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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 char* script_; | 286 char* script_; |
287 base::Atomic32 state_; | 287 base::Atomic32 state_; |
288 base::Atomic32 join_called_; | 288 base::Atomic32 join_called_; |
289 }; | 289 }; |
290 #endif // !V8_SHARED | 290 #endif // !V8_SHARED |
291 | 291 |
292 | 292 |
293 class ShellOptions { | 293 class ShellOptions { |
294 public: | 294 public: |
295 ShellOptions() | 295 ShellOptions() |
296 : script_executed(false), | 296 : send_idle_notification(false), |
297 last_run(true), | |
298 send_idle_notification(false), | |
299 invoke_weak_callbacks(false), | 297 invoke_weak_callbacks(false), |
300 omit_quit(false), | 298 omit_quit(false), |
301 stress_opt(false), | 299 stress_opt(false), |
302 stress_deopt(false), | 300 stress_deopt(false), |
303 interactive_shell(false), | 301 interactive_shell(false), |
304 test_shell(false), | 302 test_shell(false), |
305 dump_heap_constants(false), | 303 dump_heap_constants(false), |
306 expected_to_throw(false), | 304 expected_to_throw(false), |
307 mock_arraybuffer_allocator(false), | 305 mock_arraybuffer_allocator(false), |
308 num_isolates(1), | 306 num_isolates(1), |
309 compile_options(v8::ScriptCompiler::kNoCompileOptions), | 307 compile_options(v8::ScriptCompiler::kNoCompileOptions), |
310 isolate_sources(NULL), | 308 isolate_sources(NULL), |
311 icu_data_file(NULL), | 309 icu_data_file(NULL), |
312 natives_blob(NULL), | 310 natives_blob(NULL), |
313 snapshot_blob(NULL) {} | 311 snapshot_blob(NULL), |
| 312 script_executed_(false), |
| 313 last_run_(true) {} |
314 | 314 |
315 ~ShellOptions() { | 315 ~ShellOptions() { |
316 delete[] isolate_sources; | 316 delete[] isolate_sources; |
317 } | 317 } |
318 | 318 |
319 bool use_interactive_shell() { | 319 bool use_interactive_shell() { |
320 return (interactive_shell || !script_executed) && !test_shell; | 320 return (interactive_shell || !script_executed()) && !test_shell; |
321 } | 321 } |
322 | 322 |
323 bool script_executed; | 323 bool script_executed() { return base::NoBarrier_Load(&script_executed_); } |
324 bool last_run; | 324 |
| 325 void set_script_executed(bool value) { |
| 326 return base::NoBarrier_Store(&script_executed_, value); |
| 327 } |
| 328 |
| 329 bool last_run() { return base::NoBarrier_Load(&last_run_); } |
| 330 |
| 331 void set_last_run(bool value) { |
| 332 return base::NoBarrier_Store(&last_run_, value); |
| 333 } |
| 334 |
325 bool send_idle_notification; | 335 bool send_idle_notification; |
326 bool invoke_weak_callbacks; | 336 bool invoke_weak_callbacks; |
327 bool omit_quit; | 337 bool omit_quit; |
328 bool stress_opt; | 338 bool stress_opt; |
329 bool stress_deopt; | 339 bool stress_deopt; |
330 bool interactive_shell; | 340 bool interactive_shell; |
331 bool test_shell; | 341 bool test_shell; |
332 bool dump_heap_constants; | 342 bool dump_heap_constants; |
333 bool expected_to_throw; | 343 bool expected_to_throw; |
334 bool mock_arraybuffer_allocator; | 344 bool mock_arraybuffer_allocator; |
335 int num_isolates; | 345 int num_isolates; |
336 v8::ScriptCompiler::CompileOptions compile_options; | 346 v8::ScriptCompiler::CompileOptions compile_options; |
337 SourceGroup* isolate_sources; | 347 SourceGroup* isolate_sources; |
338 const char* icu_data_file; | 348 const char* icu_data_file; |
339 const char* natives_blob; | 349 const char* natives_blob; |
340 const char* snapshot_blob; | 350 const char* snapshot_blob; |
| 351 |
| 352 private: |
| 353 base::Atomic32 script_executed_; |
| 354 base::Atomic32 last_run_; |
341 }; | 355 }; |
342 | 356 |
343 #ifdef V8_SHARED | 357 #ifdef V8_SHARED |
344 class Shell { | 358 class Shell { |
345 #else | 359 #else |
346 class Shell : public i::AllStatic { | 360 class Shell : public i::AllStatic { |
347 #endif // V8_SHARED | 361 #endif // V8_SHARED |
348 | 362 |
349 public: | 363 public: |
350 enum SourceType { SCRIPT, MODULE }; | 364 enum SourceType { SCRIPT, MODULE }; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 static void RunShell(Isolate* isolate); | 510 static void RunShell(Isolate* isolate); |
497 static bool SetOptions(int argc, char* argv[]); | 511 static bool SetOptions(int argc, char* argv[]); |
498 static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); | 512 static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); |
499 }; | 513 }; |
500 | 514 |
501 | 515 |
502 } // namespace v8 | 516 } // namespace v8 |
503 | 517 |
504 | 518 |
505 #endif // V8_D8_H_ | 519 #endif // V8_D8_H_ |
OLD | NEW |