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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 function GetStackTraceLine(recv, fun, pos, isGlobal) { | 268 function GetStackTraceLine(recv, fun, pos, isGlobal) { |
269 return new CallSite(recv, fun, pos, false).toString(); | 269 return new CallSite(recv, fun, pos, false).toString(); |
270 } | 270 } |
271 | 271 |
272 // ---------------------------------------------------------------------------- | 272 // ---------------------------------------------------------------------------- |
273 // Error implementation | 273 // Error implementation |
274 | 274 |
275 function CallSite(receiver, fun, pos, strict_mode) { | 275 function CallSite(receiver, fun, pos, strict_mode) { |
276 // For wasm frames, receiver is the wasm object and fun is the function index | 276 // For wasm frames, receiver is the wasm object and fun is the function index |
277 // instead of an actual function. | 277 // instead of an actual function. |
278 if (!IS_FUNCTION(fun) && !IS_NUMBER(fun)) { | 278 if (!IS_FUNCTION(fun) && !%IsWasmObject(receiver)) { |
279 throw MakeTypeError(kCallSiteExpectsFunction, typeof fun); | 279 throw MakeTypeError(kCallSiteExpectsFunction, typeof receiver, typeof fun); |
280 } | 280 } |
281 | 281 |
282 if (IS_UNDEFINED(new.target)) { | 282 if (IS_UNDEFINED(new.target)) { |
283 return new CallSite(receiver, fun, pos, strict_mode); | 283 return new CallSite(receiver, fun, pos, strict_mode); |
284 } | 284 } |
285 | 285 |
286 if (IS_FUNCTION(fun)) { | 286 if (IS_FUNCTION(fun)) { |
287 SET_PRIVATE(this, callSiteReceiverSymbol, receiver); | 287 SET_PRIVATE(this, callSiteReceiverSymbol, receiver); |
288 SET_PRIVATE(this, callSiteFunctionSymbol, fun); | 288 SET_PRIVATE(this, callSiteFunctionSymbol, fun); |
289 } else { | 289 } else { |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 utils.Export(function(to) { | 756 utils.Export(function(to) { |
757 to.ErrorToString = ErrorToString; | 757 to.ErrorToString = ErrorToString; |
758 to.MakeError = MakeError; | 758 to.MakeError = MakeError; |
759 to.MakeRangeError = MakeRangeError; | 759 to.MakeRangeError = MakeRangeError; |
760 to.MakeSyntaxError = MakeSyntaxError; | 760 to.MakeSyntaxError = MakeSyntaxError; |
761 to.MakeTypeError = MakeTypeError; | 761 to.MakeTypeError = MakeTypeError; |
762 to.MakeURIError = MakeURIError; | 762 to.MakeURIError = MakeURIError; |
763 }); | 763 }); |
764 | 764 |
765 }); | 765 }); |
OLD | NEW |