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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 10825483: Add --use_cha (default true, switch to false if you use dynamic class loading). Use CHA to specify … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 const intptr_t kNumTemps = 1; 2178 const intptr_t kNumTemps = 1;
2179 LocationSummary* summary = 2179 LocationSummary* summary =
2180 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2180 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2181 summary->set_in(0, Location::RequiresRegister()); 2181 summary->set_in(0, Location::RequiresRegister());
2182 summary->set_temp(0, Location::RequiresRegister()); 2182 summary->set_temp(0, Location::RequiresRegister());
2183 return summary; 2183 return summary;
2184 } 2184 }
2185 2185
2186 2186
2187 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { 2187 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) {
2188 const intptr_t v_cid = value()->ResultCid();
2189 const intptr_t num_checks = ic_data()->NumberOfChecks();
2190 if ((num_checks == 1) &&
2191 (v_cid == ic_data()->GetReceiverClassIdAt(0))) {
2192 // No checks needed.
2193 // TODO(srdjan): Should the computation have been removed instead?
2194 return;
2195 }
2188 Register value = locs()->in(0).reg(); 2196 Register value = locs()->in(0).reg();
2189 Register temp = locs()->temp(0).reg(); 2197 Register temp = locs()->temp(0).reg();
2190 Label* deopt = compiler->AddDeoptStub(deopt_id(), 2198 Label* deopt = compiler->AddDeoptStub(deopt_id(),
2191 try_index(), 2199 try_index(),
2192 kDeoptCheckClass); 2200 kDeoptCheckClass);
2193 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmiCid); 2201 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmiCid);
2194 __ testl(value, Immediate(kSmiTagMask)); 2202 __ testl(value, Immediate(kSmiTagMask));
2195 __ j(ZERO, deopt); 2203 __ j(ZERO, deopt);
2196 __ LoadClassId(temp, value); 2204 __ LoadClassId(temp, value);
2197 Label is_ok; 2205 Label is_ok;
2198 const intptr_t num_checks = ic_data()->NumberOfChecks();
2199 const bool use_near_jump = num_checks < 5; 2206 const bool use_near_jump = num_checks < 5;
2200 for (intptr_t i = 0; i < num_checks; i++) { 2207 for (intptr_t i = 0; i < num_checks; i++) {
2201 __ cmpl(temp, Immediate(ic_data()->GetReceiverClassIdAt(i))); 2208 __ cmpl(temp, Immediate(ic_data()->GetReceiverClassIdAt(i)));
2202 if (i == (num_checks - 1)) { 2209 if (i == (num_checks - 1)) {
2203 __ j(NOT_EQUAL, deopt); 2210 __ j(NOT_EQUAL, deopt);
2204 } else { 2211 } else {
2205 if (use_near_jump) { 2212 if (use_near_jump) {
2206 __ j(EQUAL, &is_ok, Assembler::kNearJump); 2213 __ j(EQUAL, &is_ok, Assembler::kNearJump);
2207 } else { 2214 } else {
2208 __ j(EQUAL, &is_ok); 2215 __ j(EQUAL, &is_ok);
2209 } 2216 }
2210 } 2217 }
2211 } 2218 }
2212 __ Bind(&is_ok); 2219 __ Bind(&is_ok);
2213 } 2220 }
2214 2221
2215 } // namespace dart 2222 } // namespace dart
2216 2223
2217 #undef __ 2224 #undef __
2218 2225
2219 #endif // defined TARGET_ARCH_X64 2226 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/flow_graph_optimizer.cc ('K') | « runtime/vm/flow_graph_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698