OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "execution.h" | 7 #include "execution.h" |
8 #include "factory.h" | 8 #include "factory.h" |
9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
10 #include "global-handles.h" | 10 #include "global-handles.h" |
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 | 1191 |
1192 TEST(TestSizeOfObjects) { | 1192 TEST(TestSizeOfObjects) { |
1193 v8::V8::Initialize(); | 1193 v8::V8::Initialize(); |
1194 | 1194 |
1195 // Get initial heap size after several full GCs, which will stabilize | 1195 // Get initial heap size after several full GCs, which will stabilize |
1196 // the heap size and return with sweeping finished completely. | 1196 // the heap size and return with sweeping finished completely. |
1197 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1197 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1198 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1198 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1199 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1199 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1200 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 1200 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
| 1201 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
1201 CHECK(HEAP->old_pointer_space()->IsSweepingComplete()); | 1202 CHECK(HEAP->old_pointer_space()->IsSweepingComplete()); |
1202 int initial_size = static_cast<int>(HEAP->SizeOfObjects()); | 1203 int initial_size = static_cast<int>(HEAP->SizeOfObjects()); |
1203 | 1204 |
1204 { | 1205 { |
1205 // Allocate objects on several different old-space pages so that | 1206 // Allocate objects on several different old-space pages so that |
1206 // lazy sweeping kicks in for subsequent GC runs. | 1207 // lazy sweeping kicks in for subsequent GC runs. |
1207 AlwaysAllocateScope always_allocate; | 1208 AlwaysAllocateScope always_allocate; |
1208 int filler_size = static_cast<int>(FixedArray::SizeFor(8192)); | 1209 int filler_size = static_cast<int>(FixedArray::SizeFor(8192)); |
1209 for (int i = 1; i <= 100; i++) { | 1210 for (int i = 1; i <= 100; i++) { |
1210 HEAP->AllocateFixedArray(8192, TENURED)->ToObjectChecked(); | 1211 HEAP->AllocateFixedArray(8192, TENURED)->ToObjectChecked(); |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 | 1895 |
1895 Handle<JSObject> root = | 1896 Handle<JSObject> root = |
1896 v8::Utils::OpenHandle( | 1897 v8::Utils::OpenHandle( |
1897 *v8::Handle<v8::Object>::Cast( | 1898 *v8::Handle<v8::Object>::Cast( |
1898 v8::Context::GetCurrent()->Global()->Get(v8_str("root")))); | 1899 v8::Context::GetCurrent()->Global()->Get(v8_str("root")))); |
1899 | 1900 |
1900 // The root object should be in a sane state. | 1901 // The root object should be in a sane state. |
1901 CHECK(root->IsJSObject()); | 1902 CHECK(root->IsJSObject()); |
1902 CHECK(root->map()->IsMap()); | 1903 CHECK(root->map()->IsMap()); |
1903 } | 1904 } |
OLD | NEW |