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

Unified Diff: src/messages.js

Issue 1123703002: Reland "Wrap v8natives.js into a function." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: revert stack trace printing Created 5 years, 8 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 | « src/math.js ('k') | src/mirror-debugger.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 4d400f29209231643d80f2de6073efd5d8a8cbfa..71a132563aa1da74cd07a7a61ea69e89d0e7bcb2 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -238,6 +238,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);
@@ -245,7 +252,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);
@@ -254,7 +261,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;
@@ -306,7 +313,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;
@@ -584,7 +591,7 @@ function ScriptNameOrSourceURL() {
}
-SetUpLockedPrototype(Script, [
+$setUpLockedPrototype(Script, [
"source",
"name",
"source_url",
@@ -648,7 +655,7 @@ function SourceLocationSourceText() {
}
-SetUpLockedPrototype(SourceLocation,
+$setUpLockedPrototype(SourceLocation,
["script", "position", "line", "column", "start", "end"],
["sourceText", SourceLocationSourceText]
);
@@ -692,7 +699,7 @@ function SourceSliceSourceText() {
$stringSubstring);
}
-SetUpLockedPrototype(SourceSlice,
+$setUpLockedPrototype(SourceSlice,
["script", "from_line", "to_line", "from_position", "to_position"],
["sourceText", SourceSliceSourceText]
);
@@ -787,8 +794,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.
@@ -796,8 +803,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) {
@@ -914,7 +921,7 @@ function CallSiteToString() {
return line;
}
-SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [
+$setUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [
"getThis", CallSiteGetThis,
"getTypeName", CallSiteGetTypeName,
"isToplevel", CallSiteIsToplevel,
@@ -1103,9 +1110,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);
}
@@ -1229,7 +1236,8 @@ function ErrorToString() {
}
}
-InstallFunctions(GlobalError.prototype, DONT_ENUM, ['toString', ErrorToString]);
+$installFunctions(GlobalError.prototype, DONT_ENUM,
+ ['toString', ErrorToString]);
$errorToString = ErrorToString;
$formatMessage = FormatMessage;
« no previous file with comments | « src/math.js ('k') | src/mirror-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698