| 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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 // the scanner/parser. | 550 // the scanner/parser. |
| 551 var source = ToString(this.source); | 551 var source = ToString(this.source); |
| 552 var sourceUrlPos = %StringIndexOf(source, "sourceURL=", 0); | 552 var sourceUrlPos = %StringIndexOf(source, "sourceURL=", 0); |
| 553 this.cachedNameOrSourceURL = this.name; | 553 this.cachedNameOrSourceURL = this.name; |
| 554 if (sourceUrlPos > 4) { | 554 if (sourceUrlPos > 4) { |
| 555 var sourceUrlPattern = | 555 var sourceUrlPattern = |
| 556 /\/\/@[\040\t]sourceURL=[\040\t]*([^\s\'\"]*)[\040\t]*$/gm; | 556 /\/\/@[\040\t]sourceURL=[\040\t]*([^\s\'\"]*)[\040\t]*$/gm; |
| 557 // Don't reuse lastMatchInfo here, so we create a new array with room | 557 // Don't reuse lastMatchInfo here, so we create a new array with room |
| 558 // for four captures (array with length one longer than the index | 558 // for four captures (array with length one longer than the index |
| 559 // of the fourth capture, where the numbering is zero-based). | 559 // of the fourth capture, where the numbering is zero-based). |
| 560 var matchInfo = new InternalPackedArray(CAPTURE(3) + 1); | 560 var matchInfo = new InternalArray(CAPTURE(3) + 1); |
| 561 var match = | 561 var match = |
| 562 %_RegExpExec(sourceUrlPattern, source, sourceUrlPos - 4, matchInfo); | 562 %_RegExpExec(sourceUrlPattern, source, sourceUrlPos - 4, matchInfo); |
| 563 if (match) { | 563 if (match) { |
| 564 this.cachedNameOrSourceURL = | 564 this.cachedNameOrSourceURL = |
| 565 SubString(source, matchInfo[CAPTURE(2)], matchInfo[CAPTURE(3)]); | 565 SubString(source, matchInfo[CAPTURE(2)], matchInfo[CAPTURE(3)]); |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 return this.cachedNameOrSourceURL; | 568 return this.cachedNameOrSourceURL; |
| 569 } | 569 } |
| 570 | 570 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 try { | 1026 try { |
| 1027 return "<error: " + e + ">"; | 1027 return "<error: " + e + ">"; |
| 1028 } catch (ee) { | 1028 } catch (ee) { |
| 1029 return "<error>"; | 1029 return "<error>"; |
| 1030 } | 1030 } |
| 1031 } | 1031 } |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 | 1034 |
| 1035 function GetStackFrames(raw_stack) { | 1035 function GetStackFrames(raw_stack) { |
| 1036 var frames = new InternalPackedArray(); | 1036 var frames = new InternalArray(); |
| 1037 for (var i = 0; i < raw_stack.length; i += 4) { | 1037 for (var i = 0; i < raw_stack.length; i += 4) { |
| 1038 var recv = raw_stack[i]; | 1038 var recv = raw_stack[i]; |
| 1039 var fun = raw_stack[i + 1]; | 1039 var fun = raw_stack[i + 1]; |
| 1040 var code = raw_stack[i + 2]; | 1040 var code = raw_stack[i + 2]; |
| 1041 var pc = raw_stack[i + 3]; | 1041 var pc = raw_stack[i + 3]; |
| 1042 var pos = %FunctionGetPositionForOffset(code, pc); | 1042 var pos = %FunctionGetPositionForOffset(code, pc); |
| 1043 frames.push(new CallSite(recv, fun, pos)); | 1043 frames.push(new CallSite(recv, fun, pos)); |
| 1044 } | 1044 } |
| 1045 return frames; | 1045 return frames; |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 | 1048 |
| 1049 function FormatStackTrace(error_string, frames) { | 1049 function FormatStackTrace(error_string, frames) { |
| 1050 var lines = new InternalPackedArray(); | 1050 var lines = new InternalArray(); |
| 1051 lines.push(error_string); | 1051 lines.push(error_string); |
| 1052 for (var i = 0; i < frames.length; i++) { | 1052 for (var i = 0; i < frames.length; i++) { |
| 1053 var frame = frames[i]; | 1053 var frame = frames[i]; |
| 1054 var line; | 1054 var line; |
| 1055 try { | 1055 try { |
| 1056 line = frame.toString(); | 1056 line = frame.toString(); |
| 1057 } catch (e) { | 1057 } catch (e) { |
| 1058 try { | 1058 try { |
| 1059 line = "<error: " + e + ">"; | 1059 line = "<error: " + e + ">"; |
| 1060 } catch (ee) { | 1060 } catch (ee) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 %SetOverflowedStackTrace(this, void 0); | 1301 %SetOverflowedStackTrace(this, void 0); |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 %DefineOrRedefineAccessorProperty( | 1304 %DefineOrRedefineAccessorProperty( |
| 1305 boilerplate, 'stack', getter, setter, DONT_ENUM); | 1305 boilerplate, 'stack', getter, setter, DONT_ENUM); |
| 1306 | 1306 |
| 1307 return boilerplate; | 1307 return boilerplate; |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1310 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
| OLD | NEW |