39 #ifdef ENABLE_DISASSEMBLER
50 if (FLAG_track_field_types) {
54 if (
map->is_stable() &&
61 return HeapType::Any(isolate);
70 if (object->IsNumber()) {
71 constructor =
handle(native_context->number_function(), isolate);
72 }
else if (object->IsBoolean()) {
73 constructor =
handle(native_context->boolean_function(), isolate);
74 }
else if (object->IsString()) {
75 constructor =
handle(native_context->string_function(), isolate);
76 }
else if (object->IsSymbol()) {
77 constructor =
handle(native_context->symbol_function(), isolate);
88 if (IsBoolean())
return IsTrue();
89 if (IsSmi())
return Smi::cast(
this)->value() != 0;
90 if (IsUndefined() || IsNull())
return false;
91 if (IsUndetectableObject())
return false;
92 if (IsString())
return String::cast(
this)->length() != 0;
93 if (IsHeapNumber())
return HeapNumber::cast(
this)->HeapNumberBooleanValue();
100 while (fun->IsJSFunctionProxy()) {
101 fun = JSFunctionProxy::cast(fun)->call_trap();
103 return fun->IsJSFunction() ||
104 (fun->IsHeapObject() &&
105 HeapObject::cast(fun)->map()->has_instance_call_handler());
110 for (; it->IsFound(); it->Next()) {
111 switch (it->state()) {
112 case LookupIterator::NOT_FOUND:
113 case LookupIterator::TRANSITION:
115 case LookupIterator::JSPROXY:
117 it->GetReceiver(), it->name());
118 case LookupIterator::INTERCEPTOR: {
120 it->GetHolder<
JSObject>(), it->GetReceiver(), it->name());
121 if (!maybe_result.
is_null())
return maybe_result;
122 if (it->isolate()->has_pending_exception())
return maybe_result;
125 case LookupIterator::ACCESS_CHECK:
132 case LookupIterator::DATA:
133 return it->GetDataValue();
136 return it->factory()->undefined_value();
143 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
149 for (; it->IsFound(); it->Next()) {
150 switch (it->state()) {
151 case LookupIterator::INTERCEPTOR:
152 case LookupIterator::NOT_FOUND:
153 case LookupIterator::TRANSITION:
155 case LookupIterator::ACCESS_CHECK:
158 case LookupIterator::JSPROXY:
160 return it->isolate()->factory()->undefined_value();
166 return it->isolate()->factory()->undefined_value();
167 case LookupIterator::DATA:
168 return it->GetDataValue();
171 return it->isolate()->factory()->undefined_value();
177 *value = Smi::cast(
this)->value();
180 if (IsHeapNumber()) {
181 double num = HeapNumber::cast(
this)->value();
193 int num = Smi::cast(
this)->value();
195 *value =
static_cast<uint32_t>(num);
199 if (IsHeapNumber()) {
200 double num = HeapNumber::cast(
this)->value();
211 if (!object->IsHeapObject())
return false;
221 if (!cons_obj->IsJSFunction())
return false;
225 for (
Object* type = fun->shared()->function_data();
226 type->IsFunctionTemplateInfo();
227 type = FunctionTemplateInfo::cast(type)->parent_template()) {
228 if (type ==
this)
return true;
235 template<
typename To>
238 DCHECK(temp %
sizeof(To) == 0);
239 return reinterpret_cast<To*
>(temp);
249 switch (descriptor.
size) {
251 value =
static_cast<uint32_t>(*CheckedCast<uint8_t>(ptr));
252 compare_value &= 0xff;
256 value =
static_cast<uint32_t>(*CheckedCast<uint16_t>(ptr));
257 compare_value &= 0xffff;
261 value = *CheckedCast<uint32_t>(ptr);
265 return isolate->
factory()->undefined_value();
267 return isolate->
factory()->ToBoolean(
268 (bitmask & value) == (bitmask & compare_value));
277 uintptr_t value = *CheckedCast<uintptr_t>(ptr);
278 return isolate->
factory()->ToBoolean(compare_value == value);
289 int32_value = *CheckedCast<int8_t>(ptr);
292 int32_value = *CheckedCast<uint8_t>(ptr);
295 int32_value = *CheckedCast<int16_t>(ptr);
298 int32_value = *CheckedCast<uint16_t>(ptr);
301 int32_value = *CheckedCast<int32_t>(ptr);
304 uint32_t value = *CheckedCast<uint32_t>(ptr);
306 return isolate->
factory()->NewNumberFromUint(value);
309 uint8_t
byte = *CheckedCast<uint8_t>(ptr);
310 return isolate->
factory()->ToBoolean(
314 float value = *CheckedCast<float>(ptr);
316 return isolate->
factory()->NewNumber(value);
319 double value = *CheckedCast<double>(ptr);
321 return isolate->
factory()->NewNumber(value);
325 return isolate->
factory()->NewNumberFromInt(int32_value);
334 char* current =
reinterpret_cast<char*
>(*receiver);
338 switch (data->
type) {
341 current = *CheckedCast<char*>(current);
342 return handle(*CheckedCast<Object*>(current), isolate);
346 current = *
reinterpret_cast<char**
>(current);
354 Object*
object = CheckedCast<Object>(current);
356 Object* smi = JSObject::cast(
object)->GetInternalField(field);
358 current =
reinterpret_cast<char*
>(smi);
379 return isolate->
factory()->undefined_value();
385 DCHECK(object->HasFastSmiOrObjectElements());
386 Isolate* isolate =
object->GetIsolate();
388 if (elems->map() != isolate->
heap()->fixed_cow_array_map())
return elems;
390 elems, isolate->
factory()->fixed_array_map());
391 object->set_elements(*writable_elems);
392 isolate->
counters()->cow_arrays_converted()->Increment();
393 return writable_elems;
400 Isolate* isolate = proxy->GetIsolate();
403 if (
name->IsSymbol())
return isolate->
factory()->undefined_value();
407 proxy,
"get", isolate->derived_get_trap(),
arraysize(args), args);
416 DCHECK(!structure->IsForeign());
418 if (structure->IsAccessorInfo()) {
420 if (!info->IsCompatibleReceiver(*receiver)) {
423 NewTypeError(
"incompatible_method_receiver",
427 if (structure->IsDeclaredAccessorInfo()) {
437 v8::ToCData<v8::AccessorNameGetterCallback>(data->getter());
438 if (call_fun ==
NULL)
return isolate->
factory()->undefined_value();
440 LOG(isolate, ApiNamedPropertyAccess(
"load", *holder, *
name));
446 return isolate->
factory()->undefined_value();
449 return_value->VerifyApiCallResultType();
451 return handle(*return_value, isolate);
457 if (getter->IsSpecFunction()) {
463 return isolate->
factory()->undefined_value();
470 if (!info->HasExpectedReceiverType())
return true;
473 return FunctionTemplateInfo::cast(info->expected_receiver_type())
474 ->IsTemplateFor(*
map);
485 DCHECK(!structure->IsForeign());
486 if (structure->IsExecutableAccessorInfo()) {
488 if (!receiver->IsJSObject())
return value;
494 NewTypeError(
"incompatible_method_receiver",
498 Object* call_obj = info->setter();
500 v8::ToCData<v8::AccessorNameSetterCallback>(call_obj);
501 if (call_fun ==
NULL)
return value;
502 LOG(isolate, ApiNamedPropertyAccess(
"store", *holder, *
name));
511 if (structure->IsAccessorPair()) {
512 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
513 if (setter->IsSpecFunction()) {
518 if (strict_mode ==
SLOPPY)
return value;
521 isolate, NewTypeError(
"no_setter_in_callback",
HandleVector(args, 2)),
527 if (structure->IsDeclaredAccessorInfo()) {
539 Isolate* isolate = getter->GetIsolate();
548 return Execution::Call(isolate, getter, receiver, 0,
NULL,
true);
556 Isolate* isolate = setter->GetIsolate();
575 for (; it->IsFound(); it->Next()) {
578 if (accessors->IsAccessorInfo()) {
579 if (AccessorInfo::cast(*accessors)->all_can_read())
return true;
588 LookupIterator* it) {
597 return it->factory()->undefined_value();
602 LookupIterator* it) {
605 return maybe(it->property_details().attributes());
614 for (; it->IsFound(); it->Next()) {
617 if (accessors->IsAccessorInfo()) {
618 if (AccessorInfo::cast(*accessors)->all_can_write())
return true;
632 it->GetAccessors(), strict_mode);
644 PropertyDetails details) {
645 DCHECK(!object->HasFastProperties());
648 if (!
name->IsUniqueName()) {
649 name =
object->GetIsolate()->factory()->InternalizeString(
656 if (object->IsGlobalObject()) {
657 store_value =
object->GetIsolate()->factory()->NewPropertyCell(value);
667 int enumeration_index;
669 if (original_details.IsDeleted()) {
673 enumeration_index = original_details.dictionary_index();
674 DCHECK(enumeration_index > 0);
677 details = PropertyDetails(
678 details.attributes(), details.type(), enumeration_index);
680 if (object->IsGlobalObject()) {
695 DCHECK(!object->HasFastProperties());
696 Isolate* isolate =
object->GetIsolate();
698 int entry = dictionary->FindEntry(
name);
701 if (object->IsGlobalObject()) {
702 PropertyDetails details = dictionary->DetailsAt(entry);
703 if (!details.IsConfigurable()) {
710 DCHECK(new_map->is_dictionary_map());
716 dictionary->DetailsAtPut(entry, details.AsDeleted());
720 if (*deleted == isolate->
heap()->true_value()) {
723 object->set_properties(*new_properties);
728 return isolate->
factory()->true_value();
734 if (!cons_obj->IsJSFunction())
737 if (!fun->shared()->IsApiFunction())
751 if (object->IsUndefined()) {
754 return isolate->
factory()->undefined_value();
760 object->IsJSProxy() || object->IsJSObject()
763 !iter.
IsAtEnd(); iter.Advance()) {
777 if (js_object->IsAccessCheckNeeded()) {
781 return isolate->
factory()->undefined_value();
785 if (js_object->HasIndexedInterceptor()) {
789 if (js_object->elements() != isolate->
heap()->empty_fixed_array()) {
793 js_object->GetElementsAccessor()->Get(receiver, js_object, index),
795 if (!result->IsTheHole())
return result;
799 return isolate->
factory()->undefined_value();
807 return context->number_function()->initial_map();
810 HeapObject* heap_object = HeapObject::cast(
this);
814 if (heap_object->IsJSReceiver()) {
815 return heap_object->
map();
819 if (heap_object->IsHeapNumber()) {
820 return context->number_function()->initial_map();
822 if (heap_object->IsString()) {
823 return context->string_function()->initial_map();
825 if (heap_object->IsSymbol()) {
826 return context->symbol_function()->initial_map();
828 if (heap_object->IsBoolean()) {
829 return context->boolean_function()->initial_map();
831 return isolate->
heap()->null_value()->map();
843 uint32_t hash = Name::cast(
this)->Hash();
847 uint32_t hash = Oddball::cast(
this)->to_string()->Hash();
852 return JSReceiver::cast(
this)->GetIdentityHash();
860 DCHECK(object->IsJSReceiver());
866 if (other ==
this)
return true;
870 if (IsNumber() && other->IsNumber()) {
871 double this_value =
Number();
872 double other_value = other->
Number();
873 bool equal = this_value == other_value;
875 if (!
equal)
return std::isnan(this_value) && std::isnan(other_value);
877 return (this_value != 0) || ((1 / this_value) == (1 / other_value));
879 if (IsString() && other->IsString()) {
880 return String::cast(
this)->Equals(String::cast(other));
887 if (other ==
this)
return true;
891 if (IsNumber() && other->IsNumber()) {
892 double this_value =
Number();
893 double other_value = other->
Number();
895 return this_value == other_value
896 || (std::isnan(this_value) && std::isnan(other_value));
898 if (IsString() && other->IsString()) {
899 return String::cast(
this)->Equals(String::cast(other));
914 accumulator->Add(os.
c_str());
919 if (v.
value->IsSmi()) {
920 Smi::cast(v.
value)->SmiPrint(os);
941 if (str->
length() == 0)
return false;
942 int c0 = str->Get(0);
943 int c1 = str->
length() > 1 ? str->Get(1) : 0;
948 }
else if (c0 ==
'A' || c0 ==
'E' || c0 ==
'I' || c0 ==
'O') {
950 }
else if ((c1 == 0 || (c1 >=
'A' && c1 <=
'Z')) &&
951 (c0 ==
'F' || c0 ==
'H' || c0 ==
'M' || c0 ==
'N' || c0 ==
'R' ||
952 c0 ==
'S' || c0 ==
'X')) {
961 DCHECK(AllowHeapAllocation::IsAllowed());
962 DCHECK(cons->second()->length() != 0);
963 Isolate* isolate = cons->GetIsolate();
964 int length = cons->length();
968 if (cons->IsOneByteRepresentation()) {
970 length, tenure).ToHandleChecked();
976 length, tenure).ToHandleChecked();
981 cons->set_first(*result);
982 cons->set_second(isolate->
heap()->empty_string());
992 DCHECK(!this->IsExternalString());
993 #ifdef ENABLE_SLOW_DCHECKS
1001 resource->
length() *
sizeof(smart_chars[0])) == 0);
1009 bool is_internalized = this->IsInternalizedString();
1019 new_map = is_internalized
1021 ? heap->short_external_internalized_string_with_one_byte_data_map()
1022 : heap->short_external_internalized_string_map())
1023 : (is_one_byte ? heap->short_external_string_with_one_byte_data_map()
1024 : heap->short_external_string_map());
1026 new_map = is_internalized
1028 ? heap->external_internalized_string_with_one_byte_data_map()
1029 : heap->external_internalized_string_map())
1030 : (is_one_byte ? heap->external_string_with_one_byte_data_map()
1031 : heap->external_string_map());
1043 self->set_resource(resource);
1044 if (is_internalized)
self->Hash();
1054 DCHECK(!this->IsExternalString());
1055 #ifdef ENABLE_SLOW_DCHECKS
1068 resource->
length() *
sizeof(smart_chars[0])) == 0);
1075 bool is_internalized = this->IsInternalizedString();
1085 new_map = is_internalized
1086 ? heap->short_external_one_byte_internalized_string_map()
1087 : heap->short_external_one_byte_string_map();
1089 new_map = is_internalized
1090 ? heap->external_one_byte_internalized_string_map()
1091 : heap->external_one_byte_string_map();
1103 self->set_resource(resource);
1104 if (is_internalized)
self->Hash();
1114 accumulator->Add(
"<Very long string[%u]>", len);
1119 accumulator->Add(
"<Invalid String>");
1126 bool truncated =
false;
1131 bool one_byte =
true;
1132 for (
int i = 0;
i < len;
i++) {
1135 if (c < 32 || c >= 127) {
1141 accumulator->Add(
"<String[%u]: ",
length());
1142 for (
int i = 0;
i < len;
i++) {
1143 accumulator->Put(
static_cast<char>(stream.
GetNext()));
1145 accumulator->Put(
'>');
1149 accumulator->Add(
"<String[%u]\\: ",
length());
1150 for (
int i = 0;
i < len;
i++) {
1153 accumulator->Add(
"\\n");
1154 }
else if (c ==
'\r') {
1155 accumulator->Add(
"\\r");
1156 }
else if (c ==
'\\') {
1157 accumulator->Add(
"\\\\");
1158 }
else if (c < 32 || c > 126) {
1159 accumulator->Add(
"\\x%02x", c);
1161 accumulator->Put(
static_cast<char>(c));
1165 accumulator->Put(
'.');
1166 accumulator->Put(
'.');
1167 accumulator->Put(
'.');
1169 accumulator->Put(
'>');
1176 if (end < 0) end =
length();
1179 for (
int i = start;
i < end && stream.
HasMore();
i++) {
1186 switch (
map()->instance_type()) {
1188 double length = JSArray::cast(
this)->length()->IsUndefined()
1190 : JSArray::cast(
this)->length()->Number();
1191 accumulator->Add(
"<JS Array[%u]>",
static_cast<uint32_t>(length));
1195 accumulator->Add(
"<JS WeakMap>");
1199 accumulator->Add(
"<JS WeakSet>");
1203 accumulator->Add(
"<JS RegExp>");
1207 JSFunction*
function = JSFunction::cast(
this);
1208 Object* fun_name =
function->shared()->DebugName();
1209 bool printed =
false;
1210 if (fun_name->IsString()) {
1211 String* str = String::cast(fun_name);
1213 accumulator->Add(
"<JS Function ");
1214 accumulator->Put(str);
1219 accumulator->Add(
"<JS Function");
1221 accumulator->Add(
" (SharedFunctionInfo %p)",
1222 reinterpret_cast<void*
>(function->shared()));
1223 accumulator->Put(
'>');
1227 accumulator->Add(
"<JS Generator>");
1231 accumulator->Add(
"<JS Module>");
1237 Map* map_of_this =
map();
1239 Object* constructor = map_of_this->constructor();
1240 bool printed =
false;
1241 if (constructor->IsHeapObject() &&
1242 !heap->
Contains(HeapObject::cast(constructor))) {
1243 accumulator->Add(
"!!!INVALID CONSTRUCTOR!!!");
1245 bool global_object = IsJSGlobalProxy();
1246 if (constructor->IsJSFunction()) {
1247 if (!heap->
Contains(JSFunction::cast(constructor)->shared())) {
1248 accumulator->Add(
"!!!INVALID SHARED ON CONSTRUCTOR!!!");
1251 JSFunction::cast(constructor)->shared()->name();
1255 bool vowel =
AnWord(str);
1256 accumulator->Add(
"<%sa%s ",
1257 global_object ?
"Global Object: " :
"",
1259 accumulator->Put(str);
1260 accumulator->Add(
" with %smap %p",
1269 accumulator->Add(
"<JS %sObject", global_object ?
"Global " :
"");
1273 accumulator->Add(
" value = ");
1274 JSValue::cast(
this)->value()->ShortPrint(accumulator);
1276 accumulator->Put(
'>');
1287 if (from_kind != to_kind) {
1293 object->ShortPrint(
file);
1295 from_elements->ShortPrint(
file);
1297 to_elements->ShortPrint(
file);
1308 bool constant_to_field,
1314 os <<
"[generalizing ";
1317 Name*
name = instance_descriptors()->GetKey(modify_index);
1318 if (
name->IsString()) {
1321 os <<
"{symbol " <<
static_cast<void*
>(
name) <<
"}";
1324 if (constant_to_field) {
1327 os << old_representation.
Mnemonic() <<
"{";
1331 os <<
"->" << new_representation.
Mnemonic() <<
"{";
1334 if (strlen(reason) > 0) {
1337 os <<
"+" << (descriptors - split) <<
" maps";
1362 if (
name->IsString()) {
1377 os <<
"!!!INVALID POINTER!!!";
1381 os <<
"!!!INVALID MAP!!!";
1388 HeapStringAllocator allocator;
1389 StringStream accumulator(&allocator);
1390 String::cast(
this)->StringShortPrint(&accumulator);
1391 os << accumulator.ToCString().get();
1395 HeapStringAllocator allocator;
1396 StringStream accumulator(&allocator);
1397 JSObject::cast(
this)->JSObjectShortPrint(&accumulator);
1398 os << accumulator.ToCString().get();
1401 switch (
map()->instance_type()) {
1403 os <<
"<Map(elements=" << Map::cast(
this)->elements_kind() <<
")>";
1406 os <<
"<FixedArray[" << FixedArray::cast(
this)->length() <<
"]>";
1409 os <<
"<FixedDoubleArray[" << FixedDoubleArray::cast(
this)->length()
1413 os <<
"<ByteArray[" << ByteArray::cast(
this)->length() <<
"]>";
1416 os <<
"<FreeSpace[" << FreeSpace::cast(
this)->Size() <<
"]>";
1418 #define TYPED_ARRAY_SHORT_PRINT(Type, type, TYPE, ctype, size) \
1419 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
1420 os << "<External" #Type "Array[" \
1421 << External##Type##Array::cast(this)->length() << "]>"; \
1423 case FIXED_##TYPE##_ARRAY_TYPE: \
1424 os << "<Fixed" #Type "Array[" << Fixed##Type##Array::cast(this)->length() \
1429 #undef TYPED_ARRAY_SHORT_PRINT
1435 if (debug_name[0] != 0) {
1436 os <<
"<SharedFunctionInfo " << debug_name.
get() <<
">";
1438 os <<
"<SharedFunctionInfo>";
1443 os <<
"<JSMessageObject>";
1445 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1447 os << "<" #Name ">"; \
1450 #undef MAKE_STRUCT_CASE
1452 Code* code = Code::cast(
this);
1457 if (IsUndefined()) {
1458 os <<
"<undefined>";
1459 }
else if (IsTheHole()) {
1461 }
else if (IsNull()) {
1463 }
else if (IsTrue()) {
1465 }
else if (IsFalse()) {
1468 os <<
"<Odd Oddball>";
1473 Symbol* symbol = Symbol::cast(
this);
1474 os <<
"<Symbol: " << symbol->
Hash();
1475 if (!symbol->name()->IsUndefined()) {
1477 HeapStringAllocator allocator;
1478 StringStream accumulator(&allocator);
1479 String::cast(symbol->name())->StringShortPrint(&accumulator);
1480 os << accumulator.ToCString().get();
1487 HeapNumber::cast(
this)->HeapNumberPrint(os);
1492 os <<
"<MutableNumber: ";
1493 HeapNumber::cast(
this)->HeapNumberPrint(os);
1500 case JS_FUNCTION_PROXY_TYPE:
1501 os << "<JSFunctionProxy>";
1508 HeapStringAllocator allocator;
1509 StringStream accumulator(&allocator);
1510 Cell::cast(this)->value()->ShortPrint(&accumulator);
1511 os << accumulator.ToCString().get();
1514 case PROPERTY_CELL_TYPE: {
1515 os << "PropertyCell for ";
1516 HeapStringAllocator allocator;
1517 StringStream accumulator(&allocator);
1518 PropertyCell::cast(this)->value()->ShortPrint(&accumulator);
1519 os << accumulator.ToCString().get();
1523 os << "<Other heap object (" << map()->instance_type() << ")>";
1529 void HeapObject::Iterate(ObjectVisitor* v) {
1531 IteratePointer(v, kMapOffset);
1532 // Handle object body
1534 IterateBody(m->instance_type(), SizeFromMap(m), v);
1538 void HeapObject::IterateBody(InstanceType type, int object_size,
1540 // Avoiding <Type>::cast(this) because it accesses the map pointer field.
1541 // During GC, the map pointer field is encoded.
1542 if (type < FIRST_NONSTRING_TYPE) {
1543 switch (type & kStringRepresentationMask) {
1546 case kConsStringTag:
1547 ConsString::BodyDescriptor::IterateBody(this, v);
1549 case kSlicedStringTag:
1550 SlicedString::BodyDescriptor::IterateBody(this, v);
1552 case kExternalStringTag:
1553 if ((type & kStringEncodingMask) == kOneByteStringTag) {
1554 reinterpret_cast<ExternalOneByteString*>(this)
1555 ->ExternalOneByteStringIterateBody(v);
1557 reinterpret_cast<ExternalTwoByteString*>(this)->
1558 ExternalTwoByteStringIterateBody(v);
1566 case FIXED_ARRAY_TYPE:
1567 FixedArray::BodyDescriptor::IterateBody(this, object_size, v);
1569 case CONSTANT_POOL_ARRAY_TYPE:
1570 reinterpret_cast<ConstantPoolArray*>(this)->ConstantPoolIterateBody(v);
1572 case FIXED_DOUBLE_ARRAY_TYPE:
1574 case JS_OBJECT_TYPE:
1575 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1576 case JS_GENERATOR_OBJECT_TYPE:
1577 case JS_MODULE_TYPE:
1581 case JS_ARRAY_BUFFER_TYPE:
1582 case JS_TYPED_ARRAY_TYPE:
1583 case JS_DATA_VIEW_TYPE:
1586 case JS_SET_ITERATOR_TYPE:
1587 case JS_MAP_ITERATOR_TYPE:
1588 case JS_WEAK_MAP_TYPE:
1589 case JS_WEAK_SET_TYPE:
1590 case JS_REGEXP_TYPE:
1591 case JS_GLOBAL_PROXY_TYPE:
1592 case JS_GLOBAL_OBJECT_TYPE:
1593 case JS_BUILTINS_OBJECT_TYPE:
1594 case JS_MESSAGE_OBJECT_TYPE:
1595 JSObject::BodyDescriptor::IterateBody(this, object_size, v);
1597 case JS_FUNCTION_TYPE:
1598 reinterpret_cast<JSFunction*>(this)
1599 ->JSFunctionIterateBody(object_size, v);
1602 Oddball::BodyDescriptor::IterateBody(this, v);
1605 JSProxy::BodyDescriptor::IterateBody(this, v);
1607 case JS_FUNCTION_PROXY_TYPE:
1608 JSFunctionProxy::BodyDescriptor::IterateBody(this, v);
1611 reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v);
1614 Map::BodyDescriptor::IterateBody(this, v);
1617 reinterpret_cast<Code*>(this)->CodeIterateBody(v);
1620 Cell::BodyDescriptor::IterateBody(this, v);
1622 case PROPERTY_CELL_TYPE:
1623 PropertyCell::BodyDescriptor::IterateBody(this, v);
1626 Symbol::BodyDescriptor::IterateBody(this, v);
1629 case HEAP_NUMBER_TYPE:
1630 case MUTABLE_HEAP_NUMBER_TYPE:
1632 case BYTE_ARRAY_TYPE:
1633 case FREE_SPACE_TYPE:
1636 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1637 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
1638 case FIXED_##TYPE##_ARRAY_TYPE: \
1641 TYPED_ARRAYS(TYPED_ARRAY_CASE)
1642 #undef TYPED_ARRAY_CASE
1644 case SHARED_FUNCTION_INFO_TYPE: {
1645 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
1649 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1651 STRUCT_LIST(MAKE_STRUCT_CASE)
1652 #undef MAKE_STRUCT_CASE
1653 if (type == ALLOCATION_SITE_TYPE) {
1654 AllocationSite::BodyDescriptor::IterateBody(this, v);
1656 StructBodyDescriptor::IterateBody(this, object_size, v);
1660 PrintF("Unknown type: %d\n", type);
1666 bool HeapNumber::HeapNumberBooleanValue() {
1667 return DoubleToBoolean(value());
1671 void HeapNumber::HeapNumberPrint(OStream& os) { // NOLINT
1676 String* JSReceiver::class_name() {
1677 if (IsJSFunction() || IsJSFunctionProxy()) {
1678 return GetHeap()->Function_string();
1680 if (map()->constructor()->IsJSFunction()) {
1681 JSFunction* constructor = JSFunction::cast(map()->constructor());
1682 return String::cast(constructor->shared()->instance_class_name());
1684 // If the constructor is not present, return "Object".
1685 return GetHeap()->Object_string();
1689 String* Map::constructor_name() {
1690 if (constructor()->IsJSFunction()) {
1691 JSFunction* constructor = JSFunction::cast(this->constructor());
1692 String* name = String::cast(constructor->shared()->name());
1693 if (name->length() > 0) return name;
1694 String* inferred_name = constructor->shared()->inferred_name();
1695 if (inferred_name->length() > 0) return inferred_name;
1696 Object* proto = prototype();
1697 if (proto->IsJSObject()) return JSObject::cast(proto)->constructor_name();
1699 // TODO(rossberg): what about proxies?
1700 // If the constructor is not present, return "Object".
1701 return GetHeap()->Object_string();
1705 String* JSReceiver::constructor_name() {
1706 return map()->constructor_name();
1710 MaybeHandle<Map> Map::CopyWithField(Handle<Map> map,
1712 Handle<HeapType> type,
1713 PropertyAttributes attributes,
1714 Representation representation,
1715 TransitionFlag flag) {
1716 DCHECK(DescriptorArray::kNotFound ==
1717 map->instance_descriptors()->Search(
1718 *name, map->NumberOfOwnDescriptors()));
1720 // Ensure the descriptor array does not get too big.
1721 if (map->NumberOfOwnDescriptors() >= kMaxNumberOfDescriptors) {
1722 return MaybeHandle<Map>();
1725 Isolate* isolate = map->GetIsolate();
1727 // Compute the new index for new field.
1728 int index = map->NextFreePropertyIndex();
1730 if (map->instance_type() == JS_CONTEXT_EXTENSION_OBJECT_TYPE) {
1731 representation = Representation::Tagged();
1732 type = HeapType::Any(isolate);
1735 FieldDescriptor new_field_desc(name, index, type, attributes, representation);
1736 Handle<Map> new_map = Map::CopyAddDescriptor(map, &new_field_desc, flag);
1737 int unused_property_fields = new_map->unused_property_fields() - 1;
1738 if (unused_property_fields < 0) {
1739 unused_property_fields += JSObject::kFieldsAdded;
1741 new_map->set_unused_property_fields(unused_property_fields);
1746 MaybeHandle<Map> Map::CopyWithConstant(Handle<Map> map,
1748 Handle<Object> constant,
1749 PropertyAttributes attributes,
1750 TransitionFlag flag) {
1751 // Ensure the descriptor array does not get too big.
1752 if (map->NumberOfOwnDescriptors() >= kMaxNumberOfDescriptors) {
1753 return MaybeHandle<Map>();
1756 // Allocate new instance descriptors with (name, constant) added.
1757 ConstantDescriptor new_constant_desc(name, constant, attributes);
1758 return Map::CopyAddDescriptor(map, &new_constant_desc, flag);
1762 void JSObject::AddSlowProperty(Handle<JSObject> object,
1764 Handle<Object> value,
1765 PropertyAttributes attributes) {
1766 DCHECK(!object->HasFastProperties());
1767 Isolate* isolate = object->GetIsolate();
1768 Handle<NameDictionary> dict(object->property_dictionary());
1769 if (object->IsGlobalObject()) {
1770 // In case name is an orphaned property reuse the cell.
1771 int entry = dict->FindEntry(name);
1772 if (entry != NameDictionary::kNotFound) {
1773 Handle<PropertyCell> cell(PropertyCell::cast(dict->ValueAt(entry)));
1774 PropertyCell::SetValueInferType(cell, value);
1775 // Assign an enumeration index to the property and update
1776 // SetNextEnumerationIndex.
1777 int index = dict->NextEnumerationIndex();
1778 PropertyDetails details = PropertyDetails(attributes, NORMAL, index);
1779 dict->SetNextEnumerationIndex(index + 1);
1780 dict->SetEntry(entry, name, cell, details);
1783 Handle<PropertyCell> cell = isolate->factory()->NewPropertyCell(value);
1784 PropertyCell::SetValueInferType(cell, value);
1787 PropertyDetails details = PropertyDetails(attributes, NORMAL, 0);
1788 Handle<NameDictionary> result =
1789 NameDictionary::Add(dict, name, value, details);
1790 if (*dict != *result) object->set_properties(*result);
1794 Context* JSObject::GetCreationContext() {
1795 Object* constructor = this->map()->constructor();
1796 JSFunction* function;
1797 if (!constructor->IsJSFunction()) {
1798 // Functions have null as a constructor,
1799 // but any JSFunction knows its context immediately.
1800 function = JSFunction::cast(this);
1802 function = JSFunction::cast(constructor);
1805 return function->context()->native_context();
1809 void JSObject::EnqueueChangeRecord(Handle<JSObject> object,
1810 const char* type_str,
1812 Handle<Object> old_value) {
1813 DCHECK(!object->IsJSGlobalProxy());
1814 DCHECK(!object->IsJSGlobalObject());
1815 Isolate* isolate = object->GetIsolate();
1816 HandleScope scope(isolate);
1817 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str);
1818 Handle<Object> args[] = { type, object, name, old_value };
1819 int argc = name.is_null() ? 2 : old_value->IsTheHole() ? 3 : 4;
1821 Execution::Call(isolate,
1822 Handle<JSFunction>(isolate->observers_notify_change()),
1823 isolate->factory()->undefined_value(),
1824 argc, args).Assert();
1828 const char* Representation::Mnemonic() const {
1830 case kNone: return "v";
1831 case kTagged: return "t";
1832 case kSmi: return "s";
1833 case kDouble: return "d";
1834 case kInteger32: return "i";
1835 case kHeapObject: return "h";
1836 case kExternal: return "x";
1844 bool Map::InstancesNeedRewriting(Map* target, int target_number_of_fields,
1845 int target_inobject, int target_unused,
1846 int* old_number_of_fields) {
1847 // If fields were added (or removed), rewrite the instance.
1848 *old_number_of_fields = NumberOfFields();
1849 DCHECK(target_number_of_fields >= *old_number_of_fields);
1850 if (target_number_of_fields != *old_number_of_fields) return true;
1852 // If smi descriptors were replaced by double descriptors, rewrite.
1853 DescriptorArray* old_desc = instance_descriptors();
1854 DescriptorArray* new_desc = target->instance_descriptors();
1855 int limit = NumberOfOwnDescriptors();
1856 for (int i = 0; i < limit; i++) {
1857 if (new_desc->GetDetails(i).representation().IsDouble() !=
1858 old_desc->GetDetails(i).representation().IsDouble()) {
1863 // If no fields were added, and no inobject properties were removed, setting
1864 // the map is sufficient.
1865 if (target_inobject == inobject_properties()) return false;
1866 // In-object slack tracking may have reduced the object size of the new map.
1867 // In that case, succeed if all existing fields were inobject, and they still
1868 // fit within the new inobject size.
1869 DCHECK(target_inobject < inobject_properties());
1870 if (target_number_of_fields <= target_inobject) {
1871 DCHECK(target_number_of_fields + target_unused == target_inobject);
1874 // Otherwise, properties will need to be moved to the backing store.
1879 void Map::ConnectElementsTransition(Handle<Map> parent, Handle<Map> child) {
1880 Isolate* isolate = parent->GetIsolate();
1881 Handle<Name> name = isolate->factory()->elements_transition_symbol();
1882 ConnectTransition(parent, child, name, FULL_TRANSITION);
1886 void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map) {
1887 if (object->map() == *new_map) return;
1888 if (object->HasFastProperties()) {
1889 if (!new_map->is_dictionary_map()) {
1890 Handle<Map> old_map(object->map());
1891 MigrateFastToFast(object, new_map);
1892 if (old_map->is_prototype_map()) {
1893 // Clear out the old descriptor array to avoid problems to sharing
1894 // the descriptor array without using an explicit.
1895 old_map->InitializeDescriptors(
1896 old_map->GetHeap()->empty_descriptor_array());
1897 // Ensure that no transition was inserted for prototype migrations.
1898 DCHECK(!old_map->HasTransitionArray());
1899 DCHECK(new_map->GetBackPointer()->IsUndefined());
1902 MigrateFastToSlow(object, new_map, 0);
1905 // For slow-to-fast migrations JSObject::TransformToFastProperties()
1906 // must be used instead.
1907 CHECK(new_map->is_dictionary_map());
1909 // Slow-to-slow migration is trivial.
1910 object->set_map(*new_map);
1915 // To migrate a fast instance to a fast map:
1916 // - First check whether the instance needs to be rewritten. If not, simply
1918 // - Otherwise, allocate a fixed array large enough to hold all fields, in
1919 // addition to unused space.
1920 // - Copy all existing properties in, in the following order: backing store
1921 // properties, unused fields, inobject properties.
1922 // - If all allocation succeeded, commit the state atomically:
1923 // * Copy inobject properties from the backing store back into the object.
1924 // * Trim the difference in instance size of the object. This also cleanly
1925 // frees inobject properties that moved to the backing store.
1926 // * If there are properties left in the backing store, trim of the space used
1927 // to temporarily store the inobject properties.
1928 // * If there are properties left in the backing store, install the backing
1930 void JSObject::MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
1931 Isolate* isolate = object->GetIsolate();
1932 Handle<Map> old_map(object->map());
1933 int old_number_of_fields;
1934 int number_of_fields = new_map->NumberOfFields();
1935 int inobject = new_map->inobject_properties();
1936 int unused = new_map->unused_property_fields();
1938 // Nothing to do if no functions were converted to fields and no smis were
1939 // converted to doubles.
1940 if (!old_map->InstancesNeedRewriting(*new_map, number_of_fields, inobject,
1941 unused, &old_number_of_fields)) {
1942 object->synchronized_set_map(*new_map);
1946 int total_size = number_of_fields + unused;
1947 int external = total_size - inobject;
1949 if (number_of_fields != old_number_of_fields &&
1950 new_map->GetBackPointer() == *old_map) {
1951 PropertyDetails details = new_map->GetLastDescriptorDetails();
1953 if (old_map->unused_property_fields() > 0) {
1954 if (details.representation().IsDouble()) {
1955 Handle<Object> value = isolate->factory()->NewHeapNumber(0, MUTABLE);
1957 FieldIndex::ForDescriptor(*new_map, new_map->LastAdded());
1958 object->FastPropertyAtPut(index, *value);
1960 object->synchronized_set_map(*new_map);
1964 DCHECK(number_of_fields == old_number_of_fields + 1);
1965 // This migration is a transition from a map that has run out out property
1966 // space. Therefore it could be done by extending the backing store.
1967 Handle<FixedArray> old_storage = handle(object->properties(), isolate);
1968 Handle<FixedArray> new_storage =
1969 FixedArray::CopySize(old_storage, external);
1971 // Properly initialize newly added property.
1972 Handle<Object> value;
1973 if (details.representation().IsDouble()) {
1974 value = isolate->factory()->NewHeapNumber(0, MUTABLE);
1976 value = isolate->factory()->uninitialized_value();
1978 DCHECK(details.type() == FIELD);
1979 int target_index = details.field_index() - inobject;
1980 DCHECK(target_index >= 0); // Must be a backing store index.
1981 new_storage->set(target_index, *value);
1983 // From here on we cannot fail and we shouldn't
GC anymore.
1987 object->set_properties(*new_storage);
1988 object->synchronized_set_map(*new_map);
1995 int old_nof = old_map->NumberOfOwnDescriptors();
1996 int new_nof = new_map->NumberOfOwnDescriptors();
2000 DCHECK(old_nof <= new_nof);
2002 for (
int i = 0;
i < old_nof;
i++) {
2003 PropertyDetails details = new_descriptors->GetDetails(
i);
2004 if (details.type() !=
FIELD)
continue;
2005 PropertyDetails old_details = old_descriptors->GetDetails(
i);
2007 DCHECK(details.representation().IsTagged());
2011 old_details.type() ==
FIELD);
2013 ? old_descriptors->GetValue(
i)
2014 :
object->RawFastPropertyAt(FieldIndex::ForDescriptor(*old_map,
i));
2016 if (!old_details.representation().IsDouble() &&
2017 details.representation().IsDouble()) {
2018 if (old_details.representation().IsNone()) {
2022 }
else if (old_details.representation().IsDouble() &&
2023 !details.representation().IsDouble()) {
2026 DCHECK(!(details.representation().IsDouble() && value->IsSmi()));
2027 int target_index = new_descriptors->GetFieldIndex(
i) - inobject;
2028 if (target_index < 0) target_index += total_size;
2029 array->set(target_index, *value);
2032 for (
int i = old_nof;
i < new_nof;
i++) {
2033 PropertyDetails details = new_descriptors->GetDetails(
i);
2034 if (details.type() !=
FIELD)
continue;
2035 Handle<Object> value;
2036 if (details.representation().IsDouble()) {
2037 value = isolate->factory()->NewHeapNumber(0,
MUTABLE);
2039 value = isolate->factory()->uninitialized_value();
2041 int target_index = new_descriptors->GetFieldIndex(
i) - inobject;
2042 if (target_index < 0) target_index += total_size;
2043 array->set(target_index, *value);
2051 int limit =
Min(inobject, number_of_fields);
2052 for (
int i = 0;
i < limit;
i++) {
2053 FieldIndex index = FieldIndex::ForPropertyIndex(*new_map,
i);
2054 object->FastPropertyAtPut(index, array->get(external +
i));
2057 Heap* heap = isolate->heap();
2063 object->set_properties(*array);
2067 int new_instance_size = new_map->instance_size();
2068 int instance_size_delta = old_map->instance_size() - new_instance_size;
2069 DCHECK(instance_size_delta >= 0);
2071 if (instance_size_delta > 0) {
2073 heap->CreateFillerObjectAt(
2074 address + new_instance_size, instance_size_delta);
2080 object->synchronized_set_map(*new_map);
2089 handle(object->map()), modify_index, new_representation, new_field_type,
2091 MigrateToMap(
object, new_map);
2098 for (
int i = 0;
i < NumberOfOwnDescriptors();
i++) {
2109 const char* reason) {
2115 for (
int i = 0;
i < length;
i++) {
2118 descriptors->
SetValue(
i, HeapType::Any());
2123 PropertyDetails details = descriptors->
GetDetails(modify_index);
2125 (details.type() !=
FIELD || details.attributes() != attributes)) {
2126 int field_index = details.type() ==
FIELD ? details.field_index()
2127 : new_map->NumberOfFields();
2128 FieldDescriptor d(
handle(descriptors->
GetKey(modify_index), isolate),
2130 descriptors->
Replace(modify_index, &d);
2131 if (details.type() !=
FIELD) {
2132 int unused_property_fields = new_map->unused_property_fields() - 1;
2133 if (unused_property_fields < 0) {
2136 new_map->set_unused_property_fields(unused_property_fields);
2139 DCHECK(details.attributes() == attributes);
2142 if (FLAG_trace_generalization) {
2144 ?
map->instance_descriptors()->GetFieldType(modify_index)
2147 new_map->NumberOfOwnDescriptors(),
2148 new_map->NumberOfOwnDescriptors(),
2151 field_type, HeapType::Any());
2161 const char* reason) {
2162 PropertyDetails details =
2163 map->instance_descriptors()->GetDetails(modify_index);
2164 return CopyGeneralizeAllRepresentations(
map, modify_index, store_mode,
2165 details.attributes(), reason);
2170 if (is_deprecated())
return;
2171 if (HasTransitionArray()) {
2180 NotifyLeafMapLayoutChange();
2188 if (HasTransitionArray()) {
2190 int transition = transitions->
Search(key);
2197 if (NumberOfOwnDescriptors() == 0)
return;
2200 Map* current =
this;
2202 while (current->instance_descriptors() == to_replace) {
2204 current->set_instance_descriptors(new_descriptors);
2206 if (next->IsUndefined())
break;
2207 current = Map::cast(next);
2210 set_owns_descriptors(
false);
2218 if (back->IsUndefined())
return result;
2219 result = Map::cast(back);
2230 DCHECK(GetBackPointer()->IsUndefined());
2232 Map* current =
this;
2234 for (
int i = verbatim;
i < length;
i++) {
2244 PropertyDetails details = descriptors->
GetDetails(
i);
2245 PropertyDetails next_details = next_descriptors->
GetDetails(
i);
2246 if (details.type() != next_details.type())
break;
2247 if (details.attributes() != next_details.attributes())
break;
2248 if (!details.representation().Equals(next_details.representation()))
break;
2249 if (next_details.type() ==
FIELD) {
2264 DCHECK_EQ(
FIELD, instance_descriptors()->GetDetails(descriptor).type());
2268 if (back->IsUndefined())
break;
2269 Map* parent = Map::cast(back);
2280 PropertyDetails details = instance_descriptors()->GetDetails(descriptor);
2281 if (details.type() !=
FIELD)
return;
2282 if (HasTransitionArray()) {
2289 if (instance_descriptors()->GetFieldType(descriptor) == *new_type)
return;
2290 FieldDescriptor d(
name, instance_descriptors()->GetFieldIndex(descriptor),
2291 new_type, details.attributes(), details.representation());
2292 instance_descriptors()->Replace(descriptor, &d);
2300 static const int kMaxClassesPerFieldType = 5;
2301 if (type1->NowIs(type2))
return type2;
2302 if (type2->NowIs(type1))
return type1;
2303 if (type1->NowStable() && type2->NowStable()) {
2305 if (type->NumClasses() <= kMaxClassesPerFieldType) {
2306 DCHECK(type->NowStable());
2307 DCHECK(type1->NowIs(type));
2308 DCHECK(type2->NowIs(type));
2312 return HeapType::Any(isolate);
2324 map->instance_descriptors()->GetFieldType(modify_index), isolate);
2325 if (new_field_type->NowIs(old_field_type)) {
2328 isolate)->NowIs(old_field_type));
2335 field_owner->instance_descriptors(), isolate);
2336 DCHECK_EQ(*old_field_type, descriptors->GetFieldType(modify_index));
2340 old_field_type, new_field_type, isolate);
2342 PropertyDetails details = descriptors->GetDetails(modify_index);
2344 field_owner->UpdateFieldType(modify_index,
name, new_field_type);
2345 field_owner->dependent_code()->DeoptimizeDependentCodeGroup(
2348 if (FLAG_trace_generalization) {
2350 stdout,
"field type generalization",
2353 details.representation(), details.representation(),
2354 *old_field_type, *new_field_type);
2383 Isolate* isolate = old_map->GetIsolate();
2386 old_map->instance_descriptors(), isolate);
2387 int old_nof = old_map->NumberOfOwnDescriptors();
2388 PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
2389 Representation old_representation = old_details.representation();
2395 if (old_representation.
IsNone() &&
2396 !new_representation.
IsNone() &&
2399 DCHECK(old_descriptors->GetFieldType(modify_index)->NowIs(
2401 if (FLAG_trace_generalization) {
2402 old_map->PrintGeneralization(
2403 stdout,
"uninitialized field",
2404 modify_index, old_map->NumberOfOwnDescriptors(),
2405 old_map->NumberOfOwnDescriptors(),
false,
2406 old_representation, new_representation,
2407 old_descriptors->GetFieldType(modify_index), *new_field_type);
2409 old_descriptors->SetRepresentation(modify_index, new_representation);
2410 old_descriptors->SetValue(modify_index, *new_field_type);
2415 Handle<Map> root_map(old_map->FindRootMap(), isolate);
2416 if (!old_map->EquivalentToForTransition(*root_map)) {
2417 return CopyGeneralizeAllRepresentations(
2418 old_map, modify_index, store_mode,
"not equivalent");
2420 int root_nof = root_map->NumberOfOwnDescriptors();
2421 if (modify_index < root_nof) {
2422 PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
2424 (old_details.type() ==
FIELD &&
2425 (!new_field_type->NowIs(old_descriptors->GetFieldType(modify_index)) ||
2426 !new_representation.
fits_into(old_details.representation())))) {
2427 return CopyGeneralizeAllRepresentations(
2428 old_map, modify_index, store_mode,
"root modification");
2433 for (
int i = root_nof;
i < old_nof; ++
i) {
2434 int j = target_map->SearchTransition(old_descriptors->GetKey(
i));
2436 Handle<Map> tmp_map(target_map->GetTransition(j), isolate);
2438 tmp_map->instance_descriptors(), isolate);
2441 PropertyDetails old_details = old_descriptors->GetDetails(
i);
2442 PropertyDetails tmp_details = tmp_descriptors->GetDetails(
i);
2445 if (tmp_details.attributes() != old_details.attributes() ||
2447 (tmp_type != old_type ||
2448 tmp_descriptors->GetValue(
i) != old_descriptors->GetValue(
i)))) {
2449 return CopyGeneralizeAllRepresentations(
2450 old_map, modify_index, store_mode,
"incompatible");
2452 Representation old_representation = old_details.representation();
2453 Representation tmp_representation = tmp_details.representation();
2454 if (!old_representation.
fits_into(tmp_representation) ||
2455 (!new_representation.
fits_into(tmp_representation) &&
2456 modify_index ==
i)) {
2459 if (tmp_type ==
FIELD) {
2462 ?
handle(old_descriptors->GetFieldType(
i), isolate)
2463 : old_descriptors->GetValue(
i)->OptimalType(
2464 isolate, tmp_representation);
2465 if (modify_index ==
i) {
2466 old_field_type = GeneralizeFieldType(
2467 new_field_type, old_field_type, isolate);
2469 GeneralizeFieldType(tmp_map,
i, old_field_type);
2472 old_descriptors->GetConstant(
i) != tmp_descriptors->GetConstant(
i)) {
2477 DCHECK_EQ(tmp_descriptors->GetValue(
i), old_descriptors->GetValue(
i));
2479 target_map = tmp_map;
2484 target_map->instance_descriptors(), isolate);
2485 int target_nof = target_map->NumberOfOwnDescriptors();
2486 if (target_nof == old_nof &&
2488 target_descriptors->GetDetails(modify_index).type() ==
FIELD)) {
2489 DCHECK(modify_index < target_nof);
2491 target_descriptors->GetDetails(modify_index).representation()));
2492 DCHECK(target_descriptors->GetDetails(modify_index).type() !=
FIELD ||
2493 new_field_type->NowIs(
2494 target_descriptors->GetFieldType(modify_index)));
2499 for (
int i = target_nof;
i < old_nof; ++
i) {
2500 int j = target_map->SearchTransition(old_descriptors->GetKey(
i));
2502 Handle<Map> tmp_map(target_map->GetTransition(j), isolate);
2504 tmp_map->instance_descriptors(), isolate);
2507 PropertyDetails old_details = old_descriptors->GetDetails(
i);
2508 PropertyDetails tmp_details = tmp_descriptors->GetDetails(
i);
2509 if (tmp_details.attributes() != old_details.attributes() ||
2511 (tmp_details.type() != old_details.type() ||
2512 tmp_descriptors->GetValue(
i) != old_descriptors->GetValue(
i)))) {
2513 return CopyGeneralizeAllRepresentations(
2514 old_map, modify_index, store_mode,
"incompatible");
2516 target_map = tmp_map;
2518 target_nof = target_map->NumberOfOwnDescriptors();
2519 target_descriptors =
handle(target_map->instance_descriptors(), isolate);
2524 int new_slack =
Max(
2525 old_nof, old_descriptors->number_of_descriptors()) - old_nof;
2527 isolate, old_nof, new_slack);
2528 DCHECK(new_descriptors->length() > target_descriptors->length() ||
2529 new_descriptors->NumberOfSlackDescriptors() > 0 ||
2530 new_descriptors->number_of_descriptors() ==
2531 old_descriptors->number_of_descriptors());
2532 DCHECK(new_descriptors->number_of_descriptors() == old_nof);
2535 int current_offset = 0;
2536 for (
int i = 0;
i < root_nof; ++
i) {
2537 PropertyDetails old_details = old_descriptors->GetDetails(
i);
2538 if (old_details.type() ==
FIELD) current_offset++;
2540 handle(old_descriptors->GetValue(
i), isolate),
2542 new_descriptors->Set(
i, &d);
2546 for (
int i = root_nof;
i < target_nof; ++
i) {
2547 Handle<Name> target_key(target_descriptors->GetKey(
i), isolate);
2548 PropertyDetails old_details = old_descriptors->GetDetails(
i);
2549 PropertyDetails target_details = target_descriptors->GetDetails(
i);
2550 target_details = target_details.CopyWithRepresentation(
2551 old_details.representation().generalize(
2552 target_details.representation()));
2553 if (modify_index ==
i) {
2554 target_details = target_details.CopyWithRepresentation(
2555 new_representation.
generalize(target_details.representation()));
2557 DCHECK_EQ(old_details.attributes(), target_details.attributes());
2558 if (old_details.type() ==
FIELD ||
2559 target_details.type() ==
FIELD ||
2561 (target_descriptors->GetValue(
i) != old_descriptors->GetValue(
i))) {
2563 ?
handle(old_descriptors->GetFieldType(
i), isolate)
2564 : old_descriptors->GetValue(
i)->OptimalType(
2565 isolate, target_details.representation());
2567 ?
handle(target_descriptors->GetFieldType(
i), isolate)
2568 : target_descriptors->GetValue(
i)->OptimalType(
2569 isolate, target_details.representation());
2570 target_field_type = GeneralizeFieldType(
2571 target_field_type, old_field_type, isolate);
2572 if (modify_index ==
i) {
2573 target_field_type = GeneralizeFieldType(
2574 target_field_type, new_field_type, isolate);
2576 FieldDescriptor d(target_key,
2579 target_details.attributes(),
2580 target_details.representation());
2581 new_descriptors->Set(
i, &d);
2585 handle(target_descriptors->GetValue(
i), isolate),
2587 new_descriptors->Set(
i, &d);
2592 for (
int i = target_nof;
i < old_nof; ++
i) {
2593 PropertyDetails old_details = old_descriptors->GetDetails(
i);
2595 if (modify_index ==
i) {
2596 old_details = old_details.CopyWithRepresentation(
2597 new_representation.
generalize(old_details.representation()));
2599 if (old_details.type() ==
FIELD) {
2601 old_descriptors->GetFieldType(
i), isolate);
2602 if (modify_index ==
i) {
2603 old_field_type = GeneralizeFieldType(
2604 old_field_type, new_field_type, isolate);
2606 FieldDescriptor d(old_key,
2609 old_details.attributes(),
2610 old_details.representation());
2611 new_descriptors->Set(
i, &d);
2615 FieldDescriptor d(old_key,
2617 GeneralizeFieldType(
2618 old_descriptors->GetValue(
i)->OptimalType(
2619 isolate, old_details.representation()),
2620 new_field_type, isolate),
2621 old_details.attributes(),
2622 old_details.representation());
2623 new_descriptors->Set(
i, &d);
2627 handle(old_descriptors->GetValue(
i), isolate),
2629 new_descriptors->Set(
i, &d);
2634 new_descriptors->Sort();
2637 new_descriptors->GetDetails(modify_index).type() ==
FIELD);
2640 root_nof, old_nof, *new_descriptors), isolate);
2641 int split_nof = split_map->NumberOfOwnDescriptors();
2644 split_map->DeprecateTarget(
2645 old_descriptors->GetKey(split_nof), *new_descriptors);
2647 if (FLAG_trace_generalization) {
2648 PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
2649 PropertyDetails new_details = new_descriptors->GetDetails(modify_index);
2651 ?
handle(old_descriptors->GetFieldType(modify_index), isolate)
2655 ?
handle(new_descriptors->GetFieldType(modify_index), isolate)
2658 old_map->PrintGeneralization(
2659 stdout,
"", modify_index, split_nof, old_nof,
2661 old_details.representation(), new_details.representation(),
2662 *old_field_type, *new_field_type);
2667 for (
int i = split_nof;
i < old_nof; ++
i) {
2668 new_map = CopyInstallDescriptors(new_map,
i, new_descriptors);
2670 new_map->set_owns_descriptors(
true);
2680 if (descriptors->GetDetails(
i).type() ==
FIELD) {
2693 while (proto_map->prototype()->IsJSObject()) {
2700 return TryUpdateInternal(
map);
2718 if (!old_map->is_deprecated())
return old_map;
2721 Map* root_map = old_map->FindRootMap();
2722 if (!old_map->EquivalentToForTransition(root_map))
return MaybeHandle<Map>();
2725 int old_nof = old_map->NumberOfOwnDescriptors();
2728 Map* new_map = root_map;
2729 for (
int i = root_nof;
i < old_nof; ++
i) {
2735 PropertyDetails new_details = new_descriptors->
GetDetails(
i);
2736 PropertyDetails old_details = old_descriptors->
GetDetails(
i);
2737 if (old_details.attributes() != new_details.attributes() ||
2738 !old_details.representation().fits_into(new_details.representation())) {
2747 if ((old_type ==
FIELD &&
2759 if (old_type != new_type || old_value != new_value) {
2776 if (it->name()->IsSymbol())
return value;
2784 ApiNamedPropertyAccess(
"interceptor-named-set", *holder, *name_string));
2788 v8::ToCData<v8::NamedPropertySetterCallback>(interceptor->setter());
2792 if (!result.
IsEmpty())
return value;
2803 return SetProperty(&it, value, strict_mode, store_mode);
2814 AssertNoContextChange ncc(it->isolate());
2817 for (; it->IsFound(); it->Next()) {
2818 switch (it->state()) {
2819 case LookupIterator::NOT_FOUND:
2822 case LookupIterator::ACCESS_CHECK:
2830 case LookupIterator::JSPROXY:
2831 if (it->HolderIsReceiverOrHiddenPrototype()) {
2833 it->GetReceiver(), it->name(),
2834 value, strict_mode);
2837 bool has_result =
false;
2840 it->GetHolder<
JSProxy>(), it->GetReceiver(), it->name(),
2841 value, strict_mode, &has_result);
2842 if (has_result)
return maybe_result;
2847 case LookupIterator::INTERCEPTOR:
2848 if (it->HolderIsReceiverOrHiddenPrototype()) {
2851 if (!maybe_result.
is_null())
return maybe_result;
2852 if (it->isolate()->has_pending_exception())
return maybe_result;
2856 it->GetHolder<
JSObject>(), it->GetReceiver(), it->name());
2866 if (it->property_details().IsReadOnly()) {
2869 if (it->HolderIsReceiverOrHiddenPrototype() ||
2870 !it->GetAccessors()->IsDeclaredAccessorInfo()) {
2873 it->GetAccessors(), strict_mode);
2878 case LookupIterator::DATA:
2879 if (it->property_details().IsReadOnly()) {
2882 if (it->HolderIsReceiverOrHiddenPrototype()) {
2888 case LookupIterator::TRANSITION:
2899 if (it->GetReceiver()->IsJSGlobalObject() && strict_mode ==
STRICT) {
2902 NewReferenceError(
"not_defined",
HandleVector(args, 1)),
2907 if (strict_mode ==
STRICT) {
2910 NewReferenceError(
"not_defined",
HandleVector(args, 1)),
2923 if (strict_mode !=
STRICT)
return value;
2927 NewTypeError(
"strict_read_only_property",
2940 DCHECK(it->HolderIsReceiverOrHiddenPrototype());
2946 receiver->map()->is_observed() &&
2947 !it->name().is_identical_to(it->factory()->hidden_string());
2949 if (is_observed) maybe_old = it->GetDataValue();
2953 it->PrepareForDataProperty(value);
2956 it->WriteDataValue(value);
2959 if (is_observed && !value->SameValue(*maybe_old.ToHandleChecked())) {
2961 maybe_old.ToHandleChecked());
2973 DCHECK(!it->GetReceiver()->IsJSProxy());
2974 if (!it->GetReceiver()->IsJSObject()) {
2983 if (receiver->IsJSGlobalProxy())
return value;
2987 it->PrepareTransitionToDataProperty(value, attributes, store_mode);
2988 if (it->state() != LookupIterator::TRANSITION) {
2989 if (strict_mode ==
SLOPPY)
return value;
2993 NewTypeError(
"object_not_extensible",
2997 it->ApplyTransitionToDataProperty();
3000 if (receiver->map()->is_dictionary_map()) {
3002 it->InternalizeName();
3006 it->WriteDataValue(value);
3010 if (receiver->map()->is_observed() &&
3011 !it->name().is_identical_to(it->factory()->hidden_string())) {
3013 it->factory()->the_hole_value());
3026 Isolate *isolate =
object->GetIsolate();
3032 isolate->
factory()->Uint32ToString(index),
3033 value, strict_mode, found);
3037 if (!js_proto->HasDictionaryElements()) {
3041 int entry = dictionary->FindEntry(index);
3043 PropertyDetails details = dictionary->DetailsAt(entry);
3047 return SetElementWithCallback(
object, structure, index, value, js_proto,
3053 return isolate->
factory()->the_hole_value();
3063 if (slack <= descriptors->NumberOfSlackDescriptors())
return;
3066 descriptors, old_size, slack);
3068 if (old_size == 0) {
3069 map->set_instance_descriptors(*new_descriptors);
3078 if (descriptors->HasEnumCache()) {
3079 new_descriptors->CopyEnumCacheFrom(*descriptors);
3087 !current->IsUndefined();
3089 walk_map = Map::cast(current);
3090 if (walk_map->instance_descriptors() != *descriptors)
break;
3091 walk_map->set_instance_descriptors(*new_descriptors);
3094 map->set_instance_descriptors(*new_descriptors);
3101 int valid_descriptors) {
3102 int nof_callbacks = callbacks->
length();
3104 Isolate* isolate = array->GetIsolate();
3108 for (
int i = 0;
i < nof_callbacks; ++
i) {
3110 if (entry->name()->IsUniqueName())
continue;
3112 isolate->
factory()->InternalizeString(
3114 entry->set_name(*key);
3120 for (
int i = nof_callbacks - 1;
i >= 0;
i--) {
3124 if (!T::Contains(key, entry, valid_descriptors, array)) {
3125 T::Insert(key, entry, valid_descriptors, array);
3126 valid_descriptors++;
3130 return valid_descriptors;
3137 int valid_descriptors,
3144 int valid_descriptors,
3147 CallbacksDescriptor desc(key, entry, entry->property_attributes());
3148 array->Append(&desc);
3157 int valid_descriptors,
3159 for (
int i = 0;
i < valid_descriptors;
i++) {
3160 if (*key == AccessorInfo::cast(array->get(
i))->name())
return true;
3166 int valid_descriptors,
3169 array->set(valid_descriptors, *entry);
3179 DCHECK(array->NumberOfSlackDescriptors() >= callbacks.
length());
3180 nof = AppendUniqueCallbacks<DescriptorArrayAppender>(&callbacks, array, nof);
3187 int valid_descriptors) {
3189 DCHECK(array->length() >= callbacks.
length() + valid_descriptors);
3190 return AppendUniqueCallbacks<FixedArrayAppender>(&callbacks,
3198 for (
int i = 0;
i < maps->length(); ++
i) {
3199 if (!maps->
at(
i).
is_null() && maps->
at(
i).is_identical_to(
map))
return true;
3221 MaybeNull(current_map->LookupElementsTransitionMap(kind));
3222 if (maybe_transitioned_map.
is_null())
break;
3223 if (
ContainsMap(candidates, maybe_transitioned_map) &&
3225 transitioned_map = maybe_transitioned_map;
3228 current_map = maybe_transitioned_map;
3231 return transitioned_map;
3256 while (kind != target_kind) {
3282 if (isolate->initial_array_prototype()->map() ==
this) {
3286 if (isolate->initial_object_prototype()->map() ==
this) {
3311 if (kind != to_kind) {
3316 DCHECK(current_map->elements_kind() == to_kind);
3324 if (from_kind == to_kind)
return map;
3328 Object* maybe_array_maps = native_context->js_array_maps();
3329 if (maybe_array_maps->IsFixedArray()) {
3331 FixedArray* array_maps = FixedArray::cast(maybe_array_maps);
3332 if (array_maps->
get(from_kind) == *
map) {
3333 Object* maybe_transitioned_map = array_maps->
get(to_kind);
3334 if (maybe_transitioned_map->IsMap()) {
3335 return handle(Map::cast(maybe_transitioned_map));
3340 return TransitionElementsToSlow(
map, to_kind);
3348 if (from_kind == to_kind) {
3352 bool allow_store_transition =
3360 allow_store_transition &=
3365 if (!allow_store_transition) {
3377 if (closest_map->elements_kind() == kind) {
3394 Isolate* isolate = proxy->GetIsolate();
3397 if (
name->IsSymbol())
return maybe(
false);
3402 isolate, result, CallTrap(proxy,
"has", isolate->derived_has_trap(),
3406 return maybe(result->BooleanValue());
3415 Isolate* isolate = proxy->GetIsolate();
3418 if (
name->IsSymbol())
return value;
3425 isolate->derived_set_trap(),
3437 Isolate* isolate = proxy->GetIsolate();
3441 if (
name->IsSymbol()) {
3443 return isolate->
factory()->the_hole_value();
3452 "getPropertyDescriptor",
3458 if (result->IsUndefined()) {
3460 return isolate->
factory()->the_hole_value();
3468 Execution::Call(isolate,
3469 isolate->to_complete_property_descriptor(),
3477 isolate->
factory()->InternalizeOneByteString(
3481 DCHECK(configurable->IsBoolean());
3482 if (configurable->IsFalse()) {
3490 DCHECK(configurable->IsTrue());
3494 isolate->
factory()->InternalizeOneByteString(
3498 DCHECK(hasWritable->IsBoolean());
3499 if (hasWritable->IsTrue()) {
3504 DCHECK(writable->IsBoolean());
3505 *done = writable->IsFalse();
3506 if (!*done)
return isolate->
factory()->the_hole_value();
3507 if (strict_mode ==
SLOPPY)
return value;
3518 if (!setter->IsUndefined()) {
3524 if (strict_mode ==
SLOPPY)
return value;
3534 Isolate* isolate = proxy->GetIsolate();
3537 if (
name->IsSymbol())
return isolate->
factory()->false_value();
3550 bool result_bool = result->BooleanValue();
3551 if (
mode == STRICT_DELETION && !result_bool) {
3560 return isolate->
factory()->ToBoolean(result_bool);
3566 Isolate* isolate = proxy->GetIsolate();
3574 Isolate* isolate = proxy->GetIsolate();
3584 proxy->CallTrap(proxy,
"getPropertyDescriptor",
Handle<Object>(),
3594 Execution::Call(isolate, isolate->to_complete_property_descriptor(),
3617 if (!writable->BooleanValue()) {
3624 writable = isolate->
factory()->ToBoolean(!setter->IsUndefined());
3627 if (configurable->IsFalse()) {
3633 MaybeHandle<Object> maybe_error = isolate->
factory()->NewTypeError(
3635 if (maybe_error.ToHandle(&error)) isolate->
Throw(*error);
3639 int attributes =
NONE;
3640 if (!enumerable->BooleanValue()) attributes |=
DONT_ENUM;
3641 if (!configurable->BooleanValue()) attributes |=
DONT_DELETE;
3642 if (!writable->BooleanValue()) attributes |=
READ_ONLY;
3649 Isolate* isolate = proxy->GetIsolate();
3651 return GetPropertyAttributesWithHandler(proxy, receiver,
name);
3656 Isolate* isolate = proxy->GetIsolate();
3661 if (proxy->IsJSFunctionProxy()) {
3662 isolate->
factory()->BecomeJSFunction(proxy);
3665 isolate->
factory()->BecomeJSObject(proxy);
3667 DCHECK(proxy->IsJSObject());
3670 if (hash->IsSmi()) {
3682 Isolate* isolate = proxy->GetIsolate();
3692 if (trap->IsUndefined()) {
3696 NewTypeError(
"handler_trap_missing",
3703 return Execution::Call(isolate, trap, handler, argc, argv);
3709 ElementsKind obj_kind =
object->map()->elements_kind();
3711 if (map_kind != obj_kind) {
3718 NormalizeElements(
object);
3720 TransitionElementsKind(
object, to_kind);
3732 MigrateToMap(
object,
map);
3733 if (FLAG_trace_migration) {
3734 object->PrintInstanceMigration(stdout, *original_map, *
map);
3741 Isolate* isolate =
object->GetIsolate();
3749 if (FLAG_trace_migration) {
3750 object->PrintInstanceMigration(stdout, *original_map, object->map());
3769 PropertyDetails details = desc->
GetDetails(descriptor);
3773 FieldIndex index = FieldIndex::ForDescriptor(
map(), descriptor);
3774 if (details.representation().IsDouble()) {
3776 if (value->IsUninitialized())
return;
3777 HeapNumber* box = HeapNumber::cast(RawFastPropertyAt(index));
3778 DCHECK(box->IsMutableHeapNumber());
3781 FastPropertyAtPut(index, value);
3790 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
3793 DCHECK(!object->IsJSProxy());
3798 DCHECK(object->map()->is_extensible() ||
3799 name.is_identical_to(it.isolate()->factory()->hidden_string()));
3814 DCHECK(!value->IsTheHole());
3816 bool is_observed =
object->map()->is_observed() &&
3817 *
name != it.isolate()->heap()->hidden_string();
3818 for (; it.IsFound(); it.Next()) {
3819 switch (it.state()) {
3820 case LookupIterator::INTERCEPTOR:
3821 case LookupIterator::JSPROXY:
3822 case LookupIterator::NOT_FOUND:
3823 case LookupIterator::TRANSITION:
3826 case LookupIterator::ACCESS_CHECK:
3828 return SetPropertyWithFailedAccessCheck(&it, value,
SLOPPY);
3833 PropertyDetails details = it.property_details();
3834 Handle<Object> old_value = it.isolate()->factory()->the_hole_value();
3836 AssertNoContextChange ncc(it.isolate());
3840 if (is_observed && accessors->IsAccessorInfo()) {
3842 it.isolate(), old_value,
3844 it.GetHolder<
JSObject>(), accessors),
3850 if (handling == DONT_FORCE_FIELD &&
3851 accessors->IsExecutableAccessorInfo()) {
3854 it.isolate(), result,
3859 DCHECK(result->SameValue(*value));
3861 if (details.attributes() == attributes) {
3863 if (is_observed && !old_value->SameValue(*value)) {
3867 if (!object->IsJSFunction() ||
3868 !
Name::Equals(it.isolate()->factory()->prototype_string(),
3871 EnqueueChangeRecord(
object,
"update",
name, old_value);
3880 new_data->set_property_attributes(attributes);
3885 SetPropertyCallback(
object,
name, new_data, attributes);
3887 if (old_value->SameValue(*value)) {
3888 old_value = it.isolate()->factory()->the_hole_value();
3890 EnqueueChangeRecord(
object,
"reconfigure",
name, old_value);
3895 it.ReconfigureDataProperty(value, attributes);
3896 it.PrepareForDataProperty(value);
3897 it.WriteDataValue(value);
3900 if (old_value->SameValue(*value)) {
3901 old_value = it.isolate()->factory()->the_hole_value();
3903 EnqueueChangeRecord(
object,
"reconfigure",
name, old_value);
3909 case LookupIterator::DATA: {
3910 PropertyDetails details = it.property_details();
3913 if (details.attributes() == attributes) {
3917 if (is_observed) old_value = it.GetDataValue();
3919 it.ReconfigureDataProperty(value, attributes);
3920 it.PrepareForDataProperty(value);
3921 it.WriteDataValue(value);
3924 if (old_value->SameValue(*value)) {
3925 old_value = it.isolate()->factory()->the_hole_value();
3927 EnqueueChangeRecord(
object,
"reconfigure",
name, old_value);
3947 Isolate* isolate = holder->GetIsolate();
3952 AssertNoContextChange ncc(isolate);
3956 isolate, interceptor->data(), *receiver, *holder);
3957 if (!interceptor->query()->IsUndefined()) {
3959 v8::ToCData<v8::NamedPropertyQueryCallback>(interceptor->query());
3961 ApiNamedPropertyAccess(
"interceptor-named-has", *holder, *
name));
3968 }
else if (!interceptor->getter()->IsUndefined()) {
3970 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter());
3972 ApiNamedPropertyAccess(
"interceptor-named-get-has", *holder, *
name));
3987 if (object->IsJSObject() &&
name->AsArrayIndex(&index)) {
3988 return GetOwnElementAttribute(
object, index);
3991 return GetPropertyAttributes(&it);
3997 for (; it->IsFound(); it->Next()) {
3998 switch (it->state()) {
3999 case LookupIterator::NOT_FOUND:
4000 case LookupIterator::TRANSITION:
4002 case LookupIterator::JSPROXY:
4004 it->GetHolder<
JSProxy>(), it->GetReceiver(), it->name());
4005 case LookupIterator::INTERCEPTOR: {
4008 it->GetHolder<
JSObject>(), it->GetReceiver(), it->name());
4013 case LookupIterator::ACCESS_CHECK:
4017 case LookupIterator::DATA:
4018 return maybe(it->property_details().attributes());
4027 bool check_prototype) {
4028 Isolate* isolate =
object->GetIsolate();
4031 if (object->IsAccessCheckNeeded()) {
4039 if (object->IsJSGlobalProxy()) {
4045 index, check_prototype);
4049 if (object->HasIndexedInterceptor() && !isolate->
bootstrapper()->IsActive()) {
4051 object, receiver, index, check_prototype);
4054 return GetElementAttributeWithoutInterceptor(
4055 object, receiver, index, check_prototype);
4061 bool check_prototype) {
4062 Isolate* isolate =
object->GetIsolate();
4067 AssertNoContextChange ncc(isolate);
4071 isolate, interceptor->data(), *receiver, *
object);
4072 if (!interceptor->query()->IsUndefined()) {
4074 v8::ToCData<v8::IndexedPropertyQueryCallback>(interceptor->query());
4076 ApiIndexedPropertyAccess(
"interceptor-indexed-has", *
object, index));
4080 }
else if (!interceptor->getter()->IsUndefined()) {
4082 v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter());
4084 ApiIndexedPropertyAccess(
4085 "interceptor-indexed-get-has", *
object, index));
4090 return GetElementAttributeWithoutInterceptor(
4091 object, receiver, index, check_prototype);
4097 bool check_prototype) {
4099 receiver,
object, index);
4103 if (object->IsStringObjectWithCharacterAt(index)) {
4117 return GetElementAttributeWithReceiver(
4134 if (!value->IsMap() ||
4135 !Map::cast(value)->EquivalentToForNormalization(*fast_map,
mode)) {
4138 return handle(Map::cast(value));
4145 DCHECK(normalized_map->is_dictionary_map());
4151 int entries = length();
4152 for (
int i = 0;
i != entries;
i++) {
4168 int expected_additional_properties) {
4169 if (!object->HasFastProperties())
return;
4174 MigrateFastToSlow(
object, new_map, expected_additional_properties);
4180 int expected_additional_properties) {
4182 DCHECK(!object->IsGlobalObject());
4184 DCHECK(!object->IsJSGlobalProxy());
4186 Isolate* isolate =
object->GetIsolate();
4192 int property_count = real_size;
4193 if (expected_additional_properties > 0) {
4194 property_count += expected_additional_properties;
4196 property_count += 2;
4202 for (
int i = 0;
i < real_size;
i++) {
4203 PropertyDetails details = descs->GetDetails(
i);
4204 switch (details.type()) {
4208 PropertyDetails d = PropertyDetails(
4209 details.attributes(),
NORMAL,
i + 1);
4215 FieldIndex index = FieldIndex::ForDescriptor(*
map,
i);
4217 object->RawFastPropertyAt(index), isolate);
4218 if (details.representation().IsDouble()) {
4219 DCHECK(value->IsMutableHeapNumber());
4221 value = isolate->
factory()->NewHeapNumber(old->value());
4224 PropertyDetails(details.attributes(),
NORMAL,
i + 1);
4231 PropertyDetails d = PropertyDetails(
4243 dictionary->SetNextEnumerationIndex(real_size + 1);
4249 int new_instance_size = new_map->instance_size();
4251 DCHECK(instance_size_delta >= 0);
4253 if (instance_size_delta > 0) {
4256 instance_size_delta);
4263 object->synchronized_set_map(*new_map);
4265 object->set_properties(*dictionary);
4267 isolate->
counters()->props_to_dictionary()->Increment();
4270 if (FLAG_trace_normalization) {
4272 os <<
"Object properties have been normalized:\n";
4280 int unused_property_fields) {
4281 if (object->HasFastProperties())
return;
4282 DCHECK(!object->IsGlobalObject());
4283 Isolate* isolate =
object->GetIsolate();
4284 Factory* factory = isolate->
factory();
4289 int number_of_elements = dictionary->NumberOfElements();
4292 if (number_of_elements != dictionary->NextEnumerationIndex()) {
4296 int instance_descriptor_length = 0;
4297 int number_of_fields = 0;
4300 int capacity = dictionary->Capacity();
4301 for (
int i = 0;
i < capacity;
i++) {
4302 Object* k = dictionary->KeyAt(
i);
4303 if (dictionary->IsKey(k)) {
4304 Object* value = dictionary->ValueAt(
i);
4307 instance_descriptor_length++;
4308 if (type ==
NORMAL && !value->IsJSFunction()) {
4309 number_of_fields += 1;
4314 int inobject_props =
object->map()->inobject_properties();
4318 new_map->set_dictionary_map(
false);
4320 if (instance_descriptor_length == 0) {
4322 DCHECK_LE(unused_property_fields, inobject_props);
4324 new_map->set_unused_property_fields(inobject_props);
4325 object->synchronized_set_map(*new_map);
4326 object->set_properties(isolate->
heap()->empty_fixed_array());
4328 DCHECK(object->HasFastProperties());
4334 isolate, instance_descriptor_length);
4336 int number_of_allocated_fields =
4337 number_of_fields + unused_property_fields - inobject_props;
4338 if (number_of_allocated_fields < 0) {
4340 number_of_allocated_fields = 0;
4341 unused_property_fields = inobject_props - number_of_fields;
4346 number_of_allocated_fields);
4349 int current_offset = 0;
4350 for (
int i = 0;
i < capacity;
i++) {
4351 Object* k = dictionary->KeyAt(
i);
4352 if (dictionary->IsKey(k)) {
4353 Object* value = dictionary->ValueAt(
i);
4355 if (k->IsSymbol()) {
4356 key =
handle(Symbol::cast(k));
4360 key = factory->InternalizeString(
handle(String::cast(k)));
4363 PropertyDetails details = dictionary->DetailsAt(
i);
4364 int enumeration_index = details.dictionary_index();
4367 if (value->IsJSFunction()) {
4368 ConstantDescriptor d(key,
4370 details.attributes());
4371 descriptors->Set(enumeration_index - 1, &d);
4372 }
else if (type ==
NORMAL) {
4373 if (current_offset < inobject_props) {
4374 object->InObjectPropertyAtPut(current_offset,
4378 int offset = current_offset - inobject_props;
4379 fields->set(offset, value);
4381 FieldDescriptor d(key,
4383 details.attributes(),
4386 descriptors->Set(enumeration_index - 1, &d);
4388 CallbacksDescriptor d(key,
4390 details.attributes());
4391 descriptors->Set(enumeration_index - 1, &d);
4397 DCHECK(current_offset == number_of_fields);
4399 descriptors->Sort();
4402 new_map->InitializeDescriptors(*descriptors);
4403 new_map->set_unused_property_fields(unused_property_fields);
4406 object->synchronized_set_map(*new_map);
4408 object->set_properties(*fields);
4409 DCHECK(object->IsJSObject());
4412 DCHECK(object->HasFastProperties());
4417 Isolate* isolate =
object->GetIsolate();
4418 CHECK(object->map() != isolate->
heap()->sloppy_arguments_elements_map());
4419 if (object->map()->has_dictionary_elements()) {
4422 object->set_elements(*new_elements);
4424 object->set_elements(object->map()->GetInitialElements());
4433 Isolate* isolate = array->GetIsolate();
4434 Factory* factory = isolate->
factory();
4435 bool has_double_elements = array->IsFixedDoubleArray();
4436 for (
int i = 0;
i < length;
i++) {
4438 if (has_double_elements) {
4441 if (double_array->is_the_hole(
i)) {
4442 value = factory->the_hole_value();
4444 value = factory->NewHeapNumber(double_array->get_scalar(
i));
4449 if (!value->IsTheHole()) {
4450 PropertyDetails details = PropertyDetails(
NONE,
NORMAL, 0);
4461 DCHECK(!object->HasExternalArrayElements() &&
4462 !object->HasFixedTypedArrayElements());
4463 Isolate* isolate =
object->GetIsolate();
4468 (array->map() == isolate->
heap()->sloppy_arguments_elements_map());
4470 array =
handle(FixedArrayBase::cast(
4475 DCHECK(object->HasFastSmiOrObjectElements() ||
4476 object->HasFastDoubleElements() ||
4477 object->HasFastArgumentsElements());
4479 int length =
object->IsJSArray()
4482 int old_capacity = 0;
4483 int used_elements = 0;
4484 object->GetElementsCapacityAndUsage(&old_capacity, &used_elements);
4492 FixedArray::cast(object->elements())->set(1, *dictionary);
4500 object->set_elements(*dictionary);
4503 isolate->
counters()->elements_to_dictionary()->Increment();
4506 if (FLAG_trace_normalization) {
4508 os <<
"Object elements have been normalized:\n";
4513 DCHECK(object->HasDictionaryElements() ||
4514 object->HasDictionaryArgumentsElements());
4527 }
while (hash_value == 0 && attempts < 30);
4528 hash_value = hash_value != 0 ? hash_value : 1;
4535 DCHECK(!object->IsJSGlobalProxy());
4536 Isolate* isolate =
object->GetIsolate();
4537 SetHiddenProperty(
object, isolate->
factory()->identity_hash_string(), hash);
4541 template<
typename ProxyType>
4543 Isolate* isolate = proxy->GetIsolate();
4549 proxy->set_hash(*hash);
4557 if (IsJSGlobalProxy()) {
4558 return JSGlobalProxy::cast(
this)->hash();
4561 GetHiddenProperty(isolate->
factory()->identity_hash_string());
4562 return stored_value->IsSmi()
4564 : isolate->
heap()->undefined_value();
4569 if (object->IsJSGlobalProxy()) {
4573 Isolate* isolate =
object->GetIsolate();
4579 SetHiddenProperty(
object, isolate->
factory()->identity_hash_string(), hash);
4585 return this->hash();
4596 DCHECK(key->IsUniqueName());
4597 if (IsJSGlobalProxy()) {
4605 return JSObject::cast(iter.
GetCurrent())->GetHiddenProperty(key);
4607 DCHECK(!IsJSGlobalProxy());
4608 Object* inline_value = GetHiddenPropertiesHashTable();
4610 if (inline_value->IsSmi()) {
4612 if (*key ==
GetHeap()->identity_hash_string()) {
4613 return inline_value;
4615 return GetHeap()->the_hole_value();
4619 if (inline_value->IsUndefined())
return GetHeap()->the_hole_value();
4630 Isolate* isolate =
object->GetIsolate();
4632 DCHECK(key->IsUniqueName());
4633 if (object->IsJSGlobalProxy()) {
4635 DCHECK(*key != *isolate->
factory()->identity_hash_string());
4639 if (iter.
IsAtEnd())
return isolate->
factory()->undefined_value();
4641 return SetHiddenProperty(
4645 DCHECK(!object->IsJSGlobalProxy());
4647 Handle<Object> inline_value(object->GetHiddenPropertiesHashTable(), isolate);
4650 if (value->IsSmi() &&
4651 *key == *isolate->
factory()->identity_hash_string() &&
4652 (inline_value->IsUndefined() || inline_value->IsSmi())) {
4657 GetOrCreateHiddenPropertiesHashtable(
object);
4662 if (*new_table != *hashtable) {
4665 SetHiddenPropertiesHashTable(
object, new_table);
4674 Isolate* isolate =
object->GetIsolate();
4675 DCHECK(key->IsUniqueName());
4677 if (object->IsJSGlobalProxy()) {
4681 return DeleteHiddenProperty(
4685 Object* inline_value =
object->GetHiddenPropertiesHashTable();
4688 DCHECK(*key != *isolate->
factory()->identity_hash_string());
4689 if (inline_value->IsUndefined() || inline_value->IsSmi())
return;
4692 bool was_present =
false;
4698 Handle<Name> hidden =
object->GetIsolate()->factory()->hidden_string();
4699 LookupIterator it(
object, hidden, LookupIterator::OWN_SKIP_INTERCEPTOR);
4708 DCHECK(!IsJSGlobalProxy());
4709 if (HasFastProperties()) {
4717 if (descriptors->
GetKey(sorted_index) ==
GetHeap()->hidden_string() &&
4718 sorted_index <
map()->NumberOfOwnDescriptors()) {
4722 FieldIndex index = FieldIndex::ForDescriptor(this->
map(),
4724 return this->RawFastPropertyAt(index);
4726 return GetHeap()->undefined_value();
4729 return GetHeap()->undefined_value();
4734 LookupIterator::OWN_SKIP_INTERCEPTOR);
4736 return *GetDataProperty(&it);
4742 Isolate* isolate =
object->GetIsolate();
4744 static const int kInitialCapacity = 4;
4745 Handle<Object> inline_value(object->GetHiddenPropertiesHashTable(), isolate);
4746 if (inline_value->IsHashTable()) {
4753 if (inline_value->IsSmi()) {
4757 isolate->
factory()->identity_hash_string(),
4761 SetHiddenPropertiesHashTable(
object, hashtable);
4768 DCHECK(!object->IsJSGlobalProxy());
4769 Isolate* isolate =
object->GetIsolate();
4771 SetOwnPropertyIgnoreAttributes(
object,
name, value,
DONT_ENUM).Assert();
4778 Isolate* isolate = holder->GetIsolate();
4787 v8::ToCData<v8::NamedPropertyDeleterCallback>(interceptor->deleter());
4789 ApiNamedPropertyAccess(
"interceptor-named-delete", *holder, *
name));
4799 result_internal->VerifyApiCallResultType();
4801 return handle(*result_internal, isolate);
4808 Isolate* isolate =
object->GetIsolate();
4809 Factory* factory = isolate->
factory();
4813 AssertNoContextChange ncc(isolate);
4816 if (interceptor->deleter()->IsUndefined())
return factory->false_value();
4818 v8::ToCData<v8::IndexedPropertyDeleterCallback>(interceptor->deleter());
4820 ApiIndexedPropertyAccess(
"interceptor-indexed-delete", *
object, index));
4822 isolate, interceptor->data(), *
object, *
object);
4828 result_internal->VerifyApiCallResultType();
4830 return handle(*result_internal, isolate);
4833 object, index, NORMAL_DELETION);
4834 return delete_result;
4841 Isolate* isolate =
object->GetIsolate();
4842 Factory* factory = isolate->
factory();
4845 if (object->IsAccessCheckNeeded() &&
4849 return factory->false_value();
4852 if (object->IsStringObjectWithCharacterAt(index)) {
4853 if (
mode == STRICT_DELETION) {
4861 return factory->false_value();
4864 if (object->IsJSGlobalProxy()) {
4866 if (iter.
IsAtEnd())
return factory->false_value();
4868 return DeleteElement(
4874 bool should_enqueue_change_record =
false;
4875 if (object->map()->is_observed()) {
4878 should_enqueue_change_record =
maybe.value;
4879 if (should_enqueue_change_record) {
4880 if (!GetOwnElementAccessorPair(
object, index).is_null()) {
4884 isolate,
object, index).ToHandleChecked();
4891 if (object->HasIndexedInterceptor() &&
mode != FORCE_DELETION) {
4892 maybe_result = DeleteElementWithInterceptor(
object, index);
4894 maybe_result =
object->GetElementsAccessor()->Delete(
object, index,
mode);
4899 if (should_enqueue_change_record) {
4904 EnqueueChangeRecord(
object,
"delete",
name, old_value);
4919 if (
name->AsArrayIndex(&index)) {
4920 return DeleteElement(
object, index, delete_mode);
4924 LookupIterator::Configuration config =
4925 delete_mode == FORCE_DELETION ? LookupIterator::HIDDEN_SKIP_INTERCEPTOR
4926 : LookupIterator::HIDDEN;
4930 bool is_observed =
object->map()->is_observed() &&
4931 *
name != it.isolate()->heap()->hidden_string();
4932 Handle<Object> old_value = it.isolate()->factory()->the_hole_value();
4934 for (; it.IsFound(); it.Next()) {
4935 switch (it.state()) {
4936 case LookupIterator::JSPROXY:
4937 case LookupIterator::NOT_FOUND:
4938 case LookupIterator::TRANSITION:
4940 case LookupIterator::ACCESS_CHECK:
4942 it.isolate()->ReportFailedAccessCheck(it.GetHolder<
JSObject>(),
4945 return it.isolate()->factory()->false_value();
4946 case LookupIterator::INTERCEPTOR: {
4951 if (!maybe_result.
is_null())
return maybe_result;
4953 if (it.isolate()->has_pending_exception())
return maybe_result;
4956 case LookupIterator::DATA:
4958 old_value = it.GetDataValue();
4962 if (delete_mode != FORCE_DELETION && !it.IsConfigurable()) {
4964 if (delete_mode == STRICT_DELETION) {
4967 NewTypeError(
"strict_delete_property",
4971 return it.isolate()->factory()->false_value();
4980 if (!holder.is_identical_to(
object) &&
4981 !(
object->IsJSGlobalProxy() && holder->IsJSGlobalObject())) {
4982 return it.isolate()->factory()->true_value();
4984 NormalizeProperties(holder,
mode, 0);
4986 DeleteNormalizedProperty(holder,
name, delete_mode);
4987 ReoptimizeIfPrototype(holder);
4990 EnqueueChangeRecord(
object,
"delete",
name, old_value);
4998 return it.isolate()->factory()->true_value();
5005 if (object->IsJSProxy()) {
5016 if (object->IsJSProxy()) {
5030 int length = IsJSArray()
5031 ? Smi::cast(JSArray::cast(
this)->length())->value()
5033 for (
int i = 0;
i < length; ++
i) {
5035 if (!element->IsTheHole() && element ==
object)
return true;
5039 SeededNumberDictionary::cast(elements)->SlowReverseLookup(
object);
5040 if (!key->IsUndefined())
return true;
5048 Map* map_of_this =
map();
5053 if (map_of_this->constructor() == obj) {
5058 if (map_of_this->prototype() == obj) {
5063 Object* key = SlowReverseLookup(obj);
5064 if (!key->IsUndefined()) {
5073 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
5074 case EXTERNAL_##TYPE##_ELEMENTS: \
5075 case TYPE##_ELEMENTS: \
5079 #undef TYPED_ARRAY_CASE
5090 FixedArray* elements = FixedArray::cast(this->elements());
5091 if (ReferencesObjectFromElements(elements, kind, obj))
return true;
5095 FixedArray* parameter_map = FixedArray::cast(elements());
5097 int length = parameter_map->
length();
5098 for (
int i = 2;
i < length; ++
i) {
5100 if (!value->IsTheHole() && value == obj)
return true;
5103 FixedArray* arguments = FixedArray::cast(parameter_map->
get(1));
5106 if (ReferencesObjectFromElements(arguments, kind, obj))
return true;
5112 if (IsJSFunction()) {
5114 Map* arguments_map =
5117 JSFunction::cast(arguments_map->constructor());
5129 if (context->
get(
i)->IsJSObject()) {
5132 if (ctxobj->
map()->constructor() == arguments_function) {
5136 }
else if (ctxobj == obj) {
5150 return JSObject::cast(context->
extension())->ReferencesObject(obj);
5160 Isolate* isolate =
object->GetIsolate();
5162 if (!object->map()->is_extensible())
return object;
5164 if (object->IsAccessCheckNeeded() &&
5169 return isolate->
factory()->false_value();
5172 if (object->IsJSGlobalProxy()) {
5174 if (iter.
IsAtEnd())
return object;
5176 return PreventExtensions(
5181 if (object->HasExternalArrayElements() ||
5182 object->HasFixedTypedArrayElements()) {
5184 NewTypeError(
"cant_prevent_ext_external_array_elements",
5191 DCHECK(object->HasDictionaryElements() ||
5192 object->HasDictionaryArgumentsElements());
5195 dictionary->set_requires_slow_elements();
5202 new_map->set_is_extensible(
false);
5204 DCHECK(!object->map()->is_extensible());
5206 if (object->map()->is_observed()) {
5207 EnqueueChangeRecord(
object,
"preventExtensions",
Handle<Name>(),
5208 isolate->
factory()->the_hole_value());
5214 template<
typename Dictionary>
5216 int capacity = dictionary->
Capacity();
5217 for (
int i = 0;
i < capacity;
i++) {
5219 if (dictionary->
IsKey(k) &&
5220 !(k->IsSymbol() && Symbol::cast(k)->is_private())) {
5221 PropertyDetails details = dictionary->
DetailsAt(
i);
5226 if (v->IsPropertyCell()) v = PropertyCell::cast(v)->value();
5227 if (!v->IsAccessorPair()) attrs |=
READ_ONLY;
5231 details = details.CopyAddAttributes(
5241 DCHECK(!object->HasSloppyArgumentsElements());
5242 DCHECK(!object->map()->is_observed());
5244 if (object->map()->is_frozen())
return object;
5246 Isolate* isolate =
object->GetIsolate();
5247 if (object->IsAccessCheckNeeded() &&
5252 return isolate->
factory()->false_value();
5255 if (object->IsJSGlobalProxy()) {
5257 if (iter.
IsAtEnd())
return object;
5263 if (object->HasExternalArrayElements() ||
5264 object->HasFixedTypedArrayElements()) {
5266 NewTypeError(
"cant_prevent_ext_external_array_elements",
5272 if (!object->elements()->IsDictionary()) {
5273 int length =
object->IsJSArray()
5275 :
object->elements()->length();
5279 object->GetElementsCapacityAndUsage(&capacity, &used);
5285 handle(object->elements()), length, new_element_dictionary);
5288 new_element_dictionary =
5289 isolate->
factory()->empty_slow_element_dictionary();
5294 int transition_index = old_map->SearchTransition(
5295 isolate->
heap()->frozen_symbol());
5297 Handle<Map> transition_map(old_map->GetTransition(transition_index));
5298 DCHECK(transition_map->has_dictionary_elements());
5299 DCHECK(transition_map->is_frozen());
5300 DCHECK(!transition_map->is_extensible());
5302 }
else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) {
5307 DCHECK(old_map->is_dictionary_map() || !old_map->is_prototype_map());
5315 new_map->set_is_extensible(
false);
5323 DCHECK(object->map()->has_dictionary_elements());
5324 if (!new_element_dictionary.
is_null()) {
5325 object->set_elements(*new_element_dictionary);
5328 if (object->elements() != isolate->
heap()->empty_slow_element_dictionary()) {
5341 DCHECK(!object->IsJSGlobalProxy());
5342 DCHECK(!object->IsJSGlobalObject());
5343 Isolate* isolate =
object->GetIsolate();
5346 DCHECK(!old_map->is_observed());
5347 int transition_index = old_map->SearchTransition(
5348 isolate->
heap()->observed_symbol());
5350 new_map =
handle(old_map->GetTransition(transition_index), isolate);
5351 DCHECK(new_map->is_observed());
5352 }
else if (object->HasFastProperties() && old_map->CanHaveMoreTransitions()) {
5356 new_map->set_is_observed();
5365 Isolate* isolate =
object->GetIsolate();
5366 Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate);
5371 template<
class ContextObject>
5376 : site_context_(site_context),
5388 site_context()->ExitScope(current_site, value);
5389 return copy_of_value;
5404 template <
class ContextObject>
5407 Isolate* isolate = this->isolate();
5408 bool copying = this->copying();
5412 StackLimitCheck check(isolate);
5414 if (check.HasOverflowed()) {
5420 if (object->map()->is_deprecated()) {
5427 if (site_context()->ShouldCreateMemento(
object)) {
5428 site_to_pass = site_context()->current();
5430 copy = isolate->
factory()->CopyJSObjectWithAllocationSite(
5431 object, site_to_pass);
5436 DCHECK(copying || copy.is_identical_to(
object));
5440 FixedArray::cast(copy->elements())->map() ==
5441 isolate->
heap()->fixed_cow_array_map()) {
5442 isolate->
counters()->cow_arrays_created_runtime()->Increment();
5449 if (copy->HasFastProperties()) {
5451 int limit = copy->map()->NumberOfOwnDescriptors();
5452 for (
int i = 0;
i < limit;
i++) {
5453 PropertyDetails details = descriptors->GetDetails(
i);
5454 if (details.type() !=
FIELD)
continue;
5455 FieldIndex index = FieldIndex::ForDescriptor(copy->map(),
i);
5457 if (value->IsJSObject()) {
5467 copy->FastPropertyAtPut(index, *value);
5472 isolate->
factory()->NewFixedArray(copy->NumberOfOwnProperties());
5473 copy->GetOwnPropertyNames(*names, 0);
5474 for (
int i = 0;
i < names->length();
i++) {
5475 DCHECK(names->get(
i)->IsString());
5484 if (attributes !=
NONE)
continue;
5487 if (value->IsJSObject()) {
5503 DCHECK(!copy->HasExternalArrayElements());
5510 if (elements->map() == isolate->
heap()->fixed_cow_array_map()) {
5512 for (
int i = 0;
i < elements->length();
i++) {
5513 DCHECK(!elements->get(
i)->IsJSObject());
5517 for (
int i = 0;
i < elements->length();
i++) {
5520 value->IsTheHole() ||
5522 if (value->IsJSObject()) {
5529 elements->set(
i, *result);
5538 copy->element_dictionary());
5539 int capacity = element_dictionary->Capacity();
5540 for (
int i = 0;
i < capacity;
i++) {
5541 Object* k = element_dictionary->KeyAt(
i);
5542 if (element_dictionary->IsKey(k)) {
5544 if (value->IsJSObject()) {
5551 element_dictionary->ValueAtPut(
i, *result);
5563 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
5564 case EXTERNAL_##TYPE##_ELEMENTS: \
5565 case TYPE##_ELEMENTS: \
5568 #undef TYPED_ARRAY_CASE
5588 DCHECK(!result.ToHandle(&for_assert) || for_assert.is_identical_to(
object));
5600 DCHECK(!copy.ToHandle(&for_assert) || !for_assert.is_identical_to(
object));
5613 !iter.
IsAtEnd(); iter.Advance()) {
5614 if (!iter.GetCurrent()->IsJSObject())
return false;
5615 JSObject* curr = JSObject::cast(iter.GetCurrent());
5618 if (curr->IsAccessCheckNeeded())
return false;
5622 if (curr !=
this && enum_length != 0)
return false;
5629 if ((filter &
SYMBOLIC) && key->IsSymbol()) {
5634 key->IsSymbol() && Symbol::cast(key)->is_private()) {
5638 if ((filter &
STRING) && !key->IsSymbol()) {
5652 : NumberOfOwnDescriptors();
5653 for (
int i = 0;
i < limit;
i++) {
5654 if ((descs->
GetDetails(
i).attributes() & filter) == 0 &&
5665 int number_of_own_descriptors = NumberOfOwnDescriptors();
5667 for (
int i = 0;
i < number_of_own_descriptors;
i++) {
5670 if (current_index > max_index) max_index = current_index;
5673 return max_index + 1;
5678 int len = array->length();
5679 for (
int i = 0;
i < len;
i++) {
5681 if (!(e->IsString() || e->IsNumber()))
return false;
5689 DCHECK(array->length() >= length);
5690 if (array->length() == length)
return array;
5693 array->GetIsolate()->factory()->NewFixedArray(length);
5694 for (
int i = 0;
i < length; ++
i) new_array->set(
i, array->get(
i));
5700 bool cache_result) {
5701 Isolate* isolate =
object->GetIsolate();
5702 if (object->HasFastProperties()) {
5703 int own_property_count =
object->map()->EnumLength();
5710 own_property_count =
object->map()->NumberOfDescribedProperties(
5713 DCHECK(own_property_count == object->map()->NumberOfDescribedProperties(
5717 if (object->map()->instance_descriptors()->HasEnumCache()) {
5725 if (own_property_count <= keys->length()) {
5726 if (cache_result)
object->map()->SetEnumLength(own_property_count);
5727 isolate->
counters()->enum_cache_hits()->Increment();
5734 if (
map->instance_descriptors()->IsEmpty()) {
5735 isolate->
counters()->enum_cache_hits()->Increment();
5737 return isolate->
factory()->empty_fixed_array();
5740 isolate->
counters()->enum_cache_misses()->Increment();
5743 own_property_count);
5745 own_property_count);
5753 for (
int i = 0;
i <
size;
i++) {
5754 PropertyDetails details = descs->GetDetails(
i);
5755 Object* key = descs->GetKey(
i);
5756 if (!(details.IsDontEnum() || key->IsSymbol())) {
5757 storage->set(index, key);
5759 if (details.type() !=
FIELD) {
5762 FieldIndex field_index = FieldIndex::ForDescriptor(*
map,
i);
5763 int load_by_field_index = field_index.GetLoadByFieldIndex();
5764 indices->set(index,
Smi::FromInt(load_by_field_index));
5770 DCHECK(index == storage->length());
5773 isolate->
factory()->NewFixedArray(
5779 : Object::cast(*indices));
5781 object->map()->SetEnumLength(own_property_count);
5786 int length = dictionary->NumberOfEnumElements();
5791 dictionary->CopyEnumKeysTo(*storage);
5800 Isolate* isolate =
object->GetIsolate();
5803 JSFunction::cast(isolate->sloppy_arguments_map()->constructor()));
5808 !iter.
IsAtEnd(); iter.Advance()) {
5816 Execution::Call(isolate,
5817 isolate->proxy_enumerate(),
5834 if (current->IsAccessCheckNeeded() &&
5844 isolate->
factory()->NewFixedArray(current->NumberOfEnumElements());
5845 current->GetEnumElementKeys(*element_keys);
5853 if (current->HasIndexedInterceptor()) {
5856 current,
object).ToHandle(&result)) {
5875 bool cache_enum_keys =
5876 ((current->map()->constructor() != *arguments_function) &&
5877 !current->IsJSValue() &&
5878 !current->IsAccessCheckNeeded() &&
5879 !current->HasNamedInterceptor() &&
5880 !current->HasIndexedInterceptor());
5890 if (current->HasNamedInterceptor()) {
5893 current,
object).ToHandle(&result)) {
5904 if (type == OWN_ONLY)
break;
5918 int entry = dictionary->
FindEntry(index);
5921 PropertyDetails details = dictionary->
DetailsAt(entry);
5922 if (details.type() ==
CALLBACKS && result->IsAccessorPair()) {
5923 DCHECK(details.IsConfigurable());
5924 if (details.attributes() != attributes) {
5927 PropertyDetails(attributes,
CALLBACKS, index));
5929 AccessorPair::cast(result)->SetComponents(getter, setter);
5942 switch (object->GetElementsKind()) {
5951 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
5952 case EXTERNAL_##TYPE##_ELEMENTS: \
5953 case TYPE##_ELEMENTS: \
5956 #undef TYPED_ARRAY_CASE
5973 FixedArray* parameter_map = FixedArray::cast(object->elements());
5976 index < (length - 2) ? parameter_map->
get(index + 2) :
NULL;
5977 if (probe ==
NULL || probe->IsTheHole()) {
5978 FixedArray* arguments = FixedArray::cast(parameter_map->
get(1));
5979 if (arguments->IsDictionary()) {
5981 SeededNumberDictionary::cast(arguments);
5995 Isolate* isolate =
object->GetIsolate();
5997 accessors->SetComponents(*getter, *setter);
5999 SetElementCallback(
object, index, accessors, attributes);
6009 if (iter.GetCurrent()->IsJSProxy()) {
6015 JSObject::cast(iter.GetCurrent())->map()->elements_kind())) {
6028 Heap* heap =
object->GetHeap();
6029 PropertyDetails details = PropertyDetails(attributes,
CALLBACKS, 0);
6032 bool had_dictionary_elements =
object->HasDictionaryElements();
6034 DCHECK(object->HasDictionaryElements() ||
6035 object->HasDictionaryArgumentsElements());
6039 dictionary->set_requires_slow_elements();
6042 if (object->elements()->map() == heap->sloppy_arguments_elements_map()) {
6048 FixedArray* parameter_map = FixedArray::cast(object->elements());
6049 if (index <
static_cast<uint32_t>(parameter_map->
length()) - 2) {
6050 parameter_map->
set(index + 2, heap->the_hole_value());
6052 parameter_map->
set(1, *dictionary);
6054 object->set_elements(*dictionary);
6056 if (!had_dictionary_elements) {
6072 NormalizeProperties(
object,
mode, 0);
6076 if (object->IsGlobalObject()) {
6078 DCHECK(new_map->is_dictionary_map());
6088 PropertyDetails details = PropertyDetails(attributes,
CALLBACKS, 0);
6089 SetNormalizedProperty(
object,
name, structure, details);
6091 ReoptimizeIfPrototype(
object);
6100 Isolate* isolate =
object->GetIsolate();
6102 if (object->IsAccessCheckNeeded() &&
6106 return isolate->
factory()->undefined_value();
6109 if (object->IsJSGlobalProxy()) {
6111 if (iter.
IsAtEnd())
return isolate->
factory()->undefined_value();
6114 name, getter, setter, attributes);
6115 return isolate->
factory()->undefined_value();
6120 AssertNoContextChange ncc(isolate);
6126 bool is_element =
name->AsArrayIndex(&index);
6129 bool is_observed =
object->map()->is_observed() &&
6131 bool preexists =
false;
6137 if (!
maybe.has_value) {
6139 return isolate->
factory()->undefined_value();
6141 preexists =
maybe.value;
6142 if (preexists && GetOwnElementAccessorPair(
object, index).is_null()) {
6148 CHECK(GetPropertyAttributes(&it).has_value);
6149 preexists = it.IsFound();
6150 if (preexists && (it.state() == LookupIterator::DATA ||
6151 it.GetAccessors()->IsAccessorInfo())) {
6158 DefineElementAccessor(
object, index, getter, setter, attributes);
6160 DCHECK(getter->IsSpecFunction() || getter->IsUndefined() ||
6162 DCHECK(setter->IsSpecFunction() || setter->IsUndefined() ||
6165 DCHECK(!getter->IsNull() || !setter->IsNull());
6167 if (it.state() == LookupIterator::ACCESS_CHECK) {
6171 if (!getter->IsNull()) {
6174 if (!setter->IsNull()) {
6180 const char* type = preexists ?
"reconfigure" :
"add";
6181 EnqueueChangeRecord(
object, type,
name, old_value);
6184 return isolate->
factory()->undefined_value();
6190 Isolate* isolate =
object->GetIsolate();
6191 Factory* factory = isolate->
factory();
6195 if (object->IsAccessCheckNeeded() &&
6199 return factory->undefined_value();
6202 if (object->IsJSGlobalProxy()) {
6204 if (iter.
IsAtEnd())
return object;
6212 AssertNoContextChange ncc(isolate);
6218 bool is_element =
name->AsArrayIndex(&index);
6221 if (object->IsJSArray())
return factory->undefined_value();
6224 switch (object->GetElementsKind()) {
6233 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
6234 case EXTERNAL_##TYPE##_ELEMENTS: \
6235 case TYPE##_ELEMENTS: \
6238 #undef TYPED_ARRAY_CASE
6241 return factory->undefined_value();
6250 SetElementCallback(
object, index, info, info->property_attributes());
6254 CHECK(GetPropertyAttributes(&it).has_value);
6257 if (it.IsFound() && (it.IsReadOnly() || !it.IsConfigurable())) {
6258 return factory->undefined_value();
6261 SetPropertyCallback(
object,
name, info, info->property_attributes());
6271 Isolate* isolate =
object->GetIsolate();
6275 AssertNoContextChange ncc(isolate);
6279 if (
name->AsArrayIndex(&index)) {
6282 !iter.
IsAtEnd(); iter.Advance()) {
6285 if (current->IsAccessCheckNeeded() &&
6291 return isolate->
factory()->undefined_value();
6294 if (current->IsJSObject() &&
6296 JSObject* js_object = JSObject::cast(*current);
6298 int entry = dictionary->
FindEntry(index);
6302 element->IsAccessorPair()) {
6303 return handle(AccessorPair::cast(element)->GetComponent(component),
6311 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
6312 for (; it.IsFound(); it.Next()) {
6313 switch (it.state()) {
6314 case LookupIterator::INTERCEPTOR:
6315 case LookupIterator::NOT_FOUND:
6316 case LookupIterator::TRANSITION:
6319 case LookupIterator::ACCESS_CHECK:
6324 return isolate->
factory()->undefined_value();
6326 case LookupIterator::JSPROXY:
6327 return isolate->
factory()->undefined_value();
6329 case LookupIterator::DATA:
6333 if (maybe_pair->IsAccessorPair()) {
6335 AccessorPair::cast(*maybe_pair)->GetComponent(component),
6342 return isolate->
factory()->undefined_value();
6347 if (HasFastProperties()) {
6350 for (
int i = 0;
i < number_of_own_descriptors;
i++) {
6353 RawFastPropertyAt(FieldIndex::ForDescriptor(
map(),
i));
6354 if (descs->
GetDetails(
i).representation().IsDouble()) {
6355 DCHECK(property->IsMutableHeapNumber());
6356 if (value->IsNumber() && property->
Number() == value->
Number()) {
6359 }
else if (property == value) {
6368 return GetHeap()->undefined_value();
6370 return property_dictionary()->SlowReverseLookup(value);
6378 result->set_prototype(
map->prototype());
6379 result->set_constructor(
map->constructor());
6383 new_bit_field3 = OwnsDescriptors::update(new_bit_field3,
true);
6384 new_bit_field3 = NumberOfOwnDescriptorsBits::update(new_bit_field3, 0);
6385 new_bit_field3 = EnumLengthBits::update(new_bit_field3,
6387 new_bit_field3 = Deprecated::update(new_bit_field3,
false);
6389 new_bit_field3 = IsUnstable::update(new_bit_field3,
false);
6391 new_bit_field3 = ConstructionCount::update(new_bit_field3,
6393 result->set_bit_field3(new_bit_field3);
6400 DCHECK(!fast_map->is_dictionary_map());
6402 Isolate* isolate = fast_map->GetIsolate();
6405 bool use_cache = !maybe_cache->IsUndefined();
6410 if (use_cache && cache->Get(fast_map,
mode).ToHandle(&new_map)) {
6412 if (FLAG_verify_heap) new_map->DictionaryMapVerify();
6414 #ifdef ENABLE_SLOW_DCHECKS
6421 DCHECK(memcmp(fresh->address(),
6427 DCHECK(memcmp(fresh->address() + offset,
6428 new_map->address() + offset,
6435 cache->Set(fast_map, new_map);
6436 isolate->
counters()->normalized_maps()->Increment();
6439 fast_map->NotifyLeafMapLayoutChange();
6457 result->set_dictionary_map(
true);
6458 result->set_migration_target(
false);
6461 if (FLAG_verify_heap) result->DictionaryMapVerify();
6475 result->set_pre_allocated_property_fields(
6490 map->instance_descriptors()->number_of_descriptors());
6496 if (descriptors->NumberOfSlackDescriptors() == 0) {
6497 int old_size = descriptors->number_of_descriptors();
6498 if (old_size == 0) {
6501 EnsureDescriptorSlack(
map, old_size < 4 ? 1 : old_size / 2);
6502 descriptors =
handle(
map->instance_descriptors());
6508 descriptors->Append(descriptor);
6509 result->InitializeDescriptors(*descriptors);
6521 parent->set_owns_descriptors(
false);
6522 if (parent->is_prototype_map()) {
6523 DCHECK(child->is_prototype_map());
6527 parent->set_transitions(*transitions);
6528 child->SetBackPointer(*parent);
6538 DCHECK(descriptors->IsSortedNoDuplicates());
6541 result->InitializeDescriptors(*descriptors);
6547 ConnectTransition(
map, result,
name, simple_flag);
6549 int length = descriptors->number_of_descriptors();
6550 for (
int i = 0;
i < length;
i++) {
6552 if (descriptors->GetDetails(
i).type() ==
FIELD) {
6553 descriptors->SetValue(
i, HeapType::Any());
6568 DCHECK(descriptors->IsSortedNoDuplicates());
6572 result->InitializeDescriptors(*descriptors);
6573 result->SetNumberOfOwnDescriptors(new_descriptor + 1);
6576 if (descriptors->GetDetails(new_descriptor).type() ==
FIELD) {
6578 if (unused_property_fields < 0) {
6583 result->set_unused_property_fields(unused_property_fields);
6607 bool insert_transition =
6615 ConnectElementsTransition(
map, new_map);
6617 new_map->set_elements_kind(kind);
6618 new_map->InitializeDescriptors(
map->instance_descriptors());
6627 new_map->set_elements_kind(kind);
6629 if (insert_transition) {
6630 ConnectElementsTransition(
map, new_map);
6646 new_map = CopyDropDescriptors(
map);
6649 new_map = Copy(
map);
6652 new_map->set_is_observed();
6654 new_map->InitializeDescriptors(
map->instance_descriptors());
6669 return CopyReplaceDescriptors(
6680 int max_extra_properties =
6683 if (inobject_properties > max_extra_properties) {
6684 inobject_properties = max_extra_properties;
6687 int new_instance_size =
6691 copy->set_inobject_properties(inobject_properties);
6692 copy->set_unused_property_fields(inobject_properties);
6693 copy->set_instance_size(new_instance_size);
6703 handle(
map->instance_descriptors(), isolate), num_descriptors,
FROZEN);
6707 new_map->set_is_extensible(
false);
6714 PropertyDetails details = GetDetails(descriptor);
6715 switch (details.type()) {
6718 GetFieldType(descriptor)->NowContains(value);
6721 DCHECK(GetConstant(descriptor) != value ||
6723 return GetConstant(descriptor) == value;
6748 if (descriptors->CanHoldValue(descriptor, *value))
return map;
6754 return GeneralizeRepresentation(
map, descriptor, representation, type,
6772 int descriptor = transition->LastAdded();
6776 if (descriptors->
GetDetails(descriptor).attributes() != attributes) {
6785 if (value->IsJSFunction()) {
6796 if (!maybe_map.ToHandle(&result)) {
6811 return CopyGeneralizeAllRepresentations(
map, descriptor,
FORCE_FIELD,
6812 attributes,
"attributes mismatch");
6843 int descriptor = transition->LastAdded();
6844 if (descriptors->
GetKey(descriptor) != *
name) {
6846 descriptor = descriptors->SearchWithCache(*
name, *transition);
6854 if (descriptors->
GetDetails(descriptor).attributes() != attributes) {
6859 if (!maybe_pair->IsAccessorPair()) {
6864 if (pair->get(component) != *accessor) {
6873 int descriptor = old_descriptors->SearchWithCache(*
name, *
map);
6875 PropertyDetails old_details = old_descriptors->
GetDetails(descriptor);
6880 if (old_details.attributes() != attributes) {
6885 if (!maybe_pair->IsAccessorPair()) {
6890 if (current == *accessor)
return map;
6892 if (!current->IsTheHole()) {
6901 pair = isolate->
factory()->NewAccessorPair();
6904 pair->set(component, *accessor);
6906 CallbacksDescriptor new_desc(
name, pair, attributes);
6917 descriptor->KeyToUniqueName();
6922 return ShareDescriptor(
map, descriptors, descriptor);
6927 new_descriptors->Append(descriptor);
6929 return CopyReplaceDescriptors(
6940 descriptor->KeyToUniqueName();
6943 int index = old_descriptors->SearchWithCache(*descriptor->GetKey(), *
map);
6945 return CopyReplaceDescriptor(
map, old_descriptors, descriptor, index,
flag);
6947 return CopyAddDescriptor(
map, descriptor,
flag);
6953 int enumeration_index,
6956 desc, enumeration_index,
NONE, slack);
6962 int enumeration_index,
6965 if (enumeration_index + slack == 0) {
6966 return desc->GetIsolate()->factory()->empty_descriptor_array();
6969 int size = enumeration_index;
6975 if (attributes !=
NONE) {
6976 for (
int i = 0;
i <
size; ++
i) {
6977 Object* value = desc->GetValue(
i);
6978 Name* key = desc->GetKey(
i);
6979 PropertyDetails details = desc->GetDetails(
i);
6981 if (!key->IsSymbol() || !Symbol::cast(key)->is_private()) {
6984 if (details.type() !=
CALLBACKS || !value->IsAccessorPair()) {
6987 details = details.CopyAddAttributes(
6991 handle(key),
handle(value, desc->GetIsolate()), details);
6992 descriptors->Set(
i, &inner_desc, witness);
6995 for (
int i = 0;
i <
size; ++
i) {
6996 descriptors->CopyFrom(
i, *desc, witness);
7000 if (desc->number_of_descriptors() != enumeration_index) descriptors->Sort();
7009 int insertion_index,
7012 descriptor->KeyToUniqueName();
7015 DCHECK(*key == descriptors->GetKey(insertion_index));
7020 new_descriptors->Replace(insertion_index, descriptor);
7023 (insertion_index == descriptors->number_of_descriptors() - 1)
7026 return CopyReplaceDescriptors(
map, new_descriptors,
flag, key, simple_flag);
7036 if (
map->code_cache()->IsFixedArray()) {
7038 map->set_code_cache(*result);
7049 if (!code_cache()->IsFixedArray()) {
7050 return CodeCache::cast(code_cache())->Lookup(
name,
flags);
7052 return GetHeap()->undefined_value();
7059 if (!code_cache()->IsFixedArray()) {
7060 return CodeCache::cast(code_cache())->GetIndex(
name, code);
7069 DCHECK(!code_cache()->IsFixedArray());
7070 CodeCache::cast(code_cache())->RemoveByIndex(
name, code, index);
7083 transition_array_(transition_array),
7084 constructor_(constructor) { }
7087 DCHECK(!(*IteratorField())->IsSmi() || IsIterating());
7088 if (!(*IteratorField())->IsSmi()) {
7089 DCHECK(*IteratorField() == constructor_);
7095 return (*IteratorField())->IsSmi() &&
7096 Smi::cast(*IteratorField())->value() < 0;
7101 int value = Smi::cast(*IteratorField())->value();
7102 int index = -value - 1;
7103 int number_of_transitions = transition_array_->number_of_transitions();
7104 while (index < number_of_transitions) {
7106 return transition_array_->GetTarget(index);
7109 *IteratorField() = constructor_;
7132 : map_(
map), proto_trans_(proto_trans), constructor_(constructor) { }
7135 if (!(*IteratorField())->IsSmi()) {
7136 DCHECK(*IteratorField() == constructor_);
7142 return (*IteratorField())->IsSmi() &&
7143 Smi::cast(*IteratorField())->value() >= 0;
7148 int transitionNumber = Smi::cast(*IteratorField())->value();
7149 if (transitionNumber < NumberOfTransitions()) {
7151 return GetTransition(transitionNumber);
7153 *IteratorField() = constructor_;
7165 return Smi::cast(num)->value();
7170 return Map::cast(proto_trans->
get(IndexFor(transitionNumber)));
7225 if (!HasTransitionArray())
return NULL;
7236 Map* next = proto_iterator.
Next();
7246 Map* next = transition_iterator.
Next();
7264 Object* root_constructor = constructor();
7267 if (child !=
NULL) {
7272 callback(current, data);
7273 if (current ==
this)
break;
7287 if (code_cache->normal_type_cache()->IsUndefined()) {
7291 code_cache->set_normal_type_cache(*result);
7293 UpdateNormalTypeCache(code_cache,
name, code);
7295 DCHECK(code_cache->default_cache()->IsFixedArray());
7296 UpdateDefaultCache(code_cache,
name, code);
7311 int length = cache->length();
7314 int deleted_index = -1;
7315 for (
int i = 0;
i < length;
i += kCodeCacheEntrySize) {
7317 if (key->IsNull()) {
7318 if (deleted_index < 0) deleted_index =
i;
7321 if (key->IsUndefined()) {
7322 if (deleted_index >= 0)
i = deleted_index;
7323 cache->set(
i + kCodeCacheEntryNameOffset, *
name);
7324 cache->set(
i + kCodeCacheEntryCodeOffset, *code);
7327 if (
name->Equals(Name::cast(key))) {
7329 Code::cast(cache->get(
i + kCodeCacheEntryCodeOffset))->flags();
7331 cache->set(
i + kCodeCacheEntryCodeOffset, *code);
7339 if (deleted_index >= 0) {
7340 cache->set(deleted_index + kCodeCacheEntryNameOffset, *
name);
7341 cache->set(deleted_index + kCodeCacheEntryCodeOffset, *code);
7348 int new_length = length + ((length >> 1)) + kCodeCacheEntrySize;
7349 new_length = new_length - new_length % kCodeCacheEntrySize;
7350 DCHECK((new_length % kCodeCacheEntrySize) == 0);
7354 cache->set(length + kCodeCacheEntryNameOffset, *
name);
7355 cache->set(length + kCodeCacheEntryCodeOffset, *code);
7356 code_cache->set_default_cache(*cache);
7364 CodeCacheHashTable::cast(code_cache->normal_type_cache()));
7366 code_cache->set_normal_type_cache(*new_cache);
7372 if (result->IsCode()) {
7373 if (Code::cast(result)->
flags() ==
flags)
return result;
7374 return GetHeap()->undefined_value();
7376 return LookupNormalTypeCache(
name,
flags);
7382 int length = cache->
length();
7383 for (
int i = 0;
i < length;
i += kCodeCacheEntrySize) {
7384 Object* key = cache->
get(
i + kCodeCacheEntryNameOffset);
7386 if (key->IsNull())
continue;
7387 if (key->IsUndefined())
return key;
7388 if (
name->Equals(Name::cast(key))) {
7389 Code* code = Code::cast(cache->
get(
i + kCodeCacheEntryCodeOffset));
7395 return GetHeap()->undefined_value();
7400 if (!normal_type_cache()->IsUndefined()) {
7404 return GetHeap()->undefined_value();
7411 if (normal_type_cache()->IsUndefined())
return -1;
7417 int len = array->
length();
7418 for (
int i = 0;
i < len;
i += kCodeCacheEntrySize) {
7419 if (array->
get(
i + kCodeCacheEntryCodeOffset) == code)
return i + 1;
7427 DCHECK(!normal_type_cache()->IsUndefined());
7437 DCHECK_EQ(1, kCodeCacheEntryCodeOffset - kCodeCacheEntryNameOffset);
7451 : name_(
name), flags_(
flags), code_() { }
7454 : name_(
name), flags_(code->
flags()), code_(code) { }
7457 if (!other->IsFixedArray())
return false;
7461 if (
flags != flags_) {
7464 return name_->Equals(
name);
7476 Code* code = Code::cast(pair->
get(1));
7477 return NameFlagsHashHelper(
name, code->
flags());
7483 pair->set(0, *name_);
7484 pair->set(1, *code);
7499 int entry = FindEntry(&key);
7500 if (entry == kNotFound)
return GetHeap()->undefined_value();
7501 return get(EntryToIndex(entry) + 1);
7511 int entry = new_cache->FindInsertionEntry(key.
Hash());
7514 new_cache->set(EntryToIndex(entry), *k);
7515 new_cache->set(EntryToIndex(entry) + 1, *code);
7516 new_cache->ElementAdded();
7524 int entry = FindEntry(&key);
7525 return (entry == kNotFound) ? -1 : entry;
7532 set(EntryToIndex(index), heap->the_hole_value());
7533 set(EntryToIndex(index) + 1, heap->the_hole_value());
7542 Isolate* isolate = code_cache->GetIsolate();
7543 if (code_cache->cache()->IsUndefined()) {
7548 code_cache->set_cache(*result);
7551 DCHECK(PolymorphicCodeCacheHashTable::cast(code_cache->cache())
7552 ->Lookup(maps,
flags)->IsUndefined());
7555 handle(PolymorphicCodeCacheHashTable::cast(code_cache->cache()));
7558 code_cache->set_cache(*new_cache);
7564 if (!cache()->IsUndefined()) {
7566 PolymorphicCodeCacheHashTable::cast(cache());
7582 code_flags_(code_flags) {}
7587 FromObject(other, &other_flags, &other_maps);
7588 if (code_flags_ != other_flags)
return false;
7589 if (maps_->length() != other_maps.length())
return false;
7591 int this_hash = MapsHashHelper(maps_, code_flags_);
7592 int other_hash = MapsHashHelper(&other_maps, other_flags);
7593 if (this_hash != other_hash)
return false;
7598 for (
int i = 0;
i < maps_->length(); ++
i) {
7599 bool match_found =
false;
7600 for (
int j = 0; j < other_maps.length(); ++j) {
7601 if (*(maps_->at(
i)) == *(other_maps.
at(j))) {
7606 if (!match_found)
return false;
7613 for (
int i = 0;
i < maps->length(); ++
i) {
7614 hash ^= maps->
at(
i)->Hash();
7620 return MapsHashHelper(maps_, code_flags_);
7626 FromObject(obj, &other_flags, &other_maps);
7627 return MapsHashHelper(&other_maps, other_flags);
7635 isolate->
factory()->NewUninitializedFixedArray(maps_->length() + 1);
7637 for (
int i = 0;
i < maps_->length(); ++
i) {
7638 list->set(
i + 1, *maps_->at(
i));
7649 *code_flags = Smi::cast(list->
get(0))->value();
7650 for (
int i = 1;
i < list->
length(); ++
i) {
7666 int entry = FindEntry(&key);
7667 if (entry == kNotFound)
return GetHeap()->undefined_value();
7668 return get(EntryToIndex(entry) + 1);
7679 EnsureCapacity(hash_table, 1, &key);
7680 int entry = cache->FindInsertionEntry(key.
Hash());
7683 cache->set(EntryToIndex(entry), *obj);
7684 cache->set(EntryToIndex(entry) + 1, *code);
7685 cache->ElementAdded();
7691 DCHECK(0 <= new_length && new_length <= length());
7692 if (new_length < length()) {
7694 this, length() - new_length);
7702 DCHECK(array->IsJSArray() || array->HasSloppyArgumentsElements());
7706 array->GetIsolate(), result,
7710 #ifdef ENABLE_SLOW_DCHECKS
7713 for (
int i = 0;
i < result->length();
i++) {
7714 Object* current = result->get(
i);
7715 DCHECK(current->IsNumber() || current->IsName());
7728 first->GetIsolate(), result,
7736 #ifdef ENABLE_SLOW_DCHECKS
7739 for (
int i = 0;
i < result->length();
i++) {
7740 Object* current = result->get(
i);
7741 DCHECK(current->IsNumber() || current->IsName());
7751 Isolate* isolate = array->GetIsolate();
7752 if (new_length == 0)
return isolate->
factory()->empty_fixed_array();
7754 isolate->
factory()->NewFixedArray(new_length, pretenure);
7757 int len = array->length();
7758 if (new_length < len) len = new_length;
7761 result->set_map_no_write_barrier(array->map());
7763 for (
int i = 0;
i < len;
i++) {
7764 result->set(
i, array->get(
i),
mode);
7773 for (
int index = 0; index < len; index++) {
7774 dest->
set(dest_pos+index, get(pos+index),
mode);
7780 bool FixedArray::IsEqualTo(
FixedArray* other) {
7781 if (length() != other->
length())
return false;
7782 for (
int i = 0 ;
i < length(); ++
i) {
7783 if (get(
i) != other->
get(
i))
return false;
7791 int number_of_descriptors,
7793 DCHECK(0 <= number_of_descriptors);
7794 Factory* factory = isolate->
factory();
7796 int size = number_of_descriptors + slack;
7797 if (
size == 0)
return factory->empty_descriptor_array();
7801 result->set(kDescriptorLengthIndex,
Smi::FromInt(number_of_descriptors));
7813 descriptor->SetSortedKeyIndex(GetSortedKeyIndex(index));
7814 Set(index, descriptor);
7820 Object* new_index_cache) {
7821 DCHECK(bridge_storage->
length() >= kEnumCacheBridgeLength);
7822 DCHECK(new_index_cache->IsSmi() || new_index_cache->IsFixedArray());
7824 DCHECK(!HasEnumCache() || new_cache->
length() > GetEnumCache()->length());
7825 FixedArray::cast(bridge_storage)->
7826 set(kEnumCacheBridgeCacheIndex, new_cache);
7827 FixedArray::cast(bridge_storage)->
7828 set(kEnumCacheBridgeIndicesCacheIndex, new_index_cache);
7829 set(kEnumCacheIndex, bridge_storage);
7837 PropertyDetails details = src->
GetDetails(index);
7841 Set(index, &desc, witness);
7851 int len = number_of_descriptors();
7853 for (
int i = 0;
i < len; ++
i) SetSortedKey(
i,
i);
7856 const int max_parent_index = (len / 2) - 1;
7857 for (
int i = max_parent_index;
i >= 0; --
i) {
7858 int parent_index =
i;
7859 const uint32_t parent_hash = GetSortedKey(
i)->Hash();
7860 while (parent_index <= max_parent_index) {
7861 int child_index = 2 * parent_index + 1;
7862 uint32_t child_hash = GetSortedKey(child_index)->Hash();
7863 if (child_index + 1 < len) {
7864 uint32_t right_child_hash = GetSortedKey(child_index + 1)->Hash();
7865 if (right_child_hash > child_hash) {
7867 child_hash = right_child_hash;
7870 if (child_hash <= parent_hash)
break;
7871 SwapSortedKeys(parent_index, child_index);
7873 parent_index = child_index;
7878 for (
int i = len - 1;
i > 0; --
i) {
7880 SwapSortedKeys(0,
i);
7882 int parent_index = 0;
7883 const uint32_t parent_hash = GetSortedKey(parent_index)->Hash();
7884 const int max_parent_index = (
i / 2) - 1;
7885 while (parent_index <= max_parent_index) {
7886 int child_index = parent_index * 2 + 1;
7887 uint32_t child_hash = GetSortedKey(child_index)->Hash();
7888 if (child_index + 1 <
i) {
7889 uint32_t right_child_hash = GetSortedKey(child_index + 1)->Hash();
7890 if (right_child_hash > child_hash) {
7892 child_hash = right_child_hash;
7895 if (child_hash <= parent_hash)
break;
7896 SwapSortedKeys(parent_index, child_index);
7897 parent_index = child_index;
7900 DCHECK(IsSortedNoDuplicates());
7906 copy->set_getter(pair->getter());
7907 copy->set_setter(pair->setter());
7913 Object* accessor = get(component);
7914 return accessor->IsTheHole() ?
GetHeap()->undefined_value() : accessor;
7920 DCHECK(deopt_entry_count > 0);
7922 isolate->
factory()->NewFixedArray(LengthFor(deopt_entry_count),
7929 int number_of_deopt_points,
7932 if (number_of_deopt_points == 0) {
7933 result = isolate->
factory()->empty_fixed_array();
7935 result = isolate->
factory()->NewFixedArray(
7936 LengthOfFixedArray(number_of_deopt_points), pretenure);
7944 if (IsEmpty())
return other->
IsEmpty();
7945 if (other->
IsEmpty())
return false;
7946 if (length() != other->
length())
return false;
7947 for (
int i = 0;
i < length(); ++
i) {
7948 if (get(
i) != other->
get(
i))
return false;
7956 if (!
GetIsolate()->heap()->Contains(
this))
return false;
7962 DCHECK(!AllowHeapAllocation::IsAllowed());
7963 int length = this->length();
7964 StringShape shape(
this);
7972 string = cons->
first();
7973 shape = StringShape(
string);
7977 offset = slice->
offset();
7978 string = slice->
parent();
7979 shape = StringShape(
string);
7984 const uint8_t* start;
7986 start = SeqOneByteString::cast(
string)->GetChars();
7988 start = ExternalOneByteString::cast(
string)->GetChars();
7995 start = SeqTwoByteString::cast(
string)->GetChars();
7997 start = ExternalTwoByteString::cast(
string)->GetChars();
8008 int* length_return) {
8015 if (length < 0) length =
kMaxInt - offset;
8021 int character_position = offset;
8024 while (stream.
HasMore() && character_position++ < offset + length) {
8030 if (length_return) {
8031 *length_return = utf8_bytes;
8034 char* result = NewArray<char>(utf8_bytes + 1);
8037 stream.
Reset(
this, offset);
8038 character_position = offset;
8039 int utf8_byte_position = 0;
8041 while (stream.
HasMore() && character_position++ < offset + length) {
8046 utf8_byte_position +=
8050 result[utf8_byte_position] = 0;
8057 int* length_return) {
8058 return ToCString(allow_nulls, robust_flag, 0, -1, length_return);
8063 DCHECK(!IsOneByteRepresentationUnderneath());
8064 switch (StringShape(
this).representation_tag()) {
8066 return SeqTwoByteString::cast(
this)->SeqTwoByteStringGetData(start);
8068 return ExternalTwoByteString::cast(
this)->
8069 ExternalTwoByteStringGetData(start);
8093 uc16* result = NewArray<uc16>(length() + 1);
8098 result[
i++] = character;
8106 return reinterpret_cast<uc16*
>(
8111 void Relocatable::PostGarbageCollectionProcessing(
Isolate* isolate) {
8112 Relocatable* current = isolate->relocatable_top();
8113 while (current !=
NULL) {
8114 current->PostGarbageCollection();
8115 current = current->prev_;
8122 return sizeof(Relocatable*);
8127 char* Relocatable::ArchiveState(Isolate* isolate,
char*
to) {
8128 *
reinterpret_cast<Relocatable**
>(
to) = isolate->relocatable_top();
8129 isolate->set_relocatable_top(
NULL);
8135 char* Relocatable::RestoreState(Isolate* isolate,
char* from) {
8136 isolate->set_relocatable_top(*
reinterpret_cast<Relocatable**
>(from));
8141 char* Relocatable::Iterate(ObjectVisitor* v,
char* thread_storage) {
8142 Relocatable* top = *
reinterpret_cast<Relocatable**
>(thread_storage);
8148 void Relocatable::Iterate(Isolate* isolate, ObjectVisitor* v) {
8149 Iterate(v, isolate->relocatable_top());
8153 void Relocatable::Iterate(ObjectVisitor* v, Relocatable* top) {
8154 Relocatable* current = top;
8155 while (current !=
NULL) {
8156 current->IterateInstance(v);
8157 current = current->prev_;
8163 : Relocatable(isolate),
8164 str_(str.location()),
8165 length_(str->length()) {
8171 : Relocatable(isolate),
8174 length_(input.length()),
8175 start_(input.start()) {}
8197 root_ = cons_string;
8212 if (!blew_stack)
string =
NextLeaf(&blew_stack);
8216 string =
Search(offset_out);
8235 int length =
string->
length();
8237 if (consumed < offset + length) {
8240 type =
string->map()->instance_type();
8242 cons_string = ConsString::cast(
string);
8253 string = cons_string->
second();
8256 cons_string = ConsString::cast(
string);
8261 length =
string->length();
8277 *offset_out = consumed - offset;
8289 *blew_stack =
false;
8300 int32_t type =
string->map()->instance_type();
8304 int length =
string->length();
8306 if (length == 0)
continue;
8310 cons_string = ConsString::cast(
string);
8315 string = cons_string->
first();
8319 int length =
string->length();
8324 cons_string = ConsString::cast(
string);
8339 return left->Get(index);
8342 String*
string = String::cast(
this);
8345 if (StringShape(
string).IsCons()) {
8346 ConsString* cons_string = ConsString::cast(
string);
8348 if (left->
length() > index) {
8352 string = cons_string->
second();
8355 return string->Get(index);
8369 template <
typename sink
char>
8379 switch (StringShape(source).full_representation_tag()) {
8381 CopyChars(sink, ExternalOneByteString::cast(source)->GetChars() + from,
8387 ExternalTwoByteString::cast(source)->GetChars();
8395 SeqOneByteString::cast(source)->GetChars() + from,
8401 SeqTwoByteString::cast(source)->GetChars() + from,
8407 ConsString* cons_string = ConsString::cast(source);
8409 int boundary = first->
length();
8410 if (
to - boundary >= boundary - from) {
8412 if (from < boundary) {
8414 sink += boundary - from;
8420 source = cons_string->
second();
8423 if (
to > boundary) {
8428 if (
to - boundary == 1) {
8429 sink[boundary - from] =
static_cast<sinkchar
>(second->Get(0));
8430 }
else if (second->IsSeqOneByteString()) {
8432 SeqOneByteString::cast(second)->GetChars(),
8436 sink + boundary - from,
8449 unsigned offset = slice->
offset();
8459 template <
typename SourceChar>
8463 bool include_ending_line) {
8464 const int src_len = src.
length();
8469 while (position != -1 && position < src_len) {
8470 position = search.
Search(src, position);
8471 if (position != -1) {
8472 line_ends->
Add(position);
8474 }
else if (include_ending_line) {
8476 line_ends->
Add(src_len);
8484 bool include_ending_line) {
8488 int line_count_estimate = src->length() >> 4;
8489 List<int> line_ends(line_count_estimate);
8490 Isolate* isolate = src->GetIsolate();
8499 include_ending_line);
8504 include_ending_line);
8507 int line_count = line_ends.length();
8509 for (
int i = 0;
i < line_count;
i++) {
8518 template <
typename Char>
8520 const Char*
const b,
8526 template<
typename Chars1,
typename Chars2>
8529 static inline bool compare(
const Chars1* a,
const Chars2* b,
int len) {
8530 DCHECK(
sizeof(Chars1) !=
sizeof(Chars2));
8531 for (
int i = 0;
i < len;
i++) {
8553 static inline bool compare(
const uint8_t* a,
const uint8_t* b,
int len) {
8568 if (cons_string !=
NULL) {
8626 template<
typename Chars1,
typename Chars2>
8628 const Chars1* a =
reinterpret_cast<const Chars1*
>(state_1->
buffer8_);
8629 const Chars2* b =
reinterpret_cast<const Chars2*
>(state_2->
buffer8_);
8634 int length = string_1->
length();
8639 DCHECK(to_check > 0 && to_check <= length);
8655 if (!is_equal)
return false;
8658 if (length == 0)
return true;
8675 if (len != other->
length())
return false;
8676 if (len == 0)
return true;
8681 #ifdef ENABLE_SLOW_DCHECKS
8684 bool found_difference =
false;
8685 for (
int i = 0;
i < len;
i++) {
8686 if (Get(
i) != other->Get(
i)) {
8687 found_difference =
true;
8691 DCHECK(found_difference);
8695 if (
Hash() != other->
Hash())
return false;
8700 if (this->Get(0) != other->Get(0))
return false;
8702 if (IsSeqOneByteString() && other->IsSeqOneByteString()) {
8703 const uint8_t* str1 = SeqOneByteString::cast(
this)->GetChars();
8704 const uint8_t* str2 = SeqOneByteString::cast(other)->GetChars();
8718 int one_length = one->length();
8719 if (one_length != two->length())
return false;
8720 if (one_length == 0)
return true;
8724 if (one->HasHashCode() && two->HasHashCode()) {
8725 #ifdef ENABLE_SLOW_DCHECKS
8727 if (one->Hash() != two->Hash()) {
8728 bool found_difference =
false;
8729 for (
int i = 0;
i < one_length;
i++) {
8730 if (one->Get(
i) != two->Get(
i)) {
8731 found_difference =
true;
8735 DCHECK(found_difference);
8739 if (one->Hash() != two->Hash())
return false;
8744 if (one->Get(0) != two->Get(0))
return false;
8758 for (
int i = 0;
i < one_length;
i++) {
8759 if (flat1.
Get(
i) != flat2.
Get(
i))
return false;
8767 if (StringShape(
this).IsInternalized())
return false;
8771 if (
map == heap->string_map()) {
8772 this->
set_map(heap->undetectable_string_map());
8774 }
else if (
map == heap->one_byte_string_map()) {
8775 this->
set_map(heap->undetectable_one_byte_string_map());
8786 int str_len = str.
length();
8787 if (!allow_prefix_match &&
8793 unsigned remaining_in_str =
static_cast<unsigned>(str_len);
8794 const uint8_t* utf8_data =
reinterpret_cast<const uint8_t*
>(str.
start());
8795 for (
i = 0; i < slen && remaining_in_str > 0;
i++) {
8796 unsigned cursor = 0;
8798 DCHECK(cursor > 0 && cursor <= remaining_in_str);
8800 if (
i > slen - 1)
return false;
8804 if (Get(
i) != r)
return false;
8806 utf8_data += cursor;
8807 remaining_in_str -= cursor;
8809 return (allow_prefix_match ||
i == slen) && remaining_in_str == 0;
8815 if (str.
length() != slen)
return false;
8820 str.
start(), slen) == 0;
8822 for (
int i = 0;
i < slen;
i++) {
8823 if (Get(
i) !=
static_cast<uint16_t>(str[
i]))
return false;
8831 if (str.
length() != slen)
return false;
8837 for (
int i = 0;
i < slen;
i++) {
8838 if (Get(
i) != str[
i])
return false;
8884 int new_size, old_size;
8885 int old_length =
string->length();
8886 if (old_length <= new_length)
return string;
8888 if (string->IsSeqOneByteString()) {
8892 DCHECK(string->IsSeqTwoByteString());
8897 int delta = old_size - new_size;
8899 Address start_of_string =
string->address();
8903 Heap* heap =
string->GetHeap();
8905 if (newspace->
Contains(start_of_string) &&
8906 newspace->
top() == start_of_string + old_size) {
8908 newspace->
set_top(start_of_string + new_size);
8918 string->synchronized_set_length(new_length);
8920 if (new_length == 0)
return heap->
isolate()->
factory()->empty_string();
8958 int* utf16_length_out) {
8959 int vector_length = chars.
length();
8961 if (vector_length <= 1) {
8962 DCHECK(vector_length == 0 ||
8963 static_cast<uint8_t
>(chars.
start()[0]) <=
8965 *utf16_length_out = vector_length;
8971 unsigned remaining =
static_cast<unsigned>(vector_length);
8972 const uint8_t* stream =
reinterpret_cast<const uint8_t*
>(chars.
start());
8973 int utf16_length = 0;
8974 bool is_index =
true;
8976 while (remaining > 0) {
8977 unsigned consumed = 0;
8979 DCHECK(consumed > 0 && consumed <= remaining);
8981 remaining -= consumed;
8983 utf16_length += is_two_characters ? 2 : 1;
8986 if (is_two_characters) {
8998 *utf16_length_out =
static_cast<int>(utf16_length);
9000 hasher.
length_ = utf16_length;
9039 first->constructor() == second->constructor() &&
9040 first->prototype() == second->prototype() &&
9070 while (!code_iter.is_finished()) {
9071 v->VisitCodeEntry(
reinterpret_cast<Address>(
9077 while (!heap_iter.is_finished()) {
9088 reinterpret_cast<Address>(isolate->
heap()->undefined_value()) };
9090 for (
int i = 0;
i < 2; ++
i) {
9116 DCHECK(shared()->allows_lazy_compilation() ||
9117 code()->optimizable());
9118 DCHECK(!shared()->is_generator());
9120 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimized));
9128 DCHECK(shared()->allows_lazy_compilation() ||
code()->optimizable());
9129 DCHECK(!shared()->is_generator());
9131 if (FLAG_trace_concurrent_recompilation) {
9134 PrintF(
" for concurrent recompilation.\n");
9137 GetIsolate()->builtins()->builtin(Builtins::kCompileOptimizedConcurrent));
9147 DCHECK(shared()->allows_lazy_compilation() ||
code()->optimizable());
9149 if (FLAG_trace_concurrent_recompilation) {
9152 PrintF(
" for concurrent recompilation.\n");
9155 GetIsolate()->builtins()->builtin(Builtins::kInOptimizationQueue));
9161 Isolate* isolate =
function->GetIsolate();
9166 isolate->
factory()->NewFunctionFromSharedFunctionInfo(shared,
context);
9168 if (shared->bound()) {
9169 clone->set_function_bindings(function->function_bindings());
9176 if (*original_prototype != clone->map()->prototype()) {
9190 Isolate* isolate = shared->GetIsolate();
9191 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
9192 DCHECK(native_context->IsNativeContext());
9197 if (value->IsSmi()) {
9199 DCHECK_EQ(0, Smi::cast(*value)->value());
9206 DCHECK_EQ(-1, shared->SearchOptimizedCodeMap(*native_context, osr_ast_id));
9207 old_length = old_code_map->length();
9212 Object** data = old_code_map->data_start();
9227 Code::OPTIMIZED_FUNCTION);
9232 shared->set_optimized_code_map(*new_code_map);
9238 FixedArray* code_map = FixedArray::cast(optimized_code_map());
9240 FixedArray* cached_literals = FixedArray::cast(code_map->
get(index + 1));
9242 return cached_literals;
9250 FixedArray* code_map = FixedArray::cast(optimized_code_map());
9251 Code* code = Code::cast(code_map->
get(index));
9258 FixedArray* code_map = FixedArray::cast(optimized_code_map());
9273 const char* reason) {
9275 if (optimized_code_map()->IsSmi())
return;
9277 FixedArray* code_map = FixedArray::cast(optimized_code_map());
9281 DCHECK(code_map->
get(src)->IsNativeContext());
9284 if (FLAG_trace_opt) {
9285 PrintF(
"[evicting entry from optimizing code map (%s) for ", reason);
9318 FixedArray* code_map = FixedArray::cast(optimized_code_map());
9331 if (object->IsGlobalObject())
return;
9332 if (object->IsJSGlobalProxy())
return;
9337 if (!object->HasFastProperties()) {
9341 !object->map()->is_prototype_map()) {
9344 object->map()->set_is_prototype_map(
true);
9350 if (!object->map()->is_prototype_map())
return;
9359 Factory* factory = native_context->GetIsolate()->factory();
9366 maps->set(kind, *current_map);
9371 if (current_map->HasElementsTransition()) {
9372 new_map =
handle(current_map->elements_transition_map());
9373 DCHECK(new_map->elements_kind() == next_kind);
9378 maps->set(next_kind, *new_map);
9379 current_map = new_map;
9381 native_context->set_js_array_maps(*maps);
9388 Isolate* isolate =
function->GetIsolate();
9390 DCHECK(value->IsJSReceiver());
9394 if (function->has_initial_map()) {
9399 if (function->IsInobjectSlackTrackingInProgress()) {
9400 function->CompleteInobjectSlackTracking();
9410 function->set_prototype_or_initial_map(*value);
9420 if (array_function->IsJSFunction() &&
9421 *
function == JSFunction::cast(array_function)) {
9427 initial_map->dependent_code()->DeoptimizeDependentCodeGroup(
9433 function->set_prototype_or_initial_map(*value);
9441 DCHECK(function->should_have_prototype());
9448 if (!value->IsJSReceiver()) {
9455 new_map->set_constructor(*value);
9456 new_map->set_non_instance_prototype(
true);
9457 Isolate* isolate = new_map->GetIsolate();
9458 construct_prototype =
handle(
9462 function->map()->set_non_instance_prototype(
false);
9471 Map* no_prototype_map = shared()->strict_mode() ==
SLOPPY
9472 ? native_context->sloppy_function_without_prototype_map()
9473 : native_context->strict_function_without_prototype_map();
9475 if (
map() == no_prototype_map)
return true;
9478 if (
map() != (shared()->strict_mode() ==
SLOPPY
9479 ? native_context->sloppy_function_map()
9480 : native_context->strict_function_map())) {
9486 set_prototype_or_initial_map(no_prototype_map->
GetHeap()->the_hole_value());
9498 function->set_prototype_or_initial_map(*
map);
9499 map->set_constructor(*
function);
9504 if (function->has_initial_map())
return;
9505 Isolate* isolate =
function->GetIsolate();
9511 int in_object_properties;
9512 if (function->shared()->is_generator()) {
9515 in_object_properties = 0;
9518 instance_size =
function->shared()->CalculateInstanceSize();
9519 in_object_properties =
function->shared()->CalculateInObjectProperties();
9525 if (function->has_instance_prototype()) {
9537 if (!function->shared()->is_generator()) {
9538 function->StartInobjectSlackTracking();
9544 shared()->set_instance_class_name(
name);
9568 if (*raw_filter ==
'*')
return true;
9571 if (filter.
length() == 0)
return name->length() == 0;
9572 if (filter[0] ==
'-') {
9574 if (filter.
length() == 1) {
9575 return (
name->length() != 0);
9579 if (filter[filter.
length() - 1] ==
'*' &&
9585 }
else if (
name->IsUtf8EqualTo(filter)) {
9588 if (filter[filter.
length() - 1] ==
'*' &&
9598 const char* to_string,
9602 isolate->
factory()->InternalizeUtf8String(to_string);
9603 oddball->set_to_string(*internalized_to_string);
9604 oddball->set_to_number(*to_number);
9605 oddball->set_kind(
kind);
9610 if (!script->line_ends()->IsUndefined())
return;
9612 Isolate* isolate = script->GetIsolate();
9614 if (!script->source()->IsString()) {
9615 DCHECK(script->source()->IsUndefined());
9617 script->set_line_ends(*empty);
9618 DCHECK(script->line_ends()->IsFixedArray());
9626 if (*array != isolate->
heap()->empty_fixed_array()) {
9627 array->set_map(isolate->
heap()->fixed_cow_array_map());
9630 script->set_line_ends(*array);
9631 DCHECK(script->line_ends()->IsFixedArray());
9637 if (line_number == -1)
return -1;
9640 FixedArray* line_ends_array = FixedArray::cast(script->line_ends());
9641 line_number = line_number - script->line_offset()->value();
9642 if (line_number == 0)
return code_pos + script->column_offset()->value();
9643 int prev_line_end_pos =
9644 Smi::cast(line_ends_array->
get(line_number - 1))->value();
9645 return code_pos - (prev_line_end_pos + 1);
9651 DCHECK(line_ends()->IsFixedArray());
9652 FixedArray* line_ends_array = FixedArray::cast(line_ends());
9653 int line_ends_len = line_ends_array->
length();
9654 if (line_ends_len == 0)
return -1;
9656 if ((Smi::cast(line_ends_array->
get(0)))->value() >= code_pos) {
9657 return line_offset()->value();
9661 int right = line_ends_len;
9662 while (
int half = (right - left) / 2) {
9663 if ((Smi::cast(line_ends_array->
get(left + half)))->value() > code_pos) {
9669 return right + line_offset()->value();
9675 return script->GetLineNumberWithArray(code_pos);
9684 if (!source()->IsString())
return -1;
9686 String* source_string = String::cast(source());
9688 int len = source_string->
length();
9689 for (
int pos = 0; pos < len; pos++) {
9690 if (pos == code_pos)
break;
9691 if (source_string->Get(pos) ==
'\n') line++;
9698 Isolate* isolate = script->GetIsolate();
9700 isolate->
factory()->InternalizeOneByteString(
9704 script_wrapper, name_or_source_url_key).ToHandleChecked();
9705 DCHECK(property->IsJSFunction());
9710 if (!Execution::TryCall(method, script_wrapper, 0,
NULL).ToHandle(&result)) {
9711 return isolate->
factory()->undefined_value();
9726 JSValue* wrapper = JSValue::cast(*location);
9727 Script::cast(wrapper->value())->ClearWrapperCache();
9742 if (script->wrapper()->foreign_address() !=
NULL) {
9745 *
reinterpret_cast<JSValue**
>(script->wrapper()->foreign_address()));
9747 Isolate* isolate = script->GetIsolate();
9749 isolate->
counters()->script_wrappers()->Increment();
9754 result->set_value(*script);
9761 reinterpret_cast<void*
>(
handle.location()),
9763 script->wrapper()->set_foreign_address(
9771 if (!n->IsString() || String::cast(n)->length() == 0)
return inferred_name();
9772 return String::cast(n);
9777 return !script()->IsUndefined() &&
9778 !
reinterpret_cast<Script*
>(script())->source()->IsUndefined();
9784 Handle<String> source(String::cast(Script::cast(script())->source()));
9792 if (!script()->IsScript())
return false;
9793 if (optimization_disabled())
return false;
9795 if (code()->
kind() != Code::FUNCTION)
return true;
9796 return code()->optimizable();
9812 return instance_size;
9831 reinterpret_cast<String*
>(Script::cast(s->script())->source());
9833 if (!script_source->
LooksValid())
return os <<
"<Invalid Source>";
9835 if (!s->is_toplevel()) {
9838 if (
name->IsString() && String::cast(
name)->length() > 0) {
9839 String::cast(
name)->PrintUC16(os);
9850 return os <<
"...\n";
9857 ByteArray* code_relocation = code->relocation_info();
9858 ByteArray* recompiled_relocation = recompiled->relocation_info();
9859 int length = code_relocation->
length();
9860 if (length != recompiled_relocation->
length())
return false;
9864 return compare == 0;
9871 Code* code = this->code();
9874 code->set_deoptimization_data(recompiled->deoptimization_data());
9895 set_optimization_disabled(
true);
9900 if (code()->
kind() == Code::FUNCTION) {
9901 code()->set_optimizable(
false);
9904 if (FLAG_trace_opt) {
9905 PrintF(
"[disabled optimization for ");
9914 Code* unoptimized = code();
9916 DeoptimizationOutputData::cast(unoptimized->deoptimization_data());
9926 if (!FLAG_clever_optimizations)
return;
9944 code()->ClearInlineCaches();
9949 if (code()->
kind() == Code::FUNCTION) {
9950 code()->set_profiler_ticks(0);
9951 if (optimization_disabled() &&
9954 set_optimization_disabled(
false);
9955 code()->set_optimizable(
true);
9964 int slack =
map->unused_property_fields();
9965 if (*
reinterpret_cast<int*
>(data) > slack) {
9966 *
reinterpret_cast<int*
>(data) = slack;
9972 int slack = *
reinterpret_cast<int*
>(data);
9973 map->set_inobject_properties(
map->inobject_properties() - slack);
9974 map->set_unused_property_fields(
map->unused_property_fields() - slack);
10002 if (!FLAG_cache_optimized_code)
return -1;
10003 Object* value = optimized_code_map();
10004 if (!value->IsSmi()) {
10005 FixedArray* optimized_code_map = FixedArray::cast(value);
10014 if (FLAG_trace_opt) {
10015 PrintF(
"[didn't find optimized code in optimized code map for ");
10024 #define DECLARE_TAG(ignore1, name, ignore2) name,
10032 #define DECLARE_TAG(ignore1, ignore2, name) name,
10040 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) {
10043 Object* old_target = target;
10044 VisitPointer(&target);
10049 void ObjectVisitor::VisitCodeAgeSequence(RelocInfo* rinfo) {
10051 Object* stub = rinfo->code_age_stub();
10053 VisitPointer(&stub);
10058 void ObjectVisitor::VisitCodeEntry(
Address entry_address) {
10060 Object* old_code = code;
10061 VisitPointer(&code);
10062 if (code != old_code) {
10068 void ObjectVisitor::VisitCell(RelocInfo* rinfo) {
10070 Object* cell = rinfo->target_cell();
10071 Object* old_cell = cell;
10072 VisitPointer(&cell);
10073 if (cell != old_cell) {
10074 rinfo->set_target_cell(
reinterpret_cast<Cell*
>(cell));
10079 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) {
10081 rinfo->IsPatchedReturnSequence()) ||
10083 rinfo->IsPatchedDebugBreakSlotSequence()));
10085 Object* old_target = target;
10086 VisitPointer(&target);
10091 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) {
10093 Object* p = rinfo->target_object();
10098 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) {
10099 Address p = rinfo->target_reference();
10100 VisitExternalReference(&p);
10106 set_relocation_info(
GetHeap()->empty_byte_array());
10112 Cell* undefined_cell =
GetHeap()->undefined_cell();
10135 DCHECK(Marking::Color(
this) == Marking::WHITE_OBJECT);
10168 Code* code = Code::cast(*p);
10173 Address p = it.rinfo()->target_runtime_entry(origin);
10178 Code* code = Code::cast(*p);
10200 while (!it.
done()) {
10205 int dist =
static_cast<int>(
pc - it.
rinfo()->
pc());
10206 int pos =
static_cast<int>(it.
rinfo()->
data());
10210 if ((dist < distance) ||
10211 (dist == distance && pos > position)) {
10229 int statement_position = 0;
10231 while (!it.
done()) {
10233 int p =
static_cast<int>(it.
rinfo()->
data());
10234 if (statement_position < p && p <= position) {
10235 statement_position = p;
10240 return statement_position;
10245 SafepointTable table(
this);
10246 return table.FindEntry(
pc);
10256 Object*
object = info->target_object();
10257 if (object->IsHeapObject()) {
10258 if (HeapObject::cast(
object)->
map() == match_map) {
10259 if (--n == 0)
return object;
10269 return (result !=
NULL) ? AllocationSite::cast(result) :
NULL;
10275 return (result !=
NULL) ? Map::cast(result) :
NULL;
10284 int current_pattern = 0;
10287 Object*
object = info->target_object();
10288 if (object->IsHeapObject()) {
10289 Map*
map = HeapObject::cast(
object)->
map();
10290 if (
map == *pattern.
find_[current_pattern]) {
10291 info->set_target_object(*pattern.
replace_[current_pattern]);
10292 if (++current_pattern == pattern.
count_)
return;
10306 Object*
object = info->target_object();
10307 if (object->IsMap()) maps->
Add(
handle(Map::cast(
object)));
10319 if (code->
kind() == Code::HANDLER)
return code;
10331 if (
i == length)
return true;
10336 if (code->
kind() != Code::HANDLER)
break;
10340 return i == length;
10348 bool return_next =
false;
10352 Object*
object = info->target_object();
10353 if (
object ==
map) return_next =
true;
10354 }
else if (return_next) {
10370 Object*
object = info->target_object();
10371 if (object->IsName())
return Name::cast(
object);
10411 if (obj->IsHeapObject()) {
10413 HeapObject::cast(obj)->map()->instance_type();
10414 switch (instance_type) {
10477 if (sequence !=
NULL) {
10483 if (age !=
kLastCodeAge && code_parity != current_parity) {
10486 static_cast<Age>(age + 1),
10499 return FLAG_age_code &&
10501 (
kind() == OPTIMIZED_FUNCTION ||
10515 if (sequence ==
NULL) {
10530 #define HANDLE_CODE_AGE(AGE) \
10531 stub = *builtins->Make##AGE##CodeYoungAgainEvenMarking(); \
10532 if (code == stub) { \
10533 *age = k##AGE##CodeAge; \
10534 *parity = EVEN_MARKING_PARITY; \
10537 stub = *builtins->Make##AGE##CodeYoungAgainOddMarking(); \
10538 if (code == stub) { \
10539 *age = k##AGE##CodeAge; \
10540 *parity = ODD_MARKING_PARITY; \
10544 #undef HANDLE_CODE_AGE
10545 stub = *builtins->MarkCodeAsExecutedOnce();
10546 if (code == stub) {
10551 stub = *builtins->MarkCodeAsExecutedTwice();
10552 if (code == stub) {
10564 #define HANDLE_CODE_AGE(AGE) \
10565 case k##AGE##CodeAge: { \
10566 Code* stub = parity == EVEN_MARKING_PARITY \
10567 ? *builtins->Make##AGE##CodeYoungAgainEvenMarking() \
10568 : *builtins->Make##AGE##CodeYoungAgainOddMarking(); \
10572 #undef HANDLE_CODE_AGE
10575 return *builtins->MarkCodeAsExecutedOnce();
10579 return *builtins->MarkCodeAsExecutedTwice();
10590 const char* last_comment =
NULL;
10596 last_comment =
reinterpret_cast<const char*
>(info->
data());
10597 }
else if (last_comment !=
NULL) {
10605 PrintF(out,
" %s\n", last_comment);
10615 DeoptimizationInputData::cast(deoptimization_data());
10618 if (deopt_data->Pc(
i)->value() == -1)
continue;
10629 #define CASE(name) case name: return #name;
10639 #ifdef ENABLE_DISASSEMBLER
10641 void DeoptimizationInputData::DeoptimizationInputDataPrint(
10645 os <<
"Deoptimization Input Data (deopt points = " << deopt_count <<
")\n";
10646 if (0 != deopt_count) {
10647 os <<
" index ast id argc pc";
10648 if (FLAG_print_code_verbose) os <<
" commands";
10651 for (
int i = 0;
i < deopt_count;
i++) {
10655 ArgumentsStackHeight(
i)->value(), Pc(
i)->value());
10656 os << buf1.start();
10658 if (!FLAG_print_code_verbose) {
10663 int translation_index = TranslationIndex(
i)->value();
10664 TranslationIterator iterator(TranslationByteArray(), translation_index);
10667 DCHECK(Translation::BEGIN == opcode);
10668 int frame_count = iterator.Next();
10669 int jsframe_count = iterator.Next();
10670 os <<
" " << Translation::StringFor(opcode)
10671 <<
" {frame count=" << frame_count
10672 <<
", js frame count=" << jsframe_count <<
"}\n";
10674 while (iterator.HasNext() &&
10675 Translation::BEGIN !=
10678 SNPrintF(buf2,
"%27s %s ",
"", Translation::StringFor(opcode));
10679 os << buf2.start();
10682 case Translation::BEGIN:
10687 int ast_id = iterator.Next();
10688 int function_id = iterator.Next();
10689 unsigned height = iterator.Next();
10690 os <<
"{ast_id=" << ast_id <<
", function=";
10691 if (function_id != Translation::kSelfLiteralId) {
10692 Object*
function = LiteralArray()->get(function_id);
10693 os << Brief(JSFunction::cast(
function)->shared()->DebugName());
10697 os <<
", height=" << height <<
"}";
10701 case Translation::COMPILED_STUB_FRAME: {
10703 os <<
"{kind=" << stub_kind <<
"}";
10707 case Translation::ARGUMENTS_ADAPTOR_FRAME:
10708 case Translation::CONSTRUCT_STUB_FRAME: {
10709 int function_id = iterator.Next();
10710 JSFunction*
function =
10711 JSFunction::cast(LiteralArray()->
get(function_id));
10712 unsigned height = iterator.Next();
10713 os <<
"{function=" << Brief(function->shared()->DebugName())
10714 <<
", height=" << height <<
"}";
10718 case Translation::GETTER_STUB_FRAME:
10719 case Translation::SETTER_STUB_FRAME: {
10720 int function_id = iterator.Next();
10721 JSFunction*
function =
10722 JSFunction::cast(LiteralArray()->
get(function_id));
10723 os <<
"{function=" << Brief(function->shared()->DebugName()) <<
"}";
10728 int reg_code = iterator.Next();
10733 case Translation::INT32_REGISTER: {
10734 int reg_code = iterator.Next();
10739 case Translation::UINT32_REGISTER: {
10740 int reg_code = iterator.Next();
10746 case Translation::DOUBLE_REGISTER: {
10747 int reg_code = iterator.Next();
10753 case Translation::STACK_SLOT: {
10754 int input_slot_index = iterator.Next();
10755 os <<
"{input=" << input_slot_index <<
"}";
10759 case Translation::INT32_STACK_SLOT: {
10760 int input_slot_index = iterator.Next();
10761 os <<
"{input=" << input_slot_index <<
"}";
10765 case Translation::UINT32_STACK_SLOT: {
10766 int input_slot_index = iterator.Next();
10767 os <<
"{input=" << input_slot_index <<
" (unsigned)}";
10771 case Translation::DOUBLE_STACK_SLOT: {
10772 int input_slot_index = iterator.Next();
10773 os <<
"{input=" << input_slot_index <<
"}";
10777 case Translation::LITERAL: {
10778 unsigned literal_index = iterator.Next();
10779 os <<
"{literal_id=" << literal_index <<
"}";
10783 case Translation::DUPLICATED_OBJECT: {
10784 int object_index = iterator.Next();
10785 os <<
"{object_index=" << object_index <<
"}";
10789 case Translation::ARGUMENTS_OBJECT:
10790 case Translation::CAPTURED_OBJECT: {
10791 int args_length = iterator.Next();
10792 os <<
"{length=" << args_length <<
"}";
10802 void DeoptimizationOutputData::DeoptimizationOutputDataPrint(
10804 os <<
"Deoptimization Output Data (deopt points = " << this->
DeoptPoints()
10808 os <<
"ast id pc state\n";
10828 return "PROTOTYPE_FAILURE";
10831 case GENERIC:
return "GENERIC";
10841 const char* Code::StubType2String(StubType type) {
10843 case NORMAL:
return "NORMAL";
10844 case FAST:
return "FAST";
10851 void Code::PrintExtraICState(OStream& os,
10853 os <<
"extra_ic_state = ";
10854 if ((
kind == STORE_IC ||
kind == KEYED_STORE_IC) && (extra ==
STRICT)) {
10857 os << extra <<
"\n";
10862 void Code::Disassemble(
const char*
name, OStream& os) {
10865 const char* n = CodeStub::MajorName(CodeStub::GetMajorKey(
this),
true);
10866 os <<
"major_key = " << (n ==
NULL ?
"null" : n) <<
"\n";
10869 os <<
"ic_state = " << ICState2String(
ic_state()) <<
"\n";
10872 os <<
"type = " << StubType2String(
type()) <<
"\n";
10875 DCHECK(CodeStub::GetMajorKey(
this) == CodeStub::CompareIC);
10880 os <<
"compare_operation = " <<
Token::Name(stub.op()) <<
"\n";
10884 os <<
"name = " <<
name <<
"\n";
10886 if (
kind() == OPTIMIZED_FUNCTION) {
10897 if (
kind() == Code::FUNCTION) {
10902 byte* end = begin + decode_size;
10907 if (
kind() == FUNCTION) {
10908 DeoptimizationOutputData* data =
10909 DeoptimizationOutputData::cast(this->deoptimization_data());
10910 data->DeoptimizationOutputDataPrint(os);
10911 }
else if (
kind() == OPTIMIZED_FUNCTION) {
10912 DeoptimizationInputData* data =
10913 DeoptimizationInputData::cast(this->deoptimization_data());
10914 data->DeoptimizationInputDataPrint(os);
10919 SafepointTable table(
this);
10920 os <<
"Safepoints (size = " << table.size() <<
")\n";
10921 for (
unsigned i = 0;
i < table.length();
i++) {
10922 unsigned pc_offset = table.GetPcOffset(
i);
10927 os << buf1.start() <<
" ";
10928 table.PrintEntry(
i, os);
10929 os <<
" (sp -> fp) ";
10930 SafepointEntry
entry = table.GetEntry(
i);
10931 if (
entry.deoptimization_index() != Safepoint::kNoDeoptimizationIndex) {
10934 os << buf2.start();
10938 if (
entry.argument_count() > 0) {
10939 os <<
" argc: " <<
entry.argument_count();
10944 }
else if (
kind() == FUNCTION) {
10950 BackEdgeTable back_edges(
this, &no_gc);
10952 os <<
"Back edges (size = " << back_edges.length() <<
")\n";
10953 os <<
"ast_id pc_offset loop_depth\n";
10955 for (
uint32_t i = 0;
i < back_edges.length();
i++) {
10957 SNPrintF(buf,
"%6d %9u %10u\n", back_edges.ast_id(
i).ToInt(),
10958 back_edges.pc_offset(
i), back_edges.loop_depth(
i));
10964 #ifdef OBJECT_PRINT
10966 OFStream os(stdout);
10988 DCHECK(!object->HasExternalArrayElements());
10992 object->GetIsolate()->factory()->NewUninitializedFixedArray(capacity);
10994 ElementsKind elements_kind =
object->GetElementsKind();
10998 bool has_fast_smi_elements =
11001 if (has_fast_smi_elements) {
11016 accessor->
CopyElements(
object, new_elements, elements_kind);
11019 Handle<Map> new_map = (new_elements_kind != elements_kind)
11021 :
handle(object->map());
11029 parameter_map->set(1, *new_elements);
11032 if (FLAG_trace_elements_transitions) {
11034 object->GetElementsKind(), new_elements);
11037 if (object->IsJSArray()) {
11040 return new_elements;
11048 DCHECK(!object->HasExternalArrayElements());
11051 object->GetIsolate()->factory()->NewFixedDoubleArray(capacity);
11053 ElementsKind elements_kind =
object->GetElementsKind();
11071 if (FLAG_trace_elements_transitions) {
11073 object->GetElementsKind(), elems);
11076 if (object->IsJSArray()) {
11085 array->GetIsolate()->factory()->NewJSArrayStorage(
11115 old_values->Add(value);
11116 indices->
Add(index);
11124 Isolate* isolate =
object->GetIsolate();
11128 isolate->
factory()->NewNumberFromUint(add_count);
11131 { object, index_object, deleted, add_count_object };
11133 Execution::Call(isolate,
11135 isolate->
factory()->undefined_value(),
11142 Isolate* isolate =
object->GetIsolate();
11146 Execution::Call(isolate,
11148 isolate->
factory()->undefined_value(),
11155 Isolate* isolate =
object->GetIsolate();
11159 Execution::Call(isolate,
11161 isolate->
factory()->undefined_value(),
11170 if (array->HasFastElements()) {
11173 int max_fast_array_size =
static_cast<int>(
11174 (array->GetHeap()->MaxOldGenerationSize() /
kDoubleSize) / 4);
11175 if (new_length_handle->IsNumber() &&
11176 NumberToInt32(*new_length_handle) >= max_fast_array_size) {
11182 DCHECK(array->AllowsSetElementsLength());
11183 if (!array->map()->is_observed()) {
11184 return array->GetElementsAccessor()->SetLength(array, new_length_handle);
11187 Isolate* isolate = array->GetIsolate();
11192 CHECK(old_length_handle->ToArrayIndex(&old_length));
11194 CHECK(new_length_handle->ToArrayIndex(&new_length));
11197 int num_elements = array->NumberOfOwnElements(kNoAttrFilter);
11198 if (num_elements > 0) {
11199 if (old_length ==
static_cast<uint32_t>(num_elements)) {
11201 for (
uint32_t i = old_length - 1;
i + 1 > new_length; --
i) {
11202 if (!
GetOldValue(isolate, array,
i, &old_values, &indices))
break;
11209 array->GetOwnElementKeys(*
keys, kNoAttrFilter);
11210 while (num_elements-- > 0) {
11212 if (index < new_length)
break;
11213 if (!
GetOldValue(isolate, array, index, &old_values, &indices))
break;
11221 array->GetElementsAccessor()->SetLength(array, new_length_handle),
11224 CHECK(array->length()->ToArrayIndex(&new_length));
11225 if (old_length == new_length)
return hresult;
11229 for (
int i = 0;
i < indices.length(); ++
i) {
11234 array,
"delete", isolate->
factory()->Uint32ToString(indices[
i]),
11238 array,
"update", isolate->
factory()->length_string(),
11239 old_length_handle);
11244 uint32_t add_count = new_length > old_length ? new_length - old_length : 0;
11245 uint32_t delete_count = new_length < old_length ? old_length - new_length : 0;
11247 if (delete_count > 0) {
11248 for (
int i = indices.length() - 1;
i >= 0;
i--) {
11251 if (old_values[
i]->IsTheHole())
continue;
11253 deleted, indices[
i] - index, old_values[
i],
NONE,
SLOPPY).Assert();
11257 isolate->
factory()->NewNumberFromUint(delete_count),
11271 const int proto_offset =
11275 for (
int i = 0;
i < number_of_transitions;
i++) {
11276 if (cache->
get(proto_offset +
i * step) == *prototype) {
11277 Object* result = cache->
get(map_offset +
i * step);
11288 DCHECK(target_map->IsMap());
11289 DCHECK(HeapObject::cast(*prototype)->map()->IsMap());
11299 int capacity = (cache->length() - header) / step;
11302 if (transitions > capacity) {
11313 int entry = header + last * step;
11329 int length = transition_array->
length();
11330 for (
int i = 0;
i < length;
i++) {
11331 data[
i] = the_hole;
11340 proto_transitions->
length());
11351 if (*codes !=
map->dependent_code())
map->set_dependent_code(*codes);
11362 if (*codes !=
map->dependent_code())
map->set_dependent_code(*codes);
11369 DCHECK(stub->next_code_link()->IsUndefined());
11378 map->dependent_code()->AddToDependentICList(stub);
11389 start_indexes_[0] = 0;
11392 start_indexes_[g] = start_indexes_[g - 1] + count;
11414 int start = starts.
at(group);
11415 int end = starts.
at(group + 1);
11418 for (
int i = start;
i < end;
i++) {
11419 if (entries->object_at(
i) == *
object)
return entries;
11423 if (capacity > 5) capacity = capacity * 5 / 4;
11428 start = starts.
at(group);
11429 end = starts.
at(group + 1);
11432 entries->clear_at(
i);
11438 new_entries->set_number_of_entries(
static_cast<DependencyGroup>(g), 0);
11441 entries = new_entries;
11443 entries->ExtendGroup(group);
11444 entries->set_object_at(end, *
object);
11445 entries->set_number_of_entries(group, end + 1 - start);
11457 int start = starts.
at(group);
11458 int end = starts.
at(group + 1);
11459 for (
int i = start;
i < end;
i++) {
11467 for (
int i = start;
i < end;
i++) {
11480 int start = starts.
at(group);
11481 int end = starts.
at(group + 1);
11484 for (
int i = start;
i < end;
i++) {
11490 if (info_pos == -1)
return;
11491 int gap = info_pos;
11494 int last_of_group = starts.
at(
i + 1) - 1;
11495 DCHECK(last_of_group >= gap);
11496 if (last_of_group == gap)
continue;
11497 copy(last_of_group, gap);
11498 gap = last_of_group;
11505 for (
int i = start;
i < end - 1;
i++) {
11513 while (!head->IsUndefined()) {
11514 if (head == code)
return true;
11515 head = Code::cast(head)->next_code_link();
11523 int start = starts.
at(group);
11524 int end = starts.
at(group + 1);
11528 for (
int i = start;
i < end;
i++) {
11540 int start = starts.
at(group);
11541 int end = starts.
at(group + 1);
11543 if (start == end)
return false;
11546 bool marked =
false;
11547 for (
int i = start;
i < end;
i++) {
11560 for (
int src = end, dst = start; src < code_entries; src++, dst++) {
11564 int removed = end - start;
11565 for (
int i = code_entries - removed;
i < code_entries;
i++) {
11576 DCHECK(AllowCodeDependencyChange::IsAllowed());
11592 if (head->IsCode()) {
11593 stub->set_next_code_link(Code::cast(head)->next_code_link());
11594 Code::cast(head)->set_next_code_link(*stub);
11596 stub->set_next_code_link(head);
11605 if (FLAG_trace_deopt &&
11606 (code->deoptimization_data() != code->
GetHeap()->empty_fixed_array())) {
11608 DeoptimizationInputData::cast(code->deoptimization_data());
11611 " (opt #%d) for deoptimization, reason: %s]\n",
11612 reinterpret_cast<intptr_t
>(code),
11623 return "weak-code";
11625 return "transition";
11627 return "prototype-check";
11629 return "elements-cant-be-added";
11631 return "property-cell-changed";
11633 return "field-type";
11635 return "initial-map-changed";
11637 return "allocation-site-tenuring-changed";
11639 return "allocation-site-transition-changed";
11650 new_map = Copy(
map);
11651 PutPrototypeTransition(
map, prototype, new_map);
11652 new_map->set_prototype(*prototype);
11660 bool from_javascript) {
11662 int size =
object->Size();
11665 Isolate* isolate =
object->GetIsolate();
11669 if (!value->IsJSReceiver() && !value->IsNull())
return value;
11679 if (!object->map()->is_extensible()) {
11692 !iter.
IsAtEnd(); iter.Advance()) {
11693 if (JSReceiver::cast(iter.GetCurrent()) == *
object) {
11696 NewError(
"cyclic_proto", HandleVector<Object>(
NULL, 0)),
11701 bool dictionary_elements_in_chain =
11702 object->map()->DictionaryElementsInPrototypeChainOnly();
11705 if (from_javascript) {
11720 if (
map->prototype() == *value)
return value;
11722 if (value->IsJSObject()) {
11729 DCHECK(new_map->prototype() == *value);
11732 if (!dictionary_elements_in_chain &&
11733 new_map->DictionaryElementsInPrototypeChainOnly()) {
11737 object->GetHeap()->ClearAllICsByKind(Code::KEYED_STORE_IC);
11754 return EnsureCanContainElements(
11755 object, args->arguments() - first_arg - (arg_count - 1), arg_count,
mode);
11762 if (object->IsJSGlobalProxy()) {
11766 return GetOwnElementAccessorPair(
11773 return object->GetElementsAccessor()->GetAccessorPair(
object,
object, index);
11783 bool check_prototype,
11785 Isolate* isolate =
object->GetIsolate();
11789 AssertNoContextChange ncc(isolate);
11792 if (!interceptor->setter()->IsUndefined()) {
11794 v8::ToCData<v8::IndexedPropertySetterCallback>(interceptor->setter());
11796 ApiIndexedPropertyAccess(
"interceptor-indexed-set", *
object, index));
11802 if (!result.
IsEmpty())
return value;
11805 return SetElementWithoutInterceptor(
object, index, value, attributes,
11818 Isolate* isolate =
object->GetIsolate();
11819 DCHECK(!structure->IsForeign());
11821 if (structure->IsExecutableAccessorInfo()) {
11824 Object* fun_obj = data->getter();
11826 v8::ToCData<v8::AccessorNameGetterCallback>(fun_obj);
11827 if (call_fun ==
NULL)
return isolate->
factory()->undefined_value();
11831 LOG(isolate, ApiNamedPropertyAccess(
"load", *holder_handle, *key));
11833 args(isolate, data->data(), *receiver, *holder_handle);
11836 if (result.
IsEmpty())
return isolate->
factory()->undefined_value();
11838 result_internal->VerifyApiCallResultType();
11840 return handle(*result_internal, isolate);
11844 if (structure->IsAccessorPair()) {
11847 if (getter->IsSpecFunction()) {
11853 return isolate->
factory()->undefined_value();
11856 if (structure->IsDeclaredAccessorInfo()) {
11872 Isolate* isolate =
object->GetIsolate();
11876 DCHECK(!value->IsTheHole());
11877 DCHECK(!structure->IsForeign());
11878 if (structure->IsExecutableAccessorInfo()) {
11882 Object* call_obj = data->setter();
11884 v8::ToCData<v8::AccessorNameSetterCallback>(call_obj);
11885 if (call_fun ==
NULL)
return value;
11888 LOG(isolate, ApiNamedPropertyAccess(
"store", *
object, *key));
11890 args(isolate, data->data(), *
object, *holder);
11891 args.Call(call_fun,
11898 if (structure->IsAccessorPair()) {
11899 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
11900 if (setter->IsSpecFunction()) {
11905 if (strict_mode ==
SLOPPY)
return value;
11909 isolate, NewTypeError(
"no_setter_in_callback",
HandleVector(args, 2)),
11915 if (structure->IsDeclaredAccessorInfo())
return value;
11924 if (!elements()->IsFixedArray())
return false;
11925 FixedArray* elements = FixedArray::cast(this->elements());
11926 if (elements->
map() != heap->sloppy_arguments_elements_map()) {
11929 FixedArray* arguments = FixedArray::cast(elements->
get(1));
11930 return !arguments->IsDictionary();
11936 if (!elements()->IsFixedArray())
return false;
11937 FixedArray* elements = FixedArray::cast(this->elements());
11938 if (elements->
map() != heap->sloppy_arguments_elements_map()) {
11941 FixedArray* arguments = FixedArray::cast(elements->
get(1));
11942 return arguments->IsDictionary();
11953 bool check_prototype) {
11954 DCHECK(object->HasFastSmiOrObjectElements() ||
11955 object->HasFastArgumentsElements());
11957 Isolate* isolate =
object->GetIsolate();
11962 if (isolate->is_initial_object_prototype(*
object) ||
11963 isolate->is_initial_array_prototype(*
object)) {
11964 object->map()->dependent_code()->DeoptimizeDependentCodeGroup(isolate,
11969 if (backing_store->map() ==
11970 isolate->
heap()->sloppy_arguments_elements_map()) {
11971 backing_store =
handle(FixedArray::cast(backing_store->get(1)));
11973 backing_store = EnsureWritableFastElements(
object);
11977 if (check_prototype &&
11978 (index >= capacity || backing_store->get(index)->IsTheHole())) {
11981 object, index, value, &found, strict_mode);
11982 if (found)
return result;
11988 bool must_update_array_length =
false;
11989 bool introduces_holes =
true;
11990 if (object->IsJSArray()) {
11992 introduces_holes = index > array_length;
11993 if (index >= array_length) {
11994 must_update_array_length =
true;
11995 array_length = index + 1;
11998 introduces_holes = index >= capacity;
12003 ElementsKind elements_kind =
object->GetElementsKind();
12004 if (introduces_holes &&
12008 TransitionElementsKind(
object, transitioned_kind);
12013 if (index >= capacity) {
12014 bool convert_to_slow =
true;
12015 if ((index - capacity) < kMaxGap) {
12016 new_capacity = NewElementsCapacity(index + 1);
12017 DCHECK(new_capacity > index);
12018 if (!object->ShouldConvertToSlowElements(new_capacity)) {
12019 convert_to_slow =
false;
12022 if (convert_to_slow) {
12023 NormalizeElements(
object);
12024 return SetDictionaryElement(
object, index, value,
NONE, strict_mode,
12029 if (object->HasFastSmiElements() && !value->IsSmi() && value->IsNumber()) {
12035 UpdateAllocationSite(
object, to_kind);
12037 SetFastDoubleElementsCapacityAndLength(
object, new_capacity, array_length);
12038 FixedDoubleArray::cast(object->elements())->set(index, value->Number());
12043 if (object->HasFastSmiElements() && !value->IsSmi()) {
12048 UpdateAllocationSite(
object, kind);
12049 Handle<Map> new_map = GetElementsTransitionMap(
object, kind);
12054 if (new_capacity != capacity) {
12056 value->IsSmi() &&
object->HasFastSmiElements()
12057 ? kAllowSmiElements
12058 : kDontAllowSmiElements;
12060 SetFastElementsCapacityAndLength(
object, new_capacity, array_length,
12062 new_elements->set(index, *value);
12068 DCHECK(object->elements()->IsFixedArray());
12069 backing_store->set(index, *value);
12070 if (must_update_array_length) {
12083 bool check_prototype,
12085 DCHECK(object->HasDictionaryElements() ||
12086 object->HasDictionaryArgumentsElements());
12087 Isolate* isolate =
object->GetIsolate();
12091 bool is_arguments =
12092 (elements->map() == isolate->
heap()->sloppy_arguments_elements_map());
12094 ? SeededNumberDictionary::cast(elements->get(1))
12095 : SeededNumberDictionary::cast(*elements));
12097 int entry = dictionary->FindEntry(index);
12100 PropertyDetails details = dictionary->DetailsAt(entry);
12102 return SetElementWithCallback(
object, element, index, value,
object,
12105 dictionary->UpdateMaxNumberKey(index);
12110 details = PropertyDetails(
12111 attributes,
NORMAL, details.dictionary_index());
12112 dictionary->DetailsAtPut(entry, details);
12113 }
else if (details.IsReadOnly() && !element->IsTheHole()) {
12114 if (strict_mode ==
SLOPPY) {
12115 return isolate->
factory()->undefined_value();
12125 if (is_arguments && element->IsAliasedArgumentsEntry()) {
12129 int context_index = entry->aliased_context_slot();
12130 DCHECK(!context->get(context_index)->IsTheHole());
12131 context->set(context_index, *value);
12133 if (!details.IsReadOnly()) value = element;
12135 dictionary->ValueAtPut(entry, *value);
12140 if (check_prototype) {
12143 object, index, value, &found, strict_mode);
12144 if (found)
return result;
12149 if (!object->map()->is_extensible()) {
12150 if (strict_mode ==
SLOPPY) {
12151 return isolate->
factory()->undefined_value();
12162 PropertyDetails details = PropertyDetails(attributes,
NORMAL, 0);
12166 if (*dictionary != *new_dictionary) {
12167 if (is_arguments) {
12168 elements->set(1, *new_dictionary);
12170 object->set_elements(*new_dictionary);
12172 dictionary = new_dictionary;
12177 if (object->IsJSArray()) {
12183 if (object->ShouldConvertToFastElements()) {
12185 if (object->IsJSArray()) {
12188 new_length = dictionary->max_number_key() + 1;
12190 bool has_smi_only_elements =
false;
12191 bool should_convert_to_fast_double_elements =
12192 object->ShouldConvertToFastDoubleElements(&has_smi_only_elements);
12194 has_smi_only_elements ? kForceSmiElements : kAllowSmiElements;
12196 if (should_convert_to_fast_double_elements) {
12197 SetFastDoubleElementsCapacityAndLength(
object, new_length, new_length);
12199 SetFastElementsCapacityAndLength(
object, new_length, new_length,
12204 if (FLAG_trace_normalization) {
12206 os <<
"Object elements are fast case again:\n";
12219 bool check_prototype) {
12220 DCHECK(object->HasFastDoubleElements());
12227 if (check_prototype &&
12228 (index >= elms_length ||
12232 object, index, value, &found, strict_mode);
12233 if (found)
return result;
12238 bool value_is_smi = value->IsSmi();
12239 bool introduces_holes =
true;
12241 if (object->IsJSArray()) {
12243 introduces_holes = index >
length;
12245 introduces_holes = index >= elms_length;
12248 if (!value->IsNumber()) {
12249 SetFastElementsCapacityAndLength(
object, elms_length,
length,
12250 kDontAllowSmiElements);
12253 object->GetIsolate(), result,
12254 SetFastElement(
object, index, value, strict_mode, check_prototype),
12260 double double_value = value_is_smi
12266 ElementsKind elements_kind =
object->GetElementsKind();
12269 TransitionElementsKind(
object, transitioned_kind);
12273 if (index < elms_length) {
12275 elms->set(index, double_value);
12276 if (object->IsJSArray()) {
12281 if (index >= array_length) {
12289 if ((index - elms_length) < kMaxGap) {
12291 int new_capacity = NewElementsCapacity(index+1);
12292 if (!object->ShouldConvertToSlowElements(new_capacity)) {
12294 SetFastDoubleElementsCapacityAndLength(
object, new_capacity, index + 1);
12295 FixedDoubleArray::cast(object->elements())->set(index, double_value);
12302 DCHECK(object->HasFastDoubleElements());
12303 DCHECK(object->map()->has_fast_double_elements());
12304 DCHECK(object->elements()->IsFixedDoubleArray() ||
12305 object->elements()->length() == 0);
12307 NormalizeElements(
object);
12308 DCHECK(object->HasDictionaryElements());
12309 return SetElement(
object, index, value,
NONE, strict_mode, check_prototype);
12318 if (object->IsJSProxy()) {
12331 DCHECK(!object->HasExternalArrayElements());
12341 bool check_prototype,
12343 Isolate* isolate =
object->GetIsolate();
12345 if (object->HasExternalArrayElements() ||
12346 object->HasFixedTypedArrayElements()) {
12347 if (!value->IsNumber() && !value->IsUndefined()) {
12355 if (object->IsAccessCheckNeeded()) {
12363 if (object->IsJSGlobalProxy()) {
12365 if (iter.
IsAtEnd())
return value;
12369 value, attributes, strict_mode, check_prototype, set_mode);
12373 if ((object->HasExternalArrayElements() ||
12374 object->HasFixedTypedArrayElements()) &&
12378 THROW_NEW_ERROR(isolate, NewTypeError(
"redef_external_array_element",
12387 dictionary->set_requires_slow_elements();
12390 if (!object->map()->is_observed()) {
12391 return object->HasIndexedInterceptor()
12392 ? SetElementWithInterceptor(
object, index, value, attributes,
12393 strict_mode, check_prototype, set_mode)
12394 : SetElementWithoutInterceptor(
object, index, value, attributes,
12395 strict_mode, check_prototype, set_mode);
12407 if (old_attributes !=
ABSENT) {
12408 if (GetOwnElementAccessorPair(
object, index).is_null()) {
12411 }
else if (object->IsJSArray()) {
12421 object->HasIndexedInterceptor()
12422 ? SetElementWithInterceptor(
12423 object, index, value, attributes,
12424 strict_mode, check_prototype, set_mode)
12425 : SetElementWithoutInterceptor(
12426 object, index, value, attributes,
12427 strict_mode, check_prototype, set_mode),
12431 maybe = GetOwnElementAttribute(
object, index);
12435 if (old_attributes ==
ABSENT) {
12436 if (object->IsJSArray() &&
12437 !old_length_handle->SameValue(
12443 CHECK(old_length_handle->ToArrayIndex(&old_length));
12444 CHECK(new_length_handle->ToArrayIndex(&new_length));
12447 EnqueueChangeRecord(
object,
"add",
name, old_value);
12448 EnqueueChangeRecord(
object,
"update", isolate->
factory()->length_string(),
12449 old_length_handle);
12453 new_length - old_length);
12455 EnqueueChangeRecord(
object,
"add",
name, old_value);
12457 }
else if (old_value->IsTheHole()) {
12458 EnqueueChangeRecord(
object,
"reconfigure",
name, old_value);
12462 bool value_changed = !old_value->SameValue(*new_value);
12463 if (old_attributes != new_attributes) {
12464 if (!value_changed) old_value = isolate->
factory()->the_hole_value();
12465 EnqueueChangeRecord(
object,
"reconfigure",
name, old_value);
12466 }
else if (value_changed) {
12467 EnqueueChangeRecord(
object,
"update",
name, old_value);
12481 bool check_prototype,
12483 DCHECK(object->HasDictionaryElements() ||
12484 object->HasDictionaryArgumentsElements() ||
12486 Isolate* isolate =
object->GetIsolate();
12487 if (FLAG_trace_external_array_abuse &&
12491 if (FLAG_trace_js_array_abuse &&
12493 if (object->IsJSArray()) {
12499 if (strict_mode ==
SLOPPY) {
12505 switch (object->GetElementsKind()) {
12510 return SetFastElement(
object, index, value, strict_mode, check_prototype);
12513 return SetFastDoubleElement(
object, index, value, strict_mode,
12516 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
12517 case EXTERNAL_##TYPE##_ELEMENTS: { \
12518 Handle<External##Type##Array> array( \
12519 External##Type##Array::cast(object->elements())); \
12520 return External##Type##Array::SetValue(array, index, value); \
12522 case TYPE##_ELEMENTS: { \
12523 Handle<Fixed##Type##Array> array( \
12524 Fixed##Type##Array::cast(object->elements())); \
12525 return Fixed##Type##Array::SetValue(array, index, value); \
12530 #undef TYPED_ARRAY_CASE
12533 return SetDictionaryElement(
object, index, value, attributes, strict_mode,
12542 if (!probe.
is_null() && !probe->IsTheHole()) {
12545 DCHECK(!context->get(context_index)->IsTheHole());
12546 context->set(context_index, *value);
12549 parameter_map->set_the_hole(index + 2);
12553 isolate->
factory()->NewAliasedArgumentsEntry(context_index));
12557 if (arguments->IsDictionary()) {
12558 return SetDictionaryElement(
object, index, value, attributes,
12563 return SetFastElement(
object, index, value, strict_mode,
12571 return isolate->
factory()->null_value();
12579 set_pretenure_decision(kUndecided);
12580 set_memento_found_count(0);
12581 set_memento_create_count(0);
12593 DCHECK(FLAG_trace_track_allocation_sites);
12595 while (current->IsAllocationSite()) {
12597 if (current_site->nested_site() ==
this) {
12600 current = current_site->weak_next();
12608 Isolate* isolate = site->GetIsolate();
12610 if (site->SitePointsToLiteral() && site->transition_info()->IsJSArray()) {
12612 handle(JSArray::cast(site->transition_info()));
12613 ElementsKind kind = transition_info->GetElementsKind();
12622 CHECK(transition_info->length()->ToArrayIndex(&
length));
12623 if (
length <= kMaximumArrayBytesToPretransition) {
12624 if (FLAG_trace_track_allocation_sites) {
12625 bool is_nested = site->IsNestedSite();
12627 "AllocationSite: JSArray %p boilerplate %s updated %s->%s\n",
12628 reinterpret_cast<void*
>(*site),
12629 is_nested ?
"(nested)" :
"",
12634 site->dependent_code()->DeoptimizeDependentCodeGroup(
12645 if (FLAG_trace_track_allocation_sites) {
12646 PrintF(
"AllocationSite: JSArray %p site updated %s->%s\n",
12647 reinterpret_cast<void*
>(*site),
12651 site->SetElementsKind(to_kind);
12652 site->dependent_code()->DeoptimizeDependentCodeGroup(
12667 if (*codes != site->dependent_code()) site->set_dependent_code(*codes);
12673 switch (decision) {
12674 case kUndecided:
return "undecided";
12675 case kDontTenure:
return "don't tenure";
12676 case kMaybeTenure:
return "maybe tenure";
12677 case kTenure:
return "tenure";
12678 case kZombie:
return "zombie";
12687 if (!object->IsJSArray())
return;
12689 Heap* heap =
object->GetHeap();
12697 if (memento ==
NULL)
return;
12708 ElementsKind from_kind =
object->map()->elements_kind();
12714 if (from_kind == to_kind)
return;
12717 UpdateAllocationSite(
object, to_kind);
12720 Isolate* isolate =
object->GetIsolate();
12721 if (object->elements() == isolate->
heap()->empty_fixed_array() ||
12729 Handle<Map> new_map = GetElementsTransitionMap(
object, to_kind);
12730 MigrateToMap(
object, new_map);
12731 if (FLAG_trace_elements_transitions) {
12733 PrintElementsTransition(stdout,
object, from_kind, elms, to_kind, elms);
12742 if (object->IsJSArray()) {
12744 if (raw_length->IsUndefined()) {
12755 SetFastDoubleElementsCapacityAndLength(
object, capacity,
length);
12762 SetFastElementsCapacityAndLength(
object, capacity,
length,
12763 kDontAllowSmiElements);
12792 CHECK(array->length()->ToArrayIndex(&old_len));
12795 if (index >= old_len && index != 0xffffffff) {
12797 static_cast<double>(index) + 1);
12798 array->set_length(*len);
12804 Isolate* isolate = jsarray_map->GetIsolate();
12805 DCHECK(!jsarray_map->is_dictionary_map());
12806 LookupResult lookup(isolate);
12808 jsarray_map->LookupDescriptor(
NULL, *length_string, &lookup);
12809 return lookup.IsReadOnly();
12818 LookupIterator it(array, array->GetIsolate()->factory()->length_string(),
12819 LookupIterator::OWN_SKIP_INTERCEPTOR);
12820 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
12821 CHECK(it.IsFound());
12823 return it.IsReadOnly();
12830 Isolate* isolate = array->GetIsolate();
12843 Isolate* isolate =
object->GetIsolate();
12847 AssertNoContextChange ncc(isolate);
12850 if (!interceptor->getter()->IsUndefined()) {
12852 v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter());
12854 ApiIndexedPropertyAccess(
"interceptor-indexed-get", *
object, index));
12856 args(isolate, interceptor->data(), *receiver, *
object);
12861 result_internal->VerifyApiCallResultType();
12863 return handle(*result_internal, isolate);
12870 isolate, result, handler->
Get(receiver,
object, index),
12872 if (!result->IsTheHole())
return result;
12875 if (iter.
IsAtEnd())
return isolate->
factory()->undefined_value();
12884 GetElementsCapacityAndUsage(&capacity, &used);
12885 return (capacity == 0) || (used > (capacity / 2));
12893 FixedArrayBase* backing_store_base = FixedArrayBase::cast(elements());
12895 switch (GetElementsKind()) {
12897 backing_store_base =
12898 FixedArray::cast(FixedArray::cast(backing_store_base)->
get(1));
12899 backing_store = FixedArray::cast(backing_store_base);
12900 if (backing_store->IsDictionary()) {
12902 SeededNumberDictionary::cast(backing_store);
12903 *capacity = dictionary->
Capacity();
12911 *capacity = backing_store_base->
length();
12912 *used = Smi::cast(JSArray::cast(
this)->
length())->value();
12918 backing_store = FixedArray::cast(backing_store_base);
12919 *capacity = backing_store->
length();
12920 for (
int i = 0;
i < *capacity; ++
i) {
12921 if (!backing_store->
get(
i)->IsTheHole()) ++(*used);
12926 *capacity = dictionary->
Capacity();
12932 *capacity = backing_store_base->
length();
12933 *used = Smi::cast(JSArray::cast(
this)->
length())->value();
12938 *capacity = elements()->length();
12939 if (*capacity == 0)
break;
12941 for (
int i = 0;
i < *capacity;
i++) {
12947 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
12948 case EXTERNAL_##TYPE##_ELEMENTS: \
12949 case TYPE##_ELEMENTS: \
12952 #undef TYPED_ARRAY_CASE
12955 FixedArrayBase* external_array = FixedArrayBase::cast(elements());
12956 *capacity = external_array->
length();
12957 *used = external_array->
length();
12966 if (HasFastElements() && key->ToArrayIndex(&index)) {
12969 if (index >= capacity) {
12970 if ((index - capacity) >= kMaxGap)
return true;
12971 uint32_t new_capacity = NewElementsCapacity(index + 1);
12972 return ShouldConvertToSlowElements(new_capacity);
12981 kMaxUncheckedFastElementsLength);
12982 if (new_capacity <= kMaxUncheckedOldFastElementsLength ||
12983 (new_capacity <= kMaxUncheckedFastElementsLength &&
12984 GetHeap()->InNewSpace(
this))) {
12990 int old_capacity = 0;
12991 int used_elements = 0;
12992 GetElementsCapacityAndUsage(&old_capacity, &used_elements);
12995 return 3 * dictionary_size <= new_capacity;
13000 DCHECK(HasDictionaryElements() || HasDictionaryArgumentsElements());
13002 if (!HasDenseElements())
return false;
13005 if (IsAccessCheckNeeded())
return false;
13008 if (
map()->is_observed())
return false;
13010 FixedArray* elements = FixedArray::cast(this->elements());
13012 if (elements->
map() ==
GetHeap()->sloppy_arguments_elements_map()) {
13013 dictionary = SeededNumberDictionary::cast(elements->
get(1));
13015 dictionary = SeededNumberDictionary::cast(elements);
13031 return 2 * dictionary_size >= array_size;
13036 bool* has_smi_only_elements) {
13037 *has_smi_only_elements =
false;
13038 if (HasSloppyArgumentsElements())
return false;
13039 if (FLAG_unbox_double_arrays) {
13040 DCHECK(HasDictionaryElements());
13042 bool found_double =
false;
13043 for (
int i = 0;
i < dictionary->
Capacity();
i++) {
13045 if (key->IsNumber()) {
13047 if (!value->IsNumber())
return false;
13048 if (!value->IsSmi()) {
13049 found_double =
true;
13053 *has_smi_only_elements = !found_double;
13054 return found_double;
13066 #ifdef OBJECT_PRINT
13067 template <
typename Derived,
typename Shape,
typename Key>
13069 int capacity = DerivedHashTable::Capacity();
13070 for (
int i = 0;
i < capacity;
i++) {
13071 Object* k = DerivedHashTable::KeyAt(
i);
13072 if (DerivedHashTable::IsKey(k)) {
13074 if (k->IsString()) {
13075 String::cast(k)->StringPrint(os);
13079 os <<
": " << Brief(ValueAt(
i)) <<
"\n";
13086 template<
typename Derived,
typename Shape,
typename Key>
13089 int capacity = DerivedHashTable::Capacity();
13092 for (
int i = 0;
i < capacity;
i++) {
13095 elements->
set(pos++, ValueAt(
i),
mode);
13103 DCHECK(
map()->has_named_interceptor());
13104 JSFunction* constructor = JSFunction::cast(
map()->constructor());
13105 DCHECK(constructor->shared()->IsApiFunction());
13107 constructor->shared()->get_api_func_data()->named_property_handler();
13108 return InterceptorInfo::cast(result);
13113 DCHECK(
map()->has_indexed_interceptor());
13114 JSFunction* constructor = JSFunction::cast(
map()->constructor());
13115 DCHECK(constructor->shared()->IsApiFunction());
13117 constructor->shared()->get_api_func_data()->indexed_property_handler();
13118 return InterceptorInfo::cast(result);
13126 Isolate* isolate = holder->GetIsolate();
13129 if (
name->IsSymbol())
return isolate->
factory()->undefined_value();
13137 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter());
13139 ApiNamedPropertyAccess(
"interceptor-named-get", *holder, *
name));
13141 args(isolate, interceptor->data(), *receiver, *holder);
13148 result_internal->VerifyApiCallResultType();
13150 return handle(*result_internal, isolate);
13158 Isolate* isolate = receiver->GetIsolate();
13161 args(isolate, interceptor->data(), *receiver, *
object);
13163 if (!interceptor->enumerator()->IsUndefined()) {
13165 v8::ToCData<v8::NamedPropertyEnumeratorCallback>(
13166 interceptor->enumerator());
13167 LOG(isolate, ApiObjectAccess(
"interceptor-named-enum", *
object));
13168 result = args.Call(enum_fun);
13171 #if ENABLE_EXTRA_CHECKS
13183 Isolate* isolate = receiver->GetIsolate();
13186 args(isolate, interceptor->data(), *receiver, *
object);
13188 if (!interceptor->enumerator()->IsUndefined()) {
13190 v8::ToCData<v8::IndexedPropertyEnumeratorCallback>(
13191 interceptor->enumerator());
13192 LOG(isolate, ApiObjectAccess(
"interceptor-indexed-enum", *
object));
13193 result = args.Call(enum_fun);
13196 #if ENABLE_EXTRA_CHECKS
13207 LookupIterator it(
object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
13210 return maybe(it.IsFound());
13216 Isolate* isolate =
object->GetIsolate();
13219 if (object->IsAccessCheckNeeded()) {
13223 return maybe(
false);
13227 if (object->IsJSGlobalProxy()) {
13232 return HasRealElementProperty(
13237 GetElementAttributeWithoutInterceptor(
object,
object, index,
false);
13245 LookupIterator it(
object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
13253 if (HasFastProperties()) {
13262 return property_dictionary()->NumberOfElementsFilterAttributes(filter);
13270 if (
this != numbers) {
13271 temp = numbers->
get(
i);
13272 numbers->
set(
i, Smi::cast(numbers->
get(j)));
13273 numbers->
set(j, Smi::cast(temp));
13281 for (
int i = 1;
i < len;
i++) {
13298 for (
int i = 1;
i < len; ++
i) {
13299 int child_index =
i;
13300 while (child_index > 0) {
13301 int parent_index = ((child_index + 1) >> 1) - 1;
13304 if (parent_value < child_value) {
13305 content->
SwapPairs(numbers, parent_index, child_index);
13309 child_index = parent_index;
13314 for (
int i = len - 1;
i > 0; --
i) {
13318 int parent_index = 0;
13320 int child_index = ((parent_index + 1) << 1) - 1;
13321 if (child_index >=
i)
break;
13325 if (child_index + 1 >=
i || child1_value > child2_value) {
13326 if (parent_value > child1_value)
break;
13327 content->
SwapPairs(numbers, parent_index, child_index);
13328 parent_index = child_index;
13330 if (parent_value > child2_value)
break;
13331 content->
SwapPairs(numbers, parent_index, child_index + 1);
13332 parent_index = child_index + 1;
13351 for (
i = 1;
i < len;
i++) {
13358 if (max_index - min_index + 1 == len) {
13362 for (
i = 0;
i < len;
i++) {
13384 DCHECK(storage->
length() >= (NumberOfOwnProperties(filter) - index));
13385 if (HasFastProperties()) {
13388 for (
int i = 0;
i < real_size;
i++) {
13389 if ((descs->
GetDetails(
i).attributes() & filter) == 0 &&
13395 property_dictionary()->CopyKeysTo(storage,
13404 return GetOwnElementKeys(
NULL, filter);
13410 if (!IsJSValue() && HasFastObjectElements()) {
13413 Smi::cast(JSArray::cast(
this)->
length())->value()) :
13414 static_cast<uint32_t>(FixedArray::cast(elements())->length());
13415 if (
length == 0)
return 0;
13425 switch (GetElementsKind()) {
13430 int length = IsJSArray() ?
13431 Smi::cast(JSArray::cast(
this)->
length())->value() :
13432 FixedArray::cast(elements())->length();
13434 if (!FixedArray::cast(elements())->
get(
i)->IsTheHole()) {
13435 if (storage !=
NULL) {
13446 int length = IsJSArray() ?
13447 Smi::cast(JSArray::cast(
this)->
length())->value() :
13448 FixedArrayBase::cast(elements())->length();
13450 if (!FixedDoubleArray::cast(elements())->
is_the_hole(
i)) {
13451 if (storage !=
NULL) {
13461 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
13462 case EXTERNAL_##TYPE##_ELEMENTS: \
13463 case TYPE##_ELEMENTS: \
13466 #undef TYPED_ARRAY_CASE
13468 int length = FixedArrayBase::cast(elements())->length();
13469 while (counter <
length) {
13470 if (storage !=
NULL) {
13480 if (storage !=
NULL) {
13481 element_dictionary()->CopyKeysTo(storage,
13485 counter += element_dictionary()->NumberOfElementsFilterAttributes(filter);
13489 FixedArray* parameter_map = FixedArray::cast(elements());
13490 int mapped_length = parameter_map->
length() - 2;
13491 FixedArray* arguments = FixedArray::cast(parameter_map->
get(1));
13492 if (arguments->IsDictionary()) {
13496 SeededNumberDictionary::cast(arguments);
13497 if (storage !=
NULL) {
13502 for (
int i = 0;
i < mapped_length; ++
i) {
13503 if (!parameter_map->
get(
i + 2)->IsTheHole()) {
13511 int backing_length = arguments->
length();
13513 for (;
i < mapped_length; ++
i) {
13514 if (!parameter_map->
get(
i + 2)->IsTheHole()) {
13517 }
else if (i < backing_length && !arguments->
get(
i)->IsTheHole()) {
13522 for (;
i < backing_length; ++
i) {
13531 if (this->IsJSValue()) {
13532 Object* val = JSValue::cast(
this)->value();
13533 if (val->IsString()) {
13534 String* str = String::cast(val);
13536 for (
int i = 0;
i < str->
length();
i++) {
13540 counter += str->
length();
13559 int scope_position)
13562 strict_mode_(strict_mode),
13563 scope_position_(scope_position) { }
13567 if (!other->IsFixedArray())
return false;
13568 FixedArray* other_array = FixedArray::cast(other);
13570 if (shared != *shared_)
return false;
13571 int strict_unchecked = Smi::cast(other_array->
get(2))->value();
13574 if (strict_mode != strict_mode_)
return false;
13575 int scope_position = Smi::cast(other_array->
get(3))->value();
13576 if (scope_position != scope_position_)
return false;
13577 String* source = String::cast(other_array->
get(1));
13578 return source->
Equals(*source_);
13584 int scope_position) {
13592 Script* script(Script::cast(shared->script()));
13593 hash ^= String::cast(script->source())->Hash();
13594 if (strict_mode ==
STRICT) hash ^= 0x8000;
13595 hash += scope_position;
13601 return StringSharedHashHelper(*source_, *shared_, strict_mode_,
13607 FixedArray* other_array = FixedArray::cast(obj);
13609 String* source = String::cast(other_array->
get(1));
13610 int strict_unchecked = Smi::cast(other_array->
get(2))->value();
13613 int scope_position = Smi::cast(other_array->
get(3))->value();
13614 return StringSharedHashHelper(
13615 source, shared, strict_mode, scope_position);
13621 array->set(0, *shared_);
13622 array->set(1, *source_);
13641 flags_(
Smi::FromInt(
flags.value())) { }
13669 return string->Hash() +
flags->value();
13678 if (hash_field_ == 0)
Hash();
13679 return isolate->
factory()->NewOneByteInternalizedString(string_, hash_field_);
13684 if (hash_field_ == 0)
Hash();
13685 return isolate->
factory()->NewTwoByteInternalizedString(string_, hash_field_);
13690 if (hash_field_ == 0)
Hash();
13691 return isolate->
factory()->NewOneByteInternalizedSubString(
13692 string_, from_, length_, hash_field_);
13698 return String::cast(
string)->IsOneByteEqualTo(chars);
13706 : string_(string) { }
13709 return String::cast(
string)->Equals(*string_);
13715 return String::cast(other)->Hash();
13721 isolate->factory()->InternalizedStringMapForString(string_);
13723 if (maybe_map.ToHandle(&
map)) {
13725 DCHECK(string_->IsInternalizedString());
13729 return isolate->factory()->NewInternalizedStringImpl(
13730 string_, string_->length(), string_->hash_field());
13734 return String::cast(obj)->Hash();
13741 template<
typename Derived,
typename Shape,
typename Key>
13747 template<
typename Derived,
typename Shape,
typename Key>
13750 kElementsStartOffset,
13755 template<
typename Derived,
typename Shape,
typename Key>
13758 int at_least_space_for,
13761 DCHECK(0 <= at_least_space_for);
13764 ? at_least_space_for
13765 : ComputeCapacity(at_least_space_for);
13770 Factory* factory = isolate->
factory();
13771 int length = EntryToIndex(capacity);
13773 array->set_map_no_write_barrier(*factory->hash_table_map());
13776 table->SetNumberOfElements(0);
13777 table->SetNumberOfDeletedElements(0);
13778 table->SetCapacity(capacity);
13785 if (!key->IsUniqueName()) {
13786 return DerivedHashTable::FindEntry(key);
13800 uint32_t entry = FirstProbe(key->Hash(), capacity);
13804 int index = EntryToIndex(entry);
13806 if (element->IsUndefined())
break;
13807 if (*key == element)
return entry;
13808 if (!element->IsUniqueName() &&
13809 !element->IsTheHole() &&
13810 Name::cast(element)->Equals(*key)) {
13816 DCHECK(element->IsTheHole() || !Name::cast(element)->Equals(*key));
13817 entry = NextProbe(entry, count++, capacity);
13823 template<
typename Derived,
typename Shape,
typename Key>
13827 DCHECK(NumberOfElements() < new_table->Capacity());
13833 for (
int i = kPrefixStartIndex;
13834 i < kPrefixStartIndex + Shape::kPrefixSize;
13840 int capacity = Capacity();
13841 for (
int i = 0;
i < capacity;
i++) {
13847 EntryToIndex(new_table->FindInsertionEntry(hash));
13848 for (
int j = 0; j < Shape::kEntrySize; j++) {
13849 new_table->set(insertion_index + j,
get(from_index + j),
mode);
13853 new_table->SetNumberOfElements(NumberOfElements());
13854 new_table->SetNumberOfDeletedElements(0);
13858 template<
typename Derived,
typename Shape,
typename Key>
13866 uint32_t entry = FirstProbe(hash, capacity);
13867 for (
int i = 1;
i < probe;
i++) {
13868 if (entry == expected)
return expected;
13869 entry = NextProbe(entry,
i, capacity);
13875 template<
typename Derived,
typename Shape,
typename Key>
13879 int index1 = EntryToIndex(entry1);
13880 int index2 = EntryToIndex(entry2);
13881 Object* temp[Shape::kEntrySize];
13882 for (
int j = 0; j < Shape::kEntrySize; j++) {
13883 temp[j] =
get(index1 + j);
13885 for (
int j = 0; j < Shape::kEntrySize; j++) {
13888 for (
int j = 0; j < Shape::kEntrySize; j++) {
13889 set(index2 + j, temp[j],
mode);
13894 template<
typename Derived,
typename Shape,
typename Key>
13900 for (
int probe = 1; !done; probe++) {
13904 for (
uint32_t current = 0; current < capacity; current++) {
13905 Object* current_key =
get(EntryToIndex(current));
13906 if (IsKey(current_key)) {
13907 uint32_t target = EntryForProbe(key, current_key, probe, current);
13908 if (current == target)
continue;
13909 Object* target_key =
get(EntryToIndex(target));
13910 if (!IsKey(target_key) ||
13911 EntryForProbe(key, target_key, probe, target) != target) {
13913 Swap(current, target,
mode);
13927 template<
typename Derived,
typename Shape,
typename Key>
13933 Isolate* isolate = table->GetIsolate();
13934 int capacity = table->Capacity();
13935 int nof = table->NumberOfElements() + n;
13936 int nod = table->NumberOfDeletedElements();
13940 if (nod <= (capacity - nof) >> 1) {
13941 int needed_free = nof >> 1;
13942 if (nof + needed_free <= capacity)
return table;
13945 const int kMinCapacityForPretenure = 256;
13946 bool should_pretenure = pretenure ==
TENURED ||
13947 ((capacity > kMinCapacityForPretenure) &&
13955 table->Rehash(new_table, key);
13960 template<
typename Derived,
typename Shape,
typename Key>
13963 int capacity = table->Capacity();
13964 int nof = table->NumberOfElements();
13968 if (nof > (capacity >> 2))
return table;
13973 int at_least_room_for = nof;
13974 if (at_least_room_for < 16)
return table;
13976 Isolate* isolate = table->GetIsolate();
13977 const int kMinCapacityForPretenure = 256;
13979 (at_least_room_for > kMinCapacityForPretenure) &&
13987 table->Rehash(new_table, key);
13992 template<
typename Derived,
typename Shape,
typename Key>
13995 uint32_t entry = FirstProbe(hash, capacity);
13999 Object* element = KeyAt(entry);
14000 if (element->IsUndefined() || element->IsTheHole())
break;
14001 entry = NextProbe(entry, count++, capacity);
14060 SlowReverseLookup(
Object* value);
14147 NumberOfEnumElements();
14156 DCHECK(object->HasDictionaryElements());
14157 Isolate* isolate =
object->GetIsolate();
14167 int capacity = dict->Capacity();
14172 for (
int i = 0;
i < capacity;
i++) {
14174 if (!dict->IsKey(k))
continue;
14177 DCHECK(!k->IsSmi() || Smi::cast(k)->value() >= 0);
14178 DCHECK(!k->IsHeapNumber() || HeapNumber::cast(k)->value() >= 0);
14183 PropertyDetails details = dict->DetailsAt(
i);
14184 if (details.type() ==
CALLBACKS || details.IsReadOnly()) {
14192 if (value->IsUndefined()) {
14200 new_dict, pos, value, details);
14201 DCHECK(result.is_identical_to(new_dict));
14211 new_dict, key, value, details);
14212 DCHECK(result.is_identical_to(new_dict));
14218 PropertyDetails no_details = PropertyDetails(
NONE,
NORMAL, 0);
14219 while (undefs > 0) {
14227 new_dict, pos, isolate->
factory()->undefined_value(), no_details);
14228 DCHECK(result.is_identical_to(new_dict));
14234 object->set_elements(*new_dict);
14237 return isolate->
factory()->NewNumberFromUint(result);
14247 Isolate* isolate =
object->GetIsolate();
14248 if (object->HasSloppyArgumentsElements() ||
14249 object->map()->is_observed()) {
14253 if (object->HasDictionaryElements()) {
14257 if (object->IsJSArray() || dict->requires_slow_elements() ||
14258 dict->max_number_key() >= limit) {
14269 isolate->
factory()->NewFixedArray(dict->NumberOfElements(), tenure);
14270 dict->CopyValuesTo(*fast_elements);
14274 }
else if (object->HasExternalArrayElements() ||
14275 object->HasFixedTypedArrayElements()) {
14278 FixedArrayBase::cast(object->elements())->length()), isolate);
14279 }
else if (!object->HasFastDoubleElements()) {
14280 EnsureWritableFastElements(
object);
14282 DCHECK(object->HasFastSmiOrObjectElements() ||
14283 object->HasFastDoubleElements());
14289 uint32_t elements_length =
static_cast<uint32_t>(elements_base->length());
14290 if (limit > elements_length) {
14291 limit = elements_length ;
14298 if (elements_base->map() == isolate->
heap()->fixed_double_array_map()) {
14301 unsigned int holes = limit;
14304 for (
unsigned int i = 0;
i < holes;
i++) {
14311 while (holes >
i) {
14321 while (holes < limit) {
14326 FixedArray* elements = FixedArray::cast(*elements_base);
14332 unsigned int undefs = limit;
14333 unsigned int holes = limit;
14336 for (
unsigned int i = 0;
i < undefs;
i++) {
14338 if (current->IsTheHole()) {
14341 }
else if (current->IsUndefined()) {
14347 while (undefs >
i) {
14348 current = elements->
get(undefs);
14349 if (current->IsTheHole()) {
14352 }
else if (current->IsUndefined()) {
14355 elements->
set(
i, current, write_barrier);
14361 while (undefs < holes) {
14365 while (holes < limit) {
14371 return isolate->
factory()->NewNumberFromUint(result);
14376 switch (elements()->
map()->instance_type()) {
14377 #define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \
14378 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
14379 case FIXED_##TYPE##_ARRAY_TYPE: \
14380 return kExternal##Type##Array;
14383 #undef INSTANCE_TYPE_TO_ARRAY_TYPE
14393 switch (elements()->
map()->instance_type()) {
14394 #define INSTANCE_TYPE_TO_ELEMENT_SIZE(Type, type, TYPE, ctype, size) \
14395 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
14399 #undef INSTANCE_TYPE_TO_ELEMENT_SIZE
14412 uint8_t clamped_value = 0;
14413 if (index <
static_cast<uint32_t>(array->length())) {
14414 if (value->IsSmi()) {
14416 if (int_value < 0) {
14418 }
else if (int_value > 255) {
14419 clamped_value = 255;
14421 clamped_value =
static_cast<uint8_t
>(int_value);
14423 }
else if (value->IsHeapNumber()) {
14425 if (!(double_value > 0)) {
14428 }
else if (double_value > 255) {
14430 clamped_value = 255;
14433 clamped_value =
static_cast<uint8_t
>(lrint(double_value));
14438 DCHECK(value->IsUndefined());
14440 array->set(index, clamped_value);
14446 template<
typename ExternalArrayClass,
typename ValueType>
14452 ValueType cast_value = 0;
14453 if (index <
static_cast<uint32_t>(receiver->length())) {
14454 if (value->IsSmi()) {
14456 cast_value =
static_cast<ValueType
>(int_value);
14457 }
else if (value->IsHeapNumber()) {
14459 cast_value =
static_cast<ValueType
>(
DoubleToInt32(double_value));
14463 DCHECK(value->IsUndefined());
14465 receiver->set(index, cast_value);
14467 return isolate->
factory()->NewNumberFromInt(cast_value);
14474 return ExternalArrayIntSetter<ExternalInt8Array, int8_t>(
14475 array->GetIsolate(), array, index, value);
14482 return ExternalArrayIntSetter<ExternalUint8Array, uint8_t>(
14483 array->GetIsolate(), array, index, value);
14490 return ExternalArrayIntSetter<ExternalInt16Array, int16_t>(
14491 array->GetIsolate(), array, index, value);
14498 return ExternalArrayIntSetter<ExternalUint16Array, uint16_t>(
14499 array->GetIsolate(), array, index, value);
14506 return ExternalArrayIntSetter<ExternalInt32Array, int32_t>(
14507 array->GetIsolate(), array, index, value);
14516 if (index <
static_cast<uint32_t>(array->length())) {
14517 if (value->IsSmi()) {
14519 cast_value =
static_cast<uint32_t>(int_value);
14520 }
else if (value->IsHeapNumber()) {
14526 DCHECK(value->IsUndefined());
14528 array->set(index, cast_value);
14530 return array->GetIsolate()->factory()->NewNumberFromUint(cast_value);
14539 if (index <
static_cast<uint32_t>(array->length())) {
14540 if (value->IsSmi()) {
14542 cast_value =
static_cast<float>(int_value);
14543 }
else if (value->IsHeapNumber()) {
14545 cast_value =
static_cast<float>(double_value);
14549 DCHECK(value->IsUndefined());
14551 array->set(index, cast_value);
14553 return array->GetIsolate()->factory()->NewNumber(cast_value);
14562 if (index <
static_cast<uint32_t>(array->length())) {
14563 if (value->IsNumber()) {
14564 double_value = value->Number();
14568 DCHECK(value->IsUndefined());
14570 array->set(index, double_value);
14572 return array->GetIsolate()->factory()->NewNumber(double_value);
14579 DCHECK(!global->HasFastProperties());
14580 int entry = global->property_dictionary()->FindEntry(
name);
14582 Isolate* isolate = global->GetIsolate();
14584 isolate->
factory()->the_hole_value());
14586 details = details.AsDeleted();
14588 handle(global->property_dictionary()),
name, cell, details);
14589 global->set_properties(*dictionary);
14592 Object* value = global->property_dictionary()->ValueAt(entry);
14593 DCHECK(value->IsPropertyCell());
14594 return handle(PropertyCell::cast(value));
14607 : c1_(c1), c2_(c2) {
14611 hash += hash << 10;
14615 hash += hash << 10;
14619 hash ^= hash >> 11;
14620 hash += hash << 15;
14636 if (!o->IsString())
return false;
14637 String* other = String::cast(o);
14638 if (other->
length() != 2)
return false;
14639 if (other->Get(0) != c1_)
return false;
14640 return other->Get(1) == c2_;
14645 if (!key->IsString())
return 0;
14646 return String::cast(key)->Hash();
14666 if (string->IsInternalizedString()) {
14669 return LookupStringIfExists(isolate,
string);
14678 int entry = string_table->FindEntry(&key);
14679 if (entry == kNotFound) {
14682 Handle<String> result(String::cast(string_table->KeyAt(entry)), isolate);
14683 DCHECK(StringShape(*result).IsInternalized());
14695 int entry = string_table->FindEntry(&key);
14696 if (entry == kNotFound) {
14699 Handle<String> result(String::cast(string_table->KeyAt(entry)), isolate);
14700 DCHECK(StringShape(*result).IsInternalized());
14709 return LookupKey(isolate, &key);
14715 int entry = table->FindEntry(key);
14718 if (entry != kNotFound) {
14719 return handle(String::cast(table->KeyAt(entry)), isolate);
14729 CHECK(!
string.is_null());
14732 entry = table->FindInsertionEntry(key->
Hash());
14733 table->set(EntryToIndex(entry), *
string);
14734 table->ElementAdded();
14736 isolate->
factory()->set_string_table(table);
14747 int entry = FindEntry(&key);
14748 if (entry == kNotFound)
return isolate->
factory()->undefined_value();
14756 int scope_position) {
14760 int entry = FindEntry(&key);
14761 if (entry == kNotFound)
return isolate->
factory()->undefined_value();
14771 int entry = FindEntry(&key);
14772 if (entry == kNotFound)
return isolate->
factory()->undefined_value();
14780 Isolate* isolate = cache->GetIsolate();
14784 cache = EnsureCapacity(cache, 1, &key);
14786 int entry = cache->FindInsertionEntry(key.
Hash());
14787 cache->set(EntryToIndex(entry), *k);
14788 cache->set(EntryToIndex(entry) + 1, *value);
14789 cache->ElementAdded();
14797 int scope_position) {
14798 Isolate* isolate = cache->GetIsolate();
14800 StringSharedKey key(src, shared, value->strict_mode(), scope_position);
14801 cache = EnsureCapacity(cache, 1, &key);
14803 int entry = cache->FindInsertionEntry(key.
Hash());
14804 cache->set(EntryToIndex(entry), *k);
14805 cache->set(EntryToIndex(entry) + 1, *value);
14806 cache->ElementAdded();
14815 cache = EnsureCapacity(cache, 1, &key);
14816 int entry = cache->FindInsertionEntry(key.
Hash());
14819 cache->set(EntryToIndex(entry), *value);
14820 cache->set(EntryToIndex(entry) + 1, *value);
14821 cache->ElementAdded();
14829 for (
int entry = 0,
size = Capacity(); entry <
size; entry++) {
14830 int entry_index = EntryToIndex(entry);
14831 int value_index = entry_index + 1;
14832 if (
get(value_index) == value) {
14849 int len = strings_->length();
14850 if (o->
length() != len)
return false;
14851 for (
int i = 0;
i < len;
i++) {
14852 if (o->
get(
i) != strings_->get(
i))
return false;
14860 FixedArray* strings = FixedArray::cast(obj);
14861 int len = strings->
length();
14863 for (
int i = 0;
i < len;
i++) {
14864 hash ^= String::cast(strings->
get(
i))->Hash();
14879 int entry = FindEntry(&key);
14880 if (entry == kNotFound)
return GetHeap()->undefined_value();
14881 return get(EntryToIndex(entry) + 1);
14890 int entry = new_cache->FindInsertionEntry(key.
Hash());
14891 new_cache->set(EntryToIndex(entry), *array);
14892 new_cache->set(EntryToIndex(entry) + 1, *value);
14893 new_cache->ElementAdded();
14898 template<
typename Derived,
typename Shape,
typename Key>
14901 int at_least_space_for,
14903 DCHECK(0 <= at_least_space_for);
14905 at_least_space_for,
14910 dict->SetNextEnumerationIndex(PropertyDetails::kInitialIndex);
14915 template<
typename Derived,
typename Shape,
typename Key>
14918 Factory* factory = dictionary->GetIsolate()->factory();
14919 int length = dictionary->NumberOfElements();
14931 int capacity = dictionary->Capacity();
14933 for (
int i = 0;
i < capacity;
i++) {
14934 if (dictionary->IsKey(dictionary->KeyAt(
i))) {
14935 int index = dictionary->DetailsAt(
i).dictionary_index();
14941 iteration_order->SortPairs(*enumeration_order, enumeration_order->length());
14945 int index = Smi::cast(iteration_order->get(
i))->value();
14946 int enum_index = PropertyDetails::kInitialIndex +
i;
14947 enumeration_order->set(index,
Smi::FromInt(enum_index));
14951 capacity = dictionary->Capacity();
14953 for (
int i = 0;
i < capacity;
i++) {
14954 if (dictionary->IsKey(dictionary->KeyAt(
i))) {
14955 int enum_index = Smi::cast(enumeration_order->get(pos++))->value();
14956 PropertyDetails details = dictionary->DetailsAt(
i);
14957 PropertyDetails new_details = PropertyDetails(
14958 details.attributes(), details.type(), enum_index);
14959 dictionary->DetailsAtPut(
i, new_details);
14964 dictionary->SetNextEnumerationIndex(PropertyDetails::kInitialIndex+
length);
14968 template<
typename Derived,
typename Shape,
typename Key>
14972 if (Shape::kIsEnumerable &&
14973 !PropertyDetails::IsValidIndex(dictionary->NextEnumerationIndex() + n)) {
14975 GenerateNewEnumerationIndices(dictionary);
14977 return DerivedHashTable::EnsureCapacity(dictionary, n, key);
14981 template<
typename Derived,
typename Shape,
typename Key>
14986 Factory* factory = dictionary->GetIsolate()->factory();
14987 PropertyDetails details = dictionary->DetailsAt(entry);
14990 return factory->false_value();
14993 dictionary->SetEntry(
14994 entry, factory->the_hole_value(), factory->the_hole_value());
14995 dictionary->ElementRemoved();
14996 return factory->true_value();
15000 template<
typename Derived,
typename Shape,
typename Key>
15003 int entry = dictionary->FindEntry(key);
15007 dictionary->ValueAtPut(entry, *value);
15012 dictionary = EnsureCapacity(dictionary, 1, key);
15014 USE(Shape::AsHandle(dictionary->GetIsolate(), key));
15016 PropertyDetails details = PropertyDetails(
NONE,
NORMAL, 0);
15018 AddEntry(dictionary, key, value, details, dictionary->Hash(key));
15023 template<
typename Derived,
typename Shape,
typename Key>
15028 PropertyDetails details) {
15032 dictionary = EnsureCapacity(dictionary, 1, key);
15034 AddEntry(dictionary, key, value, details, dictionary->Hash(key));
15040 template<
typename Derived,
typename Shape,
typename Key>
15045 PropertyDetails details,
15048 Handle<Object> k = Shape::AsHandle(dictionary->GetIsolate(), key);
15050 uint32_t entry = dictionary->FindInsertionEntry(hash);
15052 if (!details.IsDeleted() &&
15053 details.dictionary_index() == 0 &&
15054 Shape::kIsEnumerable) {
15057 int index = dictionary->NextEnumerationIndex();
15058 details = PropertyDetails(details.attributes(), details.type(), index);
15059 dictionary->SetNextEnumerationIndex(index + 1);
15061 dictionary->SetEntry(entry, k, value, details);
15062 DCHECK((dictionary->KeyAt(entry)->IsNumber() ||
15063 dictionary->KeyAt(entry)->IsName()));
15064 dictionary->ElementAdded();
15072 if (requires_slow_elements())
return;
15075 if (key > kRequiresSlowElementsLimit) {
15076 set_requires_slow_elements();
15080 Object* max_index_object =
get(kMaxNumberKeyIndex);
15081 if (!max_index_object->IsSmi() || max_number_key() < key) {
15092 PropertyDetails details) {
15093 dictionary->UpdateMaxNumberKey(key);
15094 SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound);
15095 return Add(dictionary, key, value, details);
15103 SLOW_DCHECK(dictionary->FindEntry(key) == kNotFound);
15104 return Add(dictionary, key, value, PropertyDetails(
NONE,
NORMAL, 0));
15112 dictionary->UpdateMaxNumberKey(key);
15113 return AtPut(dictionary, key, value);
15121 return AtPut(dictionary, key, value);
15129 PropertyDetails details) {
15130 int entry = dictionary->FindEntry(key);
15131 if (entry == kNotFound) {
15132 return AddNumberEntry(dictionary, key, value, details);
15135 details = PropertyDetails(details.attributes(),
15137 dictionary->DetailsAt(entry).dictionary_index());
15140 dictionary->SetEntry(entry, object_key, value, details);
15149 int entry = dictionary->FindEntry(key);
15150 if (entry == kNotFound)
return AddNumberEntry(dictionary, key, value);
15153 dictionary->SetEntry(entry, object_key, value);
15159 template<
typename Derived,
typename Shape,
typename Key>
15162 int capacity = DerivedHashTable::Capacity();
15164 for (
int i = 0;
i < capacity;
i++) {
15165 Object* k = DerivedHashTable::KeyAt(
i);
15166 if (DerivedHashTable::IsKey(k) && !
FilterKey(k, filter)) {
15167 PropertyDetails details = DetailsAt(
i);
15168 if (details.IsDeleted())
continue;
15170 if ((attr & filter) == 0) result++;
15177 template<
typename Derived,
typename Shape,
typename Key>
15179 return NumberOfElementsFilterAttributes(
15184 template<
typename Derived,
typename Shape,
typename Key>
15189 DCHECK(storage->
length() >= NumberOfElementsFilterAttributes(filter));
15190 int capacity = DerivedHashTable::Capacity();
15192 for (
int i = 0;
i < capacity;
i++) {
15193 Object* k = DerivedHashTable::KeyAt(
i);
15194 if (DerivedHashTable::IsKey(k) && !
FilterKey(k, filter)) {
15195 PropertyDetails details = DetailsAt(
i);
15196 if (details.IsDeleted())
continue;
15198 if ((attr & filter) == 0) storage->
set(index++, k);
15211 PropertyDetails
da(dict->DetailsAt(a->
value()));
15212 PropertyDetails
db(dict->DetailsAt(b->
value()));
15213 return da.dictionary_index() <
db.dictionary_index();
15221 int capacity = Capacity();
15222 int properties = 0;
15223 for (
int i = 0;
i < capacity;
i++) {
15225 if (IsKey(k) && !k->IsSymbol()) {
15226 PropertyDetails details = DetailsAt(
i);
15227 if (details.IsDeleted() || details.IsDontEnum())
continue;
15230 if (properties ==
length)
break;
15236 std::sort(start, start +
length, cmp);
15238 int index = Smi::cast(storage->
get(
i))->value();
15239 storage->
set(
i, KeyAt(index));
15244 template<
typename Derived,
typename Shape,
typename Key>
15250 DCHECK(storage->
length() >= NumberOfElementsFilterAttributes(filter));
15251 int capacity = DerivedHashTable::Capacity();
15252 for (
int i = 0;
i < capacity;
i++) {
15253 Object* k = DerivedHashTable::KeyAt(
i);
15254 if (DerivedHashTable::IsKey(k) && !
FilterKey(k, filter)) {
15255 PropertyDetails details = DetailsAt(
i);
15256 if (details.IsDeleted())
continue;
15258 if ((attr & filter) == 0) storage->
set(index++, k);
15269 template<
typename Derived,
typename Shape,
typename Key>
15271 int capacity = DerivedHashTable::Capacity();
15272 for (
int i = 0;
i < capacity;
i++) {
15273 Object* k = DerivedHashTable::KeyAt(
i);
15276 if (e->IsPropertyCell()) {
15277 e = PropertyCell::cast(e)->value();
15279 if (e == value)
return k;
15283 return heap->undefined_value();
15292 Object* hash = key->GetHash();
15293 if (hash->IsUndefined()) {
15294 return GetHeap()->the_hole_value();
15296 int entry = FindEntry(key);
15297 if (entry == kNotFound)
return GetHeap()->the_hole_value();
15298 return get(EntryToIndex(entry) + 1);
15305 DCHECK(table->IsKey(*key));
15306 DCHECK(!value->IsTheHole());
15308 Isolate* isolate = table->GetIsolate();
15313 int entry = table->FindEntry(key);
15316 if (entry != kNotFound) {
15317 table->set(EntryToIndex(entry) + 1, *value);
15322 table = EnsureCapacity(table, 1, key);
15323 table->AddEntry(table->FindInsertionEntry(hash->value()),
15332 bool* was_present) {
15333 DCHECK(table->IsKey(*key));
15335 Object* hash = key->GetHash();
15336 if (hash->IsUndefined()) {
15337 *was_present =
false;
15341 int entry = table->FindEntry(key);
15342 if (entry == kNotFound) {
15343 *was_present =
false;
15347 *was_present =
true;
15348 table->RemoveEntry(entry);
15349 return Shrink(table, key);
15354 set(EntryToIndex(entry), key);
15355 set(EntryToIndex(entry) + 1, value);
15370 int entry = FindEntry(key);
15371 if (entry == kNotFound)
return GetHeap()->the_hole_value();
15372 return get(EntryToValueIndex(entry));
15379 DCHECK(table->IsKey(*key));
15380 int entry = table->FindEntry(key);
15382 if (entry != kNotFound) {
15391 table = EnsureCapacity(table, 1, key,
TENURED);
15393 table->AddEntry(table->FindInsertionEntry(table->Hash(key)), key, value);
15411 template<
class Derived,
class Iterator,
int entrysize>
15420 if (capacity > kMaxCapacity) {
15423 int num_buckets = capacity / kLoadFactor;
15425 kHashTableStartIndex + num_buckets + (capacity * kEntrySize), pretenure);
15426 backing_store->set_map_no_write_barrier(
15427 isolate->
heap()->ordered_hash_table_map());
15429 for (
int i = 0;
i < num_buckets; ++
i) {
15430 table->set(kHashTableStartIndex +
i,
Smi::FromInt(kNotFound));
15432 table->SetNumberOfBuckets(num_buckets);
15433 table->SetNumberOfElements(0);
15434 table->SetNumberOfDeletedElements(0);
15439 template<
class Derived,
class Iterator,
int entrysize>
15442 DCHECK(!table->IsObsolete());
15444 int nof = table->NumberOfElements();
15445 int nod = table->NumberOfDeletedElements();
15446 int capacity = table->Capacity();
15447 if ((nof + nod) < capacity)
return table;
15451 return Rehash(table, (nod < (capacity >> 1)) ? capacity << 1 : capacity);
15455 template<
class Derived,
class Iterator,
int entrysize>
15458 DCHECK(!table->IsObsolete());
15460 int nof = table->NumberOfElements();
15461 int capacity = table->Capacity();
15462 if (nof >= (capacity >> 2))
return table;
15463 return Rehash(table, capacity / 2);
15467 template<
class Derived,
class Iterator,
int entrysize>
15470 DCHECK(!table->IsObsolete());
15473 Allocate(table->GetIsolate(),
15477 table->SetNextTable(*new_table);
15478 table->SetNumberOfDeletedElements(-1);
15484 template<
class Derived,
class Iterator,
int entrysize>
15487 int entry = table->FindEntry(key);
15488 if (entry == kNotFound) {
15489 *was_present =
false;
15492 *was_present =
true;
15493 table->RemoveEntry(entry);
15498 template<
class Derived,
class Iterator,
int entrysize>
15501 DCHECK(!table->IsObsolete());
15504 Allocate(table->GetIsolate(),
15507 int nof = table->NumberOfElements();
15508 int nod = table->NumberOfDeletedElements();
15509 int new_buckets = new_table->NumberOfBuckets();
15511 int removed_holes_index = 0;
15513 for (
int old_entry = 0; old_entry < (nof + nod); ++old_entry) {
15514 Object* key = table->KeyAt(old_entry);
15515 if (key->IsTheHole()) {
15516 table->SetRemovedIndexAt(removed_holes_index++, old_entry);
15521 int bucket = Smi::cast(hash)->value() & (new_buckets - 1);
15522 Object* chain_entry = new_table->get(kHashTableStartIndex + bucket);
15523 new_table->set(kHashTableStartIndex + bucket,
Smi::FromInt(new_entry));
15524 int new_index = new_table->EntryToIndex(new_entry);
15525 int old_index = table->EntryToIndex(old_entry);
15526 for (
int i = 0;
i < entrysize; ++
i) {
15527 Object* value = table->get(old_index +
i);
15528 new_table->set(new_index +
i, value);
15530 new_table->set(new_index + kChainOffset, chain_entry);
15536 new_table->SetNumberOfElements(nof);
15537 table->SetNextTable(*new_table);
15543 template <
class Derived,
class Iterator,
int entrysize>
15549 DCHECK(!key->IsTheHole());
15550 for (
int entry = HashToEntry(hash); entry != kNotFound;
15551 entry = ChainAt(entry)) {
15552 Object* candidate = KeyAt(entry);
15560 template <
class Derived,
class Iterator,
int entrysize>
15564 Object* hash = key->GetHash();
15565 if (!hash->IsSmi())
return kNotFound;
15566 return FindEntry(key, Smi::cast(hash)->value());
15570 template <
class Derived,
class Iterator,
int entrysize>
15574 int entry = UsedCapacity();
15575 int bucket = HashToBucket(hash);
15576 int index = EntryToIndex(entry);
15577 Object* chain_entry =
get(kHashTableStartIndex + bucket);
15579 set(index + kChainOffset, chain_entry);
15580 SetNumberOfElements(NumberOfElements() + 1);
15585 template<
class Derived,
class Iterator,
int entrysize>
15589 int index = EntryToIndex(entry);
15590 for (
int i = 0;
i < entrysize; ++
i) {
15593 SetNumberOfElements(NumberOfElements() - 1);
15594 SetNumberOfDeletedElements(NumberOfDeletedElements() + 1);
15663 return FindEntry(key) != kNotFound;
15670 if (table->FindEntry(key, hash) != kNotFound)
return table;
15672 table = EnsureGrowable(table);
15674 int index = table->AddEntry(hash);
15675 table->set(index, *key);
15682 int entry = FindEntry(key);
15683 if (entry == kNotFound)
return GetHeap()->the_hole_value();
15684 return ValueAt(entry);
15691 DCHECK(!key->IsTheHole());
15694 int entry = table->FindEntry(key, hash);
15696 if (entry != kNotFound) {
15697 table->set(table->EntryToIndex(entry) + kValueOffset, *value);
15701 table = EnsureGrowable(table);
15703 int index = table->AddEntry(hash);
15704 table->set(index, *key);
15705 table->set(index + kValueOffset, *value);
15710 template<
class Derived,
class TableType>
15713 TableType* table = TableType::cast(this->table());
15714 if (!table->IsObsolete())
return;
15716 int index = Smi::cast(this->index())->value();
15717 while (table->IsObsolete()) {
15718 TableType* next_table = table->NextTable();
15721 int nod = table->NumberOfDeletedElements();
15727 int old_index = index;
15728 for (
int i = 0;
i < nod; ++
i) {
15729 int removed_index = table->RemovedIndexAt(
i);
15730 if (removed_index >= old_index)
break;
15736 table = next_table;
15744 template<
class Derived,
class TableType>
15747 if (this->table()->IsUndefined())
return false;
15751 TableType* table = TableType::cast(this->table());
15752 int index = Smi::cast(this->index())->value();
15753 int used_capacity = table->UsedCapacity();
15755 while (index < used_capacity && table->KeyAt(index)->IsTheHole()) {
15761 if (index < used_capacity)
return true;
15763 set_table(
GetHeap()->undefined_value());
15768 template<
class Derived,
class TableType>
15772 FixedArray* array = FixedArray::cast(value_array->elements());
15773 static_cast<Derived*
>(
this)->PopulateValueArray(array);
15775 return Smi::cast(kind());
15840 int previous_length =
15841 previous.
is_null() ? 0 : previous->serialized_data()->length();
15842 int length =
sizeof(descriptor) + previous_length;
15844 isolate->
factory()->NewByteArray(length);
15846 isolate->
factory()->NewDeclaredAccessorDescriptor();
15847 value->set_serialized_data(*serialized_descriptor);
15851 uint8_t* array = serialized_descriptor->GetDataStartAddress();
15852 if (previous_length != 0) {
15853 uint8_t* previous_array =
15854 previous->serialized_data()->GetDataStartAddress();
15855 MemCopy(array, previous_array, previous_length);
15856 array += previous_length;
15861 *data = descriptor;
15874 if (break_point_info->IsUndefined())
return false;
15875 return BreakPointInfo::cast(break_point_info)->GetBreakPointCount() > 0;
15886 return BreakPointInfo::cast(break_points()->get(index));
15894 Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position),
15895 debug_info->GetIsolate());
15896 if (break_point_info->IsUndefined())
return;
15899 break_point_object);
15905 int source_position,
15906 int statement_position,
15908 Isolate* isolate = debug_info->GetIsolate();
15909 Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position),
15911 if (!break_point_info->IsUndefined()) {
15914 break_point_object);
15921 for (
int i = 0;
i < debug_info->break_points()->length();
i++) {
15922 if (debug_info->break_points()->get(
i)->IsUndefined()) {
15932 isolate->
factory()->NewFixedArray(
15933 old_break_points->length() +
15936 debug_info->set_break_points(*new_break_points);
15937 for (
int i = 0;
i < old_break_points->length();
i++) {
15938 new_break_points->set(
i, old_break_points->get(
i));
15940 index = old_break_points->length();
15947 new_break_point_info->set_code_position(
Smi::FromInt(code_position));
15948 new_break_point_info->set_source_position(
Smi::FromInt(source_position));
15949 new_break_point_info->
15950 set_statement_position(
Smi::FromInt(statement_position));
15951 new_break_point_info->set_break_point_objects(
15952 isolate->
heap()->undefined_value());
15954 debug_info->break_points()->set(index, *new_break_point_info);
15961 if (break_point_info->IsUndefined()) {
15962 return GetHeap()->undefined_value();
15964 return BreakPointInfo::cast(break_point_info)->break_point_objects();
15970 if (break_points()->IsUndefined())
return 0;
15972 for (
int i = 0;
i < break_points()->length();
i++) {
15973 if (!break_points()->get(
i)->IsUndefined()) {
15975 BreakPointInfo::cast(break_points()->get(
i));
15985 Heap* heap = debug_info->GetHeap();
15986 if (debug_info->break_points()->IsUndefined())
return heap->undefined_value();
15987 for (
int i = 0;
i < debug_info->break_points()->length();
i++) {
15988 if (!debug_info->break_points()->get(
i)->IsUndefined()) {
15991 debug_info->break_points()->get(
i)));
15993 break_point_object)) {
15994 return *break_point_info;
15998 return heap->undefined_value();
16006 for (
int i = 0;
i < break_points()->length();
i++) {
16007 if (!break_points()->get(
i)->IsUndefined()) {
16009 BreakPointInfo::cast(break_points()->get(
i));
16010 if (break_point_info->code_position()->value() == code_position) {
16022 Isolate* isolate = break_point_info->GetIsolate();
16024 if (break_point_info->break_point_objects()->IsUndefined())
return;
16026 if (!break_point_info->break_point_objects()->IsFixedArray()) {
16027 if (break_point_info->break_point_objects() == *break_point_object) {
16028 break_point_info->set_break_point_objects(
16029 isolate->
heap()->undefined_value());
16034 DCHECK(break_point_info->break_point_objects()->IsFixedArray());
16037 FixedArray::cast(break_point_info->break_point_objects()));
16039 isolate->
factory()->NewFixedArray(old_array->length() - 1);
16040 int found_count = 0;
16041 for (
int i = 0;
i < old_array->length();
i++) {
16042 if (old_array->get(
i) == *break_point_object) {
16043 DCHECK(found_count == 0);
16046 new_array->set(
i - found_count, old_array->get(
i));
16050 if (found_count > 0) break_point_info->set_break_point_objects(*new_array);
16057 Isolate* isolate = break_point_info->GetIsolate();
16060 if (break_point_info->break_point_objects()->IsUndefined()) {
16061 break_point_info->set_break_point_objects(*break_point_object);
16065 if (break_point_info->break_point_objects() == *break_point_object)
return;
16067 if (!break_point_info->break_point_objects()->IsFixedArray()) {
16069 array->set(0, break_point_info->break_point_objects());
16070 array->set(1, *break_point_object);
16071 break_point_info->set_break_point_objects(*array);
16077 FixedArray::cast(break_point_info->break_point_objects()));
16079 isolate->
factory()->NewFixedArray(old_array->length() + 1);
16080 for (
int i = 0;
i < old_array->length();
i++) {
16082 if (old_array->get(
i) == *break_point_object)
return;
16083 new_array->set(
i, old_array->get(
i));
16086 new_array->set(old_array->length(), *break_point_object);
16087 break_point_info->set_break_point_objects(*new_array);
16095 if (break_point_info->break_point_objects()->IsUndefined())
return false;
16097 if (!break_point_info->break_point_objects()->IsFixedArray()) {
16098 return break_point_info->break_point_objects() == *break_point_object;
16101 FixedArray* array = FixedArray::cast(break_point_info->break_point_objects());
16102 for (
int i = 0;
i < array->
length();
i++) {
16103 if (array->
get(
i) == *break_point_object) {
16114 if (break_point_objects()->IsUndefined())
return 0;
16116 if (!break_point_objects()->IsFixedArray())
return 1;
16118 return FixedArray::cast(break_point_objects())->length();
16123 return JSDate::cast(
object)->DoGetField(
16134 Object* stamp = cache_stamp();
16135 if (stamp != date_cache->
stamp() && stamp->IsSmi()) {
16137 int64_t local_time_ms =
16138 date_cache->
ToLocal(
static_cast<int64_t
>(value()->
Number()));
16142 case kYear:
return year();
16143 case kMonth:
return month();
16144 case kDay:
return day();
16146 case kHour:
return hour();
16157 double time = value()->Number();
16160 int64_t local_time_ms = date_cache->
ToLocal(
static_cast<int64_t
>(time));
16177 if (std::isnan(value))
return GetIsolate()->
heap()->nan_value();
16179 int64_t time_ms =
static_cast<int64_t
>(value);
16190 int year, month, day;
16216 if (is_value_nan) {
16235 int year, month, day;
16237 int weekday = date_cache->
Weekday(days);
16238 int hour = time_in_day_ms / (60 * 60 * 1000);
16239 int min = (time_in_day_ms / (60 * 1000)) % 60;
16240 int sec = (time_in_day_ms / 1000) % 60;
16241 set_cache_stamp(date_cache->
stamp());
16254 set_backing_store(
NULL);
16273 set_elements(
GetHeap()->EmptyExternalArrayForMap(
map()));
16278 switch (elements_kind) {
16279 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
16280 case TYPE##_ELEMENTS: return EXTERNAL_##TYPE##_ELEMENTS;
16283 #undef TYPED_ARRAY_CASE
16296 Isolate* isolate = typed_array->GetIsolate();
16306 FixedTypedArrayBase::cast(typed_array->elements()));
16308 fixed_typed_array->DataSize(),
false);
16309 memcpy(buffer->backing_store(),
16310 fixed_typed_array->DataPtr(),
16311 fixed_typed_array->DataSize());
16313 isolate->
factory()->NewExternalArray(
16314 fixed_typed_array->length(), typed_array->type(),
16315 static_cast<uint8_t*
>(buffer->backing_store()));
16317 buffer->set_weak_first_view(*typed_array);
16318 DCHECK(typed_array->weak_next() == isolate->
heap()->undefined_value());
16319 typed_array->set_buffer(*buffer);
16338 return static_cast<HeapType*
>(type_raw());
16343 DCHECK(IsPropertyCell());
16344 set_type_raw(
type, ignored);
16350 Isolate* isolate = cell->GetIsolate();
16354 if (new_type->Is(old_type))
return old_type;
16356 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16363 return HeapType::Any(isolate);
16369 cell->set_value(*value);
16370 if (!HeapType::Any()->
Is(cell->type())) {
16372 cell->set_type(*new_type);
16384 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16386 cell, info->
zone());
#define SLOW_DCHECK(condition)
virtual const char * NameOfCPURegister(int reg) const
static uint16_t LeadSurrogate(uint32_t char_code)
static const int kNoPreviousCharacter
static const uchar kMaxNonSurrogateCharCode
static uint16_t TrailSurrogate(uint32_t char_code)
static const unsigned kMaxOneByteChar
static uchar ValueOf(const byte *str, unsigned length, unsigned *cursor)
static uchar Length(uchar chr, int previous)
static const unsigned kMaxEncodedSize
static unsigned Encode(char *out, uchar c, int previous, bool replace_invalid=false)
bool IsEmpty() const
Returns true if the handle is empty.
v8::internal::Object * get(int index)
A JavaScript object (ECMA-262, 4.3.3)
An ExternalOneByteStringResource is a wrapper around an one-byte string buffer that resides outside V...
virtual const char * data() const =0
The string data from the underlying buffer.
virtual size_t length() const =0
The number of Latin-1 characters in the string.
An ExternalStringResource is a wrapper around a two-byte string buffer that resides outside V8's heap...
virtual const uint16_t * data() const =0
The string data from the underlying buffer.
virtual size_t length() const =0
The length of the string.
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
bool IsBoolean() const
Returns true if this value is boolean.
int32_t Int32Value() const
bool IsInt32() const
Returns true if this value is a 32-bit signed integer.
static double nan_value()
static int AppendUnique(Handle< Object > descriptors, Handle< FixedArray > array, int valid_descriptors)
static bool IsCompatibleReceiverType(Isolate *isolate, Handle< AccessorInfo > info, Handle< HeapType > type)
bool IsCompatibleReceiver(Object *receiver)
Object * GetComponent(AccessorComponent component)
static Handle< AccessorPair > Copy(Handle< AccessorPair > pair)
static Handle< ExecutableAccessorInfo > CloneAccessor(Isolate *isolate, Handle< ExecutableAccessorInfo > accessor)
AllocationSite * GetAllocationSite()
const char * PretenureDecisionName(PretenureDecision decision)
PretenureFlag GetPretenureMode()
static void DigestTransitionFeedback(Handle< AllocationSite > site, ElementsKind to_kind)
static const double kPretenureRatio
static void AddDependentCompilationInfo(Handle< AllocationSite > site, Reason reason, CompilationInfo *info)
void ResetPretenureDecision()
uint32_t pc_offset(uint32_t index)
BailoutId ast_id(uint32_t index)
static bool HasBreakPointObject(Handle< BreakPointInfo > info, Handle< Object > break_point_object)
static void ClearBreakPoint(Handle< BreakPointInfo > info, Handle< Object > break_point_object)
static void SetBreakPoint(Handle< BreakPointInfo > info, Handle< Object > break_point_object)
Code * builtin(Name name)
Address GetDataStartAddress()
static uint32_t NameFlagsHashHelper(Name *name, Code::Flags flags)
MaybeHandle< Code > code_
uint32_t HashForObject(Object *obj) OVERRIDE
CodeCacheHashTableKey(Handle< Name > name, Code::Flags flags)
MUST_USE_RESULT Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
CodeCacheHashTableKey(Handle< Name > name, Handle< Code > code)
bool IsMatch(Object *other) OVERRIDE
int GetIndex(Name *name, Code::Flags flags)
static const int kInitialSize
static Handle< CodeCacheHashTable > Put(Handle< CodeCacheHashTable > table, Handle< Name > name, Handle< Code > code)
void RemoveByIndex(int index)
Object * Lookup(Name *name, Code::Flags flags)
Object * LookupNormalTypeCache(Name *name, Code::Flags flags)
Object * Lookup(Name *name, Code::Flags flags)
static void UpdateNormalTypeCache(Handle< CodeCache > code_cache, Handle< Name > name, Handle< Code > code)
Object * LookupDefaultCache(Name *name, Code::Flags flags)
static void UpdateDefaultCache(Handle< CodeCache > code_cache, Handle< Name > name, Handle< Code > code)
int GetIndex(Object *name, Code *code)
static void Update(Handle< CodeCache > cache, Handle< Name > name, Handle< Code > code)
void RemoveByIndex(Object *name, Code *code, int index)
void EvictOptimizedCodeMap(SharedFunctionInfo *code_map_holder)
Handle< Map > find_[kMaxCount]
static const int kMaxCount
Handle< Object > replace_[kMaxCount]
void CopyFrom(const CodeDesc &desc)
AllocationSite * FindFirstAllocationSite()
ConstantPoolArray * constant_pool()
uint32_t TranslateAstIdToPcOffset(BailoutId ast_id)
void set_has_deoptimization_support(bool value)
unsigned safepoint_table_offset()
void Relocate(intptr_t delta)
static Code * GetCodeAgeStub(Isolate *isolate, Age age, MarkingParity parity)
void InvalidateRelocation()
bool is_compare_ic_stub()
static Code * GetCodeFromTargetAddress(Address address)
BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset)
ExtraICState extra_ic_state()
static void PatchPlatformCodeAge(Isolate *isolate, byte *sequence, Age age, MarkingParity parity)
static const char * Kind2String(Kind kind)
static void GetCodeAgeAndParity(Code *code, Age *age, MarkingParity *parity)
static void MarkCodeAsExecuted(byte *sequence, Isolate *isolate)
bool is_inline_cache_stub()
bool marked_for_deoptimization()
Object * FindNthObject(int n, Map *match_map)
void FindAllMaps(MapHandleList *maps)
void PrintDeoptLocation(FILE *out, int bailout_id)
byte * relocation_start()
int SourceStatementPosition(Address pc)
Code * FindFirstHandler()
bool FindHandlers(CodeHandleList *code_list, int length=-1)
static void MakeCodeAgeSequenceYoung(byte *sequence, Isolate *isolate)
STATIC_ASSERT(NUMBER_OF_KINDS<=16)
int instruction_size() const
SafepointEntry GetSafepointEntry(Address pc)
bool CanDeoptAt(Address pc)
friend class RelocIterator
void set_marked_for_deoptimization(bool flag)
byte * instruction_start()
static Object * GetObjectFromEntryAddress(Address location_of_address)
InlineCacheState ic_state()
void FindAndReplace(const FindAndReplacePattern &pattern)
MaybeHandle< Code > FindHandlerForMap(Map *map)
int SourcePosition(Address pc)
void MakeOlder(MarkingParity)
unsigned back_edge_table_offset()
Object * type_feedback_info()
bool has_debug_break_slots()
static Flags RemoveTypeFromFlags(Flags flags)
static const int kPrologueOffsetNotSet
byte * FindCodeAgeSequence()
int prologue_offset() const
void InvalidateEmbeddedObjects()
static const char * GetStateName(CompareICState::State state)
static Handle< CompilationCacheTable > PutRegExp(Handle< CompilationCacheTable > cache, Handle< String > src, JSRegExp::Flags flags, Handle< FixedArray > value)
Handle< Object > LookupRegExp(Handle< String > source, JSRegExp::Flags flags)
static Handle< CompilationCacheTable > PutEval(Handle< CompilationCacheTable > cache, Handle< String > src, Handle< Context > context, Handle< SharedFunctionInfo > value, int scope_position)
void Remove(Object *value)
static Handle< CompilationCacheTable > Put(Handle< CompilationCacheTable > cache, Handle< String > src, Handle< Context > context, Handle< Object > value)
Handle< Object > LookupEval(Handle< String > src, Handle< Context > context, StrictMode strict_mode, int scope_position)
Handle< Object > Lookup(Handle< String > src, Handle< Context > context)
void AbortDueToDependencyChange()
ZoneList< Handle< HeapObject > > * dependencies(DependentCode::DependencyGroup group)
Handle< Foreign > object_wrapper()
Isolate * isolate() const
void Reset(ConsString *cons_string, int offset=0)
String * Continue(int *offset_out)
void PushRight(ConsString *string)
static int OffsetForDepth(int depth)
String * Next(int *offset_out)
static const int kStackSize
String * NextLeaf(bool *blew_stack)
String * Search(int *offset_out)
ConsString * frames_[kStackSize]
void PushLeft(ConsString *string)
void Initialize(ConsString *cons_string, int offset)
void AdjustMaximumDepth()
uint16_t ConsStringGet(int index)
LayoutSection final_section()
void ClearPtrEntries(Isolate *isolate)
Object ** RawFieldOfElementAt(int index)
int OffsetOfElementAt(int index)
void ConstantPoolIterateBody(ObjectVisitor *v)
int first_index(Type type, LayoutSection layout_section)
int number_of_entries(Type type, LayoutSection layout_section)
static Context * cast(Object *context)
Context * native_context()
static void FlushICache(void *start, size_t size)
static int TimeInDay(int64_t time_ms, int days)
void YearMonthDayFromDays(int days, int *year, int *month, int *day)
static const int kInvalidStamp
int64_t ToLocal(int64_t time_ms)
static int DaysFromTime(int64_t time_ms)
int TimezoneOffset(int64_t time_ms)
static const int kEstimatedNofBreakPointsInFunction
static Object * FindBreakPointInfo(Handle< DebugInfo > debug_info, Handle< Object > break_point_object)
static void ClearBreakPoint(Handle< DebugInfo > debug_info, int code_position, Handle< Object > break_point_object)
static const int kNoBreakPointInfo
int GetBreakPointInfoIndex(int code_position)
static void SetBreakPoint(Handle< DebugInfo > debug_info, int code_position, int source_position, int statement_position, Handle< Object > break_point_object)
Object * GetBreakPointInfo(int code_position)
Object * GetBreakPointObjects(int code_position)
bool HasBreakPoint(int code_position)
void HandleStepIn(Handle< JSFunction > function, Handle< Object > holder, Address fp, bool is_constructor)
DeclaredAccessorDescriptorIterator(DeclaredAccessorDescriptor *descriptor)
const DeclaredAccessorDescriptorData * Next()
static Handle< DeclaredAccessorDescriptor > Create(Isolate *isolate, const DeclaredAccessorDescriptorData &data, Handle< DeclaredAccessorDescriptor > previous)
Smi * PcAndState(int index)
BailoutId AstId(int index)
static Handle< DeoptimizationOutputData > New(Isolate *isolate, int number_of_deopt_points, PretenureFlag pretenure)
static void DeoptimizeGlobalObject(JSObject *object)
static void DeoptimizeMarkedCode(Isolate *isolate)
static int GetOutputInfo(DeoptimizationOutputData *data, BailoutId node_id, SharedFunctionInfo *shared)
static int GetDeoptimizationId(Isolate *isolate, Address addr, BailoutType type)
void Recompute(DependentCode *entries)
GroupStartIndexes(DependentCode *entries)
static Handle< DependentCode > Insert(Handle< DependentCode > entries, DependencyGroup group, Handle< Object > object)
Object * object_at(int i)
bool MarkCodeForDeoptimization(Isolate *isolate, DependentCode::DependencyGroup group)
int number_of_entries(DependencyGroup group)
void UpdateToFinishedCode(DependencyGroup group, CompilationInfo *info, Code *code)
@ kElementsCantBeAddedGroup
@ kInitialMapChangedGroup
@ kPropertyCellChangedGroup
@ kAllocationSiteTenuringChangedGroup
@ kAllocationSiteTransitionChangedGroup
void DeoptimizeDependentCodeGroup(Isolate *isolate, DependentCode::DependencyGroup group)
static const int kCodesStartIndex
static const char * DependencyGroupName(DependencyGroup group)
static void SetMarkedForDeoptimization(Code *code, DependencyGroup group)
static const int kGroupCount
void set_number_of_entries(DependencyGroup group, int value)
static DependentCode * ForObject(Handle< HeapObject > object, DependencyGroup group)
void set_object_at(int i, Object *object)
void RemoveCompilationInfo(DependentCode::DependencyGroup group, CompilationInfo *info)
void AddToDependentICList(Handle< Code > stub)
CompilationInfo * compilation_info_at(int i)
void copy(int from, int to)
bool Contains(DependencyGroup group, Code *code)
void Replace(int descriptor_number, Descriptor *descriptor)
void SetEnumCache(FixedArray *bridge_storage, FixedArray *new_cache, Object *new_index_cache)
void SetValue(int descriptor_number, Object *value)
int GetSortedKeyIndex(int descriptor_number)
void SetRepresentation(int descriptor_number, Representation representation)
static Handle< DescriptorArray > CopyUpTo(Handle< DescriptorArray > desc, int enumeration_index, int slack=0)
static Handle< DescriptorArray > Allocate(Isolate *isolate, int number_of_descriptors, int slack=0)
Name * GetKey(int descriptor_number)
static const int kNotFound
PropertyDetails GetDetails(int descriptor_number)
FixedArray * GetEnumCache()
bool CanHoldValue(int descriptor, Object *value)
Object * GetValue(int descriptor_number)
int GetFieldIndex(int descriptor_number)
PropertyType GetType(int descriptor_number)
Object * GetConstant(int descriptor_number)
static const int kEnumCacheBridgeLength
static Handle< DescriptorArray > CopyUpToAddAttributes(Handle< DescriptorArray > desc, int enumeration_index, PropertyAttributes attributes, int slack=0)
void CopyFrom(int index, DescriptorArray *src, const WhitenessWitness &)
int number_of_descriptors()
HeapType * GetFieldType(int descriptor_number)
static MUST_USE_RESULT Handle< NameDictionary > New(Isolate *isolate, int at_least_space_for, PretenureFlag pretenure=NOT_TENURED)
static Handle< Derived > EnsureCapacity(Handle< Derived > obj, int n, Key key)
void CopyKeysTo(FixedArray *storage, PropertyAttributes filter, SortMode sort_mode)
Object * ValueAt(int entry)
static void GenerateNewEnumerationIndices(Handle< Derived > dictionary)
static MUST_USE_RESULT Handle< Derived > AtPut(Handle< Derived > dictionary, Key key, Handle< Object > value)
static MUST_USE_RESULT Handle< NameDictionary > Add(Handle< NameDictionary > dictionary, Handle< Name > key, Handle< Object > value, PropertyDetails details)
static Handle< Object > DeleteProperty(Handle< NameDictionary > dictionary, int entry, JSObject::DeleteMode mode)
int NumberOfEnumElements()
void SetNextEnumerationIndex(int index)
void SetEntry(int entry, Handle< Object > key, Handle< Object > value)
static MUST_USE_RESULT Handle< NameDictionary > Shrink(Handle< NameDictionary > dictionary, Handle< Name > key)
PropertyDetails DetailsAt(int entry)
Object * SlowReverseLookup(Object *value)
void DetailsAtPut(int entry, PropertyDetails value)
static void AddEntry(Handle< Derived > dictionary, Key key, Handle< Object > value, PropertyDetails details, uint32_t hash)
int NumberOfElementsFilterAttributes(PropertyAttributes filter)
void CopyValuesTo(FixedArray *elements)
int NextEnumerationIndex()
static int Decode(Isolate *isolate, OStream *os, byte *begin, byte *end, Code *code=NULL)
virtual void CopyElements(Handle< FixedArrayBase > source, uint32_t source_start, ElementsKind source_kind, Handle< FixedArrayBase > destination, uint32_t destination_start, int copy_size)=0
virtual void SetCapacityAndLength(Handle< JSArray > array, int capacity, int length)=0
virtual MUST_USE_RESULT MaybeHandle< FixedArray > AddElementsToFixedArray(Handle< Object > receiver, Handle< JSObject > holder, Handle< FixedArray > to, Handle< FixedArrayBase > from)=0
virtual MUST_USE_RESULT MaybeHandle< Object > Get(Handle< Object > receiver, Handle< JSObject > holder, uint32_t key, Handle< FixedArrayBase > backing_store)=0
static ElementsAccessor * ForArray(Handle< FixedArrayBase > array)
static ElementsAccessor * ForKind(ElementsKind elements_kind)
static Handle< Object > SetValue(Handle< ExternalFloat32Array > array, uint32_t index, Handle< Object > value)
static Handle< Object > SetValue(Handle< ExternalFloat64Array > array, uint32_t index, Handle< Object > value)
static Handle< Object > SetValue(Handle< ExternalInt16Array > array, uint32_t index, Handle< Object > value)
static Handle< Object > SetValue(Handle< ExternalInt32Array > array, uint32_t index, Handle< Object > value)
static Handle< Object > SetValue(Handle< ExternalInt8Array > array, uint32_t index, Handle< Object > value)
static const int kShortSize
static Handle< Object > SetValue(Handle< ExternalUint16Array > array, uint32_t index, Handle< Object > value)
static Handle< Object > SetValue(Handle< ExternalUint32Array > array, uint32_t index, Handle< Object > value)
static Handle< Object > SetValue(Handle< ExternalUint8Array > array, uint32_t index, Handle< Object > value)
static Handle< Object > SetValue(Handle< ExternalUint8ClampedArray > array, uint32_t index, Handle< Object > value)
static const int kHeaderSize
void SwapPairs(FixedArray *numbers, int i, int j)
void SortPairs(FixedArray *numbers, uint32_t len)
static Handle< FixedArray > CopySize(Handle< FixedArray > array, int new_length, PretenureFlag pretenure=NOT_TENURED)
static MUST_USE_RESULT MaybeHandle< FixedArray > AddKeysFromArrayLike(Handle< FixedArray > content, Handle< JSObject > array)
static void NoWriteBarrierSet(FixedArray *array, int index, Object *value)
Object ** GetFirstElementAddress()
bool is_the_hole(int index)
void CopyTo(int pos, FixedArray *dest, int dest_pos, int len)
void set(int index, Object *value)
STATIC_ASSERT(kHeaderSize==Internals::kFixedArrayHeaderSize)
static MUST_USE_RESULT MaybeHandle< FixedArray > UnionOfKeys(Handle< FixedArray > first, Handle< FixedArray > second)
void set_undefined(int index)
void set_the_hole(int index)
bool is_the_hole(int index)
void set(int index, double value)
void set_the_hole(int index)
double get_scalar(int index)
void PostGarbageCollection()
FlatStringReader(Isolate *isolate, Handle< String > str)
Address foreign_address()
void set_foreign_address(Address value)
static const char * State2String(State state)
bool IsTemplateFor(Object *object)
static void MakeWeak(Object **location, void *parameter, WeakCallback weak_callback)
static void Destroy(Object **location)
Handle< Object > Create(Object *value)
static Handle< T > cast(Handle< S > that)
static Handle< T > null()
virtual uint32_t Hash()=0
virtual MUST_USE_RESULT Handle< Object > AsHandle(Isolate *isolate)=0
static int ComputeCapacity(int at_least_space_for)
static MUST_USE_RESULT Handle< Derived > EnsureCapacity(Handle< Derived > table, int n, Key key, PretenureFlag pretenure=NOT_TENURED)
Object * KeyAt(int entry)
static const int kNotFound
static MUST_USE_RESULT Handle< ObjectHashTable > New(Isolate *isolate, int at_least_space_for, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY, PretenureFlag pretenure=NOT_TENURED)
uint32_t HashForObject(Key key, Object *object)
void IteratePrefix(ObjectVisitor *visitor)
uint32_t EntryForProbe(Key key, Object *k, int probe, uint32_t expected)
void Swap(uint32_t entry1, uint32_t entry2, WriteBarrierMode mode)
uint32_t FindInsertionEntry(uint32_t hash)
static const int kEntrySize
static const int kMaxCapacity
void IterateElements(ObjectVisitor *visitor)
static MUST_USE_RESULT Handle< Derived > Shrink(Handle< Derived > table, Key key)
void set_value(double value)
void set_map_no_write_barrier(Map *value)
STATIC_ASSERT(kMapOffset==Internals::kHeapObjectMapOffset)
static Object ** RawField(HeapObject *obj, int offset)
static void UpdateMapCodeCache(Handle< HeapObject > object, Handle< Name > name, Handle< Code > code)
Isolate * GetIsolate() const
static const int kHeaderSize
void synchronized_set_map(Map *value)
WriteBarrierMode GetWriteBarrierMode(const DisallowHeapAllocation &promise)
void Iterate(ObjectVisitor *v)
void IteratePointers(ObjectVisitor *v, int start, int end)
void HeapObjectShortPrint(OStream &os)
int SizeFromMap(Map *map)
bool Contains(Address addr)
void ClearInstanceofCache()
Object * allocation_sites_list()
bool InNewSpace(Object *object)
void CreateFillerObjectAt(Address addr, int size)
void ClearAllICsByKind(Code::Kind kind)
void AdjustLiveBytes(Address address, int by, InvocationMode mode)
IncrementalMarking * incremental_marking()
static void FatalProcessOutOfMemory(const char *location, bool take_snapshot=false)
static bool ShouldZapGarbage()
void RightTrimFixedArray(FixedArrayBase *obj, int elements_to_trim)
AllocationMemento * FindAllocationMemento(HeapObject *object)
MarkCompactCollector * mark_compact_collector()
static Handle< Map > TypeToMap(HeapType *type, Isolate *isolate)
static void Clear(Isolate *isolate, Address address, ConstantPoolArray *constant_pool)
void RecordWrites(HeapObject *obj)
virtual Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
static uint32_t StringHash(Object *obj)
virtual uint32_t Hash() OVERRIDE
virtual uint32_t HashForObject(Object *other) OVERRIDE
InternalizedStringKey(Handle< String > string)
virtual bool IsMatch(Object *string) OVERRIDE
IntrusiveMapTransitionIterator(Map *map, TransitionArray *transition_array, Object *constructor)
TransitionArray * transition_array_
Object ** IteratorField()
IntrusivePrototypeTransitionIterator(Map *map, HeapObject *proto_trans, Object *constructor)
int NumberOfTransitions()
HeapObject * proto_trans_
int IndexFor(int transitionNumber)
Object ** IteratorField()
Map * GetTransition(int transitionNumber)
StaticResource< ConsStringIteratorOp > * objects_string_iterator()
bool serializer_enabled() const
void ReportFailedAccessCheck(Handle< JSObject > receiver, v8::AccessType type)
ConsStringIteratorOp * objects_string_compare_iterator_b()
bool MayIndexedAccess(Handle< JSObject > receiver, uint32_t index, v8::AccessType type)
Handle< Context > native_context()
Object * Throw(Object *exception, MessageLocation *location=NULL)
CodeTracer * GetCodeTracer()
base::RandomNumberGenerator * random_number_generator()
ConsStringIteratorOp * objects_string_compare_iterator_a()
bool MayNamedAccess(Handle< JSObject > receiver, Handle< Object > key, v8::AccessType type)
GlobalHandles * global_handles()
Bootstrapper * bootstrapper()
static uint32_t Hash(String *string, uint32_t seed)
static MUST_USE_RESULT MaybeHandle< Object > SetElementsLength(Handle< JSArray > array, Handle< Object > length)
static void JSArrayUpdateLengthFromIndex(Handle< JSArray > array, uint32_t index, Handle< Object > value)
static bool IsReadOnlyLengthDescriptor(Handle< Map > jsarray_map)
static void Expand(Handle< JSArray > array, int minimum_size_of_backing_fixed_array)
static MaybeHandle< Object > ReadOnlyLengthError(Handle< JSArray > array)
static bool WouldChangeReadOnlyLength(Handle< JSArray > array, uint32_t index)
static void Initialize(Handle< JSArray > array, int capacity, int length=0)
void SetValue(Object *value, bool is_value_nan)
Object * GetUTCField(FieldIndex index, double value, DateCache *date_cache)
Object * DoGetField(FieldIndex index)
static Object * GetField(Object *date, Smi *index)
void SetCachedFields(int64_t local_time_ms, DateCache *date_cache)
void MarkInOptimizationQueue()
void MarkForOptimization()
void JSFunctionIterateBody(int object_size, ObjectVisitor *v)
static const int kLiteralNativeContextIndex
void CompleteInobjectSlackTracking()
void set_code_no_write_barrier(Code *code)
static void SetInitialMap(Handle< JSFunction > function, Handle< Map > map, Handle< Object > prototype)
static void SetInstancePrototype(Handle< JSFunction > function, Handle< Object > value)
void StartInobjectSlackTracking()
bool IsInobjectSlackTrackingInProgress()
static void EnsureHasInitialMap(Handle< JSFunction > function)
void SetInstanceClassName(String *name)
static void SetPrototype(Handle< JSFunction > function, Handle< Object > value)
static Handle< JSFunction > CloneClosure(Handle< JSFunction > function)
static const int kGenerousAllocationCount
void MarkForConcurrentOptimization()
bool PassesFilter(const char *raw_filter)
static const int kNoSlackTracking
bool IsMarkedForConcurrentOptimization()
static Context * NativeContextFromLiterals(FixedArray *literals)
void PrintName(FILE *out=stdout)
static const int kCodeEntryOffset
static Handle< PropertyCell > EnsurePropertyCell(Handle< JSGlobalObject > global, Handle< Name > name)
MUST_USE_RESULT MaybeHandle< JSObject > StructureWalk(Handle< JSObject > object)
JSObjectWalkVisitor(ContextObject *site_context, bool copying, JSObject::DeepCopyHints hints)
ContextObject * site_context()
MUST_USE_RESULT MaybeHandle< JSObject > VisitElementOrProperty(Handle< JSObject > object, Handle< JSObject > value)
const JSObject::DeepCopyHints hints_
ContextObject * site_context_
bool HasFastArgumentsElements()
static void AllocateStorageForMap(Handle< JSObject > object, Handle< Map > map)
static void GeneralizeFieldRepresentation(Handle< JSObject > object, int modify_index, Representation new_representation, Handle< HeapType > new_field_type)
static void SetMapAndElements(Handle< JSObject > object, Handle< Map > map, Handle< FixedArrayBase > elements)
static void ResetElements(Handle< JSObject > object)
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithCallback(Handle< JSObject > object, Handle< Object > receiver, Handle< Object > structure, uint32_t index, Handle< Object > holder)
static MUST_USE_RESULT MaybeHandle< Object > SetElementWithCallback(Handle< JSObject > object, Handle< Object > structure, uint32_t index, Handle< Object > value, Handle< JSObject > holder, StrictMode strict_mode)
static MUST_USE_RESULT MaybeHandle< AccessorPair > GetOwnElementAccessorPair(Handle< JSObject > object, uint32_t index)
MUST_USE_RESULT Object * GetIdentityHash()
int GetEnumElementKeys(FixedArray *storage)
int NumberOfEnumElements()
bool HasDictionaryArgumentsElements()
static MUST_USE_RESULT MaybeHandle< Object > DeleteElement(Handle< JSObject > object, uint32_t index, DeleteMode mode)
static void MigrateSlowToFast(Handle< JSObject > object, int unused_property_fields)
bool HasIndexedInterceptor()
static MUST_USE_RESULT MaybeHandle< Object > SetAccessor(Handle< JSObject > object, Handle< AccessorInfo > info)
static void DeleteHiddenProperty(Handle< JSObject > object, Handle< Name > key)
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithInterceptor(Handle< JSObject > object, Handle< Object > receiver, uint32_t index)
bool HasFastObjectElements()
static void SetObserved(Handle< JSObject > object)
static const int kFieldsAdded
static MUST_USE_RESULT MaybeHandle< Object > Freeze(Handle< JSObject > object)
static MUST_USE_RESULT Maybe< bool > HasRealNamedCallbackProperty(Handle< JSObject > object, Handle< Name > key)
static void MigrateToNewProperty(Handle< JSObject > object, Handle< Map > transition, Handle< Object > value)
static void NormalizeProperties(Handle< JSObject > object, PropertyNormalizationMode mode, int expected_additional_properties)
static void ReoptimizeIfPrototype(Handle< JSObject > object)
static void MigrateFastToSlow(Handle< JSObject > object, Handle< Map > new_map, int expected_additional_properties)
static MUST_USE_RESULT MaybeHandle< Object > DeleteProperty(Handle< JSObject > object, Handle< Name > name, DeleteMode mode)
static const int kMaxInstanceSize
void PrintInstanceMigration(FILE *file, Map *original_map, Map *new_map)
static Handle< FixedArray > SetFastElementsCapacityAndLength(Handle< JSObject > object, int capacity, int length, SetFastElementsCapacitySmiMode smi_mode)
static Handle< ObjectHashTable > GetOrCreateHiddenPropertiesHashtable(Handle< JSObject > object)
static MUST_USE_RESULT MaybeHandle< Object > GetAccessor(Handle< JSObject > object, Handle< Name > name, AccessorComponent component)
static void UpdateAllocationSite(Handle< JSObject > object, ElementsKind to_kind)
static void SetFastDoubleElementsCapacityAndLength(Handle< JSObject > object, int capacity, int length)
void JSObjectShortPrint(StringStream *accumulator)
SeededNumberDictionary * element_dictionary()
static MUST_USE_RESULT MaybeHandle< Object > SetFastElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, StrictMode strict_mode, bool check_prototype)
Object * GetHiddenProperty(Handle< Name > key)
static void AddSlowProperty(Handle< JSObject > object, Handle< Name > name, Handle< Object > value, PropertyAttributes attributes)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetElementAttributeWithReceiver(Handle< JSObject > object, Handle< JSReceiver > receiver, uint32_t index, bool check_prototype)
static const int kHeaderSize
int NumberOfOwnElements(PropertyAttributes filter)
static void TransitionElementsKind(Handle< JSObject > object, ElementsKind to_kind)
static MUST_USE_RESULT MaybeHandle< Object > DeletePropertyWithInterceptor(Handle< JSObject > holder, Handle< JSObject > receiver, Handle< Name > name)
static MUST_USE_RESULT Maybe< bool > HasRealNamedProperty(Handle< JSObject > object, Handle< Name > key)
static MUST_USE_RESULT MaybeHandle< Object > SetOwnElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, StrictMode strict_mode)
static Handle< Object > FastPropertyAt(Handle< JSObject > object, Representation representation, FieldIndex index)
static Handle< Object > SetHiddenPropertiesHashTable(Handle< JSObject > object, Handle< Object > value)
bool ReferencesObject(Object *obj)
static Handle< Object > PrepareSlowElementsForSort(Handle< JSObject > object, uint32_t limit)
static void SetPropertyCallback(Handle< JSObject > object, Handle< Name > name, Handle< Object > structure, PropertyAttributes attributes)
static MUST_USE_RESULT MaybeHandle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype=true, SetPropertyMode set_mode=SET_PROPERTY)
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithInterceptor(Handle< JSObject > object, Handle< Object > receiver, Handle< Name > name)
void GetElementsCapacityAndUsage(int *capacity, int *used)
static void MigrateToMap(Handle< JSObject > object, Handle< Map > new_map)
static void SetElementCallback(Handle< JSObject > object, uint32_t index, Handle< Object > structure, PropertyAttributes attributes)
static void OptimizeAsPrototype(Handle< JSObject > object, PrototypeOptimizationMode mode)
bool HasNamedInterceptor()
static MUST_USE_RESULT Maybe< bool > HasRealElementProperty(Handle< JSObject > object, uint32_t index)
static Handle< Object > DeleteNormalizedProperty(Handle< JSObject > object, Handle< Name > name, DeleteMode mode)
static MUST_USE_RESULT MaybeHandle< Object > SetElementWithoutInterceptor(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype, SetPropertyMode set_mode)
ExecutableAccessorInfoHandling
void GetOwnPropertyNames(FixedArray *storage, int index, PropertyAttributes filter=NONE)
static MUST_USE_RESULT MaybeHandle< JSObject > GetKeysForIndexedInterceptor(Handle< JSObject > object, Handle< JSReceiver > receiver)
static Handle< Object > GetDataProperty(Handle< JSObject > object, Handle< Name > key)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetElementAttributeWithoutInterceptor(Handle< JSObject > object, Handle< JSReceiver > receiver, uint32_t index, bool continue_search)
static MUST_USE_RESULT MaybeHandle< Object > SetDictionaryElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype, SetPropertyMode set_mode=SET_PROPERTY)
static bool TryMigrateInstance(Handle< JSObject > instance)
bool ReferencesObjectFromElements(FixedArray *elements, ElementsKind kind, Object *object)
static Handle< Map > GetElementsTransitionMap(Handle< JSObject > object, ElementsKind to_kind)
static MUST_USE_RESULT MaybeHandle< Object > SetElementWithInterceptor(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype, SetPropertyMode set_mode)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetElementAttributeWithInterceptor(Handle< JSObject > object, Handle< JSReceiver > receiver, uint32_t index, bool continue_search)
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithFailedAccessCheck(LookupIterator *it)
static MUST_USE_RESULT MaybeHandle< Object > SetPrototype(Handle< JSObject > object, Handle< Object > value, bool from_javascript)
static MUST_USE_RESULT MaybeHandle< Object > PreventExtensions(Handle< JSObject > object)
static void SetIdentityHash(Handle< JSObject > object, Handle< Smi > hash)
static Handle< Object > SetHiddenProperty(Handle< JSObject > object, Handle< Name > key, Handle< Object > value)
static const int kPropertiesOffset
static MUST_USE_RESULT MaybeHandle< JSObject > DeepWalk(Handle< JSObject > object, AllocationSiteCreationContext *site_context)
static void AddProperty(Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes)
int NumberOfOwnProperties(PropertyAttributes filter=NONE)
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithInterceptor(LookupIterator *it, Handle< Object > value)
static Handle< FixedArray > EnsureWritableFastElements(Handle< JSObject > object)
Object * SlowReverseLookup(Object *value)
static void EnqueueChangeRecord(Handle< JSObject > object, const char *type, Handle< Name > name, Handle< Object > old_value)
SetFastElementsCapacitySmiMode
static void ValidateElements(Handle< JSObject > object)
static void EnsureCanContainElements(Handle< JSObject > object, Object **elements, uint32_t count, EnsureElementsMode mode)
InterceptorInfo * GetNamedInterceptor()
static MaybeHandle< Object > DefineAccessor(Handle< JSObject > object, Handle< Name > name, Handle< Object > getter, Handle< Object > setter, PropertyAttributes attributes)
static MUST_USE_RESULT MaybeHandle< JSObject > DeepCopy(Handle< JSObject > object, AllocationSiteUsageContext *site_context, DeepCopyHints hints=kNoHints)
bool WouldConvertToSlowElements(Handle< Object > key)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributesWithInterceptor(Handle< JSObject > holder, Handle< Object > receiver, Handle< Name > name)
static bool HasHiddenProperties(Handle< JSObject > object)
MUST_USE_RESULT Object * GetHiddenPropertiesHashTable()
static MUST_USE_RESULT MaybeHandle< Object > SetElementWithCallbackSetterInPrototypes(Handle< JSObject > object, uint32_t index, Handle< Object > value, bool *found, StrictMode strict_mode)
static MUST_USE_RESULT MaybeHandle< JSObject > GetKeysForNamedInterceptor(Handle< JSObject > object, Handle< JSReceiver > receiver)
int GetOwnElementKeys(FixedArray *storage, PropertyAttributes filter)
InterceptorInfo * GetIndexedInterceptor()
static Handle< SeededNumberDictionary > NormalizeElements(Handle< JSObject > object)
static void PrintElementsTransition(FILE *file, Handle< JSObject > object, ElementsKind from_kind, Handle< FixedArrayBase > from_elements, ElementsKind to_kind, Handle< FixedArrayBase > to_elements)
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithFailedAccessCheck(LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
static MUST_USE_RESULT MaybeHandle< Object > SetOwnPropertyIgnoreAttributes(Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes, ExecutableAccessorInfoHandling handling=DEFAULT_HANDLING)
void WriteToField(int descriptor, Object *value)
bool ShouldConvertToFastDoubleElements(bool *has_smi_only_elements)
static MUST_USE_RESULT MaybeHandle< Object > DeleteElementWithInterceptor(Handle< JSObject > object, uint32_t index)
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSObject > object)
static void MigrateInstance(Handle< JSObject > instance)
bool ShouldConvertToSlowElements(int new_capacity)
static void DefineElementAccessor(Handle< JSObject > object, uint32_t index, Handle< Object > getter, Handle< Object > setter, PropertyAttributes attributes)
static Handle< Object > PrepareElementsForSort(Handle< JSObject > object, uint32_t limit)
static MUST_USE_RESULT MaybeHandle< Object > SetFastDoubleElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, StrictMode strict_mode, bool check_prototype=true)
NameDictionary * property_dictionary()
bool ShouldConvertToFastElements()
static void SetNormalizedProperty(Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyDetails details)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributesWithFailedAccessCheck(LookupIterator *it)
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name)
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, uint32_t index)
static MUST_USE_RESULT MaybeHandle< Object > DeleteElementWithHandler(Handle< JSProxy > proxy, uint32_t index, DeleteMode mode)
static MUST_USE_RESULT Maybe< bool > HasPropertyWithHandler(Handle< JSProxy > proxy, Handle< Name > name)
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSProxy > proxy)
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyViaPrototypesWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name, Handle< Object > value, StrictMode strict_mode, bool *done)
MUST_USE_RESULT Object * GetIdentityHash()
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributesWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetElementAttributeWithHandler(Handle< JSProxy > proxy, Handle< JSReceiver > receiver, uint32_t index)
static MUST_USE_RESULT MaybeHandle< Object > SetElementWithHandler(Handle< JSProxy > proxy, Handle< JSReceiver > receiver, uint32_t index, Handle< Object > value, StrictMode strict_mode)
static MUST_USE_RESULT MaybeHandle< Object > CallTrap(Handle< JSProxy > proxy, const char *name, Handle< Object > derived_trap, int argc, Handle< Object > args[])
static MUST_USE_RESULT MaybeHandle< Object > DeletePropertyWithHandler(Handle< JSProxy > proxy, Handle< Name > name, DeleteMode mode)
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name, Handle< Object > value, StrictMode strict_mode)
static void Fix(Handle< JSProxy > proxy)
static MUST_USE_RESULT MaybeHandle< Object > SetElement(Handle< JSReceiver > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode)
String * constructor_name()
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(Handle< JSReceiver > object, Handle< Name > name)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetOwnPropertyAttributes(Handle< JSReceiver > object, Handle< Name > name)
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSReceiver > object)
static MUST_USE_RESULT MaybeHandle< Object > DeleteElement(Handle< JSReceiver > object, uint32_t index, DeleteMode mode=NORMAL_DELETION)
static MUST_USE_RESULT MaybeHandle< FixedArray > GetKeys(Handle< JSReceiver > object, KeyCollectionType type)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetOwnElementAttribute(Handle< JSReceiver > object, uint32_t index)
static MUST_USE_RESULT MaybeHandle< Object > DeleteProperty(Handle< JSReceiver > object, Handle< Name > name, DeleteMode mode=NORMAL_DELETION)
static const int kFlagsIndex
static const int kSourceIndex
static Handle< JSArrayBuffer > MaterializeArrayBuffer(Handle< JSTypedArray > typed_array)
Handle< JSArrayBuffer > GetBuffer()
static void PrintTop(Isolate *isolate, FILE *file, bool print_args, bool print_line_number)
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
Object * Lookup(FixedArray *key)
static Handle< MapCache > Put(Handle< MapCache > map_cache, Handle< FixedArray > key, Handle< Map > value)
void DeprecateTarget(Name *key, DescriptorArray *new_descriptors)
static Handle< Map > Create(Isolate *isolate, int inobject_properties)
static Handle< Map > TransitionToAccessorProperty(Handle< Map > map, Handle< Name > name, AccessorComponent component, Handle< Object > accessor, PropertyAttributes attributes)
ElementsKind elements_kind()
void SetEnumLength(int length)
static void UpdateCodeCache(Handle< Map > map, Handle< Name > name, Handle< Code > code)
int NumberOfOwnDescriptors()
void set_migration_target(bool value)
int unused_property_fields()
FixedArray * GetPrototypeTransitions()
static MUST_USE_RESULT Handle< HeapType > GeneralizeFieldType(Handle< HeapType > type1, Handle< HeapType > type2, Isolate *isolate)
static Handle< Map > AsElementsKind(Handle< Map > map, ElementsKind kind)
String * constructor_name()
int pre_allocated_property_fields()
Object * GetBackPointer()
Map * LookupElementsTransitionMap(ElementsKind elements_kind)
Map * elements_transition_map()
static Handle< Map > CopyAsElementsKind(Handle< Map > map, ElementsKind kind, TransitionFlag flag)
bool HasElementsTransition()
static const int kProtoTransitionMapOffset
static Handle< Map > CopyReplaceDescriptors(Handle< Map > map, Handle< DescriptorArray > descriptors, TransitionFlag flag, MaybeHandle< Name > maybe_name, SimpleTransitionFlag simple_flag=FULL_TRANSITION)
static Handle< Map > GeneralizeRepresentation(Handle< Map > map, int modify_index, Representation new_representation, Handle< HeapType > new_field_type, StoreMode store_mode)
void set_unused_property_fields(int value)
Map * GetTransition(int transition_index)
void set_construction_count(int value)
static Handle< Map > TransitionElementsTo(Handle< Map > map, ElementsKind to_kind)
static Handle< Map > Update(Handle< Map > map)
void SetNumberOfProtoTransitions(int value)
static Handle< Map > CopyInstallDescriptors(Handle< Map > map, int new_descriptor, Handle< DescriptorArray > descriptors)
static void AddDependentCompilationInfo(Handle< Map > map, DependentCode::DependencyGroup group, CompilationInfo *info)
void NotifyLeafMapLayoutChange()
static Handle< Map > CopyInsertDescriptor(Handle< Map > map, Descriptor *descriptor, TransitionFlag flag)
int IndexInCodeCache(Object *name, Code *code)
void PrintGeneralization(FILE *file, const char *reason, int modify_index, int split, int descriptors, bool constant_to_field, Representation old_representation, Representation new_representation, HeapType *old_field_type, HeapType *new_field_type)
void RemoveFromCodeCache(Name *name, Code *code, int index)
static Handle< Map > CopyGeneralizeAllRepresentations(Handle< Map > map, int modify_index, StoreMode store_mode, PropertyAttributes attributes, const char *reason)
int inobject_properties()
bool IsMapInArrayPrototypeChain()
static void EnsureDescriptorSlack(Handle< Map > map, int slack)
static Handle< Map > CopyNormalized(Handle< Map > map, PropertyNormalizationMode mode)
static MaybeHandle< Map > TryUpdate(Handle< Map > map) WARN_UNUSED_RESULT
void UpdateFieldType(int descriptor_number, Handle< Name > name, Handle< HeapType > new_type)
bool EquivalentToForNormalization(Map *other, PropertyNormalizationMode mode)
bool done_inobject_slack_tracking()
static Handle< Map > GetPrototypeTransition(Handle< Map > map, Handle< Object > prototype)
int NextFreePropertyIndex()
bool CanHaveMoreTransitions()
PropertyDetails GetLastDescriptorDetails()
static Handle< Map > CopyReplaceDescriptor(Handle< Map > map, Handle< DescriptorArray > descriptors, Descriptor *descriptor, int index, TransitionFlag flag)
bool has_instance_call_handler()
void SetNumberOfOwnDescriptors(int number)
static const int kMaxCachedPrototypeTransitions
void DeprecateTransitionTree()
static Handle< Map > PrepareForDataProperty(Handle< Map > old_map, int descriptor_number, Handle< Object > value)
static Handle< Map > CopyDropDescriptors(Handle< Map > map)
static Handle< Map > Normalize(Handle< Map > map, PropertyNormalizationMode mode)
static void AddDependentCode(Handle< Map > map, DependentCode::DependencyGroup group, Handle< Code > code)
void ZapPrototypeTransitions()
static Handle< Map > GeneralizeAllFieldRepresentations(Handle< Map > map)
static Handle< Map > ReconfigureDataProperty(Handle< Map > map, int descriptor, PropertyAttributes attributes)
static Handle< Map > PutPrototypeTransition(Handle< Map > map, Handle< Object > prototype, Handle< Map > target_map)
static const int kDependentCodeOffset
int NumberOfDescribedProperties(DescriptorFlag which=OWN_DESCRIPTORS, PropertyAttributes filter=NONE)
static const int kProtoTransitionNumberOfEntriesOffset
static bool IsValidElementsTransition(ElementsKind from_kind, ElementsKind to_kind)
static void ConnectTransition(Handle< Map > parent, Handle< Map > child, Handle< Name > name, SimpleTransitionFlag flag)
static Handle< Map > RawCopy(Handle< Map > map, int instance_size)
InstanceType instance_type()
static const int kProtoTransitionElementsPerEntry
static MaybeHandle< Map > TryUpdateInternal(Handle< Map > map) WARN_UNUSED_RESULT
void set_done_inobject_slack_tracking(bool value)
Handle< Map > FindTransitionedMap(MapHandleList *candidates)
Map * FindLastMatchMap(int verbatim, int length, DescriptorArray *descriptors)
static const int kProtoTransitionPrototypeOffset
static Handle< Map > TransitionElementsToSlow(Handle< Map > object, ElementsKind to_kind)
static void SetPrototypeTransitions(Handle< Map > map, Handle< FixedArray > prototype_transitions)
void TraverseTransitionTree(TraverseCallback callback, void *data)
static MUST_USE_RESULT MaybeHandle< Map > CopyWithConstant(Handle< Map > map, Handle< Name > name, Handle< Object > constant, PropertyAttributes attributes, TransitionFlag flag)
static Handle< Map > CopyAddDescriptor(Handle< Map > map, Descriptor *descriptor, TransitionFlag flag)
static const int kCodeCacheOffset
static void AppendCallbackDescriptors(Handle< Map > map, Handle< Object > descriptors)
bool has_fast_object_elements()
static Handle< Map > TransitionToDataProperty(Handle< Map > map, Handle< Name > name, Handle< Object > value, PropertyAttributes attributes, StoreFromKeyed store_mode)
static Handle< Map > TransitionToPrototype(Handle< Map > map, Handle< Object > prototype)
void set_inobject_properties(int value)
int NumberOfProtoTransitions()
static const int kConstructorOffset
Object * FindInCodeCache(Name *name, Code::Flags flags)
Map * FindFieldOwner(int descriptor)
static MUST_USE_RESULT MaybeHandle< Map > CopyWithField(Handle< Map > map, Handle< Name > name, Handle< HeapType > type, PropertyAttributes attributes, Representation representation, TransitionFlag flag)
bool EquivalentToForTransition(Map *other)
static Handle< Map > CopyForObserved(Handle< Map > map)
bool HasTransitionArray() const
static void AddDependentIC(Handle< Map > map, Handle< Code > stub)
bool DictionaryElementsInPrototypeChainOnly()
int SearchTransition(Name *name)
static Handle< Map > Copy(Handle< Map > map)
static const int kProtoTransitionHeaderSize
static Handle< Map > CopyForFreeze(Handle< Map > map)
bool TooManyFastProperties(StoreFromKeyed store_mode)
static Handle< Map > ShareDescriptor(Handle< Map > map, Handle< DescriptorArray > descriptors, Descriptor *descriptor)
CodeFlusher * code_flusher()
static const intptr_t kAlignmentMask
static Address & Address_at(Address addr)
static void DoGenerateNewEnumerationIndices(Handle< NameDictionary > dictionary)
int FindEntry(Handle< Name > key)
void CopyEnumKeysTo(FixedArray *storage)
static const int kHashShift
void set_hash_field(uint32_t value)
static const uint32_t kHashBitMask
static const int kIsNotArrayIndexMask
void set_top(Address top)
static Handle< NormalizedMapCache > New(Isolate *isolate)
MUST_USE_RESULT MaybeHandle< Map > Get(Handle< Map > fast_map, PropertyNormalizationMode mode)
void Set(Handle< Map > fast_map, Handle< Map > normalized_map)
static Handle< Object > AsHandle(Isolate *isolate, uint32_t key)
const char * c_str() const
void AddEntry(int entry, Object *key, Object *value)
static Handle< ObjectHashTable > Remove(Handle< ObjectHashTable > table, Handle< Object > key, bool *was_present)
Object * Lookup(Handle< Object > key)
static Handle< ObjectHashTable > Put(Handle< ObjectHashTable > table, Handle< Object > key, Handle< Object > value)
void RemoveEntry(int entry)
Handle< HeapType > OptimalType(Isolate *isolate, Representation representation)
static MUST_USE_RESULT MaybeHandle< Object > AddDataProperty(LookupIterator *it, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode)
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyOrElement(Handle< Object > object, Handle< Name > key)
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithDefinedSetter(Handle< Object > receiver, Handle< JSReceiver > setter, Handle< Object > value)
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithAccessor(Handle< Object > receiver, Handle< Name > name, Handle< Object > value, Handle< JSObject > holder, Handle< Object > structure, StrictMode strict_mode)
bool ToUint32(uint32_t *value)
static MaybeHandle< JSReceiver > ToObject(Isolate *isolate, Handle< Object > object)
static MUST_USE_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, Handle< Object > object, uint32_t index)
bool SameValue(Object *other)
friend class LookupIterator
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
@ CERTAINLY_NOT_STORE_FROM_KEYED
Map * GetRootMap(Isolate *isolate)
bool SameValueZero(Object *other)
static Handle< Object > NewStorageFor(Isolate *isolate, Handle< Object > object, Representation representation)
static MUST_USE_RESULT MaybeHandle< Object > WriteToReadOnlyProperty(LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
void ShortPrint(FILE *out=stdout)
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithDefinedGetter(Handle< Object > receiver, Handle< JSReceiver > getter)
bool FitsRepresentation(Representation representation)
static Handle< Object > SetDataProperty(LookupIterator *it, Handle< Object > value)
bool ToInt32(int32_t *value)
bool ToArrayIndex(uint32_t *index)
static Handle< Smi > GetOrCreateHash(Isolate *isolate, Handle< Object > object)
static Handle< Object > WrapForRead(Isolate *isolate, Handle< Object > object, Representation representation)
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithReceiver(Isolate *isolate, Handle< Object > object, Handle< Object > receiver, uint32_t index)
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithAccessor(Handle< Object > receiver, Handle< Name > name, Handle< JSObject > holder, Handle< Object > structure)
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
static void Initialize(Isolate *isolate, Handle< Oddball > oddball, const char *to_string, Handle< Object > to_number, byte kind)
virtual Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
Object * Lookup(Handle< Object > key)
static Handle< OrderedHashMap > Put(Handle< OrderedHashMap > table, Handle< Object > key, Handle< Object > value)
bool Contains(Handle< Object > key)
static Handle< OrderedHashSet > Add(Handle< OrderedHashSet > table, Handle< Object > key)
Smi * Next(JSArray *value_array)
static Handle< Derived > Allocate(Isolate *isolate, int capacity, PretenureFlag pretenure=NOT_TENURED)
void RemoveEntry(int entry)
int FindEntry(Handle< Object > key, int hash)
static Handle< Derived > Remove(Handle< Derived > table, Handle< Object > key, bool *was_present)
static Handle< Derived > Shrink(Handle< Derived > table)
static Handle< Derived > EnsureGrowable(Handle< Derived > table)
static Handle< Derived > Rehash(Handle< Derived > table, int new_capacity)
static Handle< Derived > Clear(Handle< Derived > table)
uint32_t HashForObject(Object *obj) OVERRIDE
MUST_USE_RESULT Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
bool IsMatch(Object *other) OVERRIDE
PolymorphicCodeCacheHashTableKey(MapHandleList *maps, int code_flags)
static MapHandleList * FromObject(Object *obj, int *code_flags, MapHandleList *maps)
static uint32_t MapsHashHelper(MapHandleList *maps, int code_flags)
Object * Lookup(MapHandleList *maps, int code_kind)
static Handle< PolymorphicCodeCacheHashTable > Put(Handle< PolymorphicCodeCacheHashTable > hash_table, MapHandleList *maps, int code_kind, Handle< Code > code)
static const int kInitialSize
Handle< Object > Lookup(MapHandleList *maps, Code::Flags flags)
static void Update(Handle< PolymorphicCodeCache > cache, MapHandleList *maps, Code::Flags flags, Handle< Code > code)
static Handle< HeapType > UpdatedType(Handle< PropertyCell > cell, Handle< Object > value)
void set_type(HeapType *value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
static void SetValueInferType(Handle< PropertyCell > cell, Handle< Object > value)
static void AddDependentCompilationInfo(Handle< PropertyCell > cell, CompilationInfo *info)
A class to uniformly access the prototype of any Object and walk its prototype chain.
bool IsAtEnd(WhereToEnd where_to_end=END_AT_NULL) const
Object * GetCurrent() const
static bool compare(const uint16_t *a, const uint16_t *b, int len)
static bool compare(const uint8_t *a, const uint8_t *b, int len)
static bool compare(const Chars1 *a, const Chars2 *b, int len)
bool IsMatch(Object *obj) OVERRIDE
RegExpKey(Handle< String > string, JSRegExp::Flags flags)
static uint32_t RegExpHash(String *string, Smi *flags)
Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
uint32_t HashForObject(Object *obj) OVERRIDE
static int ModeMask(Mode mode)
static const int kCodeTargetMask
static bool IsDebugBreakSlot(Mode mode)
static const int kPositionMask
static bool IsJSReturn(Mode mode)
static bool IsRuntimeEntry(Mode mode)
static const int kApplyMask
static bool IsCodeTarget(Mode mode)
static bool IsStatementPosition(Mode mode)
static bool IsCodeAgeSequence(Mode mode)
static const int kNoPosition
const char * Mnemonic() const
bool fits_into(const Representation &other) const
bool IsHeapObject() const
Representation generalize(Representation other)
bool Equals(const Representation &other) const
static Representation Tagged()
static Representation None()
static bool SetupArrayBufferAllocatingData(Isolate *isolate, Handle< JSArrayBuffer > array_buffer, size_t allocated_length, bool initialize=true)
static Handle< Object > GetNameOrSourceURL(Handle< Script > script)
static int GetColumnNumber(Handle< Script > script, int code_pos)
int GetLineNumberWithArray(int code_pos)
static void InitLineEnds(Handle< Script > script)
static Handle< JSObject > GetWrapper(Handle< Script > script)
static int GetLineNumber(Handle< Script > script, int code_pos)
static MUST_USE_RESULT Handle< SeededNumberDictionary > AtNumberPut(Handle< SeededNumberDictionary > dictionary, uint32_t key, Handle< Object > value)
static MUST_USE_RESULT Handle< SeededNumberDictionary > Set(Handle< SeededNumberDictionary > dictionary, uint32_t key, Handle< Object > value, PropertyDetails details)
bool requires_slow_elements()
void set_requires_slow_elements()
void UpdateMaxNumberKey(uint32_t key)
static MUST_USE_RESULT Handle< SeededNumberDictionary > AddNumberEntry(Handle< SeededNumberDictionary > dictionary, uint32_t key, Handle< Object > value, PropertyDetails details)
uint32_t max_number_key()
static int SizeFor(int length)
virtual Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
virtual bool IsMatch(Object *string) OVERRIDE
static MUST_USE_RESULT Handle< String > Truncate(Handle< SeqString > string, int new_length)
const uint16_t * SeqTwoByteStringGetData(unsigned start)
static int SizeFor(int length)
static const int kCachedCodeOffset
int start_position() const
bool VerifyBailoutId(BailoutId id)
void ResetForNewContext(int new_ic_age)
static void AddToOptimizedCodeMap(Handle< SharedFunctionInfo > shared, Handle< Context > native_context, Handle< Code > code, Handle< FixedArray > literals, BailoutId osr_ast_id)
void set_opt_count(int opt_count)
void ClearTypeFeedbackInfo()
void EnableDeoptimizationSupport(Code *recompiled)
static const int kNextMapIndex
static const int kEntriesStart
static const int kOsrAstIdOffset
void set_bailout_reason(BailoutReason reason)
STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount<=SharedFunctionInfo::kCompilerHintsSize *kBitsPerByte)
static const int kLiteralsOffset
void DisableOptimization(BailoutReason reason)
void ReplaceCode(Code *code)
bool HasSourceCode() const
static const int kInitialLength
void TrimOptimizedCodeMap(int shrink_by)
bool has_deoptimization_support()
Code * GetCodeFromOptimizedCodeMap(int index)
int SearchOptimizedCodeMap(Context *native_context, BailoutId osr_ast_id)
void set_deopt_count(int value)
void ClearOptimizedCodeMap()
void EvictFromOptimizedCodeMap(Code *optimized_code, const char *reason)
Handle< Object > GetSourceCode()
static const int kContextOffset
int CalculateInObjectProperties()
int expected_nof_properties() const
static const int kEntryLength
FixedArray * GetLiteralsFromOptimizedCodeMap(int index)
int CalculateInstanceSize()
uint16_t SlicedStringGet(int index)
void SmiPrint(OStream &os) const
static const int kMaxValue
static Smi * FromInt(int value)
static VisitorId GetVisitorId(int instance_type, int instance_size)
void Reset(String *string, int offset=0)
void VisitOneByteString(const uint8_t *chars, int length)
const uint16_t * buffer16_
DISALLOW_IMPLICIT_CONSTRUCTORS(State)
State(ConsStringIteratorOp *op)
ConsStringIteratorOp *const op_
void Advance(int consumed)
void VisitTwoByteString(const uint16_t *chars, int length)
void Init(String *string)
static bool Equals(State *state_1, State *state_2, int to_check)
bool Equals(String *string_1, String *string_2)
StringComparator(ConsStringIteratorOp *op_1, ConsStringIteratorOp *op_2)
DISALLOW_IMPLICIT_CONSTRUCTORS(StringComparator)
void AddCharacter(uint16_t c)
static uint32_t ComputeUtf8Hash(Vector< const char > chars, uint32_t seed, int *utf16_length_out)
static uint32_t MakeArrayIndexHash(uint32_t value, int length)
bool UpdateIndex(uint16_t c)
uint32_t raw_running_hash_
static const int kZeroHash
static uint32_t HashSequentialString(const schar *chars, int length, uint32_t seed)
int Search(Vector< const SubjectChar > subject, int index)
bool IsMatch(Object *other) OVERRIDE
static uint32_t StringSharedHashHelper(String *source, SharedFunctionInfo *shared, StrictMode strict_mode, int scope_position)
Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
StringSharedKey(Handle< String > source, Handle< SharedFunctionInfo > shared, StrictMode strict_mode, int scope_position)
uint32_t HashForObject(Object *obj) OVERRIDE
Handle< SharedFunctionInfo > shared_
static Handle< String > LookupString(Isolate *isolate, Handle< String > key)
static MUST_USE_RESULT MaybeHandle< String > InternalizeStringIfExists(Isolate *isolate, Handle< String > string)
static Handle< String > LookupKey(Isolate *isolate, HashTableKey *key)
static MUST_USE_RESULT MaybeHandle< String > LookupStringIfExists(Isolate *isolate, Handle< String > str)
static MUST_USE_RESULT MaybeHandle< String > LookupTwoCharsStringIfExists(Isolate *isolate, uint16_t c1, uint16_t c2)
Vector< const uint8_t > ToOneByteVector()
Vector< const uc16 > ToUC16Vector()
void StringShortPrint(StringStream *accumulator)
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
static const unsigned int kContainsCachedArrayIndexMask
const uc16 * GetTwoByteData(unsigned start)
bool MarkAsUndetectable()
FlatContent GetFlatContent()
static Handle< String > SlowFlatten(Handle< ConsString > cons, PretenureFlag tenure)
bool IsTwoByteRepresentation() const
bool IsOneByteEqualTo(Vector< const uint8_t > str)
static const int kArrayIndexValueBits
bool ComputeArrayIndex(uint32_t *index)
SmartArrayPointer< uc16 > ToWideCString(RobustnessFlag robustness_flag=FAST_STRING_TRAVERSAL)
static const int kMaxHashCalcLength
bool SlowAsArrayIndex(uint32_t *index)
uint32_t ComputeAndSetHash()
static const int kMaxShortPrintLength
bool SlowEquals(String *other)
bool IsUtf8EqualTo(Vector< const char > str, bool allow_prefix_match=false)
bool MakeExternal(v8::String::ExternalStringResource *resource)
bool IsTwoByteEqualTo(Vector< const uc16 > str)
void PrintUC16(OStream &os, int start=0, int end=-1)
static ConsString * VisitFlat(Visitor *visitor, String *string, int offset=0)
bool IsOneByteRepresentation() const
static const int kMaxArrayIndexSize
SmartArrayPointer< char > ToCString(AllowNullsFlag allow_nulls, RobustnessFlag robustness_flag, int offset, int length, int *length_output=0)
static Handle< String > Flatten(Handle< String > string, PretenureFlag pretenure=NOT_TENURED)
static Handle< FixedArray > CalculateLineEnds(Handle< String > string, bool include_ending_line)
static bool IsOneByte(const uc16 *chars, int length)
static const int kMaxCachedArrayIndexLength
bool Equals(String *other)
bool IsMatch(Object *strings) OVERRIDE
Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
uint32_t HashForObject(Object *obj) OVERRIDE
StringsKey(Handle< FixedArray > strings)
Handle< FixedArray > strings_
static const char * Name(Value tok)
int number_of_transitions()
bool HasPrototypeTransitions()
static const int kNotFound
Map * GetTarget(int transition_number)
static Handle< TransitionArray > CopyInsert(Handle< Map > map, Handle< Name > name, Handle< Map > target, SimpleTransitionFlag flag)
FixedArray * GetPrototypeTransitions()
TraversableMap * ChildIteratorNext(Object *constructor)
void SetParent(TraversableMap *parent)
TraversableMap * GetAndResetParent()
virtual Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
bool IsMatch(Object *o) OVERRIDE
Handle< Object > AsHandle(Isolate *isolate) OVERRIDE
TwoCharHashTableKey(uint16_t c1, uint16_t c2, uint32_t seed)
uint32_t HashForObject(Object *key) OVERRIDE
static Object * RawUninitializedSentinel(Heap *heap)
bool NowIs(TypeImpl *that)
static TypeHandle Constant(i::Handle< i::Object > value, Region *region)
static TypeImpl * cast(typename Config::Base *object)
void PrintTo(OStream &os, PrintDimension dim=BOTH_DIMS)
static TypeHandle Class(i::Handle< i::Map > map, Region *region)
static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region *reg)
static MUST_USE_RESULT Handle< UnseededNumberDictionary > Set(Handle< UnseededNumberDictionary > dictionary, uint32_t key, Handle< Object > value)
static MUST_USE_RESULT Handle< UnseededNumberDictionary > AtNumberPut(Handle< UnseededNumberDictionary > dictionary, uint32_t key, Handle< Object > value)
static MUST_USE_RESULT Handle< UnseededNumberDictionary > AddNumberEntry(Handle< UnseededNumberDictionary > dictionary, uint32_t key, Handle< Object > value)
Vector< T > SubVector(int from, int to)
static Vector< T > New(int length)
static const char *const kTagNames[kNumberOfSyncTags]
static const char *const kTags[kNumberOfSyncTags]
void AddEntry(int entry, Handle< Object > key, Handle< Object > value)
Object * Lookup(Handle< Object > key)
static MUST_USE_RESULT Handle< WeakHashTable > Put(Handle< WeakHashTable > table, Handle< Object > key, Handle< Object > value)
#define PROFILE(IsolateGetter, Call)
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 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 keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_BOOL(profile_deserialization
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 A file to write the raw context snapshot bytes Write V8 startup blob file(mksnapshot only)") DEFINE_BOOL(profile_hydrogen_code_stub_compilation
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 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T)
#define RETURN_ON_EXCEPTION(isolate, call, T)
#define THROW_NEW_ERROR(isolate, call, T)
#define RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, T)
#define RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, value)
#define LOG(isolate, Call)
#define CHECK_EQ(expected, value)
#define DCHECK_LE(v1, v2)
#define CHECK_NE(unexpected, value)
#define DCHECK_NE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
uint32_t RoundUpToPowerOfTwo32(uint32_t value)
bool IsPowerOfTwo32(uint32_t value)
static int comparator(const HeapObjectInfo *a, const HeapObjectInfo *b)
Vector< const char > CStrVector(const char *data)
void CopyChars(sinkchar *dest, const sourcechar *src, int chars)
bool IsFastHoleyElementsKind(ElementsKind kind)
uint32_t DoubleToUint32(double x)
static void ShrinkInstanceSize(Map *map, void *data)
static bool FilterKey(Object *key, PropertyAttributes filter)
static Handle< Object > ExternalArrayIntSetter(Isolate *isolate, Handle< ExternalArrayClass > receiver, uint32_t index, Handle< Object > value)
ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number)
bool IsExternalArrayElementsKind(ElementsKind kind)
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
uint32_t ComputeLongHash(uint64_t key)
bool CanTransitionToMoreGeneralFastElementsKind(ElementsKind elements_kind, bool allow_only_packed)
PrototypeOptimizationMode
static Map * FindClosestElementsTransition(Map *map, ElementsKind to_kind)
static int min(int a, int b)
static ElementsKind FixedToExternalElementsKind(ElementsKind elements_kind)
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
bool IsFastSmiOrObjectElementsKind(ElementsKind kind)
const uint32_t kTwoByteStringTag
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind)
int CompareChars(const lchar *lhs, const rchar *rhs, int chars)
bool IsTransitionElementsKind(ElementsKind kind)
static Handle< Object > GetPrimitiveValue(const PrimitiveValueDescriptor &descriptor, char *ptr, Isolate *isolate)
Handle< Object > CacheInitialJSArrayMaps(Handle< Context > native_context, Handle< Map > initial_map)
void CheckArrayAbuse(Handle< JSObject > obj, const char *op, uint32_t key, bool allow_appending)
static void CalculateLineEndsImpl(Isolate *isolate, List< int > *line_ends, Vector< const SourceChar > src, bool include_ending_line)
unsigned int FastD2UI(double x)
static void ClearWrapperCacheWeakCallback(const v8::WeakCallbackData< v8::Value, void > &data)
@ USE_DEFAULT_MINIMUM_CAPACITY
@ USE_CUSTOM_MINIMUM_CAPACITY
static Handle< Map > AddMissingElementsTransitions(Handle< Map > map, ElementsKind to_kind)
ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, bool allow_only_packed)
static bool CheckEquivalent(Map *first, Map *second)
static Handle< Object > GetDeclaredAccessorProperty(Handle< Object > receiver, Handle< DeclaredAccessorInfo > info, Isolate *isolate)
static Handle< Object > PerformCompare(const BitmaskCompareDescriptor &descriptor, char *ptr, Isolate *isolate)
void MemsetPointer(T **dest, U *value, int counter)
bool IsHoleyElementsKind(ElementsKind kind)
int SNPrintF(Vector< char > str, const char *format,...)
const int kElementsKindCount
int ToNumber(Register reg)
kSerializedDataOffset Object
static bool CodeListContains(Object *head, Code *code)
static void InsertionSortPairs(FixedArray *content, FixedArray *numbers, int len)
const int kPointerSizeLog2
@ LAST_NONCALLABLE_SPEC_OBJECT_TYPE
@ FIRST_NONCALLABLE_SPEC_OBJECT_TYPE
@ FIXED_DOUBLE_ARRAY_TYPE
@ JS_GENERATOR_OBJECT_TYPE
@ MUTABLE_HEAP_NUMBER_TYPE
@ SHARED_FUNCTION_INFO_TYPE
@ FAST_HOLEY_DOUBLE_ELEMENTS
@ SLOPPY_ARGUMENTS_ELEMENTS
@ TERMINAL_FAST_ELEMENTS_KIND
@ FAST_HOLEY_SMI_ELEMENTS
@ FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND
static void FreezeDictionary(Dictionary *dictionary)
const char * ElementsKindToString(ElementsKind kind)
bool IsFastDoubleElementsKind(ElementsKind kind)
Handle< T > handle(T *t, Isolate *isolate)
const uint32_t kOneByteStringTag
static uint32_t ObjectAddressForHashing(Object *object)
@ ROBUST_STRING_TRAVERSAL
static bool AnWord(String *str)
static To * CheckedCast(void *from)
int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind)
bool IsFastPackedElementsKind(ElementsKind kind)
const bool FLAG_enable_slow_asserts
OStream & operator<<(OStream &os, const BasicBlockProfiler &p)
static void EndPerformSplice(Handle< JSArray > object)
static const int kInvalidEnumCacheSentinel
static Handle< FixedArray > GetEnumPropertyKeys(Handle< JSObject > object, bool cache_result)
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
static bool ContainsMap(MapHandleList *maps, Handle< Map > map)
const int kFastElementsKindCount
static bool FindAllCanWriteHolder(LookupIterator *it)
const char * GetBailoutReason(BailoutReason reason)
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)
ElementsKind GetNextTransitionElementsKind(ElementsKind kind)
static void GetMinInobjectSlack(Map *map, void *data)
const uint32_t kStringRepresentationMask
static Handle< FixedArray > ReduceFixedArrayTo(Handle< FixedArray > array, int length)
static bool IsCodeEquivalent(Code *code, Code *recompiled)
bool IsTerminalElementsKind(ElementsKind kind)
static int AppendUniqueCallbacks(NeanderArray *callbacks, Handle< typename T::Array > array, int valid_descriptors)
int32_t NumberToInt32(Object *number)
bool IsFastElementsKind(ElementsKind kind)
static bool CompareRawStringContents(const Char *const a, const Char *const b, int length)
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset kInstanceCallHandlerOffset kInternalFieldCountOffset dependent_code
static uint32_t Hash(RegisteredExtension *extension)
static const int kMaxNumberOfDescriptors
void PrintF(const char *format,...)
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
int32_t DoubleToInt32(double x)
bool IsDictionaryElementsKind(ElementsKind kind)
uint32_t NumberToUint32(Object *number)
static Smi * GenerateIdentityHash(Isolate *isolate)
static Code::Age EffectiveAge(Code::Age age)
int TenToThe(int exponent)
kFeedbackVectorOffset flag
static int ArchiveSpacePerThread()
static bool GetOldValue(Isolate *isolate, Handle< JSObject > object, uint32_t index, List< Handle< Object > > *old_values, List< uint32_t > *indices)
const int kMaxKeyedPolymorphism
static Handle< SeededNumberDictionary > CopyFastElementsToDictionary(Handle< FixedArrayBase > array, int length, Handle< SeededNumberDictionary > dictionary)
@ kDescriptorBitmaskCompare
@ kDescriptorPointerDereference
@ kDescriptorPointerShift
@ kDescriptorObjectDereference
@ kDescriptorPrimitiveValue
@ kDescriptorReturnObject
@ kDescriptorPointerCompare
bool IsFixedTypedArrayElementsKind(ElementsKind kind)
double FastUI2D(unsigned x)
static void BeginPerformSplice(Handle< JSArray > object)
static bool ContainsOnlyValidKeys(Handle< FixedArray > array)
const uint32_t kMaxUInt32
bool IsFastSmiElementsKind(ElementsKind kind)
bool StringToArrayIndex(Stream *stream, uint32_t *index)
static bool UpdateGetterSetterInDictionary(SeededNumberDictionary *dictionary, uint32_t index, Object *getter, Object *setter, PropertyAttributes attributes)
bool IsTransitionableFastElementsKind(ElementsKind from_kind)
void MemCopy(void *dest, const void *src, size_t size)
ElementsKind GetInitialFastElementsKind()
uint64_t double_to_uint64(double d)
static bool FindAllCanReadHolder(LookupIterator *it)
static Handle< Smi > GetOrCreateIdentityHashHelper(Handle< ProxyType > proxy)
static void EnqueueSpliceRecord(Handle< JSArray > object, uint32_t index, Handle< JSArray > deleted, uint32_t add_count)
void CopyBytes(uint8_t *target, uint8_t *source)
static Handle< T > MaybeNull(T *p)
@ INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE
bool IsFastObjectElementsKind(ElementsKind kind)
void HeapSortPairs(FixedArray *content, FixedArray *numbers, int len)
PropertyNormalizationMode
@ KEEP_INOBJECT_PROPERTIES
@ CLEAR_INOBJECT_PROPERTIES
Debugger support for the V8 JavaScript engine.
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Returns the value of the property if the getter intercepts the request.
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Returns the value if the setter intercepts the request.
void(* NamedPropertyGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
NamedProperty[Getter|Setter] are used as interceptors on object.
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
Returns a non-empty handle if the deleter intercepts the request.
void(* NamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Returns an array containing the names of the properties the named property getter intercepts.
void(* AccessorNameGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
void(* NamedPropertySetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Returns the value if the setter intercepts the request.
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
Returns a non-empty handle if the interceptor intercepts the request.
void(* NamedPropertyDeleterCallback)(Local< String > property, const PropertyCallbackInfo< Boolean > &info)
Returns a non-empty handle if the deleter intercepts the request.
void(* NamedPropertyQueryCallback)(Local< String > property, const PropertyCallbackInfo< Integer > &info)
Returns a non-empty handle if the interceptor intercepts the request.
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Returns an array containing the indices of the properties the indexed property getter intercepts.
Handle< Primitive > Undefined(Isolate *isolate)
#define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size)
#define DECLARE_TAG(ignore1, name, ignore2)
#define HANDLE_CODE_AGE(AGE)
#define INSTANCE_TYPE_TO_ELEMENT_SIZE(Type, type, TYPE, ctype, size)
#define TYPED_ARRAY_SHORT_PRINT(Type, type, TYPE, ctype, size)
#define MAKE_STRUCT_CASE(NAME, Name, name)
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size)
#define CODE_KIND_LIST(V)
#define VISITOR_SYNCHRONIZATION_TAGS_LIST(V)
#define DCHECK_OBJECT_ALIGNED(address)
A simple Maybe type, representing an object which may or may not have a value.
struct BitmaskCompareDescriptor bitmask_compare_descriptor
struct PrimitiveValueDescriptor primitive_value_descriptor
struct PointerCompareDescriptor pointer_compare_descriptor
struct PointerShiftDescriptor pointer_shift_descriptor
struct ObjectDerefenceDescriptor object_dereference_descriptor
AccessorDescriptorType type
static void Insert(Handle< Name > key, Handle< AccessorInfo > entry, int valid_descriptors, Handle< DescriptorArray > array)
static bool Contains(Handle< Name > key, Handle< AccessorInfo > entry, int valid_descriptors, Handle< DescriptorArray > array)
static const char * AllocationIndexToString(int index)
EnumIndexComparator(NameDictionary *dict)
static bool Contains(Handle< Name > key, Handle< AccessorInfo > entry, int valid_descriptors, Handle< FixedArray > array)
static void Insert(Handle< Name > key, Handle< AccessorInfo > entry, int valid_descriptors, Handle< FixedArray > array)
v8::DeclaredAccessorDescriptorDataType data_type
const SharedFunctionInfo * value
#define T(name, string, precedence)
#define STATIC_CHAR_VECTOR(x)