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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 2388153003: [modules] Implement namespace imports. (Closed)
Patch Set: Fix verifier. Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 bool success; 953 bool success;
954 LookupIterator it = LookupIterator::PropertyOrElement( 954 LookupIterator it = LookupIterator::PropertyOrElement(
955 isolate, o, key, &success, LookupIterator::OWN); 955 isolate, o, key, &success, LookupIterator::OWN);
956 if (!success) return isolate->heap()->exception(); 956 if (!success) return isolate->heap()->exception();
957 MAYBE_RETURN( 957 MAYBE_RETURN(
958 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), 958 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR),
959 isolate->heap()->exception()); 959 isolate->heap()->exception());
960 return *value; 960 return *value;
961 } 961 }
962 962
963 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) {
adamk 2016/10/04 18:26:53 It occurs to me that maybe these runtime functions
neis 2016/10/05 08:18:41 Yeah I was planning to do that eventually.
964 HandleScope scope(isolate);
965 DCHECK(args.length() == 1);
966 CONVERT_ARG_HANDLE_CHECKED(Smi, module_request, 0);
adamk 2016/10/04 18:26:53 You can use CONVERT_SMI_ARG_CHECKED here to get an
neis 2016/10/05 08:18:42 Done.
967 Handle<Module> module(isolate->context()->module());
adamk 2016/10/04 18:26:53 Seems a little scary to depend on the current cont
neis 2016/10/05 08:18:42 I don't understand. All the module runtime functi
adamk 2016/10/05 17:21:54 Sorry, you're right. Like I said, I need to rename
968 return *Module::GetModuleNamespace(module, module_request->value());
969 }
970
963 RUNTIME_FUNCTION(Runtime_LoadModuleExport) { 971 RUNTIME_FUNCTION(Runtime_LoadModuleExport) {
964 HandleScope scope(isolate); 972 HandleScope scope(isolate);
965 DCHECK(args.length() == 1); 973 DCHECK(args.length() == 1);
966 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 974 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
967 Handle<Module> module(isolate->context()->module()); 975 Handle<Module> module(isolate->context()->module());
968 return *Module::LoadExport(module, name); 976 return *Module::LoadExport(module, name);
969 } 977 }
970 978
971 RUNTIME_FUNCTION(Runtime_LoadModuleImport) { 979 RUNTIME_FUNCTION(Runtime_LoadModuleImport) {
972 HandleScope scope(isolate); 980 HandleScope scope(isolate);
973 DCHECK(args.length() == 2); 981 DCHECK(args.length() == 2);
974 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 982 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
975 CONVERT_ARG_HANDLE_CHECKED(Smi, module_request, 1); 983 CONVERT_ARG_HANDLE_CHECKED(Smi, module_request, 1);
976 Handle<Module> module(isolate->context()->module()); 984 Handle<Module> module(isolate->context()->module());
977 return *Module::LoadImport(module, name, module_request->value()); 985 return *Module::LoadImport(module, name, module_request->value());
978 } 986 }
979 987
980 RUNTIME_FUNCTION(Runtime_StoreModuleExport) { 988 RUNTIME_FUNCTION(Runtime_StoreModuleExport) {
981 HandleScope scope(isolate); 989 HandleScope scope(isolate);
982 DCHECK(args.length() == 2); 990 DCHECK(args.length() == 2);
983 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 991 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
984 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); 992 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
985 Handle<Module> module(isolate->context()->module()); 993 Handle<Module> module(isolate->context()->module());
986 Module::StoreExport(module, name, value); 994 Module::StoreExport(module, name, value);
987 return isolate->heap()->undefined_value(); 995 return isolate->heap()->undefined_value();
988 } 996 }
989 997
990 } // namespace internal 998 } // namespace internal
991 } // namespace v8 999 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698