Chromium Code Reviews| Index: src/stub-cache.cc |
| diff --git a/src/stub-cache.cc b/src/stub-cache.cc |
| index edb60257daf38cab3722111dfa8467776ef9fd98..a58dc9887bd8878076c6fc3955fe376b9be044b6 100644 |
| --- a/src/stub-cache.cc |
| +++ b/src/stub-cache.cc |
| @@ -803,7 +803,9 @@ Register PropertyHandlerCompiler::Frontend(Register object_reg, |
| } |
| -void NamedLoadHandlerCompiler::NonexistentFrontend(Handle<Name> name) { |
| +void PropertyHandlerCompiler::NonexistentFrontend(Handle<Name> name, |
| + Register scratch1, |
| + Register scratch2) { |
| Label miss; |
| Register holder_reg; |
| @@ -819,26 +821,24 @@ void NamedLoadHandlerCompiler::NonexistentFrontend(Handle<Name> name) { |
| last_map = handle(holder()->map()); |
| } |
| - if (last_map->is_dictionary_map() && !last_map->IsJSGlobalObjectMap()) { |
| - if (!name->IsUniqueName()) { |
| - ASSERT(name->IsString()); |
| - name = factory()->InternalizeString(Handle<String>::cast(name)); |
| + if (last_map->is_dictionary_map()) { |
| + if (last_map->IsJSGlobalObjectMap()) { |
| + Handle<JSGlobalObject> global = |
| + holder().is_null() |
| + ? Handle<JSGlobalObject>::cast(type()->AsConstant()->Value()) |
| + : Handle<JSGlobalObject>::cast(holder()); |
| + GenerateCheckPropertyCell(masm(), global, name, scratch1, &miss); |
| + } else { |
| + if (!name->IsUniqueName()) { |
| + ASSERT(name->IsString()); |
| + name = factory()->InternalizeString(Handle<String>::cast(name)); |
| + } |
| + ASSERT(holder().is_null() || |
| + holder()->property_dictionary()->FindEntry(name) == |
| + NameDictionary::kNotFound); |
| + GenerateDictionaryNegativeLookup(masm(), &miss, holder_reg, name, |
| + scratch1, scratch2); |
| } |
| - ASSERT(holder().is_null() || |
| - holder()->property_dictionary()->FindEntry(name) == |
| - NameDictionary::kNotFound); |
| - GenerateDictionaryNegativeLookup(masm(), &miss, holder_reg, name, |
| - scratch2(), scratch3()); |
| - } |
| - |
| - // If the last object in the prototype chain is a global object, |
| - // check that the global property cell is empty. |
| - if (last_map->IsJSGlobalObjectMap()) { |
| - Handle<JSGlobalObject> global = |
| - holder().is_null() |
| - ? Handle<JSGlobalObject>::cast(type()->AsConstant()->Value()) |
| - : Handle<JSGlobalObject>::cast(holder()); |
| - GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss); |
| } |
| FrontendFooter(name, &miss); |
| @@ -861,6 +861,14 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadConstant( |
| } |
| +Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent( |
| + Handle<Name> name) { |
| + NonexistentFrontend(name, scratch2(), scratch3()); |
| + GenerateLoadConstant(isolate()->factory()->undefined_value()); |
| + return GetCode(kind(), Code::FAST, name); |
| +} |
| + |
| + |
| Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( |
| Handle<Name> name, Handle<ExecutableAccessorInfo> callback) { |
| Register reg = CallbackFrontend(receiver(), name, callback); |
| @@ -970,15 +978,10 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition( |
| iter.Advance(); |
| } |
| if (!last.is_null()) set_holder(last); |
| - } |
| - |
| - Register holder_reg = FrontendHeader(receiver(), name, &miss); |
| - |
| - // If no property was found, and the holder (the last object in the |
| - // prototype chain) is in slow mode, we need to do a negative lookup on the |
| - // holder. |
| - if (is_nonexistent) { |
| - GenerateNegativeHolderLookup(holder_reg, name, &miss); |
| + NonexistentFrontend(name, scratch1(), scratch2()); |
|
Igor Sheludko
2014/08/04 10:27:58
Now this thing will generate a frontend footer wit
|
| + } else { |
| + Frontend(receiver(), name); |
|
Igor Sheludko
2014/08/04 10:27:58
... (same here) ...
|
| + ASSERT(holder()->HasFastProperties()); |
| } |
| GenerateStoreTransition(transition, name, receiver(), this->name(), value(), |