| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 | 11 |
| 12 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { | 12 RUNTIME_FUNCTION(Runtime_GetModuleNamespace) { |
| 13 HandleScope scope(isolate); | 13 HandleScope scope(isolate); |
| 14 DCHECK(args.length() == 1); | 14 DCHECK_EQ(1, args.length()); |
| 15 CONVERT_SMI_ARG_CHECKED(module_request, 0); | 15 CONVERT_SMI_ARG_CHECKED(module_request, 0); |
| 16 Handle<Module> module(isolate->context()->module()); | 16 Handle<Module> module(isolate->context()->module()); |
| 17 return *Module::GetModuleNamespace(module, module_request); | 17 return *Module::GetModuleNamespace(module, module_request); |
| 18 } | 18 } |
| 19 | 19 |
| 20 RUNTIME_FUNCTION(Runtime_LoadModuleVariable) { | 20 RUNTIME_FUNCTION(Runtime_LoadModuleVariable) { |
| 21 HandleScope scope(isolate); | 21 HandleScope scope(isolate); |
| 22 DCHECK(args.length() == 1); | 22 DCHECK_EQ(1, args.length()); |
| 23 CONVERT_SMI_ARG_CHECKED(index, 0); | 23 CONVERT_SMI_ARG_CHECKED(index, 0); |
| 24 Handle<Module> module(isolate->context()->module()); | 24 Handle<Module> module(isolate->context()->module()); |
| 25 return *Module::LoadVariable(module, index); | 25 return *Module::LoadVariable(module, index); |
| 26 } | 26 } |
| 27 | 27 |
| 28 RUNTIME_FUNCTION(Runtime_StoreModuleVariable) { | 28 RUNTIME_FUNCTION(Runtime_StoreModuleVariable) { |
| 29 HandleScope scope(isolate); | 29 HandleScope scope(isolate); |
| 30 DCHECK(args.length() == 2); | 30 DCHECK_EQ(2, args.length()); |
| 31 CONVERT_SMI_ARG_CHECKED(index, 0); | 31 CONVERT_SMI_ARG_CHECKED(index, 0); |
| 32 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 32 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 33 Handle<Module> module(isolate->context()->module()); | 33 Handle<Module> module(isolate->context()->module()); |
| 34 Module::StoreVariable(module, index, value); | 34 Module::StoreVariable(module, index, value); |
| 35 return isolate->heap()->undefined_value(); | 35 return isolate->heap()->undefined_value(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace internal | 38 } // namespace internal |
| 39 } // namespace v8 | 39 } // namespace v8 |
| OLD | NEW |