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

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

Issue 14894006: Make v8 compilable without V8_USE_UNSAFE_HANDLES. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | 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 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void set_default_isolate(v8::Isolate* default_isolate) {
87 default_isolate_ = default_isolate; 87 default_isolate_ = default_isolate;
88 } 88 }
89 static v8::Isolate* default_isolate() { return default_isolate_; } 89 static v8::Isolate* default_isolate() { return default_isolate_; }
90 static v8::Isolate* isolate() { return context()->GetIsolate(); } 90 static v8::Isolate* isolate() {
91 v8::HandleScope handle_scope;
92 return context()->GetIsolate();
dcarney 2013/05/06 11:40:17 store the isolate instead when the context is set
marja 2013/05/06 12:14:23 Removed this function, used default_isolate() inst
93 }
94
95 // You need to have a valid HandleScope before calling this function.
dcarney 2013/05/06 11:40:17 skip the comment
marja 2013/05/06 12:14:23 Done.
91 static v8::Handle<v8::Context> env() { return context(); } 96 static v8::Handle<v8::Context> env() { return context(); }
92 97
93 // Helper function to initialize the VM. 98 // Helper function to initialize the VM.
94 static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS); 99 static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS);
95 100
96 private: 101 private:
97 static v8::Handle<v8::Context> context() { 102 static v8::Handle<v8::Context> context() {
98 return *reinterpret_cast<v8::Handle<v8::Context>*>(&context_); 103 return v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), context_);
dcarney 2013/05/06 11:40:17 use the context isolate also, just inline this fun
marja 2013/05/06 12:14:23 Done.
marja 2013/05/06 12:14:23 Done.
99 } 104 }
100 TestFunction* callback_; 105 TestFunction* callback_;
101 const char* file_; 106 const char* file_;
102 const char* name_; 107 const char* name_;
103 const char* dependency_; 108 const char* dependency_;
104 bool enabled_; 109 bool enabled_;
105 CcTest* prev_; 110 CcTest* prev_;
106 static CcTest* last_; 111 static CcTest* last_;
107 static v8::Isolate* default_isolate_; 112 static v8::Isolate* default_isolate_;
108 static v8::Persistent<v8::Context> context_; 113 static v8::Persistent<v8::Context> context_;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { 291 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
287 int old_linear_size = static_cast<int>(space->limit() - space->top()); 292 int old_linear_size = static_cast<int>(space->limit() - space->top());
288 space->Free(space->top(), old_linear_size); 293 space->Free(space->top(), old_linear_size);
289 space->SetTop(space->limit(), space->limit()); 294 space->SetTop(space->limit(), space->limit());
290 space->ResetFreeList(); 295 space->ResetFreeList();
291 space->ClearStats(); 296 space->ClearStats();
292 } 297 }
293 298
294 299
295 #endif // ifndef CCTEST_H_ 300 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698