OLD | NEW |
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 static v8::base::RandomNumberGenerator* random_number_generator() { | 140 static v8::base::RandomNumberGenerator* random_number_generator() { |
141 return InitIsolateOnce()->random_number_generator(); | 141 return InitIsolateOnce()->random_number_generator(); |
142 } | 142 } |
143 | 143 |
144 static v8::Local<v8::Object> global() { | 144 static v8::Local<v8::Object> global() { |
145 return isolate()->GetCurrentContext()->Global(); | 145 return isolate()->GetCurrentContext()->Global(); |
146 } | 146 } |
147 | 147 |
| 148 static v8::ArrayBuffer::Allocator* array_buffer_allocator() { |
| 149 return allocator_; |
| 150 } |
| 151 |
| 152 static void set_array_buffer_allocator( |
| 153 v8::ArrayBuffer::Allocator* allocator) { |
| 154 allocator_ = allocator; |
| 155 } |
| 156 |
148 // TODO(dcarney): Remove. | 157 // TODO(dcarney): Remove. |
149 // This must be called first in a test. | 158 // This must be called first in a test. |
150 static void InitializeVM() { | 159 static void InitializeVM() { |
151 CHECK(!v8::base::NoBarrier_Load(&isolate_used_)); | 160 CHECK(!v8::base::NoBarrier_Load(&isolate_used_)); |
152 CHECK(!initialize_called_); | 161 CHECK(!initialize_called_); |
153 initialize_called_ = true; | 162 initialize_called_ = true; |
154 v8::HandleScope handle_scope(CcTest::isolate()); | 163 v8::HandleScope handle_scope(CcTest::isolate()); |
155 v8::Context::New(CcTest::isolate())->Enter(); | 164 v8::Context::New(CcTest::isolate())->Enter(); |
156 } | 165 } |
157 | 166 |
(...skipping 13 matching lines...) Expand all Loading... |
171 private: | 180 private: |
172 friend int main(int argc, char** argv); | 181 friend int main(int argc, char** argv); |
173 TestFunction* callback_; | 182 TestFunction* callback_; |
174 const char* file_; | 183 const char* file_; |
175 const char* name_; | 184 const char* name_; |
176 const char* dependency_; | 185 const char* dependency_; |
177 bool enabled_; | 186 bool enabled_; |
178 bool initialize_; | 187 bool initialize_; |
179 CcTest* prev_; | 188 CcTest* prev_; |
180 static CcTest* last_; | 189 static CcTest* last_; |
| 190 static v8::ArrayBuffer::Allocator* allocator_; |
181 static v8::Isolate* isolate_; | 191 static v8::Isolate* isolate_; |
182 static bool initialize_called_; | 192 static bool initialize_called_; |
183 static v8::base::Atomic32 isolate_used_; | 193 static v8::base::Atomic32 isolate_used_; |
184 }; | 194 }; |
185 | 195 |
186 // Switches between all the Api tests using the threading support. | 196 // Switches between all the Api tests using the threading support. |
187 // In order to get a surprising but repeatable pattern of thread | 197 // In order to get a surprising but repeatable pattern of thread |
188 // switching it has extra semaphores to control the order in which | 198 // switching it has extra semaphores to control the order in which |
189 // the tests alternate, not relying solely on the big V8 lock. | 199 // the tests alternate, not relying solely on the big V8 lock. |
190 // | 200 // |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 HandleAndZoneScope() {} | 616 HandleAndZoneScope() {} |
607 | 617 |
608 // Prefixing the below with main_ reduces a lot of naming clashes. | 618 // Prefixing the below with main_ reduces a lot of naming clashes. |
609 i::Zone* main_zone() { return &main_zone_; } | 619 i::Zone* main_zone() { return &main_zone_; } |
610 | 620 |
611 private: | 621 private: |
612 i::Zone main_zone_; | 622 i::Zone main_zone_; |
613 }; | 623 }; |
614 | 624 |
615 #endif // ifndef CCTEST_H_ | 625 #endif // ifndef CCTEST_H_ |
OLD | NEW |