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

Side by Side Diff: test/cctest/test-api.cc

Issue 9173007: Fix flaky idle notification test. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use always allocate scope and not threading test Created 8 years, 11 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
« no previous file with comments | « no previous file | 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 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 13541 matching lines...) Expand 10 before | Expand all | Expand 10 after
13552 rv = v8::V8::IdleNotification(); 13552 rv = v8::V8::IdleNotification();
13553 if (rv) 13553 if (rv)
13554 break; 13554 break;
13555 } 13555 }
13556 CHECK(rv == true); 13556 CHECK(rv == true);
13557 } 13557 }
13558 13558
13559 // Test that idle notification can be handled and eventually returns true. 13559 // Test that idle notification can be handled and eventually returns true.
13560 // This just checks the contract of the IdleNotification() function, 13560 // This just checks the contract of the IdleNotification() function,
13561 // and does not verify that it does reasonable work. 13561 // and does not verify that it does reasonable work.
13562 THREADED_TEST(IdleNotificationWithHint) { 13562 TEST(IdleNotificationWithHint) {
13563 v8::HandleScope scope; 13563 v8::HandleScope scope;
13564 LocalContext env; 13564 LocalContext env;
13565 CompileRun("function binom(n, m) {" 13565 {
13566 " var C = [[1]];" 13566 i::AlwaysAllocateScope always_allocate;
13567 " for (var i = 1; i <= n; ++i) {" 13567 CompileRun("function binom(n, m) {"
13568 " C[i] = [1];" 13568 " var C = [[1]];"
13569 " for (var j = 1; j < i; ++j) {" 13569 " for (var i = 1; i <= n; ++i) {"
13570 " C[i][j] = C[i-1][j-1] + C[i-1][j];" 13570 " C[i] = [1];"
13571 " }" 13571 " for (var j = 1; j < i; ++j) {"
13572 " C[i][i] = 1;" 13572 " C[i][j] = C[i-1][j-1] + C[i-1][j];"
13573 " }" 13573 " }"
13574 " return C[n][m];" 13574 " C[i][i] = 1;"
13575 "};" 13575 " }"
13576 "binom(1000, 500)"); 13576 " return C[n][m];"
13577 "};"
13578 "binom(1000, 500)");
13579 }
13577 bool rv = false; 13580 bool rv = false;
13578 intptr_t old_size = HEAP->SizeOfObjects(); 13581 intptr_t old_size = HEAP->SizeOfObjects();
13579 bool no_idle_work = v8::V8::IdleNotification(10); 13582 bool no_idle_work = v8::V8::IdleNotification(10);
13580 for (int i = 0; i < 200; i++) { 13583 for (int i = 0; i < 200; i++) {
13581 rv = v8::V8::IdleNotification(10); 13584 rv = v8::V8::IdleNotification(10);
13582 if (rv) 13585 if (rv)
13583 break; 13586 break;
13584 } 13587 }
13585 CHECK(rv == true); 13588 CHECK(rv == true);
13586 intptr_t new_size = HEAP->SizeOfObjects(); 13589 intptr_t new_size = HEAP->SizeOfObjects();
(...skipping 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after
15824 CompileRun("throw 'exception';"); 15827 CompileRun("throw 'exception';");
15825 } 15828 }
15826 15829
15827 15830
15828 TEST(CallCompletedCallbackTwoExceptions) { 15831 TEST(CallCompletedCallbackTwoExceptions) {
15829 v8::HandleScope scope; 15832 v8::HandleScope scope;
15830 LocalContext env; 15833 LocalContext env;
15831 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException); 15834 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException);
15832 CompileRun("throw 'first exception';"); 15835 CompileRun("throw 'first exception';");
15833 } 15836 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698