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

Unified Diff: src/x64/lithium-codegen-x64.cc

Issue 14850006: Use mutable heapnumbers to store doubles in fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported to ARM and x64 Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index 3b873699135edefe1b2b36e417b29962e3b2c22b..28b784c33bece55ec87ef4a895f3c91d40a5fbe5 100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -2668,29 +2668,21 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) {
void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
+ int offset = instr->hydrogen()->offset();
Register object = ToRegister(instr->object());
- if (!FLAG_track_double_fields) {
- ASSERT(!instr->hydrogen()->representation().IsDouble());
+ if (FLAG_track_double_fields &&
+ instr->hydrogen()->representation().IsDouble()) {
+ XMMRegister result = ToDoubleRegister(instr->result());
+ __ movsd(result, FieldOperand(object, offset));
+ return;
}
- Register temp = instr->hydrogen()->representation().IsDouble()
- ? ToRegister(instr->temp()) : ToRegister(instr->result());
+
+ Register result = ToRegister(instr->result());
if (instr->hydrogen()->is_in_object()) {
- __ movq(temp, FieldOperand(object, instr->hydrogen()->offset()));
+ __ movq(result, FieldOperand(object, offset));
} else {
- __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset));
- __ movq(temp, FieldOperand(temp, instr->hydrogen()->offset()));
- }
-
- if (instr->hydrogen()->representation().IsDouble()) {
- Label load_from_heap_number, done;
- XMMRegister result = ToDoubleRegister(instr->result());
- __ JumpIfNotSmi(temp, &load_from_heap_number);
- __ SmiToInteger32(temp, temp);
- __ cvtlsi2sd(result, temp);
- __ jmp(&done);
- __ bind(&load_from_heap_number);
- __ movsd(result, FieldOperand(temp, HeapNumber::kValueOffset));
- __ bind(&done);
+ __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset));
+ __ movq(result, FieldOperand(result, offset));
}
}
@@ -3910,6 +3902,8 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
int offset = instr->offset();
+ Handle<Map> transition = instr->transition();
+
if (FLAG_track_fields && representation.IsSmi()) {
if (instr->value()->IsConstantOperand()) {
LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
@@ -3920,18 +3914,15 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
Register value = ToRegister(instr->value());
__ Integer32ToSmi(value, value);
}
- } else if (FLAG_track_double_fields && representation.IsDouble() &&
- !instr->hydrogen()->value()->type().IsSmi() &&
- !instr->hydrogen()->value()->type().IsHeapNumber()) {
- Register value = ToRegister(instr->value());
- Label do_store;
- __ JumpIfSmi(value, &do_store);
- Handle<Map> map(isolate()->factory()->heap_number_map());
- DoCheckMapCommon(value, map, REQUIRE_EXACT_MAP, instr);
- __ bind(&do_store);
+ } else if (FLAG_track_double_fields && representation.IsDouble()) {
+ ASSERT(transition.is_null());
+ ASSERT(instr->is_in_object());
+ ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
+ XMMRegister value = ToDoubleRegister(instr->value());
+ __ movsd(FieldOperand(object, offset), value);
+ return;
}
- Handle<Map> transition = instr->transition();
if (!transition.is_null()) {
if (transition->CanBeDeprecated()) {
transition_maps_.Add(transition, info()->zone());
@@ -3976,6 +3967,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
ToRegister(operand_value));
} else {
Handle<Object> handle_value = ToHandle(operand_value);
+ ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
__ Move(FieldOperand(write_register, offset), handle_value);
}
} else {
@@ -5228,7 +5220,8 @@ void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
// Set up the parameters to the stub/runtime call and pick the right
// runtime function or stub to call.
int properties_count = instr->hydrogen()->constant_properties_length() / 2;
- if (instr->hydrogen()->depth() > 1) {
+ if ((FLAG_track_double_fields && instr->hydrogen()->may_store_doubles()) ||
+ instr->hydrogen()->depth() > 1) {
__ PushHeapObject(literals);
__ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
__ Push(constant_properties);
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698