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 4007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4018 __ j(NegateCondition(cc), &done, Label::kNear); | 4018 __ j(NegateCondition(cc), &done, Label::kNear); |
4019 __ int3(); | 4019 __ int3(); |
4020 __ bind(&done); | 4020 __ bind(&done); |
4021 } else { | 4021 } else { |
4022 DeoptimizeIf(cc, check->environment()); | 4022 DeoptimizeIf(cc, check->environment()); |
4023 } | 4023 } |
4024 } | 4024 } |
4025 | 4025 |
4026 | 4026 |
4027 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4027 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4028 if (instr->hydrogen()->skip_check()) return; | 4028 HBoundsCheck* hinstr = instr->hydrogen(); |
| 4029 if (hinstr->skip_check()) return; |
| 4030 |
| 4031 Representation representation = hinstr->length()->representation(); |
| 4032 ASSERT(representation.Equals(hinstr->index()->representation())); |
| 4033 ASSERT(representation.IsSmiOrInteger32()); |
4029 | 4034 |
4030 if (instr->length()->IsRegister()) { | 4035 if (instr->length()->IsRegister()) { |
4031 Register reg = ToRegister(instr->length()); | 4036 Register reg = ToRegister(instr->length()); |
4032 if (!instr->hydrogen()->length()->representation().IsSmi()) { | 4037 |
4033 __ AssertZeroExtended(reg); | |
4034 } | |
4035 if (instr->index()->IsConstantOperand()) { | 4038 if (instr->index()->IsConstantOperand()) { |
4036 int32_t constant_index = | 4039 int32_t constant_index = |
4037 ToInteger32(LConstantOperand::cast(instr->index())); | 4040 ToInteger32(LConstantOperand::cast(instr->index())); |
4038 if (instr->hydrogen()->length()->representation().IsSmi()) { | 4041 if (representation.IsSmi()) { |
4039 __ Cmp(reg, Smi::FromInt(constant_index)); | 4042 __ Cmp(reg, Smi::FromInt(constant_index)); |
4040 } else { | 4043 } else { |
4041 __ cmpq(reg, Immediate(constant_index)); | 4044 __ cmpl(reg, Immediate(constant_index)); |
4042 } | 4045 } |
4043 } else { | 4046 } else { |
4044 Register reg2 = ToRegister(instr->index()); | 4047 Register reg2 = ToRegister(instr->index()); |
4045 if (!instr->hydrogen()->index()->representation().IsSmi()) { | 4048 if (representation.IsSmi()) { |
4046 __ AssertZeroExtended(reg2); | 4049 __ cmpq(reg, reg2); |
| 4050 } else { |
| 4051 __ cmpl(reg, reg2); |
4047 } | 4052 } |
4048 __ cmpq(reg, reg2); | |
4049 } | 4053 } |
4050 } else { | 4054 } else { |
4051 Operand length = ToOperand(instr->length()); | 4055 Operand length = ToOperand(instr->length()); |
4052 if (instr->index()->IsConstantOperand()) { | 4056 if (instr->index()->IsConstantOperand()) { |
4053 int32_t constant_index = | 4057 int32_t constant_index = |
4054 ToInteger32(LConstantOperand::cast(instr->index())); | 4058 ToInteger32(LConstantOperand::cast(instr->index())); |
4055 if (instr->hydrogen()->length()->representation().IsSmi()) { | 4059 if (representation.IsSmi()) { |
4056 __ Cmp(length, Smi::FromInt(constant_index)); | 4060 __ Cmp(length, Smi::FromInt(constant_index)); |
4057 } else { | 4061 } else { |
4058 __ cmpq(length, Immediate(constant_index)); | 4062 __ cmpl(length, Immediate(constant_index)); |
4059 } | 4063 } |
4060 } else { | 4064 } else { |
4061 __ cmpq(length, ToRegister(instr->index())); | 4065 if (representation.IsSmi()) { |
| 4066 __ cmpq(length, ToRegister(instr->index())); |
| 4067 } else { |
| 4068 __ cmpl(length, ToRegister(instr->index())); |
| 4069 } |
4062 } | 4070 } |
4063 } | 4071 } |
4064 Condition condition = | 4072 Condition condition = hinstr->allow_equality() ? below : below_equal; |
4065 instr->hydrogen()->allow_equality() ? below : below_equal; | |
4066 ApplyCheckIf(condition, instr); | 4073 ApplyCheckIf(condition, instr); |
4067 } | 4074 } |
4068 | 4075 |
4069 | 4076 |
4070 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { | 4077 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { |
4071 ElementsKind elements_kind = instr->elements_kind(); | 4078 ElementsKind elements_kind = instr->elements_kind(); |
4072 LOperand* key = instr->key(); | 4079 LOperand* key = instr->key(); |
4073 if (!key->IsConstantOperand()) { | 4080 if (!key->IsConstantOperand()) { |
4074 Register key_reg = ToRegister(key); | 4081 Register key_reg = ToRegister(key); |
4075 // Even though the HLoad/StoreKeyedFastElement instructions force | 4082 // Even though the HLoad/StoreKeyedFastElement instructions force |
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5579 FixedArray::kHeaderSize - kPointerSize)); | 5586 FixedArray::kHeaderSize - kPointerSize)); |
5580 __ bind(&done); | 5587 __ bind(&done); |
5581 } | 5588 } |
5582 | 5589 |
5583 | 5590 |
5584 #undef __ | 5591 #undef __ |
5585 | 5592 |
5586 } } // namespace v8::internal | 5593 } } // namespace v8::internal |
5587 | 5594 |
5588 #endif // V8_TARGET_ARCH_X64 | 5595 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |