OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 if (FLAG_trace_ic) { | 2069 if (FLAG_trace_ic) { |
2070 PrintF("[CompareIC (%s->%s)#%s]\n", | 2070 PrintF("[CompareIC (%s->%s)#%s]\n", |
2071 GetStateName(previous_state), | 2071 GetStateName(previous_state), |
2072 GetStateName(state), | 2072 GetStateName(state), |
2073 Token::Name(op_)); | 2073 Token::Name(op_)); |
2074 } | 2074 } |
2075 #endif | 2075 #endif |
2076 } | 2076 } |
2077 | 2077 |
2078 | 2078 |
| 2079 void TRBinaryOpIC::PatchInlinedSmiCode(Address address) { |
| 2080 // The address of the instruction following the call. |
| 2081 Address test_instruction_address = |
| 2082 address + Assembler::kCallTargetAddressOffset; |
| 2083 |
| 2084 // If the instruction following the call is not a test eax, nothing |
| 2085 // was inlined. |
| 2086 if (*test_instruction_address != Assembler::kTestEaxByte) return; |
| 2087 |
| 2088 Address delta_address = test_instruction_address + 1; |
| 2089 // The delta to the start of the map check instruction and the |
| 2090 // condition code uses at the patched jump. |
| 2091 int delta_and_condition = *reinterpret_cast<int*>(delta_address); |
| 2092 int condition = delta_and_condition & 0xffff; |
| 2093 int delta = delta_and_condition >> 16; |
| 2094 if (FLAG_trace_ic) { |
| 2095 PrintF("[TRBinaryOpIC patching ic at %p, test=%p, delta=%d, cc=%d\n", |
| 2096 address, test_instruction_address, delta, condition); |
| 2097 } |
| 2098 |
| 2099 // Patch with a short conditional jump. There must be an unconditional |
| 2100 // short jump at this position. |
| 2101 Address jmp_address = test_instruction_address - delta; |
| 2102 ASSERT(*jmp_address == Assembler::kJmpShortOpcode); |
| 2103 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | condition); |
| 2104 } |
| 2105 |
| 2106 |
2079 } } // namespace v8::internal | 2107 } } // namespace v8::internal |
2080 | 2108 |
2081 #endif // V8_TARGET_ARCH_IA32 | 2109 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |