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

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

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/OWNERS ('k') | test/cctest/cctest.cc » ('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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // Only for UNINITIALIZED_TESTs 124 // Only for UNINITIALIZED_TESTs
125 static void DisableAutomaticDispose(); 125 static void DisableAutomaticDispose();
126 126
127 // Helper function to configure a context. 127 // Helper function to configure a context.
128 // Must be in a HandleScope. 128 // Must be in a HandleScope.
129 static v8::Local<v8::Context> NewContext( 129 static v8::Local<v8::Context> NewContext(
130 CcTestExtensionFlags extensions, 130 CcTestExtensionFlags extensions,
131 v8::Isolate* isolate = CcTest::isolate()); 131 v8::Isolate* isolate = CcTest::isolate());
132 132
133 static void TearDown() {
134 if (isolate_ != NULL) isolate_->Dispose();
135 }
136
133 private: 137 private:
134 friend int main(int argc, char** argv); 138 friend int main(int argc, char** argv);
135 TestFunction* callback_; 139 TestFunction* callback_;
136 const char* file_; 140 const char* file_;
137 const char* name_; 141 const char* name_;
138 const char* dependency_; 142 const char* dependency_;
139 bool enabled_; 143 bool enabled_;
140 bool initialize_; 144 bool initialize_;
141 CcTest* prev_; 145 CcTest* prev_;
142 static CcTest* last_; 146 static CcTest* last_;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 308 }
305 309
306 310
307 // Helper function that compiles and runs the source. 311 // Helper function that compiles and runs the source.
308 static inline v8::Local<v8::Value> CompileRun(const char* source) { 312 static inline v8::Local<v8::Value> CompileRun(const char* source) {
309 return v8::Script::Compile( 313 return v8::Script::Compile(
310 v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), source))->Run(); 314 v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), source))->Run();
311 } 315 }
312 316
313 317
318 static inline v8::Local<v8::Value> PreCompileCompileRun(const char* source) {
319 v8::Local<v8::String> script_source =
320 v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), source);
321 v8::ScriptData* preparse = v8::ScriptData::PreCompile(script_source);
322 v8::Local<v8::Script> script =
323 v8::Script::Compile(script_source, NULL, preparse);
324 v8::Local<v8::Value> result = script->Run();
325 delete preparse;
326 return result;
327 }
328
329
314 // Helper function that compiles and runs the source with given origin. 330 // Helper function that compiles and runs the source with given origin.
315 static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source, 331 static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source,
316 const char* origin_url, 332 const char* origin_url,
317 int line_number, 333 int line_number,
318 int column_number) { 334 int column_number) {
319 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 335 v8::Isolate* isolate = v8::Isolate::GetCurrent();
320 v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, origin_url), 336 v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, origin_url),
321 v8::Integer::New(isolate, line_number), 337 v8::Integer::New(isolate, line_number),
322 v8::Integer::New(isolate, column_number)); 338 v8::Integer::New(isolate, column_number));
323 return v8::Script::Compile(v8::String::NewFromUtf8(isolate, source), &origin) 339 return v8::Script::Compile(v8::String::NewFromUtf8(isolate, source), &origin)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects()); 383 CHECK_EQ(0, heap_profiler_->heap_object_map()->FindUntrackedObjects());
368 heap_profiler_->StopHeapObjectsTracking(); 384 heap_profiler_->StopHeapObjectsTracking();
369 } 385 }
370 386
371 private: 387 private:
372 i::HeapProfiler* heap_profiler_; 388 i::HeapProfiler* heap_profiler_;
373 }; 389 };
374 390
375 391
376 #endif // ifndef CCTEST_H_ 392 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « test/cctest/OWNERS ('k') | test/cctest/cctest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698