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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 callGraphSize, | 76 callGraphSize, |
77 ignoreUnknown, | 77 ignoreUnknown, |
78 stateFilter, | 78 stateFilter, |
79 distortion, | 79 distortion, |
80 range, | 80 range, |
81 sourceMap, | 81 sourceMap, |
82 timedRange, | 82 timedRange, |
83 pairwiseTimedRange, | 83 pairwiseTimedRange, |
84 onlySummary) { | 84 onlySummary) { |
85 LogReader.call(this, { | 85 LogReader.call(this, { |
86 'shared-library': { parsers: [null, parseInt, parseInt], | 86 'shared-library': { parsers: [null, parseInt, parseInt, parseInt], |
87 processor: this.processSharedLibrary }, | 87 processor: this.processSharedLibrary }, |
88 'code-creation': { | 88 'code-creation': { |
89 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], | 89 parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], |
90 processor: this.processCodeCreation }, | 90 processor: this.processCodeCreation }, |
91 'code-move': { parsers: [parseInt, parseInt], | 91 'code-move': { parsers: [parseInt, parseInt], |
92 processor: this.processCodeMove }, | 92 processor: this.processCodeMove }, |
93 'code-delete': { parsers: [parseInt], | 93 'code-delete': { parsers: [parseInt], |
94 processor: this.processCodeDelete }, | 94 processor: this.processCodeDelete }, |
95 'sfi-move': { parsers: [parseInt, parseInt], | 95 'sfi-move': { parsers: [parseInt, parseInt], |
96 processor: this.processFunctionMove }, | 96 processor: this.processFunctionMove }, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 TickProcessor.prototype.processLogFileInTest = function(fileName) { | 236 TickProcessor.prototype.processLogFileInTest = function(fileName) { |
237 // Hack file name to avoid dealing with platform specifics. | 237 // Hack file name to avoid dealing with platform specifics. |
238 this.lastLogFileName_ = 'v8.log'; | 238 this.lastLogFileName_ = 'v8.log'; |
239 var contents = readFile(fileName); | 239 var contents = readFile(fileName); |
240 this.processLogChunk(contents); | 240 this.processLogChunk(contents); |
241 }; | 241 }; |
242 | 242 |
243 | 243 |
244 TickProcessor.prototype.processSharedLibrary = function( | 244 TickProcessor.prototype.processSharedLibrary = function( |
245 name, startAddr, endAddr) { | 245 name, startAddr, endAddr, slide) { |
246 var entry = this.profile_.addLibrary(name, startAddr, endAddr); | 246 var entry = this.profile_.addLibrary(name, startAddr, endAddr, slide); |
247 this.setCodeType(entry.getName(), 'SHARED_LIB'); | 247 this.setCodeType(entry.getName(), 'SHARED_LIB'); |
248 | 248 |
249 var self = this; | 249 var self = this; |
250 var libFuncs = this.cppEntriesProvider_.parseVmSymbols( | 250 var libFuncs = this.cppEntriesProvider_.parseVmSymbols( |
251 name, startAddr, endAddr, function(fName, fStart, fEnd) { | 251 name, startAddr, endAddr, slide, function(fName, fStart, fEnd) { |
252 self.profile_.addStaticCode(fName, fStart, fEnd); | 252 self.profile_.addStaticCode(fName, fStart, fEnd); |
253 self.setCodeType(fName, 'CPP'); | 253 self.setCodeType(fName, 'CPP'); |
254 }); | 254 }); |
255 }; | 255 }; |
256 | 256 |
257 | 257 |
258 TickProcessor.prototype.processCodeCreation = function( | 258 TickProcessor.prototype.processCodeCreation = function( |
259 type, kind, start, size, name, maybe_func) { | 259 type, kind, start, size, name, maybe_func) { |
260 name = this.deserializedEntriesNames_[start] || name; | 260 name = this.deserializedEntriesNames_[start] || name; |
261 if (maybe_func.length) { | 261 if (maybe_func.length) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } | 552 } |
553 }); | 553 }); |
554 }; | 554 }; |
555 | 555 |
556 | 556 |
557 function CppEntriesProvider() { | 557 function CppEntriesProvider() { |
558 }; | 558 }; |
559 | 559 |
560 | 560 |
561 CppEntriesProvider.prototype.parseVmSymbols = function( | 561 CppEntriesProvider.prototype.parseVmSymbols = function( |
562 libName, libStart, libEnd, processorFunc) { | 562 libName, libStart, libEnd, libSlide, processorFunc) { |
563 this.loadSymbols(libName); | 563 this.loadSymbols(libName); |
564 | 564 |
565 var prevEntry; | 565 var prevEntry; |
566 | 566 |
567 function addEntry(funcInfo) { | 567 function addEntry(funcInfo) { |
568 // Several functions can be mapped onto the same address. To avoid | 568 // Several functions can be mapped onto the same address. To avoid |
569 // creating zero-sized entries, skip such duplicates. | 569 // creating zero-sized entries, skip such duplicates. |
570 // Also double-check that function belongs to the library address space. | 570 // Also double-check that function belongs to the library address space. |
571 if (prevEntry && !prevEntry.end && | 571 if (prevEntry && !prevEntry.end && |
572 prevEntry.start < funcInfo.start && | 572 prevEntry.start < funcInfo.start && |
573 prevEntry.start >= libStart && funcInfo.start <= libEnd) { | 573 prevEntry.start >= libStart && funcInfo.start <= libEnd) { |
574 processorFunc(prevEntry.name, prevEntry.start, funcInfo.start); | 574 processorFunc(prevEntry.name, prevEntry.start, funcInfo.start); |
575 } | 575 } |
576 if (funcInfo.end && | 576 if (funcInfo.end && |
577 (!prevEntry || prevEntry.start != funcInfo.start) && | 577 (!prevEntry || prevEntry.start != funcInfo.start) && |
578 funcInfo.start >= libStart && funcInfo.end <= libEnd) { | 578 funcInfo.start >= libStart && funcInfo.end <= libEnd) { |
579 processorFunc(funcInfo.name, funcInfo.start, funcInfo.end); | 579 processorFunc(funcInfo.name, funcInfo.start, funcInfo.end); |
580 } | 580 } |
581 prevEntry = funcInfo; | 581 prevEntry = funcInfo; |
582 } | 582 } |
583 | 583 |
584 while (true) { | 584 while (true) { |
585 var funcInfo = this.parseNextLine(); | 585 var funcInfo = this.parseNextLine(); |
586 if (funcInfo === null) { | 586 if (funcInfo === null) { |
587 continue; | 587 continue; |
588 } else if (funcInfo === false) { | 588 } else if (funcInfo === false) { |
589 break; | 589 break; |
590 } | 590 } |
| 591 funcInfo.start += libSlide; |
591 if (funcInfo.start < libStart && funcInfo.start < libEnd - libStart) { | 592 if (funcInfo.start < libStart && funcInfo.start < libEnd - libStart) { |
592 funcInfo.start += libStart; | 593 funcInfo.start += libStart; |
593 } | 594 } |
594 if (funcInfo.size) { | 595 if (funcInfo.size) { |
595 funcInfo.end = funcInfo.start + funcInfo.size; | 596 funcInfo.end = funcInfo.start + funcInfo.size; |
596 } | 597 } |
597 addEntry(funcInfo); | 598 addEntry(funcInfo); |
598 } | 599 } |
599 addEntry({name: '', start: libEnd}); | 600 addEntry({name: '', start: libEnd}); |
600 }; | 601 }; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 for (var synArg in this.argsDispatch_) { | 885 for (var synArg in this.argsDispatch_) { |
885 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { | 886 if (arg !== synArg && dispatch === this.argsDispatch_[synArg]) { |
886 synonyms.push(synArg); | 887 synonyms.push(synArg); |
887 delete this.argsDispatch_[synArg]; | 888 delete this.argsDispatch_[synArg]; |
888 } | 889 } |
889 } | 890 } |
890 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]); | 891 print(' ' + padRight(synonyms.join(', '), 20) + " " + dispatch[2]); |
891 } | 892 } |
892 quit(2); | 893 quit(2); |
893 }; | 894 }; |
OLD | NEW |