OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 | 800 |
801 | 801 |
802 int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { | 802 int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { |
803 return ToRepresentation(op, Representation::Integer32()); | 803 return ToRepresentation(op, Representation::Integer32()); |
804 } | 804 } |
805 | 805 |
806 | 806 |
807 int32_t LCodeGen::ToRepresentation(LConstantOperand* op, | 807 int32_t LCodeGen::ToRepresentation(LConstantOperand* op, |
808 const Representation& r) const { | 808 const Representation& r) const { |
809 HConstant* constant = chunk_->LookupConstant(op); | 809 HConstant* constant = chunk_->LookupConstant(op); |
| 810 if (r.IsExternal()) { |
| 811 return reinterpret_cast<int32_t>( |
| 812 constant->ExternalReferenceValue().address()); |
| 813 } |
810 int32_t value = constant->Integer32Value(); | 814 int32_t value = constant->Integer32Value(); |
811 if (r.IsInteger32()) return value; | 815 if (r.IsInteger32()) return value; |
812 DCHECK(r.IsSmiOrTagged()); | 816 DCHECK(r.IsSmiOrTagged()); |
813 return reinterpret_cast<int32_t>(Smi::FromInt(value)); | 817 return reinterpret_cast<int32_t>(Smi::FromInt(value)); |
814 } | 818 } |
815 | 819 |
816 | 820 |
817 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 821 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
818 HConstant* constant = chunk_->LookupConstant(op); | 822 HConstant* constant = chunk_->LookupConstant(op); |
819 DCHECK(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); | 823 DCHECK(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); |
(...skipping 3667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4487 write_register = ToRegister(instr->temp()); | 4491 write_register = ToRegister(instr->temp()); |
4488 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | 4492 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
4489 } | 4493 } |
4490 | 4494 |
4491 MemOperand operand = FieldOperand(write_register, offset); | 4495 MemOperand operand = FieldOperand(write_register, offset); |
4492 if (instr->value()->IsConstantOperand()) { | 4496 if (instr->value()->IsConstantOperand()) { |
4493 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4497 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4494 if (operand_value->IsRegister()) { | 4498 if (operand_value->IsRegister()) { |
4495 Register value = ToRegister(operand_value); | 4499 Register value = ToRegister(operand_value); |
4496 __ Store(value, operand, representation); | 4500 __ Store(value, operand, representation); |
4497 } else if (representation.IsInteger32()) { | 4501 } else if (representation.IsInteger32() || representation.IsExternal()) { |
4498 Immediate immediate = ToImmediate(operand_value, representation); | 4502 Immediate immediate = ToImmediate(operand_value, representation); |
4499 DCHECK(!instr->hydrogen()->NeedsWriteBarrier()); | 4503 DCHECK(!instr->hydrogen()->NeedsWriteBarrier()); |
4500 __ mov(operand, immediate); | 4504 __ mov(operand, immediate); |
4501 } else { | 4505 } else { |
4502 Handle<Object> handle_value = ToHandle(operand_value); | 4506 Handle<Object> handle_value = ToHandle(operand_value); |
4503 DCHECK(!instr->hydrogen()->NeedsWriteBarrier()); | 4507 DCHECK(!instr->hydrogen()->NeedsWriteBarrier()); |
4504 __ mov(operand, handle_value); | 4508 __ mov(operand, handle_value); |
4505 } | 4509 } |
4506 } else { | 4510 } else { |
4507 Register value = ToRegister(instr->value()); | 4511 Register value = ToRegister(instr->value()); |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6467 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6471 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6468 } | 6472 } |
6469 | 6473 |
6470 | 6474 |
6471 #undef __ | 6475 #undef __ |
6472 | 6476 |
6473 } // namespace internal | 6477 } // namespace internal |
6474 } // namespace v8 | 6478 } // namespace v8 |
6475 | 6479 |
6476 #endif // V8_TARGET_ARCH_X87 | 6480 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |