Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: test/cctest/log-eq-of-logging-and-traversal.js

Issue 7354027: Convert *.js files of cctest/test-log into "resources". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 entityNamesEqual.builtins = 130 entityNamesEqual.builtins =
131 ["Boolean", "Function", "Number", "Object", 131 ["Boolean", "Function", "Number", "Object",
132 "Script", "String", "RegExp", "Date", "Error"]; 132 "Script", "String", "RegExp", "Date", "Error"];
133 133
134 function entitiesEqual(entityA, entityB) { 134 function entitiesEqual(entityA, entityB) {
135 if (entityA === null && entityB !== null) return true; 135 if (entityA === null && entityB !== null) return true;
136 if (entityA !== null && entityB === null) return false; 136 if (entityA !== null && entityB === null) return false;
137 return entityA.size === entityB.size && entityNamesEqual(entityA, entityB); 137 return entityA.size === entityB.size && entityNamesEqual(entityA, entityB);
138 } 138 }
139 139
140 var i = 0, j = 0, k = logging_entries.length, l = traversal_entries.length; 140 var l_pos = 0, t_pos = 0;
141 var l_len = logging_entries.length, t_len = traversal_entries.length;
141 var comparison = []; 142 var comparison = [];
142 var equal = true; 143 var equal = true;
143 // Do a merge-like comparison of entries. At the same address we expect to 144 // Do a merge-like comparison of entries. At the same address we expect to
144 // find the same entries. We skip builtins during log parsing, but compiled 145 // find the same entries. We skip builtins during log parsing, but compiled
145 // functions traversal may erroneously recognize them as functions, so we are 146 // functions traversal may erroneously recognize them as functions, so we are
146 // expecting more functions in traversal vs. logging. 147 // expecting more functions in traversal vs. logging.
147 while (i < k && j < l) { 148 while (l_pos < l_len && t_pos < t_len) {
148 var entryA = logging_entries[i], entryB = traversal_entries[j]; 149 var entryA = logging_entries[l_pos];
150 var entryB = traversal_entries[t_pos];
149 var cmp = addressComparator(entryA, entryB); 151 var cmp = addressComparator(entryA, entryB);
150 var entityA = entryA[1], entityB = entryB[1]; 152 var entityA = entryA[1], entityB = entryB[1];
151 var address = entryA[0]; 153 var address = entryA[0];
152 if (cmp < 0) { 154 if (cmp < 0) {
153 ++i; 155 ++l_pos;
154 entityB = null; 156 entityB = null;
155 } else if (cmp > 0) { 157 } else if (cmp > 0) {
156 ++j; 158 ++t_pos;
157 entityA = null; 159 entityA = null;
158 address = entryB[0]; 160 address = entryB[0];
159 } else { 161 } else {
160 ++i; 162 ++l_pos;
161 ++j; 163 ++t_pos;
162 } 164 }
163 var entities_equal = entitiesEqual(entityA, entityB); 165 var entities_equal = entitiesEqual(entityA, entityB);
164 if (!entities_equal) equal = false; 166 if (!entities_equal) equal = false;
165 comparison.push([entities_equal, address, entityA, entityB]); 167 comparison.push([entities_equal, address, entityA, entityB]);
166 } 168 }
167 if (i < k) equal = false; 169 if (l_pos < l_len) equal = false;
168 while (i < k) { 170 while (l_pos < l_len) {
169 var entryA = logging_entries[i++]; 171 var entryA = logging_entries[l_pos++];
170 comparison.push([false, entryA[0], entryA[1], null]); 172 comparison.push([false, entryA[0], entryA[1], null]);
171 } 173 }
172 return [equal, comparison]; 174 return [equal, comparison];
173 } 175 }
174 176
175 var result = RunTest(); 177 var result = RunTest();
176 if (typeof result !== "string") { 178 if (typeof result !== "string") {
177 var out = []; 179 var out = [];
178 if (!result[0]) { 180 if (!result[0]) {
179 var comparison = result[1]; 181 var comparison = result[1];
180 for (var i = 0, l = comparison.length; i < l; ++i) { 182 for (var i = 0, l = comparison.length; i < l; ++i) {
181 var c = comparison[i]; 183 var c = comparison[i];
182 out.push((c[0] ? " " : "* ") + 184 out.push((c[0] ? " " : "* ") +
183 c[1].toString(16) + " " + 185 c[1].toString(16) + " " +
184 (c[2] ? c[2] : "---") + " " + 186 (c[2] ? c[2] : "---") + " " +
185 (c[3] ? c[3] : "---")); 187 (c[3] ? c[3] : "---"));
186 } 188 }
187 } 189 }
188 result[0] ? true : out.join("\n"); 190 result[0] ? true : out.join("\n");
189 } else { 191 } else {
190 result; 192 result;
191 } 193 }
OLDNEW
« test/cctest/SConscript ('K') | « test/cctest/SConscript ('k') | test/cctest/test-log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698