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

Side by Side Diff: runtime/vm/intermediate_language_x64.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
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 const intptr_t kNumTemps = 1; 2184 const intptr_t kNumTemps = 1;
2185 LocationSummary* summary = 2185 LocationSummary* summary =
2186 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2186 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2187 summary->set_in(0, Location::RequiresRegister()); 2187 summary->set_in(0, Location::RequiresRegister());
2188 summary->set_temp(0, Location::RequiresRegister()); 2188 summary->set_temp(0, Location::RequiresRegister());
2189 return summary; 2189 return summary;
2190 } 2190 }
2191 2191
2192 2192
2193 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { 2193 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) {
2194 const intptr_t v_cid = value()->ResultCid();
2195 const intptr_t num_checks = ic_data()->NumberOfChecks();
2196 if ((num_checks == 1) &&
2197 (v_cid == ic_data()->GetReceiverClassIdAt(0))) {
2198 // No checks needed.
2199 // TODO(srdjan): Should the computation have been removed instead?
2200 return;
2201 }
2194 Register value = locs()->in(0).reg(); 2202 Register value = locs()->in(0).reg();
2195 Register temp = locs()->temp(0).reg(); 2203 Register temp = locs()->temp(0).reg();
2196 Label* deopt = compiler->AddDeoptStub(deopt_id(), 2204 Label* deopt = compiler->AddDeoptStub(deopt_id(),
2197 try_index(), 2205 try_index(),
2198 kDeoptCheckClass); 2206 kDeoptCheckClass);
2199 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmiCid); 2207 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmiCid);
2200 __ testq(value, Immediate(kSmiTagMask)); 2208 __ testq(value, Immediate(kSmiTagMask));
2201 __ j(ZERO, deopt); 2209 __ j(ZERO, deopt);
2202 __ LoadClassId(temp, value); 2210 __ LoadClassId(temp, value);
2203 Label is_ok; 2211 Label is_ok;
2204 const intptr_t num_checks = ic_data()->NumberOfChecks();
2205 const bool use_near_jump = num_checks < 5; 2212 const bool use_near_jump = num_checks < 5;
2206 for (intptr_t i = 0; i < num_checks; i++) { 2213 for (intptr_t i = 0; i < num_checks; i++) {
2207 __ cmpl(temp, Immediate(ic_data()->GetReceiverClassIdAt(i))); 2214 __ cmpl(temp, Immediate(ic_data()->GetReceiverClassIdAt(i)));
2208 if (i == (num_checks - 1)) { 2215 if (i == (num_checks - 1)) {
2209 __ j(NOT_EQUAL, deopt); 2216 __ j(NOT_EQUAL, deopt);
2210 } else { 2217 } else {
2211 if (use_near_jump) { 2218 if (use_near_jump) {
2212 __ j(EQUAL, &is_ok, Assembler::kNearJump); 2219 __ j(EQUAL, &is_ok, Assembler::kNearJump);
2213 } else { 2220 } else {
2214 __ j(EQUAL, &is_ok); 2221 __ j(EQUAL, &is_ok);
2215 } 2222 }
2216 } 2223 }
2217 } 2224 }
2218 __ Bind(&is_ok); 2225 __ Bind(&is_ok);
2219 } 2226 }
2220 2227
2221 } // namespace dart 2228 } // namespace dart
2222 2229
2223 #undef __ 2230 #undef __
2224 2231
2225 #endif // defined TARGET_ARCH_X64 2232 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698