OLD | NEW |
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 kMessages = { | 7 var kMessages = { |
8 // Error | 8 // Error |
9 constructor_is_generator: ["Class constructor may not be a generator"], | 9 constructor_is_generator: ["Class constructor may not be a generator"], |
10 constructor_is_accessor: ["Class constructor may not be an accessor"], | 10 constructor_is_accessor: ["Class constructor may not be an accessor"], |
(...skipping 23 matching lines...) Expand all Loading... |
34 uncaught_exception: ["Uncaught ", "%0"], | 34 uncaught_exception: ["Uncaught ", "%0"], |
35 undefined_method: ["Object ", "%1", " has no method '", "%0", "'"
], | 35 undefined_method: ["Object ", "%1", " has no method '", "%0", "'"
], |
36 not_defined: ["%0", " is not defined"], | 36 not_defined: ["%0", " is not defined"], |
37 non_method: ["'super' is referenced from non-method"], | 37 non_method: ["'super' is referenced from non-method"], |
38 unsupported_super: ["Unsupported reference to 'super'"], | 38 unsupported_super: ["Unsupported reference to 'super'"], |
39 non_object_property_load: ["Cannot read property '", "%0", "' of ", "%1"]
, | 39 non_object_property_load: ["Cannot read property '", "%0", "' of ", "%1"]
, |
40 non_object_property_store: ["Cannot set property '", "%0", "' of ", "%1"], | 40 non_object_property_store: ["Cannot set property '", "%0", "' of ", "%1"], |
41 illegal_invocation: ["Illegal invocation"], | 41 illegal_invocation: ["Illegal invocation"], |
42 no_setter_in_callback: ["Cannot set property ", "%0", " of ", "%1", "
which has only a getter"], | 42 no_setter_in_callback: ["Cannot set property ", "%0", " of ", "%1", "
which has only a getter"], |
43 flags_getter_non_object: ["RegExp.prototype.flags getter called on non-o
bject ", "%0"], | 43 flags_getter_non_object: ["RegExp.prototype.flags getter called on non-o
bject ", "%0"], |
44 reduce_no_initial: ["Reduce of empty array with no initial value"]
, | |
45 value_and_accessor: ["Invalid property. A property cannot both hav
e accessors and be writable or have a value, ", "%0"], | 44 value_and_accessor: ["Invalid property. A property cannot both hav
e accessors and be writable or have a value, ", "%0"], |
46 proto_object_or_null: ["Object prototype may only be an Object or nul
l: ", "%0"], | 45 proto_object_or_null: ["Object prototype may only be an Object or nul
l: ", "%0"], |
47 non_extensible_proto: ["%0", " is not extensible"], | 46 non_extensible_proto: ["%0", " is not extensible"], |
48 handler_non_object: ["Proxy.", "%0", " called with non-object as ha
ndler"], | 47 handler_non_object: ["Proxy.", "%0", " called with non-object as ha
ndler"], |
49 proto_non_object: ["Proxy.", "%0", " called with non-object as pr
ototype"], | 48 proto_non_object: ["Proxy.", "%0", " called with non-object as pr
ototype"], |
50 trap_function_expected: ["Proxy.", "%0", " called with non-function for
'", "%1", "' trap"], | 49 trap_function_expected: ["Proxy.", "%0", " called with non-function for
'", "%1", "' trap"], |
51 proxy_repeated_prop_name: ["Trap '", "%1", "' returned repeated property
name '", "%2", "'"], | 50 proxy_repeated_prop_name: ["Trap '", "%1", "' returned repeated property
name '", "%2", "'"], |
52 invalid_weakmap_key: ["Invalid value used as weak map key"], | 51 invalid_weakmap_key: ["Invalid value used as weak map key"], |
53 invalid_weakset_value: ["Invalid value used in weak set"], | 52 invalid_weakset_value: ["Invalid value used in weak set"], |
54 not_date_object: ["this is not a Date object."], | 53 not_date_object: ["this is not a Date object."], |
55 observe_non_object: ["Object.", "%0", " cannot ", "%0", " non-objec
t"], | 54 observe_non_object: ["Object.", "%0", " cannot ", "%0", " non-objec
t"], |
56 observe_non_function: ["Object.", "%0", " cannot deliver to non-funct
ion"], | 55 observe_non_function: ["Object.", "%0", " cannot deliver to non-funct
ion"], |
57 observe_callback_frozen: ["Object.observe cannot deliver to a frozen fun
ction object"], | 56 observe_callback_frozen: ["Object.observe cannot deliver to a frozen fun
ction object"], |
58 observe_invalid_accept: ["Third argument to Object.observe must be an a
rray of strings."], | 57 observe_invalid_accept: ["Third argument to Object.observe must be an a
rray of strings."], |
59 observe_type_non_string: ["Invalid changeRecord with non-string 'type' p
roperty"], | 58 observe_type_non_string: ["Invalid changeRecord with non-string 'type' p
roperty"], |
60 observe_perform_non_string: ["Invalid non-string changeType"], | 59 observe_perform_non_string: ["Invalid non-string changeType"], |
61 observe_perform_non_function: ["Cannot perform non-function"], | 60 observe_perform_non_function: ["Cannot perform non-function"], |
62 observe_notify_non_notifier: ["notify called on non-notifier object"], | 61 observe_notify_non_notifier: ["notify called on non-notifier object"], |
63 observe_global_proxy: ["%0", " cannot be called on the global proxy o
bject"], | 62 observe_global_proxy: ["%0", " cannot be called on the global proxy o
bject"], |
64 not_typed_array: ["this is not a typed array."], | 63 not_typed_array: ["this is not a typed array."], |
65 invalid_argument: ["invalid_argument"], | 64 invalid_argument: ["invalid_argument"], |
66 data_view_not_array_buffer: ["First argument to DataView constructor must b
e an ArrayBuffer"], | 65 data_view_not_array_buffer: ["First argument to DataView constructor must b
e an ArrayBuffer"], |
67 constructor_not_function: ["Constructor ", "%0", " requires 'new'"], | 66 constructor_not_function: ["Constructor ", "%0", " requires 'new'"], |
68 not_a_symbol: ["%0", " is not a symbol"], | 67 not_a_symbol: ["%0", " is not a symbol"], |
69 not_a_promise: ["%0", " is not a promise"], | 68 not_a_promise: ["%0", " is not a promise"], |
70 resolver_not_a_function: ["Promise resolver ", "%0", " is not a function
"], | 69 resolver_not_a_function: ["Promise resolver ", "%0", " is not a function
"], |
71 promise_cyclic: ["Chaining cycle detected for promise ", "%0"], | 70 promise_cyclic: ["Chaining cycle detected for promise ", "%0"], |
72 array_functions_on_frozen: ["Cannot modify frozen array elements"], | |
73 array_functions_change_sealed: ["Cannot add/remove sealed array elements"], | |
74 first_argument_not_regexp: ["First argument to ", "%0", " must not be a re
gular expression"], | 71 first_argument_not_regexp: ["First argument to ", "%0", " must not be a re
gular expression"], |
75 iterator_result_not_an_object: ["Iterator result ", "%0", " is not an object"]
, | 72 iterator_result_not_an_object: ["Iterator result ", "%0", " is not an object"]
, |
76 iterator_value_not_an_object: ["Iterator value ", "%0", " is not an entry obj
ect"], | 73 iterator_value_not_an_object: ["Iterator value ", "%0", " is not an entry obj
ect"], |
77 // RangeError | 74 // RangeError |
78 invalid_array_length: ["Invalid array length"], | 75 invalid_array_length: ["Invalid array length"], |
79 invalid_array_buffer_length: ["Invalid array buffer length"], | 76 invalid_array_buffer_length: ["Invalid array buffer length"], |
80 invalid_string_length: ["Invalid string length"], | 77 invalid_string_length: ["Invalid string length"], |
81 invalid_typed_array_offset: ["Start offset is too large:"], | 78 invalid_typed_array_offset: ["Start offset is too large:"], |
82 invalid_typed_array_length: ["Invalid typed array length"], | 79 invalid_typed_array_length: ["Invalid typed array length"], |
83 invalid_typed_array_alignment: ["%0", " of ", "%1", " should be a multiple of
", "%2"], | 80 invalid_typed_array_alignment: ["%0", " of ", "%1", " should be a multiple of
", "%2"], |
(...skipping 17 matching lines...) Expand all Loading... |
101 // SyntaxError | 98 // SyntaxError |
102 not_isvar: ["builtin %IS_VAR: not a variable"], | 99 not_isvar: ["builtin %IS_VAR: not a variable"], |
103 single_function_literal: ["Single function literal required"], | 100 single_function_literal: ["Single function literal required"], |
104 invalid_regexp_flags: ["Invalid flags supplied to RegExp constructor
'", "%0", "'"], | 101 invalid_regexp_flags: ["Invalid flags supplied to RegExp constructor
'", "%0", "'"], |
105 invalid_regexp: ["Invalid RegExp pattern /", "%0", "/"], | 102 invalid_regexp: ["Invalid RegExp pattern /", "%0", "/"], |
106 illegal_break: ["Illegal break statement"], | 103 illegal_break: ["Illegal break statement"], |
107 illegal_continue: ["Illegal continue statement"], | 104 illegal_continue: ["Illegal continue statement"], |
108 illegal_return: ["Illegal return statement"], | 105 illegal_return: ["Illegal return statement"], |
109 error_loading_debugger: ["Error loading debugger"], | 106 error_loading_debugger: ["Error loading debugger"], |
110 circular_structure: ["Converting circular structure to JSON"], | 107 circular_structure: ["Converting circular structure to JSON"], |
111 called_on_null_or_undefined: ["%0", " called on null or undefined"], | |
112 array_indexof_not_defined: ["Array.getIndexOf: Argument undefined"], | 108 array_indexof_not_defined: ["Array.getIndexOf: Argument undefined"], |
113 object_not_extensible: ["Can't add property ", "%0", ", object is not
extensible"], | 109 object_not_extensible: ["Can't add property ", "%0", ", object is not
extensible"], |
114 illegal_access: ["Illegal access"], | 110 illegal_access: ["Illegal access"], |
115 static_prototype: ["Classes may not have static property named pr
ototype"], | 111 static_prototype: ["Classes may not have static property named pr
ototype"], |
116 strict_mode_with: ["Strict mode code may not include a with state
ment"], | 112 strict_mode_with: ["Strict mode code may not include a with state
ment"], |
117 strict_eval_arguments: ["Unexpected eval or arguments in strict mode"]
, | 113 strict_eval_arguments: ["Unexpected eval or arguments in strict mode"]
, |
118 too_many_arguments: ["Too many arguments in function call (only 655
35 allowed)"], | 114 too_many_arguments: ["Too many arguments in function call (only 655
35 allowed)"], |
119 too_many_parameters: ["Too many parameters in function definition (o
nly 65535 allowed)"], | 115 too_many_parameters: ["Too many parameters in function definition (o
nly 65535 allowed)"], |
120 too_many_variables: ["Too many variables declared (only 4194303 all
owed)"], | 116 too_many_variables: ["Too many variables declared (only 4194303 all
owed)"], |
121 strict_param_dupe: ["Strict mode function may not have duplicate p
arameter names"], | 117 strict_param_dupe: ["Strict mode function may not have duplicate p
arameter names"], |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 287 |
292 | 288 |
293 /** | 289 /** |
294 * Set up the Script function and constructor. | 290 * Set up the Script function and constructor. |
295 */ | 291 */ |
296 %FunctionSetInstanceClassName(Script, 'Script'); | 292 %FunctionSetInstanceClassName(Script, 'Script'); |
297 %AddNamedProperty(Script.prototype, 'constructor', Script, | 293 %AddNamedProperty(Script.prototype, 'constructor', Script, |
298 DONT_ENUM | DONT_DELETE | READ_ONLY); | 294 DONT_ENUM | DONT_DELETE | READ_ONLY); |
299 %SetCode(Script, function(x) { | 295 %SetCode(Script, function(x) { |
300 // Script objects can only be created by the VM. | 296 // Script objects can only be created by the VM. |
301 throw new $Error("Not supported"); | 297 throw MakeError(kUnsupported); |
302 }); | 298 }); |
303 | 299 |
304 | 300 |
305 // Helper functions; called from the runtime system. | 301 // Helper functions; called from the runtime system. |
306 function FormatMessage(type, arg0, arg1, arg2) { | 302 function FormatMessage(type, arg0, arg1, arg2) { |
307 if (IS_NUMBER(type)) { | 303 if (IS_NUMBER(type)) { |
308 var arg0 = NoSideEffectToString(arg0); | 304 var arg0 = NoSideEffectToString(arg0); |
309 var arg1 = NoSideEffectToString(arg1); | 305 var arg1 = NoSideEffectToString(arg1); |
310 var arg2 = NoSideEffectToString(arg2); | 306 var arg2 = NoSideEffectToString(arg2); |
311 try { | 307 try { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 360 |
365 function MakeReferenceError(type, arg0, arg1, arg2) { | 361 function MakeReferenceError(type, arg0, arg1, arg2) { |
366 return MakeGenericError($ReferenceError, type, arg0, arg1, arg2); | 362 return MakeGenericError($ReferenceError, type, arg0, arg1, arg2); |
367 } | 363 } |
368 | 364 |
369 | 365 |
370 function MakeEvalError(type, arg0, arg1, arg2) { | 366 function MakeEvalError(type, arg0, arg1, arg2) { |
371 return MakeGenericError($EvalError, type, arg0, arg1, arg2); | 367 return MakeGenericError($EvalError, type, arg0, arg1, arg2); |
372 } | 368 } |
373 | 369 |
| 370 |
| 371 function MakeURIError() { |
| 372 return MakeGenericError($URIError, kURIMalformed); |
| 373 } |
| 374 |
374 // The embedded versions are called from unoptimized code, with embedded | 375 // The embedded versions are called from unoptimized code, with embedded |
375 // arguments. Those arguments cannot be arrays, which are context-dependent. | 376 // arguments. Those arguments cannot be arrays, which are context-dependent. |
376 function MakeTypeErrorEmbedded(type, arg) { | 377 function MakeTypeErrorEmbedded(type, arg) { |
377 return MakeGenericError($TypeError, type, [arg]); | 378 return MakeGenericError($TypeError, type, [arg]); |
378 } | 379 } |
379 | 380 |
380 | 381 |
381 function MakeSyntaxErrorEmbedded(type, arg) { | 382 function MakeSyntaxErrorEmbedded(type, arg) { |
382 return MakeGenericError($SyntaxError, type, [arg]); | 383 return MakeGenericError($SyntaxError, type, [arg]); |
383 } | 384 } |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 function SetUpStackOverflowBoilerplate() { | 1266 function SetUpStackOverflowBoilerplate() { |
1266 var boilerplate = MakeRangeError(kStackOverflow); | 1267 var boilerplate = MakeRangeError(kStackOverflow); |
1267 | 1268 |
1268 %DefineAccessorPropertyUnchecked( | 1269 %DefineAccessorPropertyUnchecked( |
1269 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1270 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1270 | 1271 |
1271 return boilerplate; | 1272 return boilerplate; |
1272 } | 1273 } |
1273 | 1274 |
1274 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1275 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |