Index: src/stub-cache.cc |
=================================================================== |
--- src/stub-cache.cc (revision 4394) |
+++ src/stub-cache.cc (working copy) |
@@ -93,6 +93,28 @@ |
} |
+Object* StubCache::ComputeLoadNonExisting(String* name, JSObject* receiver) { |
+ // The code stub for loading non-existing properties can be reused |
+ // for all names, so we use the empty_string as the name in the map |
+ // code cache. |
+ Code::Flags flags = |
+ Code::ComputeMonomorphicFlags(Code::LOAD_IC, NON_EXISTING); |
+ Object* code = receiver->map()->FindInCodeCache(Heap::empty_string(), flags); |
+ if (code->IsUndefined()) { |
+ LoadStubCompiler compiler; |
+ code = compiler.CompileLoadNonExisting(receiver); |
+ if (code->IsFailure()) return code; |
+ PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, |
+ Code::cast(code), |
+ Heap::empty_string())); |
+ Object* result = receiver->map()->UpdateCodeCache(Heap::empty_string(), |
+ Code::cast(code)); |
+ if (result->IsFailure()) return result; |
+ } |
+ return Set(name, receiver->map(), Code::cast(code)); |
+} |
+ |
+ |
Object* StubCache::ComputeLoadField(String* name, |
JSObject* receiver, |
JSObject* holder, |