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

Side by Side Diff: test/cctest/cctest.h

Issue 1293283003: [heap,cctest] Get rid of protected-for-sake-of-testing scope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add heap-tester.h to cctest.gyp Created 5 years, 4 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/heap/heap.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 typedef v8::internal::EnumSet<CcTestExtensionIds> CcTestExtensionFlags; 83 typedef v8::internal::EnumSet<CcTestExtensionIds> CcTestExtensionFlags;
84 #define DEFINE_EXTENSION_FLAG(Name, Ident) \ 84 #define DEFINE_EXTENSION_FLAG(Name, Ident) \
85 static const CcTestExtensionFlags Name(1 << Name##_ID); 85 static const CcTestExtensionFlags Name(1 << Name##_ID);
86 static const CcTestExtensionFlags NO_EXTENSIONS(0); 86 static const CcTestExtensionFlags NO_EXTENSIONS(0);
87 static const CcTestExtensionFlags ALL_EXTENSIONS((1 << kMaxExtensions) - 1); 87 static const CcTestExtensionFlags ALL_EXTENSIONS((1 << kMaxExtensions) - 1);
88 EXTENSION_LIST(DEFINE_EXTENSION_FLAG) 88 EXTENSION_LIST(DEFINE_EXTENSION_FLAG)
89 #undef DEFINE_EXTENSION_FLAG 89 #undef DEFINE_EXTENSION_FLAG
90 90
91 91
92 // Use this to expose protected methods in i::Heap.
93 class TestHeap : public i::Heap {
94 public:
95 using i::Heap::AllocateByteArray;
96 using i::Heap::AllocateFixedArray;
97 using i::Heap::AllocateHeapNumber;
98 using i::Heap::AllocateFloat32x4;
99 using i::Heap::AllocateJSObject;
100 using i::Heap::AllocateJSObjectFromMap;
101 using i::Heap::AllocateMap;
102 using i::Heap::CopyCode;
103 using i::Heap::kInitialNumberStringCacheSize;
104 };
105
106
107 class CcTest { 92 class CcTest {
108 public: 93 public:
109 typedef void (TestFunction)(); 94 typedef void (TestFunction)();
110 CcTest(TestFunction* callback, const char* file, const char* name, 95 CcTest(TestFunction* callback, const char* file, const char* name,
111 const char* dependency, bool enabled, bool initialize); 96 const char* dependency, bool enabled, bool initialize);
112 ~CcTest() { i::DeleteArray(file_); } 97 ~CcTest() { i::DeleteArray(file_); }
113 void Run(); 98 void Run();
114 static CcTest* last() { return last_; } 99 static CcTest* last() { return last_; }
115 CcTest* prev() { return prev_; } 100 CcTest* prev() { return prev_; }
116 const char* file() { return file_; } 101 const char* file() { return file_; }
(...skipping 13 matching lines...) Expand all
130 } 115 }
131 116
132 static i::Isolate* i_isolate() { 117 static i::Isolate* i_isolate() {
133 return reinterpret_cast<i::Isolate*>(isolate()); 118 return reinterpret_cast<i::Isolate*>(isolate());
134 } 119 }
135 120
136 static i::Heap* heap() { 121 static i::Heap* heap() {
137 return i_isolate()->heap(); 122 return i_isolate()->heap();
138 } 123 }
139 124
140 static TestHeap* test_heap() {
141 return reinterpret_cast<TestHeap*>(i_isolate()->heap());
142 }
143
144 static v8::base::RandomNumberGenerator* random_number_generator() { 125 static v8::base::RandomNumberGenerator* random_number_generator() {
145 return InitIsolateOnce()->random_number_generator(); 126 return InitIsolateOnce()->random_number_generator();
146 } 127 }
147 128
148 static v8::Local<v8::Object> global() { 129 static v8::Local<v8::Object> global() {
149 return isolate()->GetCurrentContext()->Global(); 130 return isolate()->GetCurrentContext()->Global();
150 } 131 }
151 132
152 static v8::ArrayBuffer::Allocator* array_buffer_allocator() { 133 static v8::ArrayBuffer::Allocator* array_buffer_allocator() {
153 return allocator_; 134 return allocator_;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 HandleAndZoneScope() {} 597 HandleAndZoneScope() {}
617 598
618 // Prefixing the below with main_ reduces a lot of naming clashes. 599 // Prefixing the below with main_ reduces a lot of naming clashes.
619 i::Zone* main_zone() { return &main_zone_; } 600 i::Zone* main_zone() { return &main_zone_; }
620 601
621 private: 602 private:
622 i::Zone main_zone_; 603 i::Zone main_zone_;
623 }; 604 };
624 605
625 #endif // ifndef CCTEST_H_ 606 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698