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 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2661 kSaveFPRegs, | 2661 kSaveFPRegs, |
2662 EMIT_REMEMBERED_SET, | 2662 EMIT_REMEMBERED_SET, |
2663 check_needed); | 2663 check_needed); |
2664 } | 2664 } |
2665 | 2665 |
2666 __ bind(&skip_assignment); | 2666 __ bind(&skip_assignment); |
2667 } | 2667 } |
2668 | 2668 |
2669 | 2669 |
2670 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2670 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 2671 int offset = instr->hydrogen()->offset(); |
2671 Register object = ToRegister(instr->object()); | 2672 Register object = ToRegister(instr->object()); |
2672 if (!FLAG_track_double_fields) { | 2673 if (FLAG_track_double_fields && |
2673 ASSERT(!instr->hydrogen()->representation().IsDouble()); | 2674 instr->hydrogen()->representation().IsDouble()) { |
2674 } | 2675 XMMRegister result = ToDoubleRegister(instr->result()); |
2675 Register temp = instr->hydrogen()->representation().IsDouble() | 2676 __ movsd(result, FieldOperand(object, offset)); |
2676 ? ToRegister(instr->temp()) : ToRegister(instr->result()); | 2677 return; |
2677 if (instr->hydrogen()->is_in_object()) { | |
2678 __ movq(temp, FieldOperand(object, instr->hydrogen()->offset())); | |
2679 } else { | |
2680 __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset)); | |
2681 __ movq(temp, FieldOperand(temp, instr->hydrogen()->offset())); | |
2682 } | 2678 } |
2683 | 2679 |
2684 if (instr->hydrogen()->representation().IsDouble()) { | 2680 Register result = ToRegister(instr->result()); |
2685 Label load_from_heap_number, done; | 2681 if (instr->hydrogen()->is_in_object()) { |
2686 XMMRegister result = ToDoubleRegister(instr->result()); | 2682 __ movq(result, FieldOperand(object, offset)); |
2687 __ JumpIfNotSmi(temp, &load_from_heap_number); | 2683 } else { |
2688 __ SmiToInteger32(temp, temp); | 2684 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
2689 __ cvtlsi2sd(result, temp); | 2685 __ movq(result, FieldOperand(result, offset)); |
2690 __ jmp(&done); | |
2691 __ bind(&load_from_heap_number); | |
2692 __ movsd(result, FieldOperand(temp, HeapNumber::kValueOffset)); | |
2693 __ bind(&done); | |
2694 } | 2686 } |
2695 } | 2687 } |
2696 | 2688 |
2697 | 2689 |
2698 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, | 2690 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, |
2699 Register object, | 2691 Register object, |
2700 Handle<Map> type, | 2692 Handle<Map> type, |
2701 Handle<String> name, | 2693 Handle<String> name, |
2702 LEnvironment* env) { | 2694 LEnvironment* env) { |
2703 LookupResult lookup(isolate()); | 2695 LookupResult lookup(isolate()); |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3903 } | 3895 } |
3904 | 3896 |
3905 | 3897 |
3906 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 3898 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
3907 Representation representation = instr->representation(); | 3899 Representation representation = instr->representation(); |
3908 | 3900 |
3909 Register object = ToRegister(instr->object()); | 3901 Register object = ToRegister(instr->object()); |
3910 | 3902 |
3911 int offset = instr->offset(); | 3903 int offset = instr->offset(); |
3912 | 3904 |
| 3905 Handle<Map> transition = instr->transition(); |
| 3906 |
3913 if (FLAG_track_fields && representation.IsSmi()) { | 3907 if (FLAG_track_fields && representation.IsSmi()) { |
3914 if (instr->value()->IsConstantOperand()) { | 3908 if (instr->value()->IsConstantOperand()) { |
3915 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3909 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
3916 if (!IsInteger32Constant(operand_value)) { | 3910 if (!IsInteger32Constant(operand_value)) { |
3917 DeoptimizeIf(no_condition, instr->environment()); | 3911 DeoptimizeIf(no_condition, instr->environment()); |
3918 } | 3912 } |
3919 } else { | 3913 } else { |
3920 Register value = ToRegister(instr->value()); | 3914 Register value = ToRegister(instr->value()); |
3921 __ Integer32ToSmi(value, value); | 3915 __ Integer32ToSmi(value, value); |
3922 } | 3916 } |
3923 } else if (FLAG_track_double_fields && representation.IsDouble() && | 3917 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
3924 !instr->hydrogen()->value()->type().IsSmi() && | 3918 ASSERT(transition.is_null()); |
3925 !instr->hydrogen()->value()->type().IsHeapNumber()) { | 3919 ASSERT(instr->is_in_object()); |
3926 Register value = ToRegister(instr->value()); | 3920 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
3927 Label do_store; | 3921 XMMRegister value = ToDoubleRegister(instr->value()); |
3928 __ JumpIfSmi(value, &do_store); | 3922 __ movsd(FieldOperand(object, offset), value); |
3929 Handle<Map> map(isolate()->factory()->heap_number_map()); | 3923 return; |
3930 DoCheckMapCommon(value, map, REQUIRE_EXACT_MAP, instr); | |
3931 __ bind(&do_store); | |
3932 } | 3924 } |
3933 | 3925 |
3934 Handle<Map> transition = instr->transition(); | |
3935 if (!transition.is_null()) { | 3926 if (!transition.is_null()) { |
3936 if (transition->CanBeDeprecated()) { | 3927 if (transition->CanBeDeprecated()) { |
3937 transition_maps_.Add(transition, info()->zone()); | 3928 transition_maps_.Add(transition, info()->zone()); |
3938 } | 3929 } |
3939 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { | 3930 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { |
3940 __ Move(FieldOperand(object, HeapObject::kMapOffset), transition); | 3931 __ Move(FieldOperand(object, HeapObject::kMapOffset), transition); |
3941 } else { | 3932 } else { |
3942 Register temp = ToRegister(instr->temp()); | 3933 Register temp = ToRegister(instr->temp()); |
3943 __ Move(kScratchRegister, transition); | 3934 __ Move(kScratchRegister, transition); |
3944 __ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister); | 3935 __ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister); |
(...skipping 24 matching lines...) Expand all Loading... |
3969 if (IsInteger32Constant(operand_value)) { | 3960 if (IsInteger32Constant(operand_value)) { |
3970 // In lithium register preparation, we made sure that the constant integer | 3961 // In lithium register preparation, we made sure that the constant integer |
3971 // operand fits into smi range. | 3962 // operand fits into smi range. |
3972 Smi* smi_value = Smi::FromInt(ToInteger32(operand_value)); | 3963 Smi* smi_value = Smi::FromInt(ToInteger32(operand_value)); |
3973 __ Move(FieldOperand(write_register, offset), smi_value); | 3964 __ Move(FieldOperand(write_register, offset), smi_value); |
3974 } else if (operand_value->IsRegister()) { | 3965 } else if (operand_value->IsRegister()) { |
3975 __ movq(FieldOperand(write_register, offset), | 3966 __ movq(FieldOperand(write_register, offset), |
3976 ToRegister(operand_value)); | 3967 ToRegister(operand_value)); |
3977 } else { | 3968 } else { |
3978 Handle<Object> handle_value = ToHandle(operand_value); | 3969 Handle<Object> handle_value = ToHandle(operand_value); |
| 3970 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
3979 __ Move(FieldOperand(write_register, offset), handle_value); | 3971 __ Move(FieldOperand(write_register, offset), handle_value); |
3980 } | 3972 } |
3981 } else { | 3973 } else { |
3982 __ movq(FieldOperand(write_register, offset), ToRegister(instr->value())); | 3974 __ movq(FieldOperand(write_register, offset), ToRegister(instr->value())); |
3983 } | 3975 } |
3984 | 3976 |
3985 if (instr->hydrogen()->NeedsWriteBarrier()) { | 3977 if (instr->hydrogen()->NeedsWriteBarrier()) { |
3986 Register value = ToRegister(instr->value()); | 3978 Register value = ToRegister(instr->value()); |
3987 Register temp = instr->is_in_object() ? ToRegister(instr->temp()) : object; | 3979 Register temp = instr->is_in_object() ? ToRegister(instr->temp()) : object; |
3988 // Update the write barrier for the object for in-object properties. | 3980 // Update the write barrier for the object for in-object properties. |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5221 int flags = instr->hydrogen()->fast_elements() | 5213 int flags = instr->hydrogen()->fast_elements() |
5222 ? ObjectLiteral::kFastElements | 5214 ? ObjectLiteral::kFastElements |
5223 : ObjectLiteral::kNoFlags; | 5215 : ObjectLiteral::kNoFlags; |
5224 flags |= instr->hydrogen()->has_function() | 5216 flags |= instr->hydrogen()->has_function() |
5225 ? ObjectLiteral::kHasFunction | 5217 ? ObjectLiteral::kHasFunction |
5226 : ObjectLiteral::kNoFlags; | 5218 : ObjectLiteral::kNoFlags; |
5227 | 5219 |
5228 // Set up the parameters to the stub/runtime call and pick the right | 5220 // Set up the parameters to the stub/runtime call and pick the right |
5229 // runtime function or stub to call. | 5221 // runtime function or stub to call. |
5230 int properties_count = instr->hydrogen()->constant_properties_length() / 2; | 5222 int properties_count = instr->hydrogen()->constant_properties_length() / 2; |
5231 if (instr->hydrogen()->depth() > 1) { | 5223 if ((FLAG_track_double_fields && instr->hydrogen()->may_store_doubles()) || |
| 5224 instr->hydrogen()->depth() > 1) { |
5232 __ PushHeapObject(literals); | 5225 __ PushHeapObject(literals); |
5233 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | 5226 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); |
5234 __ Push(constant_properties); | 5227 __ Push(constant_properties); |
5235 __ Push(Smi::FromInt(flags)); | 5228 __ Push(Smi::FromInt(flags)); |
5236 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 5229 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
5237 } else if (flags != ObjectLiteral::kFastElements || | 5230 } else if (flags != ObjectLiteral::kFastElements || |
5238 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 5231 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
5239 __ PushHeapObject(literals); | 5232 __ PushHeapObject(literals); |
5240 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | 5233 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); |
5241 __ Push(constant_properties); | 5234 __ Push(constant_properties); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5697 FixedArray::kHeaderSize - kPointerSize)); | 5690 FixedArray::kHeaderSize - kPointerSize)); |
5698 __ bind(&done); | 5691 __ bind(&done); |
5699 } | 5692 } |
5700 | 5693 |
5701 | 5694 |
5702 #undef __ | 5695 #undef __ |
5703 | 5696 |
5704 } } // namespace v8::internal | 5697 } } // namespace v8::internal |
5705 | 5698 |
5706 #endif // V8_TARGET_ARCH_X64 | 5699 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |