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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_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 "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 6562 matching lines...) Expand 10 before | Expand all | Expand 10 after
6573 if (offset()->definition()->representation() == kTagged) { 6573 if (offset()->definition()->representation() == kTagged) {
6574 __ SmiUntag(offset_reg); 6574 __ SmiUntag(offset_reg);
6575 } 6575 }
6576 __ addl(target_reg, offset_reg); 6576 __ addl(target_reg, offset_reg);
6577 6577
6578 // Jump to the absolute address. 6578 // Jump to the absolute address.
6579 __ jmp(target_reg); 6579 __ jmp(target_reg);
6580 } 6580 }
6581 6581
6582 6582
6583 LocationSummary* SmiRangeComparisonInstr::MakeLocationSummary(Zone* zone,
6584 bool opt) const {
6585 const intptr_t kNumInputs = 1;
6586 const intptr_t kNumTemps = 1;
6587 LocationSummary* locs = new (zone)
6588 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
6589 locs->set_in(0, Location::RequiresRegister());
6590 locs->set_temp(0, Location::RequiresRegister());
6591 return locs;
6592 }
6593
6594
6595 Condition SmiRangeComparisonInstr::EmitComparisonCode(
6596 FlowGraphCompiler* compiler,
6597 BranchLabels labels) {
6598 Register in = locs()->in(0).reg();
6599 Register temp = locs()->temp(0).reg();
6600 __ leal(temp, Address(in, Smi::RawValue(-from_)));
6601 __ cmpl(temp, Immediate(Smi::RawValue(to_ - from_)));
6602 return is_negated_ ? ABOVE : BELOW_EQUAL;
6603 }
6604
6605
6583 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, 6606 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone,
6584 bool opt) const { 6607 bool opt) const {
6585 const intptr_t kNumInputs = 2; 6608 const intptr_t kNumInputs = 2;
6586 const intptr_t kNumTemps = 0; 6609 const intptr_t kNumTemps = 0;
6587 if (needs_number_check()) { 6610 if (needs_number_check()) {
6588 LocationSummary* locs = new (zone) 6611 LocationSummary* locs = new (zone)
6589 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); 6612 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall);
6590 locs->set_in(0, Location::RegisterLocation(EAX)); 6613 locs->set_in(0, Location::RegisterLocation(EAX));
6591 locs->set_in(1, Location::RegisterLocation(ECX)); 6614 locs->set_in(1, Location::RegisterLocation(ECX));
6592 locs->set_out(0, Location::RegisterLocation(EAX)); 6615 locs->set_out(0, Location::RegisterLocation(EAX));
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
6785 __ Call(*StubCode::DebugStepCheck_entry()); 6808 __ Call(*StubCode::DebugStepCheck_entry());
6786 compiler->EmitCallsiteMetaData(token_pos(), deopt_id_, stub_kind_, locs()); 6809 compiler->EmitCallsiteMetaData(token_pos(), deopt_id_, stub_kind_, locs());
6787 } 6810 }
6788 6811
6789 6812
6790 } // namespace dart 6813 } // namespace dart
6791 6814
6792 #undef __ 6815 #undef __
6793 6816
6794 #endif // defined TARGET_ARCH_IA32 6817 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698