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

Unified Diff: src/ic.cc

Issue 551093: Implementing inline caches for GenericBinaryOpStub. ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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
« src/ia32/codegen-ia32.cc ('K') | « src/ic.h ('k') | src/log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
===================================================================
--- src/ic.cc (revision 3626)
+++ src/ic.cc (working copy)
@@ -222,6 +222,7 @@
case Code::STORE_IC: return StoreIC::Clear(address, target);
case Code::KEYED_STORE_IC: return KeyedStoreIC::Clear(address, target);
case Code::CALL_IC: return CallIC::Clear(address, target);
+ case Code::BINARY_OP_IC: return BinaryOpIC::Clear(address, target);
default: UNREACHABLE();
}
}
@@ -1425,7 +1426,53 @@
Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss)));
}
+// defined in codegen-<arch>.cc
+Code* GetBinaryOpStub(int minor_key);
+#ifdef DEBUG
+// defined in codegen-<arch>.cc
+void TraceBinaryOp(int old_key, int new_key);
+#endif
+
+void BinaryOpIC::patch(Code* code) {
+ set_target(code);
+}
+
+void BinaryOpIC::Clear(Address address, Code* target) {
+ if (target->ic_state() == UNINITIALIZED) return;
+
+ // At the end of a fast case stub there should be a reference to
+ // a corresponding UNINITIALIZED stub, so look for the last reloc info item.
+ RelocInfo* rinfo = NULL;
+ for (RelocIterator it(target, RelocInfo::kCodeTargetMask);
+ !it.done(); it.next()) {
+ rinfo = it.rinfo();
+ }
+
+ ASSERT(rinfo != NULL);
+ Code * uninit_stub = Code::GetCodeFromTargetAddress(rinfo->target_address());
+ ASSERT(uninit_stub->ic_state() == UNINITIALIZED &&
+ uninit_stub->kind() == Code::BINARY_OP_IC);
+ SetTargetAtAddress(address, uninit_stub);
+}
+
+
+Object * BinaryOp_Patch(Arguments args) {
Mads Ager (chromium) 2010/01/22 12:14:26 Remove space before '*'.
vladislav.kaznacheev 2010/01/22 14:09:42 Done.
+ NoHandleAllocation na;
+ int key = Smi::cast(args[1])->value();
+#ifdef DEBUG
+ if (FLAG_trace_ic) {
+ int old_key = Smi::cast(args[2])->value();
+ TraceBinaryOp(old_key, key);
+ }
+#endif // DEBUG
+ Code* code = GetBinaryOpStub(key);
+ BinaryOpIC ic;
+ ic.patch(code);
+ return args[0];
+}
+
+
static Address IC_utilities[] = {
#define ADDR(name) FUNCTION_ADDR(name),
IC_UTIL_LIST(ADDR)
« src/ia32/codegen-ia32.cc ('K') | « src/ic.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698