51 #ifdef ENABLE_DISASSEMBLER
60 MUST_USE_RESULT static MaybeObject* CreateJSValue(JSFunction* constructor,
63 { MaybeObject* maybe_result =
64 constructor->GetHeap()->AllocateJSObject(constructor);
65 if (!maybe_result->ToObject(&result))
return maybe_result;
74 return CreateJSValue(global_context->number_function(),
this);
75 }
else if (IsBoolean()) {
76 return CreateJSValue(global_context->boolean_function(),
this);
77 }
else if (IsString()) {
78 return CreateJSValue(global_context->string_function(),
this);
88 }
else if (IsNumber()) {
89 Isolate* isolate = Isolate::Current();
91 return CreateJSValue(global_context->number_function(),
this);
92 }
else if (IsBoolean()) {
95 return CreateJSValue(global_context->boolean_function(),
this);
96 }
else if (IsString()) {
99 return CreateJSValue(global_context->string_function(),
this);
108 if (IsTrue())
return this;
109 if (IsFalse())
return this;
114 if (heap_object->IsUndefined() || heap_object->IsNull()) {
115 return heap_object->
GetHeap()->false_value();
118 if (heap_object->IsUndetectableObject()) {
119 return heap_object->
GetHeap()->false_value();
121 if (heap_object->IsString()) {
125 if (heap_object->IsHeapNumber()) {
128 return heap_object->
GetHeap()->true_value();
134 if (IsJSReceiver()) {
139 holder = global_context->number_function()->instance_prototype();
140 }
else if (IsString()) {
141 holder = global_context->string_function()->instance_prototype();
142 }
else if (IsBoolean()) {
143 holder = global_context->boolean_function()->instance_prototype();
156 MaybeObject* value =
GetProperty(receiver, &result, name, attributes);
169 if (structure->IsForeign()) {
173 MaybeObject* value = (callback->
getter)(receiver, callback->
data);
179 if (structure->IsAccessorInfo()) {
189 return isolate->
Throw(*error);
191 Object* fun_obj = data->getter();
196 LOG(isolate, ApiNamedPropertyAccess(
"load",
self, name));
202 VMState state(isolate, EXTERNAL);
206 if (result.IsEmpty()) {
207 return isolate->
heap()->undefined_value();
213 if (structure->IsAccessorPair()) {
215 if (getter->IsSpecFunction()) {
220 return isolate->
heap()->undefined_value();
237 "get", isolate->derived_get_trap(),
ARRAY_SIZE(args), args);
245 Isolate* isolate =
object->IsHeapObject()
247 : Isolate::Current();
256 if (!maybe->To<
String>(&name))
return maybe;
267 if (!maybe->To<
String>(&name))
return maybe;
275 if (!maybe->To<
String>(&name))
return maybe;
285 #ifdef ENABLE_DEBUGGER_SUPPORT
286 Debug* debug = fun->GetHeap()->isolate()->debug();
289 if (debug->StepInActive() && fun->IsJSFunction()) {
295 bool has_pending_exception;
307 LookupResult* result,
310 if (result->IsProperty()) {
311 switch (result->type()) {
314 Object* obj = result->GetCallbackObject();
315 if (obj->IsAccessorInfo()) {
318 *attributes = result->GetAttributes();
319 return result->holder()->GetPropertyWithCallback(
320 receiver, result->GetCallbackObject(),
name);
330 result->holder()->LookupRealNamedPropertyInPrototypes(name, &r);
331 if (r.IsProperty()) {
343 result->holder()->LookupRealNamedProperty(name, &r);
344 if (r.IsProperty()) {
361 return heap->undefined_value();
367 LookupResult* result,
369 bool continue_search) {
370 if (result->IsProperty()) {
371 switch (result->type()) {
374 Object* obj = result->GetCallbackObject();
375 if (obj->IsAccessorInfo()) {
378 return result->GetAttributes();
387 if (!continue_search)
break;
390 result->holder()->LookupRealNamedPropertyInPrototypes(name, &r);
391 if (r.IsProperty()) {
404 if (continue_search) {
405 result->holder()->LookupRealNamedProperty(name, &r);
407 result->holder()->LocalLookupRealNamedProperty(name, &r);
409 if (r.IsProperty()) {
431 if (IsGlobalObject()) {
434 ASSERT(!value->IsJSGlobalPropertyCell());
441 if (IsGlobalObject()) {
445 cell->set_value(value);
456 PropertyDetails details) {
458 object->SetNormalizedProperty(*key, *value, details),
465 PropertyDetails details) {
469 Object* store_value = value;
470 if (IsGlobalObject()) {
472 MaybeObject* maybe_store_value =
474 if (!maybe_store_value->ToObject(&store_value))
return maybe_store_value;
477 { MaybeObject* maybe_dict =
479 if (!maybe_dict->ToObject(&dict))
return maybe_dict;
485 details = PropertyDetails(details.attributes(),
488 if (IsGlobalObject()) {
491 cell->set_value(value);
507 if (IsGlobalObject()) {
508 PropertyDetails details = dictionary->
DetailsAt(entry);
509 if (details.IsDontDelete()) {
517 if (!maybe_new_map->ToObject(&new_map))
return maybe_new_map;
523 cell->set_value(cell->
GetHeap()->the_hole_value());
527 if (deleted ==
GetHeap()->true_value()) {
529 MaybeObject* maybe_properties = dictionary->
Shrink(name);
530 if (!maybe_properties->To(&new_properties)) {
531 return maybe_properties;
533 set_properties(new_properties);
538 return GetHeap()->true_value();
544 if (!cons_obj->IsJSFunction())
547 if (!fun->shared()->IsApiFunction())
559 LookupResult* result,
562 Isolate* isolate =
object->IsHeapObject()
564 : Isolate::Current();
567 object->GetProperty(*receiver, result, *key, attributes),
573 LookupResult* result,
578 AssertNoContextChange ncc;
588 if (!result->IsHandler()) {
589 Object* last = result->IsProperty()
594 if (current->IsAccessCheckNeeded()) {
610 if (current == last)
break;
614 if (!result->IsProperty()) {
616 return heap->undefined_value();
618 *attributes = result->GetAttributes();
620 switch (result->type()) {
622 value = result->holder()->GetNormalizedProperty(result);
623 ASSERT(!value->IsTheHole() || result->IsReadOnly());
624 return value->IsTheHole() ? heap->undefined_value() : value;
626 value = result->holder()->FastPropertyAt(result->GetFieldIndex());
627 ASSERT(!value->IsTheHole() || result->IsReadOnly());
628 return value->IsTheHole() ? heap->undefined_value() : value;
630 return result->GetConstantFunction();
632 return result->holder()->GetPropertyWithCallback(
633 receiver, result->GetCallbackObject(),
name);
635 return result->proxy()->GetPropertyWithHandler(receiver, name);
638 return result->holder()->GetPropertyWithInterceptor(
639 recvr, name, attributes);
653 ? Isolate::Current()->heap()
660 holder != heap->null_value();
662 if (!holder->IsJSObject()) {
665 if (holder->IsNumber()) {
666 holder = global_context->number_function()->instance_prototype();
667 }
else if (holder->IsString()) {
668 holder = global_context->string_function()->instance_prototype();
669 }
else if (holder->IsBoolean()) {
670 holder = global_context->boolean_function()->instance_prototype();
671 }
else if (holder->IsJSProxy()) {
675 ASSERT(holder->IsUndefined() || holder->IsNull());
676 return heap->undefined_value();
686 if (js_object->IsAccessCheckNeeded()) {
690 return heap->undefined_value();
698 if (js_object->elements() != heap->empty_fixed_array()) {
700 receiver, js_object, index);
701 if (result != heap->the_hole_value())
return result;
705 return heap->undefined_value();
711 Heap* heap = Isolate::Current()->heap();
713 return context->number_function()->instance_prototype();
720 if (heap_object->IsJSReceiver()) {
721 return heap_object->
map()->prototype();
726 if (heap_object->IsHeapNumber()) {
727 return context->number_function()->instance_prototype();
729 if (heap_object->IsString()) {
730 return context->string_function()->instance_prototype();
732 if (heap_object->IsBoolean()) {
733 return context->boolean_function()->instance_prototype();
735 return heap->null_value();
755 if (IsJSReceiver()) {
765 if (other ==
this)
return true;
766 if (!IsHeapObject() || !other->IsHeapObject())
return false;
770 if (IsNumber() && other->IsNumber()) {
771 double this_value =
Number();
772 double other_value = other->
Number();
773 return (this_value == other_value) ||
776 if (IsString() && other->IsString()) {
794 }
else if (IsFailure()) {
813 accumulator->
Add(
"Failure(%p)", reinterpret_cast<void*>(value()));
818 PrintF(out,
"Failure(%p)", reinterpret_cast<void*>(value()));
827 static bool AnWord(
String* str) {
828 if (str->
length() == 0)
return false;
829 int c0 = str->Get(0);
830 int c1 = str->
length() > 1 ? str->Get(1) : 0;
835 }
else if (c0 ==
'A' || c0 ==
'E' || c0 ==
'I' || c0 ==
'O') {
837 }
else if ((c1 == 0 || (c1 >=
'A' && c1 <=
'Z')) &&
838 (c0 ==
'F' || c0 ==
'H' || c0 ==
'M' || c0 ==
'N' || c0 ==
'R' ||
839 c0 ==
'S' || c0 ==
'X')) {
846 MaybeObject* String::SlowTryFlatten(
PretenureFlag pretenure) {
852 if (!
HEAP->IsAllocationAllowed())
return this;
856 switch (StringShape(
this).representation_tag()) {
859 if (cs->second()->length() == 0) {
870 { MaybeObject* maybe_object = heap->AllocateRawAsciiString(len, tenure);
871 if (!maybe_object->ToObject(&
object))
return maybe_object;
874 String* first = cs->first();
875 int first_length = first->length();
878 String* second = cs->second();
884 { MaybeObject* maybe_object =
885 heap->AllocateRawTwoByteString(len, tenure);
886 if (!maybe_object->ToObject(&
object))
return maybe_object;
890 String* first = cs->first();
891 int first_length = first->length();
893 String* second = cs->second();
899 cs->set_first(result);
912 ASSERT(!this->IsExternalString());
919 ASSERT(memcmp(smart_chars.start(),
921 resource->
length() *
sizeof(smart_chars[0])) == 0);
925 int size = this->
Size();
930 bool is_symbol = this->IsSymbol();
937 ? (is_ascii ? heap->external_symbol_with_ascii_data_map()
938 : heap->external_symbol_map())
939 : (is_ascii ? heap->external_string_with_ascii_data_map()
940 : heap->external_string_map()));
944 ? (is_ascii ? heap->short_external_symbol_with_ascii_data_map()
945 : heap->short_external_symbol_map())
946 : (is_ascii ? heap->short_external_string_with_ascii_data_map()
947 : heap->short_external_string_map()));
950 self->set_resource(resource);
951 if (is_symbol)
self->Hash();
954 int new_size = this->
Size();
971 ASSERT(memcmp(smart_chars.start(),
973 resource->
length() *
sizeof(smart_chars[0])) == 0);
977 int size = this->
Size();
981 bool is_symbol = this->IsSymbol();
987 is_symbol ? heap->external_ascii_symbol_map()
988 : heap->external_ascii_string_map());
991 is_symbol ? heap->short_external_ascii_symbol_map()
992 : heap->short_external_ascii_string_map());
995 self->set_resource(resource);
996 if (is_symbol)
self->Hash();
999 int new_size = this->
Size();
1012 accumulator->
Add(
"<Very long string[%u]>", len);
1017 accumulator->
Add(
"<Invalid String>");
1023 bool truncated =
false;
1029 for (
int i = 0; i < len; i++) {
1032 if (c < 32 || c >= 127) {
1038 accumulator->
Add(
"<String[%u]: ",
length());
1039 for (
int i = 0; i < len; i++) {
1042 accumulator->
Put(
'>');
1046 accumulator->
Add(
"<String[%u]\\: ",
length());
1047 for (
int i = 0; i < len; i++) {
1050 accumulator->
Add(
"\\n");
1051 }
else if (c ==
'\r') {
1052 accumulator->
Add(
"\\r");
1053 }
else if (c ==
'\\') {
1054 accumulator->
Add(
"\\\\");
1055 }
else if (c < 32 || c > 126) {
1056 accumulator->
Add(
"\\x%02x", c);
1058 accumulator->
Put(c);
1062 accumulator->
Put(
'.');
1063 accumulator->
Put(
'.');
1064 accumulator->
Put(
'.');
1066 accumulator->
Put(
'>');
1073 switch (
map()->instance_type()) {
1075 double length =
JSArray::cast(
this)->length()->IsUndefined()
1078 accumulator->
Add(
"<JS Array[%u]>", static_cast<uint32_t>(length));
1082 accumulator->
Add(
"<JS WeakMap>");
1086 accumulator->
Add(
"<JS RegExp>");
1091 bool printed =
false;
1092 if (fun_name->IsString()) {
1095 accumulator->
Add(
"<JS Function ");
1096 accumulator->
Put(str);
1097 accumulator->
Put(
'>');
1102 accumulator->
Add(
"<JS Function>");
1109 Map* map_of_this =
map();
1111 Object* constructor = map_of_this->constructor();
1112 bool printed =
false;
1113 if (constructor->IsHeapObject() &&
1115 accumulator->
Add(
"!!!INVALID CONSTRUCTOR!!!");
1117 bool global_object = IsJSGlobalProxy();
1118 if (constructor->IsJSFunction()) {
1120 accumulator->
Add(
"!!!INVALID SHARED ON CONSTRUCTOR!!!");
1124 if (constructor_name->IsString()) {
1127 bool vowel = AnWord(str);
1128 accumulator->
Add(
"<%sa%s ",
1129 global_object ?
"Global Object: " :
"",
1131 accumulator->
Put(str);
1138 accumulator->
Add(
"<JS %sObject", global_object ?
"Global " :
"");
1142 accumulator->
Add(
" value = ");
1145 accumulator->
Put(
'>');
1155 if (from_kind != to_kind) {
1156 PrintF(file,
"elements transition [");
1176 accumulator->
Add(
"!!!INVALID POINTER!!!");
1180 accumulator->
Add(
"!!!INVALID MAP!!!");
1184 accumulator->
Add(
"%p ",
this);
1194 switch (
map()->instance_type()) {
1196 accumulator->
Add(
"<Map(elements=%u)>",
Map::cast(
this)->elements_kind());
1202 accumulator->
Add(
"<FixedDoubleArray[%u]>",
1212 accumulator->
Add(
"<ExternalPixelArray[%u]>",
1216 accumulator->
Add(
"<ExternalByteArray[%u]>",
1220 accumulator->
Add(
"<ExternalUnsignedByteArray[%u]>",
1224 accumulator->
Add(
"<ExternalShortArray[%u]>",
1228 accumulator->
Add(
"<ExternalUnsignedShortArray[%u]>",
1232 accumulator->
Add(
"<ExternalIntArray[%u]>",
1236 accumulator->
Add(
"<ExternalUnsignedIntArray[%u]>",
1240 accumulator->
Add(
"<ExternalFloatArray[%u]>",
1244 accumulator->
Add(
"<ExternalDoubleArray[%u]>",
1248 accumulator->
Add(
"<SharedFunctionInfo>");
1251 accumulator->
Add(
"<JSMessageObject>");
1253 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1255 accumulator->Put('<'); \
1256 accumulator->Add(#Name); \
1257 accumulator->Put('>'); \
1260 #undef MAKE_STRUCT_CASE
1262 accumulator->
Add(
"<Code>");
1266 accumulator->
Add(
"<undefined>");
1267 else if (IsTheHole())
1268 accumulator->
Add(
"<the hole>");
1270 accumulator->
Add(
"<null>");
1272 accumulator->
Add(
"<true>");
1274 accumulator->
Add(
"<false>");
1276 accumulator->
Add(
"<Odd Oddball>");
1280 accumulator->
Add(
"<Number: ");
1282 accumulator->
Put(
'>');
1285 accumulator->
Add(
"<JSProxy>");
1288 accumulator->
Add(
"<JSFunctionProxy>");
1291 accumulator->
Add(
"<Foreign>");
1294 accumulator->
Add(
"Cell for ");
1298 accumulator->
Add(
"<Other heap object (%d)>",
map()->instance_type());
1330 ExternalAsciiStringIterateBody(v);
1333 ExternalTwoByteStringIterateBody(v);
1364 ->JSFunctionIterateBody(object_size, v);
1376 reinterpret_cast<Foreign*
>(
this)->ForeignIterateBody(v);
1382 reinterpret_cast<Code*
>(
this)->CodeIterateBody(v);
1407 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1410 #undef MAKE_STRUCT_CASE
1414 PrintF(
"Unknown type: %d\n", type);
1422 #if __BYTE_ORDER == __LITTLE_ENDIAN
1424 #elif __BYTE_ORDER == __BIG_ENDIAN
1431 return GetHeap()->false_value();
1436 return GetHeap()->false_value();
1438 return GetHeap()->true_value();
1456 accumulator->
Add(
"%s", buffer.
start());
1461 if (IsJSFunction() && IsJSFunctionProxy()) {
1462 return GetHeap()->function_class_symbol();
1464 if (
map()->constructor()->IsJSFunction()) {
1466 return String::cast(constructor->shared()->instance_class_name());
1469 return GetHeap()->Object_symbol();
1474 if (
map()->constructor()->IsJSFunction()) {
1477 if (name->
length() > 0)
return name;
1478 String* inferred_name = constructor->shared()->inferred_name();
1479 if (inferred_name->
length() > 0)
return inferred_name;
1485 return GetHeap()->Object_symbol();
1493 if (
map()->unused_property_fields() == 0) {
1494 ASSERT(
map()->unused_property_fields() == 0);
1497 { MaybeObject* maybe_values =
1498 properties()->CopySize(properties()->length() + new_unused + 1);
1499 if (!maybe_values->ToObject(&values))
return maybe_values;
1511 if (!buffer->
has_more())
return false;
1528 ASSERT(!IsJSGlobalProxy());
1537 { MaybeObject* maybe_obj =
1539 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
1551 { MaybeObject* maybe_new_descriptors =
1553 if (!maybe_new_descriptors->ToObject(&new_descriptors)) {
1554 return maybe_new_descriptors;
1561 int descriptor_index = old_descriptors->Search(name);
1566 bool allow_map_transition =
1567 can_insert_transition &&
1570 ASSERT(index <
map()->inobject_properties() ||
1571 (index -
map()->inobject_properties()) < properties()->length() ||
1572 map()->unused_property_fields() == 0);
1576 if (!maybe_r->ToObject(&r))
return maybe_r;
1579 if (allow_map_transition) {
1584 if (!maybe_r->ToObject(&r))
return maybe_r;
1589 if (
map()->unused_property_fields() == 0) {
1592 { MaybeObject* maybe_obj =
1594 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
1600 { MaybeObject* maybe_values =
1601 properties()->CopySize(properties()->length() +
kFieldsAdded);
1602 if (!maybe_values->ToObject(&values))
return maybe_values;
1611 if (allow_map_transition) {
1612 map()->set_instance_descriptors(old_descriptors);
1628 { MaybeObject* maybe_new_descriptors =
1630 if (!maybe_new_descriptors->ToObject(&new_descriptors)) {
1631 return maybe_new_descriptors;
1638 if (!maybe_new_map->ToObject(&new_map))
return maybe_new_map;
1642 Map::cast(new_map)->set_instance_descriptors(descriptors);
1650 object_function()->
map()) {
1655 if (IsGlobalObject()) {
1663 if (attributes !=
NONE) {
1667 { MaybeObject* maybe_new_descriptors =
1669 if (!maybe_new_descriptors->ToObject(&new_descriptors)) {
1687 Object* store_value = value;
1688 if (IsGlobalObject()) {
1692 store_value = dict->
ValueAt(entry);
1697 PropertyDetails details = PropertyDetails(attributes,
NORMAL, index);
1699 dict->
SetEntry(entry, name, store_value, details);
1703 { MaybeObject* maybe_store_value =
1705 if (!maybe_store_value->ToObject(&store_value))
return maybe_store_value;
1709 PropertyDetails details = PropertyDetails(attributes,
NORMAL);
1711 { MaybeObject* maybe_result = dict->
Add(name, store_value, details);
1712 if (!maybe_result->ToObject(&result))
return maybe_result;
1724 ASSERT(!IsJSGlobalProxy());
1725 Map* map_of_this =
map();
1733 *
FACTORY->NewTypeError(
"object_not_extensible",
1739 if (map_of_this->instance_descriptors()->number_of_descriptors() <
1741 if (value->IsJSFunction()) {
1752 { MaybeObject* maybe_obj =
1754 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
1770 if (result.IsFound()) {
1773 return SetProperty(&result, name, value, attributes, strict_mode);
1776 MaybeObject* result_object;
1778 SetPropertyViaPrototypes(name, value, attributes, strict_mode, &done);
1779 if (done)
return result_object;
1781 return AddProperty(name, value, attributes, strict_mode);
1789 int old_index = dictionary->
FindEntry(name);
1790 int new_enumeration_index = 0;
1791 if (old_index != -1) {
1794 new_enumeration_index = dictionary->
DetailsAt(old_index).index();
1797 PropertyDetails new_details(attributes,
NORMAL, new_enumeration_index);
1808 { MaybeObject* maybe_result =
1810 if (!maybe_result->ToObject(&result))
return maybe_result;
1819 object_function()->
map()) {
1827 { MaybeObject* maybe_new_descriptors = old_map->instance_descriptors()->
1829 if (!maybe_new_descriptors->ToObject(&new_descriptors)) {
1842 if (
map()->unused_property_fields() == 0 &&
1845 { MaybeObject* maybe_obj =
1847 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
1855 Object* descriptors_unchecked;
1856 { MaybeObject* maybe_descriptors_unchecked =
map()->instance_descriptors()->
1858 if (!maybe_descriptors_unchecked->ToObject(&descriptors_unchecked)) {
1859 return maybe_descriptors_unchecked;
1866 Object* new_map_unchecked;
1868 if (!maybe_new_map_unchecked->ToObject(&new_map_unchecked)) {
1869 return maybe_new_map_unchecked;
1873 new_map->set_instance_descriptors(new_descriptors);
1878 if (
map()->unused_property_fields() == 0) {
1880 Object* new_properties_object;
1881 { MaybeObject* maybe_new_properties_object =
1882 properties()->CopySize(properties()->length() +
kFieldsAdded);
1883 if (!maybe_new_properties_object->ToObject(&new_properties_object)) {
1884 return maybe_new_properties_object;
1894 if (new_properties) {
1913 if (!interceptor->setter()->IsUndefined()) {
1914 LOG(isolate, ApiNamedPropertyAccess(
"interceptor-named-set",
this, name));
1918 v8::ToCData<v8::NamedPropertySetter>(interceptor->setter());
1922 VMState state(isolate, EXTERNAL);
1924 isolate->
heap()->undefined_value() :
1932 if (!result.IsEmpty())
return *value_handle;
1934 MaybeObject* raw_result =
1935 this_handle->SetPropertyPostInterceptor(*name_handle,
1950 object->SetProperty(*key, *value, attributes, strict_mode),
1962 return SetProperty(&result, name, value, attributes, strict_mode, store_mode);
1976 ASSERT(!value->IsTheHole());
1982 if (structure->IsForeign()) {
1986 MaybeObject* obj = (callback->
setter)(
this, value, callback->
data);
1988 if (obj->IsFailure())
return obj;
1989 return *value_handle;
1992 if (structure->IsAccessorInfo()) {
2003 return isolate->
Throw(*error);
2005 Object* call_obj = data->setter();
2007 if (call_fun ==
NULL)
return value;
2009 LOG(isolate, ApiNamedPropertyAccess(
"store",
this, name));
2014 VMState state(isolate, EXTERNAL);
2020 return *value_handle;
2023 if (structure->IsAccessorPair()) {
2025 if (setter->IsSpecFunction()) {
2035 return isolate->
Throw(
2052 #ifdef ENABLE_DEBUGGER_SUPPORT
2053 Debug* debug = isolate->debug();
2056 if (debug->StepInActive() && fun->IsJSFunction()) {
2057 debug->HandleStepIn(
2061 bool has_pending_exception;
2066 return *value_handle;
2077 pt != heap->null_value();
2078 pt = pt->GetPrototype()) {
2079 if (pt->IsJSProxy()) {
2082 if (!maybe->To<
String>(&name)) {
2087 this, name, value,
NONE, strict_mode, found);
2094 int entry = dictionary->
FindEntry(index);
2096 PropertyDetails details = dictionary->
DetailsAt(entry);
2099 return SetElementWithCallback(dictionary->
ValueAt(entry),
2108 return heap->the_hole_value();
2111 MaybeObject* JSObject::SetPropertyViaPrototypes(
2124 LookupResult result(isolate);
2126 if (result.IsFound()) {
2127 switch (result.type()) {
2131 *done = result.IsReadOnly();
2135 result.holder()->GetPropertyAttributeWithInterceptor(
2141 if (!FLAG_es5_readonly && result.IsReadOnly())
break;
2144 name, value, result.holder(), strict_mode);
2147 return result.proxy()->SetPropertyViaPrototypesWithHandler(
2148 this, name, value, attributes, strict_mode, done);
2158 if (!FLAG_es5_readonly) *done =
false;
2161 Handle<Object> args[] = { Handle<Object>(
name), Handle<Object>(
this)};
2165 return heap->the_hole_value();
2169 void JSObject::LookupInDescriptor(String* name, LookupResult* result) {
2170 DescriptorArray* descriptors =
map()->instance_descriptors();
2171 int number = descriptors->SearchWithCache(name);
2173 result->DescriptorResult(
this, descriptors->GetDetails(number), number);
2182 LookupResult* result) {
2186 int number = cache->
Lookup(descriptors, name);
2188 number = descriptors->Search(name);
2189 cache->
Update(descriptors, name, number);
2192 result->DescriptorResult(holder, descriptors->
GetDetails(number), number);
2201 for (
int i = 0; i < maps->length(); ++i) {
2202 if (!maps->
at(i).is_null() && maps->
at(i).is_identical_to(map))
return true;
2209 static Handle<T> MaybeNull(
T* p) {
2211 return Handle<T>(p);
2224 MaybeNull(current_map->LookupElementsTransitionMap(kind));
2225 if (maybe_transitioned_map.
is_null())
break;
2226 if (ContainsMap(candidates, maybe_transitioned_map) &&
2228 transitioned_map = maybe_transitioned_map;
2231 current_map = maybe_transitioned_map;
2234 return transitioned_map;
2242 for (; index < to_index; ++index) {
2244 if (next_map ==
NULL) {
2247 current_map = next_map;
2255 if (this->instance_descriptors()->MayContainTransitions() &&
2257 Map* to_map = FindClosestElementsTransition(
this, to_kind);
2272 MaybeObject* maybe_next_map =
2274 if (!maybe_next_map->To(&next_map))
return maybe_next_map;
2278 this->set_elements_transition_map(next_map);
2283 static MaybeObject* AddMissingElementsTransitions(
Map* map,
2287 ASSERT(index <= to_index);
2291 for (; index <= to_index; ++index) {
2293 MaybeObject* maybe_next_map =
2295 if (!maybe_next_map->To(¤t_map))
return maybe_next_map;
2305 Isolate* isolate =
object->GetIsolate();
2307 object->GetElementsTransitionMap(isolate, to_kind),
2315 static MaybeObject* EnsureMayContainTransitions(
Map* map) {
2316 if (map->instance_descriptors()->MayContainTransitions())
return map;
2318 MaybeObject* maybe_descriptor_array =
2320 if (!maybe_descriptor_array->To(&descriptor_array)) {
2321 return maybe_descriptor_array;
2323 map->set_instance_descriptors(descriptor_array);
2332 if (from_kind == to_kind) {
2337 bool allow_store_transition =
2341 (global_context->object_function()->
map() !=
map()) &&
2342 !start_map->IsUndefined() && !start_map->
is_shared() &&
2348 if (!allow_store_transition) {
2351 MaybeObject* maybe_new_map =
2353 if (!maybe_new_map->To(&new_map))
return maybe_new_map;
2358 EnsureMayContainTransitions(start_map);
2359 Map* closest_map = FindClosestElementsTransition(start_map, to_kind);
2365 return AddMissingElementsTransitions(closest_map, to_kind);
2370 LookupResult* result) {
2371 if (IsJSGlobalProxy()) {
2373 if (proto->IsNull())
return result->NotFound();
2374 ASSERT(proto->IsJSGlobalObject());
2380 LookupInDescriptor(name, result);
2381 if (result->IsFound()) {
2386 ASSERT(result->holder() ==
this && result->type() !=
NORMAL);
2389 if (result->IsReadOnly() && result->type() ==
FIELD &&
2391 result->DisallowCaching();
2399 if (IsGlobalObject()) {
2401 if (d.IsDeleted()) {
2409 if (value->IsTheHole()) result->DisallowCaching();
2410 result->DictionaryResult(
this, entry);
2420 if (result->IsProperty())
return;
2427 LookupResult* result) {
2430 pt != heap->null_value();
2431 pt = pt->GetPrototype()) {
2432 if (pt->IsJSProxy()) {
2437 if (result->IsProperty())
return;
2445 LookupResult* result,
2448 bool check_prototype,
2450 if (check_prototype && !result->IsProperty()) {
2454 if (result->IsProperty()) {
2455 if (!result->IsReadOnly()) {
2456 switch (result->type()) {
2458 Object* obj = result->GetCallbackObject();
2459 if (obj->IsAccessorInfo()) {
2476 if (r.IsProperty()) {
2496 return *value_handle;
2506 if (result->IsFound() && result->type() ==
HANDLER) {
2507 return result->proxy()->SetPropertyWithHandler(
2508 this, key, value, attributes, strict_mode);
2511 result, key, value, attributes, strict_mode, store_mode);
2524 "has", isolate->derived_has_trap(),
ARRAY_SIZE(args), args);
2527 return result->ToBoolean()->IsTrue();
2544 CallTrap(
"set", isolate->derived_set_trap(),
ARRAY_SIZE(args), args);
2571 if (result->IsUndefined()) {
2573 return GetHeap()->the_hole_value();
2577 bool has_pending_exception;
2581 ARRAY_SIZE(argv), argv, &has_pending_exception);
2590 ASSERT(configurable->IsTrue() || configurable->IsFalse());
2591 if (configurable->IsFalse()) {
2597 return isolate->
Throw(*error);
2599 ASSERT(configurable->IsTrue());
2606 ASSERT(hasWritable->IsTrue() || hasWritable->IsFalse());
2607 if (hasWritable->IsTrue()) {
2612 ASSERT(writable->IsTrue() || writable->IsFalse());
2613 *done = writable->IsFalse();
2614 if (!*done)
return GetHeap()->the_hole_value();
2619 return isolate->
Throw(*error);
2626 if (!setter->IsUndefined()) {
2628 return receiver->SetPropertyWithDefinedSetter(
2636 return isolate->
Throw(*error);
2652 Object* bool_result = result->ToBoolean();
2658 isolate->
Throw(*error);
2690 if (result->IsUndefined())
return ABSENT;
2692 bool has_pending_exception;
2696 ARRAY_SIZE(argv), argv, &has_pending_exception);
2697 if (has_pending_exception)
return NONE;
2710 if (configurable->IsFalse()) {
2716 isolate->
Throw(*error);
2720 int attributes =
NONE;
2721 if (enumerable->ToBoolean()->IsFalse()) attributes |=
DONT_ENUM;
2722 if (configurable->ToBoolean()->IsFalse()) attributes |=
DONT_DELETE;
2723 if (writable->ToBoolean()->IsFalse()) attributes |=
READ_ONLY;
2734 return GetPropertyAttributeWithHandler(receiver, *name);
2746 if (IsJSFunctionProxy()) {
2752 ASSERT(self->IsJSObject());
2756 if (maybe_hash->To<
Object>(&hash) && hash->IsSmi()) {
2774 if (trap->IsUndefined()) {
2779 isolate->
Throw(*error);
2799 AssertNoContextChange ncc;
2804 if (!name->IsSymbol() && name->
length() <= 2) {
2806 { MaybeObject* maybe_symbol_version = heap->
LookupSymbol(name);
2807 if (maybe_symbol_version->ToObject(&symbol_version)) {
2814 if (IsAccessCheckNeeded()) {
2817 result, name, value,
true, strict_mode);
2821 if (IsJSGlobalProxy()) {
2823 if (proto->IsNull())
return value;
2824 ASSERT(proto->IsJSGlobalObject());
2826 result, name, value, attributes, strict_mode, store_mode);
2829 if (!result->IsProperty() && !IsJSContextExtensionObject()) {
2831 MaybeObject* result_object =
2832 SetPropertyViaPrototypes(name, value, attributes, strict_mode, &done);
2833 if (done)
return result_object;
2836 if (!result->IsFound()) {
2838 return AddProperty(name, value, attributes, strict_mode, store_mode);
2840 if (result->IsReadOnly() && result->IsProperty()) {
2853 switch (result->type()) {
2859 if (attributes == result->GetAttributes()) {
2868 if (value == result->GetConstantFunction())
return value;
2870 attributes = result->GetAttributes();
2873 Object* callback_object = result->GetCallbackObject();
2874 if (callback_object->IsAccessorPair() &&
2889 Map* target_map = result->GetTransitionMap();
2890 DescriptorArray* target_descriptors = target_map->instance_descriptors();
2891 int number = target_descriptors->SearchWithCache(name);
2896 if (value ==
function) {
2930 object->GetIsolate(),
2931 object->SetLocalPropertyIgnoreAttributes(*key, *value, attributes),
2942 AssertNoContextChange ncc;
2944 LookupResult result(isolate);
2947 if (IsAccessCheckNeeded()) {
2957 if (IsJSGlobalProxy()) {
2959 if (proto->IsNull())
return value;
2960 ASSERT(proto->IsJSGlobalObject());
2968 if (!result.IsFound()) {
2973 PropertyDetails details = PropertyDetails(attributes,
NORMAL);
2976 switch (result.type()) {
2982 if (attributes == result.GetAttributes()) {
2991 if (value == result.GetConstantFunction())
return value;
2993 attributes = result.GetAttributes();
3015 bool continue_search) {
3019 if (result.IsProperty())
return result.GetAttributes();
3021 if (continue_search) {
3024 if (!pt->IsNull()) {
3036 bool continue_search) {
3041 AssertNoContextChange ncc;
3050 if (!interceptor->query()->IsUndefined()) {
3052 v8::ToCData<v8::NamedPropertyQuery>(interceptor->query());
3054 ApiNamedPropertyAccess(
"interceptor-named-has", *holder_handle, name));
3058 VMState state(isolate, EXTERNAL);
3065 }
else if (!interceptor->getter()->IsUndefined()) {
3067 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
3069 ApiNamedPropertyAccess(
"interceptor-named-get-has",
this, name));
3073 VMState state(isolate, EXTERNAL);
3078 return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle,
3100 LookupResult* result,
3102 bool continue_search) {
3104 if (IsAccessCheckNeeded()) {
3109 receiver, result, name, continue_search);
3112 if (result->IsProperty()) {
3113 switch (result->type()) {
3118 return result->GetAttributes();
3120 return JSProxy::cast(result->proxy())->GetPropertyAttributeWithHandler(
3124 return result->holder()->GetPropertyAttributeWithInterceptor(
3152 int index = fast->
Hash() % kEntries;
3153 Object* result =
get(index);
3154 if (result->IsMap() &&
3157 if (FLAG_verify_heap) {
3165 { MaybeObject* maybe_fresh =
3167 if (maybe_fresh->ToObject(&fresh)) {
3182 { MaybeObject* maybe_result =
3184 if (!maybe_result->ToObject(&result))
return maybe_result;
3187 isolate->
counters()->normalized_maps()->Increment();
3194 int entries = length();
3195 for (
int i = 0; i != entries; i++) {
3204 Isolate* isolate =
object->GetIsolate();
3206 object->UpdateMapCodeCache(*name, *code));
3211 if (
map()->is_shared()) {
3218 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
3230 int expected_additional_properties) {
3232 object->NormalizeProperties(
3233 mode, expected_additional_properties));
3238 int expected_additional_properties) {
3242 ASSERT(!IsGlobalObject());
3244 ASSERT(!IsJSGlobalProxy());
3246 Map* map_of_this =
map();
3250 if (expected_additional_properties > 0) {
3251 property_count += expected_additional_properties;
3253 property_count += 2;
3257 if (!maybe_dictionary->To(&dictionary))
return maybe_dictionary;
3262 PropertyDetails details = descs->
GetDetails(i);
3263 switch (details.type()) {
3266 PropertyDetails(details.attributes(),
NORMAL, details.index());
3268 MaybeObject* maybe_dictionary =
3269 dictionary->
Add(descs->
GetKey(i), value, d);
3270 if (!maybe_dictionary->To(&dictionary))
return maybe_dictionary;
3275 PropertyDetails(details.attributes(),
NORMAL, details.index());
3277 MaybeObject* maybe_dictionary =
3278 dictionary->
Add(descs->
GetKey(i), value, d);
3279 if (!maybe_dictionary->To(&dictionary))
return maybe_dictionary;
3285 if (value->IsAccessorPair()) {
3286 MaybeObject* maybe_copy =
3288 if (!maybe_copy->To(&value))
return maybe_copy;
3290 MaybeObject* maybe_dictionary =
3291 dictionary->
Add(descs->
GetKey(i), value, details);
3292 if (!maybe_dictionary->To(&dictionary))
return maybe_dictionary;
3310 int index = map_of_this->instance_descriptors()->NextEnumerationIndex();
3314 { MaybeObject* maybe_map =
3316 normalized_map_cache()->Get(
this, mode);
3317 if (!maybe_map->To(&new_map))
return maybe_map;
3325 int instance_size_delta = map_of_this->
instance_size() - new_instance_size;
3326 ASSERT(instance_size_delta >= 0);
3328 instance_size_delta);
3331 -instance_size_delta);
3338 set_properties(dictionary);
3340 current_heap->
isolate()->
counters()->props_to_dictionary()->Increment();
3343 if (FLAG_trace_normalization) {
3344 PrintF(
"Object properties have been normalized:\n");
3353 int unused_property_fields) {
3355 object->GetIsolate(),
3356 object->TransformToFastProperties(unused_property_fields));
3362 ASSERT(!IsGlobalObject());
3364 TransformPropertiesToFastFor(
this, unused_property_fields);
3371 object->NormalizeElements(),
3381 Map* old_map = array->
map();
3383 (old_map == old_map->
GetHeap()->non_strict_arguments_elements_map());
3387 if (array->IsDictionary())
return array;
3393 int length = IsJSArray()
3396 int old_capacity = 0;
3397 int used_elements = 0;
3398 GetElementsCapacityAndUsage(&old_capacity, &used_elements);
3402 if (!maybe->ToObject(&
object))
return maybe;
3407 bool has_double_elements = array->IsFixedDoubleArray();
3408 for (
int i = 0; i < length; i++) {
3410 if (has_double_elements) {
3419 MaybeObject* maybe_value_object =
3421 if (!maybe_value_object->ToObject(&value))
return maybe_value_object;
3427 PropertyDetails details = PropertyDetails(
NONE,
NORMAL);
3428 if (!value->IsTheHole()) {
3430 MaybeObject* maybe_result =
3432 if (!maybe_result->ToObject(&result))
return maybe_result;
3446 if (!maybe->ToObject(&new_map))
return maybe;
3448 set_elements(dictionary);
3455 if (FLAG_trace_normalization) {
3456 PrintF(
"Object elements have been normalized:\n");
3476 }
while (hash_value == 0 && attempts < 30);
3477 hash_value = hash_value != 0 ? hash_value : 1;
3486 if (maybe->IsFailure())
return maybe;
3501 if (stored_value->IsSmi())
return stored_value;
3509 if (result->IsFailure())
return result;
3510 if (result->ToObjectUnchecked()->IsUndefined()) {
3519 Object* hash = this->hash();
3529 if (IsJSGlobalProxy()) {
3533 if (proxy_parent->IsNull())
return GetHeap()->undefined_value();
3534 ASSERT(proxy_parent->IsJSGlobalObject());
3537 ASSERT(!IsJSGlobalProxy());
3538 MaybeObject* hidden_lookup = GetHiddenPropertiesDictionary(
false);
3539 ASSERT(!hidden_lookup->IsFailure());
3540 if (hidden_lookup->ToObjectUnchecked()->IsUndefined()) {
3541 return GetHeap()->undefined_value();
3547 return dictionary->
ValueAt(entry);
3555 obj->SetHiddenProperty(*key, *value),
3561 if (IsJSGlobalProxy()) {
3565 if (proxy_parent->IsNull())
return GetHeap()->undefined_value();
3566 ASSERT(proxy_parent->IsJSGlobalObject());
3569 ASSERT(!IsJSGlobalProxy());
3570 MaybeObject* hidden_lookup = GetHiddenPropertiesDictionary(
true);
3572 if (!hidden_lookup->To<
StringDictionary>(&dictionary))
return hidden_lookup;
3582 MaybeObject* insert_result = dictionary->
Add(key,
3587 if (new_dict != dictionary) {
3590 MaybeObject* store_result = SetHiddenPropertiesDictionary(new_dict);
3591 if (store_result->IsFailure())
return store_result;
3599 if (IsJSGlobalProxy()) {
3603 if (proxy_parent->IsNull())
return;
3604 ASSERT(proxy_parent->IsJSGlobalObject());
3608 MaybeObject* hidden_lookup = GetHiddenPropertiesDictionary(
false);
3609 ASSERT(!hidden_lookup->IsFailure());
3610 if (hidden_lookup->ToObjectUnchecked()->IsUndefined())
return;
3630 MaybeObject* JSObject::GetHiddenPropertiesDictionary(
bool create_if_absent) {
3631 ASSERT(!IsJSGlobalProxy());
3657 &attributes)->ToObjectUnchecked();
3658 if (!lookup->IsUndefined()) {
3662 if (!create_if_absent)
return GetHeap()->undefined_value();
3663 const int kInitialSize = 5;
3665 StringDictionary* dictionary;
3666 if (!dict_alloc->To<StringDictionary>(&dictionary))
return dict_alloc;
3675 MaybeObject* JSObject::SetHiddenPropertiesDictionary(
3676 StringDictionary* dictionary) {
3677 ASSERT(!IsJSGlobalProxy());
3684 DescriptorArray* descriptors = this->
map()->instance_descriptors();
3685 if ((descriptors->number_of_descriptors() > 0) &&
3687 if (descriptors->GetType(0) ==
FIELD) {
3696 MaybeObject* store_result =
3701 if (store_result->IsFailure())
return store_result;
3706 MaybeObject* JSObject::DeletePropertyPostInterceptor(String* name,
3711 if (!result.IsProperty())
return GetHeap()->true_value();
3716 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
3723 MaybeObject* JSObject::DeletePropertyWithInterceptor(String* name) {
3725 HandleScope scope(isolate);
3727 Handle<String> name_handle(name);
3728 Handle<JSObject> this_handle(
this);
3729 if (!interceptor->deleter()->IsUndefined()) {
3731 v8::ToCData<v8::NamedPropertyDeleter>(interceptor->deleter());
3733 ApiNamedPropertyAccess(
"interceptor-named-delete", *this_handle, name));
3734 CustomArguments args(isolate, interceptor->data(),
this,
this);
3739 VMState state(isolate, EXTERNAL);
3743 if (!result.IsEmpty()) {
3744 ASSERT(result->IsBoolean());
3748 MaybeObject* raw_result =
3749 this_handle->DeletePropertyPostInterceptor(*name_handle,
NORMAL_DELETION);
3755 MaybeObject* JSObject::DeleteElementWithInterceptor(uint32_t index) {
3757 Heap* heap = isolate->heap();
3760 AssertNoContextChange ncc;
3761 HandleScope scope(isolate);
3763 if (interceptor->deleter()->IsUndefined())
return heap->false_value();
3765 v8::ToCData<v8::IndexedPropertyDeleter>(interceptor->deleter());
3766 Handle<JSObject> this_handle(
this);
3768 ApiIndexedPropertyAccess(
"interceptor-indexed-delete",
this, index));
3769 CustomArguments args(isolate, interceptor->data(),
this,
this);
3774 VMState state(isolate, EXTERNAL);
3775 result = deleter(index, info);
3778 if (!result.IsEmpty()) {
3779 ASSERT(result->IsBoolean());
3782 MaybeObject* raw_result = this_handle->GetElementsAccessor()->Delete(
3802 if (IsAccessCheckNeeded() &&
3805 return isolate->
heap()->false_value();
3808 if (IsJSGlobalProxy()) {
3810 if (proto->IsNull())
return isolate->
heap()->false_value();
3811 ASSERT(proto->IsJSGlobalObject());
3818 return DeleteElementWithInterceptor(index);
3838 ASSERT(name->IsString());
3841 if (IsAccessCheckNeeded() &&
3844 return isolate->
heap()->false_value();
3847 if (IsJSGlobalProxy()) {
3849 if (proto->IsNull())
return isolate->
heap()->false_value();
3850 ASSERT(proto->IsJSGlobalObject());
3858 LookupResult result(isolate);
3860 if (!result.IsProperty())
return isolate->
heap()->true_value();
3870 return isolate->
heap()->false_value();
3876 return DeletePropertyPostInterceptor(name, mode);
3878 return DeletePropertyWithInterceptor(name);
3882 { MaybeObject* maybe_obj =
3884 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
3908 bool JSObject::ReferencesObjectFromElements(
FixedArray* elements,
3914 int length = IsJSArray()
3917 for (
int i = 0; i < length; ++i) {
3919 if (!element->IsTheHole() && element == object)
return true;
3924 if (!key->IsUndefined())
return true;
3932 Map* map_of_this =
map();
3937 if (map_of_this->constructor() == obj) {
3942 if (map_of_this->prototype() == obj) {
3948 if (!key->IsUndefined()) {
3976 if (ReferencesObjectFromElements(elements, kind, obj))
return true;
3982 int length = parameter_map->
length();
3983 for (
int i = 2; i < length; ++i) {
3985 if (!value->IsTheHole() && value == obj)
return true;
3991 if (ReferencesObjectFromElements(arguments, kind, obj))
return true;
3997 if (IsJSFunction()) {
4001 arguments_boilerplate();
4007 Context* context = f->context();
4008 if (context->IsGlobalContext()) {
4015 if (context->
get(i)->IsJSObject()) {
4018 if (ctxobj->
map()->constructor() == arguments_function) {
4022 }
else if (ctxobj == obj) {
4046 if (IsAccessCheckNeeded() &&
4048 isolate->
heap()->undefined_value(),
4051 return isolate->
heap()->false_value();
4054 if (IsJSGlobalProxy()) {
4056 if (proto->IsNull())
return this;
4057 ASSERT(proto->IsJSGlobalObject());
4067 "cant_prevent_ext_external_array_elements",
4069 return isolate->
Throw(*error);
4084 { MaybeObject* maybe =
4086 if (!maybe->To<
Map>(&new_map))
return maybe;
4103 o != heap->null_value();
4105 if (!o->IsJSObject())
return false;
4107 if (!curr->
map()->instance_descriptors()->HasEnumCache())
return false;
4110 ASSERT(!curr->IsAccessCheckNeeded());
4115 if (curr_fixed_array->
length() > 0)
return false;
4126 PropertyDetails details = descs->
GetDetails(i);
4127 if (descs->
IsProperty(i) && (details.attributes() & filter) == 0) {
4152 if (current_index > max_index) max_index = current_index;
4155 return max_index + 1;
4171 ASSERT(name->IsString());
4175 if (IsJSGlobalProxy()) {
4177 if (proto->IsNull())
return result->NotFound();
4178 ASSERT(proto->IsJSGlobalObject());
4189 if (IsAccessCheckNeeded()) {
4190 result->DisallowCaching();
4196 if (name->
Equals(heap->Proto_symbol()) && !IsJSContextExtensionObject()) {
4197 result->ConstantResult(js_object);
4203 !heap->isolate()->bootstrapper()->IsActive()) {
4204 result->InterceptorResult(js_object);
4215 for (
Object* current =
this;
4216 current != heap->null_value();
4219 if (result->IsProperty())
return;
4228 for (
Object* current =
this;
4229 current != heap->null_value() && current->IsJSObject();
4232 if (result->IsFound() && result->type() ==
CALLBACKS)
return;
4240 static bool UpdateGetterSetterInDictionary(
4246 int entry = dictionary->
FindEntry(index);
4249 PropertyDetails details = dictionary->
DetailsAt(entry);
4250 if (details.type() ==
CALLBACKS && result->IsAccessorPair()) {
4251 ASSERT(!details.IsDontDelete());
4252 if (details.attributes() != attributes) {
4254 PropertyDetails(attributes,
CALLBACKS, index));
4264 MaybeObject* JSObject::DefineElementAccessor(uint32_t index,
4286 return GetHeap()->undefined_value();
4293 return GetHeap()->undefined_value();
4301 uint32_t length = parameter_map->length();
4303 index < (length - 2) ? parameter_map->get(index + 2) :
NULL;
4304 if (probe ==
NULL || probe->IsTheHole()) {
4306 if (arguments->IsDictionary()) {
4307 SeededNumberDictionary* dictionary =
4309 if (UpdateGetterSetterInDictionary(dictionary,
4314 return GetHeap()->undefined_value();
4322 AccessorPair* accessors;
4324 if (!maybe_accessors->To(&accessors))
return maybe_accessors;
4326 accessors->SetComponents(getter, setter);
4328 return SetElementCallback(index, accessors, attributes);
4332 MaybeObject* JSObject::CreateAccessorPairFor(String* name) {
4333 LookupResult result(
GetHeap()->isolate());
4335 if (result.IsProperty() && result.type() ==
CALLBACKS) {
4342 Object* obj = result.GetCallbackObject();
4343 if (obj->IsAccessorPair()) {
4351 MaybeObject* JSObject::DefinePropertyAccessor(String* name,
4358 bool only_attribute_changes = getter->IsNull() && setter->IsNull();
4360 MaybeObject* getterOk = heap->undefined_value();
4361 if (!getter->IsNull()) {
4363 if (getterOk->IsFailure())
return getterOk;
4366 MaybeObject* setterOk = heap->undefined_value();
4367 if (getterOk != heap->null_value() && !setter->IsNull()) {
4369 if (setterOk->IsFailure())
return setterOk;
4372 if (getterOk != heap->null_value() && setterOk != heap->null_value()) {
4373 return heap->undefined_value();
4377 AccessorPair* accessors;
4378 { MaybeObject* maybe_accessors = CreateAccessorPairFor(name);
4379 if (!maybe_accessors->To(&accessors))
return maybe_accessors;
4381 accessors->SetComponents(getter, setter);
4382 return SetPropertyCallback(name, accessors, attributes);
4386 bool JSObject::CanSetCallback(String* name) {
4387 ASSERT(!IsAccessCheckNeeded() ||
4398 if (callback_result.IsProperty()) {
4399 Object* obj = callback_result.GetCallbackObject();
4400 if (obj->IsAccessorInfo() &&
4410 MaybeObject* JSObject::SetElementCallback(uint32_t index,
4413 PropertyDetails details = PropertyDetails(attributes,
CALLBACKS);
4416 SeededNumberDictionary* dictionary;
4418 if (!maybe_dictionary->To(&dictionary))
return maybe_dictionary;
4423 { MaybeObject* maybe_dictionary = dictionary->Set(index, structure, details);
4424 if (!maybe_dictionary->To(&dictionary))
return maybe_dictionary;
4427 dictionary->set_requires_slow_elements();
4429 if (elements()->
map() ==
GetHeap()->non_strict_arguments_elements_map()) {
4436 if (index < static_cast<uint32_t>(parameter_map->length()) - 2) {
4437 parameter_map->set(index + 2,
GetHeap()->the_hole_value());
4439 parameter_map->set(1, dictionary);
4441 set_elements(dictionary);
4444 return GetHeap()->undefined_value();
4448 MaybeObject* JSObject::SetPropertyCallback(String* name,
4453 if (maybe_ok->IsFailure())
return maybe_ok;
4458 if (IsGlobalObject()) {
4461 if (!maybe_new_map->To(&new_map))
return maybe_new_map;
4471 PropertyDetails details = PropertyDetails(attributes,
CALLBACKS);
4473 if (maybe_ok->IsFailure())
return maybe_ok;
4476 return GetHeap()->undefined_value();
4486 object->GetIsolate(),
4487 object->DefineAccessor(*name, *getter, *setter, attributes));
4496 if (IsAccessCheckNeeded() &&
4499 return isolate->
heap()->undefined_value();
4502 if (IsJSGlobalProxy()) {
4504 if (proto->IsNull())
return this;
4505 ASSERT(proto->IsJSGlobalObject());
4507 name, getter, setter, attributes);
4512 AssertNoContextChange ncc;
4517 if (!CanSetCallback(name))
return isolate->
heap()->undefined_value();
4521 DefineElementAccessor(index, getter, setter, attributes) :
4522 DefinePropertyAccessor(name, getter, setter, attributes);
4526 static MaybeObject* CreateFreshAccessor(
JSObject* obj,
4535 if (!maybe_accessors2->To(&accessors2))
return maybe_accessors2;
4537 accessors2->
set(component, accessor);
4540 Map* map1 = obj->
map();
4541 CallbacksDescriptor callbacks_descr2(name, accessors2, attributes);
4542 DescriptorArray* descriptors2;
4543 { MaybeObject* maybe_descriptors2 =
4544 map1->instance_descriptors()->CopyInsert(&callbacks_descr2,
4546 if (!maybe_descriptors2->To(&descriptors2))
return maybe_descriptors2;
4551 { MaybeObject* maybe_map2 = map1->CopyDropDescriptors();
4552 if (!maybe_map2->To(&map2))
return maybe_map2;
4554 map2->set_instance_descriptors(descriptors2);
4557 AccessorPair* accessors1;
4559 if (!maybe_accessors1->To(&accessors1))
return maybe_accessors1;
4561 accessors1->set(component, map2);
4565 CallbacksDescriptor callbacks_descr1(name, accessors1, attributes);
4566 DescriptorArray* descriptors1;
4567 { MaybeObject* maybe_descriptors1 =
4568 map1->instance_descriptors()->CopyInsert(&callbacks_descr1,
4570 if (!maybe_descriptors1->To(&descriptors1))
return maybe_descriptors1;
4575 map1->set_instance_descriptors(descriptors1);
4576 map2->SetBackPointer(map1);
4581 static bool TransitionToSameAccessor(
Object* map,
4586 DescriptorArray* descs =
Map::cast(map)->instance_descriptors();
4587 int number = descs->SearchWithCache(name);
4589 Object* target_accessor =
4592 return target_accessor == accessor && target_attributes == attributes;
4596 static MaybeObject* NewCallbackTransition(JSObject* obj,
4601 AccessorPair* accessors2) {
4603 AccessorPair* accessors3;
4604 { MaybeObject* maybe_accessors3 = accessors2->CopyWithoutTransitions();
4605 if (!maybe_accessors3->To(&accessors3))
return maybe_accessors3;
4607 accessors3->set(component, accessor);
4610 Map* map2 = obj->map();
4611 CallbacksDescriptor callbacks_descr3(name, accessors3, attributes);
4612 DescriptorArray* descriptors3;
4613 { MaybeObject* maybe_descriptors3 =
4614 map2->instance_descriptors()->CopyInsert(&callbacks_descr3,
4616 if (!maybe_descriptors3->To(&descriptors3))
return maybe_descriptors3;
4621 { MaybeObject* maybe_map3 = map2->CopyDropDescriptors();
4622 if (!maybe_map3->To(&map3))
return maybe_map3;
4624 map3->set_instance_descriptors(descriptors3);
4628 accessors2->set(component, map3);
4629 map3->SetBackPointer(map2);
4638 ASSERT(accessor->IsSpecFunction() || accessor->IsUndefined());
4643 if (!result.IsFound()) {
4644 return CreateFreshAccessor(
this, name, component, accessor, attributes);
4649 Object* callback_value = result.GetCallbackObject();
4650 if (!callback_value->IsAccessorPair())
return GetHeap()->null_value();
4654 Object* entry = accessors->
get(component);
4655 if (entry->IsMap() &&
4656 TransitionToSameAccessor(entry, name, component, accessor, attributes)) {
4662 if (entry == accessor && result.GetAttributes() == attributes)
return this;
4665 if (entry->IsTheHole()) {
4666 return NewCallbackTransition(
this,
4675 return GetHeap()->null_value();
4683 if (IsAccessCheckNeeded() &&
4686 return isolate->
heap()->undefined_value();
4689 if (IsJSGlobalProxy()) {
4691 if (proto->IsNull())
return this;
4692 ASSERT(proto->IsJSGlobalObject());
4698 AssertNoContextChange ncc;
4703 if (!CanSetCallback(name)) {
4704 return isolate->
heap()->undefined_value();
4711 if (IsJSArray())
return isolate->
heap()->undefined_value();
4733 return isolate->
heap()->undefined_value();
4741 { MaybeObject* maybe_ok =
4743 if (maybe_ok->IsFailure())
return maybe_ok;
4747 LookupResult result(isolate);
4751 if (result.IsProperty() && (result.IsReadOnly() || result.IsDontDelete())) {
4752 return isolate->
heap()->undefined_value();
4754 { MaybeObject* maybe_ok =
4756 if (maybe_ok->IsFailure())
return maybe_ok;
4769 AssertNoContextChange ncc;
4772 if (IsAccessCheckNeeded() &&
4775 return heap->undefined_value();
4782 obj != heap->null_value();
4787 int entry = dictionary->
FindEntry(index);
4791 element->IsAccessorPair()) {
4799 obj != heap->null_value();
4801 LookupResult result(heap->
isolate());
4803 if (result.IsProperty()) {
4804 if (result.IsReadOnly())
return heap->undefined_value();
4806 Object* obj = result.GetCallbackObject();
4807 if (obj->IsAccessorPair()) {
4814 return heap->undefined_value();
4832 return GetHeap()->undefined_value();
4842 { MaybeObject* maybe_result =
4843 heap->
AllocateMap(instance_type(), instance_size());
4844 if (!maybe_result->ToObject(&result))
return maybe_result;
4846 Map::cast(result)->set_prototype(prototype());
4847 Map::cast(result)->set_constructor(constructor());
4860 if (pre_allocated_property_fields() > 0) {
4861 ASSERT(constructor()->IsJSFunction());
4864 { MaybeObject* maybe_descriptors =
4865 ctor->
initial_map()->instance_descriptors()->RemoveTransitions(
4867 if (!maybe_descriptors->ToObject(&descriptors))
return maybe_descriptors;
4869 Map::cast(result)->set_instance_descriptors(
4872 pre_allocated_property_fields());
4885 int new_instance_size = instance_size();
4887 new_instance_size -= inobject_properties() *
kPointerSize;
4891 { MaybeObject* maybe_result =
4893 if (!maybe_result->ToObject(&result))
return maybe_result;
4900 Map::cast(result)->set_prototype(prototype());
4901 Map::cast(result)->set_constructor(constructor());
4906 Map::cast(result)->set_code_cache(code_cache());
4911 if (FLAG_verify_heap &&
Map::cast(result)->is_shared()) {
4923 { MaybeObject* maybe_new_map = CopyDropDescriptors();
4924 if (!maybe_new_map->ToObject(&new_map))
return maybe_new_map;
4927 { MaybeObject* maybe_descriptors =
4928 instance_descriptors()->RemoveTransitions(shared_mode);
4929 if (!maybe_descriptors->ToObject(&descriptors))
return maybe_descriptors;
4939 Isolate* isolate = map->GetIsolate();
4941 map->UpdateCodeCache(*name, *code));
4948 if (code_cache()->IsFixedArray()) {
4951 if (!maybe_result->ToObject(&result))
return maybe_result;
4953 set_code_cache(result);
4963 if (!code_cache()->IsFixedArray()) {
4966 return GetHeap()->undefined_value();
4973 if (!code_cache()->IsFixedArray()) {
4983 ASSERT(!code_cache()->IsFixedArray());
4993 : descriptor_array_(descriptor_array) { }
4997 if (descriptor_array_->MayContainTransitions())
5002 return descriptor_array_->MayContainTransitions() &&
5003 (*DescriptorArrayHeader())->IsSmi();
5014 int index = raw_index / 2;
5015 int number_of_descriptors = descriptor_array_->number_of_descriptors();
5016 while (index < number_of_descriptors) {
5017 PropertyDetails details(descriptor_array_->GetDetails(index));
5018 switch (details.type()) {
5022 *DescriptorArrayHeader() =
Smi::FromInt(raw_index + 2);
5023 return static_cast<Map*
>(descriptor_array_->GetValue(index));
5027 static_cast<AccessorPair*
>(descriptor_array_->GetValue(index));
5029 if ((raw_index & 1) == 0) {
5030 accessor = accessors->setter();
5033 accessor = accessors->getter();
5036 if (accessor->IsMap()) {
5038 return static_cast<Map*
>(accessor);
5054 if (index == descriptor_array_->number_of_descriptors()) {
5056 if (elements_transition !=
NULL) {
5058 return elements_transition;
5061 *DescriptorArrayHeader() = descriptor_array_->
GetHeap()->fixed_array_map();
5066 Object** DescriptorArrayHeader() {
5070 DescriptorArray* descriptor_array_;
5079 : proto_trans_(proto_trans) { }
5087 return HasTransitions() && (*Header())->IsSmi();
5093 if (transitionNumber < NumberOfTransitions()) {
5095 return GetTransition(transitionNumber);
5097 *Header() = proto_trans_->GetHeap()->fixed_array_map();
5102 bool HasTransitions() {
5103 return proto_trans_->map()->IsSmi() || proto_trans_->IsFixedArray();
5110 int NumberOfTransitions() {
5111 ASSERT(HasTransitions());
5112 FixedArray* proto_trans =
reinterpret_cast<FixedArray*
>(proto_trans_);
5117 Map* GetTransition(
int transitionNumber) {
5118 ASSERT(HasTransitions());
5119 FixedArray* proto_trans =
reinterpret_cast<FixedArray*
>(proto_trans_);
5120 return Map::cast(proto_trans->get(IndexFor(transitionNumber)));
5123 int IndexFor(
int transitionNumber) {
5129 HeapObject* proto_trans_;
5173 if (object->IsSmi()) {
5174 return GetHeap()->empty_descriptor_array();
5178 return descriptor_array;
5187 unchecked_prototype_transitions()).
Start();
5194 proto_iterator(unchecked_prototype_transitions());
5196 Map* next = proto_iterator.
Next();
5200 descriptor_iterator(MutatedInstanceDescriptors());
5202 Map* next = descriptor_iterator.
Next();
5217 if (child !=
NULL) {
5223 callback(current, data);
5224 if (current ==
this)
break;
5237 if (normal_type_cache()->IsUndefined()) {
5239 { MaybeObject* maybe_result =
5241 if (!maybe_result->ToObject(&result))
return maybe_result;
5243 set_normal_type_cache(result);
5245 return UpdateNormalTypeCache(name, code);
5247 ASSERT(default_cache()->IsFixedArray());
5248 return UpdateDefaultCache(name, code);
5253 MaybeObject* CodeCache::UpdateDefaultCache(
String* name,
Code* code) {
5262 int length = cache->length();
5263 int deleted_index = -1;
5264 for (
int i = 0; i < length; i += kCodeCacheEntrySize) {
5265 Object* key = cache->get(i);
5266 if (key->IsNull()) {
5267 if (deleted_index < 0) deleted_index = i;
5270 if (key->IsUndefined()) {
5271 if (deleted_index >= 0) i = deleted_index;
5272 cache->set(i + kCodeCacheEntryNameOffset, name);
5273 cache->set(i + kCodeCacheEntryCodeOffset, code);
5280 cache->set(i + kCodeCacheEntryCodeOffset, code);
5288 if (deleted_index >= 0) {
5289 cache->set(deleted_index + kCodeCacheEntryNameOffset, name);
5290 cache->set(deleted_index + kCodeCacheEntryCodeOffset, code);
5296 int new_length = length + ((length >> 1)) + kCodeCacheEntrySize;
5297 new_length = new_length - new_length % kCodeCacheEntrySize;
5298 ASSERT((new_length % kCodeCacheEntrySize) == 0);
5300 { MaybeObject* maybe_result = cache->CopySize(new_length);
5301 if (!maybe_result->ToObject(&result))
return maybe_result;
5306 cache->set(length + kCodeCacheEntryNameOffset, name);
5307 cache->set(length + kCodeCacheEntryCodeOffset, code);
5308 set_default_cache(cache);
5313 MaybeObject* CodeCache::UpdateNormalTypeCache(String* name, Code* code) {
5317 { MaybeObject* maybe_new_cache = cache->Put(name, code);
5318 if (!maybe_new_cache->ToObject(&new_cache))
return maybe_new_cache;
5320 set_normal_type_cache(new_cache);
5327 return LookupNormalTypeCache(name, flags);
5329 return LookupDefaultCache(name, flags);
5336 int length = cache->
length();
5337 for (
int i = 0; i < length; i += kCodeCacheEntrySize) {
5338 Object* key = cache->
get(i + kCodeCacheEntryNameOffset);
5340 if (key->IsNull())
continue;
5341 if (key->IsUndefined())
return key;
5349 return GetHeap()->undefined_value();
5354 if (!normal_type_cache()->IsUndefined()) {
5356 return cache->Lookup(name, flags);
5358 return GetHeap()->undefined_value();
5365 if (normal_type_cache()->IsUndefined())
return -1;
5371 int len = array->
length();
5372 for (
int i = 0; i < len; i += kCodeCacheEntrySize) {
5373 if (array->
get(i + kCodeCacheEntryCodeOffset) == code)
return i + 1;
5381 ASSERT(!normal_type_cache()->IsUndefined());
5391 ASSERT_EQ(1, kCodeCacheEntryCodeOffset - kCodeCacheEntryNameOffset);
5405 :
name_(name), flags_(flags), code_(
NULL) { }
5409 flags_(code->flags()),
5414 if (!other->IsFixedArray())
return false;
5418 if (flags != flags_) {
5421 return name_->Equals(name);
5428 uint32_t
Hash() {
return NameFlagsHashHelper(
name_, flags_); }
5434 return NameFlagsHashHelper(name, code->flags());
5440 { MaybeObject* maybe_obj = code_->GetHeap()->AllocateFixedArray(2);
5441 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
5445 pair->
set(1, code_);
5459 int entry = FindEntry(&key);
5460 if (entry == kNotFound)
return GetHeap()->undefined_value();
5461 return get(EntryToIndex(entry) + 1);
5468 { MaybeObject* maybe_obj = EnsureCapacity(1, &key);
5469 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
5477 { MaybeObject* maybe_k = key.
AsObject();
5478 if (!maybe_k->ToObject(&k))
return maybe_k;
5481 cache->
set(EntryToIndex(entry), k);
5482 cache->
set(EntryToIndex(entry) + 1, code);
5490 int entry = FindEntry(&key);
5491 return (entry == kNotFound) ? -1 : entry;
5498 set(EntryToIndex(index), heap->the_hole_value());
5499 set(EntryToIndex(index) + 1, heap->the_hole_value());
5508 Isolate* isolate = cache->GetIsolate();
5517 if (cache()->IsUndefined()) {
5519 { MaybeObject* maybe_result =
5522 if (!maybe_result->ToObject(&result))
return maybe_result;
5528 ->
Lookup(maps, flags)->IsUndefined());
5533 { MaybeObject* maybe_new_cache = hash_table->
Put(maps, flags, code);
5534 if (!maybe_new_cache->ToObject(&new_cache))
return maybe_new_cache;
5536 set_cache(new_cache);
5543 if (!cache()->IsUndefined()) {
5561 code_flags_(code_flags) {}
5566 FromObject(other, &other_flags, &other_maps);
5567 if (code_flags_ != other_flags)
return false;
5568 if (maps_->length() != other_maps.length())
return false;
5570 int this_hash = MapsHashHelper(maps_, code_flags_);
5571 int other_hash = MapsHashHelper(&other_maps, other_flags);
5572 if (this_hash != other_hash)
return false;
5577 for (
int i = 0; i < maps_->length(); ++i) {
5578 bool match_found =
false;
5579 for (
int j = 0; j < other_maps.length(); ++j) {
5580 if (*(maps_->at(i)) == *(other_maps.
at(j))) {
5585 if (!match_found)
return false;
5591 uint32_t hash = code_flags;
5592 for (
int i = 0; i < maps->length(); ++i) {
5593 hash ^= maps->
at(i)->Hash();
5599 return MapsHashHelper(maps_, code_flags_);
5605 FromObject(obj, &other_flags, &other_maps);
5606 return MapsHashHelper(&other_maps, other_flags);
5614 { MaybeObject* maybe_obj =
5615 HEAP->AllocateUninitializedFixedArray(maps_->length() + 1);
5616 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
5620 for (
int i = 0; i < maps_->length(); ++i) {
5621 list->
set(i + 1, *maps_->at(i));
5633 for (
int i = 1; i < list->
length(); ++i) {
5648 int entry = FindEntry(&key);
5649 if (entry == kNotFound)
return GetHeap()->undefined_value();
5650 return get(EntryToIndex(entry) + 1);
5659 { MaybeObject* maybe_obj = EnsureCapacity(1, &key);
5660 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
5665 { MaybeObject* maybe_obj = key.
AsObject();
5666 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
5668 cache->
set(EntryToIndex(entry), obj);
5669 cache->
set(EntryToIndex(entry) + 1, code);
5677 MaybeObject* maybe_result =
5680 if (!maybe_result->To<
FixedArray>(&result))
return maybe_result;
5683 for (
int i = 0; i < result->
length(); i++) {
5685 ASSERT(current->IsNumber() || current->IsString());
5695 MaybeObject* maybe_result =
5698 if (!maybe_result->To<
FixedArray>(&result))
return maybe_result;
5701 for (
int i = 0; i < result->
length(); i++) {
5703 ASSERT(current->IsNumber() || current->IsString());
5713 if (new_length == 0)
return heap->empty_fixed_array();
5716 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
5722 if (new_length < len) len = new_length;
5727 for (
int i = 0; i < len; i++) {
5728 result->
set(i,
get(i), mode);
5737 for (
int index = 0; index < len; index++) {
5738 dest->
set(dest_pos+index,
get(pos+index), mode);
5744 bool FixedArray::IsEqualTo(
FixedArray* other) {
5745 if (length() != other->
length())
return false;
5746 for (
int i = 0 ; i < length(); ++i) {
5747 if (
get(i) != other->
get(i))
return false;
5756 Heap* heap = Isolate::Current()->heap();
5759 if (number_of_descriptors == 0) {
5760 if (shared_mode == MAY_BE_SHARED) {
5761 return heap->empty_descriptor_array();
5763 { MaybeObject* maybe_array =
5765 if (!maybe_array->To(&result))
return maybe_array;
5769 { MaybeObject* maybe_array =
5771 if (!maybe_array->To(&result))
return maybe_array;
5773 result->
set(kEnumerationIndexIndex,
5784 Object* new_index_cache) {
5785 ASSERT(bridge_storage->
length() >= kEnumCacheBridgeLength);
5786 ASSERT(new_index_cache->IsSmi() || new_index_cache->IsFixedArray());
5787 if (HasEnumCache()) {
5789 set(kEnumCacheBridgeCacheIndex, new_cache);
5791 set(kEnumCacheBridgeIndicesCacheIndex, new_index_cache);
5793 if (IsEmpty())
return;
5795 set(kEnumCacheBridgeCacheIndex, new_cache);
5797 set(kEnumCacheBridgeIndicesCacheIndex, new_index_cache);
5799 kEnumCacheBridgeEnumIndex,
5800 get(kEnumerationIndexIndex));
5801 set(kEnumerationIndexIndex, bridge_storage);
5806 static bool InsertionPointFound(
String* key1,
String* key2) {
5807 return key1->
Hash() > key2->
Hash() || key1 == key2;
5817 dst->CopyFrom(dst_index, *src, src_index, witness));
5826 PropertyDetails details = src->
GetDetails(src_index);
5827 if (details.type() ==
CALLBACKS && value->IsAccessorPair()) {
5828 MaybeObject* maybe_copy =
5830 if (!maybe_copy->To(&value))
return maybe_copy;
5832 Descriptor desc(src->
GetKey(src_index), value, details);
5833 Set(dst_index, &desc, witness);
5846 ASSERT(remove_transitions == !descriptor->ContainsTransition());
5850 { MaybeObject* maybe_result = descriptor->KeyToSymbol();
5851 if (maybe_result->IsFailure())
return maybe_result;
5855 for (
int i = 0; i < number_of_descriptors(); i++) {
5856 if (IsNullDescriptor(i))
continue;
5857 if (remove_transitions && IsTransitionOnly(i))
continue;
5863 int index = Search(descriptor->GetKey());
5864 const bool replacing = (index != kNotFound);
5865 bool keep_enumeration_index =
false;
5868 }
else if (!IsTransitionOnly(index)) {
5871 keep_enumeration_index =
true;
5872 }
else if (remove_transitions) {
5879 {
SharedMode mode = remove_transitions ? MAY_BE_SHARED : CANNOT_BE_SHARED;
5880 MaybeObject* maybe_result = Allocate(new_size, mode);
5881 if (!maybe_result->To(&new_descriptors))
return maybe_result;
5888 int enumeration_index = NextEnumerationIndex();
5889 if (!descriptor->ContainsTransition()) {
5890 if (keep_enumeration_index) {
5891 descriptor->SetEnumerationIndex(GetDetails(index).index());
5893 descriptor->SetEnumerationIndex(enumeration_index);
5894 ++enumeration_index;
5897 Map* old_elements_transition = elements_transition_map();
5898 if ((!remove_transitions) && (old_elements_transition !=
NULL)) {
5899 new_descriptors->set_elements_transition_map(old_elements_transition);
5906 int insertion_index = -1;
5908 while (from_index < number_of_descriptors()) {
5909 if (insertion_index < 0 &&
5910 InsertionPointFound(GetKey(from_index), descriptor->GetKey())) {
5911 insertion_index = to_index++;
5912 if (replacing) from_index++;
5914 if (!(IsNullDescriptor(from_index) ||
5915 (remove_transitions && IsTransitionOnly(from_index)))) {
5916 MaybeObject* copy_result =
5917 new_descriptors->
CopyFrom(to_index++,
this, from_index, witness);
5918 if (copy_result->IsFailure())
return copy_result;
5923 if (insertion_index < 0) insertion_index = to_index++;
5925 ASSERT(insertion_index < new_descriptors->number_of_descriptors());
5926 new_descriptors->
Set(insertion_index, descriptor, witness);
5929 SLOW_ASSERT(new_descriptors->IsSortedNoDuplicates());
5931 return new_descriptors;
5937 int new_number_of_descriptors = 0;
5938 for (
int i = 0; i < number_of_descriptors(); i++) {
5939 if (IsProperty(i)) new_number_of_descriptors++;
5942 { MaybeObject* maybe_result = Allocate(new_number_of_descriptors,
5944 if (!maybe_result->To(&new_descriptors))
return maybe_result;
5949 int next_descriptor = 0;
5950 for (
int i = 0; i < number_of_descriptors(); i++) {
5951 if (IsProperty(i)) {
5952 MaybeObject* copy_result =
5953 new_descriptors->
CopyFrom(next_descriptor++,
this, i, witness);
5954 if (copy_result->IsFailure())
return copy_result;
5960 return new_descriptors;
5969 int len = number_of_descriptors();
5973 const int max_parent_index = (len / 2) - 1;
5974 for (
int i = max_parent_index; i >= 0; --i) {
5975 int parent_index = i;
5976 const uint32_t parent_hash = GetKey(i)->Hash();
5977 while (parent_index <= max_parent_index) {
5978 int child_index = 2 * parent_index + 1;
5979 uint32_t child_hash = GetKey(child_index)->Hash();
5980 if (child_index + 1 < len) {
5981 uint32_t right_child_hash = GetKey(child_index + 1)->Hash();
5982 if (right_child_hash > child_hash) {
5984 child_hash = right_child_hash;
5987 if (child_hash <= parent_hash)
break;
5988 NoIncrementalWriteBarrierSwapDescriptors(parent_index, child_index);
5990 parent_index = child_index;
5995 for (
int i = len - 1; i > 0; --i) {
5997 NoIncrementalWriteBarrierSwapDescriptors(0, i);
5999 int parent_index = 0;
6000 const uint32_t parent_hash = GetKey(parent_index)->Hash();
6001 const int max_parent_index = (i / 2) - 1;
6002 while (parent_index <= max_parent_index) {
6003 int child_index = parent_index * 2 + 1;
6004 uint32_t child_hash = GetKey(child_index)->Hash();
6005 if (child_index + 1 < i) {
6006 uint32_t right_child_hash = GetKey(child_index + 1)->Hash();
6007 if (right_child_hash > child_hash) {
6009 child_hash = right_child_hash;
6012 if (child_hash <= parent_hash)
break;
6013 NoIncrementalWriteBarrierSwapDescriptors(parent_index, child_index);
6014 parent_index = child_index;
6021 SortUnchecked(witness);
6027 uint32_t hash = name->
Hash();
6032 while (low != high) {
6033 int mid = (low + high) / 2;
6034 String* mid_name = GetKey(mid);
6035 uint32_t mid_hash = mid_name->
Hash();
6037 if (mid_hash >= hash) {
6044 for (; low <= limit && GetKey(low)->Hash() == hash; ++low) {
6045 if (GetKey(low)->Equals(name) && !IsNullDescriptor(low))
6054 uint32_t hash = name->
Hash();
6055 for (
int number = 0; number < len; number++) {
6056 String* entry = GetKey(number);
6058 if (name->
Equals(entry) && !IsNullDescriptor(number)) {
6070 if (!maybe_copy->To(©))
return maybe_copy;
6072 copy->set_getter(getter()->IsMap() ? heap->the_hole_value() : getter());
6073 copy->set_setter(setter()->IsMap() ? heap->the_hole_value() : setter());
6079 Object* accessor =
get(component);
6080 return accessor->IsTheHole() ?
GetHeap()->undefined_value() : accessor;
6086 ASSERT(deopt_entry_count > 0);
6087 return HEAP->AllocateFixedArray(LengthFor(deopt_entry_count),
6094 if (number_of_deopt_points == 0)
return HEAP->empty_fixed_array();
6095 return HEAP->AllocateFixedArray(LengthOfFixedArray(number_of_deopt_points),
6102 if (IsEmpty())
return other->
IsEmpty();
6103 if (other->
IsEmpty())
return false;
6104 if (length() != other->
length())
return false;
6105 for (
int i = 0; i < length(); ++i) {
6106 if (
get(i) != other->
get(i))
return false;
6114 if (!Isolate::Current()->heap()->Contains(
this))
return false;
6120 int length = this->length();
6121 StringShape shape(
this);
6129 string = cons->
first();
6130 shape = StringShape(
string);
6134 offset = slice->
offset();
6135 string = slice->
parent();
6136 shape = StringShape(
string);
6165 int* length_return) {
6172 if (length < 0) length =
kMaxInt - offset;
6177 buffer->Reset(offset,
this);
6178 int character_position = offset;
6181 while (buffer->
has_more() && character_position++ < offset + length) {
6187 if (length_return) {
6188 *length_return = utf8_bytes;
6191 char* result = NewArray<char>(utf8_bytes + 1);
6195 buffer->
Seek(offset);
6196 character_position = offset;
6197 int utf8_byte_position = 0;
6199 while (buffer->
has_more() && character_position++ < offset + length) {
6204 utf8_byte_position +=
6208 result[utf8_byte_position] = 0;
6215 int* length_return) {
6216 return ToCString(allow_nulls, robust_flag, 0, -1, length_return);
6221 return GetTwoByteData(0);
6226 ASSERT(!IsAsciiRepresentationUnderneath());
6227 switch (StringShape(
this).representation_tag()) {
6232 ExternalTwoByteStringGetData(start);
6254 buffer->Reset(
this);
6256 uc16* result = NewArray<uc16>(length() + 1);
6261 result[i++] = character;
6269 return reinterpret_cast<uc16*
>(
6275 unsigned* offset_ptr,
6276 unsigned max_chars) {
6277 unsigned chars_read = 0;
6278 unsigned offset = *offset_ptr;
6279 while (chars_read < max_chars) {
6281 reinterpret_cast<char*
>(
this) -
6302 *offset_ptr = offset;
6308 unsigned* remaining,
6309 unsigned* offset_ptr,
6310 unsigned max_chars) {
6313 *remaining = max_chars;
6314 *offset_ptr += max_chars;
6327 unsigned* offset_ptr,
6328 unsigned max_chars) {
6330 unsigned offset = *offset_ptr;
6331 int offset_correction = 0;
6335 unsigned left_length = (unsigned)left->
length();
6336 if (left_length > offset &&
6337 (max_chars <= left_length - offset ||
6338 (rbb->
capacity <= left_length - offset &&
6339 (max_chars = left_length - offset,
true)))) {
6347 if (StringShape(left).IsCons()) {
6353 *offset_ptr = offset + offset_correction;
6356 }
else if (left_length <= offset) {
6360 offset -= left_length;
6361 offset_correction += left_length;
6362 if (StringShape(right).IsCons()) {
6368 *offset_ptr = offset + offset_correction;
6384 *offset_ptr = offset + offset_correction;
6392 unsigned* remaining,
6393 unsigned* offset_ptr,
6394 unsigned max_chars) {
6397 reinterpret_cast<const unibrow::byte*
>(GetChars()) + *offset_ptr;
6398 *remaining = max_chars;
6399 *offset_ptr += max_chars;
6406 unsigned* offset_ptr,
6407 unsigned max_chars) {
6408 unsigned chars_read = 0;
6409 unsigned offset = *offset_ptr;
6411 while (chars_read < max_chars) {
6430 *offset_ptr = offset;
6436 unsigned* offset_ptr,
6437 unsigned max_chars) {
6439 if (max_chars > capacity) max_chars = capacity;
6445 *offset_ptr += max_chars;
6446 rbb->
cursor += max_chars;
6452 unsigned* offset_ptr,
6453 unsigned max_chars) {
6455 if (max_chars > capacity) max_chars = capacity;
6458 *offset_ptr += max_chars;
6459 rbb->
cursor += max_chars;
6469 unsigned* offset_ptr,
6470 unsigned max_chars) {
6471 ASSERT(*offset_ptr <= static_cast<unsigned>(input->
length()));
6472 if (max_chars == 0) {
6476 switch (StringShape(input).representation_tag()) {
6502 ExternalTwoByteStringReadBlockIntoBuffer(rbb,
6520 void Relocatable::PostGarbageCollectionProcessing() {
6521 Isolate* isolate = Isolate::Current();
6522 Relocatable* current = isolate->relocatable_top();
6523 while (current !=
NULL) {
6524 current->PostGarbageCollection();
6525 current = current->prev_;
6531 int Relocatable::ArchiveSpacePerThread() {
6532 return sizeof(Isolate::Current()->relocatable_top());
6537 char* Relocatable::ArchiveState(Isolate* isolate,
char* to) {
6538 *
reinterpret_cast<Relocatable**
>(to) = isolate->relocatable_top();
6539 isolate->set_relocatable_top(
NULL);
6540 return to + ArchiveSpacePerThread();
6545 char* Relocatable::RestoreState(Isolate* isolate,
char* from) {
6546 isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from));
6547 return from + ArchiveSpacePerThread();
6551 char* Relocatable::Iterate(ObjectVisitor* v,
char* thread_storage) {
6552 Relocatable* top = *
reinterpret_cast<Relocatable**
>(thread_storage);
6554 return thread_storage + ArchiveSpacePerThread();
6558 void Relocatable::Iterate(ObjectVisitor* v) {
6559 Isolate* isolate = Isolate::Current();
6560 Iterate(v, isolate->relocatable_top());
6564 void Relocatable::Iterate(ObjectVisitor* v, Relocatable* top) {
6565 Relocatable* current = top;
6566 while (current !=
NULL) {
6567 current->IterateInstance(v);
6568 current = current->prev_;
6574 : Relocatable(isolate),
6575 str_(str.location()),
6576 length_(str->length()) {
6582 : Relocatable(isolate),
6585 length_(input.length()),
6586 start_(input.start()) { }
6590 if (str_ ==
NULL)
return;
6594 ASSERT(content.IsFlat());
6595 is_ascii_ = content.IsAscii();
6597 start_ = content.ToAsciiVector().start();
6599 start_ = content.ToUC16Vector().start();
6620 unsigned* offset_ptr,
6621 unsigned max_chars) {
6623 if (max_chars == 0)
return;
6625 switch (StringShape(input).representation_tag()) {
6646 ExternalAsciiStringReadBlockIntoBuffer(rbb, offset_ptr, max_chars);
6649 ExternalTwoByteStringReadBlockIntoBuffer(rbb,
6671 unsigned* remaining,
6672 unsigned* offset_ptr) {
6674 unsigned chars = input->
length() - *offset_ptr;
6686 unsigned* remaining,
6687 unsigned* offset_ptr) {
6689 ASSERT(*offset_ptr <= (
unsigned)input->length());
6690 unsigned chars = input->length() - *offset_ptr;
6691 if (chars > capacity) chars = capacity;
6706 unsigned* offset_ptr,
6707 unsigned max_chars) {
6709 unsigned offset = *offset_ptr;
6710 int offset_correction = 0;
6714 unsigned left_length = (unsigned)left->
length();
6715 if (left_length > offset &&
6716 max_chars <= left_length - offset) {
6719 if (StringShape(left).IsCons()) {
6724 *offset_ptr = offset + offset_correction;
6727 }
else if (left_length <= offset) {
6730 offset -= left_length;
6731 offset_correction += left_length;
6733 if (StringShape(right).IsCons()) {
6738 *offset_ptr = offset + offset_correction;
6744 max_chars -= left_length - offset;
6748 if (offset == left_length) {
6751 offset -= left_length;
6752 offset_correction += left_length;
6755 *offset_ptr = offset + offset_correction;
6768 return left->Get(index);
6774 if (StringShape(
string).IsCons()) {
6777 if (left->
length() > index) {
6781 string = cons_string->
second();
6784 return string->Get(index);
6803 buffer, offset_ptr, chars);
6814 buffer, offset_ptr, chars);
6818 template <
typename sink
char>
6827 ASSERT(0 <= from && from <= to && to <= source->
length());
6828 switch (StringShape(source).full_representation_tag()) {
6859 int boundary = first->
length();
6860 if (to - boundary >= boundary - from) {
6862 if (from < boundary) {
6864 sink += boundary - from;
6870 source = cons_string->
second();
6873 if (to > boundary) {
6878 if (to - boundary == 1) {
6879 sink[boundary - from] =
static_cast<sinkchar
>(second->Get(0));
6880 }
else if (second->IsSeqAsciiString()) {
6886 sink + boundary - from,
6899 unsigned offset = slice->
offset();
6908 template <
typename IteratorA,
typename IteratorB>
6909 static inline bool CompareStringContents(IteratorA*
ia, IteratorB*
ib) {
6912 while (ia->has_more()) {
6913 uint32_t ca = ia->GetNext();
6914 uint32_t cb = ib->GetNext();
6926 template <
typename Char>
6927 static inline bool CompareRawStringContents(Vector<Char> a, Vector<Char> b) {
6928 int length = a.length();
6930 const Char* pa = a.start();
6931 const Char* pb = b.start();
6933 #ifndef V8_HOST_CAN_READ_UNALIGNED
6937 const int kAlignmentMask =
sizeof(uint32_t) - 1;
6938 uint32_t pa_addr =
reinterpret_cast<uint32_t
>(pa);
6939 uint32_t pb_addr =
reinterpret_cast<uint32_t
>(pb);
6940 if (((pa_addr & kAlignmentMask) | (pb_addr & kAlignmentMask)) == 0) {
6942 const int kStepSize =
sizeof(int) /
sizeof(Char);
6943 int endpoint = length - kStepSize;
6945 for (; i <= endpoint; i += kStepSize) {
6946 uint32_t wa = *
reinterpret_cast<const uint32_t*
>(pa + i);
6947 uint32_t wb = *
reinterpret_cast<const uint32_t*
>(pb + i);
6952 #ifndef V8_HOST_CAN_READ_UNALIGNED
6956 for (; i < length; i++) {
6965 template <
typename IteratorA>
6966 static inline bool CompareStringContentsPartial(Isolate* isolate,
6969 String::FlatContent content = b->GetFlatContent();
6970 if (content.IsFlat()) {
6971 if (content.IsAscii()) {
6972 VectorIterator<char>
ib(content.ToAsciiVector());
6973 return CompareStringContents(ia, &ib);
6975 VectorIterator<uc16>
ib(content.ToUC16Vector());
6976 return CompareStringContents(ia, &ib);
6979 isolate->objects_string_compare_buffer_b()->Reset(0, b);
6980 return CompareStringContents(ia,
6981 isolate->objects_string_compare_buffer_b());
6986 bool String::SlowEquals(String* other) {
6989 if (len != other->length())
return false;
6990 if (len == 0)
return true;
6997 if (
Hash() != other->Hash()) {
6998 bool found_difference =
false;
6999 for (
int i = 0; i < len; i++) {
7000 if (Get(i) != other->Get(i)) {
7001 found_difference =
true;
7005 ASSERT(found_difference);
7009 if (
Hash() != other->Hash())
return false;
7014 if (this->Get(0) != other->Get(0))
return false;
7017 String* rhs = other->TryFlattenGetString();
7019 if (StringShape(lhs).IsSequentialAscii() &&
7020 StringShape(rhs).IsSequentialAscii()) {
7023 return CompareRawStringContents(Vector<const char>(str1, len),
7024 Vector<const char>(str2, len));
7028 String::FlatContent lhs_content = lhs->GetFlatContent();
7029 String::FlatContent rhs_content = rhs->GetFlatContent();
7030 if (lhs_content.IsFlat()) {
7031 if (lhs_content.IsAscii()) {
7032 Vector<const char> vec1 = lhs_content.ToAsciiVector();
7033 if (rhs_content.IsFlat()) {
7034 if (rhs_content.IsAscii()) {
7035 Vector<const char> vec2 = rhs_content.ToAsciiVector();
7036 return CompareRawStringContents(vec1, vec2);
7038 VectorIterator<char> buf1(vec1);
7039 VectorIterator<uc16>
ib(rhs_content.ToUC16Vector());
7040 return CompareStringContents(&buf1, &ib);
7043 VectorIterator<char> buf1(vec1);
7044 isolate->objects_string_compare_buffer_b()->Reset(0, rhs);
7045 return CompareStringContents(&buf1,
7046 isolate->objects_string_compare_buffer_b());
7049 Vector<const uc16> vec1 = lhs_content.ToUC16Vector();
7050 if (rhs_content.IsFlat()) {
7051 if (rhs_content.IsAscii()) {
7052 VectorIterator<uc16> buf1(vec1);
7053 VectorIterator<char>
ib(rhs_content.ToAsciiVector());
7054 return CompareStringContents(&buf1, &ib);
7056 Vector<const uc16> vec2(rhs_content.ToUC16Vector());
7057 return CompareRawStringContents(vec1, vec2);
7060 VectorIterator<uc16> buf1(vec1);
7061 isolate->objects_string_compare_buffer_b()->Reset(0, rhs);
7062 return CompareStringContents(&buf1,
7063 isolate->objects_string_compare_buffer_b());
7067 isolate->objects_string_compare_buffer_a()->Reset(0, lhs);
7068 return CompareStringContentsPartial(isolate,
7069 isolate->objects_string_compare_buffer_a(), rhs);
7075 if (StringShape(
this).IsSymbol())
return false;
7079 if (map == heap->string_map()) {
7080 this->
set_map(heap->undetectable_string_map());
7082 }
else if (map == heap->ascii_string_map()) {
7083 this->
set_map(heap->undetectable_ascii_string_map());
7098 for (i = 0; i < slen && decoder->has_more(); i++) {
7099 uint32_t r = decoder->GetNext();
7101 if (i > slen - 1)
return false;
7105 if (Get(i) != r)
return false;
7108 return i == slen && !decoder->has_more();
7114 if (str.
length() != slen)
return false;
7118 str.
start(), slen) == 0;
7120 for (
int i = 0; i < slen; i++) {
7121 if (Get(i) !=
static_cast<uint16_t>(str[i]))
return false;
7129 if (str.
length() != slen)
return false;
7134 for (
int i = 0; i < slen; i++) {
7135 if (Get(i) != str[i])
return false;
7141 uint32_t String::ComputeAndSetHash() {
7145 const int len =
length();
7149 if (StringShape(
this).IsSequentialAscii()) {
7153 }
else if (StringShape(
this).IsSequentialTwoByte()) {
7158 StringInputBuffer buffer(
this);
7188 if (d < 0 || d > 9)
return false;
7189 uint32_t result = d;
7192 if (d < 0 || d > 9)
return false;
7194 if (result > 429496729
U - ((d > 5) ? 1 : 0))
return false;
7195 result = (result * 10) + d;
7203 bool String::SlowAsArrayIndex(uint32_t* index) {
7212 StringInputBuffer buffer(
this);
7294 if (start == 0 && end ==
length())
return this;
7301 int length = this->
length();
7302 for (
int i = 0; i <
length; i++) {
7303 fprintf(file,
"%c", Get(i));
7310 static bool ClearBackPointer(
Heap* heap,
Object* target) {
7323 Smi* NullDescriptorDetails =
7330 bool keep_entry =
false;
7332 switch (details.type()) {
7335 keep_entry = !ClearBackPointer(heap, d->
GetValue(i));
7339 if (object->IsAccessorPair()) {
7341 Object* getter = accessors->getter();
7342 if (getter->IsMap()) {
7343 if (ClearBackPointer(heap, getter)) {
7344 accessors->set_getter(heap->the_hole_value());
7348 }
else if (!getter->IsTheHole()) {
7351 Object* setter = accessors->setter();
7352 if (setter->IsMap()) {
7353 if (ClearBackPointer(heap, setter)) {
7354 accessors->set_setter(heap->the_hole_value());
7358 }
else if (!getter->IsTheHole()) {
7391 int hash = (
static_cast<uint32_t
>(
7392 reinterpret_cast<uintptr_t
>(constructor())) >> 2);
7397 hash ^= (
static_cast<uint32_t
>(
7398 reinterpret_cast<uintptr_t
>(prototype())) << 2);
7407 constructor() == other->constructor() &&
7408 prototype() == other->prototype() &&
7431 ASSERT(shared()->allows_lazy_compilation() ||
7432 code()->optimizable());
7440 return shared->is_compiled() ||
CompileLazy(shared, flag);
7444 static bool CompileLazyHelper(CompilationInfo* info,
7447 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled());
7448 ASSERT(!info->isolate()->has_pending_exception());
7450 ASSERT(result != Isolate::Current()->has_pending_exception());
7452 info->isolate()->clear_pending_exception();
7460 CompilationInfo info(shared);
7461 return CompileLazyHelper(&info, flag);
7468 if (function->shared()->is_compiled()) {
7469 function->ReplaceCode(function->shared()->code());
7470 function->shared()->set_code_age(0);
7472 CompilationInfo info(
function);
7473 result = CompileLazyHelper(&info, flag);
7474 ASSERT(!result || function->is_compiled());
7483 CompilationInfo info(
function);
7484 info.SetOptimizing(osr_ast_id);
7485 return CompileLazyHelper(&info, flag);
7493 if (!shared_info->script()->IsScript())
return false;
7494 if (shared_info->optimization_disabled())
return false;
7495 Code* code = shared_info->code();
7504 if (IsGlobalObject())
return this;
7512 if (new_proto->IsFailure())
return new_proto;
7513 ASSERT(new_proto ==
this);
7524 if (new_map ==
NULL) {
7525 MaybeObject* maybe_new_map =
7527 if (!maybe_new_map->To<
Map>(&new_map))
return maybe_new_map;
7532 if (ok->IsFailure())
return ok;
7543 ASSERT(value->IsJSReceiver());
7548 if (value->IsJSObject()) {
7550 if (ok->IsFailure())
return ok;
7559 MaybeObject* maybe_new_map =
7561 if (!maybe_new_map->To(&new_map))
return maybe_new_map;
7562 new_map->set_prototype(value);
7563 MaybeObject* maybe_object =
7565 if (maybe_object->IsFailure())
return maybe_object;
7570 set_prototype_or_initial_map(value);
7572 heap->ClearInstanceofCache();
7579 Object* construct_prototype = value;
7585 if (!value->IsJSReceiver()) {
7590 { MaybeObject* maybe_new_map =
7592 if (!maybe_new_map->To(&new_map))
return maybe_new_map;
7596 new_map->set_constructor(value);
7598 construct_prototype =
7600 initial_object_prototype();
7611 Map* no_prototype_map = shared()->is_classic_mode()
7612 ? global_context->function_without_prototype_map()
7613 : global_context->strict_mode_function_without_prototype_map();
7615 if (
map() == no_prototype_map) {
7620 ASSERT(
map() == (shared()->is_classic_mode()
7621 ? global_context->function_map()
7622 : global_context->strict_mode_function_map()));
7625 set_prototype_or_initial_map(no_prototype_map->
GetHeap()->the_hole_value());
7631 shared()->set_instance_class_name(name);
7638 PrintF(out,
"%s", *name);
7651 { MaybeObject* maybe_symbol =
7652 Isolate::Current()->heap()->LookupAsciiSymbol(to_string);
7653 if (!maybe_symbol->To(&symbol))
return maybe_symbol;
7655 set_to_string(symbol);
7656 set_to_number(to_number);
7670 return !script()->IsUndefined() &&
7671 !
reinterpret_cast<Script*
>(script())->source()->IsUndefined();
7694 return instance_size;
7705 if (!FLAG_inline_new
7712 if (!prototype->IsJSObject()) {
7713 ASSERT(prototype->IsNull());
7721 for (
Object* obj = prototype;
7722 obj != heap->null_value();
7726 LookupResult result(heap->
isolate());
7729 if (result.IsFound() && result.type() ==
CALLBACKS) {
7747 bool only_simple_this_property_assignments,
7751 only_simple_this_property_assignments));
7752 set_this_property_assignments(assignments);
7762 set_this_property_assignments(heap->undefined_value());
7769 ASSERT(obj->IsFixedArray());
7779 ASSERT(obj->IsFixedArray());
7808 accumulator->
Add(
"<No Source>");
7819 accumulator->
Add(
"<Invalid Source>");
7823 if (!is_toplevel()) {
7824 accumulator->
Add(
"function ");
7832 if (len <= max_length || max_length < 0) {
7835 accumulator->
Put(script_source,
7838 accumulator->
Add(
"...\n");
7843 static bool IsCodeEquivalent(
Code* code,
Code* recompiled) {
7845 ByteArray* code_relocation = code->relocation_info();
7846 ByteArray* recompiled_relocation = recompiled->relocation_info();
7847 int length = code_relocation->
length();
7848 if (length != recompiled_relocation->
length())
return false;
7852 return compare == 0;
7859 Code* code = this->code();
7860 if (IsCodeEquivalent(code, recompiled)) {
7862 code->set_deoptimization_data(recompiled->deoptimization_data());
7869 set_code(recompiled);
7883 set_optimization_disabled(
true);
7890 if (FLAG_trace_opt) {
7898 Code* unoptimized = code();
7910 if (!FLAG_clever_optimizations)
return;
7913 if (live_objects_may_exist())
return;
7914 set_live_objects_may_exist(
true);
7926 set_initial_map(map);
7930 set_construct_stub(builtins->
builtin(Builtins::kJSConstructStubCountdown));
7936 Map* map =
reinterpret_cast<Map*
>(initial_map());
7948 set_initial_map(heap->raw_unchecked_undefined_value());
7950 ASSERT_EQ(builtins->builtin(Builtins::kJSConstructStubCountdown),
7952 set_construct_stub(builtins->builtin(Builtins::kJSConstructStubGeneric));
7954 set_live_objects_may_exist(
false);
7964 set_initial_map(map);
7968 set_construct_stub(builtins->
builtin(Builtins::kJSConstructStubCountdown));
7970 set_live_objects_may_exist(
true);
7979 if (optimization_disabled() &&
7982 set_optimization_disabled(
false);
7991 static void GetMinInobjectSlack(
Map* map,
void* data) {
7993 if (*reinterpret_cast<int*>(data) > slack) {
7994 *
reinterpret_cast<int*
>(data) = slack;
7999 static void ShrinkInstanceSize(Map* map,
void* data) {
8000 int slack = *
reinterpret_cast<int*
>(data);
8001 map->set_inobject_properties(map->inobject_properties() - slack);
8002 map->set_unused_property_fields(map->unused_property_fields() - slack);
8003 map->set_instance_size(map->instance_size() - slack *
kPointerSize);
8015 set_initial_map(heap->undefined_value());
8017 ASSERT_EQ(builtins->builtin(Builtins::kJSConstructStubCountdown),
8019 set_construct_stub(builtins->builtin(Builtins::kJSConstructStubGeneric));
8035 v->VisitSharedFunctionInfo(
this);
8040 #define DECLARE_TAG(ignore1, name, ignore2) name,
8048 #define DECLARE_TAG(ignore1, ignore2, name) name,
8056 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) {
8057 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
8059 Object* old_target = target;
8060 VisitPointer(&target);
8065 void ObjectVisitor::VisitCodeEntry(
Address entry_address) {
8068 VisitPointer(&code);
8069 if (code != old_code) {
8075 void ObjectVisitor::VisitGlobalPropertyCell(RelocInfo* rinfo) {
8076 ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL);
8077 Object* cell = rinfo->target_cell();
8079 VisitPointer(&cell);
8080 if (cell != old_cell) {
8081 rinfo->set_target_cell(reinterpret_cast<JSGlobalPropertyCell*>(cell));
8086 void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) {
8087 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) &&
8088 rinfo->IsPatchedReturnSequence()) ||
8089 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) &&
8090 rinfo->IsPatchedDebugBreakSlotSequence()));
8092 Object* old_target = target;
8093 VisitPointer(&target);
8097 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) {
8098 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
8099 VisitPointer(rinfo->target_object_address());
8102 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) {
8103 Address* p = rinfo->target_reference_address();
8104 VisitExternalReferences(p, p + 1);
8108 set_relocation_info(
GetHeap()->empty_byte_array());
8114 it.rinfo()->apply(delta);
8121 ASSERT(Marking::Color(
this) == Marking::WHITE_OBJECT);
8133 int mode_mask = RelocInfo::kCodeTargetMask |
8134 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
8135 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) |
8136 RelocInfo::kApplyMask;
8139 RelocInfo::Mode mode = it.rinfo()->rmode();
8140 if (mode == RelocInfo::EMBEDDED_OBJECT) {
8143 }
else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
8146 }
else if (RelocInfo::IsCodeTarget(mode)) {
8154 it.rinfo()->apply(delta);
8167 int position = RelocInfo::kNoPosition;
8173 while (!it.
done()) {
8178 int dist =
static_cast<int>(pc - it.
rinfo()->pc());
8179 int pos =
static_cast<int>(it.
rinfo()->data());
8183 if ((dist < distance) ||
8184 (dist == distance && pos > position)) {
8202 int statement_position = 0;
8204 while (!it.
done()) {
8205 if (RelocInfo::IsStatementPosition(it.
rinfo()->rmode())) {
8206 int p =
static_cast<int>(it.
rinfo()->data());
8207 if (statement_position < p && p <= position) {
8208 statement_position = p;
8213 return statement_position;
8218 SafepointTable table(
this);
8219 return table.FindEntry(pc);
8233 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
8235 RelocInfo* info = it.rinfo();
8236 Object*
object = info->target_object();
8237 if (object->IsMap())
return Map::cast(
object);
8244 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
8245 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) |
8246 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID) |
8247 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_CONTEXT);
8249 RelocInfo* info = it.rinfo();
8259 Object* raw_info = type_feedback_info();
8260 if (raw_info->IsTypeFeedbackInfo()) {
8263 for (
int i = 0; i < type_feedback_cells->
CellCount(); i++) {
8277 #ifdef ENABLE_DISASSEMBLER
8279 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) {
8282 PrintF(out,
"Deoptimization Input Data (deopt points = %d)\n", deopt_count);
8283 if (0 == deopt_count)
return;
8285 PrintF(out,
"%6s %6s %6s %6s %12s\n",
"index",
"ast id",
"argc",
"pc",
8286 FLAG_print_code_verbose ?
"commands" :
"");
8287 for (
int i = 0; i < deopt_count; i++) {
8288 PrintF(out,
"%6d %6d %6d %6d",
8291 ArgumentsStackHeight(i)->value(),
8294 if (!FLAG_print_code_verbose) {
8299 int translation_index = TranslationIndex(i)->value();
8300 TranslationIterator iterator(TranslationByteArray(), translation_index);
8303 ASSERT(Translation::BEGIN == opcode);
8304 int frame_count = iterator.Next();
8305 int jsframe_count = iterator.Next();
8306 PrintF(out,
" %s {frame count=%d, js frame count=%d}\n",
8307 Translation::StringFor(opcode),
8311 while (iterator.HasNext() &&
8312 Translation::BEGIN !=
8314 PrintF(out,
"%24s %s ",
"", Translation::StringFor(opcode));
8317 case Translation::BEGIN:
8321 case Translation::JS_FRAME: {
8322 int ast_id = iterator.Next();
8323 int function_id = iterator.Next();
8324 JSFunction*
function =
8326 unsigned height = iterator.Next();
8327 PrintF(out,
"{ast_id=%d, function=", ast_id);
8328 function->PrintName(out);
8329 PrintF(out,
", height=%u}", height);
8333 case Translation::ARGUMENTS_ADAPTOR_FRAME:
8334 case Translation::CONSTRUCT_STUB_FRAME: {
8335 int function_id = iterator.Next();
8336 JSFunction*
function =
8338 unsigned height = iterator.Next();
8339 PrintF(out,
"{function=");
8340 function->PrintName(out);
8341 PrintF(out,
", height=%u}", height);
8345 case Translation::DUPLICATE:
8349 int reg_code = iterator.Next();
8354 case Translation::INT32_REGISTER: {
8355 int reg_code = iterator.Next();
8360 case Translation::DOUBLE_REGISTER: {
8361 int reg_code = iterator.Next();
8362 PrintF(out,
"{input=%s}",
8367 case Translation::STACK_SLOT: {
8368 int input_slot_index = iterator.Next();
8369 PrintF(out,
"{input=%d}", input_slot_index);
8373 case Translation::INT32_STACK_SLOT: {
8374 int input_slot_index = iterator.Next();
8375 PrintF(out,
"{input=%d}", input_slot_index);
8379 case Translation::DOUBLE_STACK_SLOT: {
8380 int input_slot_index = iterator.Next();
8381 PrintF(out,
"{input=%d}", input_slot_index);
8385 case Translation::LITERAL: {
8386 unsigned literal_index = iterator.Next();
8387 PrintF(out,
"{literal_id=%u}", literal_index);
8391 case Translation::ARGUMENTS_OBJECT:
8400 void DeoptimizationOutputData::DeoptimizationOutputDataPrint(FILE* out) {
8401 PrintF(out,
"Deoptimization Output Data (deopt points = %d)\n",
8405 PrintF(
"%6s %8s %s\n",
"ast id",
"pc",
"state");
8409 this->
AstId(i)->value(),
8418 const char* Code::Kind2String(Kind kind) {
8422 case STUB:
return "STUB";
8423 case BUILTIN:
return "BUILTIN";
8424 case LOAD_IC:
return "LOAD_IC";
8428 case CALL_IC:
return "CALL_IC";
8457 case NORMAL:
return "NORMAL";
8458 case FIELD:
return "FIELD";
8461 case HANDLER:
return "HANDLER";
8472 void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) {
8473 const char* name =
NULL;
8477 name =
"STRING_INDEX_OUT_OF_BOUNDS";
8490 PrintF(out,
"extra_ic_state = %s\n", name);
8492 PrintF(out,
"extra_ic_state = %d\n", extra);
8497 void Code::Disassemble(
const char* name, FILE* out) {
8498 PrintF(out,
"kind = %s\n", Kind2String(
kind()));
8503 PrintF(out,
"type = %s\n", PropertyType2String(
type()));
8517 if ((name !=
NULL) && (name[0] !=
'\0')) {
8518 PrintF(out,
"name = %s\n", name);
8529 DeoptimizationOutputData* data =
8531 data->DeoptimizationOutputDataPrint(out);
8533 DeoptimizationInputData* data =
8535 data->DeoptimizationInputDataPrint(out);
8540 SafepointTable table(
this);
8541 PrintF(out,
"Safepoints (size = %u)\n", table.size());
8542 for (
unsigned i = 0; i < table.length(); i++) {
8543 unsigned pc_offset = table.GetPcOffset(i);
8545 table.PrintEntry(i);
8546 PrintF(out,
" (sp -> fp)");
8547 SafepointEntry entry = table.GetEntry(i);
8548 if (entry.deoptimization_index() != Safepoint::kNoDeoptimizationIndex) {
8549 PrintF(out,
" %6d", entry.deoptimization_index());
8553 if (entry.argument_count() > 0) {
8554 PrintF(out,
" argc: %d", entry.argument_count());
8566 unsigned length = address[0];
8567 PrintF(out,
"Stack checks (size = %u)\n", length);
8568 PrintF(out,
"ast_id pc_offset\n");
8569 for (
unsigned i = 0; i < length; ++i) {
8570 unsigned index = (2 * i) + 1;
8571 PrintF(out,
"%6u %9u\n", address[index], address[index + 1]);
8578 for (RelocIterator it(
this); !it.done(); it.next()) it.rinfo()->Print(out);
8581 #endif // ENABLE_DISASSEMBLER
8595 if (!maybe->To(&new_elements))
return maybe;
8602 bool has_fast_smi_elements =
8605 if (has_fast_smi_elements) {
8620 { MaybeObject* maybe_obj =
8621 accessor->
CopyElements(
this, new_elements, new_elements_kind);
8622 if (maybe_obj->IsFailure())
return maybe_obj;
8626 if (new_elements_kind != elements_kind) {
8627 MaybeObject* maybe =
8629 if (!maybe->To(&new_map))
return maybe;
8635 parameter_map->
set(1, new_elements);
8638 if (FLAG_trace_elements_transitions) {
8646 return new_elements;
8658 { MaybeObject* maybe_obj =
8660 if (!maybe_obj->To(&elems))
return maybe_obj;
8672 { MaybeObject* maybe_obj =
8674 if (!maybe_obj->To(&new_map))
return maybe_obj;
8679 { MaybeObject* maybe_obj =
8681 if (maybe_obj->IsFailure())
return maybe_obj;
8688 parameter_map->
set(1, elems);
8691 if (FLAG_trace_elements_transitions) {
8709 if (capacity == 0) {
8710 new_elements = heap->empty_fixed_array();
8713 if (!maybe_obj->To(&new_elements))
return maybe_obj;
8715 set_elements(new_elements);
8720 void JSArray::Expand(
int required_size) {
8736 const int proto_offset =
8740 for (
int i = 0; i < number_of_transitions; i++) {
8741 if (cache->
get(proto_offset + i * step) == prototype) {
8742 Object* map = cache->
get(map_offset + i * step);
8754 if (
is_shared() || !FLAG_cache_prototype_transitions)
return this;
8761 int capacity = (cache->
length() - header) / step;
8765 if (transitions > capacity) {
8770 { MaybeObject* maybe_cache =
8772 if (!maybe_cache->To(&new_cache))
return maybe_cache;
8775 for (
int i = 0; i < capacity * step; i++) {
8776 new_cache->
set(i + header, cache->
get(i + header));
8779 set_prototype_transitions(cache);
8782 int last = transitions - 1;
8793 bool skip_hidden_prototypes) {
8801 if (!value->IsJSReceiver() && !value->IsNull())
return value;
8815 *
FACTORY->NewTypeError(
"non_extensible_proto",
8816 HandleVector<Object>(&handle, 1)));
8823 for (
Object* pt = value; pt != heap->null_value(); pt = pt->GetPrototype()) {
8828 *
FACTORY->NewError(
"cyclic_proto", HandleVector<Object>(
NULL, 0)));
8834 if (skip_hidden_prototypes) {
8838 while (current_proto->IsJSObject() &&
8846 Map* map = real_receiver->
map();
8849 if (map->prototype() == value)
return value;
8851 if (value->IsJSObject()) {
8853 if (ok->IsFailure())
return ok;
8857 if (new_map ==
NULL) {
8858 { MaybeObject* maybe_new_map =
8860 if (!maybe_new_map->To(&new_map))
return maybe_new_map;
8863 { MaybeObject* maybe_new_cache =
8865 if (maybe_new_cache->IsFailure())
return maybe_new_cache;
8868 new_map->set_prototype(value);
8870 ASSERT(new_map->prototype() == value);
8871 real_receiver->
set_map(new_map);
8887 args->arguments() - first_arg - (arg_count - 1),
8896 AssertNoContextChange ncc;
8903 if (!interceptor->query()->IsUndefined()) {
8905 v8::ToCData<v8::IndexedPropertyQuery>(interceptor->query());
8907 ApiIndexedPropertyAccess(
"interceptor-indexed-has",
this, index));
8911 VMState state(isolate, EXTERNAL);
8912 result = query(index, info);
8918 }
else if (!interceptor->getter()->IsUndefined()) {
8920 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter());
8922 ApiIndexedPropertyAccess(
"interceptor-indexed-has-get",
this, index));
8926 VMState state(isolate, EXTERNAL);
8927 result = getter(index, info);
8929 if (!result.
IsEmpty())
return true;
8932 if (holder_handle->GetElementsAccessor()->HasElement(
8933 *receiver_handle, *holder_handle, index)) {
8937 if (holder_handle->IsStringObjectWithCharacterAt(index))
return true;
8938 Object* pt = holder_handle->GetPrototype();
8939 if (pt->IsJSProxy()) {
8942 receiver, index) !=
ABSENT;
8944 if (pt->IsNull())
return false;
8951 if (IsAccessCheckNeeded()) {
8959 if (IsJSGlobalProxy()) {
8962 ASSERT(proto->IsJSGlobalObject());
8982 uint32_t length = IsJSArray() ?
8983 static_cast<uint32_t
>
8986 if ((index < length) &&
8994 uint32_t length = IsJSArray() ?
8995 static_cast<uint32_t
>
8998 if ((index < length) &&
9033 uint32_t length = parameter_map->
length();
9035 index < (length - 2) ? parameter_map->
get(index + 2) :
NULL;
9039 if (arguments->IsDictionary()) {
9046 length = arguments->
length();
9047 probe = (index < length) ? arguments->
get(index) :
NULL;
9060 if (IsAccessCheckNeeded()) {
9074 if (accessor->
HasElement(receiver,
this, index)) {
9082 if (pt->IsNull())
return false;
9083 if (pt->IsJSProxy()) {
9086 receiver, index) !=
ABSENT;
9092 MaybeObject* JSObject::SetElementWithInterceptor(uint32_t index,
9096 bool check_prototype,
9101 AssertNoContextChange ncc;
9106 if (!interceptor->setter()->IsUndefined()) {
9108 v8::ToCData<v8::IndexedPropertySetter>(interceptor->setter());
9110 ApiIndexedPropertyAccess(
"interceptor-indexed-set",
this, index));
9116 VMState state(isolate, EXTERNAL);
9120 if (!result.IsEmpty())
return *value_handle;
9122 MaybeObject* raw_result =
9123 this_handle->SetElementWithoutInterceptor(index,
9134 MaybeObject* JSObject::GetElementWithCallback(
Object* receiver,
9139 ASSERT(!structure->IsForeign());
9142 if (structure->IsAccessorInfo()) {
9144 Object* fun_obj = data->getter();
9146 HandleScope scope(isolate);
9149 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
9150 Handle<String> key = isolate->factory()->NumberToString(number);
9151 LOG(isolate, ApiNamedPropertyAccess(
"load", *
self, *key));
9152 CustomArguments args(isolate, data->data(), *
self, *holder_handle);
9157 VMState state(isolate, EXTERNAL);
9161 if (result.IsEmpty())
return isolate->heap()->undefined_value();
9166 if (structure->IsAccessorPair()) {
9168 if (getter->IsSpecFunction()) {
9173 return isolate->heap()->undefined_value();
9181 MaybeObject* JSObject::SetElementWithCallback(
Object* structure,
9187 HandleScope scope(isolate);
9191 ASSERT(!value->IsTheHole());
9192 Handle<Object> value_handle(value, isolate);
9197 ASSERT(!structure->IsForeign());
9199 if (structure->IsAccessorInfo()) {
9201 Handle<JSObject>
self(
this);
9204 Object* call_obj = data->setter();
9206 if (call_fun ==
NULL)
return value;
9207 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
9208 Handle<String> key(isolate->factory()->NumberToString(number));
9209 LOG(isolate, ApiNamedPropertyAccess(
"store", *
self, *key));
9210 CustomArguments args(isolate, data->data(), *
self, *holder_handle);
9214 VMState state(isolate, EXTERNAL);
9220 return *value_handle;
9223 if (structure->IsAccessorPair()) {
9225 if (setter->IsSpecFunction()) {
9232 Handle<Object> holder_handle(holder, isolate);
9233 Handle<Object> key(isolate->factory()->NewNumberFromUint(index));
9234 Handle<Object> args[2] = { key, holder_handle };
9235 return isolate->Throw(
9236 *isolate->factory()->NewTypeError(
"no_setter_in_callback",
9248 if (!elements()->IsFixedArray())
return false;
9250 if (elements->
map() != heap->non_strict_arguments_elements_map()) {
9254 return !arguments->IsDictionary();
9260 if (!elements()->IsFixedArray())
return false;
9262 if (elements->
map() != heap->non_strict_arguments_elements_map()) {
9266 return arguments->IsDictionary();
9276 bool check_prototype) {
9281 if (backing_store->
map() ==
GetHeap()->non_strict_arguments_elements_map()) {
9285 if (!maybe->To(&backing_store))
return maybe;
9287 uint32_t capacity =
static_cast<uint32_t
>(backing_store->
length());
9289 if (check_prototype &&
9290 (index >= capacity || backing_store->
get(index)->IsTheHole())) {
9296 if (found)
return result;
9299 uint32_t new_capacity = capacity;
9301 uint32_t array_length = 0;
9302 bool must_update_array_length =
false;
9303 bool introduces_holes =
true;
9306 introduces_holes = index > array_length;
9307 if (index >= array_length) {
9308 must_update_array_length =
true;
9309 array_length = index + 1;
9312 introduces_holes = index >= capacity;
9318 if (introduces_holes &&
9323 if (maybe->IsFailure())
return maybe;
9328 if (index >= capacity) {
9329 bool convert_to_slow =
true;
9330 if ((index - capacity) <
kMaxGap) {
9332 ASSERT(new_capacity > index);
9334 convert_to_slow =
false;
9337 if (convert_to_slow) {
9339 if (result->IsFailure())
return result;
9346 MaybeObject* maybe =
9348 if (maybe->IsFailure())
return maybe;
9361 if (!maybe_new_map->To(&new_map))
return maybe_new_map;
9366 if (new_capacity != capacity) {
9372 { MaybeObject* maybe =
9376 if (!maybe->To(&new_elements))
return maybe;
9378 new_elements->
set(index, value);
9384 ASSERT(elements()->IsFixedArray());
9385 backing_store->
set(index, value);
9386 if (must_update_array_length) {
9397 bool check_prototype,
9406 (elements->
map() == heap->non_strict_arguments_elements_map());
9414 int entry = dictionary->
FindEntry(index);
9417 PropertyDetails details = dictionary->
DetailsAt(entry);
9419 return SetElementWithCallback(element, index, value,
this, strict_mode);
9426 details = PropertyDetails(attributes,
NORMAL, details.index());
9428 }
else if (details.IsReadOnly() && !element->IsTheHole()) {
9430 return isolate->
heap()->undefined_value();
9438 return isolate->
Throw(*error);
9442 if (is_arguments && element->IsAliasedArgumentsEntry()) {
9446 ASSERT(!context->
get(context_index)->IsTheHole());
9447 context->
set(context_index, value);
9449 if (!details.IsReadOnly()) value = element;
9455 if (check_prototype) {
9457 MaybeObject* result =
9459 index, value, &found, strict_mode);
9460 if (found)
return result;
9464 if (!
map()->is_extensible()) {
9466 return isolate->
heap()->undefined_value();
9474 return isolate->
Throw(*error);
9478 PropertyDetails details = PropertyDetails(attributes,
NORMAL);
9479 MaybeObject* maybe = dictionary->
AddNumberEntry(index, value, details);
9480 if (!maybe->To(&new_dictionary))
return maybe;
9483 elements->
set(1, new_dictionary);
9485 set_elements(new_dictionary);
9493 MaybeObject* result =
9495 if (result->IsFailure())
return result;
9500 uint32_t new_length = 0;
9509 bool has_smi_only_elements =
false;
9510 bool should_convert_to_fast_double_elements =
9512 if (has_smi_only_elements) {
9515 MaybeObject* result = should_convert_to_fast_double_elements
9521 if (result->IsFailure())
return result;
9523 if (FLAG_trace_normalization) {
9524 PrintF(
"Object elements are fast case again:\n");
9537 bool check_prototype) {
9541 uint32_t elms_length =
static_cast<uint32_t
>(base_elms->
length());
9545 if (check_prototype &&
9546 (index >= elms_length ||
9553 if (found)
return result;
9558 bool value_is_smi = value->IsSmi();
9559 bool introduces_holes =
true;
9560 uint32_t length = elms_length;
9563 introduces_holes = index > length;
9565 introduces_holes = index >= elms_length;
9568 if (!value->IsNumber()) {
9573 if (maybe_obj->IsFailure())
return maybe_obj;
9574 maybe_obj =
SetFastElement(index, value, strict_mode, check_prototype);
9575 if (maybe_obj->IsFailure())
return maybe_obj;
9580 double double_value = value_is_smi
9590 if (maybe->IsFailure())
return maybe;
9594 if (index < elms_length) {
9596 elms->
set(index, double_value);
9599 uint32_t array_length = 0;
9601 if (index >= array_length) {
9609 if ((index - elms_length) <
kMaxGap) {
9613 ASSERT(static_cast<uint32_t>(new_capacity) > index);
9614 MaybeObject* maybe_obj =
9616 if (maybe_obj->IsFailure())
return maybe_obj;
9625 ASSERT(
map()->has_fast_double_elements());
9626 ASSERT(elements()->IsFixedDoubleArray());
9629 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
9632 return SetElement(index, value,
NONE, strict_mode, check_prototype);
9643 this, index, value, strict_mode);
9646 index, value, attributes, strict_mode, check_proto);
9655 ASSERT(!object->HasExternalArrayElements());
9657 object->GetIsolate(),
9658 object->SetElement(index, *value,
NONE, strict_mode,
false),
9669 if (object->HasExternalArrayElements()) {
9670 if (!value->IsSmi() && !value->IsHeapNumber() && !value->IsUndefined()) {
9678 object->GetIsolate(),
9679 object->SetElement(index, *value, attr, strict_mode,
true, set_mode),
9688 bool check_prototype,
9691 if (IsAccessCheckNeeded()) {
9697 return *value_handle;
9701 if (IsJSGlobalProxy()) {
9703 if (proto->IsNull())
return value;
9704 ASSERT(proto->IsJSGlobalObject());
9720 return isolate->
Throw(*error);
9727 if (!maybe_object->To(&dictionary))
return maybe_object;
9734 return SetElementWithInterceptor(index,
9742 return SetElementWithoutInterceptor(index,
9751 MaybeObject* JSObject::SetElementWithoutInterceptor(uint32_t index,
9755 bool check_prototype,
9766 return SetFastElement(index, value, strict_mode, check_prototype);
9772 return pixels->
SetValue(index, value);
9776 return array->
SetValue(index, value);
9781 return array->
SetValue(index, value);
9785 return array->
SetValue(index, value);
9790 return array->
SetValue(index, value);
9794 return array->
SetValue(index, value);
9799 return array->
SetValue(index, value);
9803 return array->
SetValue(index, value);
9807 return array->
SetValue(index, value);
9811 check_prototype, set_mode);
9814 uint32_t length = parameter_map->
length();
9816 (index < length - 2) ? parameter_map->
get(index + 2) :
NULL;
9817 if (probe !=
NULL && !probe->IsTheHole()) {
9820 ASSERT(!context->
get(context_index)->IsTheHole());
9821 context->
set(context_index, value);
9827 MaybeObject* maybe_entry =
9829 if (!maybe_entry->ToObject(&value))
return maybe_entry;
9833 if (arguments->IsDictionary()) {
9835 check_prototype, set_mode);
9837 return SetFastElement(index, value, strict_mode, check_prototype);
9844 return isolate->
heap()->null_value();
9851 object->TransitionElementsKind(to_kind),
9864 if (elements() == isolate->
heap()->empty_fixed_array() ||
9874 if (!maybe_new_map->To(&new_map))
return maybe_new_map;
9876 if (FLAG_trace_elements_transitions) {
9884 uint32_t capacity =
static_cast<uint32_t
>(elms->
length());
9885 uint32_t length = capacity;
9889 if (raw_length->IsUndefined()) {
9900 MaybeObject* maybe_result =
9902 if (maybe_result->IsFailure())
return maybe_result;
9911 if (maybe_result->IsFailure())
return maybe_result;
9939 uint32_t old_len = 0;
9943 if (index >= old_len && index != 0xffffffff) {
9945 { MaybeObject* maybe_len =
9947 if (!maybe_len->ToObject(&len))
return maybe_len;
9960 AssertNoContextChange ncc;
9965 if (!interceptor->getter()->IsUndefined()) {
9967 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter());
9969 ApiIndexedPropertyAccess(
"interceptor-indexed-get",
this, index));
9975 VMState state(isolate, EXTERNAL);
9976 result = getter(index, info);
9982 Heap* heap = holder_handle->GetHeap();
9984 MaybeObject* raw_result = handler->
Get(*this_handle,
9987 if (raw_result != heap->the_hole_value())
return raw_result;
9991 Object* pt = holder_handle->GetPrototype();
9992 if (pt == heap->null_value())
return heap->undefined_value();
9997 bool JSObject::HasDenseElements() {
10000 GetElementsCapacityAndUsage(&capacity, &used);
10001 return (capacity == 0) || (used > (capacity / 2));
10005 void JSObject::GetElementsCapacityAndUsage(
int* capacity,
int* used) {
10010 FixedArray* backing_store =
NULL;
10013 backing_store_base =
10016 if (backing_store->IsDictionary()) {
10017 SeededNumberDictionary* dictionary =
10019 *capacity = dictionary->Capacity();
10020 *used = dictionary->NumberOfElements();
10027 *capacity = backing_store_base->length();
10035 *capacity = backing_store->length();
10036 for (
int i = 0; i < *capacity; ++i) {
10037 if (!backing_store->get(i)->IsTheHole()) ++(*used);
10041 SeededNumberDictionary* dictionary =
10043 *capacity = dictionary->Capacity();
10044 *used = dictionary->NumberOfElements();
10049 *capacity = backing_store_base->length();
10056 *capacity = elms->length();
10057 for (
int i = 0; i < *capacity; i++) {
10058 if (!elms->is_the_hole(i)) ++(*used);
10073 *capacity = external_array->length();
10074 *used = external_array->length();
10085 GetHeap()->InNewSpace(
this))) {
10091 int old_capacity = 0;
10092 int used_elements = 0;
10093 GetElementsCapacityAndUsage(&old_capacity, &used_elements);
10096 return 3 * dictionary_size <= new_capacity;
10103 if (!HasDenseElements())
return false;
10106 if (IsAccessCheckNeeded())
return false;
10110 if (elements->
map() ==
GetHeap()->non_strict_arguments_elements_map()) {
10121 uint32_t array_size = 0;
10127 uint32_t dictionary_size =
static_cast<uint32_t
>(dictionary->
Capacity()) *
10129 return 2 * dictionary_size >= array_size;
10134 bool* has_smi_only_elements) {
10135 *has_smi_only_elements =
false;
10136 if (FLAG_unbox_double_arrays) {
10140 bool found_double =
false;
10141 for (
int i = 0; i < dictionary->
Capacity(); i++) {
10143 if (key->IsNumber()) {
10145 if (!value->IsNumber())
return false;
10146 if (!value->IsSmi()) {
10147 found_double =
true;
10151 *has_smi_only_elements = !found_double;
10152 return found_double;
10164 #ifdef OBJECT_PRINT
10165 template<
typename Shape,
typename Key>
10168 for (
int i = 0; i < capacity; i++) {
10172 if (k->IsString()) {
10178 ValueAt(i)->ShortPrint(out);
10186 template<
typename Shape,
typename Key>
10192 for (
int i = 0; i < capacity; i++) {
10195 elements->
set(pos++, ValueAt(i), mode);
10203 ASSERT(
map()->has_named_interceptor());
10205 ASSERT(constructor->shared()->IsApiFunction());
10207 constructor->shared()->get_api_func_data()->named_property_handler();
10213 ASSERT(
map()->has_indexed_interceptor());
10215 ASSERT(constructor->shared()->IsApiFunction());
10217 constructor->shared()->get_api_func_data()->indexed_property_handler();
10229 if (result.IsProperty()) {
10230 return GetProperty(receiver, &result, name, attributes);
10235 if (pt->IsNull())
return GetHeap()->undefined_value();
10247 if (result.IsProperty()) {
10248 return GetProperty(receiver, &result, name, attributes);
10250 return GetHeap()->undefined_value();
10265 if (!interceptor->getter()->IsUndefined()) {
10267 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
10269 ApiNamedPropertyAccess(
"interceptor-named-get", *holder_handle, name));
10275 VMState state(isolate, EXTERNAL);
10279 if (!result.IsEmpty()) {
10280 *attributes =
NONE;
10285 MaybeObject* result = holder_handle->GetPropertyPostInterceptor(
10297 if (IsAccessCheckNeeded()) {
10304 LookupResult result(isolate);
10306 return result.IsProperty() && (result.type() !=
INTERCEPTOR);
10312 if (IsAccessCheckNeeded()) {
10328 uint32_t length = IsJSArray() ?
10329 static_cast<uint32_t
>(
10332 return (index < length) &&
10337 uint32_t length = IsJSArray() ?
10338 static_cast<uint32_t
>(
10341 return (index < length) &&
10347 return index < static_cast<uint32_t>(pixels->
length());
10358 return index < static_cast<uint32_t>(array->
length());
10370 return GetHeap()->null_value();
10377 if (IsAccessCheckNeeded()) {
10384 LookupResult result(isolate);
10386 return result.IsFound() && (result.type() ==
CALLBACKS);
10401 if (
this != numbers) {
10402 temp = numbers->
get(i);
10409 static void InsertionSortPairs(
FixedArray* content,
10412 for (
int i = 1; i < len; i++) {
10429 for (
int i = 1; i < len; ++i) {
10430 int child_index = i;
10431 while (child_index > 0) {
10432 int parent_index = ((child_index + 1) >> 1) - 1;
10435 if (parent_value < child_value) {
10436 content->
SwapPairs(numbers, parent_index, child_index);
10440 child_index = parent_index;
10445 for (
int i = len - 1; i > 0; --i) {
10449 int parent_index = 0;
10451 int child_index = ((parent_index + 1) << 1) - 1;
10452 if (child_index >= i)
break;
10456 if (child_index + 1 >= i || child1_value > child2_value) {
10457 if (parent_value > child1_value)
break;
10458 content->
SwapPairs(numbers, parent_index, child_index);
10459 parent_index = child_index;
10461 if (parent_value > child2_value)
break;
10462 content->
SwapPairs(numbers, parent_index, child_index + 1);
10463 parent_index = child_index + 1;
10475 InsertionSortPairs(
this, numbers, len);
10480 uint32_t max_index = min_index;
10482 for (i = 1; i < len; i++) {
10489 if (max_index - min_index + 1 == len) {
10493 for (i = 0; i < len; i++) {
10500 SwapPairs(numbers, i, p);
10537 uint32_t length = IsJSArray() ?
10538 static_cast<uint32_t
>(
10541 if (length == 0)
return 0;
10556 int length = IsJSArray() ?
10559 for (
int i = 0; i < length; i++) {
10561 if (storage !=
NULL) {
10572 int length = IsJSArray() ?
10575 for (
int i = 0; i < length; i++) {
10577 if (storage !=
NULL) {
10588 while (counter < length) {
10589 if (storage !=
NULL) {
10606 while (counter < length) {
10607 if (storage !=
NULL) {
10616 if (storage !=
NULL) {
10626 int mapped_length = parameter_map->
length() - 2;
10628 if (arguments->IsDictionary()) {
10633 if (storage !=
NULL) {
10638 for (
int i = 0; i < mapped_length; ++i) {
10639 if (!parameter_map->
get(i + 2)->IsTheHole()) {
10647 int backing_length = arguments->
length();
10649 for (; i < mapped_length; ++i) {
10650 if (!parameter_map->
get(i + 2)->IsTheHole()) {
10653 }
else if (i < backing_length && !arguments->
get(i)->IsTheHole()) {
10658 for (; i < backing_length; ++i) {
10667 if (this->IsJSValue()) {
10669 if (val->IsString()) {
10672 for (
int i = 0; i < str->
length(); i++) {
10676 counter += str->
length();
10686 static_cast<PropertyAttributes>(
DONT_ENUM));
10695 hash_(HashForObject(string)) { }
10700 if (hash_ != HashForObject(
string)) {
10723 int scope_position)
10726 language_mode_(language_mode),
10727 scope_position_(scope_position) { }
10730 if (!other->IsFixedArray())
return false;
10733 if (shared != shared_)
return false;
10734 int language_unchecked =
Smi::cast(other_array->
get(2))->value();
10739 if (language_mode != language_mode_)
return false;
10740 int scope_position =
Smi::cast(other_array->
get(3))->value();
10741 if (scope_position != scope_position_)
return false;
10743 return source->
Equals(source_);
10749 int scope_position) {
10750 uint32_t hash = source->
Hash();
10759 if (language_mode ==
STRICT_MODE) hash ^= 0x8000;
10761 hash += scope_position;
10767 return StringSharedHashHelper(
10768 source_, shared_, language_mode_, scope_position_);
10775 int language_unchecked =
Smi::cast(other_array->
get(2))->value();
10780 int scope_position =
Smi::cast(other_array->
get(3))->value();
10781 return StringSharedHashHelper(
10782 source, shared, language_mode, scope_position);
10787 { MaybeObject* maybe_obj = source_->GetHeap()->AllocateFixedArray(4);
10788 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
10791 other_array->
set(0, shared_);
10792 other_array->
set(1, source_);
10795 return other_array;
10802 int scope_position_;
10811 flags_(
Smi::FromInt(flags.value())) { }
10823 uint32_t
Hash() {
return RegExpHash(string_, flags_); }
10839 return string->Hash() + flags->
value();
10850 : string_(string), hash_field_(0), seed_(seed) { }
10859 static_cast<unsigned>(string_.length()));
10872 if (hash_field_ == 0) Hash();
10873 return Isolate::Current()->heap()->AllocateSymbol(
10874 string_, chars_, hash_field_);
10884 template <
typename Char>
10888 : string_(string), hash_field_(0), seed_(seed) { }
10895 if (hasher.has_trivial_hash()) {
10901 while (i < string_.length() && hasher.is_array_index()) {
10902 hasher.AddCharacter(static_cast<uc32>(string_[i]));
10908 while (i < string_.length()) {
10909 hasher.AddCharacterNoIndex(static_cast<uc32>(string_[i]));
10912 hash_field_ = hasher.GetHashField();
10942 if (hash_field_ == 0) Hash();
10943 return HEAP->AllocateAsciiSymbol(string_, hash_field_);
10954 : string_(string), from_(from), length_(length), seed_(seed) { }
10958 ASSERT(from_ + length_ <= string_->length());
10959 StringHasher hasher(length_, string_->GetHeap()->HashSeed());
10963 if (hasher.has_trivial_hash()) {
10969 while (i < length_ && hasher.is_array_index()) {
10970 hasher.AddCharacter(static_cast<uc32>(
10971 string_->SeqAsciiStringGet(i + from_)));
10977 while (i < length_) {
10978 hasher.AddCharacterNoIndex(static_cast<uc32>(
10979 string_->SeqAsciiStringGet(i + from_)));
10982 hash_field_ = hasher.GetHashField();
11001 if (hash_field_ == 0) Hash();
11003 return HEAP->AllocateAsciiSymbol(chars, hash_field_);
11010 uint32_t hash_field_;
11025 if (hash_field_ == 0) Hash();
11026 return HEAP->AllocateTwoByteSymbol(string_, hash_field_);
11035 : string_(string) { }
11041 uint32_t
Hash() {
return string_->Hash(); }
11050 string_ = string_->TryFlattenGetString();
11051 Heap* heap = string_->GetHeap();
11056 ASSERT(string_->IsSymbol());
11063 string_->hash_field());
11074 template<
typename Shape,
typename Key>
11080 template<
typename Shape,
typename Key>
11083 kElementsStartOffset,
11088 template<
typename Shape,
typename Key>
11091 int capacity = ComputeCapacity(at_least_space_for);
11097 { MaybeObject* maybe_obj = Isolate::Current()->heap()->
11098 AllocateHashTable(EntryToIndex(capacity), pretenure);
11099 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
11110 if (!key->IsSymbol()) {
11124 uint32_t capacity = Capacity();
11125 uint32_t entry = FirstProbe(key->
Hash(), capacity);
11126 uint32_t count = 1;
11129 int index = EntryToIndex(entry);
11130 Object* element =
get(index);
11131 if (element->IsUndefined())
break;
11132 if (key == element)
return entry;
11133 if (!element->IsSymbol() &&
11134 !element->IsTheHole() &&
11142 entry = NextProbe(entry, count++, capacity);
11149 switch (DetailsAt(entry).
type()) {
11154 Object* value = ValueAt(entry);
11155 if (!value->IsAccessorPair())
return false;
11157 return accessors->getter()->IsMap() || accessors->setter()->IsMap();
11172 template<
typename Shape,
typename Key>
11180 for (
int i = kPrefixStartIndex;
11181 i < kPrefixStartIndex + Shape::kPrefixSize;
11183 new_table->
set(i,
get(i), mode);
11187 int capacity = Capacity();
11188 for (
int i = 0; i < capacity; i++) {
11189 uint32_t from_index = EntryToIndex(i);
11190 Object* k =
get(from_index);
11193 uint32_t insertion_index =
11195 for (
int j = 0; j < Shape::kEntrySize; j++) {
11196 new_table->
set(insertion_index + j,
get(from_index + j), mode);
11206 template<
typename Shape,
typename Key>
11208 int capacity = Capacity();
11209 int nof = NumberOfElements() + n;
11210 int nod = NumberOfDeletedElements();
11214 if (nod <= (capacity - nof) >> 1) {
11215 int needed_free = nof >> 1;
11216 if (nof + needed_free <= capacity)
return this;
11219 const int kMinCapacityForPretenure = 256;
11223 { MaybeObject* maybe_obj =
11225 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
11232 template<
typename Shape,
typename Key>
11234 int capacity = Capacity();
11235 int nof = NumberOfElements();
11239 if (nof > (capacity >> 2))
return this;
11244 int at_least_room_for = nof;
11245 if (at_least_room_for < 16)
return this;
11247 const int kMinCapacityForPretenure = 256;
11249 (at_least_room_for > kMinCapacityForPretenure) &&
11252 { MaybeObject* maybe_obj =
11254 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
11261 template<
typename Shape,
typename Key>
11263 uint32_t capacity = Capacity();
11264 uint32_t entry = FirstProbe(hash, capacity);
11265 uint32_t count = 1;
11268 Object* element = KeyAt(entry);
11269 if (element->IsUndefined() || element->IsTheHole())
break;
11270 entry = NextProbe(entry, count++, capacity);
11304 uint32_t, Object*);
11307 AtPut(uint32_t, Object*);
11345 String*, Object*, PropertyDetails);
11347 template MaybeObject*
11355 uint32_t, Object*, PropertyDetails);
11358 uint32_t, Object*, PropertyDetails);
11370 AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
11373 AddEntry(uint32_t, Object*, PropertyDetails, uint32_t);
11376 String*, Object*, PropertyDetails, uint32_t);
11399 Object* new_double;
11401 if (!maybe_new_double->ToObject(&new_double))
return maybe_new_double;
11407 { MaybeObject* maybe_obj =
11409 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
11416 uint32_t undefs = 0;
11418 for (
int i = 0; i < capacity; i++) {
11419 Object* k = dict->
KeyAt(i);
11420 if (dict->
IsKey(k)) {
11425 Object* value = dict->
ValueAt(i);
11426 PropertyDetails details = dict->
DetailsAt(i);
11436 if (value->IsUndefined()) {
11444 new_dict->
AddNumberEntry(pos, value, details)->ToObjectUnchecked();
11453 new_dict->
AddNumberEntry(key, value, details)->ToObjectUnchecked();
11458 uint32_t result = pos;
11459 PropertyDetails no_details = PropertyDetails(
NONE,
NORMAL);
11461 while (undefs > 0) {
11467 new_dict->
AddNumberEntry(pos, heap->undefined_value(), no_details)->
11468 ToObjectUnchecked();
11473 set_elements(new_dict);
11480 result_double->
set_value(static_cast<double>(result));
11481 return result_double;
11505 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
11510 { MaybeObject* maybe_new_array =
11512 if (!maybe_new_array->ToObject(&new_array))
return maybe_new_array;
11525 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
11534 uint32_t elements_length =
static_cast<uint32_t
>(elements_base->
length());
11535 if (limit > elements_length) {
11536 limit = elements_length ;
11546 Object* new_double;
11548 if (!maybe_new_double->ToObject(&new_double))
return maybe_new_double;
11553 uint32_t result = 0;
11554 if (elements_base->
map() == heap->fixed_double_array_map()) {
11557 unsigned int holes = limit;
11560 for (
unsigned int i = 0; i < holes; i++) {
11567 while (holes > i) {
11577 while (holes < limit) {
11588 unsigned int undefs = limit;
11589 unsigned int holes = limit;
11592 for (
unsigned int i = 0; i < undefs; i++) {
11593 Object* current = elements->
get(i);
11594 if (current->IsTheHole()) {
11597 }
else if (current->IsUndefined()) {
11603 while (undefs > i) {
11604 current = elements->
get(undefs);
11605 if (current->IsTheHole()) {
11608 }
else if (current->IsUndefined()) {
11611 elements->
set(i, current, write_barrier);
11617 while (undefs < holes) {
11621 while (holes < limit) {
11631 result_double->
set_value(static_cast<double>(result));
11632 return result_double;
11637 uint8_t clamped_value = 0;
11638 if (index < static_cast<uint32_t>(length())) {
11639 if (value->IsSmi()) {
11641 if (int_value < 0) {
11643 }
else if (int_value > 255) {
11644 clamped_value = 255;
11646 clamped_value =
static_cast<uint8_t
>(int_value);
11648 }
else if (value->IsHeapNumber()) {
11650 if (!(double_value > 0)) {
11653 }
else if (double_value > 255) {
11655 clamped_value = 255;
11658 clamped_value =
static_cast<uint8_t
>(double_value + 0.5);
11663 ASSERT(value->IsUndefined());
11665 set(index, clamped_value);
11671 template<
typename ExternalArrayClass,
typename ValueType>
11672 static MaybeObject* ExternalArrayIntSetter(
Heap* heap,
11673 ExternalArrayClass* receiver,
11676 ValueType cast_value = 0;
11677 if (index < static_cast<uint32_t>(receiver->length())) {
11678 if (value->IsSmi()) {
11680 cast_value =
static_cast<ValueType
>(int_value);
11681 }
else if (value->IsHeapNumber()) {
11683 cast_value =
static_cast<ValueType
>(
DoubleToInt32(double_value));
11687 ASSERT(value->IsUndefined());
11689 receiver->set(index, cast_value);
11696 return ExternalArrayIntSetter<ExternalByteArray, int8_t>
11697 (
GetHeap(),
this, index, value);
11703 return ExternalArrayIntSetter<ExternalUnsignedByteArray, uint8_t>
11704 (
GetHeap(),
this, index, value);
11710 return ExternalArrayIntSetter<ExternalShortArray, int16_t>
11711 (
GetHeap(),
this, index, value);
11717 return ExternalArrayIntSetter<ExternalUnsignedShortArray, uint16_t>
11718 (
GetHeap(),
this, index, value);
11723 return ExternalArrayIntSetter<ExternalIntArray, int32_t>
11724 (
GetHeap(),
this, index, value);
11729 uint32_t cast_value = 0;
11731 if (index < static_cast<uint32_t>(length())) {
11732 if (value->IsSmi()) {
11734 cast_value =
static_cast<uint32_t
>(int_value);
11735 }
else if (value->IsHeapNumber()) {
11737 cast_value =
static_cast<uint32_t
>(
DoubleToUint32(double_value));
11741 ASSERT(value->IsUndefined());
11743 set(index, cast_value);
11752 if (index < static_cast<uint32_t>(length())) {
11753 if (value->IsSmi()) {
11755 cast_value =
static_cast<float>(int_value);
11756 }
else if (value->IsHeapNumber()) {
11758 cast_value =
static_cast<float>(double_value);
11762 ASSERT(value->IsUndefined());
11764 set(index, cast_value);
11773 if (index < static_cast<uint32_t>(length())) {
11774 if (value->IsSmi()) {
11776 double_value =
static_cast<double>(int_value);
11777 }
else if (value->IsHeapNumber()) {
11782 ASSERT(value->IsUndefined());
11784 set(index, double_value);
11800 Isolate* isolate = global->GetIsolate();
11802 global->EnsurePropertyCell(*name),
11813 { MaybeObject* maybe_cell =
11815 if (!maybe_cell->ToObject(&cell))
return maybe_cell;
11818 details = details.AsDeleted();
11819 Object* dictionary;
11820 { MaybeObject* maybe_dictionary =
11822 if (!maybe_dictionary->ToObject(&dictionary))
return maybe_dictionary;
11828 ASSERT(value->IsJSGlobalPropertyCell());
11836 return LookupKey(&key, s);
11848 : c1_(c1), c2_(c2) {
11850 uint32_t hash =
seed;
11852 hash += hash << 10;
11856 hash += hash << 10;
11860 hash ^= hash >> 11;
11861 hash += hash << 15;
11871 ASSERT_EQ(static_cast<int>(hasher.GetHash()), static_cast<int>(hash));
11877 if (!o->IsString())
return false;
11879 if (other->
length() != 2)
return false;
11880 if (other->Get(0) != c1_)
return false;
11881 return other->Get(1) == c2_;
11886 if (!key->IsString())
return 0;
11906 int entry = FindEntry(&key);
11907 if (entry == kNotFound) {
11911 ASSERT(StringShape(result).IsSymbol());
11922 int entry = FindEntry(&key);
11923 if (entry == kNotFound) {
11927 ASSERT(StringShape(result).IsSymbol());
11937 return LookupKey(&key, s);
11944 return LookupKey(&key, s);
11953 return LookupKey(&key, s);
11960 return LookupKey(&key, s);
11963 MaybeObject* SymbolTable::LookupKey(
HashTableKey* key, Object** s) {
11964 int entry = FindEntry(key);
11967 if (entry != kNotFound) {
11974 { MaybeObject* maybe_obj = EnsureCapacity(1, key);
11975 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
11980 { MaybeObject* maybe_symbol = key->
AsObject();
11981 if (!maybe_symbol->ToObject(&symbol))
return maybe_symbol;
11987 SymbolTable* table =
reinterpret_cast<SymbolTable*
>(obj);
11990 entry = table->FindInsertionEntry(key->
Hash());
11991 table->set(EntryToIndex(entry), symbol);
11992 table->ElementAdded();
12000 int entry = FindEntry(&key);
12001 if (entry == kNotFound)
return GetHeap()->undefined_value();
12002 return get(EntryToIndex(entry) + 1);
12009 int scope_position) {
12011 context->
closure()->shared(),
12014 int entry = FindEntry(&key);
12015 if (entry == kNotFound)
return GetHeap()->undefined_value();
12016 return get(EntryToIndex(entry) + 1);
12023 int entry = FindEntry(&key);
12024 if (entry == kNotFound)
return GetHeap()->undefined_value();
12025 return get(EntryToIndex(entry) + 1);
12032 { MaybeObject* maybe_obj = EnsureCapacity(1, &key);
12033 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12039 cache->
set(EntryToIndex(entry), src);
12040 cache->
set(EntryToIndex(entry) + 1, value);
12049 int scope_position) {
12051 context->
closure()->shared(),
12055 { MaybeObject* maybe_obj = EnsureCapacity(1, &key);
12056 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12064 { MaybeObject* maybe_k = key.
AsObject();
12065 if (!maybe_k->ToObject(&k))
return maybe_k;
12068 cache->
set(EntryToIndex(entry), k);
12069 cache->
set(EntryToIndex(entry) + 1, value);
12080 { MaybeObject* maybe_obj = EnsureCapacity(1, &key);
12081 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12089 cache->
set(EntryToIndex(entry), value);
12090 cache->
set(EntryToIndex(entry) + 1, value);
12097 Object* the_hole_value =
GetHeap()->the_hole_value();
12098 for (
int entry = 0, size = Capacity(); entry < size; entry++) {
12099 int entry_index = EntryToIndex(entry);
12100 int value_index = entry_index + 1;
12101 if (
get(value_index) == value) {
12102 NoWriteBarrierSet(
this, entry_index, the_hole_value);
12103 NoWriteBarrierSet(
this, value_index, the_hole_value);
12118 int len = symbols_->length();
12119 if (o->
length() != len)
return false;
12120 for (
int i = 0; i < len; i++) {
12121 if (o->
get(i) != symbols_->get(i))
return false;
12126 uint32_t
Hash() {
return HashForObject(symbols_); }
12130 int len = symbols->
length();
12132 for (
int i = 0; i < len; i++) {
12147 int entry = FindEntry(&key);
12148 if (entry == kNotFound)
return GetHeap()->undefined_value();
12149 return get(EntryToIndex(entry) + 1);
12156 { MaybeObject* maybe_obj = EnsureCapacity(1, &key);
12157 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12162 cache->
set(EntryToIndex(entry), array);
12163 cache->
set(EntryToIndex(entry) + 1, value);
12169 template<
typename Shape,
typename Key>
12172 { MaybeObject* maybe_obj =
12174 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12178 SetNextEnumerationIndex(PropertyDetails::kInitialIndex);
12183 template<
typename Shape,
typename Key>
12191 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12194 for (
int i = 0; i < length; i++) {
12200 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12207 for (
int i = 0; i < capacity; i++) {
12214 iteration_order->
SortPairs(enumeration_order, enumeration_order->
length());
12217 for (
int i = 0; i < length; i++) {
12218 int index =
Smi::cast(iteration_order->
get(i))->value();
12219 int enum_index = PropertyDetails::kInitialIndex + i;
12226 for (
int i = 0; i < capacity; i++) {
12228 int enum_index =
Smi::cast(enumeration_order->
get(pos++))->value();
12229 PropertyDetails details = DetailsAt(i);
12230 PropertyDetails new_details =
12231 PropertyDetails(details.attributes(), details.type(), enum_index);
12232 DetailsAtPut(i, new_details);
12237 SetNextEnumerationIndex(PropertyDetails::kInitialIndex+length);
12241 template<
typename Shape,
typename Key>
12244 if (Shape::kIsEnumerable &&
12245 !PropertyDetails::IsValidIndex(NextEnumerationIndex() + n)) {
12248 { MaybeObject* maybe_result = GenerateNewEnumerationIndices();
12249 if (!maybe_result->ToObject(&result))
return maybe_result;
12256 template<
typename Shape,
typename Key>
12260 PropertyDetails details = DetailsAt(entry);
12263 return heap->false_value();
12265 SetEntry(entry, heap->the_hole_value(), heap->the_hole_value());
12267 return heap->true_value();
12271 template<
typename Shape,
typename Key>
12277 template<
typename Shape,
typename Key>
12279 int entry = this->FindEntry(key);
12283 ValueAtPut(entry, value);
12289 { MaybeObject* maybe_obj = EnsureCapacity(1, key);
12290 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12294 { MaybeObject* maybe_k = Shape::AsObject(key);
12295 if (!maybe_k->ToObject(&k))
return maybe_k;
12297 PropertyDetails details = PropertyDetails(
NONE,
NORMAL);
12304 template<
typename Shape,
typename Key>
12307 PropertyDetails details) {
12312 { MaybeObject* maybe_obj = EnsureCapacity(1, key);
12313 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12322 template<
typename Shape,
typename Key>
12325 PropertyDetails details,
12329 { MaybeObject* maybe_k = Shape::AsObject(key);
12330 if (!maybe_k->ToObject(&k))
return maybe_k;
12335 if (!details.IsDeleted() && details.index() == 0 && Shape::kIsEnumerable) {
12338 int index = NextEnumerationIndex();
12339 details = PropertyDetails(details.attributes(), details.type(), index);
12340 SetNextEnumerationIndex(index + 1);
12342 SetEntry(entry, k, value, details);
12353 if (requires_slow_elements())
return;
12356 if (key > kRequiresSlowElementsLimit) {
12357 set_requires_slow_elements();
12361 Object* max_index_object =
get(kMaxNumberKeyIndex);
12362 if (!max_index_object->IsSmi() || max_number_key() < key) {
12371 PropertyDetails details) {
12372 UpdateMaxNumberKey(key);
12374 return Add(key, value, details);
12381 return Add(key, value, PropertyDetails(
NONE,
NORMAL));
12386 UpdateMaxNumberKey(key);
12387 return AtPut(key, value);
12393 return AtPut(key, value);
12401 PropertyDetails details) {
12403 dictionary->Set(index, *value, details),
12413 dictionary->Set(index, *value),
12420 PropertyDetails details) {
12421 int entry = FindEntry(key);
12422 if (entry == kNotFound)
return AddNumberEntry(key, value, details);
12424 details = PropertyDetails(details.attributes(),
12426 DetailsAt(entry).index());
12428 Object* object_key;
12429 if (!maybe_object_key->ToObject(&object_key))
return maybe_object_key;
12430 SetEntry(entry, object_key, value, details);
12437 int entry = FindEntry(key);
12438 if (entry == kNotFound)
return AddNumberEntry(key, value);
12440 Object* object_key;
12441 if (!maybe_object_key->ToObject(&object_key))
return maybe_object_key;
12442 SetEntry(entry, object_key, value);
12448 template<
typename Shape,
typename Key>
12453 for (
int i = 0; i < capacity; i++) {
12456 PropertyDetails details = DetailsAt(i);
12457 if (details.IsDeleted())
continue;
12459 if ((attr & filter) == 0) result++;
12466 template<
typename Shape,
typename Key>
12468 return NumberOfElementsFilterAttributes(
12469 static_cast<PropertyAttributes>(
DONT_ENUM));
12473 template<
typename Shape,
typename Key>
12481 for (
int i = 0; i < capacity; i++) {
12484 PropertyDetails details = DetailsAt(i);
12485 if (details.IsDeleted())
continue;
12487 if ((attr & filter) == 0) storage->
set(index++, k);
12490 if (sort_mode == Dictionary<Shape, Key>::SORTED) {
12500 int capacity = Capacity();
12502 for (
int i = 0; i < capacity; i++) {
12503 Object* k = KeyAt(i);
12505 PropertyDetails details = DetailsAt(i);
12506 if (details.IsDeleted() || details.IsDontEnum())
continue;
12507 storage->
set(index, k);
12517 template<
typename Shape,
typename Key>
12522 ASSERT(storage->
length() >= NumberOfElementsFilterAttributes(
12523 static_cast<PropertyAttributes>(
NONE)));
12525 for (
int i = 0; i < capacity; i++) {
12528 PropertyDetails details = DetailsAt(i);
12529 if (details.IsDeleted())
continue;
12530 storage->
set(index++, k);
12533 if (sort_mode == Dictionary<Shape, Key>::SORTED) {
12541 template<
typename Shape,
typename Key>
12544 for (
int i = 0; i < capacity; i++) {
12547 Object* e = ValueAt(i);
12548 if (e->IsJSGlobalPropertyCell()) {
12551 if (e == value)
return k;
12555 return heap->undefined_value();
12560 JSObject* obj,
int unused_property_fields) {
12566 int max_enumeration_index =
12567 NextEnumerationIndex() +
12569 NumberOfElements());
12570 if (!PropertyDetails::IsValidIndex(max_enumeration_index)) {
12572 { MaybeObject* maybe_result = GenerateNewEnumerationIndices();
12573 if (!maybe_result->ToObject(&result))
return maybe_result;
12577 int instance_descriptor_length = 0;
12578 int number_of_fields = 0;
12583 int capacity = Capacity();
12584 for (
int i = 0; i < capacity; i++) {
12585 Object* k = KeyAt(i);
12587 Object* value = ValueAt(i);
12590 instance_descriptor_length++;
12592 (!value->IsJSFunction() || heap->
InNewSpace(value))) {
12593 number_of_fields += 1;
12600 { MaybeObject* maybe_descriptors =
12604 return maybe_descriptors;
12611 int number_of_allocated_fields =
12612 number_of_fields + unused_property_fields - inobject_props;
12613 if (number_of_allocated_fields < 0) {
12615 number_of_allocated_fields = 0;
12616 unused_property_fields = inobject_props - number_of_fields;
12621 { MaybeObject* maybe_fields =
12623 if (!maybe_fields->ToObject(&fields))
return maybe_fields;
12627 int next_descriptor = 0;
12628 int current_offset = 0;
12629 for (
int i = 0; i < capacity; i++) {
12630 Object* k = KeyAt(i);
12632 Object* value = ValueAt(i);
12636 if (!maybe_key->ToObject(&key))
return maybe_key;
12638 PropertyDetails details = DetailsAt(i);
12641 if (value->IsJSFunction() && !heap->
InNewSpace(value)) {
12644 details.attributes(),
12646 descriptors->
Set(next_descriptor++, &d, witness);
12647 }
else if (type ==
NORMAL) {
12648 if (current_offset < inobject_props) {
12653 int offset = current_offset - inobject_props;
12658 details.attributes(),
12660 descriptors->
Set(next_descriptor++, &d, witness);
12662 if (value->IsAccessorPair()) {
12663 MaybeObject* maybe_copy =
12665 if (!maybe_copy->To(&value))
return maybe_copy;
12669 details.attributes(),
12671 descriptors->
Set(next_descriptor++, &d, witness);
12677 ASSERT(current_offset == number_of_fields);
12679 descriptors->
Sort(witness);
12683 if (!maybe_new_map->ToObject(&new_map))
return maybe_new_map;
12688 obj->
map()->set_instance_descriptors(descriptors);
12692 ASSERT(obj->IsJSObject());
12707 if (maybe_hash->ToObjectUnchecked()->IsUndefined())
return false;
12709 return (FindEntry(key) != kNotFound);
12719 if (maybe_hash->IsFailure())
return maybe_hash;
12720 hash =
Smi::cast(maybe_hash->ToObjectUnchecked())->value();
12722 int entry = FindEntry(key);
12725 if (entry != kNotFound)
return this;
12729 { MaybeObject* maybe_obj = EnsureCapacity(1, key);
12730 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12734 table->
set(EntryToIndex(entry), key);
12745 if (maybe_hash->ToObjectUnchecked()->IsUndefined())
return this;
12747 int entry = FindEntry(key);
12750 if (entry == kNotFound)
return this;
12753 set_the_hole(EntryToIndex(entry));
12755 return Shrink(key);
12764 if (maybe_hash->ToObjectUnchecked()->IsUndefined()) {
12765 return GetHeap()->undefined_value();
12768 int entry = FindEntry(key);
12769 if (entry == kNotFound)
return GetHeap()->undefined_value();
12770 return get(EntryToIndex(entry) + 1);
12780 if (maybe_hash->IsFailure())
return maybe_hash;
12781 hash =
Smi::cast(maybe_hash->ToObjectUnchecked())->value();
12783 int entry = FindEntry(key);
12786 if (value->IsUndefined()) {
12787 if (entry == kNotFound)
return this;
12788 RemoveEntry(entry);
12789 return Shrink(key);
12793 if (entry != kNotFound) {
12794 set(EntryToIndex(entry) + 1, value);
12800 { MaybeObject* maybe_obj = EnsureCapacity(1, key);
12801 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
12809 void ObjectHashTable::AddEntry(
int entry, Object* key, Object* value) {
12810 set(EntryToIndex(entry), key);
12811 set(EntryToIndex(entry) + 1, value);
12816 void ObjectHashTable::RemoveEntry(
int entry) {
12817 set_the_hole(EntryToIndex(entry));
12818 set_the_hole(EntryToIndex(entry) + 1);
12823 #ifdef ENABLE_DEBUGGER_SUPPORT
12825 bool DebugInfo::HasBreakPoint(
int code_position) {
12827 Object* break_point_info = GetBreakPointInfo(code_position);
12831 if (break_point_info->IsUndefined())
return false;
12832 return BreakPointInfo::cast(break_point_info)->GetBreakPointCount() > 0;
12837 Object* DebugInfo::GetBreakPointInfo(
int code_position) {
12839 int index = GetBreakPointInfoIndex(code_position);
12842 if (index == kNoBreakPointInfo)
return GetHeap()->undefined_value();
12843 return BreakPointInfo::cast(break_points()->
get(index));
12848 void DebugInfo::ClearBreakPoint(Handle<DebugInfo> debug_info,
12850 Handle<Object> break_point_object) {
12851 Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position));
12852 if (break_point_info->IsUndefined())
return;
12853 BreakPointInfo::ClearBreakPoint(
12854 Handle<BreakPointInfo>::cast(break_point_info),
12855 break_point_object);
12859 void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info,
12861 int source_position,
12862 int statement_position,
12863 Handle<Object> break_point_object) {
12864 Isolate* isolate = Isolate::Current();
12865 Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position));
12866 if (!break_point_info->IsUndefined()) {
12867 BreakPointInfo::SetBreakPoint(
12868 Handle<BreakPointInfo>::cast(break_point_info),
12869 break_point_object);
12875 int index = kNoBreakPointInfo;
12876 for (
int i = 0; i < debug_info->break_points()->length(); i++) {
12877 if (debug_info->break_points()->get(i)->IsUndefined()) {
12882 if (index == kNoBreakPointInfo) {
12884 Handle<FixedArray> old_break_points =
12886 Handle<FixedArray> new_break_points =
12887 isolate->factory()->NewFixedArray(
12888 old_break_points->length() +
12889 Debug::kEstimatedNofBreakPointsInFunction);
12891 debug_info->set_break_points(*new_break_points);
12892 for (
int i = 0; i < old_break_points->length(); i++) {
12893 new_break_points->set(i, old_break_points->get(i));
12895 index = old_break_points->length();
12897 ASSERT(index != kNoBreakPointInfo);
12902 new_break_point_info->set_code_position(
Smi::FromInt(code_position));
12903 new_break_point_info->set_source_position(
Smi::FromInt(source_position));
12904 new_break_point_info->
12905 set_statement_position(
Smi::FromInt(statement_position));
12906 new_break_point_info->set_break_point_objects(
12907 isolate->heap()->undefined_value());
12908 BreakPointInfo::SetBreakPoint(new_break_point_info, break_point_object);
12909 debug_info->break_points()->set(index, *new_break_point_info);
12914 Object* DebugInfo::GetBreakPointObjects(
int code_position) {
12915 Object* break_point_info = GetBreakPointInfo(code_position);
12916 if (break_point_info->IsUndefined()) {
12917 return GetHeap()->undefined_value();
12919 return BreakPointInfo::cast(break_point_info)->break_point_objects();
12924 int DebugInfo::GetBreakPointCount() {
12925 if (break_points()->IsUndefined())
return 0;
12927 for (
int i = 0; i < break_points()->length(); i++) {
12928 if (!break_points()->get(i)->IsUndefined()) {
12929 BreakPointInfo* break_point_info =
12930 BreakPointInfo::cast(break_points()->
get(i));
12931 count += break_point_info->GetBreakPointCount();
12938 Object* DebugInfo::FindBreakPointInfo(Handle<DebugInfo> debug_info,
12939 Handle<Object> break_point_object) {
12940 Heap* heap = debug_info->GetHeap();
12941 if (debug_info->break_points()->IsUndefined())
return heap->undefined_value();
12942 for (
int i = 0; i < debug_info->break_points()->length(); i++) {
12943 if (!debug_info->break_points()->get(i)->IsUndefined()) {
12944 Handle<BreakPointInfo> break_point_info =
12945 Handle<BreakPointInfo>(BreakPointInfo::cast(
12946 debug_info->break_points()->get(i)));
12947 if (BreakPointInfo::HasBreakPointObject(break_point_info,
12948 break_point_object)) {
12949 return *break_point_info;
12953 return heap->undefined_value();
12959 int DebugInfo::GetBreakPointInfoIndex(
int code_position) {
12960 if (break_points()->IsUndefined())
return kNoBreakPointInfo;
12961 for (
int i = 0; i < break_points()->length(); i++) {
12962 if (!break_points()->get(i)->IsUndefined()) {
12963 BreakPointInfo* break_point_info =
12964 BreakPointInfo::cast(break_points()->
get(i));
12965 if (break_point_info->code_position()->value() == code_position) {
12970 return kNoBreakPointInfo;
12975 void BreakPointInfo::ClearBreakPoint(Handle<BreakPointInfo> break_point_info,
12976 Handle<Object> break_point_object) {
12977 Isolate* isolate = Isolate::Current();
12979 if (break_point_info->break_point_objects()->IsUndefined())
return;
12981 if (!break_point_info->break_point_objects()->IsFixedArray()) {
12982 if (break_point_info->break_point_objects() == *break_point_object) {
12983 break_point_info->set_break_point_objects(
12984 isolate->heap()->undefined_value());
12989 ASSERT(break_point_info->break_point_objects()->IsFixedArray());
12990 Handle<FixedArray> old_array =
12991 Handle<FixedArray>(
12993 Handle<FixedArray> new_array =
12994 isolate->factory()->NewFixedArray(old_array->length() - 1);
12995 int found_count = 0;
12996 for (
int i = 0; i < old_array->length(); i++) {
12997 if (old_array->get(i) == *break_point_object) {
12998 ASSERT(found_count == 0);
13001 new_array->set(i - found_count, old_array->get(i));
13005 if (found_count > 0) break_point_info->set_break_point_objects(*new_array);
13010 void BreakPointInfo::SetBreakPoint(Handle<BreakPointInfo> break_point_info,
13011 Handle<Object> break_point_object) {
13013 if (break_point_info->break_point_objects()->IsUndefined()) {
13014 break_point_info->set_break_point_objects(*break_point_object);
13018 if (break_point_info->break_point_objects() == *break_point_object)
return;
13020 if (!break_point_info->break_point_objects()->IsFixedArray()) {
13021 Handle<FixedArray> array =
FACTORY->NewFixedArray(2);
13022 array->set(0, break_point_info->break_point_objects());
13023 array->set(1, *break_point_object);
13024 break_point_info->set_break_point_objects(*array);
13028 Handle<FixedArray> old_array =
13029 Handle<FixedArray>(
13031 Handle<FixedArray> new_array =
13032 FACTORY->NewFixedArray(old_array->length() + 1);
13033 for (
int i = 0; i < old_array->length(); i++) {
13035 if (old_array->get(i) == *break_point_object)
return;
13036 new_array->set(i, old_array->get(i));
13039 new_array->set(old_array->length(), *break_point_object);
13040 break_point_info->set_break_point_objects(*new_array);
13044 bool BreakPointInfo::HasBreakPointObject(
13045 Handle<BreakPointInfo> break_point_info,
13046 Handle<Object> break_point_object) {
13048 if (break_point_info->break_point_objects()->IsUndefined())
return false;
13050 if (!break_point_info->break_point_objects()->IsFixedArray()) {
13051 return break_point_info->break_point_objects() == *break_point_object;
13054 FixedArray* array =
FixedArray::cast(break_point_info->break_point_objects());
13055 for (
int i = 0; i < array->length(); i++) {
13056 if (array->get(i) == *break_point_object) {
13065 int BreakPointInfo::GetBreakPointCount() {
13067 if (break_point_objects()->IsUndefined())
return 0;
13069 if (!break_point_objects()->IsFixedArray())
return 1;
13073 #endif // ENABLE_DEBUGGER_SUPPORT
13078 static_cast<FieldIndex>(index->
value()));
13082 Object* JSDate::DoGetField(FieldIndex index) {
13083 ASSERT(index != kDateValue);
13087 if (index < kFirstUncachedField) {
13088 Object* stamp = cache_stamp();
13089 if (stamp != date_cache->
stamp() && stamp->IsSmi()) {
13091 int64_t local_time_ms =
13092 date_cache->
ToLocal(static_cast<int64_t>(value()->
Number()));
13093 SetLocalFields(local_time_ms, date_cache);
13096 case kYear:
return year();
13097 case kMonth:
return month();
13098 case kDay:
return day();
13099 case kWeekday:
return weekday();
13100 case kHour:
return hour();
13101 case kMinute:
return min();
13102 case kSecond:
return sec();
13107 if (index >= kFirstUTCField) {
13108 return GetUTCField(index, value()->
Number(), date_cache);
13111 double time = value()->
Number();
13114 int64_t local_time_ms = date_cache->
ToLocal(static_cast<int64_t>(time));
13120 if (index == kMillisecond)
return Smi::FromInt(time_in_day_ms % 1000);
13121 ASSERT(index == kTimeInDay);
13126 Object* JSDate::GetUTCField(FieldIndex index,
13128 DateCache* date_cache) {
13129 ASSERT(index >= kFirstUTCField);
13133 int64_t time_ms =
static_cast<int64_t
>(value);
13135 if (index == kTimezoneOffset) {
13136 return Smi::FromInt(date_cache->TimezoneOffset(time_ms));
13141 if (index == kWeekdayUTC)
return Smi::FromInt(date_cache->Weekday(days));
13143 if (index <= kDayUTC) {
13144 int year, month, day;
13145 date_cache->YearMonthDayFromDays(days, &year, &month, &day);
13148 ASSERT(index == kDayUTC);
13154 case kHourUTC:
return Smi::FromInt(time_in_day_ms / (60 * 60 * 1000));
13155 case kMinuteUTC:
return Smi::FromInt((time_in_day_ms / (60 * 1000)) % 60);
13156 case kSecondUTC:
return Smi::FromInt((time_in_day_ms / 1000) % 60);
13157 case kMillisecondUTC:
return Smi::FromInt(time_in_day_ms % 1000);
13159 case kTimeInDayUTC:
return Smi::FromInt(time_in_day_ms);
13170 if (is_value_nan) {
13186 void JSDate::SetLocalFields(int64_t local_time_ms,
DateCache* date_cache) {
13189 int year, month, day;
13191 int weekday = date_cache->
Weekday(days);
13192 int hour = time_in_day_ms / (60 * 60 * 1000);
13193 int min = (time_in_day_ms / (60 * 1000)) % 60;
13194 int sec = (time_in_day_ms / 1000) % 60;
13195 set_cache_stamp(date_cache->
stamp());
static bool IsBlack(MarkBit mark_bit)
MUST_USE_RESULT MaybeObject * GetElementWithReceiver(Object *receiver, uint32_t index)
bool FLAG_enable_slow_asserts
MUST_USE_RESULT MaybeObject * GetElementWithInterceptor(Object *receiver, uint32_t index)
static const int kInitialSize
void SetEnumCache(FixedArray *bridge_storage, FixedArray *new_cache, Object *new_index_cache)
MUST_USE_RESULT MaybeObject * LookupAsciiSymbol(Vector< const char > str, Object **s)
void ClearTypeFeedbackCells(Heap *heap)
Object * Lookup(MapHandleList *maps, int code_kind)
int IndexInCodeCache(Object *name, Code *code)
bool IsMatch(Object *string)
bool prohibits_overwriting()
void set_elements_kind(ElementsKind elements_kind)
bool IsIdentifierPart(unibrow::uchar c)
int CalculateInstanceSize()
void SetBackPointer(Object *value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
StringKey(String *string)
static Handle< Object > DeleteElement(Handle< JSObject > obj, uint32_t index)
Object * KeyAt(int entry)
static uchar TrailSurrogate(int char_code)
static Handle< Object > SetProperty(Handle< JSReceiver > object, Handle< String > key, Handle< Object > value, PropertyAttributes attributes, StrictModeFlag strict_mode)
int LinearSearch(SearchMode mode, String *name, int len)
Code * builtin(Name name)
PropertyAttributes GetPropertyAttribute(String *name)
static const int kDefaultMaxOptCount
static const int kGenerousAllocationCount
void set_deopt_count(int value)
JSGlobalPropertyCell * Cell(int index)
Object * get(AccessorComponent component)
#define SLOW_ASSERT(condition)
static bool CompileLazy(Handle< JSFunction > function, ClearExceptionFlag flag)
static DeoptimizationOutputData * cast(Object *obj)
uint32_t HashForObject(Object *other)
void CopyValuesTo(FixedArray *elements)
Object * Lookup(String *name, Code::Flags flags)
static const int kNotFound
#define CHECK_EQ(expected, value)
static uchar LeadSurrogate(int char_code)
bool IsHoleyElementsKind(ElementsKind kind)
static const int kCodeEntryOffset
Object * LookupAccessor(String *name, AccessorComponent component)
MUST_USE_RESULT MaybeObject * AllocateFixedArray(int length, PretenureFlag pretenure)
static const int kArrayIndexHashMask
void SeqAsciiStringReadBlockIntoBuffer(ReadBlockBuffer *buffer, unsigned *offset, unsigned chars)
int CalculateInObjectProperties()
void InvalidateRelocation()
uint32_t HashForObject(Object *obj)
void AddCharacter(uint32_t c)
static const int kZeroHash
const char * ToCString(const v8::String::Utf8Value &value)
int inobject_properties()
void set_has_deoptimization_support(bool value)
virtual uint32_t Hash()=0
Object * LookupRegExp(String *source, JSRegExp::Flags flags)
Handle< Value >(* NamedPropertySetter)(Local< String > property, Local< Value > value, const AccessorInfo &info)
uint32_t HashForObject(Object *obj)
MUST_USE_RESULT MaybeObject * CopyDropDescriptors()
#define RETURN_IF_SCHEDULED_EXCEPTION(isolate)
bool is_hidden_prototype()
void set(int index, Object *value)
MUST_USE_RESULT MaybeObject * TransformPropertiesToFastFor(JSObject *obj, int unused_property_fields)
void AddSurrogatePair(uc32 c)
MUST_USE_RESULT MaybeObject * AddProperty(String *name, Object *value, PropertyAttributes attributes, StrictModeFlag strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
void PrintF(const char *format,...)
bool IsMatch(Object *string)
MUST_USE_RESULT MaybeObject * GetPropertyWithCallback(Object *receiver, Object *structure, String *name)
virtual MUST_USE_RESULT MaybeObject * Delete(JSObject *holder, uint32_t key, JSReceiver::DeleteMode mode)=0
bool InNewSpace(Object *object)
bool EquivalentToForNormalization(Map *other, PropertyNormalizationMode mode)
static TypeFeedbackInfo * cast(Object *obj)
static String * cast(Object *obj)
MUST_USE_RESULT MaybeObject * Add(Key key, Object *value, PropertyDetails details)
void SortUnchecked(const WhitenessWitness &)
StringSharedKey(String *source, SharedFunctionInfo *shared, LanguageMode language_mode, int scope_position)
void SetValue(Object *value, bool is_value_nan)
void DetailsAtPut(int entry, PropertyDetails value)
MUST_USE_RESULT MaybeObject * SetPropertyWithDefinedSetter(JSReceiver *setter, Object *value)
int Lookup(DescriptorArray *array, String *name)
MUST_USE_RESULT MaybeObject * AllocateSubString(String *buffer, int start, int end, PretenureFlag pretenure=NOT_TENURED)
void SetThisPropertyAssignmentsInfo(bool has_only_simple_this_property_assignments, FixedArray *this_property_assignments)
MaybeObject * TryFlatten(PretenureFlag pretenure=NOT_TENURED)
MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler(JSReceiver *receiver, uint32_t index)
MUST_USE_RESULT MaybeObject * PrepareSlowElementsForSort(uint32_t limit)
const uint32_t kTwoByteStringTag
uint32_t NumberToUint32(Object *number)
bool HasRealElementProperty(uint32_t index)
void set_opt_count(int opt_count)
uint32_t HashForObject(Object *other)
static DescriptorArray * cast(Object *obj)
static Failure * InternalError()
static void CopyFrom(Handle< DescriptorArray > dst, int dst_index, Handle< DescriptorArray > src, int src_index, const WhitenessWitness &witness)
void SeqTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer *buffer, unsigned *offset_ptr, unsigned chars)
int NumberOfLocalElements(PropertyAttributes filter)
bool IsMatch(Object *other)
Object * ToBoolean(bool condition)
void clear_instance_descriptors()
void DeleteHiddenProperty(String *key)
int unused_property_fields()
void set_length(Smi *length)
void SourceCodePrint(StringStream *accumulator, int max_length)
PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject *receiver, String *name, bool continue_search)
MUST_USE_RESULT MaybeObject * Put(MapHandleList *maps, int code_kind, Code *code)
static const char * Name(Value tok)
static Smi * FromInt(int value)
bool HasFastSmiElements()
bool IsFastObjectElementsKind(ElementsKind kind)
bool allowed_in_shared_map_code_cache()
void IteratePointer(ObjectVisitor *v, int offset)
#define LOG(isolate, Call)
RegExpKey(String *string, JSRegExp::Flags flags)
unsigned stack_check_table_offset()
Map * elements_transition_map()
void CopyKeysTo(FixedArray *storage, PropertyAttributes filter, SortMode sort_mode)
static Object * GetObjectFromEntryAddress(Address location_of_address)
void ReportFailedAccessCheck(JSObject *receiver, v8::AccessType type)
MUST_USE_RESULT MaybeObject * GetElementWithHandler(Object *receiver, uint32_t index)
uint64_t double_to_uint64(double d)
void AddSurrogatePairNoIndex(uc32 c)
bool IsMatch(Object *string)
bool HasRealNamedProperty(String *key)
MUST_USE_RESULT MaybeObject * ConvertDescriptorToFieldAndMapTransition(String *name, Object *new_value, PropertyAttributes attributes)
MUST_USE_RESULT MaybeObject * CopyInsert(Descriptor *descriptor, TransitionFlag transition_flag)
SequentialSymbolKey(Vector< const Char > string, uint32_t seed)
MUST_USE_RESULT MaybeObject * Update(String *name, Code *code)
void CopyTo(int pos, FixedArray *dest, int dest_pos, int len)
MUST_USE_RESULT MaybeObject * GetPropertyWithDefinedGetter(Object *receiver, JSReceiver *getter)
MUST_USE_RESULT MaybeObject * SetPropertyWithFailedAccessCheck(LookupResult *result, String *name, Object *value, bool check_prototype, StrictModeFlag strict_mode)
static MUST_USE_RESULT MaybeObject * Allocate(int at_least_space_for, PretenureFlag pretenure=NOT_TENURED)
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
static HeapObject * cast(Object *obj)
MUST_USE_RESULT MaybeObject * Rehash(HashTable *new_table, Key key)
MUST_USE_RESULT MaybeObject * SetInstancePrototype(Object *value)
static Handle< T > cast(Handle< S > that)
MUST_USE_RESULT MaybeObject * SetPrototype(Object *value)
static bool EncodeNonAsciiCharacter(uchar c, byte *buffer, unsigned capacity, unsigned &offset)
bool MayNamedAccess(JSObject *receiver, Object *key, v8::AccessType type)
static const int kMaxHashCalcLength
void Sort(const WhitenessWitness &)
IntrusiveMapTransitionIterator(DescriptorArray *descriptor_array)
static PropertyType ExtractTypeFromFlags(Flags flags)
MUST_USE_RESULT MaybeObject * AllocateCodeCache()
void set_pre_allocated_property_fields(int value)
const unibrow::byte * ExternalAsciiStringReadBlock(unsigned *remaining, unsigned *offset, unsigned chars)
static CodeCacheHashTable * cast(Object *obj)
static const int kProtoTransitionElementsPerEntry
static AccessorPair * cast(Object *obj)
MUST_USE_RESULT MaybeObject * AddKeysFromJSArray(JSArray *array)
static void IterateBody(HeapObject *obj, int object_size, ObjectVisitor *v)
static Failure * OutOfMemoryException()
JSFunction * GetConstantFunction(int descriptor_number)
PropertyAttributes property_attributes()
bool IsAsciiRepresentation()
TwoCharHashTableKey(uint32_t c1, uint32_t c2, uint32_t seed)
static ExternalTwoByteString * cast(Object *obj)
bool IsMatch(Object *obj)
void ExternalTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer *buffer, unsigned *offset_ptr, unsigned chars)
TraversableMap * GetAndResetParent()
int GetEnumElementKeys(FixedArray *storage)
MUST_USE_RESULT MaybeObject * GetPropertyWithFailedAccessCheck(Object *receiver, LookupResult *result, String *name, PropertyAttributes *attributes)
SeededNumberDictionary * element_dictionary()
static uint32_t StringHash(Object *obj)
Vector< const char > ToAsciiVector()
static Map * cast(Object *obj)
bool VerifyBailoutId(int id)
void CompleteInobjectSlackTracking()
MUST_USE_RESULT MaybeObject * AddNumberEntry(uint32_t key, Object *value, PropertyDetails details)
MUST_USE_RESULT MaybeObject * RemoveTransitions(SharedMode shared_mode)
MUST_USE_RESULT MaybeObject * ConvertDescriptorToField(String *name, Object *new_value, PropertyAttributes attributes)
MUST_USE_RESULT MaybeObject * GetPropertyWithReceiver(Object *receiver, String *key, PropertyAttributes *attributes)
static ByteArray * cast(Object *obj)
int BinarySearch(String *name, int low, int high)
static uint32_t ComputeHashField(unibrow::CharacterStream *buffer, int length, uint32_t seed)
MUST_USE_RESULT MaybeObject * SetElementWithCallbackSetterInPrototypes(uint32_t index, Object *value, bool *found, StrictModeFlag strict_mode)
int NumberOfEnumElements()
static const int kNoNumber
MUST_USE_RESULT MaybeObject * AsObject()
static const int kInstanceDescriptorsOrBitField3Offset
void ConsStringReadBlockIntoBuffer(ReadBlockBuffer *buffer, unsigned *offset_ptr, unsigned chars)
static FreeSpace * cast(Object *obj)
virtual MUST_USE_RESULT MaybeObject * CopyElements(JSObject *source_holder, uint32_t source_start, FixedArrayBase *destination, ElementsKind destination_kind, uint32_t destination_start, int copy_size, FixedArrayBase *source=NULL)=0
void ClearInstanceofCache()
void Set(int descriptor_number, Descriptor *desc, const WhitenessWitness &)
MUST_USE_RESULT MaybeObject * Uint32ToString(uint32_t value, bool check_number_string_cache=true)
bool SameValue(Object *other)
void Relocate(intptr_t delta)
static Failure * Exception()
MUST_USE_RESULT MaybeObject * PutRegExp(String *src, JSRegExp::Flags flags, FixedArray *value)
void MarkForLazyRecompilation()
static Foreign * cast(Object *obj)
MUST_USE_RESULT MaybeObject * GetElementsTransitionMapSlow(ElementsKind elements_kind)
MUST_USE_RESULT MaybeObject * ToObject()
MUST_USE_RESULT MaybeObject * PrepareElementsForSort(uint32_t limit)
Map * SymbolMapForString(String *str)
bool MakeExternal(v8::String::ExternalStringResource *resource)
int GetLocalElementKeys(FixedArray *storage, PropertyAttributes filter)
Object * Lookup(String *src)
int SourceStatementPosition(Address pc)
Map * LookupElementsTransitionMap(ElementsKind elements_kind)
void PrintElementsTransition(FILE *file, ElementsKind from_kind, FixedArrayBase *from_elements, ElementsKind to_kind, FixedArrayBase *to_elements)
uint32_t HashForObject(Object *obj)
static AliasedArgumentsEntry * cast(Object *obj)
bool IsTwoByteEqualTo(Vector< const uc16 > str)
uint16_t SlicedStringGet(int index)
bool Contains(Object *key)
Context * global_context()
static Handle< Object > TransitionElementsKind(Handle< JSObject > object, ElementsKind to_kind)
Handle< Object > Lookup(MapHandleList *maps, Code::Flags flags)
Object * HeapNumberToBoolean()
List< Handle< Map > > MapHandleList
#define ASSERT(condition)
bool CanTransitionToMoreGeneralFastElementsKind(ElementsKind elements_kind, bool allow_only_packed)
v8::Handle< v8::Value > Print(const v8::Arguments &args)
MUST_USE_RESULT MaybeObject * SetElement(uint32_t index, Object *value, PropertyAttributes attributes, StrictModeFlag strict_mode, bool check_prototype)
static Handle< Object > SetOwnElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, StrictModeFlag strict_mode)
MUST_USE_RESULT MaybeObject * PreventExtensions()
Map * GetPrototypeTransition(Object *prototype)
void set_profiler_ticks(int ticks)
static ExternalUnsignedShortArray * cast(Object *obj)
MUST_USE_RESULT MaybeObject * UnionOfKeys(FixedArray *other)
struct v8::internal::IeeeDoubleBigEndianArchType::@29 bits
unibrow::byte * util_buffer
static Script * cast(Object *obj)
MUST_USE_RESULT MaybeObject * PutEval(String *src, Context *context, SharedFunctionInfo *value, int scope_position)
void set_optimizable(bool value)
void LookupCallback(String *name, LookupResult *result)
int SourcePosition(Address pc)
void SetNullValueUnchecked(int descriptor_number, Heap *heap)
MUST_USE_RESULT MaybeObject * EnsureCapacity(int n, Key key)
#define VISITOR_SYNCHRONIZATION_TAGS_LIST(V)
static Dictionary< Shape, Key > * cast(Object *obj)
#define CALL_HEAP_FUNCTION_VOID(ISOLATE, FUNCTION_CALL)
MUST_USE_RESULT MaybeObject * EnsureCapacity(int n, Key key)
MUST_USE_RESULT MaybeObject * SetValue(uint32_t index, Object *value)
static Context * cast(Object *context)
Object * SlowReverseLookup(Object *value)
MUST_USE_RESULT MaybeObject * LookupSymbol(Vector< const char > str)
static const int kSourceIndex
PropertyAttributes GetPropertyAttributePostInterceptor(JSObject *receiver, String *name, bool continue_search)
static SharedFunctionInfo * cast(Object *obj)
const uint32_t kStringRepresentationMask
int SizeFromMap(Map *map)
bool HasElementWithInterceptor(JSReceiver *receiver, uint32_t index)
void RemoveFromCodeCache(String *name, Code *code, int index)
static const int kShortSize
Handle< Value >(* IndexedPropertySetter)(uint32_t index, Local< Value > value, const AccessorInfo &info)
Handle< Object > GetProperty(Handle< JSReceiver > obj, const char *name)
static const int kEntrySize
SmartArrayPointer< uc16 > ToWideCString(RobustnessFlag robustness_flag=FAST_STRING_TRAVERSAL)
bool ContainsTransition(int entry)
Handle< String > NumberToString(Handle< Object > number)
bool ReferencesObject(Object *obj)
void ReplaceCode(Code *code)
const uc16 * GetTwoByteData()
void CopyEnumKeysTo(FixedArray *storage, FixedArray *sort_array)
void set_map_and_elements(Map *map, FixedArrayBase *value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
bool IsFastElementsKind(ElementsKind kind)
static ExternalAsciiString * cast(Object *obj)
MUST_USE_RESULT MaybeObject * EnsureWritableFastElements()
void set_the_hole(int index)
static const int kInvalidStamp
void ClearThisPropertyAssignmentsInfo()
MUST_USE_RESULT MaybeObject * DeletePropertyWithHandler(String *name, DeleteMode mode)
static Code * cast(Object *obj)
Handle< String > LookupAsciiSymbol(Vector< const char > str)
bool IsMatch(Object *string)
virtual const uint16_t * data() const =0
static Handle< Object > SetHiddenProperty(Handle< JSObject > obj, Handle< String > key, Handle< Object > value)
MUST_USE_RESULT MaybeObject * AllocateInternalSymbol(unibrow::CharacterStream *buffer, int chars, uint32_t hash_field)
static uint32_t StringSharedHashHelper(String *source, SharedFunctionInfo *shared, LanguageMode language_mode, int scope_position)
MUST_USE_RESULT MaybeObject * LookupSubStringAsciiSymbol(Handle< SeqAsciiString > str, int from, int length, Object **s)
bool HasElementWithReceiver(JSReceiver *receiver, uint32_t index)
int GetSequenceIndexFromFastElementsKind(ElementsKind elements_kind)
bool AsArrayIndex(uint32_t *index)
Object * GetValue(int descriptor_number)
static Object ** RawField(HeapObject *obj, int offset)
Object * GetNormalizedProperty(LookupResult *result)
MUST_USE_RESULT MaybeObject * AllocateHeapNumber(double value, PretenureFlag pretenure)
static Smi * cast(Object *object)
static const char * AllocationIndexToString(int index)
static void IterateBody(HeapObject *obj, ObjectVisitor *v)
void ClearCodeCache(Heap *heap)
MUST_USE_RESULT MaybeObject * SetIdentityHash(Object *hash, CreationFlag flag)
bool Equals(String *other)
Handle< String > SubString(Handle< String > str, int start, int end, PretenureFlag pretenure)
MUST_USE_RESULT MaybeObject * Get(JSObject *object, PropertyNormalizationMode mode)
void Lookup(String *name, LookupResult *result)
void set_used_for_prototype(bool value)
Vector< const char > string_
MaybeObject *(* setter)(JSObject *object, Object *value, void *data)
Handle< Object > CallTrap(const char *name, Handle< Object > derived_trap, int argc, Handle< Object > args[])
static ExternalShortArray * cast(Object *obj)
MaybeObject *(* getter)(Object *object, void *data)
JSGlobalPropertyCell * GetPropertyCell(LookupResult *result)
static MarkBit MarkBitFrom(Address addr)
MUST_USE_RESULT MaybeObject * AddNumberEntry(uint32_t key, Object *value)
void Add(Vector< const char > format, Vector< FmtElm > elms)
Handle< Value >(* IndexedPropertyGetter)(uint32_t index, const AccessorInfo &info)
void IterateBody(InstanceType type, int object_size, ObjectVisitor *v)
int this_property_assignments_count()
virtual MUST_USE_RESULT MaybeObject * AsObject()=0
SmartArrayPointer< char > ToCString(AllowNullsFlag allow_nulls, RobustnessFlag robustness_flag, int offset, int length, int *length_output=0)
MUST_USE_RESULT MaybeObject * SetPropertyWithCallback(Object *structure, String *name, Object *value, JSObject *holder, StrictModeFlag strict_mode)
Object * ValueAt(int entry)
Object * InObjectPropertyAtPut(int index, Object *value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
MUST_USE_RESULT MaybeObject * SetValue(uint32_t index, Object *value)
bool IsMatch(Object *symbols)
bool IsInobjectSlackTrackingInProgress()
bool LookupSymbolIfExists(String *str, String **symbol)
const uint16_t * SeqTwoByteStringGetData(unsigned start)
static const int kMaxCachedPrototypeTransitions
MUST_USE_RESULT MaybeObject * LookupTwoByteSymbol(Vector< const uc16 > str, Object **s)
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset this_property_assignments
UnicodeCache * unicode_cache()
bool HasFastSmiOrObjectElements()
MUST_USE_RESULT MaybeObject * GetIdentityHash(CreationFlag flag)
void RemoveByIndex(Object *name, Code *code, int index)
static uchar Length(uchar chr, int previous)
void Remove(Object *value)
static const uint32_t kMaxGap
bool HasNamedInterceptor()
String * GetKey(int descriptor_number)
bool IsMatch(Object *other)
TwoByteSymbolKey(Vector< const uc16 > str, uint32_t seed)
MUST_USE_RESULT MaybeObject * GetIdentityHash(CreationFlag flag)
bool IsMatch(Object *other)
void set_the_hole(int index)
static void DeoptimizeGlobalObject(JSObject *object)
virtual size_t length() const =0
void Iterate(ObjectVisitor *v)
uint32_t HashForObject(Object *other)
MUST_USE_RESULT MaybeObject * AddFastPropertyUsingMap(Map *new_map, String *name, Object *value)
Handle< Value >(* NamedPropertyGetter)(Local< String > property, const AccessorInfo &info)
virtual MUST_USE_RESULT MaybeObject * AddElementsToFixedArray(Object *receiver, JSObject *holder, FixedArray *to, FixedArrayBase *from=NULL)=0
MUST_USE_RESULT MaybeObject * SetFastElement(uint32_t index, Object *value, StrictModeFlag strict_mode, bool check_prototype)
static void Update(Handle< PolymorphicCodeCache > cache, MapHandleList *maps, Code::Flags flags, Handle< Code > code)
MUST_USE_RESULT MaybeObject * AllocateUninitializedFixedDoubleArray(int length, PretenureFlag pretenure=NOT_TENURED)
static void PrintTop(FILE *file, bool print_args, bool print_line_number)
PolymorphicCodeCacheHashTableKey(MapHandleList *maps, int code_flags)
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
static SeededNumberDictionary * cast(Object *obj)
virtual const char * NameOfCPURegister(int reg) const
bool MarkAsUndetectable()
void LookupRealNamedPropertyInPrototypes(String *name, LookupResult *result)
int NumberOfElementsFilterAttributes(PropertyAttributes filter)
Object * SetInstanceClassName(String *name)
MUST_USE_RESULT MaybeObject * AddConstantFunctionProperty(String *name, JSFunction *function, PropertyAttributes attributes)
MUST_USE_RESULT MaybeObject * AddFastProperty(String *name, Object *value, PropertyAttributes attributes, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
static Context * GlobalContextFromLiterals(FixedArray *literals)
bool IsStringObjectWithCharacterAt(uint32_t index)
void DisableOptimization()
bool IsFastPackedElementsKind(ElementsKind kind)
MUST_USE_RESULT MaybeObject * Put(FixedArray *key, Map *value)
virtual void Seek(unsigned)
void set_undefined(int index)
MUST_USE_RESULT MaybeObject * GetLocalPropertyPostInterceptor(JSReceiver *receiver, String *name, PropertyAttributes *attributes)
static SlicedString * cast(Object *obj)
static ExternalIntArray * cast(Object *obj)
static const int kProtoTransitionMapOffset
SymbolKey(String *string)
MUST_USE_RESULT MaybeObject * SetElementsLength(Object *length)
void set_expected_nof_properties(int value)
void SetNumberOfProtoTransitions(int value)
void SetNumberOfElements(int nof)
static const int kLiteralGlobalContextIndex
MUST_USE_RESULT MaybeObject * SetElementWithHandler(JSReceiver *receiver, uint32_t index, Object *value, StrictModeFlag strict_mode)
Handle< Integer >(* NamedPropertyQuery)(Local< String > property, const AccessorInfo &info)
MUST_USE_RESULT MaybeObject * SetFastDoubleElement(uint32_t index, Object *value, StrictModeFlag strict_mode, bool check_prototype=true)
static uint32_t MapsHashHelper(MapHandleList *maps, int code_flags)
void IteratePointers(ObjectVisitor *v, int start, int end)
MUST_USE_RESULT MaybeObject * AddEntry(Key key, Object *value, PropertyDetails details, uint32_t hash)
static bool IsValidElementsTransition(ElementsKind from_kind, ElementsKind to_kind)
static const uchar kMaxNonSurrogateCharCode
void SetIdentityHash(Handle< JSObject > object, Object *hash)
void GetLocalPropertyNames(FixedArray *storage, int index)
static Failure * cast(MaybeObject *object)
#define CALL_HEAP_FUNCTION(ISOLATE, FUNCTION_CALL, TYPE)
void ResetForNewContext(int new_ic_age)
MUST_USE_RESULT MaybeObject * SetValue(uint32_t index, Object *value)
bool ToArrayIndex(uint32_t *index)
ElementsKind GetFastElementsKindFromSequenceIndex(int sequence_number)
void SetElementsCapacityAndLength(Handle< JSArray > array, int capacity, int length)
ElementsKind GetElementsKind()
Smi * PcAndState(int index)
byte * instruction_start()
static Object * RawUninitializedSentinel(Heap *heap)
static Handle< Map > GetElementsTransitionMap(Handle< JSObject > object, ElementsKind to_kind)
MUST_USE_RESULT MaybeObject * AllocateFixedArrayWithHoles(int length, PretenureFlag pretenure=NOT_TENURED)
#define MAKE_STRUCT_CASE(NAME, Name, name)
static const int kMaxCachedArrayIndexLength
Object * SetValue(uint32_t index, Object *value)
MUST_USE_RESULT MaybeObject * DeleteElement(uint32_t index, DeleteMode mode)
static const char *const kTags[kNumberOfSyncTags]
static const int kIsNotArrayIndexMask
void ForbidInlineConstructor()
uint32_t HashForObject(Key key, Object *object)
static const int kIsShared
static Oddball * cast(Object *obj)
static PolymorphicCodeCacheHashTable * cast(Object *obj)
static Address & Address_at(Address addr)
FlatStringReader(Isolate *isolate, Handle< String > str)
static const int kMaxInstanceSize
int GetFieldIndex(int descriptor_number)
Handle< Integer >(* IndexedPropertyQuery)(uint32_t index, const AccessorInfo &info)
MUST_USE_RESULT MaybeObject * GenerateNewEnumerationIndices()
MUST_USE_RESULT MaybeObject * PutPrototypeTransition(Object *prototype, Map *map)
void LookupRealNamedProperty(String *name, LookupResult *result)
static SeqAsciiString * cast(Object *obj)
void set_inobject_properties(int value)
Handle< Object > GetSourceCode()
void set_hash_field(uint32_t value)
MUST_USE_RESULT MaybeObject * SetValue(uint32_t index, Object *value)
V8EXPORT int32_t Int32Value() const
void(* AccessorSetter)(Local< String > property, Local< Value > value, const AccessorInfo &info)
static ExternalUnsignedByteArray * cast(Object *obj)
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind)
static const int kProtoTransitionNumberOfEntriesOffset
static void TransformToFastProperties(Handle< JSObject > object, int unused_property_fields)
static int TimeInDay(int64_t time_ms, int days)
uint32_t HashForObject(Object *other)
static unsigned decode(uint32_t value)
void SetCapacity(int capacity)
MUST_USE_RESULT MaybeObject * set_initial_map_and_cache_transitions(Map *value)
bool ShouldConvertToFastDoubleElements(bool *has_smi_only_elements)
static Handle< Object > SetLocalPropertyIgnoreAttributes(Handle< JSObject > object, Handle< String > key, Handle< Object > value, PropertyAttributes attributes)
Vector< const uc16 > ToUC16Vector()
uint32_t FindInsertionEntry(uint32_t hash)
void LookupInDescriptors(JSObject *holder, String *name, LookupResult *result)
SetFastElementsCapacitySmiMode
SafepointEntry GetSafepointEntry(Address pc)
static const int kPropertiesOffset
T RoundUp(T x, intptr_t m)
#define CALL_AND_RETRY(ISOLATE, FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY)
static FixedDoubleArray * cast(Object *obj)
static MUST_USE_RESULT Handle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attr, StrictModeFlag strict_mode, SetPropertyMode set_mode=SET_PROPERTY)
MUST_USE_RESULT MaybeObject * CopyWithoutTransitions()
static const char * State2String(State state)
static int GetOutputInfo(DeoptimizationOutputData *data, unsigned node_id, SharedFunctionInfo *shared)
int GetIndex(Object *name, Code *code)
Object * FastPropertyAt(int index)
static ExternalPixelArray * cast(Object *obj)
static Code * GetCodeFromTargetAddress(Address address)
bool is_inline_cache_stub()
CodeCacheHashTableKey(String *name, Code::Flags flags)
bool IsFastSmiElementsKind(ElementsKind kind)
MUST_USE_RESULT MaybeObject * CopyNormalized(PropertyNormalizationMode mode, NormalizedMapSharingMode sharing)
bool has_pending_exception()
bool AllowsSetElementsLength()
MUST_USE_RESULT MaybeObject * SetFastElementsCapacityAndLength(int capacity, int length, SetFastElementsCapacitySmiMode smi_mode)
Object * FastPropertyAtPut(int index, Object *value)
static ElementsAccessor * ForArray(FixedArrayBase *array)
MUST_USE_RESULT MaybeObject * DeleteElementWithHandler(uint32_t index, DeleteMode mode)
MUST_USE_RESULT MaybeObject * SetPropertyViaPrototypesWithHandler(JSReceiver *receiver, String *name, Object *value, PropertyAttributes attributes, StrictModeFlag strict_mode, bool *done)
void Update(DescriptorArray *array, String *name, int result)
static int GetIdentityHash(Handle< JSObject > obj)
static uint32_t NameFlagsHashHelper(String *name, Code::Flags flags)
void CopyFrom(const CodeDesc &desc)
bool HasRealNamedCallbackProperty(String *key)
InterceptorInfo * GetNamedInterceptor()
const unibrow::byte * ConsStringReadBlock(ReadBlockBuffer *buffer, unsigned *offset_ptr, unsigned chars)
void SortPairs(FixedArray *numbers, uint32_t len)
static const int kContainsCachedArrayIndexMask
WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation &)
MUST_USE_RESULT MaybeObject * Shrink(Key key)
int CompareChars(const lchar *lhs, const rchar *rhs, int chars)
PropertyDetails GetDetails(int descriptor_number)
int TenToThe(int exponent)
virtual MUST_USE_RESULT MaybeObject * Get(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store=NULL)=0
MUST_USE_RESULT MaybeObject * SetValue(uint32_t index, Object *value)
static bool ComputeArrayIndex(unibrow::CharacterStream *buffer, uint32_t *index, int length)
TraversableMap * ChildIteratorNext()
void SetNumberOfDeletedElements(int nod)
MUST_USE_RESULT MaybeObject * GetPropertyPostInterceptor(JSReceiver *receiver, String *name, PropertyAttributes *attributes)
Failure * Throw(Object *exception, MessageLocation *location=NULL)
InlineCacheState ic_state()
byte * relocation_start()
void set_construction_count(int value)
double get_scalar(int index)
Object * Lookup(Object *key)
static uint32_t MakeArrayIndexHash(uint32_t value, int length)
static MUST_USE_RESULT MaybeObject * Allocate(int at_least_space_for)
Handle< Map > FindTransitionedMap(MapHandleList *candidates)
uint16_t ConsStringGet(int index)
void Lookup(String *name, LookupResult *result)
DescriptorLookupCache * descriptor_lookup_cache()
void set_map_no_write_barrier(Map *value)
MUST_USE_RESULT MaybeObject * SetPropertyPostInterceptor(String *name, Object *value, PropertyAttributes attributes, StrictModeFlag strict_mode)
static Handle< Object > Call(Handle< Object > callable, Handle< Object > receiver, int argc, Handle< Object > argv[], bool *pending_exception, bool convert_receiver=false)
bool LookupTwoCharsSymbolIfExists(uint32_t c1, uint32_t c2, String **symbol)
MUST_USE_RESULT MaybeObject * Initialize(int capacity)
void PostGarbageCollection()
virtual bool HasElement(Object *receiver, JSObject *holder, uint32_t key, FixedArrayBase *backing_store=NULL)=0
static unsigned Encode(char *out, uchar c, int previous)
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
Object * SlowReverseLookup(Object *value)
#define DECLARE_TAG(ignore1, name, ignore2)
static JSArray * cast(Object *obj)
PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver *receiver, String *name)
void HeapSortPairs(FixedArray *content, FixedArray *numbers, int len)
#define T(name, string, precedence)
static Object * GetField(Object *date, Smi *index)
static const int kProtoTransitionHeaderSize
bool IsFastSmiOrObjectElementsKind(ElementsKind kind)
bool has_only_simple_this_property_assignments()
static JSDate * cast(Object *obj)
void SetNextEnumerationIndex(int index)
static ElementsAccessor * ForKind(ElementsKind elements_kind)
bool IsThisPropertyAssignmentArgument(int index)
bool IsMatch(Object *string)
static SeqTwoByteString * cast(Object *obj)
void RemoveByIndex(int index)
int PropertyIndexFor(String *name)
const unibrow::byte * SeqAsciiStringReadBlock(unsigned *remaining, unsigned *offset, unsigned chars)
LocalElementType HasLocalElement(uint32_t index)
static ExternalDoubleArray * cast(Object *obj)
bool IsTransitionableFastElementsKind(ElementsKind from_kind)
static void UpdateCodeCache(Handle< Map > map, Handle< String > name, Handle< Code > code)
static const unibrow::byte * ReadBlock(String *input, unibrow::byte *util_buffer, unsigned capacity, unsigned *remaining, unsigned *offset)
PropertyNormalizationMode
static ExternalFloatArray * cast(Object *obj)
bool HasElementWithHandler(uint32_t index)
MUST_USE_RESULT MaybeObject * Put(String *name, Code *code)
FlatContent GetFlatContent()
void set(int index, double value)
static const int kMaxShortPrintLength
static int SNPrintF(Vector< char > str, const char *format,...)
MUST_USE_RESULT MaybeObject * NumberFromDouble(double value, PretenureFlag pretenure=NOT_TENURED)
void PrintElementsKind(FILE *out, ElementsKind kind)
MUST_USE_RESULT MaybeObject * SetFastDoubleElementsCapacityAndLength(int capacity, int length)
int NumberOfDescribedProperties(PropertyAttributes filter=NONE)
uint32_t DoubleToUint32(double x)
uint32_t HashForObject(Object *other)
bool IsMatch(Object *string)
static const int kMapOffset
bool ShouldConvertToSlowElements(int new_capacity)
MUST_USE_RESULT MaybeObject * DeleteNormalizedProperty(String *name, DeleteMode mode)
int32_t DoubleToInt32(double x)
void LocalLookup(String *name, LookupResult *result)
void IteratePrefix(ObjectVisitor *visitor)
static HeapNumber * cast(Object *obj)
void AttachInitialMap(Map *map)
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
MUST_USE_RESULT MaybeObject * NormalizeElements()
static StringDictionary * cast(Object *obj)
void set_value(double value)
LanguageMode language_mode()
virtual size_t length() const =0
bool should_have_prototype()
static double nan_value()
bool has_deoptimization_support()
bool is_compare_ic_stub()
void ExternalAsciiStringReadBlockIntoBuffer(ReadBlockBuffer *buffer, unsigned *offset, unsigned chars)
MUST_USE_RESULT MaybeObject * AllocateAccessorPair()
static ObjectHashTable * cast(Object *obj)
bool is_the_hole(int index)
static uint32_t RandomPrivate(Isolate *isolate)
int GetIndex(String *name, Code::Flags flags)
AccessorDescriptor * GetCallbacks(int descriptor_number)
MUST_USE_RESULT MaybeObject * SetPropertyWithHandler(JSReceiver *receiver, String *name, Object *value, PropertyAttributes attributes, StrictModeFlag strict_mode)
InterceptorInfo * GetIndexedInterceptor()
ExtraICState extra_ic_state()
MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler(JSReceiver *receiver, String *name)
bool has_fast_smi_or_object_elements()
bool CanGenerateInlineConstructor(Object *prototype)
void PrintName(Object *o)
PropertyType GetType(int descriptor_number)
static JSGlobalPropertyCell * cast(Object *obj)
void YearMonthDayFromDays(int days, int *year, int *month, int *day)
static Object * cast(Object *value)
MUST_USE_RESULT MaybeObject * NumberFromUint32(uint32_t value, PretenureFlag pretenure=NOT_TENURED)
bool Contains(Address addr)
StaticResource< StringInputBuffer > * objects_string_input_buffer()
static bool CompileOptimized(Handle< JSFunction > function, int osr_ast_id, ClearExceptionFlag flag)
static Handle< Object > DeleteProperty(Handle< JSObject > obj, Handle< String > name)
void BecomeJSObject(Handle< JSReceiver > object)
MUST_USE_RESULT MaybeObject * SetPropertyForResult(LookupResult *result, String *key, Object *value, PropertyAttributes attributes, StrictModeFlag strict_mode, StoreFromKeyed store_mode)
static void ReadBlockIntoBuffer(String *input, ReadBlockBuffer *buffer, unsigned *offset_ptr, unsigned max_chars)
static const uint32_t kHashBitMask
bool HasPropertyWithHandler(String *name)
void AddCharacterNoIndex(uint32_t c)
void SlicedStringReadBlockIntoBuffer(ReadBlockBuffer *buffer, unsigned *offset_ptr, unsigned chars)
void HeapObjectShortPrint(StringStream *accumulator)
PropertyDetails DetailsAt(int entry)
uint32_t ComputeLongHash(uint64_t key)
Object * DeleteProperty(int entry, JSObject::DeleteMode mode)
MUST_USE_RESULT MaybeObject * SetDictionaryElement(uint32_t index, Object *value, PropertyAttributes attributes, StrictModeFlag strict_mode, bool check_prototype, SetPropertyMode set_mode=SET_PROPERTY)
PropertyAttributes GetPropertyAttributeWithFailedAccessCheck(Object *receiver, LookupResult *result, String *name, bool continue_search)
Handle< Object > NewTypeError(const char *type, Vector< Handle< Object > > args)
MUST_USE_RESULT MaybeObject * SetPropertyWithInterceptor(String *name, Object *value, PropertyAttributes attributes, StrictModeFlag strict_mode)
void set_bit_field(byte value)
static Token::Value ComputeOperation(Code *target)
static const int kMaxNumberOfDescriptors
SymbolsKey(FixedArray *symbols)
virtual const char * data() const =0
static JSReceiver * cast(Object *obj)
MUST_USE_RESULT MaybeObject * Initialize(const char *to_string, Object *to_number, byte kind)
ElementsKind GetNextMoreGeneralFastElementsKind(ElementsKind elements_kind, bool allow_only_packed)
static JSValue * cast(Object *obj)
Vector< const Char > string_
uint32_t HashSequentialString(const schar *chars, int length, uint32_t seed)
bool ShouldConvertToFastElements()
static const int kArrayIndexHashLengthShift
void ChildIteratorStart()
static const int kFieldsAdded
static const int kMaxUncheckedOldFastElementsLength
MUST_USE_RESULT MaybeObject * DefineFastAccessor(String *name, AccessorComponent component, Object *accessor, PropertyAttributes attributes)
void ValueAtPut(int entry, Object *value)
int number_of_descriptors()
MUST_USE_RESULT MaybeObject * AsObject()
uint32_t HashForObject(Object *obj)
static Handle< T > null()
kPropertyAccessorsOffset kNamedPropertyHandlerOffset kInstanceTemplateOffset kAccessCheckInfoOffset kEvalFrominstructionsOffsetOffset kThisPropertyAssignmentsOffset flag
bool is_keyed_store_stub()
Object * LookupEval(String *src, Context *context, LanguageMode language_mode, int scope_position)
static const int kProtoTransitionPrototypeOffset
static void IncrementLiveBytesFromMutator(Address address, int by)
MUST_USE_RESULT MaybeObject * GetPropertyWithHandler(Object *receiver, String *name)
MUST_USE_RESULT MaybeObject * CreateNextElementsTransition(ElementsKind elements_kind)
Object * Lookup(String *name, Code::Flags flags)
static const int kInitialSize
MUST_USE_RESULT MaybeObject * GetProperty(String *key)
#define ASSERT_EQ(v1, v2)
MUST_USE_RESULT MaybeObject * Put(String *src, Object *value)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
SubStringAsciiSymbolKey(Handle< SeqAsciiString > string, int from, int length, uint32_t seed)
bool HasFastObjectElements()
static bool CompileLazy(Handle< SharedFunctionInfo > shared, ClearExceptionFlag flag)
MUST_USE_RESULT MaybeObject * Add(Object *key)
InstanceType instance_type()
MUST_USE_RESULT MaybeObject * AllocateJSGlobalPropertyCell(Object *value)
static JSProxy * cast(Object *obj)
void SetParent(TraversableMap *parent)
Handle< String > Uint32ToString(uint32_t value)
static State ComputeState(Code *target)
bool MayIndexedAccess(JSObject *receiver, uint32_t index, v8::AccessType type)
static Handle< Object > ToNumber(Handle< Object > obj, bool *exc)
bool HasFastHoleyElements()
int NumberOfProtoTransitions()
bool requires_slow_elements()
MUST_USE_RESULT MaybeObject * OptimizeAsPrototype()
void SetDetailsUnchecked(int descriptor_number, Smi *value)
static bool EnsureCompiled(Handle< SharedFunctionInfo > shared, ClearExceptionFlag flag)
DescriptorArray * MutatedInstanceDescriptors()
MUST_USE_RESULT MaybeObject * CopyDropTransitions(DescriptorArray::SharedMode shared_mode)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping true
void EnableDeoptimizationSupport(Code *recompiled)
bool TooManyFastProperties(int properties, StoreFromKeyed store_mode)
#define ASSERT_NE(v1, v2)
static AccessorInfo * cast(Object *obj)
static FixedArray * cast(Object *obj)
MUST_USE_RESULT MaybeObject * GetPropertyWithInterceptor(JSReceiver *receiver, String *name, PropertyAttributes *attributes)
bool IsProperty(int descriptor_number)
static const int kHeaderSize
static Smi * set(Smi *smi, int bit_position, bool v)
bool used_for_prototype()
bool IsCompatibleReceiver(Object *receiver)
Object * SetNormalizedProperty(LookupResult *result, Object *value)
static HashTable * cast(Object *obj)
void set_is_extensible(bool value)
static bool CompileLazy(CompilationInfo *info)
ElementsKind elements_kind()
MUST_USE_RESULT MaybeObject * AtNumberPut(uint32_t key, Object *value)
Object * GetHiddenProperty(String *key)
void set_is_shared(bool value)
void SharedFunctionInfoIterateBody(ObjectVisitor *v)
static Handle< Object > GetElement(Handle< Object > object, uint32_t index)
static Handle< Object > PreventExtensions(Handle< JSObject > object)
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
static const int kArrayIndexValueBits
StaticResource< Utf8Decoder > * utf8_decoder()
static void NormalizeProperties(Handle< JSObject > object, PropertyNormalizationMode mode, int expected_additional_properties)
const uint32_t kMaxUInt32
MUST_USE_RESULT MaybeObject * NumberFromInt32(int32_t value, PretenureFlag pretenure=NOT_TENURED)
static Handle< JSGlobalPropertyCell > EnsurePropertyCell(Handle< GlobalObject > global, Handle< String > name)
void SetEntry(int entry, Object *key, Object *value)
static const int kFlagsIndex
MUST_USE_RESULT MaybeObject * AddSlowProperty(String *name, Object *value, PropertyAttributes attributes)
Object * GetCallbacksObject(int descriptor_number)
int GetThisPropertyAssignmentArgument(int index)
static VisitorId GetVisitorId(int instance_type, int instance_size)
int FindEntry(String *key)
void set_compiler_hints(int value)
bool IsFastHoleyElementsKind(ElementsKind kind)
Address GetDataStartAddress()
static MUST_USE_RESULT Handle< SeededNumberDictionary > Set(Handle< SeededNumberDictionary > dictionary, uint32_t index, Handle< Object > value, PropertyDetails details)
void IterateElements(ObjectVisitor *visitor)
CodeCacheHashTableKey(String *name, Code *code)
bool IsNullDescriptor(int descriptor_number)
bool HasDictionaryElements()
MUST_USE_RESULT MaybeObject * Put(Object *key, Object *value)
ElementsAccessor * GetElementsAccessor()
Utf8SymbolKey(Vector< const char > string, uint32_t seed)
bool HasFastDoubleElements()
MUST_USE_RESULT MaybeObject * JSArrayUpdateLengthFromIndex(uint32_t index, Object *value)
void OutputToFile(FILE *out)
static const int kAttachedToSharedFunctionInfo
MUST_USE_RESULT MaybeObject * SetPrototype(Object *value, bool skip_hidden_prototypes)
String * TryFlattenGetString(PretenureFlag pretenure=NOT_TENURED)
bool HasFastArgumentsElements()
MUST_USE_RESULT MaybeObject * LookupString(String *key, Object **s)
void set_bit_field2(byte value)
static MUST_USE_RESULT MaybeObject * AsObject(uint32_t key)
static void UpdateMapCodeCache(Handle< JSObject > object, Handle< String > name, Handle< Code > code)
void CreateFillerObjectAt(Address addr, int size)
void SwapPairs(FixedArray *numbers, int i, int j)
Object * RemovePrototype()
AsciiSymbolKey(Vector< const char > str, uint32_t seed)
void set(AccessorComponent component, Object *value)
static const int kMaxCapacity
static int Decode(FILE *f, byte *begin, byte *end)
bool HasIndexedInterceptor()
static uint32_t RegExpHash(String *string, Smi *flags)
int NumberOfLocalProperties(PropertyAttributes filter=NONE)
static void FlushICache(void *start, size_t size)
bool IsEqualTo(Vector< const char > str)
Address foreign_address()
static ExternalByteArray * cast(Object *obj)
MUST_USE_RESULT MaybeObject * AtPut(Key key, Object *value)
static const int kMaxUncheckedFastElementsLength
Handle< Boolean >(* IndexedPropertyDeleter)(uint32_t index, const AccessorInfo &info)
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
const int kMaxKeyedPolymorphism
static Flags RemoveTypeFromFlags(Flags flags)
void LocalLookupRealNamedProperty(String *name, LookupResult *result)
static int DaysFromTime(int64_t time_ms)
bool is_keyed_call_stub()
V8EXPORT bool IsInt32() const
int aliased_context_slot()
void JSFunctionIterateBody(int object_size, ObjectVisitor *v)
void set_this_property_assignments_count(int value)
bool HasHiddenProperties()
int NumberOfEnumElements()
int NextEnumerationIndex()
const uint32_t kAsciiStringTag
void CopyChars(sinkchar *dest, const sourcechar *src, int chars)
String * GetThisPropertyAssignmentName(int index)
static const int kConstructStubOffset
Smi * GenerateIdentityHash()
static const int kHashShift
AccessorDescriptor * FindAccessor(String *name)
MUST_USE_RESULT MaybeObject * DeleteProperty(String *name, DeleteMode mode)
static bool EncodeAsciiCharacter(uchar c, byte *buffer, unsigned capacity, unsigned &offset)
MUST_USE_RESULT MaybeObject * Shrink(Key key)
MUST_USE_RESULT MaybeObject * GetHash(CreationFlag flag)
static const char * GetStateName(State state)
static ConsString * cast(Object *obj)
uint32_t HashForObject(Object *obj)
bool HasDictionaryArgumentsElements()
void JSObjectShortPrint(StringStream *accumulator)
static CodeCache * cast(Object *obj)
static int NewElementsCapacity(int old_capacity)
bool IsIdentifierStart(unibrow::uchar c)
static FixedArrayBase * cast(Object *object)
MUST_USE_RESULT MaybeObject * LookupSymbol(Vector< const char > str, Object **s)
void StringShortPrint(StringStream *accumulator)
void ClearNonLiveTransitions(Heap *heap)
Object * GetComponent(AccessorComponent component)
uint32_t HashForObject(Object *key)
static const int kMaxValue
int NextFreePropertyIndex()
static const int kCodeCacheOffset
const unibrow::byte * SlicedStringReadBlock(ReadBlockBuffer *buffer, unsigned *offset_ptr, unsigned chars)
MUST_USE_RESULT MaybeObject * SetValue(uint32_t index, Object *value)
static ExternalUnsignedIntArray * cast(Object *obj)
static MUST_USE_RESULT MaybeObject * Allocate(int number_of_deopt_points, PretenureFlag pretenure)
static const int kNotFound
int expected_nof_properties()
static void DefineAccessor(Handle< JSObject > object, Handle< String > name, Handle< Object > getter, Handle< Object > setter, PropertyAttributes attributes)
void set_non_instance_prototype(bool value)
virtual MUST_USE_RESULT MaybeObject * SetLength(JSArray *holder, Object *new_length)=0
const uc32 kMaxAsciiCharCode
MUST_USE_RESULT MaybeObject * Remove(Object *key)
Handle< Value >(* AccessorGetter)(Local< String > property, const AccessorInfo &info)
Handle< Object > NewNumberFromUint(uint32_t value, PretenureFlag pretenure=NOT_TENURED)
MUST_USE_RESULT MaybeObject * AllocateMap(InstanceType instance_type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND)
StringDictionary * property_dictionary()
MUST_USE_RESULT MaybeObject * AsObject()
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
MUST_USE_RESULT MaybeObject * CopySize(int new_length)
void TraverseTransitionTree(TraverseCallback callback, void *data)
void SetNoStackCheckTable()
MUST_USE_RESULT MaybeObject * ReplaceSlowProperty(String *name, Object *value, PropertyAttributes attributes)
void UpdateMaxNumberKey(uint32_t key)
void SetNextEnumerationIndex(int value)
MUST_USE_RESULT MaybeObject * SetValue(uint32_t index, Object *value)
static ObjectHashSet * cast(Object *obj)
static JSObject * cast(Object *obj)
static const int kMaxArrayIndexSize
bool HasExternalArrayElements()
static const char *const kTagNames[kNumberOfSyncTags]
static void Clear(Address address)
static MUST_USE_RESULT MaybeObject * Allocate(int number_of_descriptors, SharedMode shared_mode)
PropertyAttributes GetLocalPropertyAttribute(String *name)
static const int kNoPreviousCharacter
void BecomeJSFunction(Handle< JSReceiver > object)
static InterceptorInfo * cast(Object *obj)
uint32_t max_number_key()
MUST_USE_RESULT MaybeObject * SetValue(uint32_t index, Object *value)
bool IsFastDoubleElementsKind(ElementsKind kind)
MUST_USE_RESULT MaybeObject * EnsureCanContainElements(Object **elements, uint32_t count, EnsureElementsMode mode)
MUST_USE_RESULT MaybeObject * SubString(int from, int to, PretenureFlag pretenure=NOT_TENURED)
void set_unused_property_fields(int value)
bool is_keyed_load_stub()
Object * FindInCodeCache(String *name, Code::Flags flags)
const uint32_t kStringEncodingMask
static v8::internal::Handle< v8::internal::TemplateInfo > OpenHandle(const Template *that)
Object * Lookup(FixedArray *key)
MUST_USE_RESULT MaybeObject * AtNumberPut(uint32_t key, Object *value)
const uint16_t * GetChars()
static MUST_USE_RESULT Handle< UnseededNumberDictionary > Set(Handle< UnseededNumberDictionary > dictionary, uint32_t index, Handle< Object > value)
void SetComponents(Object *getter, Object *setter)
void set_stack_check_table_offset(unsigned offset)
Handle< Boolean >(* NamedPropertyDeleter)(Local< String > property, const AccessorInfo &info)
void set_bit_field3(int value)
static int ComputeCapacity(int at_least_space_for)
int64_t ToLocal(int64_t time_ms)
Object * GetThisPropertyAssignmentConstant(int index)
MUST_USE_RESULT MaybeObject * AllocateAliasedArgumentsEntry(int slot)
IntrusivePrototypeTransitionIterator(HeapObject *proto_trans)
String * constructor_name()
bool IsAsciiEqualTo(Vector< const char > str)
void set_requires_slow_elements()
static JSGlobalObject * cast(Object *obj)
void StartInobjectSlackTracking(Map *map)
static JSFunction * cast(Object *obj)