Revision: 20409
Author: [email protected]
Date: Tue Apr 1 15:32:06 2014 UTC
Log: Smi immediates are not supported on x64. Do not use it.
[email protected]
BUG=358059
LOG=N
Review URL: https://codereview.chromium.org/217083003
http://code.google.com/p/v8/source/detail?r=20409
Added:
/branches/bleeding_edge/test/mjsunit/regress/regress-358059.js
Modified:
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.cc
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-358059.js Tue Apr
1 15:32:06 2014 UTC
@@ -0,0 +1,13 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function f(a, b) { return b + (a.x++); }
+var o = {};
+o.__defineGetter__('x', function() { return 1; });
+assertEquals(4, f(o, 3));
+assertEquals(4, f(o, 3));
+%OptimizeFunctionOnNextCall(f);
+assertEquals(4, f(o, 3));
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Apr 1
11:59:24 2014 UTC
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Apr 1
15:32:06 2014 UTC
@@ -1820,6 +1820,7 @@
if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) {
if (right->IsConstantOperand()) {
+ ASSERT(!target_rep.IsSmi()); // No support for smi-immediates.
int32_t offset = ToInteger32(LConstantOperand::cast(right));
if (is_p) {
__ leap(ToRegister(instr->result()),
@@ -1838,6 +1839,7 @@
}
} else {
if (right->IsConstantOperand()) {
+ ASSERT(!target_rep.IsSmi()); // No support for smi-immediates.
if (is_p) {
__ addp(ToRegister(left),
Immediate(ToInteger32(LConstantOperand::cast(right))));
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Tue Apr 1 11:42:42 2014
UTC
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Tue Apr 1 15:32:06 2014
UTC
@@ -1532,14 +1532,19 @@
ASSERT(instr->right()->representation().Equals(instr->representation()));
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
HValue* right_candidate = instr->BetterRightOperand();
- LOperand* right = use_lea
- ? UseRegisterOrConstantAtStart(right_candidate)
- : UseOrConstantAtStart(right_candidate);
+ LOperand* right;
+ if (instr->representation().IsSmi()) {
+ // We cannot add a tagged immediate to a tagged value,
+ // so we request it in a register.
+ right = UseRegisterAtStart(right_candidate);
+ } else {
+ right = use_lea ? UseRegisterOrConstantAtStart(right_candidate)
+ : UseOrConstantAtStart(right_candidate);
+ }
LAddI* add = new(zone()) LAddI(left, right);
bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
- LInstruction* result = use_lea
- ? DefineAsRegister(add)
- : DefineSameAsFirst(add);
+ LInstruction* result = use_lea ? DefineAsRegister(add)
+ : DefineSameAsFirst(add);
if (can_overflow) {
result = AssignEnvironment(result);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.