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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 function GetStackTraceLine(recv, fun, pos, isGlobal) { | 449 function GetStackTraceLine(recv, fun, pos, isGlobal) { |
450 return new CallSite(recv, fun, pos, false).toString(); | 450 return new CallSite(recv, fun, pos, false).toString(); |
451 } | 451 } |
452 | 452 |
453 // ---------------------------------------------------------------------------- | 453 // ---------------------------------------------------------------------------- |
454 // Error implementation | 454 // Error implementation |
455 | 455 |
456 function CallSite(receiver, fun, pos, strict_mode) { | 456 function CallSite(receiver, fun, pos, strict_mode) { |
457 // For wasm frames, receiver is the wasm object and fun is the function index | 457 // For wasm frames, receiver is the wasm object and fun is the function index |
458 // instead of an actual function. | 458 // instead of an actual function. |
459 if (!IS_FUNCTION(fun) && !IS_NUMBER(fun)) { | 459 if (!IS_FUNCTION(fun) && !%IsWasmObject(receiver)) { |
460 throw MakeTypeError(kCallSiteExpectsFunction, typeof fun); | 460 throw MakeTypeError(kCallSiteExpectsFunction, typeof receiver, typeof fun); |
461 } | 461 } |
462 | 462 |
463 if (IS_UNDEFINED(new.target)) { | 463 if (IS_UNDEFINED(new.target)) { |
464 return new CallSite(receiver, fun, pos, strict_mode); | 464 return new CallSite(receiver, fun, pos, strict_mode); |
465 } | 465 } |
466 | 466 |
467 if (IS_FUNCTION(fun)) { | 467 if (IS_FUNCTION(fun)) { |
468 SET_PRIVATE(this, callSiteReceiverSymbol, receiver); | 468 SET_PRIVATE(this, callSiteReceiverSymbol, receiver); |
469 SET_PRIVATE(this, callSiteFunctionSymbol, fun); | 469 SET_PRIVATE(this, callSiteFunctionSymbol, fun); |
470 } else { | 470 } else { |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 utils.Export(function(to) { | 937 utils.Export(function(to) { |
938 to.ErrorToString = ErrorToString; | 938 to.ErrorToString = ErrorToString; |
939 to.MakeError = MakeError; | 939 to.MakeError = MakeError; |
940 to.MakeRangeError = MakeRangeError; | 940 to.MakeRangeError = MakeRangeError; |
941 to.MakeSyntaxError = MakeSyntaxError; | 941 to.MakeSyntaxError = MakeSyntaxError; |
942 to.MakeTypeError = MakeTypeError; | 942 to.MakeTypeError = MakeTypeError; |
943 to.MakeURIError = MakeURIError; | 943 to.MakeURIError = MakeURIError; |
944 }); | 944 }); |
945 | 945 |
946 }); | 946 }); |
OLD | NEW |