OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
918 | 918 |
919 function CallSiteToString() { | 919 function CallSiteToString() { |
920 var fileName; | 920 var fileName; |
921 var fileLocation = ""; | 921 var fileLocation = ""; |
922 if (this.isNative()) { | 922 if (this.isNative()) { |
923 fileLocation = "native"; | 923 fileLocation = "native"; |
924 } else if (this.isEval()) { | 924 } else if (this.isEval()) { |
925 fileName = this.getScriptNameOrSourceURL(); | 925 fileName = this.getScriptNameOrSourceURL(); |
926 if (!fileName) { | 926 if (!fileName) { |
927 fileLocation = this.getEvalOrigin(); | 927 fileLocation = this.getEvalOrigin(); |
928 fileLocation += ", "; // Expecting source position to follow. | |
928 } | 929 } |
929 } else { | 930 } else { |
930 fileName = this.getFileName(); | 931 fileName = this.getFileName(); |
931 } | 932 } |
932 | 933 |
933 if (fileName) { | 934 if (!this.isNative()) { |
rossberg
2012/06/18 13:11:30
I think the code is clearer if you merge this cond
Yang
2012/06/18 13:18:42
Done.
| |
934 fileLocation += fileName; | 935 if (fileName) { |
936 fileLocation += fileName; | |
937 } else { | |
938 // Source code does not originate from a file and is not native, but we | |
939 // can still get the source position inside the source string, e.g. in | |
940 // an eval string. | |
941 fileLocation += "<anonymous>"; | |
942 } | |
935 var lineNumber = this.getLineNumber(); | 943 var lineNumber = this.getLineNumber(); |
936 if (lineNumber != null) { | 944 if (lineNumber != null) { |
937 fileLocation += ":" + lineNumber; | 945 fileLocation += ":" + lineNumber; |
938 var columnNumber = this.getColumnNumber(); | 946 var columnNumber = this.getColumnNumber(); |
939 if (columnNumber) { | 947 if (columnNumber) { |
940 fileLocation += ":" + columnNumber; | 948 fileLocation += ":" + columnNumber; |
941 } | 949 } |
942 } | 950 } |
943 } | 951 } |
944 | 952 |
945 if (!fileLocation) { | |
946 fileLocation = "unknown source"; | |
947 } | |
948 var line = ""; | 953 var line = ""; |
949 var functionName = this.getFunctionName(); | 954 var functionName = this.getFunctionName(); |
950 var addSuffix = true; | 955 var addSuffix = true; |
951 var isConstructor = this.isConstructor(); | 956 var isConstructor = this.isConstructor(); |
952 var isMethodCall = !(this.isToplevel() || isConstructor); | 957 var isMethodCall = !(this.isToplevel() || isConstructor); |
953 if (isMethodCall) { | 958 if (isMethodCall) { |
954 var typeName = GetTypeName(this, true); | 959 var typeName = GetTypeName(this, true); |
955 var methodName = this.getMethodName(); | 960 var methodName = this.getMethodName(); |
956 if (functionName) { | 961 if (functionName) { |
957 if (typeName && functionName.indexOf(typeName) != 0) { | 962 if (typeName && functionName.indexOf(typeName) != 0) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1248 throw e; | 1253 throw e; |
1249 } | 1254 } |
1250 } | 1255 } |
1251 | 1256 |
1252 | 1257 |
1253 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); | 1258 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); |
1254 | 1259 |
1255 // Boilerplate for exceptions for stack overflows. Used from | 1260 // Boilerplate for exceptions for stack overflows. Used from |
1256 // Isolate::StackOverflow(). | 1261 // Isolate::StackOverflow(). |
1257 var kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 1262 var kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
OLD | NEW |