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

Side by Side Diff: src/messages.js

Issue 1302533002: Native context: debug.js does not load from js builtins object anymore. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: make importing requirement more explicit Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/macros.py ('k') | src/prologue.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // ------------------------------------------------------------------- 5 // -------------------------------------------------------------------
6 6
7 var $errorToString; 7 var $errorToString;
8 var $internalErrorSymbol; 8 var $internalErrorSymbol;
9 var $stackTraceSymbol; 9 var $stackTraceSymbol;
10 var MakeError; 10 var MakeError;
11 var MakeEvalError; 11 var MakeEvalError;
12 var MakeRangeError; 12 var MakeRangeError;
13 var MakeReferenceError; 13 var MakeReferenceError;
14 var MakeSyntaxError; 14 var MakeSyntaxError;
15 var MakeTypeError; 15 var MakeTypeError;
16 var MakeURIError; 16 var MakeURIError;
17 17
18 (function(global, utils) { 18 (function(global, utils) {
19 19
20 %CheckIsBootstrapping(); 20 %CheckIsBootstrapping();
21 21
22 // ------------------------------------------------------------------- 22 // -------------------------------------------------------------------
23 // Imports 23 // Imports
24 24
25 var ArrayJoin;
26 var Bool16x8ToString;
27 var Bool32x4ToString;
28 var Bool8x16ToString;
29 var Float32x4ToString;
30 var FunctionSourceString
25 var GlobalObject = global.Object; 31 var GlobalObject = global.Object;
32 var Int16x8ToString;
33 var Int32x4ToString;
34 var Int8x16ToString;
26 var InternalArray = utils.InternalArray; 35 var InternalArray = utils.InternalArray;
27 var ObjectDefineProperty = utils.ObjectDefineProperty; 36 var ObjectDefineProperty;
28
29 var ArrayJoin;
30 var ObjectToString; 37 var ObjectToString;
31 var StringCharAt; 38 var StringCharAt;
32 var StringIndexOf; 39 var StringIndexOf;
33 var StringSubstring; 40 var StringSubstring;
34 41 var ToString;
35 var Float32x4ToString;
36 var Int32x4ToString;
37 var Bool32x4ToString;
38 var Int16x8ToString;
39 var Bool16x8ToString;
40 var Int8x16ToString;
41 var Bool8x16ToString;
42
43 42
44 utils.Import(function(from) { 43 utils.Import(function(from) {
45 ArrayJoin = from.ArrayJoin; 44 ArrayJoin = from.ArrayJoin;
45 Bool16x8ToString = from.Bool16x8ToString;
46 Bool32x4ToString = from.Bool32x4ToString;
47 Bool8x16ToString = from.Bool8x16ToString;
48 Float32x4ToString = from.Float32x4ToString;
49 FunctionSourceString = from.FunctionSourceString;
50 Int16x8ToString = from.Int16x8ToString;
51 Int32x4ToString = from.Int32x4ToString;
52 Int8x16ToString = from.Int8x16ToString;
53 ObjectDefineProperty = from.ObjectDefineProperty;
46 ObjectToString = from.ObjectToString; 54 ObjectToString = from.ObjectToString;
47 StringCharAt = from.StringCharAt; 55 StringCharAt = from.StringCharAt;
48 StringIndexOf = from.StringIndexOf; 56 StringIndexOf = from.StringIndexOf;
49 StringSubstring = from.StringSubstring; 57 StringSubstring = from.StringSubstring;
50 Float32x4ToString = from.Float32x4ToString; 58 });
51 Int32x4ToString = from.Int32x4ToString; 59
52 Bool32x4ToString = from.Bool32x4ToString; 60 utils.ImportNow(function(from) {
53 Int16x8ToString = from.Int16x8ToString; 61 ToString = from.ToString;
54 Bool16x8ToString = from.Bool16x8ToString;
55 Int8x16ToString = from.Int8x16ToString;
56 Bool8x16ToString = from.Bool8x16ToString;
57 }); 62 });
58 63
59 // ------------------------------------------------------------------- 64 // -------------------------------------------------------------------
60 65
61 var GlobalError; 66 var GlobalError;
62 var GlobalTypeError; 67 var GlobalTypeError;
63 var GlobalRangeError; 68 var GlobalRangeError;
64 var GlobalURIError; 69 var GlobalURIError;
65 var GlobalSyntaxError; 70 var GlobalSyntaxError;
66 var GlobalReferenceError; 71 var GlobalReferenceError;
67 var GlobalEvalError; 72 var GlobalEvalError;
68 73
69 74
70 function NoSideEffectsObjectToString() { 75 function NoSideEffectsObjectToString() {
71 if (IS_UNDEFINED(this)) return "[object Undefined]"; 76 if (IS_UNDEFINED(this)) return "[object Undefined]";
72 if (IS_NULL(this)) return "[object Null]"; 77 if (IS_NULL(this)) return "[object Null]";
73 return "[object " + %_ClassOf(TO_OBJECT(this)) + "]"; 78 return "[object " + %_ClassOf(TO_OBJECT(this)) + "]";
74 } 79 }
75 80
76 81
77 function NoSideEffectToString(obj) { 82 function NoSideEffectToString(obj) {
78 if (IS_STRING(obj)) return obj; 83 if (IS_STRING(obj)) return obj;
79 if (IS_NUMBER(obj)) return %_NumberToString(obj); 84 if (IS_NUMBER(obj)) return %_NumberToString(obj);
80 if (IS_BOOLEAN(obj)) return obj ? 'true' : 'false'; 85 if (IS_BOOLEAN(obj)) return obj ? 'true' : 'false';
81 if (IS_UNDEFINED(obj)) return 'undefined'; 86 if (IS_UNDEFINED(obj)) return 'undefined';
82 if (IS_NULL(obj)) return 'null'; 87 if (IS_NULL(obj)) return 'null';
83 if (IS_FUNCTION(obj)) { 88 if (IS_FUNCTION(obj)) {
84 var str = %_CallFunction(obj, obj, $functionSourceString); 89 var str = %_CallFunction(obj, obj, FunctionSourceString);
85 if (str.length > 128) { 90 if (str.length > 128) {
86 str = %_SubString(str, 0, 111) + "...<omitted>..." + 91 str = %_SubString(str, 0, 111) + "...<omitted>..." +
87 %_SubString(str, str.length - 2, str.length); 92 %_SubString(str, str.length - 2, str.length);
88 } 93 }
89 return str; 94 return str;
90 } 95 }
91 if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString); 96 if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString);
92 if (IS_SIMD_VALUE(obj)) { 97 if (IS_SIMD_VALUE(obj)) {
93 switch (typeof(obj)) { 98 switch (typeof(obj)) {
94 case 'float32x4': return %_CallFunction(obj, Float32x4ToString); 99 case 'float32x4': return %_CallFunction(obj, Float32x4ToString);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 145
141 146
142 // When formatting internally created error messages, do not 147 // When formatting internally created error messages, do not
143 // invoke overwritten error toString methods but explicitly use 148 // invoke overwritten error toString methods but explicitly use
144 // the error to string method. This is to avoid leaking error 149 // the error to string method. This is to avoid leaking error
145 // objects between script tags in a browser setting. 150 // objects between script tags in a browser setting.
146 function ToStringCheckErrorObject(obj) { 151 function ToStringCheckErrorObject(obj) {
147 if (CanBeSafelyTreatedAsAnErrorObject(obj)) { 152 if (CanBeSafelyTreatedAsAnErrorObject(obj)) {
148 return %_CallFunction(obj, ErrorToString); 153 return %_CallFunction(obj, ErrorToString);
149 } else { 154 } else {
150 return $toString(obj); 155 return ToString(obj);
151 } 156 }
152 } 157 }
153 158
154 159
155 function ToDetailString(obj) { 160 function ToDetailString(obj) {
156 if (obj != null && IS_OBJECT(obj) && obj.toString === ObjectToString) { 161 if (obj != null && IS_OBJECT(obj) && obj.toString === ObjectToString) {
157 var constructor = obj.constructor; 162 var constructor = obj.constructor;
158 if (typeof constructor == "function") { 163 if (typeof constructor == "function") {
159 var constructorName = constructor.name; 164 var constructorName = constructor.name;
160 if (IS_STRING(constructorName) && constructorName !== "") { 165 if (IS_STRING(constructorName) && constructorName !== "") {
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 %FunctionSetInstanceClassName(f, 'Error'); 966 %FunctionSetInstanceClassName(f, 'Error');
962 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); 967 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM);
963 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM); 968 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM);
964 %SetCode(f, function(m) { 969 %SetCode(f, function(m) {
965 if (%_IsConstructCall()) { 970 if (%_IsConstructCall()) {
966 try { captureStackTrace(this, f); } catch (e) { } 971 try { captureStackTrace(this, f); } catch (e) { }
967 // Define all the expected properties directly on the error 972 // Define all the expected properties directly on the error
968 // object. This avoids going through getters and setters defined 973 // object. This avoids going through getters and setters defined
969 // on prototype objects. 974 // on prototype objects.
970 if (!IS_UNDEFINED(m)) { 975 if (!IS_UNDEFINED(m)) {
971 %AddNamedProperty(this, 'message', $toString(m), DONT_ENUM); 976 %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM);
972 } 977 }
973 } else { 978 } else {
974 return new f(m); 979 return new f(m);
975 } 980 }
976 }); 981 });
977 %SetNativeFlag(f); 982 %SetNativeFlag(f);
978 return f; 983 return f;
979 }; 984 };
980 985
981 GlobalError = DefineError(global, function Error() { }); 986 GlobalError = DefineError(global, function Error() { });
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 to.NoSideEffectToString = NoSideEffectToString; 1056 to.NoSideEffectToString = NoSideEffectToString;
1052 to.ToDetailString = ToDetailString; 1057 to.ToDetailString = ToDetailString;
1053 to.MakeError = MakeGenericError; 1058 to.MakeError = MakeGenericError;
1054 to.MessageGetLineNumber = GetLineNumber; 1059 to.MessageGetLineNumber = GetLineNumber;
1055 to.MessageGetColumnNumber = GetColumnNumber; 1060 to.MessageGetColumnNumber = GetColumnNumber;
1056 to.MessageGetSourceLine = GetSourceLine; 1061 to.MessageGetSourceLine = GetSourceLine;
1057 to.StackOverflowBoilerplate = StackOverflowBoilerplate; 1062 to.StackOverflowBoilerplate = StackOverflowBoilerplate;
1058 }); 1063 });
1059 1064
1060 }); 1065 });
OLDNEW
« no previous file with comments | « src/macros.py ('k') | src/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698