| Index: runtime/vm/intermediate_language.cc
|
| diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
|
| index 069528f16caff523eacd1fd4959aad9043416f87..10292764b10394e5f6bf687ca695fda55bd1953c 100644
|
| --- a/runtime/vm/intermediate_language.cc
|
| +++ b/runtime/vm/intermediate_language.cc
|
| @@ -1125,6 +1125,11 @@ RawAbstractType* CheckArrayBoundInstr::CompileType() const {
|
| }
|
|
|
|
|
| +RawAbstractType* CheckBoundInstr::CompileType() const {
|
| + return AbstractType::null();
|
| +}
|
| +
|
| +
|
| RawAbstractType* CheckEitherNonSmiInstr::CompileType() const {
|
| return AbstractType::null();
|
| }
|
| @@ -1181,6 +1186,28 @@ Definition* CheckEitherNonSmiInstr::Canonicalize() {
|
| }
|
|
|
|
|
| +Definition* CheckArrayBoundInstr::Canonicalize() {
|
| + if (array_type() == kArrayCid) {
|
| + // For fixed length arrays check if array is the result of a constructor
|
| + // call. In this case we can use the length passed to the constructor
|
| + // instead of loading it from array itself.
|
| + StaticCallInstr* allocation = array()->definition()->AsStaticCall();
|
| + if ((allocation != NULL) &&
|
| + allocation->is_known_constructor() &&
|
| + (allocation->ResultCid() == kArrayCid)) {
|
| + CheckBoundInstr* check =
|
| + new CheckBoundInstr(allocation->ArgumentAt(0)->value()->Copy(),
|
| + index(),
|
| + deopt_id_);
|
| + check->set_env(env());
|
| + set_env(NULL);
|
| + return check;
|
| + }
|
| + }
|
| + return this;
|
| +}
|
| +
|
| +
|
| // Shared code generation methods (EmitNativeCode, MakeLocationSummary, and
|
| // PrepareEntry). Only assembly code that can be shared across all architectures
|
| // can be used. Machine specific register allocation and code generation
|
|
|