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

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

Issue 8519002: Start incremental marking on idle notification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments, tuned idle round starting conditions. Created 9 years, 1 month 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 13367 matching lines...) Expand 10 before | Expand all | Expand 10 after
13378 "}\n" 13378 "}\n"
13379 "foo();\n" 13379 "foo();\n"
13380 "}\n" 13380 "}\n"
13381 "eval('(' + outer +')()//@ sourceURL=eval_url');"; 13381 "eval('(' + outer +')()//@ sourceURL=eval_url');";
13382 CHECK(CompileRun(source)->IsUndefined()); 13382 CHECK(CompileRun(source)->IsUndefined());
13383 } 13383 }
13384 13384
13385 13385
13386 // Test that idle notification can be handled and eventually returns true. 13386 // Test that idle notification can be handled and eventually returns true.
13387 THREADED_TEST(IdleNotification) { 13387 THREADED_TEST(IdleNotification) {
13388 v8::HandleScope scope;
13389 LocalContext env;
13390 CompileRun(
13391 "function foo() {"
13392 " var a = new Array(1000);"
13393 " for (var i = 0; i < 1000; i++) {"
13394 " a[i] = new Array(1000);"
13395 " for (var j = 0; j < 1000; j++) {"
13396 " a[i][j] = {tag1: i, tag2: j};"
13397 " }"
13398 " }"
13399 "};"
13400 "foo();");
13388 bool rv = false; 13401 bool rv = false;
13389 for (int i = 0; i < 100; i++) { 13402 for (int i = 0; i < 100; i++) {
13390 rv = v8::V8::IdleNotification(); 13403 rv = v8::V8::IdleNotification();
13391 if (rv) 13404 if (rv)
13392 break; 13405 break;
13393 } 13406 }
13394 CHECK(rv == true); 13407 CHECK(rv == true);
13395 } 13408 }
13396 13409
13410 // Test that idle notification can be handled and eventually returns true.
13411 THREADED_TEST(IdleNotificationWithHint) {
13412 v8::HandleScope scope;
13413 LocalContext env;
13414 CompileRun(
13415 "function foo() {"
13416 " var a = new Array(1000);"
13417 " for (var i = 0; i < 1000; i++) {"
13418 " a[i] = new Array(1000);"
13419 " for (var j = 0; j < 1000; j++) {"
13420 " a[i][j] = {tag1: i, tag2: j};"
13421 " }"
13422 " }"
13423 "};"
13424 "foo();");
13425 bool rv = false;
13426 for (int i = 0; i < 200; i++) {
13427 rv = v8::V8::IdleNotification(10);
13428 if (rv)
13429 break;
13430 }
Erik Corry 2011/11/25 09:21:30 Can we test that the heap is now much smaller?
13431 CHECK(rv == true);
13432 }
13433
13397 13434
13398 static uint32_t* stack_limit; 13435 static uint32_t* stack_limit;
13399 13436
13400 static v8::Handle<Value> GetStackLimitCallback(const v8::Arguments& args) { 13437 static v8::Handle<Value> GetStackLimitCallback(const v8::Arguments& args) {
13401 stack_limit = reinterpret_cast<uint32_t*>( 13438 stack_limit = reinterpret_cast<uint32_t*>(
13402 i::Isolate::Current()->stack_guard()->real_climit()); 13439 i::Isolate::Current()->stack_guard()->real_climit());
13403 return v8::Undefined(); 13440 return v8::Undefined();
13404 } 13441 }
13405 13442
13406 13443
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after
15489 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); 15526 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]")));
15490 15527
15491 // TODO(1547): Make the following also return "i". 15528 // TODO(1547): Make the following also return "i".
15492 // Calling with environment record as base. 15529 // Calling with environment record as base.
15493 TestReceiver(o, context->Global(), "func()"); 15530 TestReceiver(o, context->Global(), "func()");
15494 // Calling with no base. 15531 // Calling with no base.
15495 TestReceiver(o, context->Global(), "(1,func)()"); 15532 TestReceiver(o, context->Global(), "(1,func)()");
15496 15533
15497 foreign_context.Dispose(); 15534 foreign_context.Dispose();
15498 } 15535 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698