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

Unified Diff: include/v8.h

Issue 16365008: ReturnValue::Set(uint32_t) is wrong (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: added tests Created 7 years, 6 months 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
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 5526705c84269523ab7eafd144ab26dd12aa594e..78598c9f163d31486f60f963aee6b15b7622f662 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5674,8 +5674,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;
Sven Panne 2013/06/07 07:05:06 I think 'i < INT32_MAX' is more readable than this
+ if (V8_LIKELY(fits_into_int32_t)) {
+ Set(static_cast<int32_t>(i));
return;
}
Set(Integer::NewFromUnsigned(i, GetIsolate()));
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698