Reviewers: Sven Panne,

Description:
use undefined as the default return value for runtime callbacks

[email protected]
BUG=

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

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

Affected files:
  M src/arguments.h
  M src/arguments.cc
  M test/cctest/test-api.cc


Index: src/arguments.cc
diff --git a/src/arguments.cc b/src/arguments.cc
index 091d0b92a47af1bd61377ce155f142ef9e078b17..afbb66c8164239510200438729ece53184a8287b 100644
--- a/src/arguments.cc
+++ b/src/arguments.cc
@@ -81,7 +81,7 @@ v8::Handle<V> CustomArguments<T>::GetReturnValue(Isolate* isolate) {
   // Check the ReturnValue.
   Object** handle = &this->end()[kReturnValueOffset];
   // Nothing was set, return empty handle as per previous behaviour.
-  if ((*handle)->IsTheHole()) return v8::Handle<V>();
+  if ((*handle)->IsUndefined()) return v8::Handle<V>();
   return v8::Handle<V>(reinterpret_cast<V*>(handle));
 }

Index: src/arguments.h
diff --git a/src/arguments.h b/src/arguments.h
index e13ddc9ec83f0f69e1bdb53d00a18ca9b5522310..c4483c44ac28c92c9448b441408a322a7aa28ef1 100644
--- a/src/arguments.h
+++ b/src/arguments.h
@@ -253,7 +253,7 @@ class PropertyCallbackArguments
     values[T::kHolderIndex] = holder;
     values[T::kDataIndex] = data;
     values[T::kIsolateIndex] = reinterpret_cast<Object*>(isolate);
-    values[T::kReturnValueIndex] = isolate->heap()->the_hole_value();
+    values[T::kReturnValueIndex] = isolate->heap()->undefined_value();
     ASSERT(values[T::kHolderIndex]->IsHeapObject());
     ASSERT(values[T::kIsolateIndex]->IsSmi());
   }
@@ -313,7 +313,7 @@ class FunctionCallbackArguments
     values[T::kCalleeIndex] = callee;
     values[T::kHolderIndex] = holder;
values[T::kIsolateIndex] = reinterpret_cast<internal::Object*>(isolate);
-    values[T::kReturnValueIndex] = isolate->heap()->the_hole_value();
+    values[T::kReturnValueIndex] = isolate->heap()->undefined_value();
     ASSERT(values[T::kCalleeIndex]->IsJSFunction());
     ASSERT(values[T::kHolderIndex]->IsHeapObject());
     ASSERT(values[T::kIsolateIndex]->IsSmi());
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index cb34bed76cf085e7e9414d91d9bb56a41cf1f317..c7836811a26096776898eaaa5671cae21be9c738 100755
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -809,7 +809,7 @@ static void CheckReturnValue(const T& t) {
   i::Object** o = *reinterpret_cast<i::Object***>(&rv);
   CHECK_EQ(v8::Isolate::GetCurrent(), t.GetIsolate());
   CHECK_EQ(t.GetIsolate(), rv.GetIsolate());
-  CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
+  CHECK((*o)->IsUndefined());
 }

 static v8::Handle<Value> handle_call(const v8::Arguments& args) {


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