Reviewers: Sven Panne,

Description:
ReturnValue::Set(uint32_t) is wrong

[email protected]
BUG=

Please review this at https://chromiumcodereview.appspot.com/16365008/

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

Affected files:
  M include/v8.h


Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 28a63f092efb5a7831ccd5a891a9cffddbf4f655..cc99f5039b6e8cb3a66c17972424179fda0bb46c 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5666,8 +5666,9 @@ void ReturnValue<T>::Set(int32_t i) {
 template<typename T>
 void ReturnValue<T>::Set(uint32_t i) {
   typedef internal::Internals I;
-  if (V8_LIKELY(I::IsValidSmi(i))) {
-    *value_ = I::IntToSmi(i);
+  bool fits_into_int32_t = (i & (1 << 31)) == 0;
+  if (V8_LIKELY(fits_into_int32_t)) {
+    Set(static_cast<int32_t>(i));
     return;
   }
   Set(Integer::NewFromUnsigned(i, GetIsolate()));


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