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

Side by Side Diff: src/messages.js

Issue 1323543002: [runtime] Replace %to_string_fun with %_ToString. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ToStringStub
Patch Set: REBASE. Fixes Created 5 years, 2 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/parser.cc » ('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 MakeError; 8 var MakeError;
9 var MakeEvalError; 9 var MakeEvalError;
10 var MakeRangeError; 10 var MakeRangeError;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 var Int8x16ToString; 42 var Int8x16ToString;
43 var InternalArray = utils.InternalArray; 43 var InternalArray = utils.InternalArray;
44 var internalErrorSymbol = utils.ImportNow("internal_error_symbol"); 44 var internalErrorSymbol = utils.ImportNow("internal_error_symbol");
45 var ObjectDefineProperty; 45 var ObjectDefineProperty;
46 var ObjectToString; 46 var ObjectToString;
47 var stackTraceSymbol = utils.ImportNow("stack_trace_symbol"); 47 var stackTraceSymbol = utils.ImportNow("stack_trace_symbol");
48 var StringCharAt; 48 var StringCharAt;
49 var StringIndexOf; 49 var StringIndexOf;
50 var StringSubstring; 50 var StringSubstring;
51 var SymbolToString; 51 var SymbolToString;
52 var ToString = utils.ImportNow("ToString");
53 var Uint16x8ToString; 52 var Uint16x8ToString;
54 var Uint32x4ToString; 53 var Uint32x4ToString;
55 var Uint8x16ToString; 54 var Uint8x16ToString;
56 55
57 utils.Import(function(from) { 56 utils.Import(function(from) {
58 ArrayJoin = from.ArrayJoin; 57 ArrayJoin = from.ArrayJoin;
59 Bool16x8ToString = from.Bool16x8ToString; 58 Bool16x8ToString = from.Bool16x8ToString;
60 Bool32x4ToString = from.Bool32x4ToString; 59 Bool32x4ToString = from.Bool32x4ToString;
61 Bool8x16ToString = from.Bool8x16ToString; 60 Bool8x16ToString = from.Bool8x16ToString;
62 Float32x4ToString = from.Float32x4ToString; 61 Float32x4ToString = from.Float32x4ToString;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 161
163 162
164 // When formatting internally created error messages, do not 163 // When formatting internally created error messages, do not
165 // invoke overwritten error toString methods but explicitly use 164 // invoke overwritten error toString methods but explicitly use
166 // the error to string method. This is to avoid leaking error 165 // the error to string method. This is to avoid leaking error
167 // objects between script tags in a browser setting. 166 // objects between script tags in a browser setting.
168 function ToStringCheckErrorObject(obj) { 167 function ToStringCheckErrorObject(obj) {
169 if (CanBeSafelyTreatedAsAnErrorObject(obj)) { 168 if (CanBeSafelyTreatedAsAnErrorObject(obj)) {
170 return %_CallFunction(obj, ErrorToString); 169 return %_CallFunction(obj, ErrorToString);
171 } else { 170 } else {
172 return ToString(obj); 171 return TO_STRING(obj);
173 } 172 }
174 } 173 }
175 174
176 175
177 function ToDetailString(obj) { 176 function ToDetailString(obj) {
178 if (obj != null && IS_OBJECT(obj) && obj.toString === ObjectToString) { 177 if (obj != null && IS_OBJECT(obj) && obj.toString === ObjectToString) {
179 var constructor = obj.constructor; 178 var constructor = obj.constructor;
180 if (typeof constructor == "function") { 179 if (typeof constructor == "function") {
181 var constructorName = constructor.name; 180 var constructorName = constructor.name;
182 if (IS_STRING(constructorName) && constructorName !== "") { 181 if (IS_STRING(constructorName) && constructorName !== "") {
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 %FunctionSetInstanceClassName(f, 'Error'); 945 %FunctionSetInstanceClassName(f, 'Error');
947 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); 946 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM);
948 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM); 947 %AddNamedProperty(f.prototype, 'name', name, DONT_ENUM);
949 %SetCode(f, function(m) { 948 %SetCode(f, function(m) {
950 if (%_IsConstructCall()) { 949 if (%_IsConstructCall()) {
951 try { captureStackTrace(this, f); } catch (e) { } 950 try { captureStackTrace(this, f); } catch (e) { }
952 // Define all the expected properties directly on the error 951 // Define all the expected properties directly on the error
953 // object. This avoids going through getters and setters defined 952 // object. This avoids going through getters and setters defined
954 // on prototype objects. 953 // on prototype objects.
955 if (!IS_UNDEFINED(m)) { 954 if (!IS_UNDEFINED(m)) {
956 %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM); 955 %AddNamedProperty(this, 'message', TO_STRING(m), DONT_ENUM);
957 } 956 }
958 } else { 957 } else {
959 return new f(m); 958 return new f(m);
960 } 959 }
961 }); 960 });
962 %SetNativeFlag(f); 961 %SetNativeFlag(f);
963 return f; 962 return f;
964 }; 963 };
965 964
966 GlobalError = DefineError(global, function Error() { }); 965 GlobalError = DefineError(global, function Error() { });
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 "range_error_function", GlobalRangeError, 1037 "range_error_function", GlobalRangeError,
1039 "reference_error_function", GlobalReferenceError, 1038 "reference_error_function", GlobalReferenceError,
1040 "stack_overflow_boilerplate", StackOverflowBoilerplate, 1039 "stack_overflow_boilerplate", StackOverflowBoilerplate,
1041 "syntax_error_function", GlobalSyntaxError, 1040 "syntax_error_function", GlobalSyntaxError,
1042 "to_detail_string_fun", ToDetailString, 1041 "to_detail_string_fun", ToDetailString,
1043 "type_error_function", GlobalTypeError, 1042 "type_error_function", GlobalTypeError,
1044 "uri_error_function", GlobalURIError, 1043 "uri_error_function", GlobalURIError,
1045 ]); 1044 ]);
1046 1045
1047 }); 1046 });
OLDNEW
« no previous file with comments | « src/macros.py ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698