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

Side by Side Diff: test/cctest/test-mark-compact.cc

Issue 6928010: Make the marking stack into a deque (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 7 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 | Annotate | Revision Log
« src/spaces.h ('K') | « src/spaces.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 26 matching lines...) Expand all
37 37
38 static v8::Persistent<v8::Context> env; 38 static v8::Persistent<v8::Context> env;
39 39
40 static void InitializeVM() { 40 static void InitializeVM() {
41 if (env.IsEmpty()) env = v8::Context::New(); 41 if (env.IsEmpty()) env = v8::Context::New();
42 v8::HandleScope scope; 42 v8::HandleScope scope;
43 env->Enter(); 43 env->Enter();
44 } 44 }
45 45
46 46
47 TEST(MarkingStack) { 47 TEST(MarkingDeque) {
48 int mem_size = 20 * kPointerSize; 48 int mem_size = 20 * kPointerSize;
49 byte* mem = NewArray<byte>(20*kPointerSize); 49 byte* mem = NewArray<byte>(20*kPointerSize);
50 Address low = reinterpret_cast<Address>(mem); 50 Address low = reinterpret_cast<Address>(mem);
51 Address high = low + mem_size; 51 Address high = low + mem_size;
52 MarkingStack s; 52 MarkingDeque s;
53 s.Initialize(low, high); 53 s.Initialize(low, high);
54 54
55 Address address = NULL; 55 Address address = NULL;
56 while (!s.is_full()) { 56 while (!s.IsFull()) {
57 s.Push(HeapObject::FromAddress(address)); 57 s.Push(HeapObject::FromAddress(address));
58 address += kPointerSize; 58 address += kPointerSize;
59 } 59 }
60 60
61 while (!s.is_empty()) { 61 while (!s.IsEmpty()) {
62 Address value = s.Pop()->address(); 62 Address value = s.Pop()->address();
63 address -= kPointerSize; 63 address -= kPointerSize;
64 CHECK_EQ(address, value); 64 CHECK_EQ(address, value);
65 } 65 }
66 66
67 CHECK_EQ(NULL, address); 67 CHECK_EQ(NULL, address);
68 DeleteArray(mem); 68 DeleteArray(mem);
69 } 69 }
70 70
71 71
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 global_handles->MakeWeak(g1c1.location(), 398 global_handles->MakeWeak(g1c1.location(),
399 reinterpret_cast<void*>(1234), 399 reinterpret_cast<void*>(1234),
400 &WeakPointerCallback); 400 &WeakPointerCallback);
401 global_handles->MakeWeak(g2c1.location(), 401 global_handles->MakeWeak(g2c1.location(),
402 reinterpret_cast<void*>(1234), 402 reinterpret_cast<void*>(1234),
403 &WeakPointerCallback); 403 &WeakPointerCallback);
404 404
405 HEAP->CollectGarbage(OLD_POINTER_SPACE); 405 HEAP->CollectGarbage(OLD_POINTER_SPACE);
406 CHECK_EQ(7, NumberOfWeakCalls); 406 CHECK_EQ(7, NumberOfWeakCalls);
407 } 407 }
OLDNEW
« src/spaces.h ('K') | « src/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698