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

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

Issue 1144183004: [strong] Refactor ObjectStrength into a replacement for strong boolean args (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase 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
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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 v8::HandleScope scope(CcTest::isolate()); 945 v8::HandleScope scope(CcTest::isolate());
946 946
947 // Array of objects to scan haep for. 947 // Array of objects to scan haep for.
948 const int objs_count = 6; 948 const int objs_count = 6;
949 Handle<Object> objs[objs_count]; 949 Handle<Object> objs[objs_count];
950 int next_objs_index = 0; 950 int next_objs_index = 0;
951 951
952 // Allocate a JS array to OLD_SPACE and NEW_SPACE 952 // Allocate a JS array to OLD_SPACE and NEW_SPACE
953 objs[next_objs_index++] = factory->NewJSArray(10); 953 objs[next_objs_index++] = factory->NewJSArray(10);
954 objs[next_objs_index++] = 954 objs[next_objs_index++] =
955 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, WEAK, TENURED); 955 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, Strength::NORMAL, TENURED);
956 956
957 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE 957 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE
958 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); 958 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij");
959 objs[next_objs_index++] = 959 objs[next_objs_index++] =
960 factory->NewStringFromStaticChars("abcdefghij", TENURED); 960 factory->NewStringFromStaticChars("abcdefghij", TENURED);
961 961
962 // Allocate a large string (for large object space). 962 // Allocate a large string (for large object space).
963 int large_size = Page::kMaxRegularHeapObjectSize + 1; 963 int large_size = Page::kMaxRegularHeapObjectSize + 1;
964 char* str = new char[large_size]; 964 char* str = new char[large_size];
965 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; 965 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a';
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 int j = TransitionArray::kProtoTransitionHeaderSize + i; 2523 int j = TransitionArray::kProtoTransitionHeaderSize + i;
2524 CHECK(trans->get(j)->IsMap()); 2524 CHECK(trans->get(j)->IsMap());
2525 } 2525 }
2526 2526
2527 // Make sure next prototype is placed on an old-space evacuation candidate. 2527 // Make sure next prototype is placed on an old-space evacuation candidate.
2528 Handle<JSObject> prototype; 2528 Handle<JSObject> prototype;
2529 PagedSpace* space = CcTest::heap()->old_space(); 2529 PagedSpace* space = CcTest::heap()->old_space();
2530 { 2530 {
2531 AlwaysAllocateScope always_allocate(isolate); 2531 AlwaysAllocateScope always_allocate(isolate);
2532 SimulateFullSpace(space); 2532 SimulateFullSpace(space);
2533 prototype = 2533 prototype = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS,
2534 factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); 2534 Strength::NORMAL, TENURED);
2535 } 2535 }
2536 2536
2537 // Add a prototype on an evacuation candidate and verify that transition 2537 // Add a prototype on an evacuation candidate and verify that transition
2538 // clearing correctly records slots in prototype transition array. 2538 // clearing correctly records slots in prototype transition array.
2539 i::FLAG_always_compact = true; 2539 i::FLAG_always_compact = true;
2540 Handle<Map> map(baseObject->map()); 2540 Handle<Map> map(baseObject->map());
2541 CHECK(!space->LastPage()->Contains( 2541 CHECK(!space->LastPage()->Contains(
2542 TransitionArray::GetPrototypeTransitions(*map)->address())); 2542 TransitionArray::GetPrototypeTransitions(*map)->address()));
2543 CHECK(space->LastPage()->Contains(prototype->address())); 2543 CHECK(space->LastPage()->Contains(prototype->address()));
2544 } 2544 }
(...skipping 3408 matching lines...) Expand 10 before | Expand all | Expand 10 after
5953 size_t counter2 = 2000; 5953 size_t counter2 = 2000;
5954 tracer->SampleAllocation(time2, counter2, counter2); 5954 tracer->SampleAllocation(time2, counter2, counter2);
5955 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 5955 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
5956 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); 5956 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput);
5957 int time3 = 1000; 5957 int time3 = 1000;
5958 size_t counter3 = 30000; 5958 size_t counter3 = 30000;
5959 tracer->SampleAllocation(time3, counter3, counter3); 5959 tracer->SampleAllocation(time3, counter3, counter3);
5960 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 5960 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
5961 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); 5961 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
5962 } 5962 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698