| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 4105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4116 __ j(NegateCondition(cc), &done, Label::kNear); | 4116 __ j(NegateCondition(cc), &done, Label::kNear); |
| 4117 __ int3(); | 4117 __ int3(); |
| 4118 __ bind(&done); | 4118 __ bind(&done); |
| 4119 } else { | 4119 } else { |
| 4120 DeoptimizeIf(cc, check->environment()); | 4120 DeoptimizeIf(cc, check->environment()); |
| 4121 } | 4121 } |
| 4122 } | 4122 } |
| 4123 | 4123 |
| 4124 | 4124 |
| 4125 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4125 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4126 if (instr->hydrogen()->skip_check()) return; | 4126 HBoundsCheck* hinstr = instr->hydrogen(); |
| 4127 if (hinstr->skip_check()) return; |
| 4128 |
| 4129 Representation representation = hinstr->length()->representation(); |
| 4130 ASSERT(representation.Equals(hinstr->index()->representation())); |
| 4131 ASSERT(representation.IsSmiOrInteger32()); |
| 4127 | 4132 |
| 4128 if (instr->length()->IsRegister()) { | 4133 if (instr->length()->IsRegister()) { |
| 4129 Register reg = ToRegister(instr->length()); | 4134 Register reg = ToRegister(instr->length()); |
| 4130 if (!instr->hydrogen()->length()->representation().IsSmi()) { | 4135 |
| 4131 __ AssertZeroExtended(reg); | |
| 4132 } | |
| 4133 if (instr->index()->IsConstantOperand()) { | 4136 if (instr->index()->IsConstantOperand()) { |
| 4134 int32_t constant_index = | 4137 int32_t constant_index = |
| 4135 ToInteger32(LConstantOperand::cast(instr->index())); | 4138 ToInteger32(LConstantOperand::cast(instr->index())); |
| 4136 if (instr->hydrogen()->length()->representation().IsSmi()) { | 4139 if (representation.IsSmi()) { |
| 4137 __ Cmp(reg, Smi::FromInt(constant_index)); | 4140 __ Cmp(reg, Smi::FromInt(constant_index)); |
| 4138 } else { | 4141 } else { |
| 4139 __ cmpq(reg, Immediate(constant_index)); | 4142 __ cmpl(reg, Immediate(constant_index)); |
| 4140 } | 4143 } |
| 4141 } else { | 4144 } else { |
| 4142 Register reg2 = ToRegister(instr->index()); | 4145 Register reg2 = ToRegister(instr->index()); |
| 4143 if (!instr->hydrogen()->index()->representation().IsSmi()) { | 4146 if (representation.IsSmi()) { |
| 4144 __ AssertZeroExtended(reg2); | 4147 __ cmpq(reg, reg2); |
| 4148 } else { |
| 4149 __ cmpl(reg, reg2); |
| 4145 } | 4150 } |
| 4146 __ cmpq(reg, reg2); | |
| 4147 } | 4151 } |
| 4148 } else { | 4152 } else { |
| 4149 Operand length = ToOperand(instr->length()); | 4153 Operand length = ToOperand(instr->length()); |
| 4150 if (instr->index()->IsConstantOperand()) { | 4154 if (instr->index()->IsConstantOperand()) { |
| 4151 int32_t constant_index = | 4155 int32_t constant_index = |
| 4152 ToInteger32(LConstantOperand::cast(instr->index())); | 4156 ToInteger32(LConstantOperand::cast(instr->index())); |
| 4153 if (instr->hydrogen()->length()->representation().IsSmi()) { | 4157 if (representation.IsSmi()) { |
| 4154 __ Cmp(length, Smi::FromInt(constant_index)); | 4158 __ Cmp(length, Smi::FromInt(constant_index)); |
| 4155 } else { | 4159 } else { |
| 4156 __ cmpq(length, Immediate(constant_index)); | 4160 __ cmpl(length, Immediate(constant_index)); |
| 4157 } | 4161 } |
| 4158 } else { | 4162 } else { |
| 4159 __ cmpq(length, ToRegister(instr->index())); | 4163 if (representation.IsSmi()) { |
| 4164 __ cmpq(length, ToRegister(instr->index())); |
| 4165 } else { |
| 4166 __ cmpl(length, ToRegister(instr->index())); |
| 4167 } |
| 4160 } | 4168 } |
| 4161 } | 4169 } |
| 4162 Condition condition = | 4170 Condition condition = hinstr->allow_equality() ? below : below_equal; |
| 4163 instr->hydrogen()->allow_equality() ? below : below_equal; | |
| 4164 ApplyCheckIf(condition, instr); | 4171 ApplyCheckIf(condition, instr); |
| 4165 } | 4172 } |
| 4166 | 4173 |
| 4167 | 4174 |
| 4168 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { | 4175 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { |
| 4169 ElementsKind elements_kind = instr->elements_kind(); | 4176 ElementsKind elements_kind = instr->elements_kind(); |
| 4170 LOperand* key = instr->key(); | 4177 LOperand* key = instr->key(); |
| 4171 if (!key->IsConstantOperand()) { | 4178 if (!key->IsConstantOperand()) { |
| 4172 Register key_reg = ToRegister(key); | 4179 Register key_reg = ToRegister(key); |
| 4173 // Even though the HLoad/StoreKeyedFastElement instructions force | 4180 // Even though the HLoad/StoreKeyedFastElement instructions force |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5648 FixedArray::kHeaderSize - kPointerSize)); | 5655 FixedArray::kHeaderSize - kPointerSize)); |
| 5649 __ bind(&done); | 5656 __ bind(&done); |
| 5650 } | 5657 } |
| 5651 | 5658 |
| 5652 | 5659 |
| 5653 #undef __ | 5660 #undef __ |
| 5654 | 5661 |
| 5655 } } // namespace v8::internal | 5662 } } // namespace v8::internal |
| 5656 | 5663 |
| 5657 #endif // V8_TARGET_ARCH_X64 | 5664 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |