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

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

Issue 1520793003: Remove obsolete PrototypeTransitionClearing cctest. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/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 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 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( 2606 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
2607 global->Get(ctx, v8_str("g")).ToLocalChecked()); 2607 global->Get(ctx, v8_str("g")).ToLocalChecked());
2608 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); 2608 g->Call(ctx, global, 0, nullptr).ToLocalChecked();
2609 } 2609 }
2610 2610
2611 CcTest::heap()->incremental_marking()->set_should_hurry(true); 2611 CcTest::heap()->incremental_marking()->set_should_hurry(true);
2612 CcTest::heap()->CollectGarbage(OLD_SPACE); 2612 CcTest::heap()->CollectGarbage(OLD_SPACE);
2613 } 2613 }
2614 2614
2615 2615
2616 TEST(PrototypeTransitionClearing) {
2617 if (FLAG_never_compact) return;
2618 CcTest::InitializeVM();
2619 Isolate* isolate = CcTest::i_isolate();
2620 Factory* factory = isolate->factory();
2621 v8::HandleScope scope(CcTest::isolate());
2622 v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
2623
2624 CompileRun("var base = {};");
2625 i::Handle<JSReceiver> baseObject =
2626 v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
2627 CcTest::global()->Get(ctx, v8_str("base")).ToLocalChecked()));
2628
2629 int initialTransitions =
2630 TransitionArray::NumberOfPrototypeTransitionsForTest(baseObject->map());
2631
2632 CompileRun(
2633 "var live = [];"
2634 "for (var i = 0; i < 10; i++) {"
2635 " var object = {};"
2636 " var prototype = {};"
2637 " object.__proto__ = prototype;"
2638 " if (i >= 3) live.push(object, prototype);"
2639 "}");
2640
2641 // Verify that only dead prototype transitions are cleared.
2642 CHECK_EQ(
2643 initialTransitions + 10,
2644 TransitionArray::NumberOfPrototypeTransitionsForTest(baseObject->map()));
2645 CcTest::heap()->CollectAllGarbage();
2646 const int transitions = 10 - 3;
2647 CHECK_EQ(
2648 initialTransitions + transitions,
2649 TransitionArray::NumberOfPrototypeTransitionsForTest(baseObject->map()));
2650
2651 // Verify that prototype transitions array was compacted.
2652 FixedArray* trans =
2653 TransitionArray::GetPrototypeTransitions(baseObject->map());
2654 for (int i = initialTransitions; i < initialTransitions + transitions; i++) {
2655 int j = TransitionArray::kProtoTransitionHeaderSize + i;
2656 CHECK(trans->get(j)->IsWeakCell());
2657 CHECK(WeakCell::cast(trans->get(j))->value()->IsMap());
2658 }
2659
2660 // Make sure next prototype is placed on an old-space evacuation candidate.
2661 Handle<JSObject> prototype;
2662 PagedSpace* space = CcTest::heap()->old_space();
2663 {
2664 AlwaysAllocateScope always_allocate(isolate);
2665 SimulateFullSpace(space);
2666 prototype = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS,
2667 Strength::WEAK, TENURED);
2668 }
2669
2670 // Add a prototype on an evacuation candidate and verify that transition
2671 // clearing correctly records slots in prototype transition array.
2672 i::FLAG_always_compact = true;
2673 Handle<Map> map(baseObject->map());
2674 CHECK(!space->LastPage()->Contains(
2675 TransitionArray::GetPrototypeTransitions(*map)->address()));
2676 CHECK(space->LastPage()->Contains(prototype->address()));
2677 }
2678
2679
2680 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { 2616 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
2681 i::FLAG_stress_compaction = false; 2617 i::FLAG_stress_compaction = false;
2682 i::FLAG_allow_natives_syntax = true; 2618 i::FLAG_allow_natives_syntax = true;
2683 #ifdef VERIFY_HEAP 2619 #ifdef VERIFY_HEAP
2684 i::FLAG_verify_heap = true; 2620 i::FLAG_verify_heap = true;
2685 #endif 2621 #endif
2686 2622
2687 CcTest::InitializeVM(); 2623 CcTest::InitializeVM();
2688 if (!CcTest::i_isolate()->use_crankshaft()) return; 2624 if (!CcTest::i_isolate()->use_crankshaft()) return;
2689 v8::HandleScope outer_scope(CcTest::isolate()); 2625 v8::HandleScope outer_scope(CcTest::isolate());
(...skipping 3860 matching lines...) Expand 10 before | Expand all | Expand 10 after
6550 isolate->IncrementJsCallsFromApiCounter(); 6486 isolate->IncrementJsCallsFromApiCounter();
6551 isolate->IncrementJsCallsFromApiCounter(); 6487 isolate->IncrementJsCallsFromApiCounter();
6552 isolate->IncrementJsCallsFromApiCounter(); 6488 isolate->IncrementJsCallsFromApiCounter();
6553 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); 6489 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4);
6554 CheckDoubleEquals(2, calls_per_ms); 6490 CheckDoubleEquals(2, calls_per_ms);
6555 } 6491 }
6556 6492
6557 6493
6558 } // namespace internal 6494 } // namespace internal
6559 } // namespace v8 6495 } // namespace v8
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