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

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

Issue 10824349: Implement class id checks as a separate instruction and add a local CSE optimization pass. (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') | runtime/vm/vm_sources.gypi » ('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 (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 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 try_index(), 2136 try_index(),
2137 function_name, 2137 function_name,
2138 kNumArguments, 2138 kNumArguments,
2139 Array::ZoneHandle(), // No optional arguments. 2139 Array::ZoneHandle(), // No optional arguments.
2140 kNumArgsChecked, 2140 kNumArgsChecked,
2141 locs()->stack_bitmap()); 2141 locs()->stack_bitmap());
2142 __ CompareObject(RAX, compiler->bool_true()); 2142 __ CompareObject(RAX, compiler->bool_true());
2143 EmitBranchOnCondition(compiler, branch_condition); 2143 EmitBranchOnCondition(compiler, branch_condition);
2144 } 2144 }
2145 2145
2146
2147 LocationSummary* CheckClassComp::MakeLocationSummary() const {
2148 const intptr_t kNumInputs = 1;
2149 const intptr_t kNumTemps = 1;
2150 LocationSummary* summary =
2151 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2152 summary->set_in(0, Location::RequiresRegister());
2153 summary->set_temp(0, Location::RequiresRegister());
2154 return summary;
2155 }
2156
2157
2158 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) {
2159 Register value = locs()->in(0).reg();
2160 Register temp = locs()->temp(0).reg();
2161 Label* deopt = compiler->AddDeoptStub(deopt_id(),
2162 try_index(),
2163 kDeoptCheckClass,
2164 value);
2165 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmiCid);
2166 __ testq(value, Immediate(kSmiTagMask));
2167 __ j(ZERO, deopt);
2168 __ LoadClassId(temp, value);
2169 Label is_ok;
2170 const intptr_t num_checks = ic_data()->NumberOfChecks();
2171 const bool use_near_jump = num_checks < 5;
2172 for (intptr_t i = 0; i < num_checks; i++) {
2173 __ cmpl(temp, Immediate(ic_data()->GetReceiverClassIdAt(i)));
2174 if (i == (num_checks - 1)) {
2175 __ j(NOT_EQUAL, deopt);
2176 } else {
2177 if (use_near_jump) {
2178 __ j(EQUAL, &is_ok, Assembler::kNearJump);
2179 } else {
2180 __ j(EQUAL, &is_ok);
2181 }
2182 }
2183 }
2184 __ Bind(&is_ok);
2185 }
2186
2146 } // namespace dart 2187 } // namespace dart
2147 2188
2148 #undef __ 2189 #undef __
2149 2190
2150 #endif // defined TARGET_ARCH_X64 2191 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698