Index: src/ic.cc |
=================================================================== |
--- src/ic.cc (revision 7552) |
+++ src/ic.cc (working copy) |
@@ -282,7 +282,6 @@ |
return KeyedStoreIC::Clear(address, target); |
case Code::CALL_IC: return CallIC::Clear(address, target); |
case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target); |
- case Code::BINARY_OP_IC: |
case Code::TYPE_RECORDING_BINARY_OP_IC: |
case Code::COMPARE_IC: |
// Clearing these is tricky and does not |
@@ -1979,147 +1978,6 @@ |
} |
-void BinaryOpIC::patch(Code* code) { |
- set_target(code); |
-} |
- |
- |
-const char* BinaryOpIC::GetName(TypeInfo type_info) { |
- switch (type_info) { |
- case UNINIT_OR_SMI: return "UninitOrSmi"; |
- case DEFAULT: return "Default"; |
- case GENERIC: return "Generic"; |
- case HEAP_NUMBERS: return "HeapNumbers"; |
- case STRINGS: return "Strings"; |
- default: return "Invalid"; |
- } |
-} |
- |
- |
-BinaryOpIC::State BinaryOpIC::ToState(TypeInfo type_info) { |
- switch (type_info) { |
- case UNINIT_OR_SMI: |
- return UNINITIALIZED; |
- case DEFAULT: |
- case HEAP_NUMBERS: |
- case STRINGS: |
- return MONOMORPHIC; |
- case GENERIC: |
- return MEGAMORPHIC; |
- } |
- UNREACHABLE(); |
- return UNINITIALIZED; |
-} |
- |
- |
-BinaryOpIC::TypeInfo BinaryOpIC::GetTypeInfo(Object* left, |
- Object* right) { |
- if (left->IsSmi() && right->IsSmi()) { |
- // If we have two smi inputs we can reach here because |
- // of an overflow. Enter default state. |
- return DEFAULT; |
- } |
- |
- if (left->IsNumber() && right->IsNumber()) { |
- return HEAP_NUMBERS; |
- } |
- |
- if (left->IsString() || right->IsString()) { |
- // Patching for fast string ADD makes sense even if only one of the |
- // arguments is a string. |
- return STRINGS; |
- } |
- |
- return GENERIC; |
-} |
- |
- |
-// defined in code-stubs-<arch>.cc |
-Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info); |
- |
- |
-RUNTIME_FUNCTION(MaybeObject*, BinaryOp_Patch) { |
- ASSERT(args.length() == 5); |
- |
- HandleScope scope(isolate); |
- Handle<Object> left = args.at<Object>(0); |
- Handle<Object> right = args.at<Object>(1); |
- int key = Smi::cast(args[2])->value(); |
- Token::Value op = static_cast<Token::Value>(Smi::cast(args[3])->value()); |
- BinaryOpIC::TypeInfo previous_type = |
- static_cast<BinaryOpIC::TypeInfo>(Smi::cast(args[4])->value()); |
- |
- BinaryOpIC::TypeInfo type = BinaryOpIC::GetTypeInfo(*left, *right); |
- Handle<Code> code = GetBinaryOpStub(key, type); |
- if (!code.is_null()) { |
- BinaryOpIC ic(isolate); |
- ic.patch(*code); |
- if (FLAG_trace_ic) { |
- PrintF("[BinaryOpIC (%s->%s)#%s]\n", |
- BinaryOpIC::GetName(previous_type), |
- BinaryOpIC::GetName(type), |
- Token::Name(op)); |
- } |
- } |
- |
- Handle<JSBuiltinsObject> builtins = Handle<JSBuiltinsObject>( |
- isolate->thread_local_top()->context_->builtins(), isolate); |
- Object* builtin = NULL; // Initialization calms down the compiler. |
- switch (op) { |
- case Token::ADD: |
- builtin = builtins->javascript_builtin(Builtins::ADD); |
- break; |
- case Token::SUB: |
- builtin = builtins->javascript_builtin(Builtins::SUB); |
- break; |
- case Token::MUL: |
- builtin = builtins->javascript_builtin(Builtins::MUL); |
- break; |
- case Token::DIV: |
- builtin = builtins->javascript_builtin(Builtins::DIV); |
- break; |
- case Token::MOD: |
- builtin = builtins->javascript_builtin(Builtins::MOD); |
- break; |
- case Token::BIT_AND: |
- builtin = builtins->javascript_builtin(Builtins::BIT_AND); |
- break; |
- case Token::BIT_OR: |
- builtin = builtins->javascript_builtin(Builtins::BIT_OR); |
- break; |
- case Token::BIT_XOR: |
- builtin = builtins->javascript_builtin(Builtins::BIT_XOR); |
- break; |
- case Token::SHR: |
- builtin = builtins->javascript_builtin(Builtins::SHR); |
- break; |
- case Token::SAR: |
- builtin = builtins->javascript_builtin(Builtins::SAR); |
- break; |
- case Token::SHL: |
- builtin = builtins->javascript_builtin(Builtins::SHL); |
- break; |
- default: |
- UNREACHABLE(); |
- } |
- |
- Handle<JSFunction> builtin_function(JSFunction::cast(builtin), |
- isolate); |
- |
- bool caught_exception; |
- Object** builtin_args[] = { right.location() }; |
- Handle<Object> result = Execution::Call(builtin_function, |
- left, |
- ARRAY_SIZE(builtin_args), |
- builtin_args, |
- &caught_exception); |
- if (caught_exception) { |
- return Failure::Exception(); |
- } |
- return *result; |
-} |
- |
- |
void TRBinaryOpIC::patch(Code* code) { |
set_target(code); |
} |