| Index: runtime/vm/intermediate_language_x64.cc
|
| diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
|
| index c5a1bf3af2a6a1a2ff56a8a6b044f5122cf1ba19..5ebc8f873ce24cf662da44e58a0643be96f52a1a 100644
|
| --- a/runtime/vm/intermediate_language_x64.cc
|
| +++ b/runtime/vm/intermediate_language_x64.cc
|
| @@ -4437,6 +4437,24 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| return;
|
| }
|
|
|
| + intptr_t guarded_array_length = -1;
|
| + if (array_ != NULL) {
|
| + if (array_->guarded_list_length() >= 0) {
|
| + guarded_array_length = array_->guarded_list_length();
|
| + }
|
| + }
|
| +
|
| + if (index_loc.IsConstant() && guarded_array_length >= 0) {
|
| + const Object& index = Smi::Cast(index_loc.constant());
|
| + int64_t i = reinterpret_cast<int64_t>(index.raw());
|
| + if (i >= guarded_array_length) {
|
| + // We know this bounds check will trigger a deoptimization.
|
| + __ jmp(deopt);
|
| + }
|
| + // Nothing to emit.
|
| + return;
|
| + }
|
| +
|
| if (index_loc.IsConstant()) {
|
| Register length = length_loc.reg();
|
| const Smi& index = Smi::Cast(index_loc.constant());
|
|
|