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

Unified Diff: runtime/vm/intermediate_language_arm64.cc

Issue 2152683003: Revert "VM: Array bounds checks that don't deoptimize for precompiled code." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_dbc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_arm64.cc
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
index e5431e00dd08d4fa1098f3f15f7d37bf73bc5470..642bc9ef5a39ce8050a72cf660dc8e0c504a96be 100644
--- a/runtime/vm/intermediate_language_arm64.cc
+++ b/runtime/vm/intermediate_language_arm64.cc
@@ -5254,72 +5254,8 @@ void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Label* deopt = compiler->AddDeoptStub(deopt_id(),
ICData::kDeoptCheckSmi,
licm_hoisted_ ? ICData::kHoisted : 0);
- __ BranchIfNotSmi(value, deopt);
-}
-
-
-
-LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone,
- bool opt) const {
- const intptr_t kNumInputs = 2;
- const intptr_t kNumTemps = 0;
- LocationSummary* locs = new(zone) LocationSummary(
- zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
- locs->set_in(kLengthPos, Location::RequiresRegister());
- locs->set_in(kIndexPos, Location::RequiresRegister());
- return locs;
-}
-
-
-class RangeErrorSlowPath : public SlowPathCode {
- public:
- RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index)
- : instruction_(instruction), try_index_(try_index) { }
-
- virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
- if (Assembler::EmittingComments()) {
- __ Comment("slow path check bound operation");
- }
- __ Bind(entry_label());
- LocationSummary* locs = instruction_->locs();
- __ Push(locs->in(0).reg());
- __ Push(locs->in(1).reg());
- compiler->GenerateRuntimeCall(instruction_->token_pos(),
- instruction_->deopt_id(),
- kRangeErrorRuntimeEntry,
- 2,
- instruction_->locs());
- compiler->RecordSafepoint(locs, /* slow_path_argument_count = */ 2);
- compiler->pc_descriptors_list()->AddDescriptor(
- RawPcDescriptors::kOther,
- compiler->assembler()->CodeSize(),
- instruction_->deopt_id(),
- instruction_->token_pos(),
- try_index_);
- __ brk(0);
- }
-
- private:
- GenericCheckBoundInstr* instruction_;
- intptr_t try_index_;
-};
-
-
-void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- RangeErrorSlowPath* slow_path =
- new RangeErrorSlowPath(this, compiler->CurrentTryIndex());
- compiler->AddSlowPathCode(slow_path);
-
- Location length_loc = locs()->in(kLengthPos);
- Location index_loc = locs()->in(kIndexPos);
- Register length = length_loc.reg();
- Register index = index_loc.reg();
- const intptr_t index_cid = this->index()->Type()->ToCid();
- if (index_cid != kSmiCid) {
- __ BranchIfNotSmi(index, slow_path->entry_label());
- }
- __ cmp(index, Operand(length));
- __ b(slow_path->entry_label(), CS);
+ __ tsti(value, Immediate(kSmiTagMask));
+ __ b(deopt, NE);
}
@@ -5346,7 +5282,6 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Location length_loc = locs()->in(kLengthPos);
Location index_loc = locs()->in(kIndexPos);
- const intptr_t index_cid = index()->Type()->ToCid();
if (length_loc.IsConstant() && index_loc.IsConstant()) {
// TODO(srdjan): remove this code once failures are fixed.
if ((Smi::Cast(length_loc.constant()).Value() >
@@ -5372,9 +5307,6 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
} else if (length_loc.IsConstant()) {
const Smi& length = Smi::Cast(length_loc.constant());
const Register index = index_loc.reg();
- if (index_cid != kSmiCid) {
- __ BranchIfNotSmi(index, deopt);
- }
if (length.Value() == Smi::kMaxValue) {
__ tst(index, Operand(index));
__ b(deopt, MI);
@@ -5385,9 +5317,6 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
} else {
const Register length = length_loc.reg();
const Register index = index_loc.reg();
- if (index_cid != kSmiCid) {
- __ BranchIfNotSmi(index, deopt);
- }
__ CompareRegisters(index, length);
__ b(deopt, CS);
}
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698