From: vogelheim@chromium.org Date: Fri, 9 May 2014 12:33:29 +0000 (+0000) Subject: Revert of Prevent calls to ReturnValue::Set with pointer-valued types. (https://coder... X-Git-Tag: upstream/4.7.83~9207 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c3ba95841e5cb3205ef24f26b9561ba2ce98098;p=platform%2Fupstream%2Fv8.git Revert of Prevent calls to ReturnValue::Set with pointer-valued types. (https://codereview.chromium.org/240013004/) Reason for revert: Looks like this broke the "V8 Linux64 ASAN" build. Original issue's description: > Prevent calls to ReturnValue::Set with pointer-valued types. > > Currently, this code will compile: > SomePointer* p = ...; > ReturnValue r = ...; > r.Set(p); > > What happens is that ReturnValue::Set has no pointer-ish overloads, but > a bool one, and hence C++ will convert the pointer to a bool and use > the Set(bool) overload. In other words, the example above is equivalent > to: r.Set(p ? true : false); Which probably isn't what the author had > in mind. This change adds a Set(void*) overload whose body forces a > compile error, to prevent this from happening inadvertently. The only > use of this indeed turned out to be an error. > > (Said error was fixed/removed in crrev.com/267393002.) > > BUG= > R=dcarney@chromium.org > > Committed: https://code.google.com/p/v8/source/detail?r=21217 R=ishell@chromium.org Review URL: https://codereview.chromium.org/271113002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21219 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/include/v8.h b/include/v8.h index 45d2fb6..af8f991 100644 --- a/include/v8.h +++ b/include/v8.h @@ -2429,9 +2429,6 @@ class ReturnValue { // Convenience getter for Isolate V8_INLINE Isolate* GetIsolate(); - // Pointer setter: Uncompilable to prevent inadvertent misuse. - void Set(void* whatever); - private: template friend class ReturnValue; template friend class FunctionCallbackInfo; @@ -5977,12 +5974,6 @@ Isolate* ReturnValue::GetIsolate() { } template -void ReturnValue::Set(void* whatever) { - // Uncompilable to prevent inadvertent misuse. - TYPE_CHECK(void*, Primitive); -} - -template internal::Object* ReturnValue::GetDefaultValue() { // Default value is always the pointer below value_ on the stack. return value_[-1];