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

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

Issue 5714001: Improve our type feedback by recogizining never-executed IC calls for binary ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: address comments, fixed ARM build. 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 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { 2052 void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
2053 HandleScope scope; 2053 HandleScope scope;
2054 Handle<Code> rewritten; 2054 Handle<Code> rewritten;
2055 #ifdef DEBUG
2056 State previous_state = GetState(); 2055 State previous_state = GetState();
2057 #endif 2056
2058 State state = TargetState(x, y); 2057 State state = TargetState(previous_state, x, y);
2059 if (state == GENERIC) { 2058 if (state == GENERIC) {
2060 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS); 2059 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS);
2061 rewritten = stub.GetCode(); 2060 rewritten = stub.GetCode();
2062 } else { 2061 } else {
2063 ICCompareStub stub(op_, state); 2062 ICCompareStub stub(op_, state);
2064 rewritten = stub.GetCode(); 2063 rewritten = stub.GetCode();
2065 } 2064 }
2066 set_target(*rewritten); 2065 set_target(*rewritten);
2067 2066
2068 #ifdef DEBUG 2067 #ifdef DEBUG
2069 if (FLAG_trace_ic) { 2068 if (FLAG_trace_ic) {
2070 PrintF("[CompareIC (%s->%s)#%s]\n", 2069 PrintF("[CompareIC (%s->%s)#%s]\n",
2071 GetStateName(previous_state), 2070 GetStateName(previous_state),
2072 GetStateName(state), 2071 GetStateName(state),
2073 Token::Name(op_)); 2072 Token::Name(op_));
2074 } 2073 }
2075 #endif 2074 #endif
2075
2076 // Activate inlined smi code.
2077 if (previous_state == UNINITIALIZED) {
2078 PatchInlinedSmiCode(address());
2079 }
2080 }
2081
2082
2083 void PatchInlinedSmiCode(Address address) {
2084 // The address of the instruction following the call.
2085 Address test_instruction_address =
2086 address + Assembler::kCallTargetAddressOffset;
2087
2088 // If the instruction following the call is not a test al, nothing
2089 // was inlined.
2090 if (*test_instruction_address != Assembler::kTestAlByte) {
2091 ASSERT(*test_instruction_address == Assembler::kNopByte);
2092 return;
2093 }
2094
2095 Address delta_address = test_instruction_address + 1;
2096 // The delta to the start of the map check instruction and the
2097 // condition code uses at the patched jump.
2098 int8_t delta = *reinterpret_cast<int8_t*>(delta_address);
2099 if (FLAG_trace_ic) {
2100 PrintF("[ patching ic at %p, test=%p, delta=%d\n",
2101 address, test_instruction_address, delta);
2102 }
2103
2104 // Patch with a short conditional jump. There must be an unconditional
2105 // short jump at this position.
2106 Address jmp_address = test_instruction_address - delta;
2107 ASSERT(*jmp_address == Assembler::kJmpShortOpcode);
2108 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | not_zero);
2076 } 2109 }
2077 2110
2078 2111
2079 } } // namespace v8::internal 2112 } } // namespace v8::internal
2080 2113
2081 #endif // V8_TARGET_ARCH_IA32 2114 #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