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

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

Issue 1399033002: Remove FLAG_cache_optimized_code because we always have it on. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments. Created 5 years, 2 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/cctest/test-compiler.cc ('k') | test/mjsunit/regress/regress-2193.js » ('j') | 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 4301 matching lines...) Expand 10 before | Expand all | Expand 10 after
4312 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array); 4312 v8::Handle<v8::Object> array_obj = v8::Utils::ToLocal(array);
4313 CcTest::global()->Set(array_name, array_obj); 4313 CcTest::global()->Set(array_name, array_obj);
4314 4314
4315 // This should crash with a protection violation if we are running a build 4315 // This should crash with a protection violation if we are running a build
4316 // with the bug. 4316 // with the bug.
4317 AlwaysAllocateScope aa_scope(isolate); 4317 AlwaysAllocateScope aa_scope(isolate);
4318 v8::Script::Compile(mote_code_string)->Run(); 4318 v8::Script::Compile(mote_code_string)->Run();
4319 } 4319 }
4320 4320
4321 4321
4322 TEST(Regress168801) {
4323 if (i::FLAG_never_compact) return;
4324 i::FLAG_always_compact = true;
4325 i::FLAG_cache_optimized_code = false;
4326 i::FLAG_allow_natives_syntax = true;
4327 CcTest::InitializeVM();
4328 Isolate* isolate = CcTest::i_isolate();
4329 Heap* heap = isolate->heap();
4330 HandleScope scope(isolate);
4331
4332 // Perform one initial GC to enable code flushing.
4333 heap->CollectAllGarbage();
4334
4335 // Ensure the code ends up on an evacuation candidate.
4336 SimulateFullSpace(heap->code_space());
4337
4338 // Prepare an unoptimized function that is eligible for code flushing.
4339 Handle<JSFunction> function;
4340 {
4341 HandleScope inner_scope(isolate);
4342 CompileRun("function mkClosure() {"
4343 " return function(x) { return x + 1; };"
4344 "}"
4345 "var f = mkClosure();"
4346 "f(1); f(2);");
4347
4348 Handle<JSFunction> f =
4349 v8::Utils::OpenHandle(
4350 *v8::Handle<v8::Function>::Cast(
4351 CcTest::global()->Get(v8_str("f"))));
4352 CHECK(f->is_compiled());
4353 const int kAgingThreshold = 6;
4354 for (int i = 0; i < kAgingThreshold; i++) {
4355 f->shared()->code()->MakeOlder(static_cast<MarkingParity>(i % 2));
4356 }
4357
4358 function = inner_scope.CloseAndEscape(handle(*f, isolate));
4359 }
4360
4361 // Simulate incremental marking so that unoptimized function is enqueued as a
4362 // candidate for code flushing. The shared function info however will not be
4363 // explicitly enqueued.
4364 SimulateIncrementalMarking(heap);
4365
4366 // Now optimize the function so that it is taken off the candidate list.
4367 {
4368 HandleScope inner_scope(isolate);
4369 CompileRun("%OptimizeFunctionOnNextCall(f); f(3);");
4370 }
4371
4372 // This cycle will bust the heap and subsequent cycles will go ballistic.
4373 heap->CollectAllGarbage();
4374 heap->CollectAllGarbage();
4375 }
4376
4377
4378 TEST(Regress173458) {
4379 if (i::FLAG_never_compact) return;
4380 i::FLAG_always_compact = true;
4381 i::FLAG_cache_optimized_code = false;
4382 i::FLAG_allow_natives_syntax = true;
4383 CcTest::InitializeVM();
4384 Isolate* isolate = CcTest::i_isolate();
4385 Heap* heap = isolate->heap();
4386 HandleScope scope(isolate);
4387
4388 // Perform one initial GC to enable code flushing.
4389 heap->CollectAllGarbage();
4390
4391 // Ensure the code ends up on an evacuation candidate.
4392 SimulateFullSpace(heap->code_space());
4393
4394 // Prepare an unoptimized function that is eligible for code flushing.
4395 Handle<JSFunction> function;
4396 {
4397 HandleScope inner_scope(isolate);
4398 CompileRun("function mkClosure() {"
4399 " return function(x) { return x + 1; };"
4400 "}"
4401 "var f = mkClosure();"
4402 "f(1); f(2);");
4403
4404 Handle<JSFunction> f =
4405 v8::Utils::OpenHandle(
4406 *v8::Handle<v8::Function>::Cast(
4407 CcTest::global()->Get(v8_str("f"))));
4408 CHECK(f->is_compiled());
4409 const int kAgingThreshold = 6;
4410 for (int i = 0; i < kAgingThreshold; i++) {
4411 f->shared()->code()->MakeOlder(static_cast<MarkingParity>(i % 2));
4412 }
4413
4414 function = inner_scope.CloseAndEscape(handle(*f, isolate));
4415 }
4416
4417 // Simulate incremental marking so that unoptimized function is enqueued as a
4418 // candidate for code flushing. The shared function info however will not be
4419 // explicitly enqueued.
4420 SimulateIncrementalMarking(heap);
4421
4422 // Now enable the debugger which in turn will disable code flushing.
4423 CHECK(isolate->debug()->Load());
4424
4425 // This cycle will bust the heap and subsequent cycles will go ballistic.
4426 heap->CollectAllGarbage();
4427 heap->CollectAllGarbage();
4428 }
4429
4430
4431 #ifdef DEBUG 4322 #ifdef DEBUG
4432 TEST(Regress513507) { 4323 TEST(Regress513507) {
4433 i::FLAG_flush_optimized_code_cache = false; 4324 i::FLAG_flush_optimized_code_cache = false;
4434 i::FLAG_allow_natives_syntax = true; 4325 i::FLAG_allow_natives_syntax = true;
4435 i::FLAG_gc_global = true; 4326 i::FLAG_gc_global = true;
4436 CcTest::InitializeVM(); 4327 CcTest::InitializeVM();
4437 Isolate* isolate = CcTest::i_isolate(); 4328 Isolate* isolate = CcTest::i_isolate();
4438 Heap* heap = isolate->heap(); 4329 Heap* heap = isolate->heap();
4439 HandleScope scope(isolate); 4330 HandleScope scope(isolate);
4440 4331
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
6424 // The CollectGarbage call above starts sweeper threads. 6315 // The CollectGarbage call above starts sweeper threads.
6425 // The crash will happen if the following two functions 6316 // The crash will happen if the following two functions
6426 // are called before sweeping finishes. 6317 // are called before sweeping finishes.
6427 heap->StartIncrementalMarking(); 6318 heap->StartIncrementalMarking();
6428 heap->FinalizeIncrementalMarkingIfComplete("test"); 6319 heap->FinalizeIncrementalMarkingIfComplete("test");
6429 } 6320 }
6430 6321
6431 6322
6432 } // namespace internal 6323 } // namespace internal
6433 } // namespace v8 6324 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/mjsunit/regress/regress-2193.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698