Reviewers: Toon Verwaest,

Description:
Fix representation requirement in HReturn.

BUG=

Please review this at https://codereview.chromium.org/143523002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+18, -9 lines):
  M src/hydrogen-instructions.h
  M src/hydrogen-instructions.cc
  A + test/mjsunit/regress-333594.js


Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 9d526434493f0ea1905ab79abc3614d50d7c46b0..062b5ae7ace247dc6a38891952d77c0f827c7143 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -2531,6 +2531,7 @@ HConstant::HConstant(Handle<Object> handle, Representation r)
     has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_);
     double_value_ = n;
     has_double_value_ = true;
+    // TODO(titzer): if this heap number is new space, tenure a new one.
   } else {
     is_internalized_string_ = handle->IsInternalizedString();
   }
@@ -2729,6 +2730,9 @@ void HConstant::PrintDataTo(StringStream* stream) {
   } else {
     handle(Isolate::Current())->ShortPrint(stream);
   }
+  if (!is_not_in_new_space_) {
+    stream->Add("[new space] ");
+  }
 }


Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index f7cbbee51a2b1caeeaa3161edef631d2c27e245a..fe701aeca6a11471ccdc35c48a4e89ba0ccd73f5 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -1581,6 +1581,8 @@ class HReturn V8_FINAL : public HTemplateControlInstruction<0, 3> {
   DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*);

virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
+    // TODO(titzer): require an Int32 input for faster returns.
+    if (index == 2) return Representation::Smi();
     return Representation::Tagged();
   }

Index: test/mjsunit/regress-333594.js
diff --git a/test/mjsunit/lithium/MathExp.js b/test/mjsunit/regress-333594.js
similarity index 86%
copy from test/mjsunit/lithium/MathExp.js
copy to test/mjsunit/regress-333594.js
index 854ff5fd7fd2a7a22bcc3557e4e2bb4c01d9b83f..6f6dbaafcd64d8b752226a290df525ca200b69a0 100644
--- a/test/mjsunit/lithium/MathExp.js
+++ b/test/mjsunit/regress-333594.js
@@ -1,4 +1,4 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
+// Copyright 2014 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -27,13 +27,16 @@

 // Flags: --allow-natives-syntax

-function foo(x) {
-  return Math.exp(x);
-}
+var a = { x: 1.1 };
+a.x = 0;
+var G = a.x;
+var o = { x: {} };

-foo(12.3);
-var r1 = foo(12.3);
-%OptimizeFunctionOnNextCall(foo);
-var r2 = foo(12.3);
+function func() {
+  return {x: G};
+}

-assertEquals(r1, r2);
+func();
+func();
+%OptimizeFunctionOnNextCall(func);
+assertEquals(0, func().x);


--
--
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/groups/opt_out.

Reply via email to