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

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

Issue 7888039: Fix flags to CollectAllGarbage in API tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 3 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 | « test/cctest/cctest.status ('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 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 &dispose_count)); 438 &dispose_count));
439 CHECK(success); 439 CHECK(success);
440 Local<Script> script = Script::Compile(source); 440 Local<Script> script = Script::Compile(source);
441 Local<Value> value = script->Run(); 441 Local<Value> value = script->Run();
442 CHECK(value->IsNumber()); 442 CHECK(value->IsNumber());
443 CHECK_EQ(7, value->Int32Value()); 443 CHECK_EQ(7, value->Int32Value());
444 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 444 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
445 CHECK_EQ(0, dispose_count); 445 CHECK_EQ(0, dispose_count);
446 } 446 }
447 i::Isolate::Current()->compilation_cache()->Clear(); 447 i::Isolate::Current()->compilation_cache()->Clear();
448 HEAP->CollectAllGarbage(false); 448 // TODO(1608): This should use kAbortIncrementalMarking.
449 HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
449 CHECK_EQ(1, dispose_count); 450 CHECK_EQ(1, dispose_count);
450 } 451 }
451 452
452 453
453 THREADED_TEST(ScriptMakingExternalAsciiString) { 454 THREADED_TEST(ScriptMakingExternalAsciiString) {
454 int dispose_count = 0; 455 int dispose_count = 0;
455 const char* c_source = "1 + 2 * 3"; 456 const char* c_source = "1 + 2 * 3";
456 { 457 {
457 v8::HandleScope scope; 458 v8::HandleScope scope;
458 LocalContext env; 459 LocalContext env;
459 Local<String> source = v8_str(c_source); 460 Local<String> source = v8_str(c_source);
460 // Trigger GCs so that the newly allocated string moves to old gen. 461 // Trigger GCs so that the newly allocated string moves to old gen.
461 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now 462 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
462 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now 463 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
463 bool success = source->MakeExternal( 464 bool success = source->MakeExternal(
464 new TestAsciiResource(i::StrDup(c_source), &dispose_count)); 465 new TestAsciiResource(i::StrDup(c_source), &dispose_count));
465 CHECK(success); 466 CHECK(success);
466 Local<Script> script = Script::Compile(source); 467 Local<Script> script = Script::Compile(source);
467 Local<Value> value = script->Run(); 468 Local<Value> value = script->Run();
468 CHECK(value->IsNumber()); 469 CHECK(value->IsNumber());
469 CHECK_EQ(7, value->Int32Value()); 470 CHECK_EQ(7, value->Int32Value());
470 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 471 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
471 CHECK_EQ(0, dispose_count); 472 CHECK_EQ(0, dispose_count);
472 } 473 }
473 i::Isolate::Current()->compilation_cache()->Clear(); 474 i::Isolate::Current()->compilation_cache()->Clear();
474 HEAP->CollectAllGarbage(false); 475 // TODO(1608): This should use kAbortIncrementalMarking.
476 HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask);
475 CHECK_EQ(1, dispose_count); 477 CHECK_EQ(1, dispose_count);
476 } 478 }
477 479
478 480
479 TEST(MakingExternalStringConditions) { 481 TEST(MakingExternalStringConditions) {
480 v8::HandleScope scope; 482 v8::HandleScope scope;
481 LocalContext env; 483 LocalContext env;
482 484
483 // Free some space in the new space so that we can check freshness. 485 // Free some space in the new space so that we can check freshness.
484 HEAP->CollectGarbage(i::NEW_SPACE); 486 HEAP->CollectGarbage(i::NEW_SPACE);
(...skipping 14681 matching lines...) Expand 10 before | Expand all | Expand 10 after
15166 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); 15168 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]")));
15167 15169
15168 // TODO(1547): Make the following also return "i". 15170 // TODO(1547): Make the following also return "i".
15169 // Calling with environment record as base. 15171 // Calling with environment record as base.
15170 TestReceiver(o, context->Global(), "func()"); 15172 TestReceiver(o, context->Global(), "func()");
15171 // Calling with no base. 15173 // Calling with no base.
15172 TestReceiver(o, context->Global(), "(1,func)()"); 15174 TestReceiver(o, context->Global(), "(1,func)()");
15173 15175
15174 foreign_context.Dispose(); 15176 foreign_context.Dispose();
15175 } 15177 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698