Reviewers: Yang,

Description:
Refine error message

[email protected]
BUG=

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

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

Affected files:
  M src/ia32/full-codegen-ia32.cc
  M src/messages.js
  M src/runtime.js
  M test/mjsunit/function-call.js


Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index cf3132d33fd1ff0bb12825bdb0866779d2963c95..ec41bc6e823630ec83950d4c83b9beafb5045fe9 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -107,6 +107,7 @@ class JumpPatchSite BASE_EMBEDDED {
 // formal parameter count expected by the function.
 //
 // The live registers are:
+//   o ecx: CallKind
 //   o edi: the JS function object being called (i.e. ourselves)
 //   o esi: our context
 //   o ebp: our caller's frame pointer
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 137d98fe7b8d73241fdee55c9874865dd00ab851..6c9e2d79b26d12d87e1dc5b03b99cc7e7318d2ad 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -73,7 +73,7 @@ var kMessages = {
invalid_in_operator_use: ["Cannot use 'in' operator to search for '", "%0", "' in ", "%1"], instanceof_function_expected: ["Expecting a function in instanceof check, but got ", "%0"], instanceof_nonobject_proto: ["Function has non-object prototype '", "%0", "' in instanceof check"],
-  null_to_object:                ["Cannot convert null to object"],
+ undefined_or_null_to_object: ["Cannot convert undefined or null to object"], reduce_no_initial: ["Reduce of empty array with no initial value"],
   getter_must_be_callable:       ["Getter must be a function: ", "%0"],
   setter_must_be_callable:       ["Setter must be a function: ", "%0"],
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index 348fd747f5b9171c45b493bc824d92a4ba725911..90fb36b42231c810cf0e74b7684a65f71dbe4e96 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -587,7 +587,7 @@ function ToObject(x) {
   if (IS_NUMBER(x)) return new $Number(x);
   if (IS_BOOLEAN(x)) return new $Boolean(x);
   if (IS_NULL_OR_UNDEFINED(x) && !IS_UNDETECTABLE(x)) {
-    throw %MakeTypeError('null_to_object', []);
+    throw %MakeTypeError('undefined_or_null_to_object', []);
   }
   return x;
 }
Index: test/mjsunit/function-call.js
diff --git a/test/mjsunit/function-call.js b/test/mjsunit/function-call.js
index 92792ac8273d8a82f15eecd48952efc08af5a052..797eef04a6ae6860c11a267c1138d539f6f28861 100644
--- a/test/mjsunit/function-call.js
+++ b/test/mjsunit/function-call.js
@@ -151,7 +151,7 @@ var reducing_functions =

 function checkExpectedMessage(e) {
   assertTrue(e.message.indexOf("called on null or undefined") >= 0 ||
-             e.message.indexOf("Cannot convert null to object") >= 0);
+ e.message.indexOf("Cannot convert undefined or null to object") >= 0);
 }

 // Test that all natives using the ToObject call throw the right exception.


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