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

Side by Side Diff: src/messages.js

Issue 6902104: Don't exchange null and undefined with the global object in function.prototype.{call, apply} for ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/string.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 duplicate_regexp_flag: ["Duplicate RegExp flag ", "%0"], 199 duplicate_regexp_flag: ["Duplicate RegExp flag ", "%0"],
200 invalid_regexp: ["Invalid RegExp pattern /", "%0", "/"], 200 invalid_regexp: ["Invalid RegExp pattern /", "%0", "/"],
201 illegal_break: ["Illegal break statement"], 201 illegal_break: ["Illegal break statement"],
202 illegal_continue: ["Illegal continue statement"], 202 illegal_continue: ["Illegal continue statement"],
203 illegal_return: ["Illegal return statement"], 203 illegal_return: ["Illegal return statement"],
204 error_loading_debugger: ["Error loading debugger"], 204 error_loading_debugger: ["Error loading debugger"],
205 no_input_to_regexp: ["No input to ", "%0"], 205 no_input_to_regexp: ["No input to ", "%0"],
206 invalid_json: ["String '", "%0", "' is not valid JSON"], 206 invalid_json: ["String '", "%0", "' is not valid JSON"],
207 circular_structure: ["Converting circular structure to JSON"], 207 circular_structure: ["Converting circular structure to JSON"],
208 obj_ctor_property_non_object: ["Object.", "%0", " called on non-object"], 208 obj_ctor_property_non_object: ["Object.", "%0", " called on non-object"],
209 called_on_null_or_undefined: ["%0", " called on null or undefined"],
209 array_indexof_not_defined: ["Array.getIndexOf: Argument undefined"], 210 array_indexof_not_defined: ["Array.getIndexOf: Argument undefined"],
210 object_not_extensible: ["Can't add property ", "%0", ", object is n ot extensible"], 211 object_not_extensible: ["Can't add property ", "%0", ", object is n ot extensible"],
211 illegal_access: ["Illegal access"], 212 illegal_access: ["Illegal access"],
212 invalid_preparser_data: ["Invalid preparser data for function ", "%0 "], 213 invalid_preparser_data: ["Invalid preparser data for function ", "%0 "],
213 strict_mode_with: ["Strict mode code may not include a with st atement"], 214 strict_mode_with: ["Strict mode code may not include a with st atement"],
214 strict_catch_variable: ["Catch variable may not be eval or argument s in strict mode"], 215 strict_catch_variable: ["Catch variable may not be eval or argument s in strict mode"],
215 too_many_parameters: ["Too many parameters in function definition "], 216 too_many_parameters: ["Too many parameters in function definition "],
216 strict_param_name: ["Parameter name eval or arguments is not al lowed in strict mode"], 217 strict_param_name: ["Parameter name eval or arguments is not al lowed in strict mode"],
217 strict_param_dupe: ["Strict mode function may not have duplicat e parameter names"], 218 strict_param_dupe: ["Strict mode function may not have duplicat e parameter names"],
218 strict_var_name: ["Variable name may not be eval or arguments in strict mode"], 219 strict_var_name: ["Variable name may not be eval or arguments in strict mode"],
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 var message = %_CallFunction(this, "message", ObjectHasOwnProperty) 1063 var message = %_CallFunction(this, "message", ObjectHasOwnProperty)
1063 ? (": " + this.message) 1064 ? (": " + this.message)
1064 : ""; 1065 : "";
1065 return this.name + message; 1066 return this.name + message;
1066 } finally { 1067 } finally {
1067 visited_errors.length = visited_errors.length - 1; 1068 visited_errors.length = visited_errors.length - 1;
1068 } 1069 }
1069 } 1070 }
1070 1071
1071 function errorToString() { 1072 function errorToString() {
1073 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
1074 throw MakeTypeError("called_on_null_or_undefined",
1075 ["Error.prototype.toString"]);
1076 }
1072 // This helper function is needed because access to properties on 1077 // This helper function is needed because access to properties on
1073 // the builtins object do not work inside of a catch clause. 1078 // the builtins object do not work inside of a catch clause.
1074 function isCyclicErrorMarker(o) { return o === cyclic_error_marker; } 1079 function isCyclicErrorMarker(o) { return o === cyclic_error_marker; }
1075 1080
1076 try { 1081 try {
1077 return %_CallFunction(this, errorToStringDetectCycle); 1082 return %_CallFunction(this, errorToStringDetectCycle);
1078 } catch(e) { 1083 } catch(e) {
1079 // If this error message was encountered already return the empty 1084 // If this error message was encountered already return the empty
1080 // string for it instead of recursively formatting it. 1085 // string for it instead of recursively formatting it.
1081 if (isCyclicErrorMarker(e)) return ''; 1086 if (isCyclicErrorMarker(e)) return '';
1082 else throw e; 1087 else throw e;
1083 } 1088 }
1084 } 1089 }
1085 1090
1086 1091
1087 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', errorToString]); 1092 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', errorToString]);
1088 1093
1089 // Boilerplate for exceptions for stack overflows. Used from 1094 // Boilerplate for exceptions for stack overflows. Used from
1090 // Isolate::StackOverflow(). 1095 // Isolate::StackOverflow().
1091 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); 1096 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []);
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698