Reviewers: dcarney,

Description:
Added a workaround for undefined behavior.

Note that this patch is not really a *solution*, it is just enough to
make the undefined behavior unobservable. The real fix would be being
much more correct about sizes and signedness in our code base...

BUG=chromium:464657
LOG=n

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+4, -1 lines):
  M src/compiler/instruction.h
  M src/compiler/instruction.cc


Index: src/compiler/instruction.cc
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc
index d85ae07954eae0856e03600c32284fe11a3bf936..1e8cad3b0275c4c294c25aca295adb46d90a8d30 100644
--- a/src/compiler/instruction.cc
+++ b/src/compiler/instruction.cc
@@ -337,6 +337,9 @@ std::ostream& operator<<(std::ostream& os,
 }


+Constant::Constant(int32_t v) : type_(kInt32), value_(v) {}
+
+
 std::ostream& operator<<(std::ostream& os, const Constant& constant) {
   switch (constant.type()) {
     case Constant::kInt32:
Index: src/compiler/instruction.h
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h
index c9e5761ca94db74b69b6bcc641590d096d32f228..e585eed6d16598ab6668ee64ddec7c2bae534289 100644
--- a/src/compiler/instruction.h
+++ b/src/compiler/instruction.h
@@ -737,7 +737,7 @@ class Constant FINAL {
     kRpoNumber
   };

-  explicit Constant(int32_t v) : type_(kInt32), value_(v) {}
+  explicit Constant(int32_t v);
   explicit Constant(int64_t v) : type_(kInt64), value_(v) {}
explicit Constant(float v) : type_(kFloat32), value_(bit_cast<int32_t>(v)) {} explicit Constant(double v) : type_(kFloat64), value_(bit_cast<int64_t>(v)) {}


--
--
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.

Reply via email to