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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 | 611 |
612 function CallSiteGetScriptNameOrSourceURL() { | 612 function CallSiteGetScriptNameOrSourceURL() { |
613 return %CallSiteGetScriptNameOrSourceUrlRT(this); | 613 return %CallSiteGetScriptNameOrSourceUrlRT(this); |
614 } | 614 } |
615 | 615 |
616 function CallSiteGetFunctionName() { | 616 function CallSiteGetFunctionName() { |
617 // See if the function knows its own name | 617 // See if the function knows its own name |
618 return %CallSiteGetFunctionNameRT(this); | 618 return %CallSiteGetFunctionNameRT(this); |
619 } | 619 } |
620 | 620 |
| 621 function CallSiteGetDebugName() { |
| 622 // See if the function knows its own name |
| 623 return %CallSiteGetDebugNameRT(this); |
| 624 } |
| 625 |
621 function CallSiteGetMethodName() { | 626 function CallSiteGetMethodName() { |
622 // See if we can find a unique property on the receiver that holds | 627 // See if we can find a unique property on the receiver that holds |
623 // this function. | 628 // this function. |
624 return %CallSiteGetMethodNameRT(this); | 629 return %CallSiteGetMethodNameRT(this); |
625 } | 630 } |
626 | 631 |
627 function CallSiteGetFileName() { | 632 function CallSiteGetFileName() { |
628 return %CallSiteGetFileNameRT(this); | 633 return %CallSiteGetFileNameRT(this); |
629 } | 634 } |
630 | 635 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 fileLocation += ":" + lineNumber; | 674 fileLocation += ":" + lineNumber; |
670 var columnNumber = this.getColumnNumber(); | 675 var columnNumber = this.getColumnNumber(); |
671 if (columnNumber) { | 676 if (columnNumber) { |
672 fileLocation += ":" + columnNumber; | 677 fileLocation += ":" + columnNumber; |
673 } | 678 } |
674 } | 679 } |
675 } | 680 } |
676 | 681 |
677 var line = ""; | 682 var line = ""; |
678 var functionName = this.getFunctionName(); | 683 var functionName = this.getFunctionName(); |
679 var addSuffix = true; | 684 var debugName = this.getDebugName(); |
680 var isConstructor = this.isConstructor(); | 685 var isConstructor = this.isConstructor(); |
681 var isMethodCall = !(this.isToplevel() || isConstructor); | 686 var isMethodCall = !(this.isToplevel() || isConstructor); |
682 if (isMethodCall) { | 687 if (debugName) { |
| 688 if (isConstructor) line += "new "; |
| 689 line += debugName; |
| 690 } else if (isMethodCall) { |
683 var typeName = GetTypeName(GET_PRIVATE(this, callSiteReceiverSymbol), true); | 691 var typeName = GetTypeName(GET_PRIVATE(this, callSiteReceiverSymbol), true); |
684 var methodName = this.getMethodName(); | 692 var methodName = this.getMethodName(); |
685 if (functionName) { | 693 if (functionName) { |
686 if (typeName && %_Call(StringIndexOf, functionName, typeName) != 0) { | 694 if (typeName && %_Call(StringIndexOf, functionName, typeName) != 0) { |
687 line += typeName + "."; | 695 line += typeName + "."; |
688 } | 696 } |
689 line += functionName; | 697 line += functionName; |
690 if (methodName && | 698 if (methodName && |
691 (%_Call(StringIndexOf, functionName, "." + methodName) != | 699 (%_Call(StringIndexOf, functionName, "." + methodName) != |
692 functionName.length - methodName.length - 1)) { | 700 functionName.length - methodName.length - 1)) { |
693 line += " [as " + methodName + "]"; | 701 line += " [as " + methodName + "]"; |
694 } | 702 } |
695 } else { | 703 } else { |
696 line += typeName + "." + (methodName || "<anonymous>"); | 704 line += typeName + "." + (methodName || "<anonymous>"); |
697 } | 705 } |
698 } else if (isConstructor) { | 706 } else if (isConstructor) { |
699 line += "new " + (functionName || "<anonymous>"); | 707 line += "new " + (functionName || "<anonymous>"); |
700 } else if (functionName) { | 708 } else if (functionName) { |
701 line += functionName; | 709 line += functionName; |
702 } else { | 710 } else { |
703 line += fileLocation; | 711 return line + fileLocation; |
704 addSuffix = false; | |
705 } | 712 } |
706 if (addSuffix) { | 713 return line + " (" + fileLocation + ")"; |
707 line += " (" + fileLocation + ")"; | |
708 } | |
709 return line; | |
710 } | 714 } |
711 | 715 |
712 utils.SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [ | 716 utils.SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [ |
713 "getThis", CallSiteGetThis, | 717 "getThis", CallSiteGetThis, |
714 "getTypeName", CallSiteGetTypeName, | 718 "getTypeName", CallSiteGetTypeName, |
715 "isToplevel", CallSiteIsToplevel, | 719 "isToplevel", CallSiteIsToplevel, |
716 "isEval", CallSiteIsEval, | 720 "isEval", CallSiteIsEval, |
717 "getEvalOrigin", CallSiteGetEvalOrigin, | 721 "getEvalOrigin", CallSiteGetEvalOrigin, |
718 "getScriptNameOrSourceURL", CallSiteGetScriptNameOrSourceURL, | 722 "getScriptNameOrSourceURL", CallSiteGetScriptNameOrSourceURL, |
719 "getFunction", CallSiteGetFunction, | 723 "getFunction", CallSiteGetFunction, |
720 "getFunctionName", CallSiteGetFunctionName, | 724 "getFunctionName", CallSiteGetFunctionName, |
| 725 "getDebugName", CallSiteGetDebugName, |
721 "getMethodName", CallSiteGetMethodName, | 726 "getMethodName", CallSiteGetMethodName, |
722 "getFileName", CallSiteGetFileName, | 727 "getFileName", CallSiteGetFileName, |
723 "getLineNumber", CallSiteGetLineNumber, | 728 "getLineNumber", CallSiteGetLineNumber, |
724 "getColumnNumber", CallSiteGetColumnNumber, | 729 "getColumnNumber", CallSiteGetColumnNumber, |
725 "isNative", CallSiteIsNative, | 730 "isNative", CallSiteIsNative, |
726 "getPosition", CallSiteGetPosition, | 731 "getPosition", CallSiteGetPosition, |
727 "isConstructor", CallSiteIsConstructor, | 732 "isConstructor", CallSiteIsConstructor, |
728 "toString", CallSiteToString | 733 "toString", CallSiteToString |
729 ]); | 734 ]); |
730 | 735 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 utils.Export(function(to) { | 1010 utils.Export(function(to) { |
1006 to.ErrorToString = ErrorToString; | 1011 to.ErrorToString = ErrorToString; |
1007 to.MakeError = MakeError; | 1012 to.MakeError = MakeError; |
1008 to.MakeRangeError = MakeRangeError; | 1013 to.MakeRangeError = MakeRangeError; |
1009 to.MakeSyntaxError = MakeSyntaxError; | 1014 to.MakeSyntaxError = MakeSyntaxError; |
1010 to.MakeTypeError = MakeTypeError; | 1015 to.MakeTypeError = MakeTypeError; |
1011 to.MakeURIError = MakeURIError; | 1016 to.MakeURIError = MakeURIError; |
1012 }); | 1017 }); |
1013 | 1018 |
1014 }); | 1019 }); |
OLD | NEW |