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

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

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 months 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.h » ('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 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 return greater_equal; 2046 return greater_equal;
2047 case Token::GTE: 2047 case Token::GTE:
2048 return greater_equal; 2048 return greater_equal;
2049 default: 2049 default:
2050 UNREACHABLE(); 2050 UNREACHABLE();
2051 return no_condition; 2051 return no_condition;
2052 } 2052 }
2053 } 2053 }
2054 2054
2055 2055
2056 static bool HasInlinedSmiCode(Address address) {
2057 // The address of the instruction following the call.
2058 Address test_instruction_address =
2059 address + Assembler::kCallTargetAddressOffset;
2060
2061 // If the instruction following the call is not a test al, nothing
2062 // was inlined.
2063 return *test_instruction_address == Assembler::kTestAlByte;
2064 }
2065
2066
2056 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { 2067 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
2057 HandleScope scope; 2068 HandleScope scope;
2058 Handle<Code> rewritten; 2069 Handle<Code> rewritten;
2059 #ifdef DEBUG
2060 State previous_state = GetState(); 2070 State previous_state = GetState();
2061 #endif 2071
2062 State state = TargetState(x, y); 2072 State state = TargetState(previous_state, HasInlinedSmiCode(address()), x, y);
2063 if (state == GENERIC) { 2073 if (state == GENERIC) {
2064 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); 2074 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS);
2065 rewritten = stub.GetCode(); 2075 rewritten = stub.GetCode();
2066 } else { 2076 } else {
2067 ICCompareStub stub(op_, state); 2077 ICCompareStub stub(op_, state);
2068 rewritten = stub.GetCode(); 2078 rewritten = stub.GetCode();
2069 } 2079 }
2070 set_target(*rewritten); 2080 set_target(*rewritten);
2071 2081
2072 #ifdef DEBUG 2082 #ifdef DEBUG
2073 if (FLAG_trace_ic) { 2083 if (FLAG_trace_ic) {
2074 PrintF("[CompareIC (%s->%s)#%s]\n", 2084 PrintF("[CompareIC (%s->%s)#%s]\n",
2075 GetStateName(previous_state), 2085 GetStateName(previous_state),
2076 GetStateName(state), 2086 GetStateName(state),
2077 Token::Name(op_)); 2087 Token::Name(op_));
2078 } 2088 }
2079 #endif 2089 #endif
2090
2091 // Activate inlined smi code.
2092 if (previous_state == UNINITIALIZED) {
2093 PatchInlinedSmiCode(address());
2094 }
2095 }
2096
2097
2098 void PatchInlinedSmiCode(Address address) {
2099 // The address of the instruction following the call.
2100 Address test_instruction_address =
2101 address + Assembler::kCallTargetAddressOffset;
2102
2103 // If the instruction following the call is not a test al, nothing
2104 // was inlined.
2105 if (*test_instruction_address != Assembler::kTestAlByte) {
2106 ASSERT(*test_instruction_address == Assembler::kNopByte);
2107 return;
2108 }
2109
2110 Address delta_address = test_instruction_address + 1;
2111 // The delta to the start of the map check instruction and the
2112 // condition code uses at the patched jump.
2113 int8_t delta = *reinterpret_cast<int8_t*>(delta_address);
2114 if (FLAG_trace_ic) {
2115 PrintF("[ patching ic at %p, test=%p, delta=%d\n",
2116 address, test_instruction_address, delta);
2117 }
2118
2119 // Patch with a short conditional jump. There must be a
2120 // short jump-if-carry/not-carry at this position.
2121 Address jmp_address = test_instruction_address - delta;
2122 ASSERT(*jmp_address == Assembler::kJncShortOpcode ||
2123 *jmp_address == Assembler::kJcShortOpcode);
2124 Condition cc = *jmp_address == Assembler::kJncShortOpcode
2125 ? not_zero
2126 : zero;
2127 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
2080 } 2128 }
2081 2129
2082 2130
2083 } } // namespace v8::internal 2131 } } // namespace v8::internal
2084 2132
2085 #endif // V8_TARGET_ARCH_IA32 2133 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698