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 #include <map> |
| 9 #include <string> |
| 10 |
8 #include "src/allocation.h" | 11 #include "src/allocation.h" |
9 #include "src/base/hashmap.h" | 12 #include "src/base/hashmap.h" |
10 #include "src/base/platform/time.h" | 13 #include "src/base/platform/time.h" |
11 #include "src/list.h" | 14 #include "src/list.h" |
12 | 15 |
13 #include "src/base/once.h" | 16 #include "src/base/once.h" |
14 | 17 |
15 | 18 |
16 namespace v8 { | 19 namespace v8 { |
17 | 20 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 SourceGroup* isolate_sources; | 309 SourceGroup* isolate_sources; |
307 const char* icu_data_file; | 310 const char* icu_data_file; |
308 const char* natives_blob; | 311 const char* natives_blob; |
309 const char* snapshot_blob; | 312 const char* snapshot_blob; |
310 bool trace_enabled; | 313 bool trace_enabled; |
311 const char* trace_config; | 314 const char* trace_config; |
312 }; | 315 }; |
313 | 316 |
314 class Shell : public i::AllStatic { | 317 class Shell : public i::AllStatic { |
315 public: | 318 public: |
316 enum SourceType { SCRIPT, MODULE }; | |
317 | |
318 static MaybeLocal<Script> CompileString( | 319 static MaybeLocal<Script> CompileString( |
319 Isolate* isolate, Local<String> source, Local<Value> name, | 320 Isolate* isolate, Local<String> source, Local<Value> name, |
320 v8::ScriptCompiler::CompileOptions compile_options); | 321 v8::ScriptCompiler::CompileOptions compile_options); |
321 static bool ExecuteString(Isolate* isolate, Local<String> source, | 322 static bool ExecuteString(Isolate* isolate, Local<String> source, |
322 Local<Value> name, bool print_result, | 323 Local<Value> name, bool print_result, |
323 bool report_exceptions, | 324 bool report_exceptions); |
324 SourceType source_type = SCRIPT); | 325 static bool ExecuteModule(Isolate* isolate, const char* file_name); |
325 static const char* ToCString(const v8::String::Utf8Value& value); | 326 static const char* ToCString(const v8::String::Utf8Value& value); |
326 static void ReportException(Isolate* isolate, TryCatch* try_catch); | 327 static void ReportException(Isolate* isolate, TryCatch* try_catch); |
327 static Local<String> ReadFile(Isolate* isolate, const char* name); | 328 static Local<String> ReadFile(Isolate* isolate, const char* name); |
328 static Local<Context> CreateEvaluationContext(Isolate* isolate); | 329 static Local<Context> CreateEvaluationContext(Isolate* isolate); |
329 static int RunMain(Isolate* isolate, int argc, char* argv[], bool last_run); | 330 static int RunMain(Isolate* isolate, int argc, char* argv[], bool last_run); |
330 static int Main(int argc, char* argv[]); | 331 static int Main(int argc, char* argv[]); |
331 static void Exit(int exit_code); | 332 static void Exit(int exit_code); |
332 static void OnExit(Isolate* isolate); | 333 static void OnExit(Isolate* isolate); |
333 static void CollectGarbage(Isolate* isolate); | 334 static void CollectGarbage(Isolate* isolate); |
334 static void EmptyMessageQueues(Isolate* isolate); | 335 static void EmptyMessageQueues(Isolate* isolate); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 448 |
448 static void WriteIgnitionDispatchCountersFile(v8::Isolate* isolate); | 449 static void WriteIgnitionDispatchCountersFile(v8::Isolate* isolate); |
449 static Counter* GetCounter(const char* name, bool is_histogram); | 450 static Counter* GetCounter(const char* name, bool is_histogram); |
450 static Local<String> Stringify(Isolate* isolate, Local<Value> value); | 451 static Local<String> Stringify(Isolate* isolate, Local<Value> value); |
451 static void Initialize(Isolate* isolate); | 452 static void Initialize(Isolate* isolate); |
452 static void RunShell(Isolate* isolate); | 453 static void RunShell(Isolate* isolate); |
453 static bool SetOptions(int argc, char* argv[]); | 454 static bool SetOptions(int argc, char* argv[]); |
454 static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); | 455 static Local<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); |
455 static MaybeLocal<Context> CreateRealm( | 456 static MaybeLocal<Context> CreateRealm( |
456 const v8::FunctionCallbackInfo<v8::Value>& args); | 457 const v8::FunctionCallbackInfo<v8::Value>& args); |
| 458 static MaybeLocal<Module> FetchModuleTree( |
| 459 Isolate* isolate, const std::string& file_name, |
| 460 std::map<std::string, Global<Module>>* module_map); |
457 }; | 461 }; |
458 | 462 |
459 | 463 |
460 } // namespace v8 | 464 } // namespace v8 |
461 | 465 |
462 | 466 |
463 #endif // V8_D8_H_ | 467 #endif // V8_D8_H_ |
OLD | NEW |