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

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

Issue 10911057: Add check for non-smi to the IL and use it for class checks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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.cc ('k') | runtime/vm/intermediate_language_x64.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 (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 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 return summary; 2093 return summary;
2094 } 2094 }
2095 2095
2096 2096
2097 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { 2097 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) {
2098 Register value = locs()->in(0).reg(); 2098 Register value = locs()->in(0).reg();
2099 Register temp = locs()->temp(0).reg(); 2099 Register temp = locs()->temp(0).reg();
2100 Label* deopt = compiler->AddDeoptStub(deopt_id(), 2100 Label* deopt = compiler->AddDeoptStub(deopt_id(),
2101 kDeoptCheckClass); 2101 kDeoptCheckClass);
2102 ASSERT(unary_checks().GetReceiverClassIdAt(0) != kSmiCid); 2102 ASSERT(unary_checks().GetReceiverClassIdAt(0) != kSmiCid);
2103 __ testl(value, Immediate(kSmiTagMask));
2104 __ j(ZERO, deopt);
2105 __ LoadClassId(temp, value); 2103 __ LoadClassId(temp, value);
2106 Label is_ok; 2104 Label is_ok;
2107 const intptr_t num_checks = unary_checks().NumberOfChecks(); 2105 const intptr_t num_checks = unary_checks().NumberOfChecks();
2108 const bool use_near_jump = num_checks < 5; 2106 const bool use_near_jump = num_checks < 5;
2109 for (intptr_t i = 0; i < num_checks; i++) { 2107 for (intptr_t i = 0; i < num_checks; i++) {
2110 __ cmpl(temp, Immediate(unary_checks().GetReceiverClassIdAt(i))); 2108 __ cmpl(temp, Immediate(unary_checks().GetReceiverClassIdAt(i)));
2111 if (i == (num_checks - 1)) { 2109 if (i == (num_checks - 1)) {
2112 __ j(NOT_EQUAL, deopt); 2110 __ j(NOT_EQUAL, deopt);
2113 } else { 2111 } else {
2114 if (use_near_jump) { 2112 if (use_near_jump) {
(...skipping 12 matching lines...) Expand all
2127 const intptr_t kNumTemps = 0; 2125 const intptr_t kNumTemps = 0;
2128 LocationSummary* summary = 2126 LocationSummary* summary =
2129 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2127 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2130 summary->set_in(0, Location::RequiresRegister()); 2128 summary->set_in(0, Location::RequiresRegister());
2131 return summary; 2129 return summary;
2132 } 2130 }
2133 2131
2134 2132
2135 void CheckSmiComp::EmitNativeCode(FlowGraphCompiler* compiler) { 2133 void CheckSmiComp::EmitNativeCode(FlowGraphCompiler* compiler) {
2136 Register value = locs()->in(0).reg(); 2134 Register value = locs()->in(0).reg();
2137 Label* deopt = compiler->AddDeoptStub(deopt_id(), 2135 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckSmi);
2138 kDeoptCheckSmi);
2139 __ testl(value, Immediate(kSmiTagMask)); 2136 __ testl(value, Immediate(kSmiTagMask));
2140 __ j(NOT_ZERO, deopt); 2137 __ j(NOT_ZERO, deopt);
2141 } 2138 }
2142 2139
2143 2140
2141 LocationSummary* CheckNonSmiComp::MakeLocationSummary() const {
2142 const intptr_t kNumInputs = 1;
2143 const intptr_t kNumTemps = 0;
2144 LocationSummary* summary =
2145 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2146 summary->set_in(0, Location::RequiresRegister());
2147 return summary;
2148 }
2149
2150
2151 void CheckNonSmiComp::EmitNativeCode(FlowGraphCompiler* compiler) {
2152 Register value = locs()->in(0).reg();
2153 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckNonSmi);
2154 __ testl(value, Immediate(kSmiTagMask));
2155 __ j(ZERO, deopt);
2156 }
2157
2158
2144 LocationSummary* CheckArrayBoundComp::MakeLocationSummary() const { 2159 LocationSummary* CheckArrayBoundComp::MakeLocationSummary() const {
2145 return LocationSummary::Make(2, 2160 return LocationSummary::Make(2,
2146 Location::NoLocation(), 2161 Location::NoLocation(),
2147 LocationSummary::kNoCall); 2162 LocationSummary::kNoCall);
2148 } 2163 }
2149 2164
2150 2165
2151 void CheckArrayBoundComp::EmitNativeCode(FlowGraphCompiler* compiler) { 2166 void CheckArrayBoundComp::EmitNativeCode(FlowGraphCompiler* compiler) {
2152 Register receiver = locs()->in(0).reg(); 2167 Register receiver = locs()->in(0).reg();
2153 Register index = locs()->in(1).reg(); 2168 Register index = locs()->in(1).reg();
(...skipping 15 matching lines...) Expand all
2169 } 2184 }
2170 __ j(ABOVE_EQUAL, deopt); 2185 __ j(ABOVE_EQUAL, deopt);
2171 } 2186 }
2172 2187
2173 2188
2174 } // namespace dart 2189 } // namespace dart
2175 2190
2176 #undef __ 2191 #undef __
2177 2192
2178 #endif // defined TARGET_ARCH_X64 2193 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698