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

Side by Side Diff: runtime/vm/intermediate_language_dbc.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) 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 if (labels.fall_through != labels.true_label) { 475 if (labels.fall_through != labels.true_label) {
476 // The preceeding Jump instruction will be skipped if the test succeeds. 476 // The preceeding Jump instruction will be skipped if the test succeeds.
477 // If we aren't falling through to the true case, then we have to do 477 // If we aren't falling through to the true case, then we have to do
478 // a Jump to it here. 478 // a Jump to it here.
479 __ Jump(labels.true_label); 479 __ Jump(labels.true_label);
480 } 480 }
481 } 481 }
482 } 482 }
483 483
484 484
485 Condition SmiRangeComparisonInstr::GetNextInstructionCondition(
486 FlowGraphCompiler* compiler,
487 BranchLabels labels) {
488 return is_negated_ ? NEXT_IS_TRUE : NEXT_IS_FALSE;
489 }
490
491
492 Condition SmiRangeComparisonInstr::EmitComparisonCode(
493 FlowGraphCompiler* compiler,
494 BranchLabels labels) {
495 __ CheckClassIdRange(locs()->in(0).reg(),
496 compiler->ToEmbeddableCid(from_, this));
497 __ Nop(__ AddConstant(Smi::Handle(Smi::New(to_ - from_))));
498 return is_negated_ ? NEXT_IS_TRUE : NEXT_IS_FALSE;
499 }
500
501
502 DEFINE_MAKE_LOCATION_SUMMARY(SmiRangeComparison, 1)
503
504
485 Condition StrictCompareInstr::GetNextInstructionCondition( 505 Condition StrictCompareInstr::GetNextInstructionCondition(
486 FlowGraphCompiler* compiler, 506 FlowGraphCompiler* compiler,
487 BranchLabels labels) { 507 BranchLabels labels) {
488 return (labels.fall_through == labels.false_label) ? NEXT_IS_TRUE 508 return (labels.fall_through == labels.false_label) ? NEXT_IS_TRUE
489 : NEXT_IS_FALSE; 509 : NEXT_IS_FALSE;
490 } 510 }
491 511
492 512
493 Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, 513 Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
494 BranchLabels labels) { 514 BranchLabels labels) {
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 } 2083 }
2064 __ IfULe(length, index); 2084 __ IfULe(length, index);
2065 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound, 2085 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound,
2066 (generalized_ ? ICData::kGeneralized : 0) | 2086 (generalized_ ? ICData::kGeneralized : 0) |
2067 (licm_hoisted_ ? ICData::kHoisted : 0)); 2087 (licm_hoisted_ ? ICData::kHoisted : 0));
2068 } 2088 }
2069 2089
2070 } // namespace dart 2090 } // namespace dart
2071 2091
2072 #endif // defined TARGET_ARCH_DBC 2092 #endif // defined TARGET_ARCH_DBC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698