Chromium Code Reviews| Index: runtime/vm/intermediate_language_x64.cc |
| diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc |
| index b5cc607fe8590365b5e3ef634ac2ea10c9c040ce..745421b0b73b3065c8caa827a225d5125c04e92c 100644 |
| --- a/runtime/vm/intermediate_language_x64.cc |
| +++ b/runtime/vm/intermediate_language_x64.cc |
| @@ -1627,17 +1627,48 @@ void GuardFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| __ pushq(value_cid_reg); |
| __ movq(value_cid_reg, |
| FieldAddress(value_reg, Array::length_offset())); |
| - __ cmpq(value_cid_reg, Immediate(field_length)); |
| + __ cmpq(value_cid_reg, Immediate(Smi::RawValue(field_length))); |
| __ popq(value_cid_reg); |
| } else if (RawObject::IsTypedDataClassId(field_cid)) { |
| __ pushq(value_cid_reg); |
| __ movq(value_cid_reg, |
| FieldAddress(value_reg, TypedData::length_offset())); |
| - __ cmpq(value_cid_reg, Immediate(field_length)); |
| + __ cmpq(value_cid_reg, Immediate(Smi::RawValue(field_length))); |
| __ popq(value_cid_reg); |
| } else { |
| ASSERT(field_cid == kIllegalCid); |
|
srdjan
2013/08/28 16:00:55
Similar comments as in ia32
|
| - // Following jump cannot not occur, fall through. |
| + Label check_array, local_exit, local_fail; |
| + __ cmpq(value_cid_reg, Immediate(kNullCid)); |
| + __ j(EQUAL, &local_fail); |
| + // Check for typed data array. |
| + __ cmpq(value_cid_reg, Immediate(kTypedDataFloat32x4ArrayCid)); |
| + __ j(GREATER, &local_fail); // Not a typed array or a regular array. |
| + __ cmpq(value_cid_reg, Immediate(kTypedDataInt8ArrayCid)); |
| + __ j(LESS, &check_array); // Could still be a regular array. |
| + __ pushq(value_cid_reg); |
| + __ movq(value_cid_reg, |
| + FieldAddress(value_reg, TypedData::length_offset())); |
| + __ cmpq(field_length_operand, value_cid_reg); |
| + __ popq(value_cid_reg); |
| + __ jmp(&local_exit); |
| + // Check for regular array. |
| + __ Bind(&check_array); |
| + __ cmpq(value_cid_reg, Immediate(kImmutableArrayCid)); |
| + __ j(GREATER, &local_fail); |
| + __ cmpq(value_cid_reg, Immediate(kArrayCid)); |
| + __ j(LESS, &local_fail); |
| + __ pushq(value_cid_reg); |
| + __ movq(value_cid_reg, |
| + FieldAddress(value_reg, Array::length_offset())); |
| + __ cmpq(field_length_operand, value_cid_reg); |
| + __ popq(value_cid_reg); |
| + __ jmp(&local_exit); |
| + |
| + __ Bind(&local_fail); |
| + __ movq(field_length_operand, |
| + Immediate(Smi::RawValue(Field::kNoFixedLength))); |
| + |
| + __ Bind(&local_exit); |
| } |
| __ j(NOT_EQUAL, fail); |
| } |
| @@ -1658,22 +1689,23 @@ void GuardFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| ASSERT((value_cid_reg != value_reg) && (field_reg != value_cid_reg)); |
| } |
| ASSERT(value_cid_reg != kNoRegister); |
| - if ((field_cid == kArrayCid) || (field_cid == kImmutableArrayCid)) { |
| + if ((value_cid == kArrayCid) || (value_cid == kImmutableArrayCid)) { |
| __ pushq(value_cid_reg); |
| __ movq(value_cid_reg, |
| FieldAddress(value_reg, Array::length_offset())); |
| - __ cmpq(value_cid_reg, Immediate(field_length)); |
| + __ cmpq(value_cid_reg, Immediate(Smi::RawValue(field_length))); |
| __ popq(value_cid_reg); |
| - } else if (RawObject::IsTypedDataClassId(field_cid)) { |
| + } else if (RawObject::IsTypedDataClassId(value_cid)) { |
| __ pushq(value_cid_reg); |
| __ movq(value_cid_reg, |
| FieldAddress(value_reg, TypedData::length_offset())); |
| - __ cmpq(value_cid_reg, Immediate(field_length)); |
| + __ cmpq(value_cid_reg, Immediate(Smi::RawValue(field_length))); |
| __ popq(value_cid_reg); |
| } else { |
| ASSERT(field_cid == kIllegalCid); |
| // Following jump cannot not occur, fall through. |
| } |
| + __ j(NOT_EQUAL, fail); |
| } |
| // Not identical, possibly null. |
| __ Bind(&skip_length_check); |
| @@ -1713,7 +1745,8 @@ void GuardFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| __ jmp(&local_exit); // Updated field length from regular array. |
| __ Bind(&local_fail); |
| - __ movq(field_length_operand, Immediate(Field::kNoFixedLength)); |
| + __ movq(field_length_operand, |
| + Immediate(Smi::RawValue(Field::kNoFixedLength))); |
| __ Bind(&local_exit); |
| } |
| @@ -1727,21 +1760,23 @@ void GuardFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| ASSERT(field_reg != kNoRegister); |
| __ movq(field_cid_operand, Immediate(value_cid)); |
| __ movq(field_nullability_operand, Immediate(value_cid)); |
| - if ((value_cid == kArrayCid) || (value_cid == kImmutableArrayCid)) { |
| - // Destroy value_cid_reg (safe because we are finished with it). |
| - __ movq(value_cid_reg, |
| - FieldAddress(value_reg, Array::length_offset())); |
| - __ movq(field_length_operand, value_cid_reg); |
| - } else if (RawObject::IsTypedDataClassId(value_cid)) { |
| - // Destroy value_cid_reg (safe because we are finished with it). |
| - __ movq(value_cid_reg, |
| - FieldAddress(value_reg, TypedData::length_offset())); |
| - __ movq(field_length_operand, value_cid_reg); |
| - } else { |
| - __ movq(field_length_operand, Immediate(Field::kNoFixedLength)); |
| + if (field_has_length) { |
| + if ((value_cid == kArrayCid) || (value_cid == kImmutableArrayCid)) { |
| + // Destroy value_cid_reg (safe because we are finished with it). |
| + __ movq(value_cid_reg, |
| + FieldAddress(value_reg, Array::length_offset())); |
| + __ movq(field_length_operand, value_cid_reg); |
| + } else if (RawObject::IsTypedDataClassId(value_cid)) { |
| + // Destroy value_cid_reg (safe because we are finished with it). |
| + __ movq(value_cid_reg, |
| + FieldAddress(value_reg, TypedData::length_offset())); |
| + __ movq(field_length_operand, value_cid_reg); |
| + } else { |
| + __ movq(field_length_operand, |
| + Immediate(Smi::RawValue(Field::kNoFixedLength))); |
| + } |
| } |
| } |
| - |
| if (!ok_is_fall_through) { |
| __ jmp(&ok); |
| } |
| @@ -1810,7 +1845,7 @@ void GuardFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| __ movq(value_cid_reg, |
| FieldAddress(value_reg, TypedData::length_offset())); |
| } |
| - __ cmpq(value_cid_reg, Immediate(field_length)); |
| + __ cmpq(value_cid_reg, Immediate(Smi::RawValue(field_length))); |
| if (ok_is_fall_through) { |
| __ j(NOT_EQUAL, fail); |
| } |