Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: src/ia32/ic-ia32.cc

Issue 5717005: Revert r5970 and r5975. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
2063 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { 2052 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
2064 HandleScope scope; 2053 HandleScope scope;
2065 Handle<Code> rewritten; 2054 Handle<Code> rewritten;
2055 #ifdef DEBUG
2066 State previous_state = GetState(); 2056 State previous_state = GetState();
2067 2057 #endif
2068 State state = TargetState(previous_state, HasInlinedSmiCode(address()), x, y); 2058 State state = TargetState(x, y);
2069 if (state == GENERIC) { 2059 if (state == GENERIC) {
2070 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); 2060 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS);
2071 rewritten = stub.GetCode(); 2061 rewritten = stub.GetCode();
2072 } else { 2062 } else {
2073 ICCompareStub stub(op_, state); 2063 ICCompareStub stub(op_, state);
2074 rewritten = stub.GetCode(); 2064 rewritten = stub.GetCode();
2075 } 2065 }
2076 set_target(*rewritten); 2066 set_target(*rewritten);
2077 2067
2078 #ifdef DEBUG 2068 #ifdef DEBUG
2079 if (FLAG_trace_ic) { 2069 if (FLAG_trace_ic) {
2080 PrintF("[CompareIC (%s->%s)#%s]\n", 2070 PrintF("[CompareIC (%s->%s)#%s]\n",
2081 GetStateName(previous_state), 2071 GetStateName(previous_state),
2082 GetStateName(state), 2072 GetStateName(state),
2083 Token::Name(op_)); 2073 Token::Name(op_));
2084 } 2074 }
2085 #endif 2075 #endif
2086
2087 // Activate inlined smi code.
2088 if (previous_state == UNINITIALIZED) {
2089 PatchInlinedSmiCode(address());
2090 }
2091 }
2092
2093
2094 void PatchInlinedSmiCode(Address address) {
2095 // The address of the instruction following the call.
2096 Address test_instruction_address =
2097 address + Assembler::kCallTargetAddressOffset;
2098
2099 // If the instruction following the call is not a test al, nothing
2100 // was inlined.
2101 if (*test_instruction_address != Assembler::kTestAlByte) {
2102 ASSERT(*test_instruction_address == Assembler::kNopByte);
2103 return;
2104 }
2105
2106 Address delta_address = test_instruction_address + 1;
2107 // The delta to the start of the map check instruction and the
2108 // condition code uses at the patched jump.
2109 int8_t delta = *reinterpret_cast<int8_t*>(delta_address);
2110 if (FLAG_trace_ic) {
2111 PrintF("[ patching ic at %p, test=%p, delta=%d\n",
2112 address, test_instruction_address, delta);
2113 }
2114
2115 // Patch with a short conditional jump. There must be an unconditional
2116 // short jump at this position.
2117 Address jmp_address = test_instruction_address - delta;
2118 ASSERT(*jmp_address == Assembler::kJmpShortOpcode);
2119 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | not_zero);
2120 } 2076 }
2121 2077
2122 2078
2123 } } // namespace v8::internal 2079 } } // namespace v8::internal
2124 2080
2125 #endif // V8_TARGET_ARCH_IA32 2081 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698