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

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

Issue 1169743002: Reland "Replace ad-hoc weakness in prototype transitions with WeakCell." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add missing slots recording Created 5 years, 6 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 | « src/transitions.cc ('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 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 CcTest::heap()->CollectAllGarbage(); 2514 CcTest::heap()->CollectAllGarbage();
2515 const int transitions = 10 - 3; 2515 const int transitions = 10 - 3;
2516 CHECK_EQ(initialTransitions + transitions, 2516 CHECK_EQ(initialTransitions + transitions,
2517 NumberOfProtoTransitions(baseObject->map())); 2517 NumberOfProtoTransitions(baseObject->map()));
2518 2518
2519 // Verify that prototype transitions array was compacted. 2519 // Verify that prototype transitions array was compacted.
2520 FixedArray* trans = 2520 FixedArray* trans =
2521 TransitionArray::GetPrototypeTransitions(baseObject->map()); 2521 TransitionArray::GetPrototypeTransitions(baseObject->map());
2522 for (int i = initialTransitions; i < initialTransitions + transitions; i++) { 2522 for (int i = initialTransitions; i < initialTransitions + transitions; i++) {
2523 int j = TransitionArray::kProtoTransitionHeaderSize + i; 2523 int j = TransitionArray::kProtoTransitionHeaderSize + i;
2524 CHECK(trans->get(j)->IsMap()); 2524 CHECK(trans->get(j)->IsWeakCell());
2525 CHECK(WeakCell::cast(trans->get(j))->value()->IsMap());
2525 } 2526 }
2526 2527
2527 // Make sure next prototype is placed on an old-space evacuation candidate. 2528 // Make sure next prototype is placed on an old-space evacuation candidate.
2528 Handle<JSObject> prototype; 2529 Handle<JSObject> prototype;
2529 PagedSpace* space = CcTest::heap()->old_space(); 2530 PagedSpace* space = CcTest::heap()->old_space();
2530 { 2531 {
2531 AlwaysAllocateScope always_allocate(isolate); 2532 AlwaysAllocateScope always_allocate(isolate);
2532 SimulateFullSpace(space); 2533 SimulateFullSpace(space);
2533 prototype = 2534 prototype =
2534 factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); 2535 factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED);
(...skipping 3418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5953 size_t counter2 = 2000; 5954 size_t counter2 = 2000;
5954 tracer->SampleAllocation(time2, counter2, counter2); 5955 tracer->SampleAllocation(time2, counter2, counter2);
5955 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 5956 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
5956 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); 5957 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput);
5957 int time3 = 1000; 5958 int time3 = 1000;
5958 size_t counter3 = 30000; 5959 size_t counter3 = 30000;
5959 tracer->SampleAllocation(time3, counter3, counter3); 5960 tracer->SampleAllocation(time3, counter3, counter3);
5960 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 5961 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
5961 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); 5962 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
5962 } 5963 }
OLDNEW
« no previous file with comments | « src/transitions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698