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 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 return greater_equal; | 2042 return greater_equal; |
2043 case Token::GTE: | 2043 case Token::GTE: |
2044 return greater_equal; | 2044 return greater_equal; |
2045 default: | 2045 default: |
2046 UNREACHABLE(); | 2046 UNREACHABLE(); |
2047 return no_condition; | 2047 return no_condition; |
2048 } | 2048 } |
2049 } | 2049 } |
2050 | 2050 |
2051 | 2051 |
| 2052 static bool HasInlinedSmiCode(Address address) { |
| 2053 // The address of the instruction following the call. |
| 2054 Address test_instruction_address = |
| 2055 address + Assembler::kCallTargetAddressOffset; |
| 2056 |
| 2057 // If the instruction following the call is not a test al, nothing |
| 2058 // was inlined. |
| 2059 return *test_instruction_address == Assembler::kTestAlByte; |
| 2060 } |
| 2061 |
| 2062 |
2052 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { | 2063 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { |
2053 HandleScope scope; | 2064 HandleScope scope; |
2054 Handle<Code> rewritten; | 2065 Handle<Code> rewritten; |
2055 State previous_state = GetState(); | 2066 State previous_state = GetState(); |
2056 | 2067 |
2057 State state = TargetState(previous_state, x, y); | 2068 State state = TargetState(previous_state, HasInlinedSmiCode(address()), x, y); |
2058 if (state == GENERIC) { | 2069 if (state == GENERIC) { |
2059 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); | 2070 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); |
2060 rewritten = stub.GetCode(); | 2071 rewritten = stub.GetCode(); |
2061 } else { | 2072 } else { |
2062 ICCompareStub stub(op_, state); | 2073 ICCompareStub stub(op_, state); |
2063 rewritten = stub.GetCode(); | 2074 rewritten = stub.GetCode(); |
2064 } | 2075 } |
2065 set_target(*rewritten); | 2076 set_target(*rewritten); |
2066 | 2077 |
2067 #ifdef DEBUG | 2078 #ifdef DEBUG |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 // short jump at this position. | 2116 // short jump at this position. |
2106 Address jmp_address = test_instruction_address - delta; | 2117 Address jmp_address = test_instruction_address - delta; |
2107 ASSERT(*jmp_address == Assembler::kJmpShortOpcode); | 2118 ASSERT(*jmp_address == Assembler::kJmpShortOpcode); |
2108 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | not_zero); | 2119 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | not_zero); |
2109 } | 2120 } |
2110 | 2121 |
2111 | 2122 |
2112 } } // namespace v8::internal | 2123 } } // namespace v8::internal |
2113 | 2124 |
2114 #endif // V8_TARGET_ARCH_IA32 | 2125 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |