| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const char* dependency, bool enabled, bool initialize); | 86 const char* dependency, bool enabled, bool initialize); |
| 87 void Run(); | 87 void Run(); |
| 88 static CcTest* last() { return last_; } | 88 static CcTest* last() { return last_; } |
| 89 CcTest* prev() { return prev_; } | 89 CcTest* prev() { return prev_; } |
| 90 const char* file() { return file_; } | 90 const char* file() { return file_; } |
| 91 const char* name() { return name_; } | 91 const char* name() { return name_; } |
| 92 const char* dependency() { return dependency_; } | 92 const char* dependency() { return dependency_; } |
| 93 bool enabled() { return enabled_; } | 93 bool enabled() { return enabled_; } |
| 94 | 94 |
| 95 static v8::Isolate* isolate() { | 95 static v8::Isolate* isolate() { |
| 96 CHECK(isolate_ != NULL); |
| 96 isolate_used_ = true; | 97 isolate_used_ = true; |
| 97 return isolate_; | 98 return isolate_; |
| 98 } | 99 } |
| 99 | 100 |
| 100 static i::Isolate* i_isolate() { | 101 static i::Isolate* i_isolate() { |
| 101 return reinterpret_cast<i::Isolate*>(isolate()); | 102 return reinterpret_cast<i::Isolate*>(isolate()); |
| 102 } | 103 } |
| 103 | 104 |
| 104 static i::Heap* heap() { | 105 static i::Heap* heap() { |
| 105 return i_isolate()->heap(); | 106 return i_isolate()->heap(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 // TODO(dcarney): Remove. | 109 // TODO(dcarney): Remove. |
| 109 // This must be called first in a test. | 110 // This must be called first in a test. |
| 110 static void InitializeVM() { | 111 static void InitializeVM() { |
| 111 CHECK(!isolate_used_); | 112 CHECK(!isolate_used_); |
| 112 CHECK(!initialize_called_); | 113 CHECK(!initialize_called_); |
| 113 initialize_called_ = true; | 114 initialize_called_ = true; |
| 114 v8::HandleScope handle_scope(CcTest::isolate()); | 115 v8::HandleScope handle_scope(CcTest::isolate()); |
| 115 v8::Context::New(CcTest::isolate())->Enter(); | 116 v8::Context::New(CcTest::isolate())->Enter(); |
| 116 } | 117 } |
| 117 | 118 |
| 119 // Only for UNINITIALIZED_TESTs |
| 120 static void DisableAutomaticDispose(); |
| 121 |
| 118 // Helper function to configure a context. | 122 // Helper function to configure a context. |
| 119 // Must be in a HandleScope. | 123 // Must be in a HandleScope. |
| 120 static v8::Local<v8::Context> NewContext( | 124 static v8::Local<v8::Context> NewContext( |
| 121 CcTestExtensionFlags extensions, | 125 CcTestExtensionFlags extensions, |
| 122 v8::Isolate* isolate = CcTest::isolate()); | 126 v8::Isolate* isolate = CcTest::isolate()); |
| 123 | 127 |
| 124 private: | 128 private: |
| 125 friend int main(int argc, char** argv); | 129 friend int main(int argc, char** argv); |
| 126 TestFunction* callback_; | 130 TestFunction* callback_; |
| 127 const char* file_; | 131 const char* file_; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { | 338 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { |
| 335 int old_linear_size = static_cast<int>(space->limit() - space->top()); | 339 int old_linear_size = static_cast<int>(space->limit() - space->top()); |
| 336 space->Free(space->top(), old_linear_size); | 340 space->Free(space->top(), old_linear_size); |
| 337 space->SetTop(space->limit(), space->limit()); | 341 space->SetTop(space->limit(), space->limit()); |
| 338 space->ResetFreeList(); | 342 space->ResetFreeList(); |
| 339 space->ClearStats(); | 343 space->ClearStats(); |
| 340 } | 344 } |
| 341 | 345 |
| 342 | 346 |
| 343 #endif // ifndef CCTEST_H_ | 347 #endif // ifndef CCTEST_H_ |
| OLD | NEW |