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

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

Issue 2149023002: VM: Array bounds checks that don't deoptimize for precompiled code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix dbc build 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_DBC. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC.
6 #if defined(TARGET_ARCH_DBC) 6 #if defined(TARGET_ARCH_DBC)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 M(ShiftUint32Op) \ 94 M(ShiftUint32Op) \
95 M(UnaryUint32Op) \ 95 M(UnaryUint32Op) \
96 M(UnboxedIntConverter) \ 96 M(UnboxedIntConverter) \
97 M(BoxInteger32) \ 97 M(BoxInteger32) \
98 M(UnboxInteger32) \ 98 M(UnboxInteger32) \
99 M(CheckedSmiOp) \ 99 M(CheckedSmiOp) \
100 100
101 // List of instructions that are not used by DBC. 101 // List of instructions that are not used by DBC.
102 #define FOR_EACH_UNREACHABLE_INSTRUCTION(M) \ 102 #define FOR_EACH_UNREACHABLE_INSTRUCTION(M) \
103 M(CaseInsensitiveCompareUC16) \ 103 M(CaseInsensitiveCompareUC16) \
104 M(GenericCheckBound) \
104 M(GrowRegExpStack) \ 105 M(GrowRegExpStack) \
105 M(IndirectGoto) 106 M(IndirectGoto)
106 107
107 // Location summaries actually are not used by the unoptimizing DBC compiler 108 // Location summaries actually are not used by the unoptimizing DBC compiler
108 // because we don't allocate any registers. 109 // because we don't allocate any registers.
109 static LocationSummary* CreateLocationSummary( 110 static LocationSummary* CreateLocationSummary(
110 Zone* zone, 111 Zone* zone,
111 intptr_t num_inputs, 112 intptr_t num_inputs,
112 Location output = Location::NoLocation(), 113 Location output = Location::NoLocation(),
113 LocationSummary::ContainsCall contains_call = LocationSummary::kNoCall) { 114 LocationSummary::ContainsCall contains_call = LocationSummary::kNoCall) {
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 BranchInstr* branch) { 1344 BranchInstr* branch) {
1344 BranchLabels labels = compiler->CreateBranchLabels(branch); 1345 BranchLabels labels = compiler->CreateBranchLabels(branch);
1345 Condition true_condition = EmitComparisonCode(compiler, labels); 1346 Condition true_condition = EmitComparisonCode(compiler, labels);
1346 EmitBranchOnCondition(compiler, true_condition, labels); 1347 EmitBranchOnCondition(compiler, true_condition, labels);
1347 } 1348 }
1348 1349
1349 1350
1350 EMIT_NATIVE_CODE(CheckArrayBound, 2) { 1351 EMIT_NATIVE_CODE(CheckArrayBound, 2) {
1351 const Register length = locs()->in(kLengthPos).reg(); 1352 const Register length = locs()->in(kLengthPos).reg();
1352 const Register index = locs()->in(kIndexPos).reg(); 1353 const Register index = locs()->in(kIndexPos).reg();
1354 const intptr_t index_cid = this->index()->Type()->ToCid();
1355 if (index_cid != kSmiCid) {
1356 __ CheckSmi(index);
1357 compiler->EmitDeopt(deopt_id(),
1358 ICData::kDeoptCheckArrayBound,
1359 (generalized_ ? ICData::kGeneralized : 0) |
1360 (licm_hoisted_ ? ICData::kHoisted : 0));
1361 }
1353 __ IfULe(length, index); 1362 __ IfULe(length, index);
1354 compiler->EmitDeopt(deopt_id(), 1363 compiler->EmitDeopt(deopt_id(),
1355 ICData::kDeoptCheckArrayBound, 1364 ICData::kDeoptCheckArrayBound,
1356 (generalized_ ? ICData::kGeneralized : 0) | 1365 (generalized_ ? ICData::kGeneralized : 0) |
1357 (licm_hoisted_ ? ICData::kHoisted : 0)); 1366 (licm_hoisted_ ? ICData::kHoisted : 0));
1358 } 1367 }
1359 1368
1360 } // namespace dart 1369 } // namespace dart
1361 1370
1362 #endif // defined TARGET_ARCH_DBC 1371 #endif // defined TARGET_ARCH_DBC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698