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

Unified Diff: src/ic.cc

Issue 7473028: Implement a type recording ToBoolean IC. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 5 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/code-stubs-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 8701)
+++ src/ic.cc (working copy)
@@ -309,6 +309,7 @@
case Code::UNARY_OP_IC:
case Code::BINARY_OP_IC:
case Code::COMPARE_IC:
+ case Code::TO_BOOLEAN_IC:
// Clearing these is tricky and does not
// make any performance difference.
return;
@@ -842,14 +843,6 @@
}
-#ifdef DEBUG
-#define TRACE_IC_NAMED(msg, name) \
- if (FLAG_trace_ic) PrintF(msg, *(name)->ToCString())
-#else
-#define TRACE_IC_NAMED(msg, name)
-#endif
-
-
MaybeObject* LoadIC::Load(State state,
Handle<Object> object,
Handle<String> name) {
@@ -2506,6 +2499,31 @@
}
+RUNTIME_FUNCTION(MaybeObject*, ToBoolean_Patch) {
+ ASSERT(args.length() == 3);
+
+ HandleScope scope(isolate);
+ Handle<Object> object = args.at<Object>(0);
+ Register tos = Register::from_code(args.smi_at(1));
+ ToBooleanStub::Types old_types(args.smi_at(2));
+
+ ToBooleanStub::Types new_types(old_types);
+ bool to_boolean_value = new_types.Record(object);
+ old_types.TraceTransition(new_types);
+
+ ToBooleanStub stub(tos, new_types);
+ Handle<Code> code = stub.GetCode();
+ ToBooleanIC ic(isolate);
+ ic.patch(*code);
+ return Smi::FromInt(to_boolean_value ? 1 : 0);
+}
+
+
+void ToBooleanIC::patch(Code* code) {
+ set_target(code);
+}
+
+
static const Address IC_utilities[] = {
#define ADDR(name) FUNCTION_ADDR(name),
IC_UTIL_LIST(ADDR)
« src/ia32/code-stubs-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