| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_D8_H_ | 5 #ifndef V8_D8_H_ |
| 6 #define V8_D8_H_ | 6 #define V8_D8_H_ |
| 7 | 7 |
| 8 #ifndef V8_SHARED | 8 #ifndef V8_SHARED |
| 9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
| 10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 begin_offset_ = offset; | 112 begin_offset_ = offset; |
| 113 } | 113 } |
| 114 | 114 |
| 115 void End(int offset) { end_offset_ = offset; } | 115 void End(int offset) { end_offset_ = offset; } |
| 116 | 116 |
| 117 void Execute(Isolate* isolate); | 117 void Execute(Isolate* isolate); |
| 118 | 118 |
| 119 #ifndef V8_SHARED | 119 #ifndef V8_SHARED |
| 120 void StartExecuteInThread(); | 120 void StartExecuteInThread(); |
| 121 void WaitForThread(); | 121 void WaitForThread(); |
| 122 void JoinThread(); |
| 122 | 123 |
| 123 private: | 124 private: |
| 124 class IsolateThread : public base::Thread { | 125 class IsolateThread : public base::Thread { |
| 125 public: | 126 public: |
| 126 explicit IsolateThread(SourceGroup* group) | 127 explicit IsolateThread(SourceGroup* group) |
| 127 : base::Thread(GetThreadOptions()), group_(group) {} | 128 : base::Thread(GetThreadOptions()), group_(group) {} |
| 128 | 129 |
| 129 virtual void Run() { | 130 virtual void Run() { |
| 130 group_->ExecuteInThread(); | 131 group_->ExecuteInThread(); |
| 131 } | 132 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 base::Atomic32 state_; | 268 base::Atomic32 state_; |
| 268 base::Atomic32 join_called_; | 269 base::Atomic32 join_called_; |
| 269 }; | 270 }; |
| 270 #endif // !V8_SHARED | 271 #endif // !V8_SHARED |
| 271 | 272 |
| 272 | 273 |
| 273 class ShellOptions { | 274 class ShellOptions { |
| 274 public: | 275 public: |
| 275 ShellOptions() | 276 ShellOptions() |
| 276 : script_executed(false), | 277 : script_executed(false), |
| 277 last_run(true), | |
| 278 send_idle_notification(false), | 278 send_idle_notification(false), |
| 279 invoke_weak_callbacks(false), | 279 invoke_weak_callbacks(false), |
| 280 omit_quit(false), | 280 omit_quit(false), |
| 281 stress_opt(false), | 281 stress_opt(false), |
| 282 stress_deopt(false), | 282 stress_deopt(false), |
| 283 stress_runs(1), |
| 283 interactive_shell(false), | 284 interactive_shell(false), |
| 284 test_shell(false), | 285 test_shell(false), |
| 285 dump_heap_constants(false), | 286 dump_heap_constants(false), |
| 286 expected_to_throw(false), | 287 expected_to_throw(false), |
| 287 mock_arraybuffer_allocator(false), | 288 mock_arraybuffer_allocator(false), |
| 288 num_isolates(1), | 289 num_isolates(1), |
| 289 compile_options(v8::ScriptCompiler::kNoCompileOptions), | 290 compile_options(v8::ScriptCompiler::kNoCompileOptions), |
| 290 isolate_sources(NULL), | 291 isolate_sources(NULL), |
| 291 icu_data_file(NULL), | 292 icu_data_file(NULL), |
| 292 natives_blob(NULL), | 293 natives_blob(NULL), |
| 293 snapshot_blob(NULL) {} | 294 snapshot_blob(NULL) {} |
| 294 | 295 |
| 295 ~ShellOptions() { | 296 ~ShellOptions() { |
| 296 delete[] isolate_sources; | 297 delete[] isolate_sources; |
| 297 } | 298 } |
| 298 | 299 |
| 299 bool use_interactive_shell() { | 300 bool use_interactive_shell() { |
| 300 return (interactive_shell || !script_executed) && !test_shell; | 301 return (interactive_shell || !script_executed) && !test_shell; |
| 301 } | 302 } |
| 302 | 303 |
| 303 bool script_executed; | 304 bool script_executed; |
| 304 bool last_run; | |
| 305 bool send_idle_notification; | 305 bool send_idle_notification; |
| 306 bool invoke_weak_callbacks; | 306 bool invoke_weak_callbacks; |
| 307 bool omit_quit; | 307 bool omit_quit; |
| 308 bool stress_opt; | 308 bool stress_opt; |
| 309 bool stress_deopt; | 309 bool stress_deopt; |
| 310 int stress_runs; |
| 310 bool interactive_shell; | 311 bool interactive_shell; |
| 311 bool test_shell; | 312 bool test_shell; |
| 312 bool dump_heap_constants; | 313 bool dump_heap_constants; |
| 313 bool expected_to_throw; | 314 bool expected_to_throw; |
| 314 bool mock_arraybuffer_allocator; | 315 bool mock_arraybuffer_allocator; |
| 315 int num_isolates; | 316 int num_isolates; |
| 316 v8::ScriptCompiler::CompileOptions compile_options; | 317 v8::ScriptCompiler::CompileOptions compile_options; |
| 317 SourceGroup* isolate_sources; | 318 SourceGroup* isolate_sources; |
| 318 const char* icu_data_file; | 319 const char* icu_data_file; |
| 319 const char* natives_blob; | 320 const char* natives_blob; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 334 v8::ScriptCompiler::CompileOptions compile_options, | 335 v8::ScriptCompiler::CompileOptions compile_options, |
| 335 SourceType source_type); | 336 SourceType source_type); |
| 336 static bool ExecuteString(Isolate* isolate, Local<String> source, | 337 static bool ExecuteString(Isolate* isolate, Local<String> source, |
| 337 Local<Value> name, bool print_result, | 338 Local<Value> name, bool print_result, |
| 338 bool report_exceptions, | 339 bool report_exceptions, |
| 339 SourceType source_type = SCRIPT); | 340 SourceType source_type = SCRIPT); |
| 340 static const char* ToCString(const v8::String::Utf8Value& value); | 341 static const char* ToCString(const v8::String::Utf8Value& value); |
| 341 static void ReportException(Isolate* isolate, TryCatch* try_catch); | 342 static void ReportException(Isolate* isolate, TryCatch* try_catch); |
| 342 static Local<String> ReadFile(Isolate* isolate, const char* name); | 343 static Local<String> ReadFile(Isolate* isolate, const char* name); |
| 343 static Local<Context> CreateEvaluationContext(Isolate* isolate); | 344 static Local<Context> CreateEvaluationContext(Isolate* isolate); |
| 344 static int RunMain(Isolate* isolate, int argc, char* argv[]); | 345 static int RunMain(Isolate* isolate, int argc, char* argv[], bool last_run); |
| 345 static int Main(int argc, char* argv[]); | 346 static int Main(int argc, char* argv[]); |
| 346 static void Exit(int exit_code); | 347 static void Exit(int exit_code); |
| 347 static void OnExit(Isolate* isolate); | 348 static void OnExit(Isolate* isolate); |
| 348 static void CollectGarbage(Isolate* isolate); | 349 static void CollectGarbage(Isolate* isolate); |
| 349 static void EmptyMessageQueues(Isolate* isolate); | 350 static void EmptyMessageQueues(Isolate* isolate); |
| 350 | 351 |
| 351 #ifndef V8_SHARED | 352 #ifndef V8_SHARED |
| 352 // TODO(binji): stupid implementation for now. Is there an easy way to hash an | 353 // TODO(binji): stupid implementation for now. Is there an easy way to hash an |
| 353 // object for use in i::HashMap? By pointer? | 354 // object for use in i::HashMap? By pointer? |
| 354 typedef i::List<Local<Object>> ObjectList; | 355 typedef i::List<Local<Object>> ObjectList; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 static void RunShell(Isolate* isolate); | 469 static void RunShell(Isolate* isolate); |
| 469 static bool SetOptions(int argc, char* argv[]); | 470 static bool SetOptions(int argc, char* argv[]); |
| 470 static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); | 471 static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); |
| 471 }; | 472 }; |
| 472 | 473 |
| 473 | 474 |
| 474 } // namespace v8 | 475 } // namespace v8 |
| 475 | 476 |
| 476 | 477 |
| 477 #endif // V8_D8_H_ | 478 #endif // V8_D8_H_ |
| OLD | NEW |