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