Commit 4ff5c2a7 authored by neis's avatar neis Committed by Commit bot

[modules] Move runtime functions into new file (runtime-module.cc).

R=adamk@chromium.org
BUG=v8:1569

Review-Url: https://codereview.chromium.org/2404243002
Cr-Commit-Position: refs/heads/master@{#40184}
parent 82b10341
......@@ -1600,6 +1600,7 @@ v8_source_set("v8_base") {
"src/runtime/runtime-literals.cc",
"src/runtime/runtime-liveedit.cc",
"src/runtime/runtime-maths.cc",
"src/runtime/runtime-module.cc",
"src/runtime/runtime-numbers.cc",
"src/runtime/runtime-object.cc",
"src/runtime/runtime-operators.cc",
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/runtime/runtime-utils.h"
#include "src/arguments.h"
namespace v8 {
namespace internal {
RUNTIME_FUNCTION(Runtime_GetModuleNamespace) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_SMI_ARG_CHECKED(module_request, 0);
Handle<Module> module(isolate->context()->module());
return *Module::GetModuleNamespace(module, module_request);
}
RUNTIME_FUNCTION(Runtime_LoadModuleExport) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
Handle<Module> module(isolate->context()->module());
return *Module::LoadExport(module, name);
}
RUNTIME_FUNCTION(Runtime_LoadModuleImport) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_SMI_ARG_CHECKED(module_request, 1);
Handle<Module> module(isolate->context()->module());
return *Module::LoadImport(module, name, module_request);
}
RUNTIME_FUNCTION(Runtime_StoreModuleExport) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
Handle<Module> module(isolate->context()->module());
Module::StoreExport(module, name, value);
return isolate->heap()->undefined_value();
}
} // namespace internal
} // namespace v8
......@@ -960,40 +960,6 @@ RUNTIME_FUNCTION(Runtime_CreateDataProperty) {
return *value;
}
RUNTIME_FUNCTION(Runtime_GetModuleNamespace) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_SMI_ARG_CHECKED(module_request, 0);
Handle<Module> module(isolate->context()->module());
return *Module::GetModuleNamespace(module, module_request);
}
RUNTIME_FUNCTION(Runtime_LoadModuleExport) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
Handle<Module> module(isolate->context()->module());
return *Module::LoadExport(module, name);
}
RUNTIME_FUNCTION(Runtime_LoadModuleImport) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_SMI_ARG_CHECKED(module_request, 1);
Handle<Module> module(isolate->context()->module());
return *Module::LoadImport(module, name, module_request);
}
RUNTIME_FUNCTION(Runtime_StoreModuleExport) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
Handle<Module> module(isolate->context()->module());
Module::StoreExport(module, name, value);
return isolate->heap()->undefined_value();
}
} // namespace internal
} // namespace v8
......@@ -1149,6 +1149,7 @@
'runtime/runtime-literals.cc',
'runtime/runtime-liveedit.cc',
'runtime/runtime-maths.cc',
'runtime/runtime-module.cc',
'runtime/runtime-numbers.cc',
'runtime/runtime-object.cc',
'runtime/runtime-operators.cc',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment