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

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

Issue 2955073005: VM-codegen: Add IL instruction to check if a Smi is in a constant range
Patch Set: Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 6488 matching lines...) Expand 10 before | Expand all | Expand 10 after
6499 // Calculate the final absolute address. 6499 // Calculate the final absolute address.
6500 if (offset()->definition()->representation() == kTagged) { 6500 if (offset()->definition()->representation() == kTagged) {
6501 __ SmiUntag(offset_reg); 6501 __ SmiUntag(offset_reg);
6502 } 6502 }
6503 __ addq(target_address_reg, offset_reg); 6503 __ addq(target_address_reg, offset_reg);
6504 6504
6505 // Jump to the absolute address. 6505 // Jump to the absolute address.
6506 __ jmp(target_address_reg); 6506 __ jmp(target_address_reg);
6507 } 6507 }
6508 6508
6509
6510 LocationSummary* SmiRangeComparisonInstr::MakeLocationSummary(Zone* zone,
6511 bool opt) const {
6512 const intptr_t kNumInputs = 1;
6513 const intptr_t kNumTemps = 1;
6514 LocationSummary* locs = new (zone)
6515 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6516 locs->set_in(0, Location::RequiresRegister());
6517 locs->set_temp(0, Location::RequiresRegister());
6518 return locs;
6519 }
6520
6521
6522 Condition SmiRangeComparisonInstr::EmitComparisonCode(
6523 FlowGraphCompiler* compiler,
6524 BranchLabels labels) {
6525 Register in = locs()->in(0).reg();
6526 Register temp = locs()->temp(0).reg();
6527 __ leaq(temp, Address(in, Smi::RawValue(-from_)));
6528 __ cmpq(temp, Immediate(Smi::RawValue(to_ - from_)));
6529 return is_negated_ ? ABOVE : BELOW_EQUAL;
6530 }
6531
6532
6509 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, 6533 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone,
6510 bool opt) const { 6534 bool opt) const {
6511 const intptr_t kNumInputs = 2; 6535 const intptr_t kNumInputs = 2;
6512 const intptr_t kNumTemps = 0; 6536 const intptr_t kNumTemps = 0;
6513 if (needs_number_check()) { 6537 if (needs_number_check()) {
6514 LocationSummary* locs = new (zone) 6538 LocationSummary* locs = new (zone)
6515 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); 6539 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall);
6516 locs->set_in(0, Location::RegisterLocation(RAX)); 6540 locs->set_in(0, Location::RegisterLocation(RAX));
6517 locs->set_in(1, Location::RegisterLocation(RCX)); 6541 locs->set_in(1, Location::RegisterLocation(RCX));
6518 locs->set_out(0, Location::RegisterLocation(RAX)); 6542 locs->set_out(0, Location::RegisterLocation(RAX));
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
6646 compiler->AddCurrentDescriptor(stub_kind_, deopt_id_, token_pos()); 6670 compiler->AddCurrentDescriptor(stub_kind_, deopt_id_, token_pos());
6647 compiler->RecordSafepoint(locs()); 6671 compiler->RecordSafepoint(locs());
6648 } 6672 }
6649 6673
6650 6674
6651 } // namespace dart 6675 } // namespace dart
6652 6676
6653 #undef __ 6677 #undef __
6654 6678
6655 #endif // defined TARGET_ARCH_X64 6679 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698