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

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

Issue 1163073002: Replace ad-hoc weakness in prototype transitions with WeakCell. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix crash 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 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 CcTest::heap()->CollectAllGarbage(); 2459 CcTest::heap()->CollectAllGarbage();
2460 const int transitions = 10 - 3; 2460 const int transitions = 10 - 3;
2461 CHECK_EQ(initialTransitions + transitions, 2461 CHECK_EQ(initialTransitions + transitions,
2462 NumberOfProtoTransitions(baseObject->map())); 2462 NumberOfProtoTransitions(baseObject->map()));
2463 2463
2464 // Verify that prototype transitions array was compacted. 2464 // Verify that prototype transitions array was compacted.
2465 FixedArray* trans = 2465 FixedArray* trans =
2466 TransitionArray::GetPrototypeTransitions(baseObject->map()); 2466 TransitionArray::GetPrototypeTransitions(baseObject->map());
2467 for (int i = initialTransitions; i < initialTransitions + transitions; i++) { 2467 for (int i = initialTransitions; i < initialTransitions + transitions; i++) {
2468 int j = TransitionArray::kProtoTransitionHeaderSize + i; 2468 int j = TransitionArray::kProtoTransitionHeaderSize + i;
2469 CHECK(trans->get(j)->IsMap()); 2469 CHECK(trans->get(j)->IsWeakCell());
2470 CHECK(WeakCell::cast(trans->get(j))->value()->IsMap());
2470 } 2471 }
2471 2472
2472 // Make sure next prototype is placed on an old-space evacuation candidate. 2473 // Make sure next prototype is placed on an old-space evacuation candidate.
2473 Handle<JSObject> prototype; 2474 Handle<JSObject> prototype;
2474 PagedSpace* space = CcTest::heap()->old_space(); 2475 PagedSpace* space = CcTest::heap()->old_space();
2475 { 2476 {
2476 AlwaysAllocateScope always_allocate(isolate); 2477 AlwaysAllocateScope always_allocate(isolate);
2477 SimulateFullSpace(space); 2478 SimulateFullSpace(space);
2478 prototype = 2479 prototype =
2479 factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); 2480 factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED);
(...skipping 3418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5898 size_t counter2 = 2000; 5899 size_t counter2 = 2000;
5899 tracer->SampleAllocation(time2, counter2, counter2); 5900 tracer->SampleAllocation(time2, counter2, counter2);
5900 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 5901 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
5901 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); 5902 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput);
5902 int time3 = 1000; 5903 int time3 = 1000;
5903 size_t counter3 = 30000; 5904 size_t counter3 = 30000;
5904 tracer->SampleAllocation(time3, counter3, counter3); 5905 tracer->SampleAllocation(time3, counter3, counter3);
5905 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 5906 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
5906 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); 5907 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
5907 } 5908 }
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