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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 typedef void (TestFunction)(); | 76 typedef void (TestFunction)(); |
77 CcTest(TestFunction* callback, const char* file, const char* name, | 77 CcTest(TestFunction* callback, const char* file, const char* name, |
78 const char* dependency, bool enabled); | 78 const char* dependency, bool enabled); |
79 void Run() { callback_(); } | 79 void Run() { callback_(); } |
80 static CcTest* last() { return last_; } | 80 static CcTest* last() { return last_; } |
81 CcTest* prev() { return prev_; } | 81 CcTest* prev() { return prev_; } |
82 const char* file() { return file_; } | 82 const char* file() { return file_; } |
83 const char* name() { return name_; } | 83 const char* name() { return name_; } |
84 const char* dependency() { return dependency_; } | 84 const char* dependency() { return dependency_; } |
85 bool enabled() { return enabled_; } | 85 bool enabled() { return enabled_; } |
86 static void set_default_isolate(v8::Isolate* default_isolate) { | 86 static v8::Isolate* default_isolate() { return default_isolate_; } |
87 default_isolate_ = default_isolate; | 87 |
| 88 static v8::Handle<v8::Context> env() { |
| 89 return v8::Local<v8::Context>::New(default_isolate_, context_); |
88 } | 90 } |
89 static v8::Isolate* default_isolate() { return default_isolate_; } | 91 |
90 static v8::Isolate* isolate() { return context()->GetIsolate(); } | 92 static v8::Isolate* isolate() { return default_isolate_; } |
91 static v8::Handle<v8::Context> env() { return context(); } | |
92 | 93 |
93 // Helper function to initialize the VM. | 94 // Helper function to initialize the VM. |
94 static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS); | 95 static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS); |
95 | 96 |
96 private: | 97 private: |
97 static v8::Handle<v8::Context> context() { | 98 friend int main(int argc, char** argv); |
98 return *reinterpret_cast<v8::Handle<v8::Context>*>(&context_); | 99 static void set_default_isolate(v8::Isolate* default_isolate) { |
| 100 default_isolate_ = default_isolate; |
99 } | 101 } |
100 TestFunction* callback_; | 102 TestFunction* callback_; |
101 const char* file_; | 103 const char* file_; |
102 const char* name_; | 104 const char* name_; |
103 const char* dependency_; | 105 const char* dependency_; |
104 bool enabled_; | 106 bool enabled_; |
105 CcTest* prev_; | 107 CcTest* prev_; |
106 static CcTest* last_; | 108 static CcTest* last_; |
107 static v8::Isolate* default_isolate_; | 109 static v8::Isolate* default_isolate_; |
108 static v8::Persistent<v8::Context> context_; | 110 static v8::Persistent<v8::Context> context_; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { | 288 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { |
287 int old_linear_size = static_cast<int>(space->limit() - space->top()); | 289 int old_linear_size = static_cast<int>(space->limit() - space->top()); |
288 space->Free(space->top(), old_linear_size); | 290 space->Free(space->top(), old_linear_size); |
289 space->SetTop(space->limit(), space->limit()); | 291 space->SetTop(space->limit(), space->limit()); |
290 space->ResetFreeList(); | 292 space->ResetFreeList(); |
291 space->ClearStats(); | 293 space->ClearStats(); |
292 } | 294 } |
293 | 295 |
294 | 296 |
295 #endif // ifndef CCTEST_H_ | 297 #endif // ifndef CCTEST_H_ |
OLD | NEW |