| 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 (function(global, utils) { | 7 (function(global, utils) { |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 "source_url", | 241 "source_url", |
| 242 "source_mapping_url", | 242 "source_mapping_url", |
| 243 "line_offset", | 243 "line_offset", |
| 244 "column_offset" | 244 "column_offset" |
| 245 ], [ | 245 ], [ |
| 246 "locationFromPosition", ScriptLocationFromPosition, | 246 "locationFromPosition", ScriptLocationFromPosition, |
| 247 "nameOrSourceURL", ScriptNameOrSourceURL, | 247 "nameOrSourceURL", ScriptNameOrSourceURL, |
| 248 ] | 248 ] |
| 249 ); | 249 ); |
| 250 | 250 |
| 251 | |
| 252 function GetStackTraceLine(recv, fun, pos, isGlobal) { | |
| 253 return new CallSite(recv, fun, pos, false).toString(); | |
| 254 } | |
| 255 | |
| 256 // ---------------------------------------------------------------------------- | 251 // ---------------------------------------------------------------------------- |
| 257 // Error implementation | 252 // Error implementation |
| 258 | 253 |
| 259 function ErrorToString() { | 254 function ErrorToString() { |
| 260 if (!IS_RECEIVER(this)) { | 255 if (!IS_RECEIVER(this)) { |
| 261 throw MakeTypeError(kCalledOnNonObject, "Error.prototype.toString"); | 256 throw MakeTypeError(kCalledOnNonObject, "Error.prototype.toString"); |
| 262 } | 257 } |
| 263 | 258 |
| 264 var name = this.name; | 259 var name = this.name; |
| 265 name = IS_UNDEFINED(name) ? "Error" : TO_STRING(name); | 260 name = IS_UNDEFINED(name) ? "Error" : TO_STRING(name); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 286 | 281 |
| 287 function MakeTypeError(type, arg0, arg1, arg2) { | 282 function MakeTypeError(type, arg0, arg1, arg2) { |
| 288 return MakeGenericError(GlobalTypeError, type, arg0, arg1, arg2); | 283 return MakeGenericError(GlobalTypeError, type, arg0, arg1, arg2); |
| 289 } | 284 } |
| 290 | 285 |
| 291 function MakeURIError() { | 286 function MakeURIError() { |
| 292 return MakeGenericError(GlobalURIError, kURIMalformed); | 287 return MakeGenericError(GlobalURIError, kURIMalformed); |
| 293 } | 288 } |
| 294 | 289 |
| 295 %InstallToContext([ | 290 %InstallToContext([ |
| 296 "get_stack_trace_line_fun", GetStackTraceLine, | |
| 297 "make_error_function", MakeGenericError, | 291 "make_error_function", MakeGenericError, |
| 298 "make_range_error", MakeRangeError, | 292 "make_range_error", MakeRangeError, |
| 299 "make_type_error", MakeTypeError, | 293 "make_type_error", MakeTypeError, |
| 300 "message_get_column_number", GetColumnNumber, | 294 "message_get_column_number", GetColumnNumber, |
| 301 "message_get_line_number", GetLineNumber, | 295 "message_get_line_number", GetLineNumber, |
| 302 "message_get_source_line", GetSourceLine, | 296 "message_get_source_line", GetSourceLine, |
| 303 "no_side_effects_to_string_fun", NoSideEffectsToString, | 297 "no_side_effects_to_string_fun", NoSideEffectsToString, |
| 304 ]); | 298 ]); |
| 305 | 299 |
| 306 utils.Export(function(to) { | 300 utils.Export(function(to) { |
| 307 to.ErrorToString = ErrorToString; | 301 to.ErrorToString = ErrorToString; |
| 308 to.MakeError = MakeError; | 302 to.MakeError = MakeError; |
| 309 to.MakeRangeError = MakeRangeError; | 303 to.MakeRangeError = MakeRangeError; |
| 310 to.MakeSyntaxError = MakeSyntaxError; | 304 to.MakeSyntaxError = MakeSyntaxError; |
| 311 to.MakeTypeError = MakeTypeError; | 305 to.MakeTypeError = MakeTypeError; |
| 312 to.MakeURIError = MakeURIError; | 306 to.MakeURIError = MakeURIError; |
| 313 }); | 307 }); |
| 314 | 308 |
| 315 }); | 309 }); |
| OLD | NEW |