| Index: src/stub-cache.cc
|
| ===================================================================
|
| --- src/stub-cache.cc (revision 2285)
|
| +++ src/stub-cache.cc (working copy)
|
| @@ -172,6 +172,23 @@
|
| }
|
|
|
|
|
| +Object* StubCache::ComputeLoadGlobal(String* name,
|
| + JSGlobalObject* receiver,
|
| + JSGlobalPropertyCell* cell) {
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL);
|
| + Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| + if (code->IsUndefined()) {
|
| + LoadStubCompiler compiler;
|
| + code = compiler.CompileLoadGlobal(receiver, cell, name);
|
| + if (code->IsFailure()) return code;
|
| + LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name));
|
| + Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code));
|
| + if (result->IsFailure()) return code;
|
| + }
|
| + return Set(name, receiver->map(), Code::cast(code));
|
| +}
|
| +
|
| +
|
| Object* StubCache::ComputeKeyedLoadField(String* name,
|
| JSObject* receiver,
|
| JSObject* holder,
|
| @@ -317,6 +334,23 @@
|
| }
|
|
|
|
|
| +Object* StubCache::ComputeStoreGlobal(String* name,
|
| + JSGlobalObject* receiver,
|
| + JSGlobalPropertyCell* cell) {
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL);
|
| + Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| + if (code->IsUndefined()) {
|
| + StoreStubCompiler compiler;
|
| + code = compiler.CompileStoreGlobal(receiver, cell, name);
|
| + if (code->IsFailure()) return code;
|
| + LOG(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name));
|
| + Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code));
|
| + if (result->IsFailure()) return code;
|
| + }
|
| + return Set(name, receiver->map(), Code::cast(code));
|
| +}
|
| +
|
| +
|
| Object* StubCache::ComputeStoreCallback(String* name,
|
| JSObject* receiver,
|
| AccessorInfo* callback) {
|
| @@ -496,6 +530,31 @@
|
| }
|
|
|
|
|
| +Object* StubCache::ComputeCallGlobal(int argc,
|
| + InLoopFlag in_loop,
|
| + String* name,
|
| + JSGlobalObject* receiver,
|
| + JSGlobalPropertyCell* cell,
|
| + JSFunction* function) {
|
| + Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, NORMAL);
|
| + Object* code = receiver->map()->FindInCodeCache(name, flags);
|
| + if (code->IsUndefined()) {
|
| + // If the function hasn't been compiled yet, we cannot do it now
|
| + // because it may cause GC. To avoid this issue, we return an
|
| + // internal error which will make sure we do not update any
|
| + // caches.
|
| + if (!function->is_compiled()) return Failure::InternalError();
|
| + CallStubCompiler compiler(argc);
|
| + code = compiler.CompileCallGlobal(receiver, cell, function, name);
|
| + if (code->IsFailure()) return code;
|
| + LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name));
|
| + Object* result = receiver->map()->UpdateCodeCache(name, Code::cast(code));
|
| + if (result->IsFailure()) return code;
|
| + }
|
| + return Set(name, receiver->map(), Code::cast(code));
|
| +}
|
| +
|
| +
|
| static Object* GetProbeValue(Code::Flags flags) {
|
| Dictionary* dictionary = Heap::non_monomorphic_cache();
|
| int entry = dictionary->FindNumberEntry(flags);
|
|
|