| 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 #include <errno.h> | 5 #include <errno.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 const std::string& file_name) { | 683 const std::string& file_name) { |
| 684 DCHECK(IsAbsolutePath(file_name)); | 684 DCHECK(IsAbsolutePath(file_name)); |
| 685 Isolate* isolate = context->GetIsolate(); | 685 Isolate* isolate = context->GetIsolate(); |
| 686 TryCatch try_catch(isolate); | 686 TryCatch try_catch(isolate); |
| 687 try_catch.SetVerbose(true); | 687 try_catch.SetVerbose(true); |
| 688 Local<String> source_text = ReadFile(isolate, file_name.c_str()); | 688 Local<String> source_text = ReadFile(isolate, file_name.c_str()); |
| 689 if (source_text.IsEmpty()) { | 689 if (source_text.IsEmpty()) { |
| 690 printf("Error reading '%s'\n", file_name.c_str()); | 690 printf("Error reading '%s'\n", file_name.c_str()); |
| 691 Shell::Exit(1); | 691 Shell::Exit(1); |
| 692 } | 692 } |
| 693 ScriptOrigin origin( | 693 ScriptOrigin origin = ScriptOrigin::ModuleOrigin( |
| 694 String::NewFromUtf8(isolate, file_name.c_str(), NewStringType::kNormal) | 694 String::NewFromUtf8(isolate, file_name.c_str(), NewStringType::kNormal) |
| 695 .ToLocalChecked()); | 695 .ToLocalChecked(), |
| 696 isolate); |
| 696 ScriptCompiler::Source source(source_text, origin); | 697 ScriptCompiler::Source source(source_text, origin); |
| 697 Local<Module> module; | 698 Local<Module> module; |
| 698 if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) { | 699 if (!ScriptCompiler::CompileModule(isolate, &source).ToLocal(&module)) { |
| 699 ReportException(isolate, &try_catch); | 700 ReportException(isolate, &try_catch); |
| 700 return MaybeLocal<Module>(); | 701 return MaybeLocal<Module>(); |
| 701 } | 702 } |
| 702 | 703 |
| 703 ModuleEmbedderData* d = GetModuleDataFromContext(context); | 704 ModuleEmbedderData* d = GetModuleDataFromContext(context); |
| 704 CHECK(d->specifier_to_module_map | 705 CHECK(d->specifier_to_module_map |
| 705 .insert(std::make_pair(file_name, Global<Module>(isolate, module))) | 706 .insert(std::make_pair(file_name, Global<Module>(isolate, module))) |
| (...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3077 } | 3078 } |
| 3078 | 3079 |
| 3079 } // namespace v8 | 3080 } // namespace v8 |
| 3080 | 3081 |
| 3081 | 3082 |
| 3082 #ifndef GOOGLE3 | 3083 #ifndef GOOGLE3 |
| 3083 int main(int argc, char* argv[]) { | 3084 int main(int argc, char* argv[]) { |
| 3084 return v8::Shell::Main(argc, argv); | 3085 return v8::Shell::Main(argc, argv); |
| 3085 } | 3086 } |
| 3086 #endif | 3087 #endif |
| OLD | NEW |