Chromium Code Reviews| 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) |