Chromium Code Reviews| Index: src/ic.cc |
| diff --git a/src/ic.cc b/src/ic.cc |
| index d6e35a7c47ccd16f2a8027ee7e762103db6d8a00..42fede18a6ac1b52b7c8f6abcfbde6a4ba32aa95 100644 |
| --- a/src/ic.cc |
| +++ b/src/ic.cc |
| @@ -2401,86 +2401,6 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissForceGeneric) { |
| } |
| -void UnaryOpIC::patch(Code* code) { |
| - set_target(code); |
| -} |
| - |
| - |
| -const char* UnaryOpIC::GetName(TypeInfo type_info) { |
| - switch (type_info) { |
| - case UNINITIALIZED: return "Uninitialized"; |
| - case SMI: return "Smi"; |
| - case NUMBER: return "Number"; |
| - case GENERIC: return "Generic"; |
| - default: return "Invalid"; |
| - } |
| -} |
| - |
| - |
| -UnaryOpIC::State UnaryOpIC::ToState(TypeInfo type_info) { |
| - switch (type_info) { |
| - case UNINITIALIZED: |
| - return v8::internal::UNINITIALIZED; |
| - case SMI: |
| - case NUMBER: |
| - return MONOMORPHIC; |
| - case GENERIC: |
| - return v8::internal::GENERIC; |
| - } |
| - UNREACHABLE(); |
| - return v8::internal::UNINITIALIZED; |
| -} |
| - |
| - |
| -Handle<Type> UnaryOpIC::TypeInfoToType(TypeInfo type_info, Isolate* isolate) { |
| - switch (type_info) { |
| - case UNINITIALIZED: |
| - return handle(Type::None(), isolate); |
| - case SMI: |
| - return handle(Type::Integer31(), isolate); |
| - case NUMBER: |
| - return handle(Type::Number(), isolate); |
| - case GENERIC: |
| - return handle(Type::Any(), isolate); |
| - } |
| - UNREACHABLE(); |
| - return handle(Type::Any(), isolate); |
| -} |
| - |
| - |
| -UnaryOpIC::TypeInfo UnaryOpIC::GetTypeInfo(Handle<Object> operand) { |
| - v8::internal::TypeInfo operand_type = |
| - v8::internal::TypeInfo::FromValue(operand); |
| - if (operand_type.IsSmi()) { |
| - return SMI; |
| - } else if (operand_type.IsNumber()) { |
| - return NUMBER; |
| - } else { |
| - return GENERIC; |
| - } |
| -} |
| - |
| - |
| -UnaryOpIC::TypeInfo UnaryOpIC::ComputeNewType( |
| - TypeInfo current_type, |
| - TypeInfo previous_type) { |
| - switch (previous_type) { |
| - case UNINITIALIZED: |
| - return current_type; |
| - case SMI: |
| - return (current_type == GENERIC) ? GENERIC : NUMBER; |
| - case NUMBER: |
| - return GENERIC; |
| - case GENERIC: |
| - // We should never do patching if we are in GENERIC state. |
| - UNREACHABLE(); |
| - return GENERIC; |
| - } |
| - UNREACHABLE(); |
| - return GENERIC; |
| -} |
| - |
| - |
| void BinaryOpIC::patch(Code* code) { |
| set_target(code); |
| } |
| @@ -2557,58 +2477,24 @@ void BinaryOpIC::StubInfoToType(int minor_key, |
| *result = TypeInfoToType(result_typeinfo, isolate); |
| } |
|
danno
2013/06/21 16:38:04
nit: two lines between functions
|
| +MaybeObject* UnaryOpIC::Transition(Handle<Object> object) { |
| + Code::ExtraICState extra_ic_state = target()->extra_ic_state(); |
| + UnaryOpStub stub(extra_ic_state); |
| -RUNTIME_FUNCTION(MaybeObject*, UnaryOp_Patch) { |
| - ASSERT(args.length() == 4); |
| - |
| - HandleScope scope(isolate); |
| - Handle<Object> operand = args.at<Object>(0); |
| - Token::Value op = static_cast<Token::Value>(args.smi_at(1)); |
| - UnaryOverwriteMode mode = static_cast<UnaryOverwriteMode>(args.smi_at(2)); |
| - UnaryOpIC::TypeInfo previous_type = |
| - static_cast<UnaryOpIC::TypeInfo>(args.smi_at(3)); |
| - |
| - UnaryOpIC::TypeInfo type = UnaryOpIC::GetTypeInfo(operand); |
| - type = UnaryOpIC::ComputeNewType(type, previous_type); |
| + stub.Record(object); |
|
danno
2013/06/21 16:38:04
Can you change "Record" here and elsewhere to Upda
|
| - UnaryOpStub stub(op, mode, type); |
| - Handle<Code> code = stub.GetCode(isolate); |
| - if (!code.is_null()) { |
| - if (FLAG_trace_ic) { |
| - PrintF("[UnaryOpIC in "); |
| - JavaScriptFrame::PrintTop(isolate, stdout, false, true); |
| - PrintF(" %s => %s #%s @ %p]\n", |
| - UnaryOpIC::GetName(previous_type), |
| - UnaryOpIC::GetName(type), |
| - Token::Name(op), |
| - static_cast<void*>(*code)); |
| - } |
| - UnaryOpIC ic(isolate); |
| - ic.patch(*code); |
| - } |
| + Handle<Code> code = stub.GetCode(isolate()); |
| + set_target(*code); |
| - Handle<JSBuiltinsObject> builtins(isolate->js_builtins_object()); |
| - Object* builtin = NULL; // Initialization calms down the compiler. |
| - switch (op) { |
| - case Token::SUB: |
| - builtin = builtins->javascript_builtin(Builtins::UNARY_MINUS); |
| - break; |
| - case Token::BIT_NOT: |
| - builtin = builtins->javascript_builtin(Builtins::BIT_NOT); |
| - break; |
| - default: |
| - UNREACHABLE(); |
| - } |
| + return stub.Result(object, isolate()); |
| +} |
| - Handle<JSFunction> builtin_function(JSFunction::cast(builtin), isolate); |
| - bool caught_exception; |
| - Handle<Object> result = Execution::Call(builtin_function, operand, 0, NULL, |
| - &caught_exception); |
| - if (caught_exception) { |
| - return Failure::Exception(); |
| - } |
| - return *result; |
| +RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss) { |
| + HandleScope scope(isolate); |
| + Handle<Object> object = args.at<Object>(0); |
| + UnaryOpIC ic(isolate); |
| + return ic.Transition(object); |
| } |
| @@ -3073,9 +2959,7 @@ MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) { |
| // types must be supported as a result of the miss. |
| bool already_monomorphic = stub.IsMonomorphic(); |
| - CompareNilICStub::State old_state = stub.GetState(); |
| stub.Record(object); |
| - old_state.TraceTransition(stub.GetState()); |
| NilValue nil = stub.GetNilValue(); |