| 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 4122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4133 ASSERT(ToRegister(instr->context()).is(rsi)); | 4133 ASSERT(ToRegister(instr->context()).is(rsi)); |
| 4134 ASSERT(ToRegister(instr->object()).is(rdx)); | 4134 ASSERT(ToRegister(instr->object()).is(rdx)); |
| 4135 ASSERT(ToRegister(instr->value()).is(rax)); | 4135 ASSERT(ToRegister(instr->value()).is(rax)); |
| 4136 | 4136 |
| 4137 __ Move(rcx, instr->hydrogen()->name()); | 4137 __ Move(rcx, instr->hydrogen()->name()); |
| 4138 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); | 4138 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); |
| 4139 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4139 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4140 } | 4140 } |
| 4141 | 4141 |
| 4142 | 4142 |
| 4143 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { | 4143 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4144 if (FLAG_debug_code && check->hydrogen()->skip_check()) { | 4144 Representation representation = instr->hydrogen()->length()->representation(); |
| 4145 ASSERT(representation.Equals(instr->hydrogen()->index()->representation())); |
| 4146 ASSERT(representation.IsSmiOrInteger32()); |
| 4147 |
| 4148 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; |
| 4149 if (instr->length()->IsConstantOperand()) { |
| 4150 int32_t length = ToInteger32(LConstantOperand::cast(instr->length())); |
| 4151 Register index = ToRegister(instr->index()); |
| 4152 if (representation.IsSmi()) { |
| 4153 __ Cmp(index, Smi::FromInt(length)); |
| 4154 } else { |
| 4155 __ cmpl(index, Immediate(length)); |
| 4156 } |
| 4157 cc = ReverseCondition(cc); |
| 4158 } else if (instr->index()->IsConstantOperand()) { |
| 4159 int32_t index = ToInteger32(LConstantOperand::cast(instr->index())); |
| 4160 if (instr->length()->IsRegister()) { |
| 4161 Register length = ToRegister(instr->length()); |
| 4162 if (representation.IsSmi()) { |
| 4163 __ Cmp(length, Smi::FromInt(index)); |
| 4164 } else { |
| 4165 __ cmpl(length, Immediate(index)); |
| 4166 } |
| 4167 } else { |
| 4168 Operand length = ToOperand(instr->length()); |
| 4169 if (representation.IsSmi()) { |
| 4170 __ Cmp(length, Smi::FromInt(index)); |
| 4171 } else { |
| 4172 __ cmpl(length, Immediate(index)); |
| 4173 } |
| 4174 } |
| 4175 } else { |
| 4176 Register index = ToRegister(instr->index()); |
| 4177 if (instr->length()->IsRegister()) { |
| 4178 Register length = ToRegister(instr->length()); |
| 4179 if (representation.IsSmi()) { |
| 4180 __ cmpp(length, index); |
| 4181 } else { |
| 4182 __ cmpl(length, index); |
| 4183 } |
| 4184 } else { |
| 4185 Operand length = ToOperand(instr->length()); |
| 4186 if (representation.IsSmi()) { |
| 4187 __ cmpp(length, index); |
| 4188 } else { |
| 4189 __ cmpl(length, index); |
| 4190 } |
| 4191 } |
| 4192 } |
| 4193 if (FLAG_debug_code && instr->hydrogen()->skip_check()) { |
| 4145 Label done; | 4194 Label done; |
| 4146 __ j(NegateCondition(cc), &done, Label::kNear); | 4195 __ j(NegateCondition(cc), &done, Label::kNear); |
| 4147 __ int3(); | 4196 __ int3(); |
| 4148 __ bind(&done); | 4197 __ bind(&done); |
| 4149 } else { | 4198 } else { |
| 4150 DeoptimizeIf(cc, check->environment()); | 4199 DeoptimizeIf(cc, instr->environment()); |
| 4151 } | 4200 } |
| 4152 } | 4201 } |
| 4153 | 4202 |
| 4154 | 4203 |
| 4155 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | |
| 4156 HBoundsCheck* hinstr = instr->hydrogen(); | |
| 4157 if (hinstr->skip_check()) return; | |
| 4158 | |
| 4159 Representation representation = hinstr->length()->representation(); | |
| 4160 ASSERT(representation.Equals(hinstr->index()->representation())); | |
| 4161 ASSERT(representation.IsSmiOrInteger32()); | |
| 4162 | |
| 4163 if (instr->length()->IsRegister()) { | |
| 4164 Register reg = ToRegister(instr->length()); | |
| 4165 | |
| 4166 if (instr->index()->IsConstantOperand()) { | |
| 4167 int32_t constant_index = | |
| 4168 ToInteger32(LConstantOperand::cast(instr->index())); | |
| 4169 if (representation.IsSmi()) { | |
| 4170 __ Cmp(reg, Smi::FromInt(constant_index)); | |
| 4171 } else { | |
| 4172 __ cmpl(reg, Immediate(constant_index)); | |
| 4173 } | |
| 4174 } else { | |
| 4175 Register reg2 = ToRegister(instr->index()); | |
| 4176 if (representation.IsSmi()) { | |
| 4177 __ cmpp(reg, reg2); | |
| 4178 } else { | |
| 4179 __ cmpl(reg, reg2); | |
| 4180 } | |
| 4181 } | |
| 4182 } else { | |
| 4183 Operand length = ToOperand(instr->length()); | |
| 4184 if (instr->index()->IsConstantOperand()) { | |
| 4185 int32_t constant_index = | |
| 4186 ToInteger32(LConstantOperand::cast(instr->index())); | |
| 4187 if (representation.IsSmi()) { | |
| 4188 __ Cmp(length, Smi::FromInt(constant_index)); | |
| 4189 } else { | |
| 4190 __ cmpl(length, Immediate(constant_index)); | |
| 4191 } | |
| 4192 } else { | |
| 4193 if (representation.IsSmi()) { | |
| 4194 __ cmpp(length, ToRegister(instr->index())); | |
| 4195 } else { | |
| 4196 __ cmpl(length, ToRegister(instr->index())); | |
| 4197 } | |
| 4198 } | |
| 4199 } | |
| 4200 Condition condition = hinstr->allow_equality() ? below : below_equal; | |
| 4201 ApplyCheckIf(condition, instr); | |
| 4202 } | |
| 4203 | |
| 4204 | |
| 4205 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { | 4204 void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { |
| 4206 ElementsKind elements_kind = instr->elements_kind(); | 4205 ElementsKind elements_kind = instr->elements_kind(); |
| 4207 LOperand* key = instr->key(); | 4206 LOperand* key = instr->key(); |
| 4208 int base_offset = instr->is_fixed_typed_array() | 4207 int base_offset = instr->is_fixed_typed_array() |
| 4209 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag | 4208 ? FixedTypedArrayBase::kDataOffset - kHeapObjectTag |
| 4210 : 0; | 4209 : 0; |
| 4211 Operand operand(BuildFastArrayOperand( | 4210 Operand operand(BuildFastArrayOperand( |
| 4212 instr->elements(), | 4211 instr->elements(), |
| 4213 key, | 4212 key, |
| 4214 elements_kind, | 4213 elements_kind, |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5724 __ bind(deferred->exit()); | 5723 __ bind(deferred->exit()); |
| 5725 __ bind(&done); | 5724 __ bind(&done); |
| 5726 } | 5725 } |
| 5727 | 5726 |
| 5728 | 5727 |
| 5729 #undef __ | 5728 #undef __ |
| 5730 | 5729 |
| 5731 } } // namespace v8::internal | 5730 } } // namespace v8::internal |
| 5732 | 5731 |
| 5733 #endif // V8_TARGET_ARCH_X64 | 5732 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |