| Index: src/x64/lithium-codegen-x64.cc
|
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
|
| index 8e887cd915f0e68b5a9d110796caa96b6e752629..cab8d377b0a1291076ffafa12aa49d38aa7e227c 100644
|
| --- a/src/x64/lithium-codegen-x64.cc
|
| +++ b/src/x64/lithium-codegen-x64.cc
|
| @@ -3774,11 +3774,17 @@ void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
|
| __ cmpq(reg, reg2);
|
| }
|
| } else {
|
| + Operand length = ToOperand(instr->length());
|
| if (instr->index()->IsConstantOperand()) {
|
| - __ cmpq(ToOperand(instr->length()),
|
| - Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
|
| + int constant_index =
|
| + ToInteger32(LConstantOperand::cast(instr->index()));
|
| + if (instr->hydrogen()->length()->representation().IsTagged()) {
|
| + __ Cmp(length, Smi::FromInt(constant_index));
|
| + } else {
|
| + __ cmpq(length, Immediate(constant_index));
|
| + }
|
| } else {
|
| - __ cmpq(ToOperand(instr->length()), ToRegister(instr->index()));
|
| + __ cmpq(length, ToRegister(instr->index()));
|
| }
|
| }
|
| DeoptimizeIf(below_equal, instr->environment());
|
|
|