OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 })(); | 116 })(); |
117 | 117 |
118 | 118 |
119 (function testDynamicNamesDuplicates() { | 119 (function testDynamicNamesDuplicates() { |
120 var codeMap = new devtools.profiler.CodeMap(); | 120 var codeMap = new devtools.profiler.CodeMap(); |
121 // Code entries with same names but different addresses. | 121 // Code entries with same names but different addresses. |
122 codeMap.addCode(0x1500, newCodeEntry(0x200, 'code')); | 122 codeMap.addCode(0x1500, newCodeEntry(0x200, 'code')); |
123 codeMap.addCode(0x1700, newCodeEntry(0x100, 'code')); | 123 codeMap.addCode(0x1700, newCodeEntry(0x100, 'code')); |
124 assertEntry(codeMap, 'code', 0x1500); | 124 assertEntry(codeMap, 'code', 0x1500); |
125 assertEntry(codeMap, 'code {1}', 0x1700); | 125 assertEntry(codeMap, 'code {1}', 0x1700); |
| 126 // Test name stability. |
| 127 assertEntry(codeMap, 'code', 0x1500); |
| 128 assertEntry(codeMap, 'code {1}', 0x1700); |
126 })(); | 129 })(); |
| 130 |
| 131 |
| 132 (function testStaticEntriesExport() { |
| 133 var codeMap = new devtools.profiler.CodeMap(); |
| 134 codeMap.addStaticCode(0x1500, newCodeEntry(0x3000, 'lib1')); |
| 135 codeMap.addStaticCode(0x15500, newCodeEntry(0x5000, 'lib2')); |
| 136 codeMap.addStaticCode(0x155500, newCodeEntry(0x10000, 'lib3')); |
| 137 var allStatics = codeMap.getAllStaticEntries(); |
| 138 allStatics.sort(); |
| 139 assertEquals(['lib1: 3000', 'lib2: 5000', 'lib3: 10000'], allStatics); |
| 140 })(); |
| 141 |
| 142 |
| 143 (function testDynamicEntriesExport() { |
| 144 var codeMap = new devtools.profiler.CodeMap(); |
| 145 codeMap.addCode(0x1500, newCodeEntry(0x200, 'code1')); |
| 146 codeMap.addCode(0x1700, newCodeEntry(0x100, 'code2')); |
| 147 codeMap.addCode(0x1900, newCodeEntry(0x50, 'code3')); |
| 148 var allDynamics = codeMap.getAllDynamicEntries(); |
| 149 allDynamics.sort(); |
| 150 assertEquals(['code1: 200', 'code2: 100', 'code3: 50'], allDynamics); |
| 151 codeMap.deleteCode(0x1700); |
| 152 var allDynamics2 = codeMap.getAllDynamicEntries(); |
| 153 allDynamics2.sort(); |
| 154 assertEquals(['code1: 200', 'code3: 50'], allDynamics2); |
| 155 codeMap.deleteCode(0x1500); |
| 156 var allDynamics3 = codeMap.getAllDynamicEntries(); |
| 157 assertEquals(['code3: 50'], allDynamics3); |
| 158 })(); |
OLD | NEW |