| 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 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2265 __ cmpq(FieldAddress(receiver, length_offset), Immediate(imm)); | 2265 __ cmpq(FieldAddress(receiver, length_offset), Immediate(imm)); |
| 2266 __ j(BELOW_EQUAL, deopt); | 2266 __ j(BELOW_EQUAL, deopt); |
| 2267 } else { | 2267 } else { |
| 2268 Register index = locs()->in(1).reg(); | 2268 Register index = locs()->in(1).reg(); |
| 2269 __ cmpq(index, FieldAddress(receiver, length_offset)); | 2269 __ cmpq(index, FieldAddress(receiver, length_offset)); |
| 2270 __ j(ABOVE_EQUAL, deopt); | 2270 __ j(ABOVE_EQUAL, deopt); |
| 2271 } | 2271 } |
| 2272 } | 2272 } |
| 2273 | 2273 |
| 2274 | 2274 |
| 2275 LocationSummary* CheckBoundInstr::MakeLocationSummary() const { |
| 2276 const intptr_t kNumInputs = 2; |
| 2277 const intptr_t kNumTemps = 0; |
| 2278 LocationSummary* locs = |
| 2279 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2280 locs->set_in(0, Location::RequiresRegister()); |
| 2281 locs->set_in(1, Location::RegisterOrConstant(index())); |
| 2282 return locs; |
| 2283 } |
| 2284 |
| 2285 |
| 2286 void CheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2287 Register length = locs()->in(0).reg(); |
| 2288 |
| 2289 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
| 2290 kDeoptLoadIndexedFixedArray); |
| 2291 |
| 2292 if (locs()->in(1).IsConstant()) { |
| 2293 const Object& constant = locs()->in(1).constant(); |
| 2294 ASSERT(constant.IsSmi()); |
| 2295 const int64_t imm = |
| 2296 reinterpret_cast<int64_t>(constant.raw()); |
| 2297 __ cmpq(length, Immediate(imm)); |
| 2298 __ j(BELOW_EQUAL, deopt); |
| 2299 } else { |
| 2300 Register index = locs()->in(1).reg(); |
| 2301 __ cmpq(index, length); |
| 2302 __ j(ABOVE_EQUAL, deopt); |
| 2303 } |
| 2304 } |
| 2305 |
| 2306 |
| 2275 } // namespace dart | 2307 } // namespace dart |
| 2276 | 2308 |
| 2277 #undef __ | 2309 #undef __ |
| 2278 | 2310 |
| 2279 #endif // defined TARGET_ARCH_X64 | 2311 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |