Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 25696004: Add support to load/store byte fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Also adjust HLoadNamedField::InferRange. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 2719
2720 __ bind(&skip_assignment); 2720 __ bind(&skip_assignment);
2721 } 2721 }
2722 2722
2723 2723
2724 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 2724 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2725 HObjectAccess access = instr->hydrogen()->access(); 2725 HObjectAccess access = instr->hydrogen()->access();
2726 int offset = access.offset(); 2726 int offset = access.offset();
2727 2727
2728 if (access.IsExternalMemory()) { 2728 if (access.IsExternalMemory()) {
2729 ASSERT(!access.representation().IsInteger32());
2730 Register result = ToRegister(instr->result()); 2729 Register result = ToRegister(instr->result());
2731 if (instr->object()->IsConstantOperand()) { 2730 if (instr->object()->IsConstantOperand()) {
2732 ASSERT(result.is(rax)); 2731 ASSERT(result.is(rax));
2733 __ load_rax(ToExternalReference(LConstantOperand::cast(instr->object()))); 2732 __ load_rax(ToExternalReference(LConstantOperand::cast(instr->object())));
2734 } else { 2733 } else {
2735 Register object = ToRegister(instr->object()); 2734 Register object = ToRegister(instr->object());
2736 __ movq(result, MemOperand(object, offset)); 2735 __ Load(result, MemOperand(object, offset), access.representation());
2737 } 2736 }
2738 return; 2737 return;
2739 } 2738 }
2740 2739
2741 Register object = ToRegister(instr->object()); 2740 Register object = ToRegister(instr->object());
2742 if (FLAG_track_double_fields && 2741 if (FLAG_track_double_fields &&
2743 instr->hydrogen()->representation().IsDouble()) { 2742 instr->hydrogen()->representation().IsDouble()) {
2744 XMMRegister result = ToDoubleRegister(instr->result()); 2743 XMMRegister result = ToDoubleRegister(instr->result());
2745 __ movsd(result, FieldOperand(object, offset)); 2744 __ movsd(result, FieldOperand(object, offset));
2746 return; 2745 return;
2747 } 2746 }
2748 2747
2749 Register result = ToRegister(instr->result()); 2748 Register result = ToRegister(instr->result());
2750 if (access.IsInobject()) { 2749 if (!access.IsInobject()) {
2751 if (access.representation().IsInteger32()) {
2752 __ movl(result, FieldOperand(object, offset));
2753 } else {
2754 __ movq(result, FieldOperand(object, offset));
2755 }
2756 } else {
2757 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); 2750 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset));
2758 if (access.representation().IsInteger32()) { 2751 object = result;
2759 __ movl(result, FieldOperand(result, offset));
2760 } else {
2761 __ movq(result, FieldOperand(result, offset));
2762 }
2763 } 2752 }
2753 __ Load(result, FieldOperand(object, offset), access.representation());
2764 } 2754 }
2765 2755
2766 2756
2767 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 2757 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2768 ASSERT(ToRegister(instr->object()).is(rax)); 2758 ASSERT(ToRegister(instr->object()).is(rax));
2769 ASSERT(ToRegister(instr->result()).is(rax)); 2759 ASSERT(ToRegister(instr->result()).is(rax));
2770 2760
2771 __ Move(rcx, instr->name()); 2761 __ Move(rcx, instr->name());
2772 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2762 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2773 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2763 CallCode(ic, RelocInfo::CODE_TARGET, instr);
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
3871 } 3861 }
3872 3862
3873 3863
3874 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 3864 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
3875 Representation representation = instr->representation(); 3865 Representation representation = instr->representation();
3876 3866
3877 HObjectAccess access = instr->hydrogen()->access(); 3867 HObjectAccess access = instr->hydrogen()->access();
3878 int offset = access.offset(); 3868 int offset = access.offset();
3879 3869
3880 if (access.IsExternalMemory()) { 3870 if (access.IsExternalMemory()) {
3881 ASSERT(!access.representation().IsInteger32());
3882 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); 3871 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3883 Register value = ToRegister(instr->value()); 3872 Register value = ToRegister(instr->value());
3884 if (instr->object()->IsConstantOperand()) { 3873 if (instr->object()->IsConstantOperand()) {
3885 ASSERT(value.is(rax)); 3874 ASSERT(value.is(rax));
3875 ASSERT(!access.representation().IsSpecialization());
3886 LConstantOperand* object = LConstantOperand::cast(instr->object()); 3876 LConstantOperand* object = LConstantOperand::cast(instr->object());
3887 __ store_rax(ToExternalReference(object)); 3877 __ store_rax(ToExternalReference(object));
3888 } else { 3878 } else {
3889 Register object = ToRegister(instr->object()); 3879 Register object = ToRegister(instr->object());
3890 __ movq(MemOperand(object, offset), value); 3880 __ Store(MemOperand(object, offset), value, representation);
3891 } 3881 }
3892 return; 3882 return;
3893 } 3883 }
3894 3884
3895 Register object = ToRegister(instr->object()); 3885 Register object = ToRegister(instr->object());
3896 Handle<Map> transition = instr->transition(); 3886 Handle<Map> transition = instr->transition();
3897 3887
3898 if (FLAG_track_fields && representation.IsSmi()) { 3888 if (FLAG_track_fields && representation.IsSmi()) {
3899 if (instr->value()->IsConstantOperand()) { 3889 if (instr->value()->IsConstantOperand()) {
3900 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); 3890 LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3949 3939
3950 Register write_register = object; 3940 Register write_register = object;
3951 if (!access.IsInobject()) { 3941 if (!access.IsInobject()) {
3952 write_register = ToRegister(instr->temp()); 3942 write_register = ToRegister(instr->temp());
3953 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); 3943 __ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset));
3954 } 3944 }
3955 3945
3956 if (instr->value()->IsConstantOperand()) { 3946 if (instr->value()->IsConstantOperand()) {
3957 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); 3947 LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
3958 if (operand_value->IsRegister()) { 3948 if (operand_value->IsRegister()) {
3959 if (access.representation().IsInteger32()) { 3949 Register value = ToRegister(operand_value);
3960 __ movl(FieldOperand(write_register, offset), 3950 __ Store(FieldOperand(write_register, offset), value, representation);
3961 ToRegister(operand_value));
3962 } else {
3963 __ movq(FieldOperand(write_register, offset),
3964 ToRegister(operand_value));
3965 }
3966 } else { 3951 } else {
3967 Handle<Object> handle_value = ToHandle(operand_value); 3952 Handle<Object> handle_value = ToHandle(operand_value);
3968 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); 3953 ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
3969 __ Move(FieldOperand(write_register, offset), handle_value); 3954 __ Move(FieldOperand(write_register, offset), handle_value);
3970 } 3955 }
3971 } else { 3956 } else {
3972 if (access.representation().IsInteger32()) { 3957 Register value = ToRegister(instr->value());
3973 __ movl(FieldOperand(write_register, offset), ToRegister(instr->value())); 3958 __ Store(FieldOperand(write_register, offset), value, representation);
3974 } else {
3975 __ movq(FieldOperand(write_register, offset), ToRegister(instr->value()));
3976 }
3977 } 3959 }
3978 3960
3979 if (instr->hydrogen()->NeedsWriteBarrier()) { 3961 if (instr->hydrogen()->NeedsWriteBarrier()) {
3980 Register value = ToRegister(instr->value()); 3962 Register value = ToRegister(instr->value());
3981 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; 3963 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object;
3982 // Update the write barrier for the object for in-object properties. 3964 // Update the write barrier for the object for in-object properties.
3983 __ RecordWriteField(write_register, 3965 __ RecordWriteField(write_register,
3984 offset, 3966 offset,
3985 value, 3967 value,
3986 temp, 3968 temp,
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
5458 FixedArray::kHeaderSize - kPointerSize)); 5440 FixedArray::kHeaderSize - kPointerSize));
5459 __ bind(&done); 5441 __ bind(&done);
5460 } 5442 }
5461 5443
5462 5444
5463 #undef __ 5445 #undef __
5464 5446
5465 } } // namespace v8::internal 5447 } } // namespace v8::internal
5466 5448
5467 #endif // V8_TARGET_ARCH_X64 5449 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698