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 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1512 if (int_val == 0) { | 1519 if (int_val == 0) { |
1513 __ xorps(res, res); | 1520 __ xorps(res, res); |
1514 } else { | 1521 } else { |
1515 Register tmp = ToRegister(instr->temp()); | 1522 Register tmp = ToRegister(instr->temp()); |
1516 __ Set(tmp, int_val); | 1523 __ Set(tmp, int_val); |
1517 __ movq(res, tmp); | 1524 __ movq(res, tmp); |
1518 } | 1525 } |
1519 } | 1526 } |
1520 | 1527 |
1521 | 1528 |
1529 void LCodeGen::DoConstantE(LConstantE* instr) { | |
1530 __ LoadAddress(ToRegister(instr->result()), instr->value()); | |
1531 } | |
1532 | |
1533 | |
1522 void LCodeGen::DoConstantT(LConstantT* instr) { | 1534 void LCodeGen::DoConstantT(LConstantT* instr) { |
1523 Handle<Object> value = instr->value(); | 1535 Handle<Object> value = instr->value(); |
1524 AllowDeferredHandleDereference smi_check; | 1536 AllowDeferredHandleDereference smi_check; |
1525 __ LoadObject(ToRegister(instr->result()), value); | 1537 __ LoadObject(ToRegister(instr->result()), value); |
1526 } | 1538 } |
1527 | 1539 |
1528 | 1540 |
1529 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1541 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
1530 Register result = ToRegister(instr->result()); | 1542 Register result = ToRegister(instr->result()); |
1531 Register map = ToRegister(instr->value()); | 1543 Register map = ToRegister(instr->value()); |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2669 check_needed); | 2681 check_needed); |
2670 } | 2682 } |
2671 | 2683 |
2672 __ bind(&skip_assignment); | 2684 __ bind(&skip_assignment); |
2673 } | 2685 } |
2674 | 2686 |
2675 | 2687 |
2676 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2688 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2677 HObjectAccess access = instr->hydrogen()->access(); | 2689 HObjectAccess access = instr->hydrogen()->access(); |
2678 int offset = access.offset(); | 2690 int offset = access.offset(); |
2691 | |
2692 if (access.IsExternalMemory()) { | |
2693 Register result = ToRegister(instr->result()); | |
2694 if (instr->object()->IsConstantOperand()) { | |
2695 ASSERT(result.is(rax)); | |
2696 __ load_rax(ToExternalReference(LConstantOperand::cast(instr->object()))); | |
2697 } else { | |
2698 Register object = ToRegister(instr->object()); | |
2699 __ movq(result, MemOperand(object, offset)); | |
2700 } | |
2701 return; | |
2702 } | |
2703 | |
2679 Register object = ToRegister(instr->object()); | 2704 Register object = ToRegister(instr->object()); |
2680 if (FLAG_track_double_fields && | 2705 if (FLAG_track_double_fields && |
2681 instr->hydrogen()->representation().IsDouble()) { | 2706 instr->hydrogen()->representation().IsDouble()) { |
2682 XMMRegister result = ToDoubleRegister(instr->result()); | 2707 XMMRegister result = ToDoubleRegister(instr->result()); |
2683 __ movsd(result, FieldOperand(object, offset)); | 2708 __ movsd(result, FieldOperand(object, offset)); |
2684 return; | 2709 return; |
2685 } | 2710 } |
2686 | 2711 |
2687 Register result = ToRegister(instr->result()); | 2712 Register result = ToRegister(instr->result()); |
2688 if (access.IsInobject()) { | 2713 if (access.IsInobject()) { |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3906 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 3931 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
3907 Register result = ToRegister(instr->result()); | 3932 Register result = ToRegister(instr->result()); |
3908 Register base = ToRegister(instr->base_object()); | 3933 Register base = ToRegister(instr->base_object()); |
3909 __ lea(result, Operand(base, instr->offset())); | 3934 __ lea(result, Operand(base, instr->offset())); |
3910 } | 3935 } |
3911 | 3936 |
3912 | 3937 |
3913 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 3938 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
3914 Representation representation = instr->representation(); | 3939 Representation representation = instr->representation(); |
3915 | 3940 |
3916 Register object = ToRegister(instr->object()); | |
3917 | |
3918 HObjectAccess access = instr->hydrogen()->access(); | 3941 HObjectAccess access = instr->hydrogen()->access(); |
3919 int offset = access.offset(); | 3942 int offset = access.offset(); |
3920 | 3943 |
3944 if (access.IsExternalMemory()) { | |
3945 Register value = ToRegister(instr->value()); | |
3946 if (instr->object()->IsConstantOperand()) { | |
3947 ASSERT(value.is(rax)); | |
3948 __ store_rax(ToExternalReference( | |
3949 LConstantOperand::cast(instr->object()))); | |
danno
2013/07/29 10:40:14
nit: funky indentatoin
Benedikt Meurer
2013/07/29 13:57:51
Done.
| |
3950 } else { | |
3951 Register object = ToRegister(instr->object()); | |
3952 __ movq(MemOperand(object, offset), value); | |
3953 } | |
3954 return; | |
3955 } | |
3956 | |
3957 Register object = ToRegister(instr->object()); | |
3921 Handle<Map> transition = instr->transition(); | 3958 Handle<Map> transition = instr->transition(); |
3922 | 3959 |
3923 if (FLAG_track_fields && representation.IsSmi()) { | 3960 if (FLAG_track_fields && representation.IsSmi()) { |
3924 if (instr->value()->IsConstantOperand()) { | 3961 if (instr->value()->IsConstantOperand()) { |
3925 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3962 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
3926 if (!IsSmiConstant(operand_value)) { | 3963 if (!IsSmiConstant(operand_value)) { |
3927 DeoptimizeIf(no_condition, instr->environment()); | 3964 DeoptimizeIf(no_condition, instr->environment()); |
3928 } | 3965 } |
3929 } | 3966 } |
3930 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 3967 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5546 FixedArray::kHeaderSize - kPointerSize)); | 5583 FixedArray::kHeaderSize - kPointerSize)); |
5547 __ bind(&done); | 5584 __ bind(&done); |
5548 } | 5585 } |
5549 | 5586 |
5550 | 5587 |
5551 #undef __ | 5588 #undef __ |
5552 | 5589 |
5553 } } // namespace v8::internal | 5590 } } // namespace v8::internal |
5554 | 5591 |
5555 #endif // V8_TARGET_ARCH_X64 | 5592 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |