Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1749)

Unified Diff: src/stub-cache.cc

Issue 151019: Changed the global object representation (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/stub-cache.h ('k') | src/v8-counters.h » ('j') | test/cctest/test-api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/stub-cache.h ('k') | src/v8-counters.h » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698