Index: src/messages.js |
diff --git a/src/messages.js b/src/messages.js |
index dd8caf3bd484c773d610e4e71ebee91fa5fe6437..8bfd0bc397fae2c257eb94dd3cdfd68f9e50d264 100644 |
--- a/src/messages.js |
+++ b/src/messages.js |
@@ -224,6 +224,13 @@ function FormatString(format, args) { |
} |
+function NoSideEffectsObjectToString() { |
+ if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; |
+ if (IS_NULL(this)) return "[object Null]"; |
+ return "[object " + %_ClassOf(TO_OBJECT_INLINE(this)) + "]"; |
+} |
+ |
+ |
function NoSideEffectToString(obj) { |
if (IS_STRING(obj)) return obj; |
if (IS_NUMBER(obj)) return %_NumberToString(obj); |
@@ -231,7 +238,7 @@ function NoSideEffectToString(obj) { |
if (IS_UNDEFINED(obj)) return 'undefined'; |
if (IS_NULL(obj)) return 'null'; |
if (IS_FUNCTION(obj)) { |
- var str = %_CallFunction(obj, FunctionToString); |
+ var str = %_CallFunction(obj, obj, $functionSourceString); |
if (str.length > 128) { |
str = %_SubString(str, 0, 111) + "...<omitted>..." + |
%_SubString(str, str.length - 2, str.length); |
@@ -240,7 +247,7 @@ function NoSideEffectToString(obj) { |
} |
if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString); |
if (IS_OBJECT(obj) |
- && %GetDataProperty(obj, "toString") === ObjectToString) { |
+ && %GetDataProperty(obj, "toString") === $objectToString) { |
var constructor = %GetDataProperty(obj, "constructor"); |
if (typeof constructor == "function") { |
var constructorName = constructor.name; |
@@ -292,7 +299,7 @@ function ToStringCheckErrorObject(obj) { |
function ToDetailString(obj) { |
- if (obj != null && IS_OBJECT(obj) && obj.toString === ObjectToString) { |
+ if (obj != null && IS_OBJECT(obj) && obj.toString === $objectToString) { |
var constructor = obj.constructor; |
if (typeof constructor == "function") { |
var constructorName = constructor.name; |
@@ -570,7 +577,7 @@ function ScriptNameOrSourceURL() { |
} |
-SetUpLockedPrototype(Script, [ |
+$setUpLockedPrototype(Script, [ |
"source", |
"name", |
"source_url", |
@@ -634,7 +641,7 @@ function SourceLocationSourceText() { |
} |
-SetUpLockedPrototype(SourceLocation, |
+$setUpLockedPrototype(SourceLocation, |
["script", "position", "line", "column", "start", "end"], |
["sourceText", SourceLocationSourceText] |
); |
@@ -678,7 +685,7 @@ function SourceSliceSourceText() { |
$stringSubstring); |
} |
-SetUpLockedPrototype(SourceSlice, |
+$setUpLockedPrototype(SourceSlice, |
["script", "from_line", "to_line", "from_position", "to_position"], |
["sourceText", SourceSliceSourceText] |
); |
@@ -773,8 +780,8 @@ function CallSiteGetMethodName() { |
var fun = GET_PRIVATE(this, CallSiteFunctionKey); |
var ownName = fun.name; |
if (ownName && receiver && |
- (%_CallFunction(receiver, ownName, ObjectLookupGetter) === fun || |
- %_CallFunction(receiver, ownName, ObjectLookupSetter) === fun || |
+ (%_CallFunction(receiver, ownName, $objectLookupGetter) === fun || |
+ %_CallFunction(receiver, ownName, $objectLookupSetter) === fun || |
(IS_OBJECT(receiver) && %GetDataProperty(receiver, ownName) === fun))) { |
// To handle DontEnum properties we guess that the method has |
// the same name as the function. |
@@ -782,8 +789,8 @@ function CallSiteGetMethodName() { |
} |
var name = null; |
for (var prop in receiver) { |
- if (%_CallFunction(receiver, prop, ObjectLookupGetter) === fun || |
- %_CallFunction(receiver, prop, ObjectLookupSetter) === fun || |
+ if (%_CallFunction(receiver, prop, $objectLookupGetter) === fun || |
+ %_CallFunction(receiver, prop, $objectLookupSetter) === fun || |
(IS_OBJECT(receiver) && %GetDataProperty(receiver, prop) === fun)) { |
// If we find more than one match bail out to avoid confusion. |
if (name) { |
@@ -900,7 +907,7 @@ function CallSiteToString() { |
return line; |
} |
-SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [ |
+$setUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [ |
"getThis", CallSiteGetThis, |
"getTypeName", CallSiteGetTypeName, |
"isToplevel", CallSiteIsToplevel, |
@@ -1089,9 +1096,9 @@ var StackTraceSetter = function(v) { |
// when constructing the initial Error prototytpes. |
var captureStackTrace = function captureStackTrace(obj, cons_opt) { |
// Define accessors first, as this may fail and throw. |
- ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
- set: StackTraceSetter, |
- configurable: true }); |
+ $objectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
+ set: StackTraceSetter, |
+ configurable: true }); |
%CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
} |
@@ -1215,7 +1222,8 @@ function ErrorToString() { |
} |
} |
-InstallFunctions(GlobalError.prototype, DONT_ENUM, ['toString', ErrorToString]); |
+$installFunctions(GlobalError.prototype, DONT_ENUM, |
+ ['toString', ErrorToString]); |
$errorToString = ErrorToString; |
$formatMessage = FormatMessage; |