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 cyclic_proto: ["Cyclic __proto__ value"], | 9 cyclic_proto: ["Cyclic __proto__ value"], |
10 code_gen_from_strings: ["%0"], | 10 code_gen_from_strings: ["%0"], |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 360 |
361 function MakeEvalError(type, args) { | 361 function MakeEvalError(type, args) { |
362 return MakeGenericError($EvalError, type, args); | 362 return MakeGenericError($EvalError, type, args); |
363 } | 363 } |
364 | 364 |
365 | 365 |
366 function MakeError(type, args) { | 366 function MakeError(type, args) { |
367 return MakeGenericError($Error, type, args); | 367 return MakeGenericError($Error, type, args); |
368 } | 368 } |
369 | 369 |
| 370 |
| 371 // The embedded versions are called from unoptimized code, with embedded |
| 372 // arguments. Those arguments cannot be arrays, which are context-dependent. |
| 373 function MakeTypeErrorEmbedded(type, arg) { |
| 374 return MakeGenericError($TypeError, type, [arg]); |
| 375 } |
| 376 |
| 377 |
| 378 function MakeSyntaxErrorEmbedded(type, arg) { |
| 379 return MakeGenericError($SyntaxError, type, [arg]); |
| 380 } |
| 381 |
| 382 |
| 383 function MakeReferenceErrorEmbedded(type, arg) { |
| 384 return MakeGenericError($ReferenceError, type, [arg]); |
| 385 } |
| 386 |
370 /** | 387 /** |
371 * Find a line number given a specific source position. | 388 * Find a line number given a specific source position. |
372 * @param {number} position The source position. | 389 * @param {number} position The source position. |
373 * @return {number} 0 if input too small, -1 if input too large, | 390 * @return {number} 0 if input too small, -1 if input too large, |
374 else the line number. | 391 else the line number. |
375 */ | 392 */ |
376 function ScriptLineFromPosition(position) { | 393 function ScriptLineFromPosition(position) { |
377 var lower = 0; | 394 var lower = 0; |
378 var upper = this.lineCount() - 1; | 395 var upper = this.lineCount() - 1; |
379 var line_ends = this.line_ends; | 396 var line_ends = this.line_ends; |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 function SetUpStackOverflowBoilerplate() { | 1320 function SetUpStackOverflowBoilerplate() { |
1304 var boilerplate = MakeRangeError('stack_overflow', []); | 1321 var boilerplate = MakeRangeError('stack_overflow', []); |
1305 | 1322 |
1306 %DefineAccessorPropertyUnchecked( | 1323 %DefineAccessorPropertyUnchecked( |
1307 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1324 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1308 | 1325 |
1309 return boilerplate; | 1326 return boilerplate; |
1310 } | 1327 } |
1311 | 1328 |
1312 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1329 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |