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

Side by Side Diff: test/mjsunit/mjsunit.js

Issue 2752043002: [promises] Add %WaitForPromise runtime call to allow tests to reliably wait for promises to be fini… (Closed)
Patch Set: Don't touch runtime-promise.cc Created 3 years, 9 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
« no previous file with comments | « test/mjsunit/basic-promise.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 // Returns true if given function is optimized. 143 // Returns true if given function is optimized.
144 var isOptimized; 144 var isOptimized;
145 145
146 // Returns true if given function is compiled by Crankshaft. 146 // Returns true if given function is compiled by Crankshaft.
147 var isCrankshafted; 147 var isCrankshafted;
148 148
149 // Returns true if given function is compiled by TurboFan. 149 // Returns true if given function is compiled by TurboFan.
150 var isTurboFanned; 150 var isTurboFanned;
151 151
152 // Monkey-patchable all-purpose failure handler.
153 var failWithMessage;
154
152 155
153 (function () { // Scope for utility functions. 156 (function () { // Scope for utility functions.
154 157
155 var ObjectPrototypeToString = Object.prototype.toString; 158 var ObjectPrototypeToString = Object.prototype.toString;
156 var NumberPrototypeValueOf = Number.prototype.valueOf; 159 var NumberPrototypeValueOf = Number.prototype.valueOf;
157 var BooleanPrototypeValueOf = Boolean.prototype.valueOf; 160 var BooleanPrototypeValueOf = Boolean.prototype.valueOf;
158 var StringPrototypeValueOf = String.prototype.valueOf; 161 var StringPrototypeValueOf = String.prototype.valueOf;
159 var DatePrototypeValueOf = Date.prototype.valueOf; 162 var DatePrototypeValueOf = Date.prototype.valueOf;
160 var RegExpPrototypeToString = RegExp.prototype.toString; 163 var RegExpPrototypeToString = RegExp.prototype.toString;
161 var ArrayPrototypeMap = Array.prototype.map; 164 var ArrayPrototypeMap = Array.prototype.map;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 229 }
227 } 230 }
228 231
229 232
230 function PrettyPrintArrayElement(value, index, array) { 233 function PrettyPrintArrayElement(value, index, array) {
231 if (value === undefined && !(index in array)) return ""; 234 if (value === undefined && !(index in array)) return "";
232 return PrettyPrint(value); 235 return PrettyPrint(value);
233 } 236 }
234 237
235 238
236 function failWithMessage(message) { 239 failWithMessage = function failWithMessage(message) {
240 print("oh, we failed: " + message);
237 throw new MjsUnitAssertionError(message); 241 throw new MjsUnitAssertionError(message);
238 } 242 }
239 243
240 244
241 function fail(expectedText, found, name_opt) { 245 function fail(expectedText, found, name_opt) {
242 var message = "Fail" + "ure"; 246 var message = "Fail" + "ure";
243 if (name_opt) { 247 if (name_opt) {
244 // Fix this when we ditch the old test runner. 248 // Fix this when we ditch the old test runner.
245 message += " (" + name_opt + ")"; 249 message += " (" + name_opt + ")";
246 } 250 }
247 251
248 var foundText = PrettyPrint(found); 252 var foundText = PrettyPrint(found);
249 if (expectedText.length <= 40 && foundText.length <= 40) { 253 if (expectedText.length <= 40 && foundText.length <= 40) {
250 message += ": expected <" + expectedText + "> found <" + foundText + ">"; 254 message += ": expected <" + expectedText + "> found <" + foundText + ">";
251 } else { 255 } else {
252 message += ":\nexpected:\n" + expectedText + "\nfound:\n" + foundText; 256 message += ":\nexpected:\n" + expectedText + "\nfound:\n" + foundText;
253 } 257 }
254 throw new MjsUnitAssertionError(message); 258 return failWithMessage(message);
255 } 259 }
256 260
257 261
258 function deepObjectEquals(a, b) { 262 function deepObjectEquals(a, b) {
259 var aProps = Object.keys(a); 263 var aProps = Object.keys(a);
260 aProps.sort(); 264 aProps.sort();
261 var bProps = Object.keys(b); 265 var bProps = Object.keys(b);
262 bProps.sort(); 266 bProps.sort();
263 if (!deepEquals(aProps, bProps)) { 267 if (!deepEquals(aProps, bProps)) {
264 return false; 268 return false;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 562
559 isTurboFanned = function isTurboFanned(fun) { 563 isTurboFanned = function isTurboFanned(fun) {
560 var opt_status = OptimizationStatus(fun, ""); 564 var opt_status = OptimizationStatus(fun, "");
561 assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0, 565 assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0,
562 "not a function"); 566 "not a function");
563 return (opt_status & V8OptimizationStatus.kOptimized) !== 0 && 567 return (opt_status & V8OptimizationStatus.kOptimized) !== 0 &&
564 (opt_status & V8OptimizationStatus.kTurboFanned) !== 0; 568 (opt_status & V8OptimizationStatus.kTurboFanned) !== 0;
565 } 569 }
566 570
567 })(); 571 })();
OLDNEW
« no previous file with comments | « test/mjsunit/basic-promise.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698