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

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

Issue 108413003: HStoreNamedField for Smis optimized for x64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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
« src/hydrogen-instructions.h ('K') | « src/objects-inl.h ('k') | no next file » | 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 7c9949a1fad8da5b441e7ecd79d96ab41dbea073..902cea1669e29e0527f14d6a5f95eeb270fe0948 100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -3946,7 +3946,8 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
if (FLAG_track_fields && representation.IsSmi()) {
if (instr->value()->IsConstantOperand()) {
LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
- if (!IsSmiConstant(operand_value)) {
+ if (!IsInteger32Constant(operand_value) &&
+ !IsSmiConstant(operand_value)) {
DeoptimizeIf(no_condition, instr->environment());
}
}
@@ -4001,6 +4002,19 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
__ movq(write_register, FieldOperand(object, JSObject::kPropertiesOffset));
}
+ bool kScratchRegisterContainsZero = false;
+ if (representation.IsSmi()) {
+ if (!instr->hydrogen()->can_omit_smi_tag_store()) {
+ // Clear the smi tag as we are not sure that it contains the right value.
+ __ xorl(kScratchRegister, kScratchRegister);
+ kScratchRegisterContainsZero = true;
+ __ movl(FieldOperand(write_register, offset), kScratchRegister);
Toon Verwaest 2013/12/09 15:51:10 What about just shifting up the value and storing
Igor Sheludko 2013/12/10 09:13:08 Done.
+ }
+ // Deal with the upper part of the smi containing the value.
+ offset += kPointerSize / 2;
+ representation = Representation::Integer32();
+ }
+
if (instr->value()->IsConstantOperand()) {
LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
if (operand_value->IsRegister()) {
@@ -4009,7 +4023,11 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
} else if (representation.IsInteger32()) {
int32_t value = ToInteger32(operand_value);
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
- __ movl(FieldOperand(write_register, offset), Immediate(value));
+ if ((value == 0) && kScratchRegisterContainsZero) {
+ __ movl(FieldOperand(write_register, offset), kScratchRegister);
+ } else {
+ __ movl(FieldOperand(write_register, offset), Immediate(value));
+ }
} else {
Handle<Object> handle_value = ToHandle(operand_value);
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
« src/hydrogen-instructions.h ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698