Chromium Code Reviews| Index: src/ic/ic.cc |
| diff --git a/src/ic/ic.cc b/src/ic/ic.cc |
| index e8be95ba34a5e9d17a89d2ab76b692b2ebc16f91..93843204949ad2117fb31ff69036c71399170a02 100644 |
| --- a/src/ic/ic.cc |
| +++ b/src/ic/ic.cc |
| @@ -571,11 +571,14 @@ void CompareIC::Clear(Isolate* isolate, Address address, Code* target, |
| // static |
| -Handle<Code> KeyedLoadIC::ChooseMegamorphicStub(Isolate* isolate) { |
| +Handle<Code> KeyedLoadIC::ChooseMegamorphicStub(Isolate* isolate, |
| + ExtraICState extra_state) { |
| if (FLAG_compiled_keyed_generic_loads) { |
| - return KeyedLoadGenericStub(isolate).GetCode(); |
| + return KeyedLoadGenericStub(isolate, LoadICState(extra_state)).GetCode(); |
| } else { |
| - return isolate->builtins()->KeyedLoadIC_Megamorphic(); |
| + return is_strong(LoadICState::GetStrength(extra_state)) |
| + ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong() |
| + : isolate->builtins()->KeyedLoadIC_Megamorphic(); |
| } |
| } |
| @@ -679,7 +682,8 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) { |
| Handle<Object> result; |
| ASSIGN_RETURN_ON_EXCEPTION( |
| isolate(), result, |
| - Runtime::GetElementOrCharAt(isolate(), object, index), Object); |
| + Runtime::GetElementOrCharAt(isolate(), object, index, strength()), |
| + Object); |
| return result; |
| } |
| @@ -722,8 +726,9 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) { |
| // Get the property. |
| Handle<Object> result; |
| - ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, Object::GetProperty(&it), |
| - Object); |
| + |
| + ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, |
| + Object::GetProperty(&it, strength()), Object); |
| if (it.IsFound()) { |
| return result; |
| } else if (!IsUndeclaredGlobal(object)) { |
| @@ -915,21 +920,25 @@ Handle<Code> LoadIC::initialize_stub_in_optimized_code( |
| } |
| -Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate) { |
| - return KeyedLoadICTrampolineStub(isolate).GetCode(); |
| +Handle<Code> KeyedLoadIC::initialize_stub(Isolate* isolate, |
| + ExtraICState extra_state) { |
| + return KeyedLoadICTrampolineStub(isolate, LoadICState(extra_state)).GetCode(); |
| } |
| Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( |
| - Isolate* isolate, State initialization_state) { |
| + Isolate* isolate, State initialization_state, ExtraICState extra_state) { |
| if (initialization_state != MEGAMORPHIC) { |
| - return KeyedLoadICStub(isolate).GetCode(); |
| + return KeyedLoadICStub(isolate, LoadICState(extra_state)).GetCode(); |
| } |
| + bool strong = is_strong(LoadICState::GetStrength(extra_state)); |
| switch (initialization_state) { |
| case UNINITIALIZED: |
| - return isolate->builtins()->KeyedLoadIC_Initialize(); |
| + return strong ? isolate->builtins()->KeyedLoadIC_Initialize_Strong() |
|
mvstanton
2015/06/09 12:46:44
I think this shows some unfinished clean-up work n
conradw
2015/06/09 13:09:27
Done.
|
| + : isolate->builtins()->KeyedLoadIC_Initialize(); |
| case MEGAMORPHIC: |
| - return isolate->builtins()->KeyedLoadIC_Megamorphic(); |
| + return strong ? isolate->builtins()->KeyedLoadIC_Megamorphic_Strong() |
| + : isolate->builtins()->KeyedLoadIC_Megamorphic(); |
| default: |
| UNREACHABLE(); |
| } |
| @@ -962,7 +971,7 @@ Handle<Code> KeyedStoreIC::initialize_stub(Isolate* isolate, |
| Handle<Code> LoadIC::megamorphic_stub() { |
| DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); |
| - return KeyedLoadIC::ChooseMegamorphicStub(isolate()); |
| + return KeyedLoadIC::ChooseMegamorphicStub(isolate(), extra_ic_state()); |
| } |
| @@ -986,7 +995,7 @@ void LoadIC::UpdateCaches(LookupIterator* lookup) { |
| lookup->state() == LookupIterator::ACCESS_CHECK) { |
| code = slow_stub(); |
| } else if (!lookup->IsFound()) { |
| - if (kind() == Code::LOAD_IC) { |
| + if (kind() == Code::LOAD_IC && !is_strong(strength())) { |
| code = NamedLoadHandlerCompiler::ComputeLoadNonexistent(lookup->name(), |
| receiver_map()); |
| // TODO(jkummerow/verwaest): Introduce a builtin that handles this case. |
| @@ -1245,7 +1254,8 @@ Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
| if (target_receiver_maps.length() == 0) { |
| Handle<Code> handler = |
| - PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); |
| + PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
| + receiver_map, extra_ic_state()); |
| ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
| return null_handle; |
| } |
| @@ -1262,7 +1272,8 @@ Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
| target_receiver_maps.at(0)->elements_kind(), |
| Handle<JSObject>::cast(receiver)->GetElementsKind())) { |
| Handle<Code> handler = |
| - PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(receiver_map); |
| + PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
| + receiver_map, extra_ic_state()); |
| ConfigureVectorState(Handle<Name>::null(), receiver_map, handler); |
| return null_handle; |
| } |
| @@ -1287,7 +1298,7 @@ Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { |
| CodeHandleList handlers(target_receiver_maps.length()); |
| ElementHandlerCompiler compiler(isolate()); |
| - compiler.CompileElementHandlers(&target_receiver_maps, &handlers); |
| + compiler.CompileElementHandlers(&target_receiver_maps, &handlers, strength()); |
| ConfigureVectorState(Handle<Name>::null(), &target_receiver_maps, &handlers); |
| return null_handle; |
| } |
| @@ -1298,8 +1309,8 @@ MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, |
| if (MigrateDeprecated(object)) { |
| Handle<Object> result; |
| ASSIGN_RETURN_ON_EXCEPTION( |
| - isolate(), result, Runtime::GetObjectProperty(isolate(), object, key), |
| - Object); |
| + isolate(), result, |
| + Runtime::GetObjectProperty(isolate(), object, key, strength()), Object); |
| return result; |
| } |
| @@ -1346,10 +1357,11 @@ MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object, |
| } |
| if (!load_handle.is_null()) return load_handle; |
| + |
| Handle<Object> result; |
| - ASSIGN_RETURN_ON_EXCEPTION(isolate(), result, |
| - Runtime::GetObjectProperty(isolate(), object, key), |
| - Object); |
| + ASSIGN_RETURN_ON_EXCEPTION( |
| + isolate(), result, |
| + Runtime::GetObjectProperty(isolate(), object, key, strength()), Object); |
| return result; |
| } |
| @@ -2812,6 +2824,7 @@ RUNTIME_FUNCTION(LoadPropertyWithInterceptor) { |
| Handle<Object> result; |
| LookupIterator it(receiver, name, holder); |
| + // TODO(conradw): Investigate strong mode semantics for this. |
| ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| JSObject::GetProperty(&it)); |
| @@ -2857,8 +2870,10 @@ RUNTIME_FUNCTION(LoadElementWithInterceptor) { |
| DCHECK(args.smi_at(1) >= 0); |
| uint32_t index = args.smi_at(1); |
| Handle<Object> result; |
| + // TODO(conradw): Investigate strong mode semantics for this. |
| + Strength strength = Strength::WEAK; |
| ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| - isolate, result, Object::GetElement(isolate, receiver, index)); |
| + isolate, result, Object::GetElement(isolate, receiver, index, strength)); |
| return *result; |
| } |
| @@ -2894,6 +2909,36 @@ RUNTIME_FUNCTION(LoadIC_MissFromStubFailure) { |
| } |
| +RUNTIME_FUNCTION(LoadIC_Slow) { |
| + HandleScope scope(isolate); |
| + DCHECK(args.length() == 2); |
| + |
| + Handle<Object> receiver = args.at<Object>(0); |
| + Handle<Name> name = args.at<Name>(1); |
| + LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); |
| + Handle<Object> result; |
| + ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| + isolate, result, |
| + Runtime::GetObjectProperty(isolate, receiver, name, ic.strength())); |
| + return *result; |
| +} |
| + |
| + |
| +RUNTIME_FUNCTION(KeyedLoadIC_Slow) { |
| + HandleScope scope(isolate); |
| + DCHECK(args.length() == 2); |
| + |
| + Handle<Object> receiver = args.at<Object>(0); |
| + Handle<Object> key = args.at<Object>(1); |
| + LoadIC ic(IC::NO_EXTRA_FRAME, isolate, true); |
| + Handle<Object> result; |
| + ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| + isolate, result, |
| + Runtime::KeyedGetObjectProperty(isolate, receiver, key, ic.strength())); |
| + return *result; |
| +} |
| + |
| + |
| static const Address IC_utilities[] = { |
| #define ADDR(name) FUNCTION_ADDR(name), |
| IC_UTIL_LIST(ADDR) NULL |
| @@ -2902,5 +2947,5 @@ static const Address IC_utilities[] = { |
| Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| -} // namespace internal |
| -} // namespace v8 |
| +} |
| +} // namespace v8::internal |