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) |