68 #define TRACE_GENERIC_IC(isolate, type, reason) \
70 if (FLAG_trace_ic) { \
71 PrintF("[%s patching generic stub in ", type); \
72 JavaScriptFrame::PrintTop(isolate, stdout, false, true); \
73 PrintF(" (%s)]\n", reason); \
79 #define TRACE_GENERIC_IC(isolate, type, reason) \
81 if (FLAG_trace_ic) { \
82 PrintF("[%s patching generic stub in ", type); \
83 PrintF("(see below) (%s)]\n", reason); \
113 if (maybe_function->IsJSFunction()) {
114 JSFunction*
function = JSFunction::cast(maybe_function);
120 const char* modifier =
"";
121 if (new_target->
kind() == Code::KEYED_STORE_IC) {
131 name->ShortPrint(stdout);
137 #define TRACE_IC(type, name) TraceIC(type, name)
138 #define TRACE_VECTOR_IC(type, name, old_state, new_state) \
139 TraceIC(type, name, old_state, new_state)
142 : isolate_(isolate), target_set_(
false), target_maps_set_(
false) {
148 if (FLAG_enable_ool_constant_pool) {
159 if (FLAG_enable_ool_constant_pool) {
164 pc_address =
reinterpret_cast<Address*
>(
fp + kCallerPCOffset);
169 for (
int i = 0;
i < depth + 1;
i++) it.
Advance();
171 DCHECK(
fp == frame->fp() && pc_address == frame->pc_address());
174 if (FLAG_enable_ool_constant_pool) {
179 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address);
197 return function->shared();
204 Code* code = shared->code();
214 DCHECK(original_code->IsCode());
215 return original_code;
220 for (; it->IsFound(); it->Next()) {
221 switch (it->state()) {
222 case LookupIterator::NOT_FOUND:
223 case LookupIterator::TRANSITION:
225 case LookupIterator::JSPROXY:
227 case LookupIterator::INTERCEPTOR: {
230 if (!holder->GetNamedInterceptor()->getter()->IsUndefined()) {
235 case LookupIterator::ACCESS_CHECK:
238 if (it->GetHolder<
JSObject>()->IsJSGlobalProxy() &&
244 case LookupIterator::DATA:
263 if (!receiver_map->IsJSObjectMap())
return false;
265 if (first_map ==
NULL)
return false;
267 if (old_map->is_deprecated())
return true;
269 receiver_map->elements_kind())) {
284 int index = ic_holder_map->IndexInCodeCache(*
name, *
target());
286 ic_holder_map->RemoveFromCodeCache(*
name, *
target(), index);
290 if (receiver->IsGlobalObject()) {
292 LookupIterator it(global,
name, LookupIterator::OWN_SKIP_INTERCEPTOR);
293 if (it.state() == LookupIterator::ACCESS_CHECK)
return false;
294 if (!it.IsFound())
return false;
296 return cell->type()->IsConstant();
304 if (
target()->is_keyed_stub()) {
306 if (!
name->IsName())
return false;
308 if (*
name != stub_name)
return false;
317 if (!
name->IsString())
return;
319 if (receiver->IsUndefined() || receiver->IsNull())
return;
356 int* polymorphic_delta,
357 int* generic_delta) {
363 *polymorphic_delta = 1;
371 *polymorphic_delta = -1;
381 *polymorphic_delta = 1;
394 bool target_remains_ic_stub) {
397 if (host->
kind() != Code::FUNCTION)
return;
399 if (FLAG_type_info_threshold > 0 && target_remains_ic_stub &&
402 int polymorphic_delta = 0;
403 int generic_delta = 0;
425 if (
target->kind() == Code::CALL_IC)
return;
430 bool target_remains_ic_stub =
false;
433 new_state =
target->ic_state();
434 target_remains_ic_stub =
true;
438 target_remains_ic_stub);
443 if (FLAG_collect_maps && FLAG_weak_embedded_maps_in_ic &&
444 stub->CanBeWeakStub()) {
445 DCHECK(!stub->is_weak_stub());
447 stub->FindAllMaps(&maps);
448 if (maps.length() == 1 && stub->IsWeakObjectInIC(*maps.
at(0))) {
450 stub->mark_as_weak_stub();
451 if (FLAG_enable_ool_constant_pool) {
452 stub->constant_pool()->set_weak_object_state(
465 Object* undefined = heap->undefined_value();
470 it.rinfo()->target_object()->IsMap()) {
483 if (
target->is_debug_stub())
return;
488 case Code::KEYED_LOAD_IC:
492 case Code::KEYED_STORE_IC:
496 case Code::COMPARE_IC:
498 case Code::COMPARE_NIL_IC:
500 case Code::BINARY_OP_IC:
501 case Code::TO_BOOLEAN_IC:
531 target->extra_ic_state());
540 target->extra_ic_state());
557 DCHECK(CodeStub::GetMajorKey(
target) == CodeStub::CompareIC);
569 if (FLAG_compiled_keyed_generic_loads) {
578 if (!object->IsJSObject())
return false;
580 if (!receiver->map()->is_deprecated())
return false;
589 if (object->IsUndefined() || object->IsNull()) {
596 if (
kind() == Code::KEYED_LOAD_IC &&
name->AsArrayIndex(&index)) {
613 LookupIterator it(
object,
name);
638 for (
int current = 0; current < receiver_maps->length(); ++current) {
639 if (!receiver_maps->
at(current).
is_null() &&
640 receiver_maps->
at(current).is_identical_to(new_receiver_map)) {
644 receiver_maps->
Add(new_receiver_map);
650 if (!code->is_handler())
return false;
657 int number_of_types = types.length();
658 int deprecated_types = 0;
659 int handler_to_overwrite = -1;
661 for (
int i = 0;
i < number_of_types;
i++) {
663 if (current_type->IsClass() &&
664 current_type->AsClass()->Map()->is_deprecated()) {
667 }
else if (type->NowIs(current_type)) {
671 handler_to_overwrite =
i;
672 }
else if (handler_to_overwrite == -1 && current_type->IsClass() &&
675 *type->AsClass()->Map())) {
676 handler_to_overwrite =
i;
680 int number_of_valid_types =
681 number_of_types - deprecated_types - (handler_to_overwrite != -1);
683 if (number_of_valid_types >= 4)
return false;
684 if (number_of_types == 0)
return false;
685 if (!
target()->FindHandlers(&handlers, types.length()))
return false;
687 number_of_valid_types++;
688 if (number_of_valid_types > 1 &&
target()->is_keyed_stub())
return false;
690 if (number_of_valid_types == 1) {
694 if (handler_to_overwrite >= 0) {
695 handlers.
Set(handler_to_overwrite, code);
696 if (!type->NowIs(types.
at(handler_to_overwrite))) {
697 types.
Set(handler_to_overwrite, type);
704 number_of_valid_types,
name,
713 return object->IsJSGlobalObject()
720 if (type->
Is(HeapType::Number()))
722 if (type->
Is(HeapType::Boolean()))
return isolate->
factory()->boolean_map();
734 typename T::Region* region) {
736 return T::Number(region);
739 return T::Boolean(region);
741 return T::Class(
map, region);
754 DCHECK(handler->is_handler());
765 if (!
target()->FindHandlers(&handlers, types.length()))
return;
766 for (
int i = 0;
i < types.length();
i++) {
773 if (source_map ==
NULL)
return true;
774 if (target_map ==
NULL)
return false;
778 Map* transitioned_map =
779 more_general_transition
783 return transitioned_map == target_map;
822 if (
kind() == Code::LOAD_IC) {
824 return stub.GetCode();
844 if (
kind() == Code::LOAD_IC) {
855 return stub.GetCode();
869 if (lookup->state() == LookupIterator::JSPROXY ||
870 lookup->state() == LookupIterator::ACCESS_CHECK) {
872 }
else if (!lookup->IsFound()) {
873 if (
kind() == Code::LOAD_IC) {
891 if (
kind() == Code::KEYED_LOAD_IC ||
kind() == Code::KEYED_STORE_IC)
return;
898 bool receiver_is_holder =
899 lookup->GetReceiver().is_identical_to(lookup->GetHolder<
JSObject>());
905 lookup->name(), stub_holder_map,
kind(),
flag,
920 Code* megamorphic_cached_code =
922 if (megamorphic_cached_code != *code)
return code;
930 DCHECK(code->is_handler());
951 if (receiver->IsString() &&
957 if (receiver->IsStringWrapper() &&
960 return string_length_stub.GetCode();
964 if (receiver->IsJSFunction() &&
969 ->has_non_instance_prototype()) {
972 return function_prototype_stub.GetCode();
977 bool receiver_is_holder = receiver.is_identical_to(holder);
978 switch (lookup->state()) {
979 case LookupIterator::INTERCEPTOR: {
980 DCHECK(!holder->GetNamedInterceptor()->getter()->IsUndefined());
985 LookupIterator it = *lookup;
993 if (receiver_is_holder) {
994 DCHECK(receiver->IsJSObject());
997 if (Accessors::IsJSObjectFieldAccessor<HeapType>(type, lookup->name(),
1000 FieldIndex::ForInObjectOffset(object_offset, js_receiver->map());
1006 if (accessors->IsExecutableAccessorInfo()) {
1009 if (v8::ToCData<Address>(info->getter()) == 0)
break;
1014 if (!holder->HasFastProperties())
break;
1019 if (accessors->IsAccessorPair()) {
1022 if (!getter->IsJSFunction())
break;
1023 if (!holder->HasFastProperties())
break;
1025 if (!receiver->IsJSObject() && !function->IsBuiltin() &&
1026 function->shared()->strict_mode() ==
SLOPPY) {
1031 CallOptimization call_optimization(
function);
1034 if (call_optimization.is_simple_api_call() &&
1035 call_optimization.IsCompatibleReceiver(receiver, holder)) {
1042 DCHECK(accessors->IsDeclaredAccessorInfo());
1046 case LookupIterator::DATA: {
1047 if (lookup->is_dictionary_holder()) {
1048 if (
kind() != Code::LOAD_IC)
break;
1049 if (holder->IsGlobalObject()) {
1054 cell, lookup->name(), lookup->IsConfigurable());
1066 if (!receiver_is_holder)
break;
1071 if (lookup->property_details().type() ==
FIELD) {
1072 FieldIndex field = lookup->GetFieldIndex();
1073 if (receiver_is_holder) {
1083 if (receiver_is_holder) {
1085 return stub.GetCode();
1090 lookup->GetConstantIndex());
1093 case LookupIterator::ACCESS_CHECK:
1094 case LookupIterator::JSPROXY:
1095 case LookupIterator::NOT_FOUND:
1096 case LookupIterator::TRANSITION:
1107 if (key->IsHeapNumber()) {
1109 if (std::isnan(value)) {
1110 key = isolate->
factory()->nan_string();
1112 int int_value =
FastD2I(value);
1117 }
else if (key->IsUndefined()) {
1118 key = isolate->
factory()->undefined_string();
1128 target_receiver_maps.
Add(
isolate()->factory()->string_map());
1132 if (target_receiver_maps.length() == 0) {
1144 target_receiver_maps.
at(0)->elements_kind(),
1145 receiver->GetElementsKind())) {
1188 if (key->IsInternalizedString() || key->IsSymbol()) {
1192 }
else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) {
1193 if (object->IsString() && key->IsNumber()) {
1195 }
else if (object->IsJSObject()) {
1205 if (*stub ==
generic) {
1212 if (!load_handle.
is_null())
return load_handle;
1225 if (!receiver->IsJSObject())
return false;
1228 for (; it->IsFound(); it->Next()) {
1229 switch (it->state()) {
1230 case LookupIterator::NOT_FOUND:
1231 case LookupIterator::TRANSITION:
1233 case LookupIterator::JSPROXY:
1235 case LookupIterator::INTERCEPTOR: {
1238 if (it->HolderIsReceiverOrHiddenPrototype()) {
1239 if (!info->setter()->IsUndefined())
return true;
1240 }
else if (!info->getter()->IsUndefined() ||
1241 !info->query()->IsUndefined()) {
1246 case LookupIterator::ACCESS_CHECK:
1247 if (it->GetHolder<
JSObject>()->IsAccessCheckNeeded())
return false;
1250 return !it->IsReadOnly();
1251 case LookupIterator::DATA: {
1252 if (it->IsReadOnly())
return false;
1254 if (receiver.is_identical_to(holder)) {
1255 it->PrepareForDataProperty(value);
1264 if (receiver->IsJSGlobalProxy()) {
1265 return it->GetHolder<
Object>().is_identical_to(
1269 it->PrepareTransitionToDataProperty(value,
NONE, store_mode);
1270 return it->IsCacheableTransition();
1275 it->PrepareTransitionToDataProperty(value,
NONE, store_mode);
1276 return it->IsCacheableTransition();
1295 if (object->IsUndefined() || object->IsNull()) {
1296 return TypeError(
"non_object_property_store",
object,
name);
1301 if (
name->AsArrayIndex(&index)) {
1304 if (!object->IsJSObject())
return value;
1316 if (object->IsHeapObject() &&
1326 LookupIterator it(
object,
name);
1339 CallICState::CallType call_type) {
1356 if (
kind() == Code::STORE_IC) {
1371 if (
kind() == Code::STORE_IC) {
1386 if (
kind() == Code::STORE_IC) {
1408 TRACE_IC(
"StoreIC", lookup->name());
1419 TRACE_IC(
"StoreIC", lookup->name());
1426 DCHECK_NE(LookupIterator::JSPROXY, lookup->state());
1431 DCHECK(!receiver->IsAccessCheckNeeded());
1433 switch (lookup->state()) {
1434 case LookupIterator::TRANSITION: {
1435 Handle<Map> transition = lookup->transition_map();
1437 if (!holder->HasFastProperties()) {
1442 DCHECK(lookup->IsCacheableTransition());
1447 case LookupIterator::INTERCEPTOR: {
1448 DCHECK(!holder->GetNamedInterceptor()->setter()->IsUndefined());
1454 if (!holder->HasFastProperties()) {
1459 if (accessors->IsExecutableAccessorInfo()) {
1462 if (v8::ToCData<Address>(info->setter()) == 0) {
1473 }
else if (accessors->IsAccessorPair()) {
1476 if (!setter->IsJSFunction()) {
1481 CallOptimization call_optimization(
function);
1483 if (call_optimization.is_simple_api_call() &&
1484 call_optimization.IsCompatibleReceiver(receiver, holder)) {
1492 DCHECK(accessors->IsDeclaredAccessorInfo());
1497 case LookupIterator::DATA: {
1498 if (lookup->is_dictionary_holder()) {
1499 if (holder->IsGlobalObject()) {
1503 receiver->IsJSGlobalProxy());
1510 DCHECK(holder.is_identical_to(receiver));
1515 if (lookup->property_details().type() ==
FIELD) {
1516 bool use_stub =
true;
1517 if (lookup->representation().IsHeapObject()) {
1521 use_stub = it.
Done();
1525 lookup->representation());
1526 return stub.GetCode();
1538 case LookupIterator::ACCESS_CHECK:
1539 case LookupIterator::JSPROXY:
1540 case LookupIterator::NOT_FOUND:
1560 if (target_receiver_maps.length() == 0) {
1574 Handle<Map> previous_receiver_map = target_receiver_maps.
at(0);
1576 Handle<Map> transitioned_receiver_map = receiver_map;
1578 transitioned_receiver_map =
1581 if ((receiver_map.is_identical_to(previous_receiver_map) &&
1584 *transitioned_receiver_map)) {
1590 transitioned_receiver_map,
strict_mode(), store_mode);
1591 }
else if (*previous_receiver_map == receiver->map() &&
1613 transitioned_receiver_map);
1635 store_mode = old_store_mode;
1636 }
else if (store_mode != old_store_mode) {
1646 int external_arrays = 0;
1647 for (
int i = 0;
i < target_receiver_maps.length(); ++
i) {
1648 if (target_receiver_maps[
i]->has_external_array_elements() ||
1649 target_receiver_maps[
i]->has_fixed_typed_array_elements()) {
1653 if (external_arrays != 0 &&
1654 external_arrays != target_receiver_maps.length()) {
1656 "unsupported combination of external and normal arrays");
1662 &target_receiver_maps, store_mode,
strict_mode());
1668 switch (store_mode) {
1686 DCHECK(
map->has_external_array_elements());
1699 if (receiver->IsJSArray()) {
1700 return JSArray::cast(*receiver)->length()->IsSmi() &&
1701 index >= Smi::cast(JSArray::cast(*receiver)->length())->value();
1703 return index >= receiver->elements()->length();
1711 int index = smi_key->value();
1715 bool allow_growth = receiver->IsJSArray() && oob_access &&
1716 !receiver->WouldConvertToSlowElements(key);
1719 if (receiver->HasFastSmiElements()) {
1720 if (value->IsHeapNumber()) {
1721 if (receiver->HasFastHoleyElements()) {
1727 if (value->IsHeapObject()) {
1728 if (receiver->HasFastHoleyElements()) {
1734 }
else if (receiver->HasFastDoubleElements()) {
1735 if (!value->IsSmi() && !value->IsHeapNumber()) {
1736 if (receiver->HasFastHoleyElements()) {
1746 if (receiver->HasFastSmiElements()) {
1747 if (value->IsHeapNumber()) {
1748 if (receiver->HasFastHoleyElements()) {
1753 }
else if (value->IsHeapObject()) {
1754 if (receiver->HasFastHoleyElements()) {
1760 }
else if (receiver->HasFastDoubleElements()) {
1761 if (!value->IsSmi() && !value->IsHeapNumber()) {
1762 if (receiver->HasFastHoleyElements()) {
1769 if (!FLAG_trace_external_array_abuse &&
1770 receiver->map()->has_external_array_elements() && oob_access) {
1773 Heap* heap = receiver->GetHeap();
1774 if (receiver->elements()->map() == heap->fixed_cow_array_map()) {
1804 if (key->IsInternalizedString()) {
1813 "unhandled internalized string key");
1816 return store_handle;
1820 FLAG_use_ic && !
object->IsStringWrapper() &&
1821 !
object->IsAccessCheckNeeded() && !
object->IsJSGlobalProxy() &&
1822 !(
object->IsJSObject() && JSObject::cast(*object)->map()->is_observed());
1823 if (use_ic && !object->IsSmi()) {
1828 if (heap_object->map()->IsMapInArrayPrototypeChain()) {
1835 DCHECK(!object->IsAccessCheckNeeded());
1837 if (object->IsJSObject()) {
1840 if (receiver->elements()->map() ==
1841 isolate()->heap()->sloppy_arguments_elements_map()) {
1847 }
else if (key_is_smi_like &&
1853 if (!(receiver->map()->DictionaryElementsInPrototypeChainOnly())) {
1877 if (*stub ==
generic) {
1887 return store_handle;
1894 DCHECK(FLAG_use_ic && function->IsJSFunction());
1902 Object* feedback = vector->get(slot->value());
1903 if (!feedback->IsAllocationSite()) {
1906 vector->set(slot->value(), *new_site);
1912 if (array_function->shared()->name()->IsString()) {
1933 vector->set(slot->value(),
1942 if (function->IsJSFunction()) {
1958 Object* feedback = vector->get(slot->value());
1961 DCHECK(!feedback->IsSmi());
1963 if (feedback->IsJSFunction() || !function->IsJSFunction()) {
1965 vector->set(slot->value(),
1976 feedback->IsAllocationSite());
1984 vector->set(slot->value(), *
function);
1987 if (function->IsJSFunction()) {
2009 DCHECK(args.length() == 4);
2015 ic.
HandleMiss(receiver,
function, vector, slot);
2023 DCHECK(args.length() == 4);
2038 DCHECK(args.length() == 2);
2053 DCHECK(args.length() == 2);
2067 DCHECK(args.length() == 2);
2082 DCHECK(args.length() == 3);
2089 isolate, result, ic.
Store(receiver, key, args.at<
Object>(2)));
2097 DCHECK(args.length() == 3);
2104 isolate, result, ic.
Store(receiver, key, args.at<
Object>(2)));
2115 DCHECK(args.length() == 3);
2123 DCHECK(object->HasFastProperties());
2124 DCHECK(object->map()->unused_property_fields() == 0);
2137 DCHECK(args.length() == 3);
2144 isolate, result, ic.
Store(receiver, key, args.at<
Object>(2)));
2152 DCHECK(args.length() == 3);
2159 isolate, result, ic.
Store(receiver, key, args.at<
Object>(2)));
2166 DCHECK(args.length() == 3);
2182 DCHECK(args.length() == 3);
2199 DCHECK(args.length() == 4);
2206 if (object->IsJSObject()) {
2208 map->elements_kind());
2229 isolate(), result, Execution::Call(
isolate(),
function, left, 1, &right),
2237 state.Update(left, right, result);
2241 if (!allocation_site.
is_null() ||
state.ShouldCreateAllocationMementos()) {
2243 if (allocation_site.
is_null()) {
2248 BinaryOpICWithAllocationSiteStub stub(
isolate(),
state);
2249 target = stub.GetCodeCopyFromTemplate(allocation_site);
2263 if (FLAG_trace_ic) {
2265 os <<
"[BinaryOpIC" << old_state <<
" => " <<
state <<
" @ "
2266 <<
static_cast<void*
>(*target) <<
" <- ";
2268 if (!allocation_site.
is_null()) {
2269 os <<
" using allocation site " <<
static_cast<void*
>(*allocation_site);
2275 if (!old_state.UseInlinedSmiCode() &&
state.UseInlinedSmiCode()) {
2277 }
else if (old_state.UseInlinedSmiCode() && !
state.UseInlinedSmiCode()) {
2305 args.at<
AllocationSite>(BinaryOpWithAllocationSiteStub::kAllocationSite);
2308 args.at<
Object>(BinaryOpWithAllocationSiteStub::kRight);
2312 isolate, result, ic.Transition(allocation_site, left, right));
2322 CHECK(stub.FindCodeInCache(&code));
2331 return stub.GetCode();
2353 if (FLAG_trace_ic) {
2354 PrintF(
"[CompareIC in ");
2356 PrintF(
" ((%s+%s=%s)->(%s+%s=%s))#%s @ %p]\n",
2363 static_cast<void*
>(*stub.GetCode()));
2379 DCHECK(args.length() == 3);
2395 CHECK(stub.FindCodeInCache(&code));
2403 if (object->IsNull() || object->IsUndefined()) {
2428 : HeapObject::cast(*object)->
map());
2431 code = stub.GetCode();
2443 return *ic.CompareNil(
object);
2450 return isolate->heap()->undefined_value();
2471 return Builtins::MOD;
2474 return Builtins::BIT_OR;
2476 case Token::BIT_AND:
2477 return Builtins::BIT_AND;
2479 case Token::BIT_XOR:
2480 return Builtins::BIT_XOR;
2483 return Builtins::SAR;
2486 return Builtins::SHR;
2489 return Builtins::SHL;
2506 DCHECK(args.length() == 1);
2510 return *ic.ToBoolean(
object);
2522 DCHECK(callback->IsCompatibleReceiver(*receiver));
2524 Address setter_address = v8::ToCData<Address>(callback->setter());
2526 FUNCTION_CAST<v8::AccessorNameSetterCallback>(setter_address);
2529 LOG(isolate, ApiNamedPropertyAccess(
"store", *receiver, *
name));
2553 if (name_handle->IsSymbol())
2554 return isolate->heap()->no_interceptor_result_sentinel();
2557 Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
2559 FUNCTION_CAST<v8::NamedPropertyGetterCallback>(getter_address);
2567 *receiver, *holder);
2576 result->VerifyApiCallResultType();
2581 return isolate->heap()->no_interceptor_result_sentinel();
2591 return isolate->
heap()->undefined_value();
2597 isolate, NewReferenceError(
"not_defined",
HandleVector(&name_handle, 1)));
2616 LookupIterator it(receiver,
name, holder);
2620 if (it.IsFound())
return *result;
2628 DCHECK(args.length() == 3);
2639 if (current->IsJSObject() &&
2658 DCHECK(args.smi_at(1) >= 0);
2681 #define ADDR(name) FUNCTION_ADDR(name),
bool IsEmpty() const
Returns true if the handle is empty.
A single JavaScript stack frame.
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
static bool IsCompatibleReceiverType(Isolate *isolate, Handle< AccessorInfo > info, Handle< HeapType > type)
MaybeHandle< Object > Transition(Handle< AllocationSite > allocation_site, Handle< Object > left, Handle< Object > right) WARN_UNUSED_RESULT
static Builtins::JavaScript TokenToJSBuiltin(Token::Value op)
void PatchMegamorphic(Handle< Object > function, Handle< TypeFeedbackVector > vector, Handle< Smi > slot)
bool DoCustomHandler(Handle< Object > receiver, Handle< Object > function, Handle< TypeFeedbackVector > vector, Handle< Smi > slot, const CallICState &state)
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
static Handle< Code > initialize_stub(Isolate *isolate, int argc, CallICState::CallType call_type)
IC::State FeedbackToState(Handle< TypeFeedbackVector > vector, Handle< Smi > slot) const
void HandleMiss(Handle< Object > receiver, Handle< Object > function, Handle< TypeFeedbackVector > vector, Handle< Smi > slot)
void set_profiler_ticks(int ticks)
ExtraICState extra_ic_state()
bool is_inline_cache_stub()
int instruction_size() const
byte * instruction_start()
void mark_as_invalidated_weak_stub()
InlineCacheState ic_state()
static CacheHolderFlag ExtractCacheHolderFromFlags(Flags flags)
Object * type_feedback_info()
static const char * GetStateName(CompareICState::State state)
static State NewInputState(State old_state, Handle< Object > value)
static State TargetState(State old_state, State old_left, State old_right, Token::Value op, bool has_inlined_smi_code, Handle< Object > x, Handle< Object > y)
void set_known_map(Handle< Map > map)
CompareICState::State state() const
CompareICState::State left() const
CompareICState::State right() const
static bool HasInlinedSmiCode(Address address)
Code * UpdateCaches(Handle< Object > x, Handle< Object > y)
static Handle< Code > GetUninitialized(Isolate *isolate, Token::Value op)
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
static Code * GetRawUninitialized(Isolate *isolate, Token::Value op)
bool IsMonomorphic() const
void UpdateStatus(Handle< Object > object)
NilValue nil_value() const
static Handle< Object > DoCompareNilSlow(Isolate *isolate, NilValue nil, Handle< Object > object)
Handle< Object > CompareNil(Handle< Object > object)
static void Clear(Address address, Code *target, ConstantPoolArray *constant_pool)
static void FlushICache(void *start, size_t size)
static bool HasDebugInfo(Handle< SharedFunctionInfo > shared)
static Handle< DebugInfo > GetDebugInfo(Handle< SharedFunctionInfo > shared)
static const int kCallerPCOffset
static const int kConstantPoolOffset
static const int kCallerFPOffset
static Handle< T > cast(Handle< S > that)
static void UpdateMapCodeCache(Handle< HeapObject > object, Handle< Name > name, Handle< Code > code)
Isolate * GetIsolate() const
static void PostPatching(Address address, Code *target, Code *old_target)
MaybeHandle< Object > TypeError(const char *type, Handle< Object > object, Handle< Object > key)
MaybeHandle< Code > maybe_handler_
void update_receiver_type(Handle< Object > receiver)
Code * GetOriginalCode() const
static Address AddressFromUtilityId(UtilityId id)
static void SetTargetAtAddress(Address address, Code *target, ConstantPoolArray *constant_pool)
static Handle< Map > TypeToMap(HeapType *type, Isolate *isolate)
Handle< HeapType > receiver_type()
bool IsNameCompatibleWithPrototypeFailure(Handle< Object > name)
static Code * GetTargetAtAddress(Address address, ConstantPoolArray *constant_pool)
void UpdateState(Handle< Object > receiver, Handle< Object > name)
ConstantPoolArray * constant_pool() const
MaybeHandle< Object > ReferenceError(const char *type, Handle< Name > name)
Handle< ConstantPoolArray > raw_constant_pool_
void TargetTypes(TypeHandleList *list)
void MarkPrototypeFailure(Handle< Object > name)
static T::TypeHandle MapToType(Handle< Map > map, typename T::Region *region)
Isolate * isolate() const
ExtraICState extra_ic_state_
SharedFunctionInfo * GetSharedFunctionInfo() const
bool IsTransitionOfMonomorphicTarget(Map *source_map, Map *target_map)
IC(FrameDepth depth, Isolate *isolate)
void TargetMaps(MapHandleList *list)
static void Clear(Isolate *isolate, Address address, ConstantPoolArray *constant_pool)
virtual Handle< Code > CompileHandler(LookupIterator *lookup, Handle< Object > value, CacheHolderFlag cache_holder)
void UpdateMonomorphicIC(Handle< Code > handler, Handle< Name > name)
Code * raw_target() const
void PatchCache(Handle< Name > name, Handle< Code > code)
void CopyICToMegamorphicCache(Handle< Name > name)
ExtraICState extra_ic_state() const
char TransitionMarkFromState(IC::State state)
Handle< Code > target() const
void set_target(Code *code)
static void OnTypeFeedbackChanged(Isolate *isolate, Address address, State old_state, State new_state, bool target_remains_ic_stub)
bool UpdatePolymorphicIC(Handle< Name > name, Handle< Code > code)
static Handle< HeapType > CurrentTypeOf(Handle< Object > object, Isolate *isolate)
static bool IsCleared(Code *code)
static Handle< Map > GetHandlerCacheHolder(HeapType *type, bool receiver_is_holder, Isolate *isolate, CacheHolderFlag *flag)
void UpdateMegamorphicCache(HeapType *type, Name *name, Code *code)
bool TryRemoveInvalidPrototypeDependentStub(Handle< Object > receiver, Handle< String > name)
static Handle< Map > GetICCacheHolder(HeapType *type, Isolate *isolate, CacheHolderFlag *flag)
static void RegisterWeakMapDependency(Handle< Code > stub)
virtual Handle< Code > megamorphic_stub()
void TraceIC(const char *type, Handle< Object > name)
static void InvalidateMaps(Code *stub)
Handle< Code > ComputeHandler(LookupIterator *lookup, Handle< Object > value=Handle< Code >::null())
InnerPointerToCodeCacheEntry * GetCacheEntry(Address inner_pointer)
static Address c_entry_fp(ThreadLocalTop *thread)
RuntimeProfiler * runtime_profiler()
Handle< JSBuiltinsObject > js_builtins_object()
InnerPointerToCodeCache * inner_pointer_to_code_cache()
ThreadLocalTop * thread_local_top()
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithInterceptor(Handle< JSObject > object, Handle< Object > receiver, uint32_t index)
static void MigrateToNewProperty(Handle< JSObject > object, Handle< Map > transition, Handle< Object > value)
static void TransitionElementsKind(Handle< JSObject > object, ElementsKind to_kind)
static MUST_USE_RESULT MaybeHandle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype=true, SetPropertyMode set_mode=SET_PROPERTY)
static void MigrateInstance(Handle< JSObject > instance)
static const int kFunctionOffset
static void PrintTop(Isolate *isolate, FILE *file, bool print_args, bool print_line_number)
static JavaScriptFrame * cast(StackFrame *frame)
JSFunction * function() const
static void PrintFunctionAndOffset(JSFunction *function, Code *code, Address pc, FILE *file, bool print_line_number)
MUST_USE_RESULT MaybeHandle< Object > Load(Handle< Object > object, Handle< Object > key)
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
Handle< Code > LoadElementStub(Handle< JSObject > receiver)
Handle< Code > string_stub()
Handle< Code > generic_stub() const
virtual Handle< Code > pre_monomorphic_stub() const
MUST_USE_RESULT MaybeHandle< Object > Store(Handle< Object > object, Handle< Object > name, Handle< Object > value)
static KeyedAccessStoreMode GetKeyedAccessStoreMode(ExtraICState extra_state)
void set_target(Code *code)
Handle< Code > sloppy_arguments_stub()
KeyedAccessStoreMode GetStoreMode(Handle< JSObject > receiver, Handle< Object > key, Handle< Object > value)
Handle< Map > ComputeTransitionedMap(Handle< Map > map, KeyedAccessStoreMode store_mode)
virtual Handle< Code > pre_monomorphic_stub() const
Handle< Code > StoreElementStub(Handle< JSObject > receiver, KeyedAccessStoreMode store_mode)
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
void Add(const T &element, AllocationPolicy allocator=AllocationPolicy())
void Set(int index, const T &element)
void UpdateCaches(LookupIterator *lookup)
void set_target(Code *code)
static Handle< Code > initialize_stub(Isolate *isolate, ExtraICState extra_state)
MUST_USE_RESULT MaybeHandle< Object > Load(Handle< Object > object, Handle< Name > name)
Handle< Code > SimpleFieldLoad(FieldIndex index)
Handle< Code > slow_stub() const
virtual Handle< Code > megamorphic_stub() OVERRIDE
ContextualMode contextual_mode() const
virtual Handle< Code > CompileHandler(LookupIterator *lookup, Handle< Object > unused, CacheHolderFlag cache_holder)
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
virtual Handle< Code > pre_monomorphic_stub() const
bool IsUndeclaredGlobal(Handle< Object > receiver)
ElementsKind elements_kind()
static void UpdateCodeCache(Handle< Map > map, Handle< Name > name, Handle< Code > code)
Map * LookupElementsTransitionMap(ElementsKind elements_kind)
static Handle< Map > TransitionElementsTo(Handle< Map > map, ElementsKind to_kind)
static void AddDependentIC(Handle< Map > map, Handle< Code > stub)
static Object *& Object_at(Address addr)
static Address & Address_at(Address addr)
static const int kInterceptorArgsNameIndex
static const int kInterceptorArgsInfoIndex
static Handle< Code > ComputeLoadNonexistent(Handle< Name > name, Handle< HeapType > type)
Handle< Code > CompileLoadCallback(Handle< Name > name, Handle< ExecutableAccessorInfo > callback)
Handle< Code > CompileLoadGlobal(Handle< PropertyCell > cell, Handle< Name > name, bool is_configurable)
static const int kInterceptorArgsThisIndex
Handle< Code > CompileLoadField(Handle< Name > name, FieldIndex index)
Handle< Code > CompileLoadInterceptor(LookupIterator *it)
static const int kInterceptorArgsHolderIndex
Handle< Code > CompileLoadViaGetter(Handle< Name > name, Handle< JSFunction > getter)
Handle< Code > CompileLoadConstant(Handle< Name > name, int constant_index)
static const int kInterceptorArgsLength
Handle< Code > CompileStoreInterceptor(Handle< Name > name)
Handle< Code > CompileStoreViaSetter(Handle< JSObject > object, Handle< Name > name, Handle< JSFunction > setter)
Handle< Code > CompileStoreCallback(Handle< JSObject > object, Handle< Name > name, Handle< ExecutableAccessorInfo > callback)
Handle< Code > CompileStoreField(LookupIterator *it)
Handle< Code > CompileStoreTransition(Handle< Map > transition, Handle< Name > name)
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
@ MAY_BE_STORE_FROM_KEYED
static MUST_USE_RESULT MaybeHandle< Smi > ToSmi(Isolate *isolate, Handle< Object > object)
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
static Handle< HeapType > UpdatedType(Handle< PropertyCell > cell, Handle< Object > value)
static Handle< Code > Find(Handle< Name > name, Handle< Map > map, Code::Kind kind, CacheHolderFlag cache_holder, Code::StubType type)
static Handle< Code > ComputeKeyedLoadMonomorphic(Handle< Map > receiver_map)
static Handle< Code > ComputeMonomorphic(Code::Kind kind, Handle< Name > name, Handle< HeapType > type, Handle< Code > handler, ExtraICState extra_ic_state)
static Handle< Code > ComputePolymorphic(Code::Kind kind, TypeHandleList *types, CodeHandleList *handlers, int number_of_valid_maps, Handle< Name > name, ExtraICState extra_ic_state)
static Handle< Code > ComputeLoad(Isolate *isolate, InlineCacheState ic_state, ExtraICState extra_state)
static Handle< Code > ComputeKeyedStorePolymorphic(MapHandleList *receiver_maps, KeyedAccessStoreMode store_mode, StrictMode strict_mode)
static Handle< Code > ComputeCompareNil(Handle< Map > receiver_map, CompareNilICStub *stub)
static Handle< Code > ComputeStore(Isolate *isolate, InlineCacheState ic_state, ExtraICState extra_state)
static Code * FindPreMonomorphic(Isolate *isolate, Code::Kind kind, ExtraICState extra_ic_state)
static Handle< Code > ComputeKeyedLoadPolymorphic(MapHandleList *receiver_maps)
static Handle< Code > ComputeKeyedStoreMonomorphic(Handle< Map > receiver_map, StrictMode strict_mode, KeyedAccessStoreMode store_mode)
A class to uniformly access the prototype of any Object and walk its prototype chain.
Object * GetCurrent() const
static int ModeMask(Mode mode)
static MUST_USE_RESULT MaybeHandle< Object > SetObjectProperty(Isolate *isolate, Handle< Object > object, Handle< Object > key, Handle< Object > value, StrictMode strict_mode)
static MUST_USE_RESULT MaybeHandle< Object > GetObjectProperty(Isolate *isolate, Handle< Object > object, Handle< Object > key)
static MUST_USE_RESULT MaybeHandle< Object > GetElementOrCharAt(Isolate *isolate, Handle< Object > object, uint32_t index)
static Smi * FromInt(int value)
static bool IsValid(intptr_t value)
StackFrame * frame() const
static const int kConstantPoolOffset
static const int kCallerPCOffset
static const int kCallerFPOffset
Handle< Code > GetCodeCopyFromTemplate(Handle< GlobalObject > global, Handle< PropertyCell > cell)
void UpdateCaches(LookupIterator *lookup, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode)
Handle< Code > generic_stub() const
void set_target(Code *code)
static StrictMode GetStrictMode(ExtraICState state)
virtual Handle< Code > pre_monomorphic_stub() const
StrictMode strict_mode() const
static Handle< Code > initialize_stub(Isolate *isolate, StrictMode strict_mode)
virtual Handle< Code > megamorphic_stub() OVERRIDE
static ExtraICState ComputeExtraICState(StrictMode flag)
Handle< Code > slow_stub() const
bool LookupForWrite(LookupIterator *it, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode)
MUST_USE_RESULT MaybeHandle< Object > Store(Handle< Object > object, Handle< Name > name, Handle< Object > value, JSReceiver::StoreFromKeyed store_mode=JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED)
static void Clear(Isolate *isolate, Address address, Code *target, ConstantPoolArray *constant_pool)
virtual Handle< Code > CompileHandler(LookupIterator *lookup, Handle< Object > value, CacheHolderFlag cache_holder)
static const int kLengthOffset
Code * Get(Name *name, Map *map, Code::Flags flags)
Code * Set(Name *name, Map *map, Code *code)
Handle< Object > ToBoolean(Handle< Object > object)
bool UpdateStatus(Handle< Object > object)
static const char * Name(Value tok)
void change_own_type_change_checksum()
void change_ic_generic_count(int delta)
void change_ic_with_type_info_count(int delta)
static Handle< Object > UninitializedSentinel(Isolate *isolate)
static Handle< Object > MegamorphicSentinel(Isolate *isolate)
i::Handle< i::Map > Map()
i::Handle< i::Object > Value()
static TypeHandle NowOf(i::Object *value, Region *region)
ConstantType * AsConstant()
static TypeHandle Constant(i::Handle< i::Object > value, Region *region)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define TRACE_GENERIC_IC(isolate, type, reason)
#define TRACE_IC(type, name)
#define TRACE_VECTOR_IC(type, name, old_state, new_state)
#define IC_UTIL_LIST(ICU)
#define RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate)
#define ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call)
#define THROW_NEW_ERROR_RETURN_FAILURE(isolate, call)
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T)
#define THROW_NEW_ERROR(isolate, call, T)
#define LOG(isolate, Call)
#define DCHECK_NE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
static void LookupForRead(LookupIterator *it)
bool IsMoreGeneralElementsKindTransition(ElementsKind from_kind, ElementsKind to_kind)
@ DISABLE_INLINED_SMI_CHECK
@ ENABLE_INLINED_SMI_CHECK
bool IsOutOfBoundsAccess(Handle< JSObject > receiver, int index)
static KeyedAccessStoreMode GetNonTransitioningStoreMode(KeyedAccessStoreMode store_mode)
@ STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT
@ STORE_TRANSITION_HOLEY_SMI_TO_OBJECT
@ STORE_TRANSITION_DOUBLE_TO_OBJECT
@ STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE
@ STORE_AND_GROW_NO_TRANSITION
@ STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE
@ STORE_AND_GROW_TRANSITION_DOUBLE_TO_OBJECT
@ STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS
@ STORE_NO_TRANSITION_HANDLE_COW
@ STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE
@ STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT
@ STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT
@ STORE_TRANSITION_SMI_TO_DOUBLE
@ STORE_TRANSITION_SMI_TO_OBJECT
@ STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT
static bool IsTransitionStoreMode(KeyedAccessStoreMode store_mode)
OStream & endl(OStream &os)
@ FAST_HOLEY_DOUBLE_ELEMENTS
@ kCacheOnPrototypeReceiverIsDictionary
Handle< T > handle(T *t, Isolate *isolate)
static bool AddOneReceiverMapIfMissing(MapHandleList *receiver_maps, Handle< Map > new_receiver_map)
void PatchInlinedSmiCode(Address address, InlinedSmiCheck check)
static bool IsGrowStoreMode(KeyedAccessStoreMode store_mode)
static Object * ThrowReferenceError(Isolate *isolate, Name *name)
static const Address IC_utilities[]
static bool MigrateDeprecated(Handle< Object > object)
void PrintF(const char *format,...)
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
kFeedbackVectorOffset flag
const int kMaxKeyedPolymorphism
static void ComputeTypeInfoCountDelta(IC::State old_state, IC::State new_state, int *polymorphic_delta, int *generic_delta)
const char * GetTransitionMarkModifier(KeyedAccessStoreMode mode)
static Handle< Object > TryConvertKey(Handle< Object > key, Isolate *isolate)
Debugger support for the V8 JavaScript engine.
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
void(* NamedPropertyGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
NamedProperty[Getter|Setter] are used as interceptors on object.