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

Side by Side Diff: src/d8.cc

Issue 2366773002: [modules] Allow Module::Instantiate to throw exceptions (Closed)
Patch Set: Rebased Created 4 years, 3 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
« no previous file with comments | « src/counters.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 634
635 TryCatch try_catch(isolate); 635 TryCatch try_catch(isolate);
636 try_catch.SetVerbose(true); 636 try_catch.SetVerbose(true);
637 637
638 MaybeLocal<Value> maybe_result; 638 MaybeLocal<Value> maybe_result;
639 { 639 {
640 PerIsolateData* data = PerIsolateData::Get(isolate); 640 PerIsolateData* data = PerIsolateData::Get(isolate);
641 Local<Context> realm = data->realms_[data->realm_current_].Get(isolate); 641 Local<Context> realm = data->realms_[data->realm_current_].Get(isolate);
642 Context::Scope context_scope(realm); 642 Context::Scope context_scope(realm);
643 643
644 // This can't fail until we support linking. 644 if (root_module->Instantiate(realm, ResolveModuleCallback,
645 CHECK(root_module->Instantiate(realm, ResolveModuleCallback, 645 External::New(isolate, &module_map))) {
646 External::New(isolate, &module_map))); 646 maybe_result = root_module->Evaluate(realm);
647 maybe_result = root_module->Evaluate(realm); 647 EmptyMessageQueues(isolate);
648 EmptyMessageQueues(isolate); 648 }
649 } 649 }
650 Local<Value> result; 650 Local<Value> result;
651 if (!maybe_result.ToLocal(&result)) { 651 if (!maybe_result.ToLocal(&result)) {
652 DCHECK(try_catch.HasCaught()); 652 DCHECK(try_catch.HasCaught());
653 // Print errors that happened during execution. 653 // Print errors that happened during execution.
654 ReportException(isolate, &try_catch); 654 ReportException(isolate, &try_catch);
655 return false; 655 return false;
656 } 656 }
657 DCHECK(!try_catch.HasCaught()); 657 DCHECK(!try_catch.HasCaught());
658 return true; 658 return true;
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 } 2752 }
2753 2753
2754 } // namespace v8 2754 } // namespace v8
2755 2755
2756 2756
2757 #ifndef GOOGLE3 2757 #ifndef GOOGLE3
2758 int main(int argc, char* argv[]) { 2758 int main(int argc, char* argv[]) {
2759 return v8::Shell::Main(argc, argv); 2759 return v8::Shell::Main(argc, argv);
2760 } 2760 }
2761 #endif 2761 #endif
OLDNEW
« no previous file with comments | « src/counters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698