v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
synthetic-module.h
Go to the documentation of this file.
1// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_OBJECTS_SYNTHETIC_MODULE_H_
6#define V8_OBJECTS_SYNTHETIC_MODULE_H_
7
9
10// Has to be the last include (doesn't have include guards):
12
13namespace v8 {
14namespace internal {
15
16#include "torque-generated/src/objects/synthetic-module-tq.inc"
17
18// The runtime representation of a Synthetic Module Record, a module that can be
19// instantiated by an embedder with embedder-defined exports and evaluation
20// steps.
21// https://heycam.github.io/webidl/#synthetic-module-records
23 : public TorqueGeneratedSyntheticModule<SyntheticModule, Module> {
24 public:
27
28 // Set module's exported value for the specified export_name to the specified
29 // export_value. An error will be thrown if export_name is not one
30 // of the export_names that were supplied during module construction.
31 // Returns Just(true) on success, Nothing<bool>() if an error was thrown.
32 static Maybe<bool> SetExport(Isolate* isolate,
34 DirectHandle<String> export_name,
35 DirectHandle<Object> export_value);
36 // The following redundant method should be deleted when the deprecated
37 // version of v8::SetSyntheticModuleExport is removed. It differs from
38 // SetExport in that it crashes rather than throwing an error if the caller
39 // attempts to set an export_name that was not present during construction of
40 // the module.
41 static void SetExportStrict(Isolate* isolate,
43 DirectHandle<String> export_name,
44 DirectHandle<Object> export_value);
45
49
50 private:
51 friend class Module;
52
55 DirectHandle<String> module_specifier, DirectHandle<String> export_name,
56 MessageLocation loc, bool must_resolve);
57
62 Isolate* isolate, DirectHandle<SyntheticModule> module);
63
65 Isolate* isolate, DirectHandle<SyntheticModule> module);
66
68};
69
70} // namespace internal
71} // namespace v8
72
74
75#endif // V8_OBJECTS_SYNTHETIC_MODULE_H_
FixedBodyDescriptor< kExportsOffset, kHeaderSize, kHeaderSize > BodyDescriptor
Definition module.h:79
static void SetExportStrict(Isolate *isolate, DirectHandle< SyntheticModule > module, DirectHandle< String > export_name, DirectHandle< Object > export_value)
static V8_WARN_UNUSED_RESULT bool PrepareInstantiate(Isolate *isolate, DirectHandle< SyntheticModule > module, v8::Local< v8::Context > context)
static V8_WARN_UNUSED_RESULT MaybeHandle< Cell > ResolveExport(Isolate *isolate, DirectHandle< SyntheticModule > module, DirectHandle< String > module_specifier, DirectHandle< String > export_name, MessageLocation loc, bool must_resolve)
static NEVER_READ_ONLY_SPACE Maybe< bool > SetExport(Isolate *isolate, DirectHandle< SyntheticModule > module, DirectHandle< String > export_name, DirectHandle< Object > export_value)
static V8_WARN_UNUSED_RESULT bool FinishInstantiate(Isolate *isolate, DirectHandle< SyntheticModule > module)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Evaluate(Isolate *isolate, DirectHandle< SyntheticModule > module)
#define DECL_VERIFIER(Name)
#define NEVER_READ_ONLY_SPACE
#define TQ_OBJECT_CONSTRUCTORS(Type)
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671