| OLD | NEW |
| 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 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 return summary; | 2107 return summary; |
| 2108 } | 2108 } |
| 2109 | 2109 |
| 2110 | 2110 |
| 2111 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 2111 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2112 Register value = locs()->in(0).reg(); | 2112 Register value = locs()->in(0).reg(); |
| 2113 Register temp = locs()->temp(0).reg(); | 2113 Register temp = locs()->temp(0).reg(); |
| 2114 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 2114 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
| 2115 kDeoptCheckClass); | 2115 kDeoptCheckClass); |
| 2116 ASSERT(unary_checks().GetReceiverClassIdAt(0) != kSmiCid); | 2116 ASSERT(unary_checks().GetReceiverClassIdAt(0) != kSmiCid); |
| 2117 __ testq(value, Immediate(kSmiTagMask)); | |
| 2118 __ j(ZERO, deopt); | |
| 2119 __ LoadClassId(temp, value); | 2117 __ LoadClassId(temp, value); |
| 2120 Label is_ok; | 2118 Label is_ok; |
| 2121 const intptr_t num_checks = unary_checks().NumberOfChecks(); | 2119 const intptr_t num_checks = unary_checks().NumberOfChecks(); |
| 2122 const bool use_near_jump = num_checks < 5; | 2120 const bool use_near_jump = num_checks < 5; |
| 2123 for (intptr_t i = 0; i < num_checks; i++) { | 2121 for (intptr_t i = 0; i < num_checks; i++) { |
| 2124 __ cmpl(temp, Immediate(unary_checks().GetReceiverClassIdAt(i))); | 2122 __ cmpl(temp, Immediate(unary_checks().GetReceiverClassIdAt(i))); |
| 2125 if (i == (num_checks - 1)) { | 2123 if (i == (num_checks - 1)) { |
| 2126 __ j(NOT_EQUAL, deopt); | 2124 __ j(NOT_EQUAL, deopt); |
| 2127 } else { | 2125 } else { |
| 2128 if (use_near_jump) { | 2126 if (use_near_jump) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2141 const intptr_t kNumTemps = 0; | 2139 const intptr_t kNumTemps = 0; |
| 2142 LocationSummary* summary = | 2140 LocationSummary* summary = |
| 2143 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2141 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2144 summary->set_in(0, Location::RequiresRegister()); | 2142 summary->set_in(0, Location::RequiresRegister()); |
| 2145 return summary; | 2143 return summary; |
| 2146 } | 2144 } |
| 2147 | 2145 |
| 2148 | 2146 |
| 2149 void CheckSmiComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 2147 void CheckSmiComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2150 Register value = locs()->in(0).reg(); | 2148 Register value = locs()->in(0).reg(); |
| 2151 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 2149 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckSmi); |
| 2152 kDeoptCheckSmi); | |
| 2153 __ testq(value, Immediate(kSmiTagMask)); | 2150 __ testq(value, Immediate(kSmiTagMask)); |
| 2154 __ j(NOT_ZERO, deopt); | 2151 __ j(NOT_ZERO, deopt); |
| 2155 } | 2152 } |
| 2156 | 2153 |
| 2157 | 2154 |
| 2155 LocationSummary* CheckNonSmiComp::MakeLocationSummary() const { |
| 2156 const intptr_t kNumInputs = 1; |
| 2157 const intptr_t kNumTemps = 0; |
| 2158 LocationSummary* summary = |
| 2159 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2160 summary->set_in(0, Location::RequiresRegister()); |
| 2161 return summary; |
| 2162 } |
| 2163 |
| 2164 |
| 2165 void CheckNonSmiComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2166 Register value = locs()->in(0).reg(); |
| 2167 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckNonSmi); |
| 2168 __ testl(value, Immediate(kSmiTagMask)); |
| 2169 __ j(ZERO, deopt); |
| 2170 } |
| 2171 |
| 2172 |
| 2158 LocationSummary* CheckArrayBoundComp::MakeLocationSummary() const { | 2173 LocationSummary* CheckArrayBoundComp::MakeLocationSummary() const { |
| 2159 return LocationSummary::Make(2, | 2174 return LocationSummary::Make(2, |
| 2160 Location::NoLocation(), | 2175 Location::NoLocation(), |
| 2161 LocationSummary::kNoCall); | 2176 LocationSummary::kNoCall); |
| 2162 } | 2177 } |
| 2163 | 2178 |
| 2164 | 2179 |
| 2165 void CheckArrayBoundComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 2180 void CheckArrayBoundComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2166 Register receiver = locs()->in(0).reg(); | 2181 Register receiver = locs()->in(0).reg(); |
| 2167 Register index = locs()->in(1).reg(); | 2182 Register index = locs()->in(1).reg(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2183 } | 2198 } |
| 2184 __ j(ABOVE_EQUAL, deopt); | 2199 __ j(ABOVE_EQUAL, deopt); |
| 2185 } | 2200 } |
| 2186 | 2201 |
| 2187 | 2202 |
| 2188 } // namespace dart | 2203 } // namespace dart |
| 2189 | 2204 |
| 2190 #undef __ | 2205 #undef __ |
| 2191 | 2206 |
| 2192 #endif // defined TARGET_ARCH_X64 | 2207 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |