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

Unified Diff: src/stub-cache.cc

Issue 24095005: Revert "Unify computation of load stubs in stub cache." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index ac5ee55e79963dfdb8fe8eb8347940e76a79351f..bdfb32f46014617441990e60673620c0d186d3d9 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -272,29 +272,21 @@ Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name,
Handle<Code> StubCache::ComputeLoadField(Handle<Name> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
- Code::Kind kind,
PropertyIndex field,
Representation representation) {
if (receiver.is_identical_to(holder)) {
- if (kind == Code::LOAD_IC) {
- LoadFieldStub stub(field.is_inobject(holder),
- field.translate(holder),
- representation);
- return stub.GetCode(isolate());
- } else {
- KeyedLoadFieldStub stub(field.is_inobject(holder),
- field.translate(holder),
- representation);
- return stub.GetCode(isolate());
- }
+ LoadFieldStub stub(field.is_inobject(holder),
+ field.translate(holder),
+ representation);
+ return stub.GetCode(isolate());
}
Handle<JSObject> stub_holder = StubHolder(receiver, holder);
Handle<Code> stub = FindLoadHandler(
- name, receiver, stub_holder, kind, Code::FIELD);
+ name, receiver, stub_holder, Code::LOAD_IC, Code::FIELD);
if (!stub.is_null()) return stub;
- BaseLoadStubCompiler compiler(isolate_, kind);
+ LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadField(receiver, holder, name, field, representation);
JSObject::UpdateMapCodeCache(stub_holder, name, handler);
@@ -306,15 +298,14 @@ Handle<Code> StubCache::ComputeLoadCallback(
Handle<Name> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
- Code::Kind kind,
Handle<ExecutableAccessorInfo> callback) {
ASSERT(v8::ToCData<Address>(callback->getter()) != 0);
Handle<JSObject> stub_holder = StubHolder(receiver, holder);
Handle<Code> stub = FindLoadHandler(
- name, receiver, stub_holder, kind, Code::CALLBACKS);
+ name, receiver, stub_holder, Code::LOAD_IC, Code::CALLBACKS);
if (!stub.is_null()) return stub;
- BaseLoadStubCompiler compiler(isolate_, kind);
+ LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadCallback(receiver, holder, name, callback);
JSObject::UpdateMapCodeCache(stub_holder, name, handler);
@@ -326,14 +317,13 @@ Handle<Code> StubCache::ComputeLoadCallback(
Handle<Name> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
- Code::Kind kind,
const CallOptimization& call_optimization) {
Handle<JSObject> stub_holder = StubHolder(receiver, holder);
Handle<Code> stub = FindLoadHandler(
- name, receiver, stub_holder, kind, Code::CALLBACKS);
+ name, receiver, stub_holder, Code::LOAD_IC, Code::CALLBACKS);
if (!stub.is_null()) return stub;
- BaseLoadStubCompiler compiler(isolate_, kind);
+ LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadCallback(receiver, holder, name, call_optimization);
JSObject::UpdateMapCodeCache(stub_holder, name, handler);
@@ -361,30 +351,29 @@ Handle<Code> StubCache::ComputeLoadViaGetter(Handle<Name> name,
Handle<Code> StubCache::ComputeLoadConstant(Handle<Name> name,
Handle<JSObject> receiver,
Handle<JSObject> holder,
- Code::Kind kind,
Handle<Object> value) {
Handle<JSObject> stub_holder = StubHolder(receiver, holder);
Handle<Code> handler = FindLoadHandler(
- name, receiver, stub_holder, kind, Code::CONSTANT);
+ name, receiver, stub_holder, Code::LOAD_IC, Code::CONSTANT);
if (!handler.is_null()) return handler;
- BaseLoadStubCompiler compiler(isolate_, kind);
+ LoadStubCompiler compiler(isolate_);
handler = compiler.CompileLoadConstant(receiver, holder, name, value);
JSObject::UpdateMapCodeCache(stub_holder, name, handler);
+
return handler;
}
Handle<Code> StubCache::ComputeLoadInterceptor(Handle<Name> name,
Handle<JSObject> receiver,
- Handle<JSObject> holder,
- Code::Kind kind) {
+ Handle<JSObject> holder) {
Handle<JSObject> stub_holder = StubHolder(receiver, holder);
Handle<Code> stub = FindLoadHandler(
- name, receiver, stub_holder, kind, Code::INTERCEPTOR);
+ name, receiver, stub_holder, Code::LOAD_IC, Code::INTERCEPTOR);
if (!stub.is_null()) return stub;
- BaseLoadStubCompiler compiler(isolate_, kind);
+ LoadStubCompiler compiler(isolate_);
Handle<Code> handler =
compiler.CompileLoadInterceptor(receiver, holder, name);
JSObject::UpdateMapCodeCache(stub_holder, name, handler);
@@ -415,6 +404,101 @@ Handle<Code> StubCache::ComputeLoadGlobal(Handle<Name> name,
}
+Handle<Code> StubCache::ComputeKeyedLoadField(Handle<Name> name,
+ Handle<JSObject> receiver,
+ Handle<JSObject> holder,
+ PropertyIndex field,
+ Representation representation) {
+ if (receiver.is_identical_to(holder)) {
+ // TODO(titzer): this should use an HObjectAccess
+ KeyedLoadFieldStub stub(field.is_inobject(holder),
+ field.translate(holder),
+ representation);
+ return stub.GetCode(isolate());
+ }
+
+ Handle<JSObject> stub_holder = StubHolder(receiver, holder);
+ Handle<Code> stub = FindLoadHandler(
+ name, receiver, stub_holder, Code::KEYED_LOAD_IC, Code::FIELD);
+ if (!stub.is_null()) return stub;
+
+ KeyedLoadStubCompiler compiler(isolate_);
+ Handle<Code> handler =
+ compiler.CompileLoadField(receiver, holder, name, field, representation);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
+ return handler;
+}
+
+
+Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<Name> name,
+ Handle<JSObject> receiver,
+ Handle<JSObject> holder,
+ Handle<Object> value) {
+ Handle<JSObject> stub_holder = StubHolder(receiver, holder);
+ Handle<Code> handler = FindLoadHandler(
+ name, receiver, stub_holder, Code::KEYED_LOAD_IC,
+ Code::CONSTANT);
+ if (!handler.is_null()) return handler;
+
+ KeyedLoadStubCompiler compiler(isolate_);
+ handler = compiler.CompileLoadConstant(receiver, holder, name, value);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
+ return handler;
+}
+
+
+Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<Name> name,
+ Handle<JSObject> receiver,
+ Handle<JSObject> holder) {
+ Handle<JSObject> stub_holder = StubHolder(receiver, holder);
+ Handle<Code> stub = FindLoadHandler(
+ name, receiver, stub_holder, Code::KEYED_LOAD_IC, Code::INTERCEPTOR);
+ if (!stub.is_null()) return stub;
+
+ KeyedLoadStubCompiler compiler(isolate_);
+ Handle<Code> handler =
+ compiler.CompileLoadInterceptor(receiver, holder, name);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
+ return handler;
+}
+
+
+Handle<Code> StubCache::ComputeKeyedLoadCallback(
+ Handle<Name> name,
+ Handle<JSObject> receiver,
+ Handle<JSObject> holder,
+ Handle<ExecutableAccessorInfo> callback) {
+ Handle<JSObject> stub_holder = StubHolder(receiver, holder);
+ Handle<Code> stub = FindLoadHandler(
+ name, receiver, stub_holder, Code::KEYED_LOAD_IC, Code::CALLBACKS);
+ if (!stub.is_null()) return stub;
+
+ KeyedLoadStubCompiler compiler(isolate_);
+ Handle<Code> handler =
+ compiler.CompileLoadCallback(receiver, holder, name, callback);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
+ return handler;
+}
+
+
+Handle<Code> StubCache::ComputeKeyedLoadCallback(
+ Handle<Name> name,
+ Handle<JSObject> receiver,
+ Handle<JSObject> holder,
+ const CallOptimization& call_optimization) {
+ Handle<JSObject> stub_holder = StubHolder(receiver, holder);
+ Handle<Code> stub = FindLoadHandler(
+ name, receiver, stub_holder, Code::KEYED_LOAD_IC, Code::CALLBACKS);
+ if (!stub.is_null()) return stub;
+
+ KeyedLoadStubCompiler compiler(isolate_);
+ Handle<Code> handler =
+ compiler.CompileLoadCallback(receiver, holder, name, call_optimization);
+ JSObject::UpdateMapCodeCache(stub_holder, name, handler);
+ return handler;
+}
+
+
Handle<Code> StubCache::ComputeStoreField(Handle<Name> name,
Handle<JSObject> receiver,
LookupResult* lookup,
@@ -1873,15 +1957,23 @@ void StubCompiler::TailCallBuiltin(MacroAssembler* masm, Builtins::Name name) {
}
-Register* BaseLoadStoreStubCompiler::GetRegisters(Code::Kind kind) {
- switch (kind) {
- case Code::LOAD_IC: return LoadStubCompiler::registers();
- case Code::STORE_IC: return StoreStubCompiler::registers();
- case Code::KEYED_LOAD_IC: return KeyedLoadStubCompiler::registers();
- case Code::KEYED_STORE_IC: return KeyedStoreStubCompiler::registers();
- default: UNREACHABLE();
- }
- return NULL;
+void LoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) {
+ GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
+}
+
+
+void KeyedLoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) {
+ GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
+}
+
+
+void StoreStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) {
+ GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
+}
+
+
+void KeyedStoreStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) {
+ GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code));
}
« no previous file with comments | « src/stub-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698