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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 } | 594 } |
595 lines.push(" at " + line); | 595 lines.push(" at " + line); |
596 } | 596 } |
597 return %_Call(ArrayJoin, lines, "\n"); | 597 return %_Call(ArrayJoin, lines, "\n"); |
598 } | 598 } |
599 | 599 |
600 | 600 |
601 function GetTypeName(receiver, requireConstructor) { | 601 function GetTypeName(receiver, requireConstructor) { |
602 if (IS_NULL_OR_UNDEFINED(receiver)) return null; | 602 if (IS_NULL_OR_UNDEFINED(receiver)) return null; |
603 if (IS_PROXY(receiver)) return "Proxy"; | 603 if (IS_PROXY(receiver)) return "Proxy"; |
604 | 604 return %GetConstructorName(receiver); |
605 var constructor = %GetDataProperty(TO_OBJECT(receiver), "constructor"); | |
606 if (!IS_FUNCTION(constructor)) { | |
607 return requireConstructor ? null : %_Call(NoSideEffectsToString, receiver); | |
608 } | |
609 return %FunctionGetName(constructor); | |
610 } | 605 } |
611 | 606 |
612 | 607 |
613 // Format the stack trace if not yet done, and return it. | 608 // Format the stack trace if not yet done, and return it. |
614 // Cache the formatted stack trace on the holder. | 609 // Cache the formatted stack trace on the holder. |
615 var StackTraceGetter = function() { | 610 var StackTraceGetter = function() { |
616 var formatted_stack_trace = UNDEFINED; | 611 var formatted_stack_trace = UNDEFINED; |
617 var holder = this; | 612 var holder = this; |
618 while (holder) { | 613 while (holder) { |
619 var formatted_stack_trace = | 614 var formatted_stack_trace = |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 utils.Export(function(to) { | 758 utils.Export(function(to) { |
764 to.ErrorToString = ErrorToString; | 759 to.ErrorToString = ErrorToString; |
765 to.MakeError = MakeError; | 760 to.MakeError = MakeError; |
766 to.MakeRangeError = MakeRangeError; | 761 to.MakeRangeError = MakeRangeError; |
767 to.MakeSyntaxError = MakeSyntaxError; | 762 to.MakeSyntaxError = MakeSyntaxError; |
768 to.MakeTypeError = MakeTypeError; | 763 to.MakeTypeError = MakeTypeError; |
769 to.MakeURIError = MakeURIError; | 764 to.MakeURIError = MakeURIError; |
770 }); | 765 }); |
771 | 766 |
772 }); | 767 }); |
OLD | NEW |