| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 422 } |
| 423 | 423 |
| 424 | 424 |
| 425 double LCodeGen::ToDouble(LConstantOperand* op) const { | 425 double LCodeGen::ToDouble(LConstantOperand* op) const { |
| 426 HConstant* constant = chunk_->LookupConstant(op); | 426 HConstant* constant = chunk_->LookupConstant(op); |
| 427 ASSERT(constant->HasDoubleValue()); | 427 ASSERT(constant->HasDoubleValue()); |
| 428 return constant->DoubleValue(); | 428 return constant->DoubleValue(); |
| 429 } | 429 } |
| 430 | 430 |
| 431 | 431 |
| 432 ExternalReference LCodeGen::ToExternalReference(LConstantOperand* op) const { |
| 433 HConstant* constant = chunk_->LookupConstant(op); |
| 434 ASSERT(constant->HasExternalReferenceValue()); |
| 435 return constant->ExternalReferenceValue(); |
| 436 } |
| 437 |
| 438 |
| 432 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { | 439 Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
| 433 HConstant* constant = chunk_->LookupConstant(op); | 440 HConstant* constant = chunk_->LookupConstant(op); |
| 434 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); | 441 ASSERT(chunk_->LookupLiteralRepresentation(op).IsSmiOrTagged()); |
| 435 return constant->handle(); | 442 return constant->handle(); |
| 436 } | 443 } |
| 437 | 444 |
| 438 | 445 |
| 439 Operand LCodeGen::ToOperand(LOperand* op) const { | 446 Operand LCodeGen::ToOperand(LOperand* op) const { |
| 440 // Does not handle registers. In X64 assembler, plain registers are not | 447 // Does not handle registers. In X64 assembler, plain registers are not |
| 441 // representable as an Operand. | 448 // representable as an Operand. |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 if (int_val == 0) { | 1523 if (int_val == 0) { |
| 1517 __ xorps(res, res); | 1524 __ xorps(res, res); |
| 1518 } else { | 1525 } else { |
| 1519 Register tmp = ToRegister(instr->temp()); | 1526 Register tmp = ToRegister(instr->temp()); |
| 1520 __ Set(tmp, int_val); | 1527 __ Set(tmp, int_val); |
| 1521 __ movq(res, tmp); | 1528 __ movq(res, tmp); |
| 1522 } | 1529 } |
| 1523 } | 1530 } |
| 1524 | 1531 |
| 1525 | 1532 |
| 1533 void LCodeGen::DoConstantE(LConstantE* instr) { |
| 1534 __ LoadAddress(ToRegister(instr->result()), instr->value()); |
| 1535 } |
| 1536 |
| 1537 |
| 1526 void LCodeGen::DoConstantT(LConstantT* instr) { | 1538 void LCodeGen::DoConstantT(LConstantT* instr) { |
| 1527 Handle<Object> value = instr->value(); | 1539 Handle<Object> value = instr->value(); |
| 1528 AllowDeferredHandleDereference smi_check; | 1540 AllowDeferredHandleDereference smi_check; |
| 1529 __ LoadObject(ToRegister(instr->result()), value); | 1541 __ LoadObject(ToRegister(instr->result()), value); |
| 1530 } | 1542 } |
| 1531 | 1543 |
| 1532 | 1544 |
| 1533 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1545 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
| 1534 Register result = ToRegister(instr->result()); | 1546 Register result = ToRegister(instr->result()); |
| 1535 Register map = ToRegister(instr->value()); | 1547 Register map = ToRegister(instr->value()); |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2682 check_needed); | 2694 check_needed); |
| 2683 } | 2695 } |
| 2684 | 2696 |
| 2685 __ bind(&skip_assignment); | 2697 __ bind(&skip_assignment); |
| 2686 } | 2698 } |
| 2687 | 2699 |
| 2688 | 2700 |
| 2689 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2701 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 2690 HObjectAccess access = instr->hydrogen()->access(); | 2702 HObjectAccess access = instr->hydrogen()->access(); |
| 2691 int offset = access.offset(); | 2703 int offset = access.offset(); |
| 2704 |
| 2705 if (access.IsExternalMemory()) { |
| 2706 Register result = ToRegister(instr->result()); |
| 2707 if (instr->object()->IsConstantOperand()) { |
| 2708 ASSERT(result.is(rax)); |
| 2709 __ load_rax(ToExternalReference(LConstantOperand::cast(instr->object()))); |
| 2710 } else { |
| 2711 Register object = ToRegister(instr->object()); |
| 2712 __ movq(result, MemOperand(object, offset)); |
| 2713 } |
| 2714 return; |
| 2715 } |
| 2716 |
| 2692 Register object = ToRegister(instr->object()); | 2717 Register object = ToRegister(instr->object()); |
| 2693 if (FLAG_track_double_fields && | 2718 if (FLAG_track_double_fields && |
| 2694 instr->hydrogen()->representation().IsDouble()) { | 2719 instr->hydrogen()->representation().IsDouble()) { |
| 2695 XMMRegister result = ToDoubleRegister(instr->result()); | 2720 XMMRegister result = ToDoubleRegister(instr->result()); |
| 2696 __ movsd(result, FieldOperand(object, offset)); | 2721 __ movsd(result, FieldOperand(object, offset)); |
| 2697 return; | 2722 return; |
| 2698 } | 2723 } |
| 2699 | 2724 |
| 2700 Register result = ToRegister(instr->result()); | 2725 Register result = ToRegister(instr->result()); |
| 2701 if (access.IsInobject()) { | 2726 if (access.IsInobject()) { |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3919 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 3944 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
| 3920 Register result = ToRegister(instr->result()); | 3945 Register result = ToRegister(instr->result()); |
| 3921 Register base = ToRegister(instr->base_object()); | 3946 Register base = ToRegister(instr->base_object()); |
| 3922 __ lea(result, Operand(base, instr->offset())); | 3947 __ lea(result, Operand(base, instr->offset())); |
| 3923 } | 3948 } |
| 3924 | 3949 |
| 3925 | 3950 |
| 3926 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 3951 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 3927 Representation representation = instr->representation(); | 3952 Representation representation = instr->representation(); |
| 3928 | 3953 |
| 3929 Register object = ToRegister(instr->object()); | |
| 3930 | |
| 3931 HObjectAccess access = instr->hydrogen()->access(); | 3954 HObjectAccess access = instr->hydrogen()->access(); |
| 3932 int offset = access.offset(); | 3955 int offset = access.offset(); |
| 3933 | 3956 |
| 3957 if (access.IsExternalMemory()) { |
| 3958 Register value = ToRegister(instr->value()); |
| 3959 if (instr->object()->IsConstantOperand()) { |
| 3960 ASSERT(value.is(rax)); |
| 3961 LConstantOperand* object = LConstantOperand::cast(instr->object()); |
| 3962 __ store_rax(ToExternalReference(object)); |
| 3963 } else { |
| 3964 Register object = ToRegister(instr->object()); |
| 3965 __ movq(MemOperand(object, offset), value); |
| 3966 } |
| 3967 return; |
| 3968 } |
| 3969 |
| 3970 Register object = ToRegister(instr->object()); |
| 3934 Handle<Map> transition = instr->transition(); | 3971 Handle<Map> transition = instr->transition(); |
| 3935 | 3972 |
| 3936 if (FLAG_track_fields && representation.IsSmi()) { | 3973 if (FLAG_track_fields && representation.IsSmi()) { |
| 3937 if (instr->value()->IsConstantOperand()) { | 3974 if (instr->value()->IsConstantOperand()) { |
| 3938 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3975 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 3939 if (!IsSmiConstant(operand_value)) { | 3976 if (!IsSmiConstant(operand_value)) { |
| 3940 DeoptimizeIf(no_condition, instr->environment()); | 3977 DeoptimizeIf(no_condition, instr->environment()); |
| 3941 } | 3978 } |
| 3942 } | 3979 } |
| 3943 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 3980 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5537 FixedArray::kHeaderSize - kPointerSize)); | 5574 FixedArray::kHeaderSize - kPointerSize)); |
| 5538 __ bind(&done); | 5575 __ bind(&done); |
| 5539 } | 5576 } |
| 5540 | 5577 |
| 5541 | 5578 |
| 5542 #undef __ | 5579 #undef __ |
| 5543 | 5580 |
| 5544 } } // namespace v8::internal | 5581 } } // namespace v8::internal |
| 5545 | 5582 |
| 5546 #endif // V8_TARGET_ARCH_X64 | 5583 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |