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

Unified Diff: src/api.cc

Issue 113023: X64: Made hash computation in serializer accept 64-bit pointers. (Closed)
Patch Set: Created 11 years, 7 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 | src/objects.h » ('j') | src/objects.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index a811a29ad013605098cd6e14d67e6eada02b2cbe..f192a01e98c78fbafdd06ba240277da7bad4c921 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2680,10 +2680,13 @@ Local<Value> v8::External::Wrap(void* data) {
ENTER_V8;
if ((reinterpret_cast<intptr_t>(data) & kAlignedPointerMask) == 0) {
uintptr_t data_ptr = reinterpret_cast<uintptr_t>(data);
- int data_value = static_cast<int>(data_ptr >> kAlignedPointerShift);
+ intptr_t data_value =
+ static_cast<intptr_t>(data_ptr >> kAlignedPointerShift);
STATIC_ASSERT(sizeof(data_ptr) == sizeof(data_value));
- i::Handle<i::Object> obj(i::Smi::FromInt(data_value));
- return Utils::ToLocal(obj);
+ if (i::Smi::IsPtrValid(data_value)) {
+ i::Handle<i::Object> obj(i::Smi::FromIntptr(data_value));
+ return Utils::ToLocal(obj);
+ }
}
return ExternalNewImpl(data);
}
@@ -2694,7 +2697,8 @@ void* v8::External::Unwrap(v8::Handle<v8::Value> value) {
i::Handle<i::Object> obj = Utils::OpenHandle(*value);
if (obj->IsSmi()) {
// The external value was an aligned pointer.
- uintptr_t result = i::Smi::cast(*obj)->value() << kAlignedPointerShift;
+ uintptr_t result = static_cast<uintptr_t>(
+ i::Smi::cast(*obj)->value()) << kAlignedPointerShift;
return reinterpret_cast<void*>(result);
}
return ExternalValueImpl(obj);
« no previous file with comments | « no previous file | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698