V8 Project
objects-inl.h
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Review notes:
6 //
7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep.
10 //
11 
12 #ifndef V8_OBJECTS_INL_H_
13 #define V8_OBJECTS_INL_H_
14 
15 #include "src/base/atomicops.h"
16 #include "src/base/bits.h"
17 #include "src/contexts.h"
18 #include "src/conversions-inl.h"
19 #include "src/elements.h"
20 #include "src/factory.h"
21 #include "src/field-index-inl.h"
22 #include "src/heap/heap-inl.h"
23 #include "src/heap/heap.h"
26 #include "src/heap/spaces.h"
27 #include "src/heap/store-buffer.h"
28 #include "src/isolate.h"
29 #include "src/lookup.h"
30 #include "src/objects.h"
31 #include "src/property.h"
32 #include "src/prototype.h"
33 #include "src/transitions-inl.h"
35 #include "src/v8memory.h"
36 
37 namespace v8 {
38 namespace internal {
39 
40 PropertyDetails::PropertyDetails(Smi* smi) {
41  value_ = smi->value();
42 }
43 
44 
45 Smi* PropertyDetails::AsSmi() const {
46  // Ensure the upper 2 bits have the same value by sign extending it. This is
47  // necessary to be able to use the 31st bit of the property details.
48  int value = value_ << 1;
49  return Smi::FromInt(value >> 1);
50 }
51 
52 
53 PropertyDetails PropertyDetails::AsDeleted() const {
54  Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1));
55  return PropertyDetails(smi);
56 }
57 
58 
59 #define TYPE_CHECKER(type, instancetype) \
60  bool Object::Is##type() const { \
61  return Object::IsHeapObject() && \
62  HeapObject::cast(this)->map()->instance_type() == instancetype; \
63  }
64 
65 
66 #define CAST_ACCESSOR(type) \
67  type* type::cast(Object* object) { \
68  SLOW_DCHECK(object->Is##type()); \
69  return reinterpret_cast<type*>(object); \
70  } \
71  const type* type::cast(const Object* object) { \
72  SLOW_DCHECK(object->Is##type()); \
73  return reinterpret_cast<const type*>(object); \
74  }
75 
76 
77 #define INT_ACCESSORS(holder, name, offset) \
78  int holder::name() const { return READ_INT_FIELD(this, offset); } \
79  void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); }
80 
81 
82 #define ACCESSORS(holder, name, type, offset) \
83  type* holder::name() const { return type::cast(READ_FIELD(this, offset)); } \
84  void holder::set_##name(type* value, WriteBarrierMode mode) { \
85  WRITE_FIELD(this, offset, value); \
86  CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \
87  }
88 
89 
90 // Getter that returns a tagged Smi and setter that writes a tagged Smi.
91 #define ACCESSORS_TO_SMI(holder, name, offset) \
92  Smi* holder::name() const { return Smi::cast(READ_FIELD(this, offset)); } \
93  void holder::set_##name(Smi* value, WriteBarrierMode mode) { \
94  WRITE_FIELD(this, offset, value); \
95  }
96 
97 
98 // Getter that returns a Smi as an int and writes an int as a Smi.
99 #define SMI_ACCESSORS(holder, name, offset) \
100  int holder::name() const { \
101  Object* value = READ_FIELD(this, offset); \
102  return Smi::cast(value)->value(); \
103  } \
104  void holder::set_##name(int value) { \
105  WRITE_FIELD(this, offset, Smi::FromInt(value)); \
106  }
107 
108 #define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset) \
109  int holder::synchronized_##name() const { \
110  Object* value = ACQUIRE_READ_FIELD(this, offset); \
111  return Smi::cast(value)->value(); \
112  } \
113  void holder::synchronized_set_##name(int value) { \
114  RELEASE_WRITE_FIELD(this, offset, Smi::FromInt(value)); \
115  }
116 
117 #define NOBARRIER_SMI_ACCESSORS(holder, name, offset) \
118  int holder::nobarrier_##name() const { \
119  Object* value = NOBARRIER_READ_FIELD(this, offset); \
120  return Smi::cast(value)->value(); \
121  } \
122  void holder::nobarrier_set_##name(int value) { \
123  NOBARRIER_WRITE_FIELD(this, offset, Smi::FromInt(value)); \
124  }
125 
126 #define BOOL_GETTER(holder, field, name, offset) \
127  bool holder::name() const { \
128  return BooleanBit::get(field(), offset); \
129  } \
130 
131 
132 #define BOOL_ACCESSORS(holder, field, name, offset) \
133  bool holder::name() const { \
134  return BooleanBit::get(field(), offset); \
135  } \
136  void holder::set_##name(bool value) { \
137  set_##field(BooleanBit::set(field(), offset, value)); \
138  }
139 
140 
141 bool Object::IsFixedArrayBase() const {
142  return IsFixedArray() || IsFixedDoubleArray() || IsConstantPoolArray() ||
143  IsFixedTypedArrayBase() || IsExternalArray();
144 }
145 
146 
147 // External objects are not extensible, so the map check is enough.
148 bool Object::IsExternal() const {
149  return Object::IsHeapObject() &&
150  HeapObject::cast(this)->map() ==
151  HeapObject::cast(this)->GetHeap()->external_map();
152 }
153 
154 
155 bool Object::IsAccessorInfo() const {
156  return IsExecutableAccessorInfo() || IsDeclaredAccessorInfo();
157 }
158 
159 
160 bool Object::IsSmi() const {
161  return HAS_SMI_TAG(this);
162 }
163 
164 
165 bool Object::IsHeapObject() const {
166  return Internals::HasHeapObjectTag(this);
167 }
168 
169 
170 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE)
171 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE)
173 
174 
175 bool Object::IsString() const {
176  return Object::IsHeapObject()
177  && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE;
178 }
179 
180 
181 bool Object::IsName() const {
182  return IsString() || IsSymbol();
183 }
184 
185 
186 bool Object::IsUniqueName() const {
187  return IsInternalizedString() || IsSymbol();
188 }
189 
190 
191 bool Object::IsSpecObject() const {
192  return Object::IsHeapObject()
193  && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE;
194 }
195 
196 
197 bool Object::IsSpecFunction() const {
198  if (!Object::IsHeapObject()) return false;
199  InstanceType type = HeapObject::cast(this)->map()->instance_type();
200  return type == JS_FUNCTION_TYPE || type == JS_FUNCTION_PROXY_TYPE;
201 }
202 
203 
204 bool Object::IsTemplateInfo() const {
205  return IsObjectTemplateInfo() || IsFunctionTemplateInfo();
206 }
207 
208 
209 bool Object::IsInternalizedString() const {
210  if (!this->IsHeapObject()) return false;
211  uint32_t type = HeapObject::cast(this)->map()->instance_type();
213  return (type & (kIsNotStringMask | kIsNotInternalizedMask)) ==
215 }
216 
217 
218 bool Object::IsConsString() const {
219  if (!IsString()) return false;
220  return StringShape(String::cast(this)).IsCons();
221 }
222 
223 
224 bool Object::IsSlicedString() const {
225  if (!IsString()) return false;
226  return StringShape(String::cast(this)).IsSliced();
227 }
228 
229 
230 bool Object::IsSeqString() const {
231  if (!IsString()) return false;
232  return StringShape(String::cast(this)).IsSequential();
233 }
234 
235 
236 bool Object::IsSeqOneByteString() const {
237  if (!IsString()) return false;
238  return StringShape(String::cast(this)).IsSequential() &&
239  String::cast(this)->IsOneByteRepresentation();
240 }
241 
242 
243 bool Object::IsSeqTwoByteString() const {
244  if (!IsString()) return false;
245  return StringShape(String::cast(this)).IsSequential() &&
246  String::cast(this)->IsTwoByteRepresentation();
247 }
248 
249 
250 bool Object::IsExternalString() const {
251  if (!IsString()) return false;
252  return StringShape(String::cast(this)).IsExternal();
253 }
254 
255 
256 bool Object::IsExternalOneByteString() const {
257  if (!IsString()) return false;
258  return StringShape(String::cast(this)).IsExternal() &&
259  String::cast(this)->IsOneByteRepresentation();
260 }
261 
262 
263 bool Object::IsExternalTwoByteString() const {
264  if (!IsString()) return false;
265  return StringShape(String::cast(this)).IsExternal() &&
266  String::cast(this)->IsTwoByteRepresentation();
267 }
268 
269 
271  // Dictionary is covered under FixedArray.
272  return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() ||
273  IsFixedTypedArrayBase();
274 }
275 
276 
278  Handle<Object> object,
279  Representation representation) {
280  if (representation.IsSmi() && object->IsUninitialized()) {
281  return handle(Smi::FromInt(0), isolate);
282  }
283  if (!representation.IsDouble()) return object;
284  double value;
285  if (object->IsUninitialized()) {
286  value = 0;
287  } else if (object->IsMutableHeapNumber()) {
288  value = HeapNumber::cast(*object)->value();
289  } else {
290  value = object->Number();
291  }
292  return isolate->factory()->NewHeapNumber(value, MUTABLE);
293 }
294 
295 
297  Handle<Object> object,
298  Representation representation) {
299  DCHECK(!object->IsUninitialized());
300  if (!representation.IsDouble()) {
301  DCHECK(object->FitsRepresentation(representation));
302  return object;
303  }
304  return isolate->factory()->NewHeapNumber(HeapNumber::cast(*object)->value());
305 }
306 
307 
308 StringShape::StringShape(const String* str)
309  : type_(str->map()->instance_type()) {
310  set_valid();
311  DCHECK((type_ & kIsNotStringMask) == kStringTag);
312 }
313 
314 
315 StringShape::StringShape(Map* map)
316  : type_(map->instance_type()) {
317  set_valid();
318  DCHECK((type_ & kIsNotStringMask) == kStringTag);
319 }
320 
321 
322 StringShape::StringShape(InstanceType t)
323  : type_(static_cast<uint32_t>(t)) {
324  set_valid();
325  DCHECK((type_ & kIsNotStringMask) == kStringTag);
326 }
327 
328 
329 bool StringShape::IsInternalized() {
330  DCHECK(valid());
332  return (type_ & (kIsNotStringMask | kIsNotInternalizedMask)) ==
334 }
335 
336 
338  uint32_t type = map()->instance_type();
339  return (type & kStringEncodingMask) == kOneByteStringTag;
340 }
341 
342 
344  uint32_t type = map()->instance_type();
345  return (type & kStringEncodingMask) == kTwoByteStringTag;
346 }
347 
348 
350  uint32_t type = map()->instance_type();
353  DCHECK(IsFlat());
354  switch (type & (kIsIndirectStringMask | kStringEncodingMask)) {
355  case kOneByteStringTag:
356  return true;
357  case kTwoByteStringTag:
358  return false;
359  default: // Cons or sliced string. Need to go deeper.
361  }
362 }
363 
364 
366  uint32_t type = map()->instance_type();
369  DCHECK(IsFlat());
370  switch (type & (kIsIndirectStringMask | kStringEncodingMask)) {
371  case kOneByteStringTag:
372  return false;
373  case kTwoByteStringTag:
374  return true;
375  default: // Cons or sliced string. Need to go deeper.
377  }
378 }
379 
380 
382  uint32_t type = map()->instance_type();
383  return (type & kOneByteDataHintMask) == kOneByteDataHintTag ||
385 }
386 
387 
388 bool StringShape::IsCons() {
389  return (type_ & kStringRepresentationMask) == kConsStringTag;
390 }
391 
392 
393 bool StringShape::IsSliced() {
394  return (type_ & kStringRepresentationMask) == kSlicedStringTag;
395 }
396 
397 
398 bool StringShape::IsIndirect() {
399  return (type_ & kIsIndirectStringMask) == kIsIndirectStringTag;
400 }
401 
402 
403 bool StringShape::IsExternal() {
404  return (type_ & kStringRepresentationMask) == kExternalStringTag;
405 }
406 
407 
408 bool StringShape::IsSequential() {
409  return (type_ & kStringRepresentationMask) == kSeqStringTag;
410 }
411 
412 
413 StringRepresentationTag StringShape::representation_tag() {
414  uint32_t tag = (type_ & kStringRepresentationMask);
415  return static_cast<StringRepresentationTag>(tag);
416 }
417 
418 
419 uint32_t StringShape::encoding_tag() {
420  return type_ & kStringEncodingMask;
421 }
422 
423 
424 uint32_t StringShape::full_representation_tag() {
425  return (type_ & (kStringRepresentationMask | kStringEncodingMask));
426 }
427 
428 
431 
434 
435 
436 bool StringShape::IsSequentialOneByte() {
437  return full_representation_tag() == (kSeqStringTag | kOneByteStringTag);
438 }
439 
440 
441 bool StringShape::IsSequentialTwoByte() {
442  return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
443 }
444 
445 
446 bool StringShape::IsExternalOneByte() {
447  return full_representation_tag() == (kExternalStringTag | kOneByteStringTag);
448 }
449 
450 
453 
455 
456 
457 bool StringShape::IsExternalTwoByte() {
458  return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
459 }
460 
461 
464 
466 
468  DCHECK(0 <= index && index <= length_);
469  if (is_one_byte_) {
470  return static_cast<const byte*>(start_)[index];
471  } else {
472  return static_cast<const uc16*>(start_)[index];
473  }
474 }
475 
476 
478  return key->AsHandle(isolate);
479 }
480 
481 
483  return key->AsHandle(isolate);
484 }
485 
486 
488  HashTableKey* key) {
489  return key->AsHandle(isolate);
490 }
491 
492 
494  HashTableKey* key) {
495  return key->AsHandle(isolate);
496 }
497 
498 template <typename Char>
500  public:
502  : string_(string), hash_field_(0), seed_(seed) { }
503 
504  virtual uint32_t Hash() OVERRIDE {
505  hash_field_ = StringHasher::HashSequentialString<Char>(string_.start(),
506  string_.length(),
507  seed_);
508 
510  DCHECK(result != 0); // Ensure that the hash value of 0 is never computed.
511  return result;
512  }
513 
514 
516  return String::cast(other)->Hash();
517  }
518 
522 };
523 
524 
525 class OneByteStringKey : public SequentialStringKey<uint8_t> {
526  public:
528  : SequentialStringKey<uint8_t>(str, seed) { }
529 
530  virtual bool IsMatch(Object* string) OVERRIDE {
531  return String::cast(string)->IsOneByteEqualTo(string_);
532  }
533 
534  virtual Handle<Object> AsHandle(Isolate* isolate) OVERRIDE;
535 };
536 
537 
539  public:
540  SeqOneByteSubStringKey(Handle<SeqOneByteString> string, int from, int length)
541  : string_(string), from_(from), length_(length) {
542  DCHECK(string_->IsSeqOneByteString());
543  }
544 
545  virtual uint32_t Hash() OVERRIDE {
546  DCHECK(length_ >= 0);
547  DCHECK(from_ + length_ <= string_->length());
548  const uint8_t* chars = string_->GetChars() + from_;
550  chars, length_, string_->GetHeap()->HashSeed());
552  DCHECK(result != 0); // Ensure that the hash value of 0 is never computed.
553  return result;
554  }
555 
557  return String::cast(other)->Hash();
558  }
559 
560  virtual bool IsMatch(Object* string) OVERRIDE;
561  virtual Handle<Object> AsHandle(Isolate* isolate) OVERRIDE;
562 
563  private:
565  int from_;
566  int length_;
568 };
569 
570 
571 class TwoByteStringKey : public SequentialStringKey<uc16> {
572  public:
574  : SequentialStringKey<uc16>(str, seed) { }
575 
576  virtual bool IsMatch(Object* string) OVERRIDE {
577  return String::cast(string)->IsTwoByteEqualTo(string_);
578  }
579 
580  virtual Handle<Object> AsHandle(Isolate* isolate) OVERRIDE;
581 };
582 
583 
584 // Utf8StringKey carries a vector of chars as key.
585 class Utf8StringKey : public HashTableKey {
586  public:
588  : string_(string), hash_field_(0), seed_(seed) { }
589 
590  virtual bool IsMatch(Object* string) OVERRIDE {
591  return String::cast(string)->IsUtf8EqualTo(string_);
592  }
593 
594  virtual uint32_t Hash() OVERRIDE {
595  if (hash_field_ != 0) return hash_field_ >> String::kHashShift;
598  DCHECK(result != 0); // Ensure that the hash value of 0 is never computed.
599  return result;
600  }
601 
603  return String::cast(other)->Hash();
604  }
605 
607  if (hash_field_ == 0) Hash();
608  return isolate->factory()->NewInternalizedStringFromUtf8(
610  }
611 
614  int chars_; // Caches the number of characters when computing the hash code.
616 };
617 
618 
619 bool Object::IsNumber() const {
620  return IsSmi() || IsHeapNumber();
621 }
622 
623 
625 TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE)
626 
627 
628 bool Object::IsFiller() const {
629  if (!Object::IsHeapObject()) return false;
630  InstanceType instance_type = HeapObject::cast(this)->map()->instance_type();
631  return instance_type == FREE_SPACE_TYPE || instance_type == FILLER_TYPE;
632 }
633 
634 
635 bool Object::IsExternalArray() const {
636  if (!Object::IsHeapObject())
637  return false;
638  InstanceType instance_type =
639  HeapObject::cast(this)->map()->instance_type();
640  return (instance_type >= FIRST_EXTERNAL_ARRAY_TYPE &&
641  instance_type <= LAST_EXTERNAL_ARRAY_TYPE);
642 }
643 
644 
645 #define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size) \
646  TYPE_CHECKER(External##Type##Array, EXTERNAL_##TYPE##_ARRAY_TYPE) \
647  TYPE_CHECKER(Fixed##Type##Array, FIXED_##TYPE##_ARRAY_TYPE)
648 
650 #undef TYPED_ARRAY_TYPE_CHECKER
651 
652 
653 bool Object::IsFixedTypedArrayBase() const {
654  if (!Object::IsHeapObject()) return false;
655 
656  InstanceType instance_type =
657  HeapObject::cast(this)->map()->instance_type();
658  return (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE &&
659  instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE);
660 }
661 
662 
663 bool Object::IsJSReceiver() const {
665  return IsHeapObject() &&
666  HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE;
667 }
668 
669 
670 bool Object::IsJSObject() const {
672  return IsHeapObject() &&
673  HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE;
674 }
675 
676 
677 bool Object::IsJSProxy() const {
678  if (!Object::IsHeapObject()) return false;
679  return HeapObject::cast(this)->map()->IsJSProxyMap();
680 }
681 
682 
683 TYPE_CHECKER(JSFunctionProxy, JS_FUNCTION_PROXY_TYPE)
686 TYPE_CHECKER(JSSetIterator, JS_SET_ITERATOR_TYPE)
687 TYPE_CHECKER(JSMapIterator, JS_MAP_ITERATOR_TYPE)
688 TYPE_CHECKER(JSWeakMap, JS_WEAK_MAP_TYPE)
689 TYPE_CHECKER(JSWeakSet, JS_WEAK_SET_TYPE)
690 TYPE_CHECKER(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE)
692 TYPE_CHECKER(FixedArray, FIXED_ARRAY_TYPE)
693 TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE)
694 TYPE_CHECKER(ConstantPoolArray, CONSTANT_POOL_ARRAY_TYPE)
695 
696 
697 bool Object::IsJSWeakCollection() const {
698  return IsJSWeakMap() || IsJSWeakSet();
699 }
700 
701 
702 bool Object::IsDescriptorArray() const {
703  return IsFixedArray();
704 }
705 
706 
707 bool Object::IsTransitionArray() const {
708  return IsFixedArray();
709 }
710 
711 
712 bool Object::IsTypeFeedbackVector() const { return IsFixedArray(); }
713 
714 
715 bool Object::IsDeoptimizationInputData() const {
716  // Must be a fixed array.
717  if (!IsFixedArray()) return false;
718 
719  // There's no sure way to detect the difference between a fixed array and
720  // a deoptimization data array. Since this is used for asserts we can
721  // check that the length is zero or else the fixed size plus a multiple of
722  // the entry size.
723  int length = FixedArray::cast(this)->length();
724  if (length == 0) return true;
725 
727  return length >= 0 && length % DeoptimizationInputData::kDeoptEntrySize == 0;
728 }
729 
730 
731 bool Object::IsDeoptimizationOutputData() const {
732  if (!IsFixedArray()) return false;
733  // There's actually no way to see the difference between a fixed array and
734  // a deoptimization data array. Since this is used for asserts we can check
735  // that the length is plausible though.
736  if (FixedArray::cast(this)->length() % 2 != 0) return false;
737  return true;
738 }
739 
740 
741 bool Object::IsDependentCode() const {
742  if (!IsFixedArray()) return false;
743  // There's actually no way to see the difference between a fixed array and
744  // a dependent codes array.
745  return true;
746 }
747 
748 
749 bool Object::IsContext() const {
750  if (!Object::IsHeapObject()) return false;
751  Map* map = HeapObject::cast(this)->map();
752  Heap* heap = map->GetHeap();
753  return (map == heap->function_context_map() ||
754  map == heap->catch_context_map() ||
755  map == heap->with_context_map() ||
756  map == heap->native_context_map() ||
757  map == heap->block_context_map() ||
758  map == heap->module_context_map() ||
759  map == heap->global_context_map());
760 }
761 
762 
763 bool Object::IsNativeContext() const {
764  return Object::IsHeapObject() &&
765  HeapObject::cast(this)->map() ==
766  HeapObject::cast(this)->GetHeap()->native_context_map();
767 }
768 
769 
770 bool Object::IsScopeInfo() const {
771  return Object::IsHeapObject() &&
772  HeapObject::cast(this)->map() ==
773  HeapObject::cast(this)->GetHeap()->scope_info_map();
774 }
775 
776 
777 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE)
778 
779 
780 template <> inline bool Is<JSFunction>(Object* obj) {
781  return obj->IsJSFunction();
782 }
783 
784 
785 TYPE_CHECKER(Code, CODE_TYPE)
786 TYPE_CHECKER(Oddball, ODDBALL_TYPE)
787 TYPE_CHECKER(Cell, CELL_TYPE)
788 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE)
789 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE)
790 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE)
791 TYPE_CHECKER(JSModule, JS_MODULE_TYPE)
792 TYPE_CHECKER(JSValue, JS_VALUE_TYPE)
793 TYPE_CHECKER(JSDate, JS_DATE_TYPE)
794 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE)
795 
796 
797 bool Object::IsStringWrapper() const {
798  return IsJSValue() && JSValue::cast(this)->value()->IsString();
799 }
800 
801 
802 TYPE_CHECKER(Foreign, FOREIGN_TYPE)
803 
804 
805 bool Object::IsBoolean() const {
806  return IsOddball() &&
807  ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0);
808 }
809 
810 
811 TYPE_CHECKER(JSArray, JS_ARRAY_TYPE)
812 TYPE_CHECKER(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE)
813 TYPE_CHECKER(JSTypedArray, JS_TYPED_ARRAY_TYPE)
814 TYPE_CHECKER(JSDataView, JS_DATA_VIEW_TYPE)
815 
816 
817 bool Object::IsJSArrayBufferView() const {
818  return IsJSDataView() || IsJSTypedArray();
819 }
820 
821 
822 TYPE_CHECKER(JSRegExp, JS_REGEXP_TYPE)
823 
824 
825 template <> inline bool Is<JSArray>(Object* obj) {
826  return obj->IsJSArray();
827 }
828 
829 
830 bool Object::IsHashTable() const {
831  return Object::IsHeapObject() &&
832  HeapObject::cast(this)->map() ==
833  HeapObject::cast(this)->GetHeap()->hash_table_map();
834 }
835 
836 
837 bool Object::IsWeakHashTable() const {
838  return IsHashTable();
839 }
840 
841 
842 bool Object::IsDictionary() const {
843  return IsHashTable() &&
844  this != HeapObject::cast(this)->GetHeap()->string_table();
845 }
846 
847 
848 bool Object::IsNameDictionary() const {
849  return IsDictionary();
850 }
851 
852 
853 bool Object::IsSeededNumberDictionary() const {
854  return IsDictionary();
855 }
856 
857 
858 bool Object::IsUnseededNumberDictionary() const {
859  return IsDictionary();
860 }
861 
862 
863 bool Object::IsStringTable() const {
864  return IsHashTable();
865 }
866 
867 
868 bool Object::IsJSFunctionResultCache() const {
869  if (!IsFixedArray()) return false;
870  const FixedArray* self = FixedArray::cast(this);
871  int length = self->length();
872  if (length < JSFunctionResultCache::kEntriesIndex) return false;
875  return false;
876  }
877 #ifdef VERIFY_HEAP
878  if (FLAG_verify_heap) {
879  // TODO(svenpanne) We use const_cast here and below to break our dependency
880  // cycle between the predicates and the verifiers. This can be removed when
881  // the verifiers are const-correct, too.
882  reinterpret_cast<JSFunctionResultCache*>(const_cast<Object*>(this))->
883  JSFunctionResultCacheVerify();
884  }
885 #endif
886  return true;
887 }
888 
889 
890 bool Object::IsNormalizedMapCache() const {
892 }
893 
894 
897 }
898 
899 
901  if (!obj->IsFixedArray()) return false;
902  if (FixedArray::cast(obj)->length() != NormalizedMapCache::kEntries) {
903  return false;
904  }
905 #ifdef VERIFY_HEAP
906  if (FLAG_verify_heap) {
907  reinterpret_cast<NormalizedMapCache*>(const_cast<Object*>(obj))->
908  NormalizedMapCacheVerify();
909  }
910 #endif
911  return true;
912 }
913 
914 
915 bool Object::IsCompilationCacheTable() const {
916  return IsHashTable();
917 }
918 
919 
920 bool Object::IsCodeCacheHashTable() const {
921  return IsHashTable();
922 }
923 
924 
925 bool Object::IsPolymorphicCodeCacheHashTable() const {
926  return IsHashTable();
927 }
928 
929 
930 bool Object::IsMapCache() const {
931  return IsHashTable();
932 }
933 
934 
935 bool Object::IsObjectHashTable() const {
936  return IsHashTable();
937 }
938 
939 
940 bool Object::IsOrderedHashTable() const {
941  return IsHeapObject() &&
942  HeapObject::cast(this)->map() ==
943  HeapObject::cast(this)->GetHeap()->ordered_hash_table_map();
944 }
945 
946 
947 bool Object::IsOrderedHashSet() const {
948  return IsOrderedHashTable();
949 }
950 
951 
952 bool Object::IsOrderedHashMap() const {
953  return IsOrderedHashTable();
954 }
955 
956 
957 bool Object::IsPrimitive() const {
958  return IsOddball() || IsNumber() || IsString();
959 }
960 
961 
962 bool Object::IsJSGlobalProxy() const {
963  bool result = IsHeapObject() &&
964  (HeapObject::cast(this)->map()->instance_type() ==
966  DCHECK(!result ||
967  HeapObject::cast(this)->map()->is_access_check_needed());
968  return result;
969 }
970 
971 
972 bool Object::IsGlobalObject() const {
973  if (!IsHeapObject()) return false;
974 
975  InstanceType type = HeapObject::cast(this)->map()->instance_type();
976  return type == JS_GLOBAL_OBJECT_TYPE ||
977  type == JS_BUILTINS_OBJECT_TYPE;
978 }
979 
980 
981 TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE)
982 TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE)
983 
984 
985 bool Object::IsUndetectableObject() const {
986  return IsHeapObject()
987  && HeapObject::cast(this)->map()->is_undetectable();
988 }
989 
990 
991 bool Object::IsAccessCheckNeeded() const {
992  if (!IsHeapObject()) return false;
993  if (IsJSGlobalProxy()) {
994  const JSGlobalProxy* proxy = JSGlobalProxy::cast(this);
995  GlobalObject* global = proxy->GetIsolate()->context()->global_object();
996  return proxy->IsDetachedFrom(global);
997  }
998  return HeapObject::cast(this)->map()->is_access_check_needed();
999 }
1000 
1001 
1002 bool Object::IsStruct() const {
1003  if (!IsHeapObject()) return false;
1004  switch (HeapObject::cast(this)->map()->instance_type()) {
1005 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true;
1007 #undef MAKE_STRUCT_CASE
1008  default: return false;
1009  }
1010 }
1011 
1012 
1013 #define MAKE_STRUCT_PREDICATE(NAME, Name, name) \
1014  bool Object::Is##Name() const { \
1015  return Object::IsHeapObject() \
1016  && HeapObject::cast(this)->map()->instance_type() == NAME##_TYPE; \
1017  }
1019 #undef MAKE_STRUCT_PREDICATE
1020 
1021 
1022 bool Object::IsUndefined() const {
1023  return IsOddball() && Oddball::cast(this)->kind() == Oddball::kUndefined;
1024 }
1025 
1026 
1027 bool Object::IsNull() const {
1028  return IsOddball() && Oddball::cast(this)->kind() == Oddball::kNull;
1029 }
1030 
1031 
1032 bool Object::IsTheHole() const {
1033  return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTheHole;
1034 }
1035 
1036 
1037 bool Object::IsException() const {
1038  return IsOddball() && Oddball::cast(this)->kind() == Oddball::kException;
1039 }
1040 
1041 
1042 bool Object::IsUninitialized() const {
1043  return IsOddball() && Oddball::cast(this)->kind() == Oddball::kUninitialized;
1044 }
1045 
1046 
1047 bool Object::IsTrue() const {
1048  return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTrue;
1049 }
1050 
1051 
1052 bool Object::IsFalse() const {
1053  return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse;
1054 }
1055 
1056 
1057 bool Object::IsArgumentsMarker() const {
1058  return IsOddball() && Oddball::cast(this)->kind() == Oddball::kArgumentMarker;
1059 }
1060 
1061 
1062 double Object::Number() {
1063  DCHECK(IsNumber());
1064  return IsSmi()
1065  ? static_cast<double>(reinterpret_cast<Smi*>(this)->value())
1066  : reinterpret_cast<HeapNumber*>(this)->value();
1067 }
1068 
1069 
1070 bool Object::IsNaN() const {
1071  return this->IsHeapNumber() && std::isnan(HeapNumber::cast(this)->value());
1072 }
1073 
1074 
1075 bool Object::IsMinusZero() const {
1076  return this->IsHeapNumber() &&
1077  i::IsMinusZero(HeapNumber::cast(this)->value());
1078 }
1079 
1080 
1082  if (object->IsSmi()) return Handle<Smi>::cast(object);
1083  if (object->IsHeapNumber()) {
1084  double value = Handle<HeapNumber>::cast(object)->value();
1085  int int_value = FastD2I(value);
1086  if (value == FastI2D(int_value) && Smi::IsValid(int_value)) {
1087  return handle(Smi::FromInt(int_value), isolate);
1088  }
1089  }
1090  return Handle<Smi>();
1091 }
1092 
1093 
1095  Handle<Object> object) {
1096  return ToObject(
1097  isolate, object, handle(isolate->context()->native_context(), isolate));
1098 }
1099 
1100 
1102  return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
1103 }
1104 
1105 
1107  Handle<Name> name) {
1108  LookupIterator it(object, name);
1109  return GetProperty(&it);
1110 }
1111 
1112 
1114  Handle<Object> object,
1115  uint32_t index) {
1116  // GetElement can trigger a getter which can cause allocation.
1117  // This was not always the case. This DCHECK is here to catch
1118  // leftover incorrect uses.
1119  DCHECK(AllowHeapAllocation::IsAllowed());
1120  return Object::GetElementWithReceiver(isolate, object, object, index);
1121 }
1122 
1123 
1125  Handle<Name> name) {
1126  uint32_t index;
1127  Isolate* isolate = name->GetIsolate();
1128  if (name->AsArrayIndex(&index)) return GetElement(isolate, object, index);
1129  return GetProperty(object, name);
1130 }
1131 
1132 
1134  Handle<Object> object,
1135  const char* name) {
1136  Handle<String> str = isolate->factory()->InternalizeUtf8String(name);
1137  DCHECK(!str.is_null());
1138 #ifdef DEBUG
1139  uint32_t index; // Assert that the name is not an array index.
1140  DCHECK(!str->AsArrayIndex(&index));
1141 #endif // DEBUG
1142  return GetProperty(object, str);
1143 }
1144 
1145 
1147  Handle<Object> receiver,
1148  uint32_t index) {
1149  return GetPropertyWithHandler(
1150  proxy, receiver, proxy->GetIsolate()->factory()->Uint32ToString(index));
1151 }
1152 
1153 
1155  Handle<JSReceiver> receiver,
1156  uint32_t index,
1157  Handle<Object> value,
1158  StrictMode strict_mode) {
1159  Isolate* isolate = proxy->GetIsolate();
1160  Handle<String> name = isolate->factory()->Uint32ToString(index);
1161  return SetPropertyWithHandler(proxy, receiver, name, value, strict_mode);
1162 }
1163 
1164 
1166  uint32_t index) {
1167  Isolate* isolate = proxy->GetIsolate();
1168  Handle<String> name = isolate->factory()->Uint32ToString(index);
1169  return HasPropertyWithHandler(proxy, name);
1170 }
1171 
1172 
1173 #define FIELD_ADDR(p, offset) \
1174  (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag)
1175 
1176 #define FIELD_ADDR_CONST(p, offset) \
1177  (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag)
1178 
1179 #define READ_FIELD(p, offset) \
1180  (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset)))
1181 
1182 #define ACQUIRE_READ_FIELD(p, offset) \
1183  reinterpret_cast<Object*>(base::Acquire_Load( \
1184  reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR_CONST(p, offset))))
1185 
1186 #define NOBARRIER_READ_FIELD(p, offset) \
1187  reinterpret_cast<Object*>(base::NoBarrier_Load( \
1188  reinterpret_cast<const base::AtomicWord*>(FIELD_ADDR_CONST(p, offset))))
1189 
1190 #define WRITE_FIELD(p, offset, value) \
1191  (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value)
1192 
1193 #define RELEASE_WRITE_FIELD(p, offset, value) \
1194  base::Release_Store( \
1195  reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \
1196  reinterpret_cast<base::AtomicWord>(value));
1197 
1198 #define NOBARRIER_WRITE_FIELD(p, offset, value) \
1199  base::NoBarrier_Store( \
1200  reinterpret_cast<base::AtomicWord*>(FIELD_ADDR(p, offset)), \
1201  reinterpret_cast<base::AtomicWord>(value));
1202 
1203 #define WRITE_BARRIER(heap, object, offset, value) \
1204  heap->incremental_marking()->RecordWrite( \
1205  object, HeapObject::RawField(object, offset), value); \
1206  if (heap->InNewSpace(value)) { \
1207  heap->RecordWrite(object->address(), offset); \
1208  }
1209 
1210 #define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode) \
1211  if (mode == UPDATE_WRITE_BARRIER) { \
1212  heap->incremental_marking()->RecordWrite( \
1213  object, HeapObject::RawField(object, offset), value); \
1214  if (heap->InNewSpace(value)) { \
1215  heap->RecordWrite(object->address(), offset); \
1216  } \
1217  }
1218 
1219 #ifndef V8_TARGET_ARCH_MIPS
1220  #define READ_DOUBLE_FIELD(p, offset) \
1221  (*reinterpret_cast<const double*>(FIELD_ADDR_CONST(p, offset)))
1222 #else // V8_TARGET_ARCH_MIPS
1223  // Prevent gcc from using load-double (mips ldc1) on (possibly)
1224  // non-64-bit aligned HeapNumber::value.
1225  static inline double read_double_field(const void* p, int offset) {
1226  union conversion {
1227  double d;
1228  uint32_t u[2];
1229  } c;
1230  c.u[0] = (*reinterpret_cast<const uint32_t*>(
1231  FIELD_ADDR_CONST(p, offset)));
1232  c.u[1] = (*reinterpret_cast<const uint32_t*>(
1233  FIELD_ADDR_CONST(p, offset + 4)));
1234  return c.d;
1235  }
1236  #define READ_DOUBLE_FIELD(p, offset) read_double_field(p, offset)
1237 #endif // V8_TARGET_ARCH_MIPS
1238 
1239 #ifndef V8_TARGET_ARCH_MIPS
1240  #define WRITE_DOUBLE_FIELD(p, offset, value) \
1241  (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value)
1242 #else // V8_TARGET_ARCH_MIPS
1243  // Prevent gcc from using store-double (mips sdc1) on (possibly)
1244  // non-64-bit aligned HeapNumber::value.
1245  static inline void write_double_field(void* p, int offset,
1246  double value) {
1247  union conversion {
1248  double d;
1249  uint32_t u[2];
1250  } c;
1251  c.d = value;
1252  (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) = c.u[0];
1253  (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset + 4))) = c.u[1];
1254  }
1255  #define WRITE_DOUBLE_FIELD(p, offset, value) \
1256  write_double_field(p, offset, value)
1257 #endif // V8_TARGET_ARCH_MIPS
1258 
1259 
1260 #define READ_INT_FIELD(p, offset) \
1261  (*reinterpret_cast<const int*>(FIELD_ADDR_CONST(p, offset)))
1262 
1263 #define WRITE_INT_FIELD(p, offset, value) \
1264  (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value)
1265 
1266 #define READ_INTPTR_FIELD(p, offset) \
1267  (*reinterpret_cast<const intptr_t*>(FIELD_ADDR_CONST(p, offset)))
1268 
1269 #define WRITE_INTPTR_FIELD(p, offset, value) \
1270  (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value)
1271 
1272 #define READ_UINT32_FIELD(p, offset) \
1273  (*reinterpret_cast<const uint32_t*>(FIELD_ADDR_CONST(p, offset)))
1274 
1275 #define WRITE_UINT32_FIELD(p, offset, value) \
1276  (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value)
1277 
1278 #define READ_INT32_FIELD(p, offset) \
1279  (*reinterpret_cast<const int32_t*>(FIELD_ADDR_CONST(p, offset)))
1280 
1281 #define WRITE_INT32_FIELD(p, offset, value) \
1282  (*reinterpret_cast<int32_t*>(FIELD_ADDR(p, offset)) = value)
1283 
1284 #define READ_INT64_FIELD(p, offset) \
1285  (*reinterpret_cast<const int64_t*>(FIELD_ADDR_CONST(p, offset)))
1286 
1287 #define WRITE_INT64_FIELD(p, offset, value) \
1288  (*reinterpret_cast<int64_t*>(FIELD_ADDR(p, offset)) = value)
1289 
1290 #define READ_SHORT_FIELD(p, offset) \
1291  (*reinterpret_cast<const uint16_t*>(FIELD_ADDR_CONST(p, offset)))
1292 
1293 #define WRITE_SHORT_FIELD(p, offset, value) \
1294  (*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value)
1295 
1296 #define READ_BYTE_FIELD(p, offset) \
1297  (*reinterpret_cast<const byte*>(FIELD_ADDR_CONST(p, offset)))
1298 
1299 #define NOBARRIER_READ_BYTE_FIELD(p, offset) \
1300  static_cast<byte>(base::NoBarrier_Load( \
1301  reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset))))
1302 
1303 #define WRITE_BYTE_FIELD(p, offset, value) \
1304  (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value)
1305 
1306 #define NOBARRIER_WRITE_BYTE_FIELD(p, offset, value) \
1307  base::NoBarrier_Store( \
1308  reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \
1309  static_cast<base::Atomic8>(value));
1310 
1311 Object** HeapObject::RawField(HeapObject* obj, int byte_offset) {
1312  return reinterpret_cast<Object**>(FIELD_ADDR(obj, byte_offset));
1313 }
1314 
1315 
1316 int Smi::value() const {
1317  return Internals::SmiValue(this);
1318 }
1319 
1320 
1321 Smi* Smi::FromInt(int value) {
1323  return reinterpret_cast<Smi*>(Internals::IntToSmi(value));
1324 }
1325 
1326 
1327 Smi* Smi::FromIntptr(intptr_t value) {
1329  int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
1330  return reinterpret_cast<Smi*>((value << smi_shift_bits) | kSmiTag);
1331 }
1332 
1333 
1334 bool Smi::IsValid(intptr_t value) {
1335  bool result = Internals::IsValidSmi(value);
1336  DCHECK_EQ(result, value >= kMinValue && value <= kMaxValue);
1337  return result;
1338 }
1339 
1340 
1341 MapWord MapWord::FromMap(const Map* map) {
1342  return MapWord(reinterpret_cast<uintptr_t>(map));
1343 }
1344 
1345 
1346 Map* MapWord::ToMap() {
1347  return reinterpret_cast<Map*>(value_);
1348 }
1349 
1350 
1351 bool MapWord::IsForwardingAddress() {
1352  return HAS_SMI_TAG(reinterpret_cast<Object*>(value_));
1353 }
1354 
1355 
1356 MapWord MapWord::FromForwardingAddress(HeapObject* object) {
1357  Address raw = reinterpret_cast<Address>(object) - kHeapObjectTag;
1358  return MapWord(reinterpret_cast<uintptr_t>(raw));
1359 }
1360 
1361 
1362 HeapObject* MapWord::ToForwardingAddress() {
1363  DCHECK(IsForwardingAddress());
1364  return HeapObject::FromAddress(reinterpret_cast<Address>(value_));
1365 }
1366 
1367 
1368 #ifdef VERIFY_HEAP
1369 void HeapObject::VerifyObjectField(int offset) {
1370  VerifyPointer(READ_FIELD(this, offset));
1371 }
1372 
1373 void HeapObject::VerifySmiField(int offset) {
1374  CHECK(READ_FIELD(this, offset)->IsSmi());
1375 }
1376 #endif
1377 
1378 
1380  Heap* heap =
1381  MemoryChunk::FromAddress(reinterpret_cast<const byte*>(this))->heap();
1382  SLOW_DCHECK(heap != NULL);
1383  return heap;
1384 }
1385 
1386 
1388  return GetHeap()->isolate();
1389 }
1390 
1391 
1393 #ifdef DEBUG
1394  // Clear mark potentially added by PathTracer.
1395  uintptr_t raw_value =
1396  map_word().ToRawValue() & ~static_cast<uintptr_t>(PathTracer::kMarkTag);
1397  return MapWord::FromRawValue(raw_value).ToMap();
1398 #else
1399  return map_word().ToMap();
1400 #endif
1401 }
1402 
1403 
1404 void HeapObject::set_map(Map* value) {
1405  set_map_word(MapWord::FromMap(value));
1406  if (value != NULL) {
1407  // TODO(1600) We are passing NULL as a slot because maps can never be on
1408  // evacuation candidate.
1409  value->GetHeap()->incremental_marking()->RecordWrite(this, NULL, value);
1410  }
1411 }
1412 
1413 
1415  return synchronized_map_word().ToMap();
1416 }
1417 
1418 
1420  synchronized_set_map_word(MapWord::FromMap(value));
1421  if (value != NULL) {
1422  // TODO(1600) We are passing NULL as a slot because maps can never be on
1423  // evacuation candidate.
1424  value->GetHeap()->incremental_marking()->RecordWrite(this, NULL, value);
1425  }
1426 }
1427 
1428 
1430  synchronized_set_map_word(MapWord::FromMap(value));
1431 }
1432 
1433 
1434 // Unsafe accessor omitting write barrier.
1436  set_map_word(MapWord::FromMap(value));
1437 }
1438 
1439 
1440 MapWord HeapObject::map_word() const {
1441  return MapWord(
1442  reinterpret_cast<uintptr_t>(NOBARRIER_READ_FIELD(this, kMapOffset)));
1443 }
1444 
1445 
1446 void HeapObject::set_map_word(MapWord map_word) {
1448  this, kMapOffset, reinterpret_cast<Object*>(map_word.value_));
1449 }
1450 
1451 
1453  return MapWord(
1454  reinterpret_cast<uintptr_t>(ACQUIRE_READ_FIELD(this, kMapOffset)));
1455 }
1456 
1457 
1460  this, kMapOffset, reinterpret_cast<Object*>(map_word.value_));
1461 }
1462 
1463 
1466  return reinterpret_cast<HeapObject*>(address + kHeapObjectTag);
1467 }
1468 
1469 
1471  return reinterpret_cast<Address>(this) - kHeapObjectTag;
1472 }
1473 
1476  return SizeFromMap(map());
1477 }
1478 
1479 
1481  InstanceType type = map()->instance_type();
1482  if (type <= LAST_NAME_TYPE) {
1483  if (type == SYMBOL_TYPE) {
1484  return false;
1485  }
1486  DCHECK(type < FIRST_NONSTRING_TYPE);
1487  // There are four string representations: sequential strings, external
1488  // strings, cons strings, and sliced strings.
1489  // Only the former two contain raw values and no heap pointers (besides the
1490  // map-word).
1491  return ((type & kIsIndirectStringMask) != kIsIndirectStringTag);
1492  }
1493  // The ConstantPoolArray contains heap pointers, but also raw values.
1494  if (type == CONSTANT_POOL_ARRAY_TYPE) return true;
1495  return (type <= LAST_DATA_TYPE);
1496 }
1497 
1498 
1499 void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) {
1500  v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)),
1501  reinterpret_cast<Object**>(FIELD_ADDR(this, end)));
1502 }
1503 
1504 
1506  v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset)));
1507 }
1508 
1509 
1511  v->VisitNextCodeLink(reinterpret_cast<Object**>(FIELD_ADDR(this, offset)));
1512 }
1513 
1514 
1515 double HeapNumber::value() const {
1516  return READ_DOUBLE_FIELD(this, kValueOffset);
1517 }
1518 
1519 
1520 void HeapNumber::set_value(double value) {
1522 }
1523 
1524 
1526  return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >>
1528 }
1529 
1530 
1532  return READ_INT_FIELD(this, kExponentOffset) & kSignMask;
1533 }
1534 
1535 
1536 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)
1537 
1538 
1539 Object** FixedArray::GetFirstElementAddress() {
1540  return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0)));
1541 }
1542 
1543 
1545  Object* the_hole = GetHeap()->the_hole_value();
1546  Object** current = GetFirstElementAddress();
1547  for (int i = 0; i < length(); ++i) {
1548  Object* candidate = *current++;
1549  if (!candidate->IsSmi() && candidate != the_hole) return false;
1550  }
1551  return true;
1552 }
1553 
1554 
1555 FixedArrayBase* JSObject::elements() const {
1556  Object* array = READ_FIELD(this, kElementsOffset);
1557  return static_cast<FixedArrayBase*>(array);
1558 }
1559 
1560 
1562 #ifdef ENABLE_SLOW_DCHECKS
1564  ElementsAccessor* accessor = object->GetElementsAccessor();
1565  accessor->Validate(object);
1566  }
1567 #endif
1568 }
1569 
1570 
1572  set_transition_info(Smi::FromInt(0));
1574  set_nested_site(Smi::FromInt(0));
1575  set_pretenure_data(Smi::FromInt(0));
1576  set_pretenure_create_count(Smi::FromInt(0));
1577  set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()),
1579 }
1580 
1581 
1583  DCHECK(!IsZombie());
1584  Initialize();
1586 }
1587 
1588 
1589 // Heuristic: We only need to create allocation site info if the boilerplate
1590 // elements kind is the initial elements kind.
1592  ElementsKind boilerplate_elements_kind) {
1593  if (FLAG_pretenuring_call_new ||
1594  IsFastSmiElementsKind(boilerplate_elements_kind)) {
1595  return TRACK_ALLOCATION_SITE;
1596  }
1597 
1599 }
1600 
1601 
1603  ElementsKind to) {
1604  if (FLAG_pretenuring_call_new ||
1605  (IsFastSmiElementsKind(from) &&
1607  return TRACK_ALLOCATION_SITE;
1608  }
1609 
1611 }
1612 
1613 
1615  if (FLAG_allocation_site_pretenuring) {
1616  return type == JS_ARRAY_TYPE ||
1617  type == JS_OBJECT_TYPE ||
1618  type < FIRST_NONSTRING_TYPE;
1619  }
1620  return type == JS_ARRAY_TYPE;
1621 }
1622 
1623 
1625  Reason reason) {
1626  switch (reason) {
1627  case TENURING:
1629  break;
1630  case TRANSITIONS:
1632  break;
1633  }
1634  UNREACHABLE();
1636 }
1637 
1638 
1640  int value = pretenure_data()->value();
1641  // Verify that we can count more mementos than we can possibly find in one
1642  // new space collection.
1643  DCHECK((GetHeap()->MaxSemiSpaceSize() /
1647  set_pretenure_data(
1650 }
1651 
1653  if (IsZombie()) return false;
1654 
1655  int value = memento_found_count();
1656  set_memento_found_count(value + 1);
1658 }
1659 
1660 
1662  DCHECK(FLAG_allocation_site_pretenuring);
1663  int value = memento_create_count();
1664  set_memento_create_count(value + 1);
1665 }
1666 
1667 
1669  PretenureDecision current_decision,
1670  double ratio,
1671  bool maximum_size_scavenge) {
1672  // Here we just allow state transitions from undecided or maybe tenure
1673  // to don't tenure, maybe tenure, or tenure.
1674  if ((current_decision == kUndecided || current_decision == kMaybeTenure)) {
1675  if (ratio >= kPretenureRatio) {
1676  // We just transition into tenure state when the semi-space was at
1677  // maximum capacity.
1678  if (maximum_size_scavenge) {
1681  // Currently we just need to deopt when we make a state transition to
1682  // tenure.
1683  return true;
1684  }
1686  } else {
1688  }
1689  }
1690  return false;
1691 }
1692 
1693 
1695  bool maximum_size_scavenge) {
1696  bool deopt = false;
1697  int create_count = memento_create_count();
1698  int found_count = memento_found_count();
1699  bool minimum_mementos_created = create_count >= kPretenureMinimumCreated;
1700  double ratio =
1701  minimum_mementos_created || FLAG_trace_pretenuring_statistics ?
1702  static_cast<double>(found_count) / create_count : 0.0;
1703  PretenureDecision current_decision = pretenure_decision();
1704 
1705  if (minimum_mementos_created) {
1706  deopt = MakePretenureDecision(
1707  current_decision, ratio, maximum_size_scavenge);
1708  }
1709 
1710  if (FLAG_trace_pretenuring_statistics) {
1711  PrintF(
1712  "AllocationSite(%p): (created, found, ratio) (%d, %d, %f) %s => %s\n",
1713  static_cast<void*>(this), create_count, found_count, ratio,
1714  PretenureDecisionName(current_decision),
1716  }
1717 
1718  // Clear feedback calculation fields until the next gc.
1721  return deopt;
1722 }
1723 
1724 
1727  ElementsKind elements_kind = object->map()->elements_kind();
1728  if (!IsFastObjectElementsKind(elements_kind)) {
1729  if (IsFastHoleyElementsKind(elements_kind)) {
1731  } else {
1733  }
1734  }
1735 }
1736 
1737 
1739  Object** objects,
1740  uint32_t count,
1742  ElementsKind current_kind = object->map()->elements_kind();
1743  ElementsKind target_kind = current_kind;
1744  {
1745  DisallowHeapAllocation no_allocation;
1747  bool is_holey = IsFastHoleyElementsKind(current_kind);
1748  if (current_kind == FAST_HOLEY_ELEMENTS) return;
1749  Heap* heap = object->GetHeap();
1750  Object* the_hole = heap->the_hole_value();
1751  for (uint32_t i = 0; i < count; ++i) {
1752  Object* current = *objects++;
1753  if (current == the_hole) {
1754  is_holey = true;
1755  target_kind = GetHoleyElementsKind(target_kind);
1756  } else if (!current->IsSmi()) {
1757  if (mode == ALLOW_CONVERTED_DOUBLE_ELEMENTS && current->IsNumber()) {
1758  if (IsFastSmiElementsKind(target_kind)) {
1759  if (is_holey) {
1760  target_kind = FAST_HOLEY_DOUBLE_ELEMENTS;
1761  } else {
1762  target_kind = FAST_DOUBLE_ELEMENTS;
1763  }
1764  }
1765  } else if (is_holey) {
1766  target_kind = FAST_HOLEY_ELEMENTS;
1767  break;
1768  } else {
1769  target_kind = FAST_ELEMENTS;
1770  }
1771  }
1772  }
1773  }
1774  if (target_kind != current_kind) {
1775  TransitionElementsKind(object, target_kind);
1776  }
1777 }
1778 
1779 
1781  Handle<FixedArrayBase> elements,
1782  uint32_t length,
1784  Heap* heap = object->GetHeap();
1785  if (elements->map() != heap->fixed_double_array_map()) {
1786  DCHECK(elements->map() == heap->fixed_array_map() ||
1787  elements->map() == heap->fixed_cow_array_map());
1790  }
1791  Object** objects =
1792  Handle<FixedArray>::cast(elements)->GetFirstElementAddress();
1793  EnsureCanContainElements(object, objects, length, mode);
1794  return;
1795  }
1796 
1798  if (object->GetElementsKind() == FAST_HOLEY_SMI_ELEMENTS) {
1800  } else if (object->GetElementsKind() == FAST_SMI_ELEMENTS) {
1801  Handle<FixedDoubleArray> double_array =
1803  for (uint32_t i = 0; i < length; ++i) {
1804  if (double_array->is_the_hole(i)) {
1806  return;
1807  }
1808  }
1810  }
1811 }
1812 
1813 
1815  Handle<Map> new_map,
1816  Handle<FixedArrayBase> value) {
1817  JSObject::MigrateToMap(object, new_map);
1818  DCHECK((object->map()->has_fast_smi_or_object_elements() ||
1819  (*value == object->GetHeap()->empty_fixed_array())) ==
1820  (value->map() == object->GetHeap()->fixed_array_map() ||
1821  value->map() == object->GetHeap()->fixed_cow_array_map()));
1822  DCHECK((*value == object->GetHeap()->empty_fixed_array()) ||
1823  (object->map()->has_fast_double_elements() ==
1824  value->IsFixedDoubleArray()));
1825  object->set_elements(*value);
1826 }
1827 
1828 
1829 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) {
1830  WRITE_FIELD(this, kElementsOffset, value);
1832 }
1833 
1834 
1835 void JSObject::initialize_properties() {
1836  DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
1837  WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array());
1838 }
1839 
1840 
1842  FixedArrayBase* elements = map()->GetInitialElements();
1843  WRITE_FIELD(this, kElementsOffset, elements);
1844 }
1845 
1846 
1848  DisallowHeapAllocation no_gc;
1849  if (!map->HasTransitionArray()) return Handle<String>::null();
1850  TransitionArray* transitions = map->transitions();
1851  if (!transitions->IsSimpleTransition()) return Handle<String>::null();
1852  int transition = TransitionArray::kSimpleTransitionIndex;
1853  PropertyDetails details = transitions->GetTargetDetails(transition);
1854  Name* name = transitions->GetKey(transition);
1855  if (details.type() != FIELD) return Handle<String>::null();
1856  if (details.attributes() != NONE) return Handle<String>::null();
1857  if (!name->IsString()) return Handle<String>::null();
1858  return Handle<String>(String::cast(name));
1859 }
1860 
1861 
1863  DCHECK(!ExpectedTransitionKey(map).is_null());
1864  return Handle<Map>(map->transitions()->GetTarget(
1866 }
1867 
1868 
1870  DisallowHeapAllocation no_allocation;
1871  if (!map->HasTransitionArray()) return Handle<Map>::null();
1872  TransitionArray* transitions = map->transitions();
1873  int transition = transitions->Search(*key);
1874  if (transition == TransitionArray::kNotFound) return Handle<Map>::null();
1875  PropertyDetails target_details = transitions->GetTargetDetails(transition);
1876  if (target_details.type() != FIELD) return Handle<Map>::null();
1877  if (target_details.attributes() != NONE) return Handle<Map>::null();
1878  return Handle<Map>(transitions->GetTarget(transition));
1879 }
1880 
1881 
1882 ACCESSORS(Oddball, to_string, String, kToStringOffset)
1883 ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
1884 
1885 
1886 byte Oddball::kind() const {
1887  return Smi::cast(READ_FIELD(this, kKindOffset))->value();
1888 }
1889 
1890 
1891 void Oddball::set_kind(byte value) {
1892  WRITE_FIELD(this, kKindOffset, Smi::FromInt(value));
1893 }
1894 
1895 
1896 Object* Cell::value() const {
1897  return READ_FIELD(this, kValueOffset);
1898 }
1899 
1900 
1901 void Cell::set_value(Object* val, WriteBarrierMode ignored) {
1902  // The write barrier is not used for global property cells.
1903  DCHECK(!val->IsPropertyCell() && !val->IsCell());
1904  WRITE_FIELD(this, kValueOffset, val);
1905 }
1906 
1907 ACCESSORS(PropertyCell, dependent_code, DependentCode, kDependentCodeOffset)
1908 
1909 Object* PropertyCell::type_raw() const {
1910  return READ_FIELD(this, kTypeOffset);
1911 }
1912 
1913 
1914 void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) {
1915  WRITE_FIELD(this, kTypeOffset, val);
1916 }
1917 
1918 
1920  InstanceType type = map()->instance_type();
1921  // Check for the most common kind of JavaScript object before
1922  // falling into the generic switch. This speeds up the internal
1923  // field operations considerably on average.
1924  if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize;
1925  switch (type) {
1927  return JSGeneratorObject::kSize;
1928  case JS_MODULE_TYPE:
1929  return JSModule::kSize;
1930  case JS_GLOBAL_PROXY_TYPE:
1931  return JSGlobalProxy::kSize;
1932  case JS_GLOBAL_OBJECT_TYPE:
1933  return JSGlobalObject::kSize;
1935  return JSBuiltinsObject::kSize;
1936  case JS_FUNCTION_TYPE:
1937  return JSFunction::kSize;
1938  case JS_VALUE_TYPE:
1939  return JSValue::kSize;
1940  case JS_DATE_TYPE:
1941  return JSDate::kSize;
1942  case JS_ARRAY_TYPE:
1943  return JSArray::kSize;
1944  case JS_ARRAY_BUFFER_TYPE:
1945  return JSArrayBuffer::kSize;
1946  case JS_TYPED_ARRAY_TYPE:
1947  return JSTypedArray::kSize;
1948  case JS_DATA_VIEW_TYPE:
1949  return JSDataView::kSize;
1950  case JS_SET_TYPE:
1951  return JSSet::kSize;
1952  case JS_MAP_TYPE:
1953  return JSMap::kSize;
1954  case JS_SET_ITERATOR_TYPE:
1955  return JSSetIterator::kSize;
1956  case JS_MAP_ITERATOR_TYPE:
1957  return JSMapIterator::kSize;
1958  case JS_WEAK_MAP_TYPE:
1959  return JSWeakMap::kSize;
1960  case JS_WEAK_SET_TYPE:
1961  return JSWeakSet::kSize;
1962  case JS_REGEXP_TYPE:
1963  return JSRegExp::kSize;
1965  return JSObject::kHeaderSize;
1967  return JSMessageObject::kSize;
1968  default:
1969  // TODO(jkummerow): Re-enable this. Blink currently hits this
1970  // from its CustomElementConstructorBuilder.
1971  // UNREACHABLE();
1972  return 0;
1973  }
1974 }
1975 
1976 
1979  // Make sure to adjust for the number of in-object properties. These
1980  // properties do contribute to the size, but are not internal fields.
1981  return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) -
1982  map()->inobject_properties();
1983 }
1984 
1985 
1987  DCHECK(index < GetInternalFieldCount() && index >= 0);
1988  return GetHeaderSize() + (kPointerSize * index);
1989 }
1990 
1991 
1993  DCHECK(index < GetInternalFieldCount() && index >= 0);
1994  // Internal objects do follow immediately after the header, whereas in-object
1995  // properties are at the end of the object. Therefore there is no need
1996  // to adjust the index here.
1997  return READ_FIELD(this, GetHeaderSize() + (kPointerSize * index));
1998 }
1999 
2000 
2001 void JSObject::SetInternalField(int index, Object* value) {
2002  DCHECK(index < GetInternalFieldCount() && index >= 0);
2003  // Internal objects do follow immediately after the header, whereas in-object
2004  // properties are at the end of the object. Therefore there is no need
2005  // to adjust the index here.
2006  int offset = GetHeaderSize() + (kPointerSize * index);
2007  WRITE_FIELD(this, offset, value);
2008  WRITE_BARRIER(GetHeap(), this, offset, value);
2009 }
2010 
2011 
2012 void JSObject::SetInternalField(int index, Smi* value) {
2013  DCHECK(index < GetInternalFieldCount() && index >= 0);
2014  // Internal objects do follow immediately after the header, whereas in-object
2015  // properties are at the end of the object. Therefore there is no need
2016  // to adjust the index here.
2017  int offset = GetHeaderSize() + (kPointerSize * index);
2018  WRITE_FIELD(this, offset, value);
2019 }
2020 
2021 
2022 // Access fast-case object properties at index. The use of these routines
2023 // is needed to correctly distinguish between properties stored in-object and
2024 // properties stored in the properties array.
2026  if (index.is_inobject()) {
2027  return READ_FIELD(this, index.offset());
2028  } else {
2029  return properties()->get(index.outobject_array_index());
2030  }
2031 }
2032 
2033 
2034 void JSObject::FastPropertyAtPut(FieldIndex index, Object* value) {
2035  if (index.is_inobject()) {
2036  int offset = index.offset();
2037  WRITE_FIELD(this, offset, value);
2038  WRITE_BARRIER(GetHeap(), this, offset, value);
2039  } else {
2040  properties()->set(index.outobject_array_index(), value);
2041  }
2042 }
2043 
2044 
2046  return map()->GetInObjectPropertyOffset(index);
2047 }
2048 
2049 
2051  int offset = GetInObjectPropertyOffset(index);
2052  return READ_FIELD(this, offset);
2053 }
2054 
2055 
2057  Object* value,
2059  // Adjust for the number of properties stored in the object.
2060  int offset = GetInObjectPropertyOffset(index);
2061  WRITE_FIELD(this, offset, value);
2062  CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode);
2063  return value;
2064 }
2065 
2066 
2067 
2069  Object* pre_allocated_value,
2070  Object* filler_value) {
2071  DCHECK(!filler_value->IsHeapObject() ||
2072  !GetHeap()->InNewSpace(filler_value));
2073  DCHECK(!pre_allocated_value->IsHeapObject() ||
2074  !GetHeap()->InNewSpace(pre_allocated_value));
2075  int size = map->instance_size();
2076  int offset = kHeaderSize;
2077  if (filler_value != pre_allocated_value) {
2078  int pre_allocated = map->pre_allocated_property_fields();
2079  DCHECK(pre_allocated * kPointerSize + kHeaderSize <= size);
2080  for (int i = 0; i < pre_allocated; i++) {
2081  WRITE_FIELD(this, offset, pre_allocated_value);
2082  offset += kPointerSize;
2083  }
2084  }
2085  while (offset < size) {
2086  WRITE_FIELD(this, offset, filler_value);
2087  offset += kPointerSize;
2088  }
2089 }
2090 
2091 
2093  DCHECK(properties()->IsDictionary() == map()->is_dictionary_map());
2094  return !properties()->IsDictionary();
2095 }
2096 
2097 
2099  if (unused_property_fields() != 0) return false;
2100  if (is_prototype_map()) return false;
2101  int minimum = store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ? 128 : 12;
2102  int limit = Max(minimum, inobject_properties());
2103  int external = NumberOfFields() - inobject_properties();
2104  return external > limit;
2105 }
2106 
2107 
2108 void Struct::InitializeBody(int object_size) {
2109  Object* value = GetHeap()->undefined_value();
2110  for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
2111  WRITE_FIELD(this, offset, value);
2112  }
2113 }
2114 
2115 
2117  if (IsSmi()) {
2118  int value = Smi::cast(this)->value();
2119  if (value < 0) return false;
2120  *index = value;
2121  return true;
2122  }
2123  if (IsHeapNumber()) {
2124  double value = HeapNumber::cast(this)->value();
2125  uint32_t uint_value = static_cast<uint32_t>(value);
2126  if (value == static_cast<double>(uint_value)) {
2127  *index = uint_value;
2128  return true;
2129  }
2130  }
2131  return false;
2132 }
2133 
2134 
2136  if (!this->IsJSValue()) return false;
2137 
2138  JSValue* js_value = JSValue::cast(this);
2139  if (!js_value->value()->IsString()) return false;
2140 
2141  String* str = String::cast(js_value->value());
2142  if (index >= static_cast<uint32_t>(str->length())) return false;
2143 
2144  return true;
2145 }
2146 
2147 
2149 #if ENABLE_EXTRA_CHECKS
2150  if (!(IsSmi() ||
2151  IsString() ||
2152  IsSymbol() ||
2153  IsSpecObject() ||
2154  IsHeapNumber() ||
2155  IsUndefined() ||
2156  IsTrue() ||
2157  IsFalse() ||
2158  IsNull())) {
2159  FATAL("API call returned invalid object");
2160  }
2161 #endif // ENABLE_EXTRA_CHECKS
2162 }
2163 
2164 
2166  SLOW_DCHECK(index >= 0 && index < this->length());
2167  return READ_FIELD(this, kHeaderSize + index * kPointerSize);
2168 }
2169 
2170 
2172  return handle(array->get(index), array->GetIsolate());
2173 }
2174 
2175 
2176 bool FixedArray::is_the_hole(int index) {
2177  return get(index) == GetHeap()->the_hole_value();
2178 }
2179 
2180 
2181 void FixedArray::set(int index, Smi* value) {
2182  DCHECK(map() != GetHeap()->fixed_cow_array_map());
2183  DCHECK(index >= 0 && index < this->length());
2184  DCHECK(reinterpret_cast<Object*>(value)->IsSmi());
2185  int offset = kHeaderSize + index * kPointerSize;
2186  WRITE_FIELD(this, offset, value);
2187 }
2188 
2189 
2190 void FixedArray::set(int index, Object* value) {
2191  DCHECK_NE(GetHeap()->fixed_cow_array_map(), map());
2192  DCHECK_EQ(FIXED_ARRAY_TYPE, map()->instance_type());
2193  DCHECK(index >= 0 && index < this->length());
2194  int offset = kHeaderSize + index * kPointerSize;
2195  WRITE_FIELD(this, offset, value);
2196  WRITE_BARRIER(GetHeap(), this, offset, value);
2197 }
2198 
2199 
2200 inline bool FixedDoubleArray::is_the_hole_nan(double value) {
2201  return bit_cast<uint64_t, double>(value) == kHoleNanInt64;
2202 }
2203 
2204 
2206  return bit_cast<double, uint64_t>(kHoleNanInt64);
2207 }
2208 
2209 
2211  DCHECK(bit_cast<uint64_t>(base::OS::nan_value()) != kHoleNanInt64);
2212  DCHECK((bit_cast<uint64_t>(base::OS::nan_value()) >> 32) != kHoleNanUpper32);
2213  return base::OS::nan_value();
2214 }
2215 
2216 
2217 double FixedDoubleArray::get_scalar(int index) {
2218  DCHECK(map() != GetHeap()->fixed_cow_array_map() &&
2219  map() != GetHeap()->fixed_array_map());
2220  DCHECK(index >= 0 && index < this->length());
2221  double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize);
2222  DCHECK(!is_the_hole_nan(result));
2223  return result;
2224 }
2225 
2227  DCHECK(map() != GetHeap()->fixed_cow_array_map() &&
2228  map() != GetHeap()->fixed_array_map());
2229  DCHECK(index >= 0 && index < this->length());
2230  return READ_INT64_FIELD(this, kHeaderSize + index * kDoubleSize);
2231 }
2232 
2233 
2235  int index) {
2236  if (array->is_the_hole(index)) {
2237  return array->GetIsolate()->factory()->the_hole_value();
2238  } else {
2239  return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index));
2240  }
2241 }
2242 
2243 
2244 void FixedDoubleArray::set(int index, double value) {
2245  DCHECK(map() != GetHeap()->fixed_cow_array_map() &&
2246  map() != GetHeap()->fixed_array_map());
2247  int offset = kHeaderSize + index * kDoubleSize;
2248  if (std::isnan(value)) value = canonical_not_the_hole_nan_as_double();
2249  WRITE_DOUBLE_FIELD(this, offset, value);
2250 }
2251 
2252 
2254  DCHECK(map() != GetHeap()->fixed_cow_array_map() &&
2255  map() != GetHeap()->fixed_array_map());
2256  int offset = kHeaderSize + index * kDoubleSize;
2257  WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double());
2258 }
2259 
2260 
2262  int offset = kHeaderSize + index * kDoubleSize;
2263  return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset));
2264 }
2265 
2266 
2268  return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize));
2269 }
2270 
2271 
2273  for (int i = from; i < to; i++) {
2274  set_the_hole(i);
2275  }
2276 }
2277 
2278 
2279 void ConstantPoolArray::NumberOfEntries::increment(Type type) {
2280  DCHECK(type < NUMBER_OF_TYPES);
2281  element_counts_[type]++;
2282 }
2283 
2284 
2285 int ConstantPoolArray::NumberOfEntries::equals(
2286  const ConstantPoolArray::NumberOfEntries& other) const {
2287  for (int i = 0; i < NUMBER_OF_TYPES; i++) {
2288  if (element_counts_[i] != other.element_counts_[i]) return false;
2289  }
2290  return true;
2291 }
2292 
2293 
2294 bool ConstantPoolArray::NumberOfEntries::is_empty() const {
2295  return total_count() == 0;
2296 }
2297 
2298 
2299 int ConstantPoolArray::NumberOfEntries::count_of(Type type) const {
2300  DCHECK(type < NUMBER_OF_TYPES);
2301  return element_counts_[type];
2302 }
2303 
2304 
2305 int ConstantPoolArray::NumberOfEntries::base_of(Type type) const {
2306  int base = 0;
2307  DCHECK(type < NUMBER_OF_TYPES);
2308  for (int i = 0; i < type; i++) {
2309  base += element_counts_[i];
2310  }
2311  return base;
2312 }
2313 
2314 
2315 int ConstantPoolArray::NumberOfEntries::total_count() const {
2316  int count = 0;
2317  for (int i = 0; i < NUMBER_OF_TYPES; i++) {
2318  count += element_counts_[i];
2319  }
2320  return count;
2321 }
2322 
2323 
2324 int ConstantPoolArray::NumberOfEntries::are_in_range(int min, int max) const {
2325  for (int i = FIRST_TYPE; i < NUMBER_OF_TYPES; i++) {
2326  if (element_counts_[i] < min || element_counts_[i] > max) {
2327  return false;
2328  }
2329  }
2330  return true;
2331 }
2332 
2333 
2334 int ConstantPoolArray::Iterator::next_index() {
2335  DCHECK(!is_finished());
2336  int ret = next_index_++;
2337  update_section();
2338  return ret;
2339 }
2340 
2341 
2342 bool ConstantPoolArray::Iterator::is_finished() {
2343  return next_index_ > array_->last_index(type_, final_section_);
2344 }
2345 
2346 
2347 void ConstantPoolArray::Iterator::update_section() {
2348  if (next_index_ > array_->last_index(type_, current_section_) &&
2349  current_section_ != final_section_) {
2350  DCHECK(final_section_ == EXTENDED_SECTION);
2351  current_section_ = EXTENDED_SECTION;
2352  next_index_ = array_->first_index(type_, EXTENDED_SECTION);
2353  }
2354 }
2355 
2356 
2358  uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset);
2359  return IsExtendedField::decode(small_layout_1);
2360 }
2361 
2362 
2365 }
2366 
2367 
2370  uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset);
2371  return TotalCountField::decode(small_layout_2);
2372 }
2373 
2374 
2376  return RoundUp(SizeFor(NumberOfEntries(this, SMALL_SECTION)), kInt64Size);
2377 }
2378 
2379 
2381  uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset);
2382  return WeakObjectStateField::decode(small_layout_2);
2383 }
2384 
2385 
2388  uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset);
2389  small_layout_2 = WeakObjectStateField::update(small_layout_2, state);
2390  WRITE_INT32_FIELD(this, kSmallLayout2Offset, small_layout_2);
2391 }
2392 
2393 
2395  int index = 0;
2396  if (section == EXTENDED_SECTION) {
2398  index += first_extended_section_index();
2399  }
2400 
2401  for (Type type_iter = FIRST_TYPE; type_iter < type;
2402  type_iter = next_type(type_iter)) {
2403  index += number_of_entries(type_iter, section);
2404  }
2405 
2406  return index;
2407 }
2408 
2409 
2411  return first_index(type, section) + number_of_entries(type, section) - 1;
2412 }
2413 
2414 
2416  if (section == SMALL_SECTION) {
2417  uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset);
2418  uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset);
2419  switch (type) {
2420  case INT64:
2421  return Int64CountField::decode(small_layout_1);
2422  case CODE_PTR:
2423  return CodePtrCountField::decode(small_layout_1);
2424  case HEAP_PTR:
2425  return HeapPtrCountField::decode(small_layout_1);
2426  case INT32:
2427  return Int32CountField::decode(small_layout_2);
2428  default:
2429  UNREACHABLE();
2430  return 0;
2431  }
2432  } else {
2433  DCHECK(section == EXTENDED_SECTION && is_extended_layout());
2434  int offset = get_extended_section_header_offset();
2435  switch (type) {
2436  case INT64:
2437  offset += kExtendedInt64CountOffset;
2438  break;
2439  case CODE_PTR:
2440  offset += kExtendedCodePtrCountOffset;
2441  break;
2442  case HEAP_PTR:
2443  offset += kExtendedHeapPtrCountOffset;
2444  break;
2445  case INT32:
2446  offset += kExtendedInt32CountOffset;
2447  break;
2448  default:
2449  UNREACHABLE();
2450  }
2451  return READ_INT_FIELD(this, offset);
2452  }
2453 }
2454 
2455 
2456 bool ConstantPoolArray::offset_is_type(int offset, Type type) {
2457  return (offset >= OffsetOfElementAt(first_index(type, SMALL_SECTION)) &&
2458  offset <= OffsetOfElementAt(last_index(type, SMALL_SECTION))) ||
2459  (is_extended_layout() &&
2460  offset >= OffsetOfElementAt(first_index(type, EXTENDED_SECTION)) &&
2461  offset <= OffsetOfElementAt(last_index(type, EXTENDED_SECTION)));
2462 }
2463 
2464 
2466  LayoutSection section;
2467  if (is_extended_layout() && index >= first_extended_section_index()) {
2468  section = EXTENDED_SECTION;
2469  } else {
2470  section = SMALL_SECTION;
2471  }
2472 
2473  Type type = FIRST_TYPE;
2474  while (index > last_index(type, section)) {
2475  type = next_type(type);
2476  }
2477  DCHECK(type <= LAST_TYPE);
2478  return type;
2479 }
2480 
2481 
2483  DCHECK(map() == GetHeap()->constant_pool_array_map());
2484  DCHECK(get_type(index) == INT64);
2485  return READ_INT64_FIELD(this, OffsetOfElementAt(index));
2486 }
2487 
2488 
2491  DCHECK(map() == GetHeap()->constant_pool_array_map());
2492  DCHECK(get_type(index) == INT64);
2493  return READ_DOUBLE_FIELD(this, OffsetOfElementAt(index));
2494 }
2495 
2496 
2498  DCHECK(map() == GetHeap()->constant_pool_array_map());
2499  DCHECK(get_type(index) == CODE_PTR);
2500  return reinterpret_cast<Address>(READ_FIELD(this, OffsetOfElementAt(index)));
2501 }
2502 
2503 
2505  DCHECK(map() == GetHeap()->constant_pool_array_map());
2506  DCHECK(get_type(index) == HEAP_PTR);
2507  return READ_FIELD(this, OffsetOfElementAt(index));
2508 }
2509 
2510 
2512  DCHECK(map() == GetHeap()->constant_pool_array_map());
2513  DCHECK(get_type(index) == INT32);
2514  return READ_INT32_FIELD(this, OffsetOfElementAt(index));
2515 }
2516 
2517 
2518 void ConstantPoolArray::set(int index, int64_t value) {
2519  DCHECK(map() == GetHeap()->constant_pool_array_map());
2520  DCHECK(get_type(index) == INT64);
2521  WRITE_INT64_FIELD(this, OffsetOfElementAt(index), value);
2522 }
2523 
2524 
2525 void ConstantPoolArray::set(int index, double value) {
2527  DCHECK(map() == GetHeap()->constant_pool_array_map());
2528  DCHECK(get_type(index) == INT64);
2529  WRITE_DOUBLE_FIELD(this, OffsetOfElementAt(index), value);
2530 }
2531 
2532 
2533 void ConstantPoolArray::set(int index, Address value) {
2534  DCHECK(map() == GetHeap()->constant_pool_array_map());
2535  DCHECK(get_type(index) == CODE_PTR);
2536  WRITE_FIELD(this, OffsetOfElementAt(index), reinterpret_cast<Object*>(value));
2537 }
2538 
2539 
2540 void ConstantPoolArray::set(int index, Object* value) {
2541  DCHECK(map() == GetHeap()->constant_pool_array_map());
2542  DCHECK(!GetHeap()->InNewSpace(value));
2543  DCHECK(get_type(index) == HEAP_PTR);
2544  WRITE_FIELD(this, OffsetOfElementAt(index), value);
2545  WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value);
2546 }
2547 
2548 
2549 void ConstantPoolArray::set(int index, int32_t value) {
2550  DCHECK(map() == GetHeap()->constant_pool_array_map());
2551  DCHECK(get_type(index) == INT32);
2552  WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value);
2553 }
2554 
2555 
2557  DCHECK(map() == GetHeap()->constant_pool_array_map());
2558  DCHECK(offset_is_type(offset, INT32));
2559  WRITE_INT32_FIELD(this, offset, value);
2560 }
2561 
2562 
2563 void ConstantPoolArray::set_at_offset(int offset, int64_t value) {
2564  DCHECK(map() == GetHeap()->constant_pool_array_map());
2565  DCHECK(offset_is_type(offset, INT64));
2566  WRITE_INT64_FIELD(this, offset, value);
2567 }
2568 
2569 
2570 void ConstantPoolArray::set_at_offset(int offset, double value) {
2571  DCHECK(map() == GetHeap()->constant_pool_array_map());
2572  DCHECK(offset_is_type(offset, INT64));
2573  WRITE_DOUBLE_FIELD(this, offset, value);
2574 }
2575 
2576 
2578  DCHECK(map() == GetHeap()->constant_pool_array_map());
2579  DCHECK(offset_is_type(offset, CODE_PTR));
2580  WRITE_FIELD(this, offset, reinterpret_cast<Object*>(value));
2581  WRITE_BARRIER(GetHeap(), this, offset, reinterpret_cast<Object*>(value));
2582 }
2583 
2584 
2585 void ConstantPoolArray::set_at_offset(int offset, Object* value) {
2586  DCHECK(map() == GetHeap()->constant_pool_array_map());
2587  DCHECK(!GetHeap()->InNewSpace(value));
2588  DCHECK(offset_is_type(offset, HEAP_PTR));
2589  WRITE_FIELD(this, offset, value);
2590  WRITE_BARRIER(GetHeap(), this, offset, value);
2591 }
2592 
2593 
2594 void ConstantPoolArray::Init(const NumberOfEntries& small) {
2595  uint32_t small_layout_1 =
2596  Int64CountField::encode(small.count_of(INT64)) |
2597  CodePtrCountField::encode(small.count_of(CODE_PTR)) |
2598  HeapPtrCountField::encode(small.count_of(HEAP_PTR)) |
2599  IsExtendedField::encode(false);
2600  uint32_t small_layout_2 =
2601  Int32CountField::encode(small.count_of(INT32)) |
2602  TotalCountField::encode(small.total_count()) |
2604  WRITE_UINT32_FIELD(this, kSmallLayout1Offset, small_layout_1);
2605  WRITE_UINT32_FIELD(this, kSmallLayout2Offset, small_layout_2);
2606  if (kHeaderSize != kFirstEntryOffset) {
2608  WRITE_UINT32_FIELD(this, kHeaderSize, 0); // Zero out header padding.
2609  }
2610 }
2611 
2612 
2613 void ConstantPoolArray::InitExtended(const NumberOfEntries& small,
2614  const NumberOfEntries& extended) {
2615  // Initialize small layout fields first.
2616  Init(small);
2617 
2618  // Set is_extended_layout field.
2619  uint32_t small_layout_1 = READ_UINT32_FIELD(this, kSmallLayout1Offset);
2620  small_layout_1 = IsExtendedField::update(small_layout_1, true);
2621  WRITE_INT32_FIELD(this, kSmallLayout1Offset, small_layout_1);
2622 
2623  // Initialize the extended layout fields.
2624  int extended_header_offset = get_extended_section_header_offset();
2625  WRITE_INT_FIELD(this, extended_header_offset + kExtendedInt64CountOffset,
2626  extended.count_of(INT64));
2627  WRITE_INT_FIELD(this, extended_header_offset + kExtendedCodePtrCountOffset,
2628  extended.count_of(CODE_PTR));
2629  WRITE_INT_FIELD(this, extended_header_offset + kExtendedHeapPtrCountOffset,
2630  extended.count_of(HEAP_PTR));
2631  WRITE_INT_FIELD(this, extended_header_offset + kExtendedInt32CountOffset,
2632  extended.count_of(INT32));
2633 }
2634 
2635 
2637  NumberOfEntries small(this, SMALL_SECTION);
2638  if (!is_extended_layout()) {
2639  return SizeFor(small);
2640  } else {
2641  NumberOfEntries extended(this, EXTENDED_SECTION);
2642  return SizeForExtended(small, extended);
2643  }
2644 }
2645 
2646 
2648  uint32_t small_layout_2 = READ_UINT32_FIELD(this, kSmallLayout2Offset);
2649  int length = TotalCountField::decode(small_layout_2);
2650  if (is_extended_layout()) {
2655  }
2656  return length;
2657 }
2658 
2659 
2661  const DisallowHeapAllocation& promise) {
2662  Heap* heap = GetHeap();
2663  if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER;
2664  if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER;
2665  return UPDATE_WRITE_BARRIER;
2666 }
2667 
2668 
2669 void FixedArray::set(int index,
2670  Object* value,
2672  DCHECK(map() != GetHeap()->fixed_cow_array_map());
2673  DCHECK(index >= 0 && index < this->length());
2674  int offset = kHeaderSize + index * kPointerSize;
2675  WRITE_FIELD(this, offset, value);
2676  CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode);
2677 }
2678 
2679 
2681  int index,
2682  Object* value) {
2683  DCHECK(array->map() != array->GetHeap()->fixed_cow_array_map());
2684  DCHECK(index >= 0 && index < array->length());
2685  int offset = kHeaderSize + index * kPointerSize;
2686  WRITE_FIELD(array, offset, value);
2687  Heap* heap = array->GetHeap();
2688  if (heap->InNewSpace(value)) {
2689  heap->RecordWrite(array->address(), offset);
2690  }
2691 }
2692 
2693 
2695  int index,
2696  Object* value) {
2697  DCHECK(array->map() != array->GetHeap()->fixed_cow_array_map());
2698  DCHECK(index >= 0 && index < array->length());
2699  DCHECK(!array->GetHeap()->InNewSpace(value));
2700  WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value);
2701 }
2702 
2703 
2704 void FixedArray::set_undefined(int index) {
2705  DCHECK(map() != GetHeap()->fixed_cow_array_map());
2706  DCHECK(index >= 0 && index < this->length());
2707  DCHECK(!GetHeap()->InNewSpace(GetHeap()->undefined_value()));
2708  WRITE_FIELD(this,
2709  kHeaderSize + index * kPointerSize,
2710  GetHeap()->undefined_value());
2711 }
2712 
2713 
2714 void FixedArray::set_null(int index) {
2715  DCHECK(index >= 0 && index < this->length());
2716  DCHECK(!GetHeap()->InNewSpace(GetHeap()->null_value()));
2717  WRITE_FIELD(this,
2718  kHeaderSize + index * kPointerSize,
2719  GetHeap()->null_value());
2720 }
2721 
2722 
2723 void FixedArray::set_the_hole(int index) {
2724  DCHECK(map() != GetHeap()->fixed_cow_array_map());
2725  DCHECK(index >= 0 && index < this->length());
2726  DCHECK(!GetHeap()->InNewSpace(GetHeap()->the_hole_value()));
2727  WRITE_FIELD(this,
2728  kHeaderSize + index * kPointerSize,
2729  GetHeap()->the_hole_value());
2730 }
2731 
2732 
2733 void FixedArray::FillWithHoles(int from, int to) {
2734  for (int i = from; i < to; i++) {
2735  set_the_hole(i);
2736  }
2737 }
2738 
2739 
2741  return HeapObject::RawField(this, kHeaderSize);
2742 }
2743 
2744 
2746  DCHECK(length() >= kFirstIndex ||
2747  this == GetHeap()->empty_descriptor_array());
2748  return length() < kFirstIndex;
2749 }
2750 
2751 
2752 void DescriptorArray::SetNumberOfDescriptors(int number_of_descriptors) {
2753  WRITE_FIELD(
2755 }
2756 
2757 
2758 // Perform a binary search in a fixed array. Low and high are entry indices. If
2759 // there are three entries in this array it should be called with low=0 and
2760 // high=2.
2761 template<SearchMode search_mode, typename T>
2762 int BinarySearch(T* array, Name* name, int low, int high, int valid_entries) {
2763  uint32_t hash = name->Hash();
2764  int limit = high;
2765 
2766  DCHECK(low <= high);
2767 
2768  while (low != high) {
2769  int mid = (low + high) / 2;
2770  Name* mid_name = array->GetSortedKey(mid);
2771  uint32_t mid_hash = mid_name->Hash();
2772 
2773  if (mid_hash >= hash) {
2774  high = mid;
2775  } else {
2776  low = mid + 1;
2777  }
2778  }
2779 
2780  for (; low <= limit; ++low) {
2781  int sort_index = array->GetSortedKeyIndex(low);
2782  Name* entry = array->GetKey(sort_index);
2783  if (entry->Hash() != hash) break;
2784  if (entry->Equals(name)) {
2785  if (search_mode == ALL_ENTRIES || sort_index < valid_entries) {
2786  return sort_index;
2787  }
2788  return T::kNotFound;
2789  }
2790  }
2791 
2792  return T::kNotFound;
2793 }
2794 
2795 
2796 // Perform a linear search in this fixed array. len is the number of entry
2797 // indices that are valid.
2798 template<SearchMode search_mode, typename T>
2799 int LinearSearch(T* array, Name* name, int len, int valid_entries) {
2800  uint32_t hash = name->Hash();
2801  if (search_mode == ALL_ENTRIES) {
2802  for (int number = 0; number < len; number++) {
2803  int sorted_index = array->GetSortedKeyIndex(number);
2804  Name* entry = array->GetKey(sorted_index);
2805  uint32_t current_hash = entry->Hash();
2806  if (current_hash > hash) break;
2807  if (current_hash == hash && entry->Equals(name)) return sorted_index;
2808  }
2809  } else {
2810  DCHECK(len >= valid_entries);
2811  for (int number = 0; number < valid_entries; number++) {
2812  Name* entry = array->GetKey(number);
2813  uint32_t current_hash = entry->Hash();
2814  if (current_hash == hash && entry->Equals(name)) return number;
2815  }
2816  }
2817  return T::kNotFound;
2818 }
2819 
2820 
2821 template<SearchMode search_mode, typename T>
2822 int Search(T* array, Name* name, int valid_entries) {
2823  if (search_mode == VALID_ENTRIES) {
2824  SLOW_DCHECK(array->IsSortedNoDuplicates(valid_entries));
2825  } else {
2826  SLOW_DCHECK(array->IsSortedNoDuplicates());
2827  }
2828 
2829  int nof = array->number_of_entries();
2830  if (nof == 0) return T::kNotFound;
2831 
2832  // Fast case: do linear search for small arrays.
2833  const int kMaxElementsForLinearSearch = 8;
2834  if ((search_mode == ALL_ENTRIES &&
2835  nof <= kMaxElementsForLinearSearch) ||
2836  (search_mode == VALID_ENTRIES &&
2837  valid_entries <= (kMaxElementsForLinearSearch * 3))) {
2838  return LinearSearch<search_mode>(array, name, nof, valid_entries);
2839  }
2840 
2841  // Slow case: perform binary search.
2842  return BinarySearch<search_mode>(array, name, 0, nof - 1, valid_entries);
2843 }
2844 
2845 
2846 int DescriptorArray::Search(Name* name, int valid_descriptors) {
2847  return internal::Search<VALID_ENTRIES>(this, name, valid_descriptors);
2848 }
2849 
2850 
2851 int DescriptorArray::SearchWithCache(Name* name, Map* map) {
2852  int number_of_own_descriptors = map->NumberOfOwnDescriptors();
2853  if (number_of_own_descriptors == 0) return kNotFound;
2854 
2855  DescriptorLookupCache* cache = GetIsolate()->descriptor_lookup_cache();
2856  int number = cache->Lookup(map, name);
2857 
2858  if (number == DescriptorLookupCache::kAbsent) {
2859  number = Search(name, number_of_own_descriptors);
2860  cache->Update(map, name, number);
2861  }
2862 
2863  return number;
2864 }
2865 
2866 
2868  return instance_descriptors()->GetDetails(LastAdded());
2869 }
2870 
2871 
2873  Name* name,
2874  LookupResult* result) {
2875  DescriptorArray* descriptors = this->instance_descriptors();
2876  int number = descriptors->SearchWithCache(name, this);
2877  if (number == DescriptorArray::kNotFound) return result->NotFound();
2878  result->DescriptorResult(holder, descriptors->GetDetails(number), number);
2879 }
2880 
2881 
2883  Name* name,
2884  LookupResult* result) {
2885  int transition_index = this->SearchTransition(name);
2886  if (transition_index == TransitionArray::kNotFound) return result->NotFound();
2887  result->TransitionResult(holder, this->GetTransition(transition_index));
2888 }
2889 
2890 
2894  DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
2895  return GetHeap()->empty_fixed_array();
2896  } else if (has_external_array_elements()) {
2897  ExternalArray* empty_array = GetHeap()->EmptyExternalArrayForMap(this);
2898  DCHECK(!GetHeap()->InNewSpace(empty_array));
2899  return empty_array;
2900  } else if (has_fixed_typed_array_elements()) {
2901  FixedTypedArrayBase* empty_array =
2903  DCHECK(!GetHeap()->InNewSpace(empty_array));
2904  return empty_array;
2905  } else {
2906  UNREACHABLE();
2907  }
2908  return NULL;
2909 }
2910 
2911 
2912 Object** DescriptorArray::GetKeySlot(int descriptor_number) {
2913  DCHECK(descriptor_number < number_of_descriptors());
2914  return RawFieldOfElementAt(ToKeyIndex(descriptor_number));
2915 }
2916 
2917 
2919  return GetKeySlot(descriptor_number);
2920 }
2921 
2922 
2924  return GetValueSlot(descriptor_number - 1) + 1;
2925 }
2926 
2927 
2928 Name* DescriptorArray::GetKey(int descriptor_number) {
2929  DCHECK(descriptor_number < number_of_descriptors());
2930  return Name::cast(get(ToKeyIndex(descriptor_number)));
2931 }
2932 
2933 
2934 int DescriptorArray::GetSortedKeyIndex(int descriptor_number) {
2935  return GetDetails(descriptor_number).pointer();
2936 }
2937 
2938 
2939 Name* DescriptorArray::GetSortedKey(int descriptor_number) {
2940  return GetKey(GetSortedKeyIndex(descriptor_number));
2941 }
2942 
2943 
2944 void DescriptorArray::SetSortedKey(int descriptor_index, int pointer) {
2945  PropertyDetails details = GetDetails(descriptor_index);
2946  set(ToDetailsIndex(descriptor_index), details.set_pointer(pointer).AsSmi());
2947 }
2948 
2949 
2950 void DescriptorArray::SetRepresentation(int descriptor_index,
2951  Representation representation) {
2952  DCHECK(!representation.IsNone());
2953  PropertyDetails details = GetDetails(descriptor_index);
2954  set(ToDetailsIndex(descriptor_index),
2955  details.CopyWithRepresentation(representation).AsSmi());
2956 }
2957 
2958 
2959 Object** DescriptorArray::GetValueSlot(int descriptor_number) {
2960  DCHECK(descriptor_number < number_of_descriptors());
2961  return RawFieldOfElementAt(ToValueIndex(descriptor_number));
2962 }
2963 
2964 
2965 int DescriptorArray::GetValueOffset(int descriptor_number) {
2966  return OffsetOfElementAt(ToValueIndex(descriptor_number));
2967 }
2968 
2969 
2970 Object* DescriptorArray::GetValue(int descriptor_number) {
2971  DCHECK(descriptor_number < number_of_descriptors());
2972  return get(ToValueIndex(descriptor_number));
2973 }
2974 
2975 
2976 void DescriptorArray::SetValue(int descriptor_index, Object* value) {
2977  set(ToValueIndex(descriptor_index), value);
2978 }
2979 
2980 
2981 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) {
2982  DCHECK(descriptor_number < number_of_descriptors());
2983  Object* details = get(ToDetailsIndex(descriptor_number));
2984  return PropertyDetails(Smi::cast(details));
2985 }
2986 
2987 
2988 PropertyType DescriptorArray::GetType(int descriptor_number) {
2989  return GetDetails(descriptor_number).type();
2990 }
2991 
2992 
2993 int DescriptorArray::GetFieldIndex(int descriptor_number) {
2994  DCHECK(GetDetails(descriptor_number).type() == FIELD);
2995  return GetDetails(descriptor_number).field_index();
2996 }
2997 
2998 
2999 HeapType* DescriptorArray::GetFieldType(int descriptor_number) {
3000  DCHECK(GetDetails(descriptor_number).type() == FIELD);
3001  return HeapType::cast(GetValue(descriptor_number));
3002 }
3003 
3004 
3005 Object* DescriptorArray::GetConstant(int descriptor_number) {
3006  return GetValue(descriptor_number);
3007 }
3008 
3009 
3011  DCHECK(GetType(descriptor_number) == CALLBACKS);
3012  return GetValue(descriptor_number);
3013 }
3014 
3015 
3017  DCHECK(GetType(descriptor_number) == CALLBACKS);
3018  Foreign* p = Foreign::cast(GetCallbacksObject(descriptor_number));
3019  return reinterpret_cast<AccessorDescriptor*>(p->foreign_address());
3020 }
3021 
3022 
3023 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
3024  desc->Init(handle(GetKey(descriptor_number), GetIsolate()),
3025  handle(GetValue(descriptor_number), GetIsolate()),
3026  GetDetails(descriptor_number));
3027 }
3028 
3029 
3030 void DescriptorArray::Set(int descriptor_number,
3031  Descriptor* desc,
3032  const WhitenessWitness&) {
3033  // Range check.
3034  DCHECK(descriptor_number < number_of_descriptors());
3035 
3037  ToKeyIndex(descriptor_number),
3038  *desc->GetKey());
3040  ToValueIndex(descriptor_number),
3041  *desc->GetValue());
3043  ToDetailsIndex(descriptor_number),
3044  desc->GetDetails().AsSmi());
3045 }
3046 
3047 
3048 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) {
3049  // Range check.
3050  DCHECK(descriptor_number < number_of_descriptors());
3051 
3052  set(ToKeyIndex(descriptor_number), *desc->GetKey());
3053  set(ToValueIndex(descriptor_number), *desc->GetValue());
3054  set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi());
3055 }
3056 
3057 
3059  DisallowHeapAllocation no_gc;
3060  int descriptor_number = number_of_descriptors();
3061  SetNumberOfDescriptors(descriptor_number + 1);
3062  Set(descriptor_number, desc);
3063 
3064  uint32_t hash = desc->GetKey()->Hash();
3065 
3066  int insertion;
3067 
3068  for (insertion = descriptor_number; insertion > 0; --insertion) {
3069  Name* key = GetSortedKey(insertion - 1);
3070  if (key->Hash() <= hash) break;
3071  SetSortedKey(insertion, GetSortedKeyIndex(insertion - 1));
3072  }
3073 
3074  SetSortedKey(insertion, descriptor_number);
3075 }
3076 
3077 
3078 void DescriptorArray::SwapSortedKeys(int first, int second) {
3079  int first_key = GetSortedKeyIndex(first);
3080  SetSortedKey(first, GetSortedKeyIndex(second));
3081  SetSortedKey(second, first_key);
3082 }
3083 
3084 
3086  : marking_(array->GetHeap()->incremental_marking()) {
3088  DCHECK(!marking_->IsMarking() ||
3089  Marking::Color(array) == Marking::WHITE_OBJECT);
3090 }
3091 
3092 
3094  marking_->LeaveNoMarkingScope();
3095 }
3096 
3097 
3098 template<typename Derived, typename Shape, typename Key>
3100  const int kMinCapacity = 32;
3101  int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2);
3102  if (capacity < kMinCapacity) {
3103  capacity = kMinCapacity; // Guarantee min capacity.
3104  }
3105  return capacity;
3106 }
3107 
3108 
3109 template<typename Derived, typename Shape, typename Key>
3111  return FindEntry(GetIsolate(), key);
3112 }
3113 
3114 
3115 // Find entry for key otherwise return kNotFound.
3116 template<typename Derived, typename Shape, typename Key>
3118  uint32_t capacity = Capacity();
3119  uint32_t entry = FirstProbe(HashTable::Hash(key), capacity);
3120  uint32_t count = 1;
3121  // EnsureCapacity will guarantee the hash table is never full.
3122  while (true) {
3123  Object* element = KeyAt(entry);
3124  // Empty entry. Uses raw unchecked accessors because it is called by the
3125  // string table during bootstrapping.
3126  if (element == isolate->heap()->raw_unchecked_undefined_value()) break;
3127  if (element != isolate->heap()->raw_unchecked_the_hole_value() &&
3128  Shape::IsMatch(key, element)) return entry;
3129  entry = NextProbe(entry, count++, capacity);
3130  }
3131  return kNotFound;
3132 }
3133 
3134 
3136  Object* max_index_object = get(kMaxNumberKeyIndex);
3137  if (!max_index_object->IsSmi()) return false;
3138  return 0 !=
3139  (Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask);
3140 }
3141 
3143  DCHECK(!requires_slow_elements());
3144  Object* max_index_object = get(kMaxNumberKeyIndex);
3145  if (!max_index_object->IsSmi()) return 0;
3146  uint32_t value = static_cast<uint32_t>(Smi::cast(max_index_object)->value());
3147  return value >> kRequiresSlowElementsTagSize;
3148 }
3149 
3151  set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
3152 }
3153 
3154 
3155 // ------------------------------------
3156 // Cast operations
3157 
3158 
3244 
3245 
3246 template <class Traits>
3248  SLOW_DCHECK(object->IsHeapObject() &&
3249  HeapObject::cast(object)->map()->instance_type() ==
3250  Traits::kInstanceType);
3251  return reinterpret_cast<FixedTypedArray<Traits>*>(object);
3252 }
3253 
3254 
3255 template <class Traits>
3257 FixedTypedArray<Traits>::cast(const Object* object) {
3258  SLOW_DCHECK(object->IsHeapObject() &&
3259  HeapObject::cast(object)->map()->instance_type() ==
3260  Traits::kInstanceType);
3261  return reinterpret_cast<FixedTypedArray<Traits>*>(object);
3262 }
3263 
3264 
3265 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name)
3267 #undef MAKE_STRUCT_CAST
3268 
3269 
3270 template <typename Derived, typename Shape, typename Key>
3271 HashTable<Derived, Shape, Key>*
3272 HashTable<Derived, Shape, Key>::cast(Object* obj) {
3273  SLOW_DCHECK(obj->IsHashTable());
3274  return reinterpret_cast<HashTable*>(obj);
3275 }
3276 
3277 
3278 template <typename Derived, typename Shape, typename Key>
3279 const HashTable<Derived, Shape, Key>*
3280 HashTable<Derived, Shape, Key>::cast(const Object* obj) {
3281  SLOW_DCHECK(obj->IsHashTable());
3282  return reinterpret_cast<const HashTable*>(obj);
3283 }
3284 
3285 
3286 SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
3288 
3289 SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
3290 NOBARRIER_SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
3291 
3294 
3295 
3296 uint32_t Name::hash_field() {
3297  return READ_UINT32_FIELD(this, kHashFieldOffset);
3298 }
3299 
3300 
3302  WRITE_UINT32_FIELD(this, kHashFieldOffset, value);
3303 #if V8_HOST_ARCH_64_BIT
3304  WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0);
3305 #endif
3306 }
3307 
3308 
3309 bool Name::Equals(Name* other) {
3310  if (other == this) return true;
3311  if ((this->IsInternalizedString() && other->IsInternalizedString()) ||
3312  this->IsSymbol() || other->IsSymbol()) {
3313  return false;
3314  }
3315  return String::cast(this)->SlowEquals(String::cast(other));
3316 }
3317 
3318 
3320  if (one.is_identical_to(two)) return true;
3321  if ((one->IsInternalizedString() && two->IsInternalizedString()) ||
3322  one->IsSymbol() || two->IsSymbol()) {
3323  return false;
3324  }
3326  Handle<String>::cast(two));
3327 }
3328 
3329 
3330 ACCESSORS(Symbol, name, Object, kNameOffset)
3331 ACCESSORS(Symbol, flags, Smi, kFlagsOffset)
3332 BOOL_ACCESSORS(Symbol, flags, is_private, kPrivateBit)
3333 BOOL_ACCESSORS(Symbol, flags, is_own, kOwnBit)
3334 
3335 
3337  if (other == this) return true;
3338  if (this->IsInternalizedString() && other->IsInternalizedString()) {
3339  return false;
3340  }
3341  return SlowEquals(other);
3342 }
3343 
3344 
3346  if (one.is_identical_to(two)) return true;
3347  if (one->IsInternalizedString() && two->IsInternalizedString()) {
3348  return false;
3349  }
3350  return SlowEquals(one, two);
3351 }
3352 
3353 
3355  if (!string->IsConsString()) return string;
3357  if (cons->IsFlat()) return handle(cons->first());
3358  return SlowFlatten(cons, pretenure);
3359 }
3360 
3361 
3362 uint16_t String::Get(int index) {
3363  DCHECK(index >= 0 && index < length());
3364  switch (StringShape(this).full_representation_tag()) {
3366  return SeqOneByteString::cast(this)->SeqOneByteStringGet(index);
3368  return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index);
3371  return ConsString::cast(this)->ConsStringGet(index);
3373  return ExternalOneByteString::cast(this)->ExternalOneByteStringGet(index);
3375  return ExternalTwoByteString::cast(this)->ExternalTwoByteStringGet(index);
3378  return SlicedString::cast(this)->SlicedStringGet(index);
3379  default:
3380  break;
3381  }
3382 
3383  UNREACHABLE();
3384  return 0;
3385 }
3386 
3387 
3388 void String::Set(int index, uint16_t value) {
3389  DCHECK(index >= 0 && index < length());
3390  DCHECK(StringShape(this).IsSequential());
3391 
3392  return this->IsOneByteRepresentation()
3393  ? SeqOneByteString::cast(this)->SeqOneByteStringSet(index, value)
3394  : SeqTwoByteString::cast(this)->SeqTwoByteStringSet(index, value);
3395 }
3396 
3397 
3399  if (!StringShape(this).IsCons()) return true;
3400  return ConsString::cast(this)->second()->length() == 0;
3401 }
3402 
3403 
3405  // Giving direct access to underlying string only makes sense if the
3406  // wrapping string is already flattened.
3407  DCHECK(this->IsFlat());
3408  DCHECK(StringShape(this).IsIndirect());
3410  const int kUnderlyingOffset = SlicedString::kParentOffset;
3411  return String::cast(READ_FIELD(this, kUnderlyingOffset));
3412 }
3413 
3414 
3415 template<class Visitor>
3416 ConsString* String::VisitFlat(Visitor* visitor,
3417  String* string,
3418  const int offset) {
3419  int slice_offset = offset;
3420  const int length = string->length();
3421  DCHECK(offset <= length);
3422  while (true) {
3423  int32_t type = string->map()->instance_type();
3424  switch (type & (kStringRepresentationMask | kStringEncodingMask)) {
3426  visitor->VisitOneByteString(
3427  SeqOneByteString::cast(string)->GetChars() + slice_offset,
3428  length - offset);
3429  return NULL;
3430 
3432  visitor->VisitTwoByteString(
3433  SeqTwoByteString::cast(string)->GetChars() + slice_offset,
3434  length - offset);
3435  return NULL;
3436 
3438  visitor->VisitOneByteString(
3439  ExternalOneByteString::cast(string)->GetChars() + slice_offset,
3440  length - offset);
3441  return NULL;
3442 
3444  visitor->VisitTwoByteString(
3445  ExternalTwoByteString::cast(string)->GetChars() + slice_offset,
3446  length - offset);
3447  return NULL;
3448 
3451  SlicedString* slicedString = SlicedString::cast(string);
3452  slice_offset += slicedString->offset();
3453  string = slicedString->parent();
3454  continue;
3455  }
3456 
3459  return ConsString::cast(string);
3460 
3461  default:
3462  UNREACHABLE();
3463  return NULL;
3464  }
3465  }
3466 }
3467 
3468 
3470  DCHECK(index >= 0 && index < length());
3471  return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
3472 }
3473 
3474 
3476  DCHECK(index >= 0 && index < length() && value <= kMaxOneByteCharCode);
3477  WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize,
3478  static_cast<byte>(value));
3479 }
3480 
3481 
3483  return FIELD_ADDR(this, kHeaderSize);
3484 }
3485 
3486 
3488  return reinterpret_cast<uint8_t*>(GetCharsAddress());
3489 }
3490 
3491 
3493  return FIELD_ADDR(this, kHeaderSize);
3494 }
3495 
3496 
3498  return reinterpret_cast<uc16*>(FIELD_ADDR(this, kHeaderSize));
3499 }
3500 
3501 
3503  DCHECK(index >= 0 && index < length());
3504  return READ_SHORT_FIELD(this, kHeaderSize + index * kShortSize);
3505 }
3506 
3507 
3509  DCHECK(index >= 0 && index < length());
3510  WRITE_SHORT_FIELD(this, kHeaderSize + index * kShortSize, value);
3511 }
3512 
3513 
3515  return SizeFor(length());
3516 }
3517 
3518 
3520  return SizeFor(length());
3521 }
3522 
3523 
3525  return String::cast(READ_FIELD(this, kParentOffset));
3526 }
3527 
3528 
3530  DCHECK(parent->IsSeqString() || parent->IsExternalString());
3531  WRITE_FIELD(this, kParentOffset, parent);
3532  CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kParentOffset, parent, mode);
3533 }
3534 
3535 
3536 SMI_ACCESSORS(SlicedString, offset, kOffsetOffset)
3537 
3538 
3539 String* ConsString::first() {
3540  return String::cast(READ_FIELD(this, kFirstOffset));
3541 }
3542 
3543 
3545  return READ_FIELD(this, kFirstOffset);
3546 }
3547 
3548 
3550  WRITE_FIELD(this, kFirstOffset, value);
3552 }
3553 
3554 
3556  return String::cast(READ_FIELD(this, kSecondOffset));
3557 }
3558 
3559 
3561  return READ_FIELD(this, kSecondOffset);
3562 }
3563 
3564 
3566  WRITE_FIELD(this, kSecondOffset, value);
3567  CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kSecondOffset, value, mode);
3568 }
3569 
3570 
3574 }
3576 
3578  return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
3579 }
3580 
3581 
3583  if (is_short()) return;
3584  const char** data_field =
3585  reinterpret_cast<const char**>(FIELD_ADDR(this, kResourceDataOffset));
3586  *data_field = resource()->data();
3587 }
3588 
3589 
3591  const ExternalOneByteString::Resource* resource) {
3592  DCHECK(IsAligned(reinterpret_cast<intptr_t>(resource), kPointerSize));
3593  *reinterpret_cast<const Resource**>(
3594  FIELD_ADDR(this, kResourceOffset)) = resource;
3595  if (resource != NULL) update_data_cache();
3596 }
3597 
3598 
3600  return reinterpret_cast<const uint8_t*>(resource()->data());
3601 }
3602 
3603 
3605  DCHECK(index >= 0 && index < length());
3606  return GetChars()[index];
3607 }
3608 
3609 
3611  return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
3612 }
3613 
3614 
3616  if (is_short()) return;
3617  const uint16_t** data_field =
3618  reinterpret_cast<const uint16_t**>(FIELD_ADDR(this, kResourceDataOffset));
3619  *data_field = resource()->data();
3620 }
3621 
3622 
3624  const ExternalTwoByteString::Resource* resource) {
3625  *reinterpret_cast<const Resource**>(
3626  FIELD_ADDR(this, kResourceOffset)) = resource;
3627  if (resource != NULL) update_data_cache();
3628 }
3629 
3630 
3632  return resource()->data();
3633 }
3634 
3635 
3637  DCHECK(index >= 0 && index < length());
3638  return GetChars()[index];
3639 }
3640 
3641 
3643  unsigned start) {
3644  return GetChars() + start;
3645 }
3646 
3647 
3649  return depth & kDepthMask;
3650 }
3651 
3652 
3654  frames_[depth_++ & kDepthMask] = string;
3655 }
3656 
3657 
3659  // Inplace update.
3660  frames_[(depth_-1) & kDepthMask] = string;
3661 }
3662 
3663 
3665  if (depth_ > maximum_depth_) maximum_depth_ = depth_;
3666 }
3667 
3668 
3670  DCHECK(depth_ > 0);
3671  DCHECK(depth_ <= maximum_depth_);
3672  depth_--;
3673 }
3674 
3675 
3677  DCHECK(buffer8_ != NULL && end_ != NULL);
3678  // Advance cursor if needed.
3679  if (buffer8_ == end_) HasMore();
3680  DCHECK(buffer8_ < end_);
3681  return is_one_byte_ ? *buffer8_++ : *buffer16_++;
3682 }
3683 
3684 
3687  int offset)
3688  : is_one_byte_(false),
3689  op_(op) {
3690  Reset(string, offset);
3691 }
3692 
3693 
3694 void StringCharacterStream::Reset(String* string, int offset) {
3695  buffer8_ = NULL;
3696  end_ = NULL;
3697  ConsString* cons_string = String::VisitFlat(this, string, offset);
3698  op_->Reset(cons_string, offset);
3699  if (cons_string != NULL) {
3700  string = op_->Next(&offset);
3701  if (string != NULL) String::VisitFlat(this, string, offset);
3702  }
3703 }
3704 
3705 
3707  if (buffer8_ != end_) return true;
3708  int offset;
3709  String* string = op_->Next(&offset);
3710  DCHECK_EQ(offset, 0);
3711  if (string == NULL) return false;
3712  String::VisitFlat(this, string);
3713  DCHECK(buffer8_ != end_);
3714  return true;
3715 }
3716 
3717 
3719  const uint8_t* chars, int length) {
3720  is_one_byte_ = true;
3721  buffer8_ = chars;
3722  end_ = chars + length;
3723 }
3724 
3725 
3727  const uint16_t* chars, int length) {
3728  is_one_byte_ = false;
3729  buffer16_ = chars;
3730  end_ = reinterpret_cast<const uint8_t*>(chars + length);
3731 }
3732 
3733 
3737 }
3738 
3739 
3741  int cache_size = size();
3742  Object** entries_start = RawFieldOfElementAt(kEntriesIndex);
3743  MemsetPointer(entries_start,
3744  GetHeap()->the_hole_value(),
3745  cache_size - kEntriesIndex);
3746  MakeZeroSize();
3747 }
3748 
3749 
3751  return Smi::cast(get(kCacheSizeIndex))->value();
3752 }
3753 
3754 
3757 }
3758 
3759 
3761  return Smi::cast(get(kFingerIndex))->value();
3762 }
3763 
3764 
3767 }
3768 
3769 
3770 byte ByteArray::get(int index) {
3771  DCHECK(index >= 0 && index < this->length());
3772  return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
3773 }
3774 
3775 
3776 void ByteArray::set(int index, byte value) {
3777  DCHECK(index >= 0 && index < this->length());
3778  WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value);
3779 }
3780 
3781 
3782 int ByteArray::get_int(int index) {
3783  DCHECK(index >= 0 && (index * kIntSize) < this->length());
3784  return READ_INT_FIELD(this, kHeaderSize + index * kIntSize);
3785 }
3786 
3787 
3790  return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag);
3791 }
3792 
3793 
3795  return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize;
3796 }
3797 
3798 
3800  return reinterpret_cast<uint8_t*>(external_pointer());
3801 }
3802 
3803 
3805  DCHECK((index >= 0) && (index < this->length()));
3806  uint8_t* ptr = external_uint8_clamped_pointer();
3807  return ptr[index];
3808 }
3809 
3810 
3813  int index) {
3814  return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
3815  array->GetIsolate());
3816 }
3817 
3818 
3819 void ExternalUint8ClampedArray::set(int index, uint8_t value) {
3820  DCHECK((index >= 0) && (index < this->length()));
3821  uint8_t* ptr = external_uint8_clamped_pointer();
3822  ptr[index] = value;
3823 }
3824 
3825 
3826 void* ExternalArray::external_pointer() const {
3827  intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset);
3828  return reinterpret_cast<void*>(ptr);
3829 }
3830 
3831 
3832 void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) {
3833  intptr_t ptr = reinterpret_cast<intptr_t>(value);
3835 }
3836 
3837 
3839  DCHECK((index >= 0) && (index < this->length()));
3840  int8_t* ptr = static_cast<int8_t*>(external_pointer());
3841  return ptr[index];
3842 }
3843 
3844 
3846  int index) {
3847  return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
3848  array->GetIsolate());
3849 }
3850 
3851 
3852 void ExternalInt8Array::set(int index, int8_t value) {
3853  DCHECK((index >= 0) && (index < this->length()));
3854  int8_t* ptr = static_cast<int8_t*>(external_pointer());
3855  ptr[index] = value;
3856 }
3857 
3858 
3860  DCHECK((index >= 0) && (index < this->length()));
3861  uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
3862  return ptr[index];
3863 }
3864 
3865 
3867  int index) {
3868  return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
3869  array->GetIsolate());
3870 }
3871 
3872 
3873 void ExternalUint8Array::set(int index, uint8_t value) {
3874  DCHECK((index >= 0) && (index < this->length()));
3875  uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
3876  ptr[index] = value;
3877 }
3878 
3879 
3881  DCHECK((index >= 0) && (index < this->length()));
3882  int16_t* ptr = static_cast<int16_t*>(external_pointer());
3883  return ptr[index];
3884 }
3885 
3886 
3888  int index) {
3889  return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
3890  array->GetIsolate());
3891 }
3892 
3893 
3894 void ExternalInt16Array::set(int index, int16_t value) {
3895  DCHECK((index >= 0) && (index < this->length()));
3896  int16_t* ptr = static_cast<int16_t*>(external_pointer());
3897  ptr[index] = value;
3898 }
3899 
3900 
3902  DCHECK((index >= 0) && (index < this->length()));
3903  uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
3904  return ptr[index];
3905 }
3906 
3907 
3909  int index) {
3910  return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
3911  array->GetIsolate());
3912 }
3913 
3914 
3915 void ExternalUint16Array::set(int index, uint16_t value) {
3916  DCHECK((index >= 0) && (index < this->length()));
3917  uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
3918  ptr[index] = value;
3919 }
3920 
3921 
3923  DCHECK((index >= 0) && (index < this->length()));
3924  int32_t* ptr = static_cast<int32_t*>(external_pointer());
3925  return ptr[index];
3926 }
3927 
3928 
3930  int index) {
3931  return array->GetIsolate()->factory()->
3932  NewNumberFromInt(array->get_scalar(index));
3933 }
3934 
3935 
3936 void ExternalInt32Array::set(int index, int32_t value) {
3937  DCHECK((index >= 0) && (index < this->length()));
3938  int32_t* ptr = static_cast<int32_t*>(external_pointer());
3939  ptr[index] = value;
3940 }
3941 
3942 
3944  DCHECK((index >= 0) && (index < this->length()));
3945  uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
3946  return ptr[index];
3947 }
3948 
3949 
3951  int index) {
3952  return array->GetIsolate()->factory()->
3953  NewNumberFromUint(array->get_scalar(index));
3954 }
3955 
3956 
3957 void ExternalUint32Array::set(int index, uint32_t value) {
3958  DCHECK((index >= 0) && (index < this->length()));
3959  uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
3960  ptr[index] = value;
3961 }
3962 
3963 
3965  DCHECK((index >= 0) && (index < this->length()));
3966  float* ptr = static_cast<float*>(external_pointer());
3967  return ptr[index];
3968 }
3969 
3970 
3972  int index) {
3973  return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index));
3974 }
3975 
3976 
3977 void ExternalFloat32Array::set(int index, float value) {
3978  DCHECK((index >= 0) && (index < this->length()));
3979  float* ptr = static_cast<float*>(external_pointer());
3980  ptr[index] = value;
3981 }
3982 
3983 
3985  DCHECK((index >= 0) && (index < this->length()));
3986  double* ptr = static_cast<double*>(external_pointer());
3987  return ptr[index];
3988 }
3989 
3990 
3992  int index) {
3993  return array->GetIsolate()->factory()->NewNumber(array->get_scalar(index));
3994 }
3995 
3996 
3997 void ExternalFloat64Array::set(int index, double value) {
3998  DCHECK((index >= 0) && (index < this->length()));
3999  double* ptr = static_cast<double*>(external_pointer());
4000  ptr[index] = value;
4001 }
4002 
4003 
4005  return FIELD_ADDR(this, kDataOffset);
4006 }
4007 
4008 
4010  int element_size;
4011  switch (type) {
4012 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
4013  case FIXED_##TYPE##_ARRAY_TYPE: \
4014  element_size = size; \
4015  break;
4016 
4018 #undef TYPED_ARRAY_CASE
4019  default:
4020  UNREACHABLE();
4021  return 0;
4022  }
4023  return length() * element_size;
4024 }
4025 
4026 
4028  return DataSize(map()->instance_type());
4029 }
4030 
4031 
4034 }
4035 
4036 
4038  return OBJECT_POINTER_ALIGN(kDataOffset + DataSize(type));
4039 }
4040 
4041 
4042 uint8_t Uint8ArrayTraits::defaultValue() { return 0; }
4043 
4044 
4045 uint8_t Uint8ClampedArrayTraits::defaultValue() { return 0; }
4046 
4047 
4048 int8_t Int8ArrayTraits::defaultValue() { return 0; }
4049 
4050 
4051 uint16_t Uint16ArrayTraits::defaultValue() { return 0; }
4052 
4053 
4054 int16_t Int16ArrayTraits::defaultValue() { return 0; }
4055 
4056 
4057 uint32_t Uint32ArrayTraits::defaultValue() { return 0; }
4058 
4059 
4060 int32_t Int32ArrayTraits::defaultValue() { return 0; }
4061 
4062 
4063 float Float32ArrayTraits::defaultValue() {
4064  return static_cast<float>(base::OS::nan_value());
4065 }
4066 
4067 
4068 double Float64ArrayTraits::defaultValue() { return base::OS::nan_value(); }
4069 
4070 
4071 template <class Traits>
4072 typename Traits::ElementType FixedTypedArray<Traits>::get_scalar(int index) {
4073  DCHECK((index >= 0) && (index < this->length()));
4074  ElementType* ptr = reinterpret_cast<ElementType*>(
4075  FIELD_ADDR(this, kDataOffset));
4076  return ptr[index];
4077 }
4078 
4079 
4080 template<> inline
4083  DCHECK((index >= 0) && (index < this->length()));
4084  return READ_DOUBLE_FIELD(this, ElementOffset(index));
4085 }
4086 
4087 
4088 template <class Traits>
4090  DCHECK((index >= 0) && (index < this->length()));
4091  ElementType* ptr = reinterpret_cast<ElementType*>(
4092  FIELD_ADDR(this, kDataOffset));
4093  ptr[index] = value;
4094 }
4095 
4096 
4097 template<> inline
4099  int index, Float64ArrayTraits::ElementType value) {
4100  DCHECK((index >= 0) && (index < this->length()));
4101  WRITE_DOUBLE_FIELD(this, ElementOffset(index), value);
4102 }
4103 
4104 
4105 template <class Traits>
4106 typename Traits::ElementType FixedTypedArray<Traits>::from_int(int value) {
4107  return static_cast<ElementType>(value);
4108 }
4109 
4110 
4111 template <> inline
4113  if (value < 0) return 0;
4114  if (value > 0xFF) return 0xFF;
4115  return static_cast<uint8_t>(value);
4116 }
4117 
4118 
4119 template <class Traits>
4120 typename Traits::ElementType FixedTypedArray<Traits>::from_double(
4121  double value) {
4122  return static_cast<ElementType>(DoubleToInt32(value));
4123 }
4124 
4125 
4126 template<> inline
4128  if (value < 0) return 0;
4129  if (value > 0xFF) return 0xFF;
4130  return static_cast<uint8_t>(lrint(value));
4131 }
4132 
4133 
4134 template<> inline
4136  return static_cast<float>(value);
4137 }
4138 
4139 
4140 template<> inline
4142  return value;
4143 }
4144 
4145 
4146 template <class Traits>
4149  int index) {
4150  return Traits::ToHandle(array->GetIsolate(), array->get_scalar(index));
4151 }
4152 
4153 
4154 template <class Traits>
4157  uint32_t index,
4158  Handle<Object> value) {
4159  ElementType cast_value = Traits::defaultValue();
4160  if (index < static_cast<uint32_t>(array->length())) {
4161  if (value->IsSmi()) {
4162  int int_value = Handle<Smi>::cast(value)->value();
4163  cast_value = from_int(int_value);
4164  } else if (value->IsHeapNumber()) {
4165  double double_value = Handle<HeapNumber>::cast(value)->value();
4166  cast_value = from_double(double_value);
4167  } else {
4168  // Clamp undefined to the default value. All other types have been
4169  // converted to a number type further up in the call chain.
4170  DCHECK(value->IsUndefined());
4171  }
4172  array->set(index, cast_value);
4173  }
4174  return Traits::ToHandle(array->GetIsolate(), cast_value);
4175 }
4176 
4177 
4178 Handle<Object> Uint8ArrayTraits::ToHandle(Isolate* isolate, uint8_t scalar) {
4179  return handle(Smi::FromInt(scalar), isolate);
4180 }
4181 
4182 
4183 Handle<Object> Uint8ClampedArrayTraits::ToHandle(Isolate* isolate,
4184  uint8_t scalar) {
4185  return handle(Smi::FromInt(scalar), isolate);
4186 }
4187 
4188 
4189 Handle<Object> Int8ArrayTraits::ToHandle(Isolate* isolate, int8_t scalar) {
4190  return handle(Smi::FromInt(scalar), isolate);
4191 }
4192 
4193 
4194 Handle<Object> Uint16ArrayTraits::ToHandle(Isolate* isolate, uint16_t scalar) {
4195  return handle(Smi::FromInt(scalar), isolate);
4196 }
4197 
4198 
4199 Handle<Object> Int16ArrayTraits::ToHandle(Isolate* isolate, int16_t scalar) {
4200  return handle(Smi::FromInt(scalar), isolate);
4201 }
4202 
4203 
4204 Handle<Object> Uint32ArrayTraits::ToHandle(Isolate* isolate, uint32_t scalar) {
4205  return isolate->factory()->NewNumberFromUint(scalar);
4206 }
4207 
4208 
4209 Handle<Object> Int32ArrayTraits::ToHandle(Isolate* isolate, int32_t scalar) {
4210  return isolate->factory()->NewNumberFromInt(scalar);
4211 }
4212 
4213 
4214 Handle<Object> Float32ArrayTraits::ToHandle(Isolate* isolate, float scalar) {
4215  return isolate->factory()->NewNumber(scalar);
4216 }
4217 
4218 
4219 Handle<Object> Float64ArrayTraits::ToHandle(Isolate* isolate, double scalar) {
4220  return isolate->factory()->NewNumber(scalar);
4221 }
4222 
4223 
4225  return READ_BYTE_FIELD(this, kVisitorIdOffset);
4226 }
4227 
4228 
4229 void Map::set_visitor_id(int id) {
4230  DCHECK(0 <= id && id < 256);
4231  WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id));
4232 }
4233 
4234 
4238 }
4239 
4240 
4243 }
4244 
4245 
4248 }
4249 
4250 
4252  // Adjust for the number of properties stored in the object.
4253  index -= inobject_properties();
4254  DCHECK(index <= 0);
4255  return instance_size() + (index * kPointerSize);
4256 }
4257 
4258 
4260  int instance_size = map->instance_size();
4261  if (instance_size != kVariableSizeSentinel) return instance_size;
4262  // Only inline the most frequent cases.
4263  InstanceType instance_type = map->instance_type();
4264  if (instance_type == FIXED_ARRAY_TYPE) {
4266  }
4267  if (instance_type == ONE_BYTE_STRING_TYPE ||
4268  instance_type == ONE_BYTE_INTERNALIZED_STRING_TYPE) {
4270  reinterpret_cast<SeqOneByteString*>(this)->length());
4271  }
4272  if (instance_type == BYTE_ARRAY_TYPE) {
4273  return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
4274  }
4275  if (instance_type == FREE_SPACE_TYPE) {
4276  return reinterpret_cast<FreeSpace*>(this)->nobarrier_size();
4277  }
4278  if (instance_type == STRING_TYPE ||
4279  instance_type == INTERNALIZED_STRING_TYPE) {
4281  reinterpret_cast<SeqTwoByteString*>(this)->length());
4282  }
4283  if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
4285  reinterpret_cast<FixedDoubleArray*>(this)->length());
4286  }
4287  if (instance_type == CONSTANT_POOL_ARRAY_TYPE) {
4288  return reinterpret_cast<ConstantPoolArray*>(this)->size();
4289  }
4290  if (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE &&
4291  instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE) {
4292  return reinterpret_cast<FixedTypedArrayBase*>(
4293  this)->TypedArraySize(instance_type);
4294  }
4295  DCHECK(instance_type == CODE_TYPE);
4296  return reinterpret_cast<Code*>(this)->CodeSize();
4297 }
4298 
4299 
4300 void Map::set_instance_size(int value) {
4301  DCHECK_EQ(0, value & (kPointerSize - 1));
4302  value >>= kPointerSizeLog2;
4303  DCHECK(0 <= value && value < 256);
4305  this, kInstanceSizeOffset, static_cast<byte>(value));
4306 }
4307 
4308 
4310  DCHECK(0 <= value && value < 256);
4311  WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value));
4312 }
4313 
4314 
4316  DCHECK(0 <= value && value < 256);
4317  WRITE_BYTE_FIELD(this,
4319  static_cast<byte>(value));
4320 }
4321 
4322 
4324  return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset));
4325 }
4326 
4327 
4329  WRITE_BYTE_FIELD(this, kInstanceTypeOffset, value);
4330 }
4331 
4332 
4335 }
4336 
4337 
4339  WRITE_BYTE_FIELD(this, kUnusedPropertyFieldsOffset, Min(value, 255));
4340 }
4341 
4342 
4344  return READ_BYTE_FIELD(this, kBitFieldOffset);
4345 }
4346 
4347 
4348 void Map::set_bit_field(byte value) {
4349  WRITE_BYTE_FIELD(this, kBitFieldOffset, value);
4350 }
4351 
4352 
4354  return READ_BYTE_FIELD(this, kBitField2Offset);
4355 }
4356 
4357 
4358 void Map::set_bit_field2(byte value) {
4359  WRITE_BYTE_FIELD(this, kBitField2Offset, value);
4360 }
4361 
4362 
4364  if (value) {
4366  } else {
4368  }
4369 }
4370 
4371 
4373  return ((1 << kHasNonInstancePrototype) & bit_field()) != 0;
4374 }
4375 
4376 
4379 }
4380 
4381 
4384 }
4385 
4386 
4387 void Map::set_is_access_check_needed(bool access_check_needed) {
4388  if (access_check_needed) {
4390  } else {
4392  }
4393 }
4394 
4395 
4397  return ((1 << kIsAccessCheckNeeded) & bit_field()) != 0;
4398 }
4399 
4400 
4401 void Map::set_is_extensible(bool value) {
4402  if (value) {
4404  } else {
4406  }
4407 }
4408 
4410  return ((1 << kIsExtensible) & bit_field2()) != 0;
4411 }
4412 
4413 
4414 void Map::set_is_prototype_map(bool value) {
4416 }
4417 
4420 }
4421 
4422 
4423 void Map::set_dictionary_map(bool value) {
4424  uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value);
4425  new_bit_field3 = IsUnstable::update(new_bit_field3, value);
4426  set_bit_field3(new_bit_field3);
4427 }
4428 
4429 
4432 }
4433 
4434 
4436  return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset));
4437 }
4438 
4439 
4440 void Map::set_owns_descriptors(bool owns_descriptors) {
4442 }
4443 
4444 
4447 }
4448 
4449 
4452 }
4453 
4454 
4457 }
4458 
4459 
4462 }
4463 
4464 
4466  return Deprecated::decode(bit_field3());
4467 }
4468 
4469 
4470 void Map::set_migration_target(bool value) {
4472 }
4473 
4474 
4477 }
4478 
4479 
4482 }
4483 
4484 
4487 }
4488 
4489 
4492 }
4493 
4494 
4497 }
4498 
4499 
4500 void Map::freeze() {
4502 }
4503 
4504 
4506  return IsFrozen::decode(bit_field3());
4507 }
4508 
4509 
4512 }
4513 
4514 
4516  return !IsUnstable::decode(bit_field3());
4517 }
4518 
4519 
4521  return code_cache() != GetIsolate()->heap()->empty_fixed_array();
4522 }
4523 
4524 
4526  int descriptor = LastAdded();
4527  for (int i = 0; i <= descriptor; i++) {
4528  PropertyDetails details = instance_descriptors()->GetDetails(i);
4529  if (details.representation().IsNone()) return true;
4530  if (details.representation().IsSmi()) return true;
4531  if (details.representation().IsDouble()) return true;
4532  if (details.representation().IsHeapObject()) return true;
4533  if (details.type() == CONSTANT) return true;
4534  }
4535  return false;
4536 }
4537 
4538 
4540  if (is_stable()) {
4541  mark_unstable();
4542  dependent_code()->DeoptimizeDependentCodeGroup(
4543  GetIsolate(),
4545  }
4546 }
4547 
4548 
4550  return is_stable() && FLAG_omit_map_checks_for_leaf_maps;
4551 }
4552 
4553 
4555  if (length() == 0) return 0;
4556  return Smi::cast(get(group))->value();
4557 }
4558 
4559 
4561  set(group, Smi::FromInt(value));
4562 }
4563 
4564 
4566  return get(kCodesStartIndex + i)->IsCode();
4567 }
4568 
4570  return Code::cast(get(kCodesStartIndex + i));
4571 }
4572 
4573 
4575  return reinterpret_cast<CompilationInfo*>(
4576  Foreign::cast(get(kCodesStartIndex + i))->foreign_address());
4577 }
4578 
4579 
4581  set(kCodesStartIndex + i, object);
4582 }
4583 
4584 
4586  return get(kCodesStartIndex + i);
4587 }
4588 
4589 
4592 }
4593 
4594 
4597 }
4598 
4599 
4600 void DependentCode::copy(int from, int to) {
4602 }
4603 
4604 
4606  GroupStartIndexes starts(this);
4607  for (int g = kGroupCount - 1; g > group; g--) {
4608  if (starts.at(g) < starts.at(g + 1)) {
4609  copy(starts.at(g), starts.at(g + 1));
4610  }
4611  }
4612 }
4613 
4614 
4618 }
4619 
4620 
4622  return ExtractKindFromFlags(flags());
4623 }
4624 
4625 
4627  return kind() == STUB || kind() == HANDLER || kind() == LOAD_IC ||
4628  kind() == KEYED_LOAD_IC || kind() == CALL_IC || kind() == STORE_IC ||
4629  kind() == KEYED_STORE_IC || kind() == BINARY_OP_IC ||
4630  kind() == COMPARE_IC || kind() == COMPARE_NIL_IC ||
4631  kind() == TO_BOOLEAN_IC;
4632 }
4633 
4634 
4637  // Only allow uninitialized or debugger states for non-IC code
4638  // objects. This is used in the debugger to determine whether or not
4639  // a call to code object has been replaced with a debug break call.
4641  result == UNINITIALIZED ||
4642  result == DEBUG_STUB);
4643  return result;
4644 }
4645 
4646 
4650 }
4651 
4652 
4654  return ExtractTypeFromFlags(flags());
4655 }
4656 
4657 
4658 // For initialization.
4661 }
4662 
4663 
4666 }
4667 
4668 
4669 inline bool Code::is_crankshafted() {
4672 }
4673 
4674 
4675 inline bool Code::is_hydrogen_stub() {
4676  return is_crankshafted() && kind() != OPTIMIZED_FUNCTION;
4677 }
4678 
4679 
4680 inline void Code::set_is_crankshafted(bool value) {
4681  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
4682  int updated = IsCrankshaftedField::update(previous, value);
4684 }
4685 
4686 
4687 inline bool Code::is_turbofanned() {
4688  DCHECK(kind() == OPTIMIZED_FUNCTION || kind() == STUB);
4691 }
4692 
4693 
4694 inline void Code::set_is_turbofanned(bool value) {
4695  DCHECK(kind() == OPTIMIZED_FUNCTION || kind() == STUB);
4696  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4697  int updated = IsTurbofannedField::update(previous, value);
4699 }
4700 
4701 
4703  DCHECK_EQ(FUNCTION, kind());
4704  return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
4705 }
4706 
4707 
4708 void Code::set_optimizable(bool value) {
4709  DCHECK_EQ(FUNCTION, kind());
4710  WRITE_BYTE_FIELD(this, kOptimizableOffset, value ? 1 : 0);
4711 }
4712 
4713 
4715  DCHECK_EQ(FUNCTION, kind());
4716  byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
4718 }
4719 
4720 
4722  DCHECK_EQ(FUNCTION, kind());
4723  byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
4726 }
4727 
4728 
4730  DCHECK_EQ(FUNCTION, kind());
4731  byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
4733 }
4734 
4735 
4737  DCHECK_EQ(FUNCTION, kind());
4738  byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
4741 }
4742 
4743 
4745  DCHECK_EQ(FUNCTION, kind());
4746  byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
4748 }
4749 
4750 
4752  DCHECK_EQ(FUNCTION, kind());
4753  byte flags = READ_BYTE_FIELD(this, kFullCodeFlags);
4756 }
4757 
4758 
4760  DCHECK_EQ(FUNCTION, kind());
4761  int fields = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
4763 }
4764 
4765 
4767  DCHECK_EQ(FUNCTION, kind());
4768  DCHECK(level >= 0 && level <= kMaxLoopNestingMarker);
4769  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
4770  int updated = AllowOSRAtLoopNestingLevelField::update(previous, level);
4772 }
4773 
4774 
4776  DCHECK_EQ(FUNCTION, kind());
4777  return READ_BYTE_FIELD(this, kProfilerTicksOffset);
4778 }
4779 
4780 
4781 void Code::set_profiler_ticks(int ticks) {
4782  DCHECK(ticks < 256);
4783  if (kind() == FUNCTION) {
4784  WRITE_BYTE_FIELD(this, kProfilerTicksOffset, ticks);
4785  }
4786 }
4787 
4788 
4790  DCHECK_EQ(BUILTIN, kind());
4792 }
4793 
4794 
4795 void Code::set_builtin_index(int index) {
4796  DCHECK_EQ(BUILTIN, kind());
4798 }
4799 
4800 
4801 unsigned Code::stack_slots() {
4803  return StackSlotsField::decode(
4805 }
4806 
4807 
4808 void Code::set_stack_slots(unsigned slots) {
4809  CHECK(slots <= (1 << kStackSlotsBitCount));
4811  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4812  int updated = StackSlotsField::update(previous, slots);
4814 }
4815 
4816 
4821 }
4822 
4823 
4824 void Code::set_safepoint_table_offset(unsigned offset) {
4825  CHECK(offset <= (1 << kSafepointTableOffsetBitCount));
4827  DCHECK(IsAligned(offset, static_cast<unsigned>(kIntSize)));
4828  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
4829  int updated = SafepointTableOffsetField::update(previous, offset);
4831 }
4832 
4833 
4835  DCHECK_EQ(FUNCTION, kind());
4838 }
4839 
4840 
4841 void Code::set_back_edge_table_offset(unsigned offset) {
4842  DCHECK_EQ(FUNCTION, kind());
4843  DCHECK(IsAligned(offset, static_cast<unsigned>(kPointerSize)));
4844  offset = offset >> kPointerSizeLog2;
4845  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
4846  int updated = BackEdgeTableOffsetField::update(previous, offset);
4848 }
4849 
4850 
4852  DCHECK_EQ(FUNCTION, kind());
4853  return allow_osr_at_loop_nesting_level() > 0;
4854 }
4855 
4856 
4858  return extra_ic_state();
4859 }
4860 
4861 
4863  DCHECK(kind() == STUB);
4866 }
4867 
4868 
4870  DCHECK(kind() == STUB);
4871  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4872  int updated = HasFunctionCacheField::update(previous, flag);
4874 }
4875 
4876 
4878  DCHECK(kind() == OPTIMIZED_FUNCTION);
4881 }
4882 
4883 
4885  DCHECK(kind() == OPTIMIZED_FUNCTION);
4886  DCHECK(!flag || AllowDeoptimization::IsAllowed(GetIsolate()));
4887  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4888  int updated = MarkedForDeoptimizationField::update(previous, flag);
4890 }
4891 
4892 
4896 }
4897 
4898 
4900  DCHECK(CanBeWeakStub());
4901  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4902  int updated = WeakStubField::update(previous, true);
4904 }
4905 
4906 
4910 }
4911 
4912 
4915  int previous = READ_UINT32_FIELD(this, kKindSpecificFlags1Offset);
4916  int updated = InvalidatedWeakStubField::update(previous, true);
4918 }
4919 
4920 
4922  Kind kind = this->kind();
4923  switch (kind) {
4924 #define CASE(name) case name: return true;
4926 #undef CASE
4927  default: return false;
4928  }
4929 }
4930 
4931 
4934 }
4935 
4936 
4938  return ic_state() == DEBUG_STUB;
4939 }
4940 
4941 
4943  return ConstantPoolArray::cast(READ_FIELD(this, kConstantPoolOffset));
4944 }
4945 
4946 
4948  DCHECK(value->IsConstantPoolArray());
4949  WRITE_FIELD(this, kConstantPoolOffset, value);
4950  WRITE_BARRIER(GetHeap(), this, kConstantPoolOffset, value);
4951 }
4952 
4953 
4955  ExtraICState extra_ic_state, StubType type,
4956  CacheHolderFlag holder) {
4957  // Compute the bit mask.
4958  unsigned int bits = KindField::encode(kind)
4962  | CacheHolderField::encode(holder);
4963  return static_cast<Flags>(bits);
4964 }
4965 
4966 
4968  ExtraICState extra_ic_state,
4969  CacheHolderFlag holder,
4970  StubType type) {
4971  return ComputeFlags(kind, MONOMORPHIC, extra_ic_state, type, holder);
4972 }
4973 
4974 
4976  CacheHolderFlag holder) {
4977  return ComputeFlags(Code::HANDLER, MONOMORPHIC, handler_kind, type, holder);
4978 }
4979 
4980 
4982  return KindField::decode(flags);
4983 }
4984 
4985 
4987  return ICStateField::decode(flags);
4988 }
4989 
4990 
4993 }
4994 
4995 
4997  return TypeField::decode(flags);
4998 }
4999 
5000 
5003 }
5004 
5005 
5007  int bits = flags & ~TypeField::kMask;
5008  return static_cast<Flags>(bits);
5009 }
5010 
5011 
5013  int bits = flags & ~TypeField::kMask & ~CacheHolderField::kMask;
5014  return static_cast<Flags>(bits);
5015 }
5016 
5017 
5020  // GetCodeFromTargetAddress might be called when marking objects during mark
5021  // sweep. reinterpret_cast is therefore used instead of the more appropriate
5022  // Code::cast. Code::cast does not work when the object's map is
5023  // marked.
5024  Code* result = reinterpret_cast<Code*>(code);
5025  return result;
5026 }
5027 
5028 
5030  return HeapObject::
5031  FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize);
5032 }
5033 
5034 
5036  if (!FLAG_collect_maps) return false;
5037  if (object->IsMap()) {
5038  return Map::cast(object)->CanTransition() &&
5039  FLAG_weak_embedded_maps_in_optimized_code;
5040  }
5041  if (object->IsJSObject() ||
5042  (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) {
5043  return FLAG_weak_embedded_objects_in_optimized_code;
5044  }
5045  return false;
5046 }
5047 
5048 
5050  public:
5052  void Add(Handle<Map> map_to_find, Handle<Object> obj_to_replace) {
5053  DCHECK(count_ < kMaxCount);
5054  find_[count_] = map_to_find;
5055  replace_[count_] = obj_to_replace;
5056  ++count_;
5057  }
5058  private:
5059  static const int kMaxCount = 4;
5060  int count_;
5063  friend class Code;
5064 };
5065 
5066 
5068  return object->IsMap() && Map::cast(object)->CanTransition() &&
5069  FLAG_collect_maps &&
5070  FLAG_weak_embedded_maps_in_ic;
5071 }
5072 
5073 
5074 Object* Map::prototype() const {
5075  return READ_FIELD(this, kPrototypeOffset);
5076 }
5077 
5078 
5079 void Map::set_prototype(Object* value, WriteBarrierMode mode) {
5080  DCHECK(value->IsNull() || value->IsJSReceiver());
5081  WRITE_FIELD(this, kPrototypeOffset, value);
5083 }
5084 
5085 
5086 // If the descriptor is using the empty transition array, install a new empty
5087 // transition array that will have place for an element transition.
5089  Handle<TransitionArray> transitions;
5090  if (!map->HasTransitionArray()) {
5091  transitions = TransitionArray::Allocate(map->GetIsolate(), 0);
5092  transitions->set_back_pointer_storage(map->GetBackPointer());
5093  } else if (!map->transitions()->IsFullTransitionArray()) {
5095  } else {
5096  return;
5097  }
5098  map->set_transitions(*transitions);
5099 }
5100 
5101 
5103  int len = descriptors->number_of_descriptors();
5104  set_instance_descriptors(descriptors);
5106 }
5107 
5108 
5109 ACCESSORS(Map, instance_descriptors, DescriptorArray, kDescriptorsOffset)
5110 
5111 
5112 void Map::set_bit_field3(uint32_t bits) {
5113  if (kInt32Size != kPointerSize) {
5114  WRITE_UINT32_FIELD(this, kBitField3Offset + kInt32Size, 0);
5115  }
5116  WRITE_UINT32_FIELD(this, kBitField3Offset, bits);
5117 }
5118 
5119 
5121  return READ_UINT32_FIELD(this, kBitField3Offset);
5122 }
5123 
5124 
5126  DescriptorArray* descriptors = instance_descriptors();
5127  int number_of_own_descriptors = NumberOfOwnDescriptors();
5128  DCHECK(descriptors->number_of_descriptors() == number_of_own_descriptors);
5129  descriptors->Append(desc);
5130  SetNumberOfOwnDescriptors(number_of_own_descriptors + 1);
5131 }
5132 
5133 
5136  if (object->IsDescriptorArray()) {
5137  return TransitionArray::cast(object)->back_pointer_storage();
5138  } else {
5139  DCHECK(object->IsMap() || object->IsUndefined());
5140  return object;
5141  }
5142 }
5143 
5144 
5146  return HasTransitionArray() && transitions()->HasElementsTransition();
5147 }
5148 
5149 
5152  return object->IsTransitionArray();
5153 }
5154 
5155 
5157  int index = transitions()->Search(GetHeap()->elements_transition_symbol());
5158  return transitions()->GetTarget(index);
5159 }
5160 
5161 
5163  if (!HasTransitionArray()) return true;
5164  return FixedArray::SizeFor(transitions()->length() +
5167 }
5168 
5169 
5170 Map* Map::GetTransition(int transition_index) {
5171  return transitions()->GetTarget(transition_index);
5172 }
5173 
5174 
5176  if (HasTransitionArray()) return transitions()->Search(name);
5178 }
5179 
5180 
5182  if (!HasTransitionArray()) return GetHeap()->empty_fixed_array();
5183  if (!transitions()->HasPrototypeTransitions()) {
5184  return GetHeap()->empty_fixed_array();
5185  }
5186  return transitions()->GetPrototypeTransitions();
5187 }
5188 
5189 
5191  Handle<Map> map, Handle<FixedArray> proto_transitions) {
5193  int old_number_of_transitions = map->NumberOfProtoTransitions();
5194 #ifdef DEBUG
5195  if (map->HasPrototypeTransitions()) {
5196  DCHECK(map->GetPrototypeTransitions() != *proto_transitions);
5198  }
5199 #endif
5200  map->transitions()->SetPrototypeTransitions(*proto_transitions);
5201  map->SetNumberOfProtoTransitions(old_number_of_transitions);
5202 }
5203 
5204 
5206  return HasTransitionArray() && transitions()->HasPrototypeTransitions();
5207 }
5208 
5209 
5210 TransitionArray* Map::transitions() const {
5213  return TransitionArray::cast(object);
5214 }
5215 
5216 
5217 void Map::set_transitions(TransitionArray* transition_array,
5219  // Transition arrays are not shared. When one is replaced, it should not
5220  // keep referenced objects alive, so we zap it.
5221  // When there is another reference to the array somewhere (e.g. a handle),
5222  // not zapping turns from a waste of memory into a source of crashes.
5223  if (HasTransitionArray()) {
5224 #ifdef DEBUG
5225  for (int i = 0; i < transitions()->number_of_transitions(); i++) {
5226  Map* target = transitions()->GetTarget(i);
5227  if (target->instance_descriptors() == instance_descriptors()) {
5228  Name* key = transitions()->GetKey(i);
5229  int new_target_index = transition_array->Search(key);
5230  DCHECK(new_target_index != TransitionArray::kNotFound);
5231  DCHECK(transition_array->GetTarget(new_target_index) == target);
5232  }
5233  }
5234 #endif
5235  DCHECK(transitions() != transition_array);
5236  ZapTransitions();
5237  }
5238 
5239  WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array);
5241  GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode);
5242 }
5243 
5244 
5245 void Map::init_back_pointer(Object* undefined) {
5246  DCHECK(undefined->IsUndefined());
5247  WRITE_FIELD(this, kTransitionsOrBackPointerOffset, undefined);
5248 }
5249 
5250 
5253  DCHECK((value->IsUndefined() && GetBackPointer()->IsMap()) ||
5254  (value->IsMap() && GetBackPointer()->IsUndefined()));
5256  if (object->IsTransitionArray()) {
5258  } else {
5261  GetHeap(), this, kTransitionsOrBackPointerOffset, value, mode);
5262  }
5263 }
5264 
5265 
5266 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
5267 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset)
5268 ACCESSORS(Map, constructor, Object, kConstructorOffset)
5269 
5270 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
5271 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
5272 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
5273 
5274 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
5275 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset)
5276 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
5277 ACCESSORS(GlobalObject, global_proxy, JSObject, kGlobalProxyOffset)
5278 
5279 ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset)
5280 ACCESSORS(JSGlobalProxy, hash, Object, kHashOffset)
5281 
5282 ACCESSORS(AccessorInfo, name, Object, kNameOffset)
5283 ACCESSORS_TO_SMI(AccessorInfo, flag, kFlagOffset)
5284 ACCESSORS(AccessorInfo, expected_receiver_type, Object,
5285  kExpectedReceiverTypeOffset)
5286 
5288  kSerializedDataOffset)
5289 
5291  kDescriptorOffset)
5292 
5293 ACCESSORS(ExecutableAccessorInfo, getter, Object, kGetterOffset)
5294 ACCESSORS(ExecutableAccessorInfo, setter, Object, kSetterOffset)
5295 ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset)
5296 
5297 ACCESSORS(Box, value, Object, kValueOffset)
5298 
5299 ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
5300 ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
5301 
5302 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset)
5303 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset)
5304 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset)
5305 
5306 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset)
5307 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset)
5308 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset)
5309 ACCESSORS(InterceptorInfo, deleter, Object, kDeleterOffset)
5310 ACCESSORS(InterceptorInfo, enumerator, Object, kEnumeratorOffset)
5311 ACCESSORS(InterceptorInfo, data, Object, kDataOffset)
5312 
5313 ACCESSORS(CallHandlerInfo, callback, Object, kCallbackOffset)
5314 ACCESSORS(CallHandlerInfo, data, Object, kDataOffset)
5315 
5316 ACCESSORS(TemplateInfo, tag, Object, kTagOffset)
5317 ACCESSORS(TemplateInfo, property_list, Object, kPropertyListOffset)
5318 ACCESSORS(TemplateInfo, property_accessors, Object, kPropertyAccessorsOffset)
5319 
5320 ACCESSORS(FunctionTemplateInfo, serial_number, Object, kSerialNumberOffset)
5321 ACCESSORS(FunctionTemplateInfo, call_code, Object, kCallCodeOffset)
5323  kPrototypeTemplateOffset)
5324 ACCESSORS(FunctionTemplateInfo, parent_template, Object, kParentTemplateOffset)
5325 ACCESSORS(FunctionTemplateInfo, named_property_handler, Object,
5326  kNamedPropertyHandlerOffset)
5328  kIndexedPropertyHandlerOffset)
5330  kInstanceTemplateOffset)
5331 ACCESSORS(FunctionTemplateInfo, class_name, Object, kClassNameOffset)
5332 ACCESSORS(FunctionTemplateInfo, signature, Object, kSignatureOffset)
5334  kInstanceCallHandlerOffset)
5336  kAccessCheckInfoOffset)
5338 
5339 ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset)
5341  kInternalFieldCountOffset)
5342 
5343 ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset)
5344 ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
5345 
5346 ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
5347 
5348 ACCESSORS(AllocationSite, transition_info, Object, kTransitionInfoOffset)
5349 ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset)
5350 ACCESSORS_TO_SMI(AllocationSite, pretenure_data, kPretenureDataOffset)
5351 ACCESSORS_TO_SMI(AllocationSite, pretenure_create_count,
5352  kPretenureCreateCountOffset)
5354  kDependentCodeOffset)
5355 ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset)
5356 ACCESSORS(AllocationMemento, allocation_site, Object, kAllocationSiteOffset)
5357 
5358 ACCESSORS(Script, source, Object, kSourceOffset)
5359 ACCESSORS(Script, name, Object, kNameOffset)
5360 ACCESSORS(Script, id, Smi, kIdOffset)
5361 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset)
5362 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset)
5363 ACCESSORS(Script, context_data, Object, kContextOffset)
5364 ACCESSORS(Script, wrapper, Foreign, kWrapperOffset)
5365 ACCESSORS_TO_SMI(Script, type, kTypeOffset)
5366 ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
5367 ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset)
5368 ACCESSORS_TO_SMI(Script, eval_from_instructions_offset,
5369  kEvalFrominstructionsOffsetOffset)
5370 ACCESSORS_TO_SMI(Script, flags, kFlagsOffset)
5371 BOOL_ACCESSORS(Script, flags, is_shared_cross_origin, kIsSharedCrossOriginBit)
5372 ACCESSORS(Script, source_url, Object, kSourceUrlOffset)
5373 ACCESSORS(Script, source_mapping_url, Object, kSourceMappingUrlOffset)
5374 
5375 Script::CompilationType Script::compilation_type() {
5376  return BooleanBit::get(flags(), kCompilationTypeBit) ?
5377  COMPILATION_TYPE_EVAL : COMPILATION_TYPE_HOST;
5378 }
5381  type == COMPILATION_TYPE_EVAL));
5382 }
5386 }
5389  state == COMPILATION_STATE_COMPILED));
5390 }
5391 
5392 
5393 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex)
5394 ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex)
5395 ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex)
5396 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex)
5397 
5398 ACCESSORS_TO_SMI(BreakPointInfo, code_position, kCodePositionIndex)
5399 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex)
5400 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex)
5401 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
5402 
5403 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
5404 ACCESSORS(SharedFunctionInfo, optimized_code_map, Object,
5405  kOptimizedCodeMapOffset)
5406 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
5408  kFeedbackVectorOffset)
5409 ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
5410  kInstanceClassNameOffset)
5411 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset)
5412 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
5413 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
5414 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
5415 
5416 
5417 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset)
5419  kHiddenPrototypeBit)
5420 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit)
5422  kNeedsAccessCheckBit)
5424  kReadOnlyPrototypeBit)
5426  kRemovePrototypeBit)
5428  kDoNotCacheBit)
5430  kIsExpressionBit)
5432  kIsTopLevelBit)
5433 
5436  allows_lazy_compilation,
5437  kAllowLazyCompilation)
5441  kAllowLazyCompilationWithoutContext)
5444  uses_arguments,
5445  kUsesArguments)
5449  kHasDuplicateParameters)
5450 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, asm_function, kIsAsmFunction)
5451 
5452 
5453 #if V8_HOST_ARCH_32_BIT
5454 SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset)
5455 SMI_ACCESSORS(SharedFunctionInfo, formal_parameter_count,
5456  kFormalParameterCountOffset)
5458  kExpectedNofPropertiesOffset)
5459 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset)
5461  kStartPositionAndTypeOffset)
5462 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset)
5464  kFunctionTokenPositionOffset)
5466  kCompilerHintsOffset)
5468  kOptCountAndBailoutReasonOffset)
5469 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset)
5470 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset)
5471 SMI_ACCESSORS(SharedFunctionInfo, profiler_ticks, kProfilerTicksOffset)
5472 
5473 #else
5474 
5475 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \
5476  STATIC_ASSERT(holder::offset % kPointerSize == 0); \
5477  int holder::name() const { \
5478  int value = READ_INT_FIELD(this, offset); \
5479  DCHECK(kHeapObjectTag == 1); \
5480  DCHECK((value & kHeapObjectTag) == 0); \
5481  return value >> 1; \
5482  } \
5483  void holder::set_##name(int value) { \
5484  DCHECK(kHeapObjectTag == 1); \
5485  DCHECK((value & 0xC0000000) == 0xC0000000 || \
5486  (value & 0xC0000000) == 0x0); \
5487  WRITE_INT_FIELD(this, \
5488  offset, \
5489  (value << 1) & ~kHeapObjectTag); \
5490  }
5491 
5492 #define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \
5493  STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \
5494  INT_ACCESSORS(holder, name, offset)
5495 
5496 
5497 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset)
5499  formal_parameter_count,
5500  kFormalParameterCountOffset)
5501 
5504  kExpectedNofPropertiesOffset)
5505 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, num_literals, kNumLiteralsOffset)
5506 
5507 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, end_position, kEndPositionOffset)
5510  kStartPositionAndTypeOffset)
5511 
5514  kFunctionTokenPositionOffset)
5517  kCompilerHintsOffset)
5518 
5521  kOptCountAndBailoutReasonOffset)
5522 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, counters, kCountersOffset)
5523 
5525  ast_node_count,
5526  kAstNodeCountOffset)
5529  kProfilerTicksOffset)
5530 
5531 #endif
5532 
5533 
5536  optimization_disabled,
5537  kOptimizationDisabled)
5538 
5539 
5540 void SharedFunctionInfo::set_optimization_disabled(bool disable) {
5543  disable));
5544  // If disabling optimizations we reflect that in the code object so
5545  // it will not be counted as optimizable code.
5546  if ((code()->kind() == Code::FUNCTION) && disable) {
5547  code()->set_optimizable(false);
5548  }
5549 }
5550 
5551 
5554  ? STRICT : SLOPPY;
5555 }
5556 
5557 
5559  // We only allow mode transitions from sloppy to strict.
5560  DCHECK(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode);
5561  int hints = compiler_hints();
5563  set_compiler_hints(hints);
5564 }
5565 
5566 
5569 }
5570 
5571 
5574  int hints = compiler_hints();
5575  hints = FunctionKindBits::update(hints, kind);
5576  set_compiler_hints(hints);
5577 }
5578 
5579 
5582  kInlineBuiltin)
5585  kNameShouldPrintAsAnonymous)
5586 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction)
5587 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous)
5588 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction)
5590 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_flush, kDontFlush)
5591 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_arrow, kIsArrow)
5592 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_generator, kIsGenerator)
5594  kIsConciseMethod)
5595 
5596 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset)
5597 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset)
5598 
5599 ACCESSORS(PolymorphicCodeCache, cache, Object, kCacheOffset)
5600 
5601 bool Script::HasValidSource() {
5602  Object* src = this->source();
5603  if (!src->IsString()) return true;
5604  String* src_str = String::cast(src);
5605  if (!StringShape(src_str).IsExternal()) return true;
5606  if (src_str->IsOneByteRepresentation()) {
5607  return ExternalOneByteString::cast(src)->resource() != NULL;
5608  } else if (src_str->IsTwoByteRepresentation()) {
5609  return ExternalTwoByteString::cast(src)->resource() != NULL;
5610  }
5611  return true;
5612 }
5613 
5614 
5616  DCHECK(code()->kind() == Code::BUILTIN);
5618 }
5619 
5620 
5623 }
5624 
5625 
5626 void SharedFunctionInfo::set_start_position(int start_position) {
5629 }
5630 
5631 
5632 Code* SharedFunctionInfo::code() const {
5633  return Code::cast(READ_FIELD(this, kCodeOffset));
5634 }
5635 
5636 
5637 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) {
5638  DCHECK(value->kind() != Code::OPTIMIZED_FUNCTION);
5639  WRITE_FIELD(this, kCodeOffset, value);
5640  CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode);
5641 }
5642 
5643 
5645  // If the GC metadata field is already used then the function was
5646  // enqueued as a code flushing candidate and we remove it now.
5647  if (code()->gc_metadata() != NULL) {
5649  flusher->EvictCandidate(this);
5650  }
5651 
5652  DCHECK(code()->gc_metadata() == NULL && value->gc_metadata() == NULL);
5653 
5654  set_code(value);
5655 }
5656 
5657 
5658 ScopeInfo* SharedFunctionInfo::scope_info() const {
5659  return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset));
5660 }
5661 
5662 
5663 void SharedFunctionInfo::set_scope_info(ScopeInfo* value,
5665  WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value));
5667  this,
5669  reinterpret_cast<Object*>(value),
5670  mode);
5671 }
5672 
5673 
5675  return code() != GetIsolate()->builtins()->builtin(Builtins::kCompileLazy);
5676 }
5677 
5678 
5680  return function_data()->IsFunctionTemplateInfo();
5681 }
5682 
5683 
5685  DCHECK(IsApiFunction());
5686  return FunctionTemplateInfo::cast(function_data());
5687 }
5688 
5689 
5691  return function_data()->IsSmi();
5692 }
5693 
5694 
5697  return static_cast<BuiltinFunctionId>(Smi::cast(function_data())->value());
5698 }
5699 
5700 
5702  return ICAgeBits::decode(counters());
5703 }
5704 
5705 
5708 }
5709 
5710 
5712  return DeoptCountBits::decode(counters());
5713 }
5714 
5715 
5718 }
5719 
5720 
5722  int value = counters();
5723  int deopt_count = DeoptCountBits::decode(value);
5726 }
5727 
5728 
5731 }
5732 
5733 
5736 }
5737 
5738 
5741 }
5742 
5743 
5747 }
5748 
5749 
5751  BailoutReason reason = static_cast<BailoutReason>(
5753  return reason;
5754 }
5755 
5756 
5758  Code* code = this->code();
5759  return code->kind() == Code::FUNCTION && code->has_deoptimization_support();
5760 }
5761 
5762 
5764  int tries = opt_reenable_tries();
5766  // We reenable optimization whenever the number of tries is a large
5767  // enough power of 2.
5768  if (tries >= 16 && (((tries - 1) & tries) == 0)) {
5769  set_optimization_disabled(false);
5770  set_opt_count(0);
5771  set_deopt_count(0);
5772  code()->set_optimizable(true);
5773  }
5774 }
5775 
5776 
5778  return context()->global_object()->IsJSBuiltinsObject();
5779 }
5780 
5781 
5783  Object* script = shared()->script();
5784  bool native = script->IsScript() &&
5785  Script::cast(script)->type()->value() == Script::TYPE_NATIVE;
5786  DCHECK(!IsBuiltin() || native); // All builtins are also native.
5787  return native;
5788 }
5789 
5790 
5792  Object* script = shared()->script();
5793  return script->IsScript() &&
5794  Script::cast(script)->type()->value() == Script::TYPE_EXTENSION;
5795 }
5796 
5797 
5799  return shared()->formal_parameter_count() !=
5801 }
5802 
5803 
5805  return code()->kind() == Code::OPTIMIZED_FUNCTION;
5806 }
5807 
5808 
5810  return code()->kind() == Code::FUNCTION && code()->optimizable();
5811 }
5812 
5813 
5815  return code() == GetIsolate()->builtins()->builtin(
5816  Builtins::kCompileOptimized);
5817 }
5818 
5819 
5821  return code() == GetIsolate()->builtins()->builtin(
5822  Builtins::kCompileOptimizedConcurrent);
5823 }
5824 
5825 
5827  return code() == GetIsolate()->builtins()->builtin(
5828  Builtins::kInOptimizationQueue);
5829 }
5830 
5831 
5833  return has_initial_map() &&
5835 }
5836 
5837 
5839  return Code::cast(
5841 }
5842 
5843 
5845  DCHECK(!GetHeap()->InNewSpace(value));
5846  Address entry = value->entry();
5847  WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry));
5848  GetHeap()->incremental_marking()->RecordWriteOfCodeEntry(
5849  this,
5851  value);
5852 }
5853 
5854 
5856  DCHECK(!GetHeap()->InNewSpace(value));
5857  Address entry = value->entry();
5858  WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry));
5859 }
5860 
5861 
5863  bool was_optimized = IsOptimized();
5864  bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION;
5865 
5866  if (was_optimized && is_optimized) {
5867  shared()->EvictFromOptimizedCodeMap(this->code(),
5868  "Replacing with another optimized code");
5869  }
5870 
5871  set_code(code);
5872 
5873  // Add/remove the function from the list of optimized functions for this
5874  // context based on the state change.
5875  if (!was_optimized && is_optimized) {
5877  }
5878  if (was_optimized && !is_optimized) {
5879  // TODO(titzer): linear in the number of optimized functions; fix!
5881  }
5882 }
5883 
5884 
5886  return Context::cast(READ_FIELD(this, kContextOffset));
5887 }
5888 
5889 
5891  return context()->global_proxy();
5892 }
5893 
5894 
5896  DCHECK(value->IsUndefined() || value->IsContext());
5897  WRITE_FIELD(this, kContextOffset, value);
5898  WRITE_BARRIER(GetHeap(), this, kContextOffset, value);
5899 }
5900 
5901 ACCESSORS(JSFunction, prototype_or_initial_map, Object,
5902  kPrototypeOrInitialMapOffset)
5903 
5904 
5906  return Map::cast(prototype_or_initial_map());
5907 }
5908 
5909 
5911  return prototype_or_initial_map()->IsMap();
5912 }
5913 
5914 
5916  return has_initial_map() || !prototype_or_initial_map()->IsTheHole();
5917 }
5918 
5919 
5922 }
5923 
5924 
5927  if (has_initial_map()) return initial_map()->prototype();
5928  // When there is no initial map and the prototype is a JSObject, the
5929  // initial map field is used for the prototype field.
5930  return prototype_or_initial_map();
5931 }
5932 
5933 
5935  DCHECK(has_prototype());
5936  // If the function's prototype property has been set to a non-JSObject
5937  // value, that value is stored in the constructor field of the map.
5938  if (map()->has_non_instance_prototype()) return map()->constructor();
5939  return instance_prototype();
5940 }
5941 
5942 
5944  return map()->function_with_prototype();
5945 }
5946 
5947 
5949  return code() != GetIsolate()->builtins()->builtin(Builtins::kCompileLazy);
5950 }
5951 
5952 
5954  DCHECK(!shared()->bound());
5955  return literals_or_bindings();
5956 }
5957 
5958 
5960  DCHECK(!shared()->bound());
5961  set_literals_or_bindings(literals);
5962 }
5963 
5964 
5966  DCHECK(shared()->bound());
5967  return literals_or_bindings();
5968 }
5969 
5970 
5972  DCHECK(shared()->bound());
5973  // Bound function literal may be initialized to the empty fixed array
5974  // before the bindings are set.
5975  DCHECK(bindings == GetHeap()->empty_fixed_array() ||
5976  bindings->map() == GetHeap()->fixed_cow_array_map());
5977  set_literals_or_bindings(bindings);
5978 }
5979 
5980 
5982  DCHECK(!shared()->bound());
5983  return literals()->length();
5984 }
5985 
5986 
5988  DCHECK(id < kJSBuiltinsCount); // id is unsigned.
5989  return READ_FIELD(this, OffsetOfFunctionWithId(id));
5990 }
5991 
5992 
5994  Object* value) {
5995  DCHECK(id < kJSBuiltinsCount); // id is unsigned.
5996  WRITE_FIELD(this, OffsetOfFunctionWithId(id), value);
5997  WRITE_BARRIER(GetHeap(), this, OffsetOfFunctionWithId(id), value);
5998 }
5999 
6000 
6002  DCHECK(id < kJSBuiltinsCount); // id is unsigned.
6003  return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id)));
6004 }
6005 
6006 
6008  Code* value) {
6009  DCHECK(id < kJSBuiltinsCount); // id is unsigned.
6010  WRITE_FIELD(this, OffsetOfCodeWithId(id), value);
6011  DCHECK(!GetHeap()->InNewSpace(value));
6012 }
6013 
6014 
6015 ACCESSORS(JSProxy, handler, Object, kHandlerOffset)
6016 ACCESSORS(JSProxy, hash, Object, kHashOffset)
6017 ACCESSORS(JSFunctionProxy, call_trap, Object, kCallTrapOffset)
6018 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset)
6019 
6020 
6021 void JSProxy::InitializeBody(int object_size, Object* value) {
6022  DCHECK(!value->IsHeapObject() || !GetHeap()->InNewSpace(value));
6023  for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
6024  WRITE_FIELD(this, offset, value);
6025  }
6026 }
6027 
6028 
6029 ACCESSORS(JSCollection, table, Object, kTableOffset)
6030 
6031 
6032 #define ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(name, type, offset) \
6033  template<class Derived, class TableType> \
6034  type* OrderedHashTableIterator<Derived, TableType>::name() const { \
6035  return type::cast(READ_FIELD(this, offset)); \
6036  } \
6037  template<class Derived, class TableType> \
6038  void OrderedHashTableIterator<Derived, TableType>::set_##name( \
6039  type* value, WriteBarrierMode mode) { \
6040  WRITE_FIELD(this, offset, value); \
6041  CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \
6042  }
6043 
6044 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(table, Object, kTableOffset)
6045 ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(index, Object, kIndexOffset)
6047 
6048 #undef ORDERED_HASH_TABLE_ITERATOR_ACCESSORS
6049 
6050 
6051 ACCESSORS(JSWeakCollection, table, Object, kTableOffset)
6052 ACCESSORS(JSWeakCollection, next, Object, kNextOffset)
6053 
6054 
6055 Address Foreign::foreign_address() {
6056  return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset));
6057 }
6058 
6059 
6062 }
6063 
6064 
6065 ACCESSORS(JSGeneratorObject, function, JSFunction, kFunctionOffset)
6066 ACCESSORS(JSGeneratorObject, context, Context, kContextOffset)
6067 ACCESSORS(JSGeneratorObject, receiver, Object, kReceiverOffset)
6068 SMI_ACCESSORS(JSGeneratorObject, continuation, kContinuationOffset)
6069 ACCESSORS(JSGeneratorObject, operand_stack, FixedArray, kOperandStackOffset)
6070 SMI_ACCESSORS(JSGeneratorObject, stack_handler_index, kStackHandlerIndexOffset)
6071 
6072 bool JSGeneratorObject::is_suspended() {
6073  DCHECK_LT(kGeneratorExecuting, kGeneratorClosed);
6074  DCHECK_EQ(kGeneratorClosed, 0);
6075  return continuation() > 0;
6076 }
6077 
6079  return continuation() == kGeneratorClosed;
6080 }
6081 
6083  return continuation() == kGeneratorExecuting;
6084 }
6085 
6086 ACCESSORS(JSModule, context, Object, kContextOffset)
6087 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset)
6088 
6089 
6090 ACCESSORS(JSValue, value, Object, kValueOffset)
6091 
6092 
6093 HeapNumber* HeapNumber::cast(Object* object) {
6094  SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber());
6095  return reinterpret_cast<HeapNumber*>(object);
6096 }
6097 
6098 
6099 const HeapNumber* HeapNumber::cast(const Object* object) {
6100  SLOW_DCHECK(object->IsHeapNumber() || object->IsMutableHeapNumber());
6101  return reinterpret_cast<const HeapNumber*>(object);
6102 }
6103 
6104 
6105 ACCESSORS(JSDate, value, Object, kValueOffset)
6106 ACCESSORS(JSDate, cache_stamp, Object, kCacheStampOffset)
6107 ACCESSORS(JSDate, year, Object, kYearOffset)
6108 ACCESSORS(JSDate, month, Object, kMonthOffset)
6109 ACCESSORS(JSDate, day, Object, kDayOffset)
6110 ACCESSORS(JSDate, weekday, Object, kWeekdayOffset)
6111 ACCESSORS(JSDate, hour, Object, kHourOffset)
6112 ACCESSORS(JSDate, min, Object, kMinOffset)
6113 ACCESSORS(JSDate, sec, Object, kSecOffset)
6114 
6115 
6116 ACCESSORS(JSMessageObject, type, String, kTypeOffset)
6117 ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset)
6118 ACCESSORS(JSMessageObject, script, Object, kScriptOffset)
6119 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset)
6120 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset)
6121 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
6122 
6123 
6124 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
6125 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset)
6126 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
6127 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset)
6128 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
6129 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset)
6130 ACCESSORS(Code, next_code_link, Object, kNextCodeLinkOffset)
6131 
6132 
6133 void Code::WipeOutHeader() {
6134  WRITE_FIELD(this, kRelocationInfoOffset, NULL);
6135  WRITE_FIELD(this, kHandlerTableOffset, NULL);
6136  WRITE_FIELD(this, kDeoptimizationDataOffset, NULL);
6137  WRITE_FIELD(this, kConstantPoolOffset, NULL);
6138  // Do not wipe out major/minor keys on a code stub or IC
6139  if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) {
6140  WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL);
6141  }
6142 }
6143 
6144 
6146  DCHECK(kind() == FUNCTION);
6147  return raw_type_feedback_info();
6148 }
6149 
6150 
6152  DCHECK(kind() == FUNCTION);
6153  set_raw_type_feedback_info(value, mode);
6155  value, mode);
6156 }
6157 
6158 
6161  Smi* smi_key = Smi::cast(raw_type_feedback_info());
6162  return static_cast<uint32_t>(smi_key->value());
6163 }
6164 
6165 
6168  set_raw_type_feedback_info(Smi::FromInt(key));
6169 }
6170 
6171 
6172 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset)
6173 INT_ACCESSORS(Code, ic_age, kICAgeOffset)
6174 
6175 
6176 byte* Code::instruction_start() {
6177  return FIELD_ADDR(this, kHeaderSize);
6178 }
6179 
6180 
6182  return instruction_start() + instruction_size();
6183 }
6184 
6185 
6188 }
6189 
6190 
6192  return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset));
6193 }
6194 
6195 
6198 }
6199 
6200 
6202  return unchecked_relocation_info()->length();
6203 }
6204 
6205 
6206 byte* Code::entry() {
6207  return instruction_start();
6208 }
6209 
6210 
6211 bool Code::contains(byte* inner_pointer) {
6212  return (address() <= inner_pointer) && (inner_pointer <= address() + Size());
6213 }
6214 
6215 
6216 ACCESSORS(JSArray, length, Object, kLengthOffset)
6217 
6218 
6219 void* JSArrayBuffer::backing_store() const {
6220  intptr_t ptr = READ_INTPTR_FIELD(this, kBackingStoreOffset);
6221  return reinterpret_cast<void*>(ptr);
6222 }
6223 
6224 
6225 void JSArrayBuffer::set_backing_store(void* value, WriteBarrierMode mode) {
6226  intptr_t ptr = reinterpret_cast<intptr_t>(value);
6228 }
6229 
6230 
6231 ACCESSORS(JSArrayBuffer, byte_length, Object, kByteLengthOffset)
6232 ACCESSORS_TO_SMI(JSArrayBuffer, flag, kFlagOffset)
6233 
6234 
6235 bool JSArrayBuffer::is_external() {
6236  return BooleanBit::get(flag(), kIsExternalBit);
6237 }
6238 
6239 
6241  set_flag(BooleanBit::set(flag(), kIsExternalBit, value));
6242 }
6243 
6244 
6246  return BooleanBit::get(flag(), kShouldBeFreed);
6247 }
6248 
6249 
6251  set_flag(BooleanBit::set(flag(), kShouldBeFreed, value));
6252 }
6253 
6254 
6255 ACCESSORS(JSArrayBuffer, weak_next, Object, kWeakNextOffset)
6256 ACCESSORS(JSArrayBuffer, weak_first_view, Object, kWeakFirstViewOffset)
6257 
6258 
6259 ACCESSORS(JSArrayBufferView, buffer, Object, kBufferOffset)
6260 ACCESSORS(JSArrayBufferView, byte_offset, Object, kByteOffsetOffset)
6261 ACCESSORS(JSArrayBufferView, byte_length, Object, kByteLengthOffset)
6262 ACCESSORS(JSArrayBufferView, weak_next, Object, kWeakNextOffset)
6263 ACCESSORS(JSTypedArray, length, Object, kLengthOffset)
6264 
6265 ACCESSORS(JSRegExp, data, Object, kDataOffset)
6266 
6267 
6268 JSRegExp::Type JSRegExp::TypeTag() {
6269  Object* data = this->data();
6270  if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
6271  Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
6272  return static_cast<JSRegExp::Type>(smi->value());
6273 }
6274 
6275 
6277  switch (TypeTag()) {
6278  case ATOM:
6279  return 0;
6280  case IRREGEXP:
6281  return Smi::cast(DataAt(kIrregexpCaptureCountIndex))->value();
6282  default:
6283  UNREACHABLE();
6284  return -1;
6285  }
6286 }
6287 
6288 
6290  DCHECK(this->data()->IsFixedArray());
6291  Object* data = this->data();
6292  Smi* smi = Smi::cast(FixedArray::cast(data)->get(kFlagsIndex));
6293  return Flags(smi->value());
6294 }
6295 
6296 
6298  DCHECK(this->data()->IsFixedArray());
6299  Object* data = this->data();
6300  String* pattern= String::cast(FixedArray::cast(data)->get(kSourceIndex));
6301  return pattern;
6302 }
6303 
6304 
6306  DCHECK(TypeTag() != NOT_COMPILED);
6307  return FixedArray::cast(data())->get(index);
6308 }
6309 
6310 
6311 void JSRegExp::SetDataAt(int index, Object* value) {
6312  DCHECK(TypeTag() != NOT_COMPILED);
6313  DCHECK(index >= kDataIndex); // Only implementation data can be set this way.
6314  FixedArray::cast(data())->set(index, value);
6315 }
6316 
6317 
6319  ElementsKind kind = map()->elements_kind();
6320 #if DEBUG
6321  FixedArrayBase* fixed_array =
6322  reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset));
6323 
6324  // If a GC was caused while constructing this object, the elements
6325  // pointer may point to a one pointer filler map.
6326  if (ElementsAreSafeToExamine()) {
6327  Map* map = fixed_array->map();
6329  (map == GetHeap()->fixed_array_map() ||
6330  map == GetHeap()->fixed_cow_array_map())) ||
6331  (IsFastDoubleElementsKind(kind) &&
6332  (fixed_array->IsFixedDoubleArray() ||
6333  fixed_array == GetHeap()->empty_fixed_array())) ||
6334  (kind == DICTIONARY_ELEMENTS &&
6335  fixed_array->IsFixedArray() &&
6336  fixed_array->IsDictionary()) ||
6337  (kind > DICTIONARY_ELEMENTS));
6338  DCHECK((kind != SLOPPY_ARGUMENTS_ELEMENTS) ||
6339  (elements()->IsFixedArray() && elements()->length() >= 2));
6340  }
6341 #endif
6342  return kind;
6343 }
6344 
6345 
6348 }
6349 
6350 
6353 }
6354 
6355 
6358 }
6359 
6360 
6363 }
6364 
6365 
6368 }
6369 
6370 
6373 }
6374 
6375 
6378 }
6379 
6380 
6383 }
6384 
6385 
6388 }
6389 
6390 
6392  HeapObject* array = elements();
6393  DCHECK(array != NULL);
6394  return array->IsExternalArray();
6395 }
6396 
6397 
6398 #define EXTERNAL_ELEMENTS_CHECK(Type, type, TYPE, ctype, size) \
6399 bool JSObject::HasExternal##Type##Elements() { \
6400  HeapObject* array = elements(); \
6401  DCHECK(array != NULL); \
6402  if (!array->IsHeapObject()) \
6403  return false; \
6404  return array->map()->instance_type() == EXTERNAL_##TYPE##_ARRAY_TYPE; \
6405 }
6406 
6408 
6409 #undef EXTERNAL_ELEMENTS_CHECK
6410 
6411 
6413  HeapObject* array = elements();
6414  DCHECK(array != NULL);
6415  return array->IsFixedTypedArrayBase();
6416 }
6417 
6418 
6419 #define FIXED_TYPED_ELEMENTS_CHECK(Type, type, TYPE, ctype, size) \
6420 bool JSObject::HasFixed##Type##Elements() { \
6421  HeapObject* array = elements(); \
6422  DCHECK(array != NULL); \
6423  if (!array->IsHeapObject()) \
6424  return false; \
6425  return array->map()->instance_type() == FIXED_##TYPE##_ARRAY_TYPE; \
6426 }
6427 
6429 
6430 #undef FIXED_TYPED_ELEMENTS_CHECK
6431 
6432 
6434  return map()->has_named_interceptor();
6435 }
6436 
6437 
6439  return map()->has_indexed_interceptor();
6440 }
6441 
6442 
6445  return NameDictionary::cast(properties());
6446 }
6447 
6448 
6451  return SeededNumberDictionary::cast(elements());
6452 }
6453 
6454 
6456  return (field & kHashNotComputedMask) == 0;
6457 }
6458 
6459 
6461  return IsHashFieldComputed(hash_field());
6462 }
6463 
6464 
6466  // Fast case: has hash code already been computed?
6467  uint32_t field = hash_field();
6468  if (IsHashFieldComputed(field)) return field >> kHashShift;
6469  // Slow case: compute hash code and set it. Has to be a string.
6470  return String::cast(this)->ComputeAndSetHash();
6471 }
6472 
6473 bool Name::IsOwn() {
6474  return this->IsSymbol() && Symbol::cast(this)->is_own();
6475 }
6476 
6477 
6479  : length_(length),
6480  raw_running_hash_(seed),
6481  array_index_(0),
6482  is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize),
6483  is_first_char_(true) {
6484  DCHECK(FLAG_randomize_hashes || raw_running_hash_ == 0);
6485 }
6486 
6487 
6490 }
6491 
6492 
6493 uint32_t StringHasher::AddCharacterCore(uint32_t running_hash, uint16_t c) {
6494  running_hash += c;
6495  running_hash += (running_hash << 10);
6496  running_hash ^= (running_hash >> 6);
6497  return running_hash;
6498 }
6499 
6500 
6501 uint32_t StringHasher::GetHashCore(uint32_t running_hash) {
6502  running_hash += (running_hash << 3);
6503  running_hash ^= (running_hash >> 11);
6504  running_hash += (running_hash << 15);
6505  if ((running_hash & String::kHashBitMask) == 0) {
6506  return kZeroHash;
6507  }
6508  return running_hash;
6509 }
6510 
6511 
6513  // Use the Jenkins one-at-a-time hash function to update the hash
6514  // for the given character.
6515  raw_running_hash_ = AddCharacterCore(raw_running_hash_, c);
6516 }
6517 
6518 
6521  if (c < '0' || c > '9') {
6522  is_array_index_ = false;
6523  return false;
6524  }
6525  int d = c - '0';
6526  if (is_first_char_) {
6527  is_first_char_ = false;
6528  if (c == '0' && length_ > 1) {
6529  is_array_index_ = false;
6530  return false;
6531  }
6532  }
6533  if (array_index_ > 429496729U - ((d + 2) >> 3)) {
6534  is_array_index_ = false;
6535  return false;
6536  }
6537  array_index_ = array_index_ * 10 + d;
6538  return true;
6539 }
6540 
6541 
6542 template<typename Char>
6543 inline void StringHasher::AddCharacters(const Char* chars, int length) {
6544  DCHECK(sizeof(Char) == 1 || sizeof(Char) == 2);
6545  int i = 0;
6546  if (is_array_index_) {
6547  for (; i < length; i++) {
6548  AddCharacter(chars[i]);
6549  if (!UpdateIndex(chars[i])) {
6550  i++;
6551  break;
6552  }
6553  }
6554  }
6555  for (; i < length; i++) {
6557  AddCharacter(chars[i]);
6558  }
6559 }
6560 
6561 
6562 template <typename schar>
6564  int length,
6565  uint32_t seed) {
6566  StringHasher hasher(length, seed);
6567  if (!hasher.has_trivial_hash()) hasher.AddCharacters(chars, length);
6568  return hasher.GetHashField();
6569 }
6570 
6571 
6573  IteratingStringHasher hasher(string->length(), seed);
6574  // Nothing to do.
6575  if (hasher.has_trivial_hash()) return hasher.GetHashField();
6576  ConsString* cons_string = String::VisitFlat(&hasher, string);
6577  // The string was flat.
6578  if (cons_string == NULL) return hasher.GetHashField();
6579  // This is a ConsString, iterate across it.
6580  ConsStringIteratorOp op(cons_string);
6581  int offset;
6582  while (NULL != (string = op.Next(&offset))) {
6583  String::VisitFlat(&hasher, string, offset);
6584  }
6585  return hasher.GetHashField();
6586 }
6587 
6588 
6590  int length) {
6591  AddCharacters(chars, length);
6592 }
6593 
6594 
6596  int length) {
6597  AddCharacters(chars, length);
6598 }
6599 
6600 
6602  return IsString() && String::cast(this)->AsArrayIndex(index);
6603 }
6604 
6605 
6607  uint32_t field = hash_field();
6608  if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) {
6609  return false;
6610  }
6611  return SlowAsArrayIndex(index);
6612 }
6613 
6614 
6616  DCHECK(IsInternalizedString());
6617  DCHECK(HasHashCode());
6618  if (canonical == this) return; // No need to forward.
6619  DCHECK(SlowEquals(canonical));
6620  DCHECK(canonical->IsInternalizedString());
6621  DCHECK(canonical->HasHashCode());
6622  WRITE_FIELD(this, kHashFieldOffset, canonical);
6623  // Setting the hash field to a tagged value sets the LSB, causing the hash
6624  // code to be interpreted as uninitialized. We use this fact to recognize
6625  // that we have a forwarded string.
6626  DCHECK(!HasHashCode());
6627 }
6628 
6629 
6631  DCHECK(IsInternalizedString());
6632  if (HasHashCode()) return this;
6633  String* canonical = String::cast(READ_FIELD(this, kHashFieldOffset));
6634  DCHECK(canonical->IsInternalizedString());
6635  DCHECK(SlowEquals(canonical));
6636  DCHECK(canonical->HasHashCode());
6637  return canonical;
6638 }
6639 
6640 
6642  return map()->constructor();
6643 }
6644 
6645 
6647  Handle<Name> name) {
6648  if (object->IsJSProxy()) {
6649  Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6650  return JSProxy::HasPropertyWithHandler(proxy, name);
6651  }
6653  if (!result.has_value) return Maybe<bool>();
6654  return maybe(result.value != ABSENT);
6655 }
6656 
6657 
6659  Handle<Name> name) {
6660  if (object->IsJSProxy()) {
6661  Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6662  return JSProxy::HasPropertyWithHandler(proxy, name);
6663  }
6665  if (!result.has_value) return Maybe<bool>();
6666  return maybe(result.value != ABSENT);
6667 }
6668 
6669 
6671  Handle<JSReceiver> object, Handle<Name> key) {
6672  uint32_t index;
6673  if (object->IsJSObject() && key->AsArrayIndex(&index)) {
6674  return GetElementAttribute(object, index);
6675  }
6676  LookupIterator it(object, key);
6677  return GetPropertyAttributes(&it);
6678 }
6679 
6680 
6682  Handle<JSReceiver> object, uint32_t index) {
6683  if (object->IsJSProxy()) {
6685  Handle<JSProxy>::cast(object), object, index);
6686  }
6688  Handle<JSObject>::cast(object), object, index, true);
6689 }
6690 
6691 
6693  return JSGlobalProxy::cast(global_proxy())->IsDetachedFrom(this);
6694 }
6695 
6696 
6698  const PrototypeIterator iter(this->GetIsolate(),
6699  const_cast<JSGlobalProxy*>(this));
6700  return iter.GetCurrent() != global;
6701 }
6702 
6703 
6705  return object->IsJSProxy()
6708 }
6709 
6710 
6712  return IsJSProxy()
6713  ? JSProxy::cast(this)->GetIdentityHash()
6714  : JSObject::cast(this)->GetIdentityHash();
6715 }
6716 
6717 
6719  if (object->IsJSProxy()) {
6720  Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6721  return JSProxy::HasElementWithHandler(proxy, index);
6722  }
6724  Handle<JSObject>::cast(object), object, index, true);
6725  if (!result.has_value) return Maybe<bool>();
6726  return maybe(result.value != ABSENT);
6727 }
6728 
6729 
6731  uint32_t index) {
6732  if (object->IsJSProxy()) {
6733  Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6734  return JSProxy::HasElementWithHandler(proxy, index);
6735  }
6737  Handle<JSObject>::cast(object), object, index, false);
6738  if (!result.has_value) return Maybe<bool>();
6739  return maybe(result.value != ABSENT);
6740 }
6741 
6742 
6744  Handle<JSReceiver> object, uint32_t index) {
6745  if (object->IsJSProxy()) {
6747  Handle<JSProxy>::cast(object), object, index);
6748  }
6750  Handle<JSObject>::cast(object), object, index, false);
6751 }
6752 
6753 
6755  return BooleanBit::get(flag(), kAllCanReadBit);
6756 }
6757 
6758 
6760  set_flag(BooleanBit::set(flag(), kAllCanReadBit, value));
6761 }
6762 
6763 
6766 }
6767 
6768 
6770  set_flag(BooleanBit::set(flag(), kAllCanWriteBit, value));
6771 }
6772 
6773 
6775  return AttributesField::decode(static_cast<uint32_t>(flag()->value()));
6776 }
6777 
6778 
6780  set_flag(Smi::FromInt(AttributesField::update(flag()->value(), attributes)));
6781 }
6782 
6783 
6785  if (!HasExpectedReceiverType()) return true;
6786  if (!receiver->IsJSObject()) return false;
6787  return FunctionTemplateInfo::cast(expected_receiver_type())
6788  ->IsTemplateFor(JSObject::cast(receiver)->map());
6789 }
6790 
6791 
6793  set_setter(GetIsolate()->heap()->undefined_value(), SKIP_WRITE_BARRIER);
6794 }
6795 
6796 
6797 template<typename Derived, typename Shape, typename Key>
6799  Handle<Object> key,
6800  Handle<Object> value) {
6801  SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0)));
6802 }
6803 
6804 
6805 template<typename Derived, typename Shape, typename Key>
6807  Handle<Object> key,
6808  Handle<Object> value,
6809  PropertyDetails details) {
6810  DCHECK(!key->IsName() ||
6811  details.IsDeleted() ||
6812  details.dictionary_index() > 0);
6813  int index = DerivedHashTable::EntryToIndex(entry);
6814  DisallowHeapAllocation no_gc;
6816  FixedArray::set(index, *key, mode);
6817  FixedArray::set(index+1, *value, mode);
6818  FixedArray::set(index+2, details.AsSmi());
6819 }
6820 
6821 
6823  DCHECK(other->IsNumber());
6824  return key == static_cast<uint32_t>(other->Number());
6825 }
6826 
6827 
6829  return ComputeIntegerHash(key, 0);
6830 }
6831 
6832 
6834  Object* other) {
6835  DCHECK(other->IsNumber());
6836  return ComputeIntegerHash(static_cast<uint32_t>(other->Number()), 0);
6837 }
6838 
6839 
6841  return ComputeIntegerHash(key, seed);
6842 }
6843 
6844 
6846  uint32_t seed,
6847  Object* other) {
6848  DCHECK(other->IsNumber());
6849  return ComputeIntegerHash(static_cast<uint32_t>(other->Number()), seed);
6850 }
6851 
6852 
6854  return isolate->factory()->NewNumberFromUint(key);
6855 }
6856 
6857 
6859  // We know that all entries in a hash table had their hash keys created.
6860  // Use that knowledge to have fast failure.
6861  if (key->Hash() != Name::cast(other)->Hash()) return false;
6862  return key->Equals(Name::cast(other));
6863 }
6864 
6865 
6867  return key->Hash();
6868 }
6869 
6870 
6872  return Name::cast(other)->Hash();
6873 }
6874 
6875 
6877  Handle<Name> key) {
6878  DCHECK(key->IsUniqueName());
6879  return key;
6880 }
6881 
6882 
6884  Handle<NameDictionary> dictionary) {
6886 }
6887 
6888 
6890  return key->SameValue(other);
6891 }
6892 
6893 
6895  return Smi::cast(key->GetHash())->value();
6896 }
6897 
6898 
6900  Object* other) {
6901  return Smi::cast(other->GetHash())->value();
6902 }
6903 
6904 
6906  Handle<Object> key) {
6907  return key;
6908 }
6909 
6910 
6913  return DerivedHashTable::Shrink(table, key);
6914 }
6915 
6916 
6917 template <int entrysize>
6919  return key->SameValue(other);
6920 }
6921 
6922 
6923 template <int entrysize>
6925  intptr_t hash = reinterpret_cast<intptr_t>(*key);
6926  return (uint32_t)(hash & 0xFFFFFFFF);
6927 }
6928 
6929 
6930 template <int entrysize>
6932  Object* other) {
6933  intptr_t hash = reinterpret_cast<intptr_t>(other);
6934  return (uint32_t)(hash & 0xFFFFFFFF);
6935 }
6936 
6937 
6938 template <int entrysize>
6940  Handle<Object> key) {
6941  return key;
6942 }
6943 
6944 
6946  // No write barrier is needed since empty_fixed_array is not in new space.
6947  // Please note this function is used during marking:
6948  // - MarkCompactCollector::MarkUnmarkedObject
6949  // - IncrementalMarking::Step
6950  DCHECK(!heap->InNewSpace(heap->empty_fixed_array()));
6951  WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array());
6952 }
6953 
6954 
6955 void JSArray::EnsureSize(Handle<JSArray> array, int required_size) {
6956  DCHECK(array->HasFastSmiOrObjectElements());
6957  Handle<FixedArray> elts = handle(FixedArray::cast(array->elements()));
6958  const int kArraySizeThatFitsComfortablyInNewSpace = 128;
6959  if (elts->length() < required_size) {
6960  // Doubling in size would be overkill, but leave some slack to avoid
6961  // constantly growing.
6962  Expand(array, required_size + (required_size >> 3));
6963  // It's a performance benefit to keep a frequently used array in new-space.
6964  } else if (!array->GetHeap()->new_space()->Contains(*elts) &&
6965  required_size < kArraySizeThatFitsComfortablyInNewSpace) {
6966  // Expand will allocate a new backing store in new space even if the size
6967  // we asked for isn't larger than what we had before.
6968  Expand(array, required_size);
6969  }
6970 }
6971 
6972 
6973 void JSArray::set_length(Smi* length) {
6974  // Don't need a write barrier for a Smi.
6975  set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER);
6976 }
6977 
6978 
6980  bool result = elements()->IsFixedArray() || elements()->IsFixedDoubleArray();
6981  DCHECK(result == !HasExternalArrayElements());
6982  return result;
6983 }
6984 
6985 
6987  Handle<FixedArrayBase> storage) {
6988  EnsureCanContainElements(array, storage, storage->length(),
6990 
6991  DCHECK((storage->map() == array->GetHeap()->fixed_double_array_map() &&
6992  IsFastDoubleElementsKind(array->GetElementsKind())) ||
6993  ((storage->map() != array->GetHeap()->fixed_double_array_map()) &&
6994  (IsFastObjectElementsKind(array->GetElementsKind()) ||
6995  (IsFastSmiElementsKind(array->GetElementsKind()) &&
6996  Handle<FixedArray>::cast(storage)->ContainsOnlySmisOrHoles()))));
6997  array->set_elements(*storage);
6998  array->set_length(Smi::FromInt(storage->length()));
6999 }
7000 
7001 
7003  int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
7004  return ICTotalCountField::decode(current);
7005 }
7006 
7007 
7009  int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
7010  value = ICTotalCountField::update(value,
7011  ICTotalCountField::decode(count));
7012  WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(value));
7013 }
7014 
7015 
7017  int current = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
7018  return ICsWithTypeInfoCountField::decode(current);
7019 }
7020 
7021 
7023  if (delta == 0) return;
7024  int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
7025  int new_count = ICsWithTypeInfoCountField::decode(value) + delta;
7026  // We can get negative count here when the type-feedback info is
7027  // shared between two code objects. The can only happen when
7028  // the debugger made a shallow copy of code object (see Heap::CopyCode).
7029  // Since we do not optimize when the debugger is active, we can skip
7030  // this counter update.
7031  if (new_count >= 0) {
7032  new_count &= ICsWithTypeInfoCountField::kMask;
7033  value = ICsWithTypeInfoCountField::update(value, new_count);
7034  WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(value));
7035  }
7036 }
7037 
7038 
7040  return Smi::cast(READ_FIELD(this, kStorage3Offset))->value();
7041 }
7042 
7043 
7045  if (delta == 0) return;
7046  int new_count = ic_generic_count() + delta;
7047  if (new_count >= 0) {
7048  new_count &= ~Smi::kMinValue;
7049  WRITE_FIELD(this, kStorage3Offset, Smi::FromInt(new_count));
7050  }
7051 }
7052 
7053 
7058 }
7059 
7060 
7062  int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
7063  int checksum = OwnTypeChangeChecksum::decode(value);
7064  checksum = (checksum + 1) % (1 << kTypeChangeChecksumBits);
7065  value = OwnTypeChangeChecksum::update(value, checksum);
7066  // Ensure packed bit field is in Smi range.
7067  if (value > Smi::kMaxValue) value |= Smi::kMinValue;
7068  if (value < Smi::kMinValue) value &= ~Smi::kMinValue;
7069  WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(value));
7070 }
7071 
7072 
7074  int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
7075  int mask = (1 << kTypeChangeChecksumBits) - 1;
7076  value = InlinedTypeChangeChecksum::update(value, checksum & mask);
7077  // Ensure packed bit field is in Smi range.
7078  if (value > Smi::kMaxValue) value |= Smi::kMinValue;
7079  if (value < Smi::kMinValue) value &= ~Smi::kMinValue;
7080  WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(value));
7081 }
7082 
7083 
7085  int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value();
7086  return OwnTypeChangeChecksum::decode(value);
7087 }
7088 
7089 
7091  int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value();
7092  int mask = (1 << kTypeChangeChecksumBits) - 1;
7093  return InlinedTypeChangeChecksum::decode(value) == (checksum & mask);
7094 }
7095 
7096 
7097 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot)
7098 
7099 
7100 Relocatable::Relocatable(Isolate* isolate) {
7101  isolate_ = isolate;
7102  prev_ = isolate->relocatable_top();
7103  isolate->set_relocatable_top(this);
7104 }
7105 
7106 
7107 Relocatable::~Relocatable() {
7108  DCHECK_EQ(isolate_->relocatable_top(), this);
7109  isolate_->set_relocatable_top(prev_);
7110 }
7111 
7112 
7114  return map->instance_size();
7115 }
7116 
7117 
7119  v->VisitExternalReference(
7120  reinterpret_cast<Address*>(FIELD_ADDR(this, kForeignAddressOffset)));
7121 }
7122 
7123 
7124 template<typename StaticVisitor>
7126  StaticVisitor::VisitExternalReference(
7127  reinterpret_cast<Address*>(FIELD_ADDR(this, kForeignAddressOffset)));
7128 }
7129 
7130 
7133  v->VisitExternalOneByteString(
7134  reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
7135 }
7136 
7137 
7138 template <typename StaticVisitor>
7141  StaticVisitor::VisitExternalOneByteString(
7142  reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
7143 }
7144 
7145 
7148  v->VisitExternalTwoByteString(
7149  reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
7150 }
7151 
7152 
7153 template<typename StaticVisitor>
7156  StaticVisitor::VisitExternalTwoByteString(
7157  reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
7158 }
7159 
7160 
7161 template<int start_offset, int end_offset, int size>
7163  HeapObject* obj,
7164  ObjectVisitor* v) {
7165  v->VisitPointers(HeapObject::RawField(obj, start_offset),
7166  HeapObject::RawField(obj, end_offset));
7167 }
7168 
7169 
7170 template<int start_offset>
7172  int object_size,
7173  ObjectVisitor* v) {
7174  v->VisitPointers(HeapObject::RawField(obj, start_offset),
7175  HeapObject::RawField(obj, object_size));
7176 }
7177 
7178 
7179 template<class Derived, class TableType>
7181  TableType* table(TableType::cast(this->table()));
7182  int index = Smi::cast(this->index())->value();
7183  Object* key = table->KeyAt(index);
7184  DCHECK(!key->IsTheHole());
7185  return key;
7186 }
7187 
7188 
7190  array->set(0, CurrentKey());
7191 }
7192 
7193 
7195  array->set(0, CurrentKey());
7196  array->set(1, CurrentValue());
7197 }
7198 
7199 
7201  OrderedHashMap* table(OrderedHashMap::cast(this->table()));
7202  int index = Smi::cast(this->index())->value();
7203  Object* value = table->ValueAt(index);
7204  DCHECK(!value->IsTheHole());
7205  return value;
7206 }
7207 
7208 
7209 #undef TYPE_CHECKER
7210 #undef CAST_ACCESSOR
7211 #undef INT_ACCESSORS
7212 #undef ACCESSORS
7213 #undef ACCESSORS_TO_SMI
7214 #undef SMI_ACCESSORS
7215 #undef SYNCHRONIZED_SMI_ACCESSORS
7216 #undef NOBARRIER_SMI_ACCESSORS
7217 #undef BOOL_GETTER
7218 #undef BOOL_ACCESSORS
7219 #undef FIELD_ADDR
7220 #undef FIELD_ADDR_CONST
7221 #undef READ_FIELD
7222 #undef NOBARRIER_READ_FIELD
7223 #undef WRITE_FIELD
7224 #undef NOBARRIER_WRITE_FIELD
7225 #undef WRITE_BARRIER
7226 #undef CONDITIONAL_WRITE_BARRIER
7227 #undef READ_DOUBLE_FIELD
7228 #undef WRITE_DOUBLE_FIELD
7229 #undef READ_INT_FIELD
7230 #undef WRITE_INT_FIELD
7231 #undef READ_INTPTR_FIELD
7232 #undef WRITE_INTPTR_FIELD
7233 #undef READ_UINT32_FIELD
7234 #undef WRITE_UINT32_FIELD
7235 #undef READ_SHORT_FIELD
7236 #undef WRITE_SHORT_FIELD
7237 #undef READ_BYTE_FIELD
7238 #undef WRITE_BYTE_FIELD
7239 #undef NOBARRIER_READ_BYTE_FIELD
7240 #undef NOBARRIER_WRITE_BYTE_FIELD
7241 
7242 } } // namespace v8::internal
7243 
7244 #endif // V8_OBJECTS_INL_H_
#define BUILTIN(name)
Definition: builtins.cc:122
#define DCHECK_TAG_ALIGNED(address)
Definition: checks.h:57
#define SLOW_DCHECK(condition)
Definition: checks.h:30
An object reference managed by the v8 garbage collector.
Definition: v8.h:198
Isolate represents an isolated instance of the V8 engine.
Definition: v8.h:4356
A superclass for symbols and strings.
Definition: v8.h:1741
A JavaScript object (ECMA-262, 4.3.3)
Definition: v8.h:2283
An ExternalOneByteStringResource is a wrapper around an one-byte string buffer that resides outside V...
Definition: v8.h:1918
An ExternalStringResource is a wrapper around a two-byte string buffer that resides outside V8's heap...
Definition: v8.h:1885
@ ONE_BYTE_ENCODING
Definition: v8.h:1758
@ TWO_BYTE_ENCODING
Definition: v8.h:1756
bool IsName() const
Returns true if this value is a symbol or a string.
Definition: api.cc:2414
bool IsTrue() const
Returns true if this value is true.
Definition: api.cc:2399
bool IsString() const
Returns true if this value is an instance of the String type.
Definition: v8.h:6552
bool IsNumber() const
Returns true if this value is a number.
Definition: api.cc:2473
bool IsNull() const
Returns true if this value is the null value.
Definition: v8.h:6534
bool IsBoolean() const
Returns true if this value is boolean.
Definition: api.cc:2500
bool IsFalse() const
Returns true if this value is false.
Definition: api.cc:2404
bool IsExternal() const
Returns true if this value is external.
Definition: api.cc:2505
bool IsUndefined() const
Returns true if this value is the undefined value.
Definition: v8.h:6516
static double nan_value()
PropertyAttributes property_attributes()
Definition: objects-inl.h:6774
void set_all_can_write(bool value)
Definition: objects-inl.h:6769
static const int kAllCanWriteBit
Definition: objects.h:10147
static const int kAllCanReadBit
Definition: objects.h:10146
void set_property_attributes(PropertyAttributes attributes)
Definition: objects-inl.h:6779
bool IsCompatibleReceiver(Object *receiver)
Definition: objects-inl.h:6784
void set_all_can_read(bool value)
Definition: objects-inl.h:6759
const char * PretenureDecisionName(PretenureDecision decision)
Definition: objects.cc:12672
void set_pretenure_decision(PretenureDecision decision)
Definition: objects.h:8149
static const double kPretenureRatio
Definition: objects.h:8093
static bool CanTrack(InstanceType type)
Definition: objects-inl.h:1614
static const int kPretenureMinimumCreated
Definition: objects.h:8094
static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind)
Definition: objects-inl.h:1591
void set_deopt_dependent_code(bool deopt)
Definition: objects.h:8161
PretenureDecision pretenure_decision()
Definition: objects.h:8144
bool DigestPretenuringFeedback(bool maximum_size_scavenge)
Definition: objects-inl.h:1694
void set_memento_create_count(int count)
Definition: objects.h:8179
bool MakePretenureDecision(PretenureDecision current_decision, double ratio, bool maximum_size_scavenge)
Definition: objects-inl.h:1668
DependentCode::DependencyGroup ToDependencyGroup(Reason reason)
Definition: objects-inl.h:1624
void set_memento_found_count(int count)
Definition: objects-inl.h:1639
void SetElementsKind(ElementsKind kind)
Definition: objects.h:8209
static U update(U previous, T value)
Definition: utils.h:223
static const U kMask
Definition: utils.h:203
static const T kMax
Definition: utils.h:209
static U encode(T value)
Definition: utils.h:217
static T decode(U value)
Definition: utils.h:228
static bool get(Smi *smi, int bit_position)
Definition: objects.h:10791
static Smi * set(Smi *smi, int bit_position, bool v)
Definition: objects.h:10799
Code * builtin(Name name)
Definition: builtins.h:254
int get_int(int index)
Definition: objects-inl.h:3782
static ByteArray * FromDataStartAddress(Address address)
Definition: objects-inl.h:3788
void set(int index, byte value)
Definition: objects-inl.h:3776
byte get(int index)
Definition: objects-inl.h:3770
static const int kValueOffset
Definition: objects.h:9446
static Handle< Object > AsHandle(Isolate *isolate, HashTableKey *key)
Definition: objects-inl.h:493
void EvictCandidate(SharedFunctionInfo *shared_info)
void Add(Handle< Map > map_to_find, Handle< Object > obj_to_replace)
Definition: objects-inl.h:5052
Handle< Object > replace_[kMaxCount]
Definition: objects-inl.h:5062
unsigned stack_slots()
Definition: objects-inl.h:4801
void set_allow_osr_at_loop_nesting_level(int level)
Definition: objects-inl.h:4766
void set_compiled_optimizable(bool value)
Definition: objects-inl.h:4751
ConstantPoolArray * constant_pool()
Definition: objects-inl.h:4942
void set_has_deoptimization_support(bool value)
Definition: objects-inl.h:4721
static const int kOptimizableOffset
Definition: objects.h:5377
void set_raw_kind_specific_flags1(int value)
Definition: objects-inl.h:4659
unsigned safepoint_table_offset()
Definition: objects-inl.h:4817
bool is_compiled_optimizable()
Definition: objects-inl.h:4744
static Flags ComputeHandlerFlags(Kind handler_kind, StubType type=NORMAL, CacheHolderFlag holder=kCacheOnReceiver)
Definition: objects-inl.h:4975
void set_has_debug_break_slots(bool value)
Definition: objects-inl.h:4736
static const int kFlagsOffset
Definition: objects.h:5361
void set_constant_pool(Object *constant_pool)
Definition: objects-inl.h:4947
void set_back_edge_table_offset(unsigned offset)
Definition: objects-inl.h:4841
void set_profiler_ticks(int ticks)
Definition: objects-inl.h:4781
static Code * GetCodeFromTargetAddress(Address address)
Definition: objects-inl.h:5018
static const int kKindSpecificFlags2Offset
Definition: objects.h:5363
ExtraICState extra_ic_state()
Definition: objects-inl.h:4647
void set_has_function_cache(bool flag)
Definition: objects-inl.h:4869
int allow_osr_at_loop_nesting_level()
Definition: objects-inl.h:4759
static StubType ExtractTypeFromFlags(Flags flags)
Definition: objects-inl.h:4996
static bool IsWeakObjectInOptimizedCode(Object *object)
Definition: objects-inl.h:5035
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, StubType type=NORMAL, CacheHolderFlag holder=kCacheOnReceiver)
Definition: objects-inl.h:4954
static const int kKindSpecificFlags1Offset
Definition: objects.h:5362
static const int kConstantPoolOffset
Definition: objects.h:5367
bool is_inline_cache_stub()
Definition: objects-inl.h:4921
bool marked_for_deoptimization()
Definition: objects-inl.h:4877
static const int kTypeFeedbackInfoOffset
Definition: objects.h:5355
void set_stub_key(uint32_t key)
Definition: objects-inl.h:6166
byte * relocation_start()
Definition: objects-inl.h:6196
static Flags RemoveTypeAndHolderFromFlags(Flags flags)
Definition: objects-inl.h:5012
STATIC_ASSERT(NUMBER_OF_KINDS<=16)
int instruction_size() const
bool is_keyed_store_stub()
Definition: objects.h:5052
void set_flags(Flags flags)
Definition: objects-inl.h:4615
bool is_keyed_load_stub()
Definition: objects.h:5050
ByteArray * unchecked_relocation_info()
Definition: objects-inl.h:6191
void set_builtin_index(int id)
Definition: objects-inl.h:4795
byte * instruction_end()
Definition: objects-inl.h:6181
static InlineCacheState ExtractICStateFromFlags(Flags flags)
Definition: objects-inl.h:4986
static Kind ExtractKindFromFlags(Flags flags)
Definition: objects-inl.h:4981
bool contains(byte *pc)
Definition: objects-inl.h:6211
void set_safepoint_table_offset(unsigned offset)
Definition: objects-inl.h:4824
void set_is_crankshafted(bool value)
Definition: objects-inl.h:4680
void set_marked_for_deoptimization(bool flag)
Definition: objects-inl.h:4884
byte * instruction_start()
Definition: objects-inl.h:6176
static Object * GetObjectFromEntryAddress(Address location_of_address)
Definition: objects-inl.h:5029
void mark_as_invalidated_weak_stub()
Definition: objects-inl.h:4913
bool is_invalidated_weak_stub()
Definition: objects-inl.h:4907
InlineCacheState ic_state()
Definition: objects-inl.h:4635
static const int kRelocationInfoOffset
Definition: objects.h:5350
static const int kSafepointTableOffsetBitCount
Definition: objects.h:5427
static const int kHeaderSize
Definition: objects.h:5373
static CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags)
Definition: objects-inl.h:5001
uint32_t stub_key()
Definition: objects-inl.h:6159
void set_stack_slots(unsigned slots)
Definition: objects-inl.h:4808
unsigned back_edge_table_offset()
Definition: objects-inl.h:4834
static const int kFullCodeFlags
Definition: objects.h:5379
Object * type_feedback_info()
Definition: objects-inl.h:6145
void set_optimizable(bool value)
Definition: objects-inl.h:4708
void set_raw_kind_specific_flags2(int value)
Definition: objects-inl.h:4664
bool has_debug_break_slots()
Definition: objects-inl.h:4729
static Flags ComputeMonomorphicFlags(Kind kind, ExtraICState extra_ic_state=kNoExtraICState, CacheHolderFlag holder=kCacheOnReceiver, StubType type=NORMAL)
Definition: objects-inl.h:4967
bool back_edges_patched_for_osr()
Definition: objects-inl.h:4851
static Flags RemoveTypeFromFlags(Flags flags)
Definition: objects-inl.h:5006
static bool IsWeakObjectInIC(Object *object)
Definition: objects-inl.h:5067
void set_is_turbofanned(bool value)
Definition: objects-inl.h:4694
bool CanBeWeakStub()
Definition: objects.h:5065
static ExtraICState ExtractExtraICStateFromFlags(Flags flags)
Definition: objects-inl.h:4991
void set_type_feedback_info(Object *value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition: objects-inl.h:6151
static const int kStackSlotsBitCount
Definition: objects.h:5397
static const int kMaxLoopNestingMarker
Definition: objects.h:5346
static const int kProfilerTicksOffset
Definition: objects.h:5385
bool has_deoptimization_support()
Definition: objects-inl.h:4714
static Handle< Object > AsHandle(Isolate *isolate, HashTableKey *key)
Definition: objects-inl.h:487
void Reset(ConsString *cons_string, int offset=0)
Definition: objects.h:9293
void PushRight(ConsString *string)
Definition: objects-inl.h:3658
static int OffsetForDepth(int depth)
Definition: objects-inl.h:3648
String * Next(int *offset_out)
Definition: objects.h:9300
void PushLeft(ConsString *string)
Definition: objects-inl.h:3653
void set_first(String *first, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition: objects-inl.h:3549
static const int kFirstOffset
Definition: objects.h:9061
void set_second(String *second, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition: objects-inl.h:3565
static Type next_type(Type type)
Definition: objects.h:2865
int64_t get_int64_entry(int index)
Definition: objects-inl.h:2482
Address get_code_ptr_entry(int index)
Definition: objects-inl.h:2497
int32_t get_int32_entry(int index)
Definition: objects-inl.h:2511
static const int kFirstEntryOffset
Definition: objects.h:2827
WeakObjectState get_weak_object_state()
Definition: objects-inl.h:2380
bool offset_is_type(int offset, Type type)
Definition: objects-inl.h:2456
void set_at_offset(int offset, int32_t value)
Definition: objects-inl.h:2556
static const int kExtendedInt64CountOffset
Definition: objects.h:2845
Object * get_heap_ptr_entry(int index)
Definition: objects-inl.h:2504
void InitExtended(const NumberOfEntries &small, const NumberOfEntries &extended)
Definition: objects-inl.h:2613
static const int kExtendedInt32CountOffset
Definition: objects.h:2850
static const int kHeaderSize
Definition: objects.h:2826
int last_index(Type type, LayoutSection layout_section)
Definition: objects-inl.h:2410
int OffsetOfElementAt(int index)
Definition: objects.h:2792
void set(int index, Address value)
Definition: objects-inl.h:2533
static const int kExtendedCodePtrCountOffset
Definition: objects.h:2846
void Init(const NumberOfEntries &small)
Definition: objects-inl.h:2594
static int SizeFor(const NumberOfEntries &small)
Definition: objects.h:2755
void set_weak_object_state(WeakObjectState state)
Definition: objects-inl.h:2386
static const int kSmallLayout1Offset
Definition: objects.h:2824
static const int kSmallLayout2Offset
Definition: objects.h:2825
int first_index(Type type, LayoutSection layout_section)
Definition: objects-inl.h:2394
int number_of_entries(Type type, LayoutSection layout_section)
Definition: objects-inl.h:2415
double get_int64_entry_as_double(int index)
Definition: objects-inl.h:2489
static int SizeForExtended(const NumberOfEntries &small, const NumberOfEntries &extended)
Definition: objects.h:2764
static const int kExtendedHeapPtrCountOffset
Definition: objects.h:2848
JSObject * global_proxy()
Definition: contexts.cc:64
static Context * cast(Object *context)
Definition: contexts.h:255
Context * native_context()
Definition: contexts.cc:44
void AddOptimizedFunction(JSFunction *function)
Definition: contexts.cc:280
void RemoveOptimizedFunction(JSFunction *function)
Definition: contexts.cc:318
GlobalObject * global_object()
Definition: contexts.h:437
static const int kFirstDeoptEntryIndex
Definition: objects.h:4804
int number_of_entries(DependencyGroup group)
Definition: objects-inl.h:4554
Object ** slot_at(int i)
Definition: objects-inl.h:4590
void ExtendGroup(DependencyGroup group)
Definition: objects-inl.h:4605
static const int kCodesStartIndex
Definition: objects.h:5589
static const int kGroupCount
Definition: objects.h:5534
void set_number_of_entries(DependencyGroup group, int value)
Definition: objects-inl.h:4560
void set_object_at(int i, Object *object)
Definition: objects-inl.h:4580
CompilationInfo * compilation_info_at(int i)
Definition: objects-inl.h:4574
void copy(int from, int to)
Definition: objects-inl.h:4600
Object ** GetDescriptorStartSlot(int descriptor_number)
Definition: objects-inl.h:2918
void SetValue(int descriptor_number, Object *value)
Definition: objects-inl.h:2976
int GetSortedKeyIndex(int descriptor_number)
Definition: objects-inl.h:2934
void SetRepresentation(int descriptor_number, Representation representation)
Definition: objects-inl.h:2950
static const int kDescriptorLengthOffset
Definition: objects.h:3027
Name * GetKey(int descriptor_number)
Definition: objects-inl.h:2928
static const int kNotFound
Definition: objects.h:3015
void SetSortedKey(int pointer, int descriptor_number)
Definition: objects-inl.h:2944
static int ToValueIndex(int descriptor_number)
Definition: objects.h:3107
Object ** GetValueSlot(int descriptor_number)
Definition: objects-inl.h:2959
PropertyDetails GetDetails(int descriptor_number)
Definition: objects-inl.h:2981
AccessorDescriptor * GetCallbacks(int descriptor_number)
Definition: objects-inl.h:3016
void Get(int descriptor_number, Descriptor *desc)
Definition: objects-inl.h:3023
void SetNumberOfDescriptors(int number_of_descriptors)
Definition: objects-inl.h:2752
Object * GetValue(int descriptor_number)
Definition: objects-inl.h:2970
static int GetValueOffset(int descriptor_number)
Definition: objects-inl.h:2965
void SwapSortedKeys(int first, int second)
Definition: objects-inl.h:3078
int GetFieldIndex(int descriptor_number)
Definition: objects-inl.h:2993
void Set(int descriptor_number, Descriptor *desc)
Definition: objects-inl.h:3048
static int ToDetailsIndex(int descriptor_number)
Definition: objects.h:3101
Object ** GetDescriptorEndSlot(int descriptor_number)
Definition: objects-inl.h:2923
PropertyType GetType(int descriptor_number)
Definition: objects-inl.h:2988
Name * GetSortedKey(int descriptor_number)
Definition: objects-inl.h:2939
Object * GetConstant(int descriptor_number)
Definition: objects-inl.h:3005
void Append(Descriptor *desc)
Definition: objects-inl.h:3058
Object ** GetKeySlot(int descriptor_number)
Definition: objects-inl.h:2912
Object * GetCallbacksObject(int descriptor_number)
Definition: objects-inl.h:3010
static const int kFirstIndex
Definition: objects.h:3019
static int ToKeyIndex(int descriptor_number)
Definition: objects.h:3095
static const int kFirstOffset
Definition: objects.h:3029
HeapType * GetFieldType(int descriptor_number)
Definition: objects-inl.h:2999
int Lookup(Map *source, Name *name)
Definition: heap.h:2307
static void GenerateNewEnumerationIndices(Handle< NameDictionary > dictionary)
Definition: objects.cc:14916
void SetEntry(int entry, Handle< Object > key, Handle< Object > value)
Definition: objects-inl.h:6798
virtual void Validate(Handle< JSObject > obj)=0
static ElementsAccessor * ForKind(ElementsKind elements_kind)
Definition: elements.h:184
static const int kExternalPointerOffset
Definition: objects.h:4471
static Handle< Object > get(Handle< ExternalFloat32Array > array, int index)
Definition: objects-inl.h:3971
void set(int index, float value)
Definition: objects-inl.h:3977
static Handle< Object > get(Handle< ExternalFloat64Array > array, int index)
Definition: objects-inl.h:3991
void set(int index, double value)
Definition: objects-inl.h:3997
void set(int index, int16_t value)
Definition: objects-inl.h:3894
static Handle< Object > get(Handle< ExternalInt16Array > array, int index)
Definition: objects-inl.h:3887
static Handle< Object > get(Handle< ExternalInt32Array > array, int index)
Definition: objects-inl.h:3929
void set(int index, int32_t value)
Definition: objects-inl.h:3936
void set(int index, int8_t value)
Definition: objects-inl.h:3852
static Handle< Object > get(Handle< ExternalInt8Array > array, int index)
Definition: objects-inl.h:3845
void set_resource(const Resource *buffer)
Definition: objects-inl.h:3590
uint16_t ExternalOneByteStringGet(int index)
Definition: objects-inl.h:3604
uint16_t ExternalTwoByteStringGet(int index)
Definition: objects-inl.h:3636
const uint16_t * ExternalTwoByteStringGetData(unsigned start)
Definition: objects-inl.h:3642
void set_resource(const Resource *buffer)
Definition: objects-inl.h:3623
uint16_t get_scalar(int index)
Definition: objects-inl.h:3901
static Handle< Object > get(Handle< ExternalUint16Array > array, int index)
Definition: objects-inl.h:3908
void set(int index, uint16_t value)
Definition: objects-inl.h:3915
static Handle< Object > get(Handle< ExternalUint32Array > array, int index)
Definition: objects-inl.h:3950
uint32_t get_scalar(int index)
Definition: objects-inl.h:3943
void set(int index, uint32_t value)
Definition: objects-inl.h:3957
void set(int index, uint8_t value)
Definition: objects-inl.h:3873
static Handle< Object > get(Handle< ExternalUint8Array > array, int index)
Definition: objects-inl.h:3866
static Handle< Object > get(Handle< ExternalUint8ClampedArray > array, int index)
Definition: objects-inl.h:3811
void set(int index, uint8_t value)
Definition: objects-inl.h:3819
static const int kLengthOffset
Definition: objects.h:2392
static const int kHeaderSize
Definition: objects.h:2393
static int SizeOf(Map *map, HeapObject *object)
Definition: objects.h:2491
Object ** RawFieldOfElementAt(int index)
Definition: objects.h:2458
void set_null(int index)
Definition: objects-inl.h:2714
static int OffsetOfElementAt(int index)
Definition: objects.h:2455
Object * get(int index)
Definition: objects-inl.h:2165
static void NoWriteBarrierSet(FixedArray *array, int index, Object *value)
Definition: objects-inl.h:2694
static void NoIncrementalWriteBarrierSet(FixedArray *array, int index, Object *value)
Definition: objects-inl.h:2680
Object ** GetFirstElementAddress()
Definition: objects-inl.h:1539
bool is_the_hole(int index)
Definition: objects-inl.h:2176
static int SizeFor(int length)
Definition: objects.h:2452
void FillWithHoles(int from, int to)
Definition: objects-inl.h:2733
void set(int index, Object *value)
Definition: objects-inl.h:2190
STATIC_ASSERT(kHeaderSize==Internals::kFixedArrayHeaderSize)
void set_undefined(int index)
Definition: objects-inl.h:2704
void set_the_hole(int index)
Definition: objects-inl.h:2723
static void IterateBody(HeapObject *obj, ObjectVisitor *v)
Definition: objects-inl.h:7162
static double canonical_not_the_hole_nan_as_double()
Definition: objects-inl.h:2210
static double hole_nan_as_double()
Definition: objects-inl.h:2205
static bool is_the_hole_nan(double value)
Definition: objects-inl.h:2200
void set(int index, double value)
Definition: objects-inl.h:2244
int64_t get_representation(int index)
Definition: objects-inl.h:2226
static int SizeFor(int length)
Definition: objects.h:2531
double get_scalar(int index)
Definition: objects-inl.h:2217
static Handle< Object > get(Handle< FixedDoubleArray > array, int index)
Definition: objects-inl.h:2234
void FillWithHoles(int from, int to)
Definition: objects-inl.h:2272
static const int kDataOffset
Definition: objects.h:4716
int TypedArraySize(InstanceType type)
Definition: objects-inl.h:4037
static Handle< Object > SetValue(Handle< FixedTypedArray< Traits > > array, uint32_t index, Handle< Object > value)
Definition: objects-inl.h:4155
void set(int index, ElementType value)
Definition: objects-inl.h:4089
static Handle< Object > get(Handle< FixedTypedArray > array, int index)
Definition: objects-inl.h:4147
static ElementType from_int(int value)
Definition: objects-inl.h:4106
ElementType get_scalar(int index)
Definition: objects-inl.h:4072
static ElementType from_double(double value)
Definition: objects-inl.h:4120
Traits::ElementType ElementType
Definition: objects.h:4737
static void IterateBody(HeapObject *obj, int object_size, ObjectVisitor *v)
Definition: objects-inl.h:7171
void set_foreign_address(Address value)
Definition: objects-inl.h:6060
static const int kForeignAddressOffset
Definition: objects.h:10004
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
bool is_null() const
Definition: handles.h:124
static Handle< T > null()
Definition: handles.h:123
virtual MUST_USE_RESULT Handle< Object > AsHandle(Isolate *isolate)=0
static int ComputeCapacity(int at_least_space_for)
Definition: objects-inl.h:3099
uint32_t Hash(Key key)
Definition: objects.h:3193
static MUST_USE_RESULT Handle< ObjectHashTable > Shrink(Handle< ObjectHashTable > table, Handle< Object > key)
Definition: objects.cc:13961
static const uint32_t kSignMask
Definition: objects.h:1522
static const int kValueOffset
Definition: objects.h:1506
static const uint32_t kExponentMask
Definition: objects.h:1523
static const int kExponentBias
Definition: objects.h:1527
static const int kExponentShift
Definition: objects.h:1528
void set_value(double value)
Definition: objects-inl.h:1520
void synchronized_set_map_no_write_barrier(Map *value)
Definition: objects-inl.h:1429
void set_map_no_write_barrier(Map *value)
Definition: objects-inl.h:1435
static const int kMapOffset
Definition: objects.h:1427
STATIC_ASSERT(kMapOffset==Internals::kHeapObjectMapOffset)
MapWord synchronized_map_word() const
Definition: objects-inl.h:1452
void set_map(Map *value)
Definition: objects-inl.h:1404
Heap * GetHeap() const
Definition: objects-inl.h:1379
static Object ** RawField(HeapObject *obj, int offset)
Definition: objects-inl.h:1311
void synchronized_set_map_word(MapWord map_word)
Definition: objects-inl.h:1458
void IterateNextCodeLink(ObjectVisitor *v, int offset)
Definition: objects-inl.h:1510
void IteratePointer(ObjectVisitor *v, int offset)
Definition: objects-inl.h:1505
Isolate * GetIsolate() const
Definition: objects-inl.h:1387
static HeapObject * FromAddress(Address address)
Definition: objects-inl.h:1464
static const int kHeaderSize
Definition: objects.h:1428
MapWord map_word() const
Definition: objects-inl.h:1440
void set_map_word(MapWord map_word)
Definition: objects-inl.h:1446
void synchronized_set_map(Map *value)
Definition: objects-inl.h:1419
WriteBarrierMode GetWriteBarrierMode(const DisallowHeapAllocation &promise)
Definition: objects-inl.h:2660
void IteratePointers(ObjectVisitor *v, int start, int end)
Definition: objects-inl.h:1499
int SizeFromMap(Map *map)
Definition: objects-inl.h:4259
FixedTypedArrayBase * EmptyFixedTypedArrayForMap(Map *map)
Definition: heap.cc:3184
bool InNewSpace(Object *object)
Definition: heap-inl.h:322
ExternalArray * EmptyExternalArrayForMap(Map *map)
Definition: heap.cc:3178
Isolate * isolate()
Definition: heap-inl.h:589
IncrementalMarking * incremental_marking()
Definition: heap.h:1205
MarkCompactCollector * mark_compact_collector()
Definition: heap.h:1197
static const int kStringEncodingMask
Definition: v8.h:5831
static const int kFullStringRepresentationMask
Definition: v8.h:5830
static const int kExternalTwoByteRepresentationTag
Definition: v8.h:5832
static internal::Object * IntToSmi(int value)
Definition: v8.h:5888
static int SmiValue(const internal::Object *value)
Definition: v8.h:5884
static const int kExternalOneByteRepresentationTag
Definition: v8.h:5833
static bool IsValidSmi(intptr_t value)
Definition: v8.h:5892
static bool HasHeapObjectTag(const internal::Object *value)
Definition: v8.h:5879
Builtins * builtins()
Definition: isolate.h:947
DescriptorLookupCache * descriptor_lookup_cache()
Definition: isolate.h:895
Context * context()
Definition: isolate.h:548
Factory * factory()
Definition: isolate.h:982
void VisitTwoByteString(const uint16_t *chars, int length)
Definition: objects-inl.h:6595
void VisitOneByteString(const uint8_t *chars, int length)
Definition: objects-inl.h:6589
static uint32_t Hash(String *string, uint32_t seed)
Definition: objects-inl.h:6572
static const int kSize
Definition: objects.h:9881
static const int kIsExternalBit
Definition: objects.h:9888
static const int kShouldBeFreed
Definition: objects.h:9889
void set_should_be_freed(bool value)
Definition: objects-inl.h:6250
void set_is_external(bool value)
Definition: objects-inl.h:6240
static const int kBackingStoreOffset
Definition: objects.h:9876
static void EnsureSize(Handle< JSArray > array, int minimum_size_of_backing_fixed_array)
Definition: objects-inl.h:6955
void set_length(Smi *length)
Definition: objects-inl.h:6973
static void SetContent(Handle< JSArray > array, Handle< FixedArrayBase > storage)
Definition: objects-inl.h:6986
static void Expand(Handle< JSArray > array, int minimum_size_of_backing_fixed_array)
Definition: objects.cc:11090
static const int kSize
Definition: objects.h:10073
static const int kJSBuiltinsCount
Definition: objects.h:7513
void set_javascript_builtin(Builtins::JavaScript id, Object *value)
Definition: objects-inl.h:5993
static int OffsetOfFunctionWithId(Builtins::JavaScript id)
Definition: objects.h:7520
void set_javascript_builtin_code(Builtins::JavaScript id, Code *value)
Definition: objects-inl.h:6007
static const int kSize
Definition: objects.h:7517
Code * javascript_builtin_code(Builtins::JavaScript id)
Definition: objects-inl.h:6001
static int OffsetOfCodeWithId(Builtins::JavaScript id)
Definition: objects.h:7524
Object * javascript_builtin(Builtins::JavaScript id)
Definition: objects-inl.h:5987
static const int kSize
Definition: objects.h:9657
static const int kSize
Definition: objects.h:9971
static const int kSize
Definition: objects.h:7632
static const int kCacheSizeIndex
Definition: objects.h:4071
void set_finger_index(int finger_index)
Definition: objects-inl.h:3765
void set_code(Code *code)
Definition: objects-inl.h:5844
void set_context(Object *context)
Definition: objects-inl.h:5895
void set_code_no_write_barrier(Code *code)
Definition: objects-inl.h:5855
void ReplaceCode(Code *code)
Definition: objects-inl.h:5862
bool IsInobjectSlackTrackingInProgress()
Definition: objects-inl.h:5832
void set_literals(FixedArray *literals)
Definition: objects-inl.h:5959
static const int kSize
Definition: objects.h:7385
FixedArray * literals()
Definition: objects-inl.h:5953
FixedArray * function_bindings()
Definition: objects-inl.h:5965
static const int kNoSlackTracking
Definition: objects.h:7263
void set_function_bindings(FixedArray *bindings)
Definition: objects-inl.h:5971
bool IsMarkedForConcurrentOptimization()
Definition: objects-inl.h:5820
static const int kContextOffset
Definition: objects.h:7381
static const int kCodeEntryOffset
Definition: objects.h:7376
static const int kGeneratorClosed
Definition: objects.h:7120
static const int kGeneratorExecuting
Definition: objects.h:7119
static const int kSize
Definition: objects.h:7485
static const int kSize
Definition: objects.h:7429
bool IsDetachedFrom(GlobalObject *global) const
Definition: objects-inl.h:6697
void PopulateValueArray(FixedArray *array)
Definition: objects-inl.h:7194
static const int kSize
Definition: objects.h:7688
static const int kSize
Definition: objects.h:7169
static int SizeOf(Map *map, HeapObject *object)
Definition: objects-inl.h:7113
static void SetMapAndElements(Handle< JSObject > object, Handle< Map > map, Handle< FixedArrayBase > elements)
Definition: objects-inl.h:1814
Object * InObjectPropertyAtPut(int index, Object *value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition: objects-inl.h:2056
Object * InObjectPropertyAt(int index)
Definition: objects-inl.h:2050
void FastPropertyAtPut(FieldIndex index, Object *value)
Definition: objects-inl.h:2034
static void EnsureCanContainHeapObjectElements(Handle< JSObject > obj)
Definition: objects-inl.h:1725
void InitializeBody(Map *map, Object *pre_allocated_value, Object *filler_value)
Definition: objects-inl.h:2068
SeededNumberDictionary * element_dictionary()
Definition: objects-inl.h:6449
int GetInObjectPropertyOffset(int index)
Definition: objects-inl.h:2045
static MUST_USE_RESULT Maybe< PropertyAttributes > GetElementAttributeWithReceiver(Handle< JSObject > object, Handle< JSReceiver > receiver, uint32_t index, bool check_prototype)
Definition: objects.cc:4025
static const int kHeaderSize
Definition: objects.h:2195
static void TransitionElementsKind(Handle< JSObject > object, ElementsKind to_kind)
Definition: objects.cc:12706
ElementsAccessor * GetElementsAccessor()
Definition: objects-inl.h:6346
void SetInternalField(int index, Object *value)
Definition: objects-inl.h:2001
static void MigrateToMap(Handle< JSObject > object, Handle< Map > new_map)
Definition: objects.cc:1886
Object * GetInternalField(int index)
Definition: objects-inl.h:1992
static const int kPropertiesOffset
Definition: objects.h:2193
static void ValidateElements(Handle< JSObject > object)
Definition: objects-inl.h:1561
static void EnsureCanContainElements(Handle< JSObject > object, Object **elements, uint32_t count, EnsureElementsMode mode)
Definition: objects-inl.h:1738
int GetInternalFieldOffset(int index)
Definition: objects-inl.h:1986
ElementsKind GetElementsKind()
Definition: objects-inl.h:6318
static const int kElementsOffset
Definition: objects.h:2194
Object * RawFastPropertyAt(FieldIndex index)
Definition: objects-inl.h:2025
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSObject > object)
Definition: objects.cc:4568
NameDictionary * property_dictionary()
Definition: objects-inl.h:6443
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name)
Definition: objects.cc:397
static MUST_USE_RESULT Maybe< bool > HasElementWithHandler(Handle< JSProxy > proxy, uint32_t index)
Definition: objects-inl.h:1165
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, uint32_t index)
Definition: objects-inl.h:1146
static MUST_USE_RESULT Maybe< bool > HasPropertyWithHandler(Handle< JSProxy > proxy, Handle< Name > name)
Definition: objects.cc:3392
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSProxy > proxy)
Definition: objects.cc:4589
static MUST_USE_RESULT Maybe< PropertyAttributes > GetElementAttributeWithHandler(Handle< JSProxy > proxy, Handle< JSReceiver > receiver, uint32_t index)
Definition: objects.cc:3647
static MUST_USE_RESULT MaybeHandle< Object > SetElementWithHandler(Handle< JSProxy > proxy, Handle< JSReceiver > receiver, uint32_t index, Handle< Object > value, StrictMode strict_mode)
Definition: objects-inl.h:1154
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name, Handle< Object > value, StrictMode strict_mode)
Definition: objects.cc:3410
static MUST_USE_RESULT Maybe< bool > HasOwnElement(Handle< JSReceiver > object, uint32_t index)
Definition: objects-inl.h:6730
static MUST_USE_RESULT Maybe< PropertyAttributes > GetElementAttribute(Handle< JSReceiver > object, uint32_t index)
Definition: objects-inl.h:6681
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(Handle< JSReceiver > object, Handle< Name > name)
Definition: objects-inl.h:6670
static MUST_USE_RESULT Maybe< bool > HasElement(Handle< JSReceiver > object, uint32_t index)
Definition: objects-inl.h:6718
static MUST_USE_RESULT Maybe< PropertyAttributes > GetOwnPropertyAttributes(Handle< JSReceiver > object, Handle< Name > name)
Definition: objects.cc:3983
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSReceiver > object)
Definition: objects-inl.h:6704
static MUST_USE_RESULT Maybe< bool > HasOwnProperty(Handle< JSReceiver >, Handle< Name > name)
Definition: objects-inl.h:6658
static MUST_USE_RESULT Maybe< PropertyAttributes > GetOwnElementAttribute(Handle< JSReceiver > object, uint32_t index)
Definition: objects-inl.h:6743
static MUST_USE_RESULT Maybe< bool > HasProperty(Handle< JSReceiver > object, Handle< Name > name)
Definition: objects-inl.h:6646
static const int kIrregexpCaptureCountIndex
Definition: objects.h:7806
void SetDataAt(int index, Object *value)
Definition: objects-inl.h:6311
Object * DataAt(int index)
Definition: objects-inl.h:6305
static const int kFlagsIndex
Definition: objects.h:7777
static const int kSourceIndex
Definition: objects.h:7776
static const int kSize
Definition: objects.h:7772
static const int kDataIndex
Definition: objects.h:7778
void PopulateValueArray(FixedArray *array)
Definition: objects-inl.h:7189
static const int kSize
Definition: objects.h:9947
static const int kSize
Definition: objects.h:7547
static const int kSize
Definition: objects.h:9809
static Handle< Object > AsHandle(Isolate *isolate, HashTableKey *key)
Definition: objects-inl.h:482
bool HasPrototypeTransitions()
Definition: objects-inl.h:5205
static const int kIsExtensible
Definition: objects.h:6250
bool has_external_array_elements()
Definition: objects.h:5760
uint32_t bit_field3()
Definition: objects-inl.h:5120
ElementsKind elements_kind()
Definition: objects.h:5730
int NumberOfOwnDescriptors()
Definition: objects.h:5944
void set_non_instance_prototype(bool value)
Definition: objects-inl.h:4363
void set_migration_target(bool value)
Definition: objects-inl.h:4470
int unused_property_fields()
Definition: objects-inl.h:4333
FixedArray * GetPrototypeTransitions()
Definition: objects-inl.h:5181
int pre_allocated_property_fields()
Definition: objects-inl.h:4246
void set_is_access_check_needed(bool access_check_needed)
Definition: objects-inl.h:4387
Object * GetBackPointer()
Definition: objects-inl.h:5134
bool is_access_check_needed()
Definition: objects-inl.h:4396
Map * elements_transition_map()
Definition: objects-inl.h:5156
bool HasElementsTransition()
Definition: objects-inl.h:5145
void set_bit_field3(uint32_t bits)
Definition: objects-inl.h:5112
static const int kBitFieldOffset
Definition: objects.h:6228
void set_unused_property_fields(int value)
Definition: objects-inl.h:4338
void set_bit_field(byte value)
Definition: objects-inl.h:4348
Map * GetTransition(int transition_index)
Definition: objects-inl.h:5170
void set_function_with_prototype(bool value)
Definition: objects-inl.h:4377
bool has_fast_smi_or_object_elements()
Definition: objects.h:5744
void set_construction_count(int value)
Definition: objects-inl.h:4490
static const int kIsAccessCheckNeeded
Definition: objects.h:6246
void SetNumberOfProtoTransitions(int value)
Definition: objects.h:5914
bool has_named_interceptor()
Definition: objects.h:5682
void NotifyLeafMapLayoutChange()
Definition: objects-inl.h:4539
static Handle< String > ExpectedTransitionKey(Handle< Map > map)
Definition: objects-inl.h:1847
void LookupTransition(JSObject *holder, Name *name, LookupResult *result)
Definition: objects-inl.h:2882
void SetBackPointer(Object *value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition: objects-inl.h:5251
int NumberOfFields()
Definition: objects.cc:2095
static const int kBitField3Offset
Definition: objects.h:6189
static Handle< Map > FindTransitionToField(Handle< Map > map, Handle< Name > key)
Definition: objects-inl.h:1869
bool done_inobject_slack_tracking()
Definition: objects-inl.h:4485
static const int kHasNonInstancePrototype
Definition: objects.h:6240
bool CanHaveMoreTransitions()
Definition: objects-inl.h:5162
void set_instance_type(InstanceType value)
Definition: objects-inl.h:4328
PropertyDetails GetLastDescriptorDetails()
Definition: objects-inl.h:2867
void set_is_extensible(bool value)
Definition: objects-inl.h:4401
bool has_instance_call_handler()
Definition: objects-inl.h:4455
static const int kInstanceTypeOffset
Definition: objects.h:6229
void SetNumberOfOwnDescriptors(int number)
Definition: objects.h:5948
bool is_dictionary_map()
Definition: objects-inl.h:4430
bool is_migration_target()
Definition: objects-inl.h:4475
bool has_fixed_typed_array_elements()
Definition: objects.h:5764
static const int kVisitorIdOffset
Definition: objects.h:6218
void InitializeDescriptors(DescriptorArray *descriptors)
Definition: objects-inl.h:5102
static Handle< Map > ExpectedTransitionTarget(Handle< Map > map)
Definition: objects-inl.h:1862
static const int kBitField2Offset
Definition: objects.h:6233
void set_is_prototype_map(bool value)
Definition: objects-inl.h:4414
void ZapPrototypeTransitions()
Definition: objects.cc:11336
void ZapTransitions()
Definition: objects.cc:11323
void LookupDescriptor(JSObject *holder, Name *name, LookupResult *result)
Definition: objects-inl.h:2872
static const int kInstanceSizeOffset
Definition: objects.h:6210
void set_has_instance_call_handler()
Definition: objects-inl.h:4450
void set_pre_allocated_property_fields(int value)
Definition: objects-inl.h:4315
FixedArrayBase * GetInitialElements()
Definition: objects-inl.h:2891
InstanceType instance_type()
Definition: objects-inl.h:4323
static const int kPreAllocatedPropertyFieldsOffset
Definition: objects.h:6215
void set_done_inobject_slack_tracking(bool value)
Definition: objects-inl.h:4480
bool has_non_instance_prototype()
Definition: objects-inl.h:4372
void set_instance_size(int value)
Definition: objects-inl.h:4300
static const int kTransitionsOrBackPointerOffset
Definition: objects.h:6196
int GetInObjectPropertyOffset(int index)
Definition: objects-inl.h:4251
bool has_fast_double_elements()
Definition: objects.h:5748
static void SetPrototypeTransitions(Handle< Map > map, Handle< FixedArray > prototype_transitions)
Definition: objects-inl.h:5190
void set_bit_field2(byte value)
Definition: objects-inl.h:4358
static const int kInObjectPropertiesOffset
Definition: objects.h:6212
static const int kCodeCacheOffset
Definition: objects.h:6200
void set_visitor_id(int visitor_id)
Definition: objects-inl.h:4229
void set_inobject_properties(int value)
Definition: objects-inl.h:4309
int NumberOfProtoTransitions()
Definition: objects.h:5907
void init_back_pointer(Object *undefined)
Definition: objects-inl.h:5245
bool function_with_prototype()
Definition: objects-inl.h:4382
void set_owns_descriptors(bool owns_descriptors)
Definition: objects-inl.h:4440
void ClearCodeCache(Heap *heap)
Definition: objects-inl.h:6945
bool HasTransitionArray() const
Definition: objects-inl.h:5150
void AppendDescriptor(Descriptor *desc)
Definition: objects-inl.h:5125
bool has_indexed_interceptor()
Definition: objects.h:5691
static const int kPrototypeOffset
Definition: objects.h:6190
int SearchTransition(Name *name)
Definition: objects-inl.h:5175
bool TooManyFastProperties(StoreFromKeyed store_mode)
Definition: objects-inl.h:2098
void set_dictionary_map(bool value)
Definition: objects-inl.h:4423
static const int kUnusedPropertyFieldsOffset
Definition: objects.h:6234
Heap * heap() const
Definition: spaces.h:603
static MemoryChunk * FromAddress(Address a)
Definition: spaces.h:276
static Address & Address_at(Address addr)
Definition: v8memory.h:56
static uint32_t Hash(Handle< Name > key)
Definition: objects-inl.h:6866
static Handle< Object > AsHandle(Isolate *isolate, Handle< Name > key)
Definition: objects-inl.h:6876
static bool IsMatch(Handle< Name > key, Object *other)
Definition: objects-inl.h:6858
static uint32_t HashForObject(Handle< Name > key, Object *object)
Definition: objects-inl.h:6871
static void DoGenerateNewEnumerationIndices(Handle< NameDictionary > dictionary)
Definition: objects-inl.h:6883
static const int kHashShift
Definition: objects.h:8499
static const int kHashNotComputedMask
Definition: objects.h:8494
static const int kHashFieldOffset
Definition: objects.h:8486
void set_hash_field(uint32_t value)
Definition: objects-inl.h:3301
static const uint32_t kHashBitMask
Definition: objects.h:8503
static const int kIsNotArrayIndexMask
Definition: objects.h:8495
static bool IsHashFieldComputed(uint32_t field)
Definition: objects-inl.h:6455
bool Equals(Name *other)
Definition: objects-inl.h:3309
bool AsArrayIndex(uint32_t *index)
Definition: objects-inl.h:6601
uint32_t hash_field()
Definition: objects-inl.h:3296
static int GetIndex(Handle< Map > map)
Definition: objects-inl.h:895
static bool IsNormalizedMapCache(const Object *obj)
Definition: objects-inl.h:900
static bool IsMatch(uint32_t key, Object *other)
Definition: objects-inl.h:6822
static Handle< Object > AsHandle(Isolate *isolate, uint32_t key)
Definition: objects-inl.h:6853
static uint32_t Hash(Handle< Object > key)
Definition: objects-inl.h:6894
static uint32_t HashForObject(Handle< Object > key, Object *object)
Definition: objects-inl.h:6899
static Handle< Object > AsHandle(Isolate *isolate, Handle< Object > key)
Definition: objects-inl.h:6905
static bool IsMatch(Handle< Object > key, Object *other)
Definition: objects-inl.h:6889
static MUST_USE_RESULT Handle< ObjectHashTable > Shrink(Handle< ObjectHashTable > table, Handle< Object > key)
Definition: objects-inl.h:6911
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyOrElement(Handle< Object > object, Handle< Name > key)
Definition: objects-inl.h:1124
Object * GetHash()
Definition: objects.cc:835
static MaybeHandle< JSReceiver > ToObject(Isolate *isolate, Handle< Object > object)
Definition: objects-inl.h:1094
static MUST_USE_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, Handle< Object > object, uint32_t index)
Definition: objects-inl.h:1113
friend class LookupIterator
Definition: objects.h:1226
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
Definition: objects.cc:109
@ CERTAINLY_NOT_STORE_FROM_KEYED
Definition: objects.h:1007
static Handle< Object > NewStorageFor(Isolate *isolate, Handle< Object > object, Representation representation)
Definition: objects-inl.h:277
static MUST_USE_RESULT MaybeHandle< Smi > ToSmi(Isolate *isolate, Handle< Object > object)
Definition: objects-inl.h:1081
void VerifyApiCallResultType()
Definition: objects-inl.h:2148
bool IsStringObjectWithCharacterAt(uint32_t index)
Definition: objects-inl.h:2135
bool ToArrayIndex(uint32_t *index)
Definition: objects-inl.h:2116
static Handle< Object > WrapForRead(Isolate *isolate, Handle< Object > object, Representation representation)
Definition: objects-inl.h:296
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithReceiver(Isolate *isolate, Handle< Object > object, Handle< Object > receiver, uint32_t index)
Definition: objects.cc:747
bool HasSpecificClassOf(String *name)
Definition: objects-inl.h:1101
static const byte kNotBooleanMask
Definition: objects.h:9402
void set_kind(byte kind)
Definition: objects-inl.h:1891
static const byte kFalse
Definition: objects.h:9400
static const byte kUndefined
Definition: objects.h:9406
static const int kKindOffset
Definition: objects.h:9397
static const byte kArgumentMarker
Definition: objects.h:9405
static const byte kException
Definition: objects.h:9409
static const byte kTheHole
Definition: objects.h:9403
static const byte kTrue
Definition: objects.h:9401
static const byte kNull
Definition: objects.h:9404
static const byte kUninitialized
Definition: objects.h:9407
virtual bool IsMatch(Object *string) OVERRIDE
Definition: objects-inl.h:530
virtual Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
Definition: objects.cc:13677
OneByteStringKey(Vector< const uint8_t > str, uint32_t seed)
Definition: objects-inl.h:527
Object * ValueAt(int entry)
Definition: objects.h:3997
static const int kMaxRegularHeapObjectSize
Definition: spaces.h:754
static const int kTypeOffset
Definition: objects.h:9494
A class to uniformly access the prototype of any Object and walk its prototype chain.
Definition: prototype.h:25
Object * GetCurrent() const
Definition: prototype.h:62
static const int kCompilationTypeBit
Definition: objects.h:6525
CompilationState compilation_state()
Definition: objects-inl.h:5383
void set_compilation_type(CompilationType type)
Definition: objects-inl.h:5379
void set_compilation_state(CompilationState state)
Definition: objects-inl.h:5387
static const int kCompilationStateBit
Definition: objects.h:6526
static uint32_t SeededHashForObject(uint32_t key, uint32_t seed, Object *object)
Definition: objects-inl.h:6845
static uint32_t SeededHash(uint32_t key, uint32_t seed)
Definition: objects-inl.h:6840
static int SizeFor(int length)
Definition: objects.h:8976
int SeqOneByteStringSize(InstanceType instance_type)
Definition: objects-inl.h:3519
uint16_t SeqOneByteStringGet(int index)
Definition: objects-inl.h:3469
void SeqOneByteStringSet(int index, uint16_t value)
Definition: objects-inl.h:3475
Handle< SeqOneByteString > string_
Definition: objects-inl.h:564
virtual Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
Definition: objects.cc:13689
virtual uint32_t Hash() OVERRIDE
Definition: objects-inl.h:545
SeqOneByteSubStringKey(Handle< SeqOneByteString > string, int from, int length)
Definition: objects-inl.h:540
virtual bool IsMatch(Object *string) OVERRIDE
Definition: objects.cc:13696
virtual uint32_t HashForObject(Object *other) OVERRIDE
Definition: objects-inl.h:556
void SeqTwoByteStringSet(int index, uint16_t value)
Definition: objects-inl.h:3508
static int SizeFor(int length)
Definition: objects.h:9015
uint16_t SeqTwoByteStringGet(int index)
Definition: objects-inl.h:3502
int SeqTwoByteStringSize(InstanceType instance_type)
Definition: objects-inl.h:3514
virtual uint32_t HashForObject(Object *other) OVERRIDE
Definition: objects-inl.h:515
virtual uint32_t Hash() OVERRIDE
Definition: objects-inl.h:504
SequentialStringKey(Vector< const Char > string, uint32_t seed)
Definition: objects-inl.h:501
Vector< const Char > string_
Definition: objects-inl.h:519
FunctionTemplateInfo * get_api_func_data()
Definition: objects-inl.h:5684
static const int kStartPositionShift
Definition: objects.h:6990
void set_start_position_and_type(int value)
void set_formal_parameter_count(int value)
void set_start_position(int start_position)
Definition: objects-inl.h:5626
static const int kScopeInfoOffset
Definition: objects.h:6895
void set_opt_count(int opt_count)
Definition: objects-inl.h:5744
void set_kind(FunctionKind kind)
Definition: objects-inl.h:5572
static const int kDontAdaptArgumentsSentinel
Definition: objects.h:6888
void set_opt_reenable_tries(int value)
Definition: objects-inl.h:5734
static const int kStartPositionMask
Definition: objects.h:6991
BuiltinFunctionId builtin_function_id()
Definition: objects-inl.h:5695
void set_opt_count_and_bailout_reason(int value)
BailoutReason DisableOptimizationReason()
Definition: objects-inl.h:5750
void set_strict_mode(StrictMode strict_mode)
Definition: objects-inl.h:5558
static const int kCodeOffset
Definition: objects.h:6893
static const int kParentOffset
Definition: objects.h:9104
void set_parent(String *parent, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition: objects-inl.h:3529
static const int kMaxValue
Definition: objects.h:1272
int value() const
Definition: objects-inl.h:1316
static const int kMinValue
Definition: objects.h:1270
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
static Smi * FromIntptr(intptr_t value)
Definition: objects-inl.h:1327
static bool IsValid(intptr_t value)
Definition: objects-inl.h:1334
void Reset(String *string, int offset=0)
Definition: objects-inl.h:3694
ConsStringIteratorOp * op_
Definition: objects.h:9352
StringCharacterStream(String *string, ConsStringIteratorOp *op, int offset=0)
Definition: objects-inl.h:3685
void VisitOneByteString(const uint8_t *chars, int length)
Definition: objects-inl.h:3718
void VisitTwoByteString(const uint16_t *chars, int length)
Definition: objects-inl.h:3726
void AddCharacter(uint16_t c)
Definition: objects-inl.h:6512
void AddCharacters(const Char *chars, int len)
Definition: objects-inl.h:6543
static uint32_t ComputeUtf8Hash(Vector< const char > chars, uint32_t seed, int *utf16_length_out)
Definition: objects.cc:8956
bool UpdateIndex(uint16_t c)
Definition: objects-inl.h:6519
static const int kZeroHash
Definition: objects.h:8363
static uint32_t HashSequentialString(const schar *chars, int length, uint32_t seed)
Definition: objects-inl.h:6563
StringHasher(int length, uint32_t seed)
Definition: objects-inl.h:6478
static Handle< Object > AsHandle(Isolate *isolate, HashTableKey *key)
Definition: objects-inl.h:477
bool IsTwoByteRepresentationUnderneath()
Definition: objects-inl.h:365
bool IsTwoByteRepresentation() const
Definition: objects-inl.h:343
void SetForwardedInternalizedString(String *string)
Definition: objects-inl.h:6615
static const int kMaxHashCalcLength
Definition: objects.h:8824
bool SlowAsArrayIndex(uint32_t *index)
Definition: objects.cc:8869
String * GetForwardedInternalizedString()
Definition: objects-inl.h:6630
bool IsOneByteRepresentationUnderneath()
Definition: objects-inl.h:349
bool SlowEquals(String *other)
Definition: objects.cc:8671
STATIC_ASSERT(kMaxArrayIndexSize<(1<< kArrayIndexLengthBits))
String * GetUnderlying()
Definition: objects-inl.h:3404
static ConsString * VisitFlat(Visitor *visitor, String *string, int offset=0)
Definition: objects-inl.h:3416
bool IsOneByteRepresentation() const
Definition: objects-inl.h:337
static Handle< String > Flatten(Handle< String > string, PretenureFlag pretenure=NOT_TENURED)
Definition: objects-inl.h:3354
void Set(int index, uint16_t value)
Definition: objects-inl.h:3388
bool AsArrayIndex(uint32_t *index)
Definition: objects-inl.h:6606
bool Equals(String *other)
Definition: objects-inl.h:3336
void InitializeBody(int object_size)
Definition: objects-inl.h:2108
static const int kSimpleTransitionIndex
Definition: transitions.h:127
static TransitionArray * cast(Object *obj)
void set_back_pointer_storage(Object *back_pointer, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
static Handle< TransitionArray > ExtendToFullTransitionArray(Handle< Map > containing_map)
Definition: transitions.cc:65
static const int kTransitionSize
Definition: transitions.h:139
static const int kNotFound
Definition: transitions.h:116
Name * GetKey(int transition_number)
static Handle< TransitionArray > Allocate(Isolate *isolate, int number_of_transitions)
Definition: transitions.cc:15
PropertyDetails GetTargetDetails(int transition_number)
Map * GetTarget(int transition_number)
virtual Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
Definition: objects.cc:13683
TwoByteStringKey(Vector< const uc16 > str, uint32_t seed)
Definition: objects-inl.h:573
virtual bool IsMatch(Object *string) OVERRIDE
Definition: objects-inl.h:576
static const int kStorage2Offset
Definition: objects.h:8061
static const int kStorage3Offset
Definition: objects.h:8062
bool matches_inlined_type_change_checksum(int checksum)
Definition: objects-inl.h:7090
static const int kStorage1Offset
Definition: objects.h:8060
void change_ic_generic_count(int delta)
Definition: objects-inl.h:7044
void set_ic_total_count(int count)
Definition: objects-inl.h:7008
static const int kTypeChangeChecksumBits
Definition: objects.h:8066
void change_ic_with_type_info_count(int delta)
Definition: objects-inl.h:7022
void set_inlined_type_change_checksum(int checksum)
Definition: objects-inl.h:7073
static TypeImpl * cast(typename Config::Base *object)
Definition: types-inl.h:20
static uint32_t Hash(uint32_t key)
Definition: objects-inl.h:6828
static uint32_t HashForObject(uint32_t key, Object *object)
Definition: objects-inl.h:6833
virtual uint32_t Hash() OVERRIDE
Definition: objects-inl.h:594
Utf8StringKey(Vector< const char > string, uint32_t seed)
Definition: objects-inl.h:587
virtual uint32_t HashForObject(Object *other) OVERRIDE
Definition: objects-inl.h:602
virtual bool IsMatch(Object *string) OVERRIDE
Definition: objects-inl.h:590
virtual Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
Definition: objects-inl.h:606
Vector< const char > string_
Definition: objects-inl.h:612
T * start() const
Definition: vector.h:47
int length() const
Definition: vector.h:41
static uint32_t Hash(Handle< Object > key)
Definition: objects-inl.h:6924
static Handle< Object > AsHandle(Isolate *isolate, Handle< Object > key)
Definition: objects-inl.h:6939
static uint32_t HashForObject(Handle< Object > key, Object *object)
Definition: objects-inl.h:6931
static bool IsMatch(Handle< Object > key, Object *other)
Definition: objects-inl.h:6918
#define OVERRIDE
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions true
enable harmony numeric literals(0o77, 0b11)") DEFINE_BOOL(harmony_object_literals
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define HAS_SMI_TAG(value)
Definition: globals.h:571
#define OBJECT_POINTER_ALIGN(value)
Definition: globals.h:578
#define UNREACHABLE()
Definition: logging.h:30
#define CHECK(condition)
Definition: logging.h:36
#define FATAL(msg)
Definition: logging.h:26
#define DCHECK_NE(v1, v2)
Definition: logging.h:207
#define DCHECK(condition)
Definition: logging.h:205
#define DCHECK_LT(v1, v2)
Definition: logging.h:209
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
intptr_t OffsetFrom(T x)
Definition: macros.h:383
unsigned short uint16_t
Definition: unicode.cc:23
signed short int16_t
Definition: unicode.cc:22
int int32_t
Definition: unicode.cc:24
uint32_t RoundUpToPowerOfTwo32(uint32_t value)
Definition: bits.cc:12
IN DWORD64 OUT PDWORD64 OUT PIMAGEHLP_SYMBOL64 Symbol
const int kPointerSize
Definition: globals.h:129
@ DONT_ALLOW_DOUBLE_ELEMENTS
Definition: objects.h:1540
@ ALLOW_CONVERTED_DOUBLE_ELEMENTS
Definition: objects.h:1542
@ ALLOW_COPIED_DOUBLE_ELEMENTS
Definition: objects.h:1541
bool IsFastHoleyElementsKind(ElementsKind kind)
const uint32_t kStringEncodingMask
Definition: objects.h:555
bool IsValidFunctionKind(FunctionKind kind)
Definition: globals.h:784
bool Is(Object *obj)
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset kInstanceCallHandlerOffset internal_field_count
Definition: objects-inl.h:5340
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit kDoNotCacheBit is_toplevel
Definition: objects-inl.h:5431
@ TRACK_ALLOCATION_SITE
Definition: objects.h:8085
@ DONT_TRACK_ALLOCATION_SITE
Definition: objects.h:8084
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit kDoNotCacheBit kIsTopLevelBit kAllowLazyCompilationWithoutContext has_duplicate_parameters
Definition: objects-inl.h:5448
kExpectedNofPropertiesOffset kFunctionTokenPositionOffset kOptCountAndBailoutReasonOffset profiler_ticks
Definition: objects-inl.h:5528
StringRepresentationTag
Definition: objects.h:562
@ kSeqStringTag
Definition: objects.h:563
@ kConsStringTag
Definition: objects.h:564
@ kSlicedStringTag
Definition: objects.h:566
@ kExternalStringTag
Definition: objects.h:565
@ SKIP_WRITE_BARRIER
Definition: objects.h:235
@ UPDATE_WRITE_BARRIER
Definition: objects.h:235
kSerializedDataOffset kPrototypeTemplateOffset indexed_property_handler
Definition: objects-inl.h:5327
TypeImpl< ZoneTypeConfig > Type
static int min(int a, int b)
Definition: liveedit.cc:273
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
bool IsFastSmiOrObjectElementsKind(ElementsKind kind)
const uint32_t kTwoByteStringTag
Definition: objects.h:556
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind)
const uint32_t kShortExternalStringTag
Definition: objects.h:590
kExpectedNofPropertiesOffset function_token_position
Definition: objects-inl.h:5513
const int kSmiTagSize
Definition: v8.h:5743
name_should_print_as_anonymous
Definition: objects-inl.h:5584
const int kDoubleSize
Definition: globals.h:127
void MemsetPointer(T **dest, U *value, int counter)
Definition: utils.h:1183
kSerializedDataOffset Object
Definition: objects-inl.h:5322
const uint32_t kNotInternalizedTag
Definition: objects.h:550
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset instance_call_handler
Definition: objects-inl.h:5333
const int kPointerSizeLog2
Definition: globals.h:147
const uint32_t kStringTag
Definition: objects.h:544
double FastI2D(int x)
Definition: conversions.h:64
kExpectedNofPropertiesOffset kFunctionTokenPositionOffset kOptCountAndBailoutReasonOffset PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo
@ FIRST_FIXED_TYPED_ARRAY_TYPE
Definition: objects.h:763
@ JS_REGEXP_TYPE
Definition: objects.h:748
@ JS_VALUE_TYPE
Definition: objects.h:728
@ JS_DATE_TYPE
Definition: objects.h:730
@ JS_GLOBAL_PROXY_TYPE
Definition: objects.h:737
@ FIXED_DOUBLE_ARRAY_TYPE
Definition: objects.h:692
@ JS_ARRAY_TYPE
Definition: objects.h:738
@ FIXED_ARRAY_TYPE
Definition: objects.h:717
@ JS_MODULE_TYPE
Definition: objects.h:734
@ JS_OBJECT_TYPE
Definition: objects.h:731
@ JS_TYPED_ARRAY_TYPE
Definition: objects.h:740
@ FIRST_NONSTRING_TYPE
Definition: objects.h:758
@ JS_DATA_VIEW_TYPE
Definition: objects.h:741
@ LAST_NAME_TYPE
Definition: objects.h:755
@ PROPERTY_CELL_TYPE
Definition: objects.h:665
@ FREE_SPACE_TYPE
Definition: objects.h:673
@ JS_GENERATOR_OBJECT_TYPE
Definition: objects.h:733
@ BYTE_ARRAY_TYPE
Definition: objects.h:672
@ JS_WEAK_SET_TYPE
Definition: objects.h:747
@ ODDBALL_TYPE
Definition: objects.h:663
@ FIRST_SPEC_OBJECT_TYPE
Definition: objects.h:781
@ LAST_JS_RECEIVER_TYPE
Definition: objects.h:773
@ JS_CONTEXT_EXTENSION_OBJECT_TYPE
Definition: objects.h:732
@ FIRST_JS_RECEIVER_TYPE
Definition: objects.h:772
@ MUTABLE_HEAP_NUMBER_TYPE
Definition: objects.h:670
@ FIRST_JS_OBJECT_TYPE
Definition: objects.h:775
@ LAST_JS_OBJECT_TYPE
Definition: objects.h:776
@ LAST_DATA_TYPE
Definition: objects.h:766
@ ONE_BYTE_STRING_TYPE
Definition: objects.h:633
@ HEAP_NUMBER_TYPE
Definition: objects.h:669
@ JS_MAP_ITERATOR_TYPE
Definition: objects.h:745
@ JS_MESSAGE_OBJECT_TYPE
Definition: objects.h:729
@ JS_FUNCTION_TYPE
Definition: objects.h:749
@ JS_FUNCTION_PROXY_TYPE
Definition: objects.h:726
@ FIRST_EXTERNAL_ARRAY_TYPE
Definition: objects.h:760
@ SHARED_FUNCTION_INFO_TYPE
Definition: objects.h:719
@ JS_SET_ITERATOR_TYPE
Definition: objects.h:744
@ INTERNALIZED_STRING_TYPE
Definition: objects.h:612
@ JS_GLOBAL_OBJECT_TYPE
Definition: objects.h:735
@ LAST_FIXED_TYPED_ARRAY_TYPE
Definition: objects.h:764
@ JS_ARRAY_BUFFER_TYPE
Definition: objects.h:739
@ JS_BUILTINS_OBJECT_TYPE
Definition: objects.h:736
@ CONSTANT_POOL_ARRAY_TYPE
Definition: objects.h:718
@ ONE_BYTE_INTERNALIZED_STRING_TYPE
Definition: objects.h:614
@ FOREIGN_TYPE
Definition: objects.h:671
@ JS_WEAK_MAP_TYPE
Definition: objects.h:746
@ LAST_EXTERNAL_ARRAY_TYPE
Definition: objects.h:761
@ FAST_HOLEY_DOUBLE_ELEMENTS
Definition: elements-kind.h:27
@ SLOPPY_ARGUMENTS_ELEMENTS
Definition: elements-kind.h:31
@ FAST_HOLEY_SMI_ELEMENTS
Definition: elements-kind.h:17
bool IsFastDoubleElementsKind(ElementsKind kind)
int LinearSearch(T *array, Name *name, int len, int valid_entries)
Definition: objects-inl.h:2799
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146
const uint32_t kOneByteStringTag
Definition: objects.h:557
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit kDoNotCacheBit start_position_and_type
Definition: objects-inl.h:5431
const int kVariableSizeSentinel
Definition: objects.h:309
kExpectedNofPropertiesOffset kFunctionTokenPositionOffset kOptCountAndBailoutReasonOffset kProfilerTicksOffset BOOL_GETTER(SharedFunctionInfo, compiler_hints, optimization_disabled, kOptimizationDisabled) void SharedFunctionInfo
Definition: objects-inl.h:5534
const int kShortSize
Definition: globals.h:123
const intptr_t kObjectAlignment
Definition: globals.h:226
kFeedbackVectorOffset kHiddenPrototypeBit read_only_prototype
Definition: objects-inl.h:5423
const int kInt64Size
Definition: globals.h:126
const bool FLAG_enable_slow_asserts
Definition: checks.h:31
const uint32_t kShortExternalStringMask
Definition: objects.h:589
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
const int kInt32Size
Definition: globals.h:125
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit kDoNotCacheBit kIsTopLevelBit allows_lazy_compilation_without_context
Definition: objects-inl.h:5440
PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, formal_parameter_count, kFormalParameterCountOffset) PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)
const uint32_t kStringRepresentationMask
Definition: objects.h:561
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit kDoNotCacheBit kIsTopLevelBit compiler_hints
Definition: objects-inl.h:5439
byte * Address
Definition: globals.h:101
bool IsFastElementsKind(ElementsKind kind)
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset kInstanceCallHandlerOffset kInternalFieldCountOffset dependent_code
Definition: objects-inl.h:5353
void PrintF(const char *format,...)
Definition: utils.cc:80
@ kDontCache
Definition: ast.h:158
int32_t DoubleToInt32(double x)
kFeedbackVectorOffset hidden_prototype
Definition: objects-inl.h:5418
const int kIntSize
Definition: globals.h:124
const int kHeapObjectTag
Definition: v8.h:5737
const uint32_t kOneByteDataHintMask
Definition: objects.h:584
const int kSmiShiftSize
Definition: v8.h:5805
int FastD2I(double x)
Definition: conversions.h:57
kExpectedNofPropertiesOffset kFunctionTokenPositionOffset opt_count_and_bailout_reason
Definition: objects-inl.h:5520
uint32_t ComputeIntegerHash(uint32_t key, uint32_t seed)
Definition: utils.h:249
const uint32_t kIsIndirectStringTag
Definition: objects.h:569
kFeedbackVectorOffset flag
Definition: objects-inl.h:5418
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit do_not_cache
Definition: objects-inl.h:5427
int BinarySearch(T *array, Name *name, int low, int high, int valid_entries)
Definition: objects-inl.h:2762
const uint32_t kInternalizedTag
Definition: objects.h:551
static void RoundUp(Vector< char > buffer, int *length, int *decimal_point)
Definition: fixed-dtoa.cc:171
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset kInstanceCallHandlerOffset kInternalFieldCountOffset ACCESSORS_TO_SMI(AllocationSite, pretenure_create_count, kPretenureCreateCountOffset) ACCESSORS(AllocationSite
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
const uint64_t kHoleNanInt64
Definition: globals.h:660
const uint32_t kIsNotInternalizedMask
Definition: objects.h:549
const uint32_t kOneByteDataHintTag
Definition: objects.h:585
kFeedbackVectorOffset kHiddenPrototypeBit BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, kNeedsAccessCheckBit) BOOL_ACCESSORS(FunctionTemplateInfo
kSerializedDataOffset prototype_template
Definition: objects-inl.h:5322
static bool IsMinusZero(double value)
Definition: conversions.h:154
uint16_t uc16
Definition: globals.h:184
const int kSmiTag
Definition: v8.h:5742
bool IsFastSmiElementsKind(ElementsKind kind)
const uint32_t kIsNotStringMask
Definition: objects.h:543
int32_t uc32
Definition: globals.h:185
int Search(T *array, Name *name, int valid_entries)
Definition: objects-inl.h:2822
bool IsAligned(T value, U alignment)
Definition: utils.h:123
ACCESSORS(AccessorInfo, expected_receiver_type, Object, kExpectedReceiverTypeOffset) ACCESSORS(DeclaredAccessorDescriptor
const int kCharSize
Definition: globals.h:122
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset kInstanceCallHandlerOffset kInternalFieldCountOffset DependentCode
Definition: objects-inl.h:5353
ElementsKind GetInitialFastElementsKind()
Definition: elements-kind.h:78
static void EnsureHasTransitionArray(Handle< Map > map)
Definition: objects-inl.h:5088
@ UNINITIALIZED
Definition: globals.h:446
const uint32_t kIsIndirectStringMask
Definition: objects.h:568
const uint32_t kHoleNanUpper32
Definition: globals.h:656
bool IsFastObjectElementsKind(ElementsKind kind)
uint8_t byte
Definition: globals.h:100
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
Maybe< T > maybe(T t)
Definition: v8.h:902
#define READ_BYTE_FIELD(p, offset)
Definition: objects-inl.h:1296
#define WRITE_SHORT_FIELD(p, offset, value)
Definition: objects-inl.h:1293
#define READ_UINT32_FIELD(p, offset)
Definition: objects-inl.h:1272
#define NOBARRIER_READ_FIELD(p, offset)
Definition: objects-inl.h:1186
#define EXTERNAL_ELEMENTS_CHECK(Type, type, TYPE, ctype, size)
Definition: objects-inl.h:6398
#define WRITE_INTPTR_FIELD(p, offset, value)
Definition: objects-inl.h:1269
#define FIELD_ADDR(p, offset)
Definition: objects-inl.h:1173
#define READ_INTPTR_FIELD(p, offset)
Definition: objects-inl.h:1266
#define WRITE_DOUBLE_FIELD(p, offset, value)
Definition: objects-inl.h:1240
#define WRITE_INT_FIELD(p, offset, value)
Definition: objects-inl.h:1263
#define MAKE_STRUCT_CAST(NAME, Name, name)
Definition: objects-inl.h:3265
#define TYPE_CHECKER(type, instancetype)
Definition: objects-inl.h:59
#define WRITE_UINT32_FIELD(p, offset, value)
Definition: objects-inl.h:1275
#define ORDERED_HASH_TABLE_ITERATOR_ACCESSORS(name, type, offset)
Definition: objects-inl.h:6032
#define READ_INT32_FIELD(p, offset)
Definition: objects-inl.h:1278
#define INT_ACCESSORS(holder, name, offset)
Definition: objects-inl.h:77
#define WRITE_FIELD(p, offset, value)
Definition: objects-inl.h:1190
#define WRITE_INT64_FIELD(p, offset, value)
Definition: objects-inl.h:1287
#define SMI_ACCESSORS(holder, name, offset)
Definition: objects-inl.h:99
#define WRITE_BARRIER(heap, object, offset, value)
Definition: objects-inl.h:1203
#define WRITE_BYTE_FIELD(p, offset, value)
Definition: objects-inl.h:1303
#define NOBARRIER_SMI_ACCESSORS(holder, name, offset)
Definition: objects-inl.h:117
#define READ_INT64_FIELD(p, offset)
Definition: objects-inl.h:1284
#define CAST_ACCESSOR(type)
Definition: objects-inl.h:66
#define NOBARRIER_WRITE_FIELD(p, offset, value)
Definition: objects-inl.h:1198
#define FIXED_TYPED_ELEMENTS_CHECK(Type, type, TYPE, ctype, size)
Definition: objects-inl.h:6419
#define TYPED_ARRAY_TYPE_CHECKER(Type, type, TYPE, ctype, size)
Definition: objects-inl.h:645
#define SYNCHRONIZED_SMI_ACCESSORS(holder, name, offset)
Definition: objects-inl.h:108
#define CASE(name)
#define READ_DOUBLE_FIELD(p, offset)
Definition: objects-inl.h:1220
#define FIELD_ADDR_CONST(p, offset)
Definition: objects-inl.h:1176
#define CONDITIONAL_WRITE_BARRIER(heap, object, offset, value, mode)
Definition: objects-inl.h:1210
#define NOBARRIER_WRITE_BYTE_FIELD(p, offset, value)
Definition: objects-inl.h:1306
#define READ_FIELD(p, offset)
Definition: objects-inl.h:1179
#define WRITE_INT32_FIELD(p, offset, value)
Definition: objects-inl.h:1281
#define MAKE_STRUCT_PREDICATE(NAME, Name, name)
Definition: objects-inl.h:1013
#define MAKE_STRUCT_CASE(NAME, Name, name)
#define READ_SHORT_FIELD(p, offset)
Definition: objects-inl.h:1290
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size)
#define READ_INT_FIELD(p, offset)
Definition: objects-inl.h:1260
#define ACQUIRE_READ_FIELD(p, offset)
Definition: objects-inl.h:1182
#define NOBARRIER_READ_BYTE_FIELD(p, offset)
Definition: objects-inl.h:1299
#define RELEASE_WRITE_FIELD(p, offset, value)
Definition: objects-inl.h:1193
#define IC_KIND_LIST(V)
Definition: objects.h:4939
#define STRUCT_LIST(V)
Definition: objects.h:515
#define TYPED_ARRAYS(V)
Definition: objects.h:4433
PropertyAttributes
@ ABSENT
@ NONE
A simple Maybe type, representing an object which may or may not have a value.
Definition: v8.h:890
T value
Definition: v8.h:896
bool has_value
Definition: v8.h:895
#define T(name, string, precedence)
Definition: token.cc:25