}
-void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- Variable* variable = declaration->proxy()->var();
- ModuleDescriptor* descriptor = declaration->module()->descriptor();
- DCHECK(variable->location() == Variable::CONTEXT);
- DCHECK(descriptor->IsFrozen());
-
- Comment cmnt(masm_, "[ ModuleDeclaration");
- EmitDebugCheckDeclarationContext(variable);
-
- // Load instance object.
- __ LoadContext(r1, scope_->ContextChainLength(scope_->ScriptScope()));
- __ ldr(r1, ContextOperand(r1, descriptor->Index()));
- __ ldr(r1, ContextOperand(r1, Context::EXTENSION_INDEX));
-
- // Assign it.
- __ str(r1, ContextOperand(cp, variable->index()));
- // We know that we have written a module, which is not a smi.
- __ RecordWriteContextSlot(cp,
- Context::SlotOffset(variable->index()),
- r1,
- r3,
- kLRHasBeenSaved,
- kDontSaveFPRegs,
- EMIT_REMEMBERED_SET,
- OMIT_SMI_CHECK);
- PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
-
- // Traverse into body.
- Visit(declaration->module());
-}
-
-
void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
}
-void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- Variable* variable = declaration->proxy()->var();
- ModuleDescriptor* descriptor = declaration->module()->descriptor();
- DCHECK(variable->location() == Variable::CONTEXT);
- DCHECK(descriptor->IsFrozen());
-
- Comment cmnt(masm_, "[ ModuleDeclaration");
- EmitDebugCheckDeclarationContext(variable);
-
- // Load instance object.
- __ LoadContext(x1, scope_->ContextChainLength(scope_->ScriptScope()));
- __ Ldr(x1, ContextMemOperand(x1, descriptor->Index()));
- __ Ldr(x1, ContextMemOperand(x1, Context::EXTENSION_INDEX));
-
- // Assign it.
- __ Str(x1, ContextMemOperand(cp, variable->index()));
- // We know that we have written a module, which is not a smi.
- __ RecordWriteContextSlot(cp,
- Context::SlotOffset(variable->index()),
- x1,
- x3,
- kLRHasBeenSaved,
- kDontSaveFPRegs,
- EMIT_REMEMBERED_SET,
- OMIT_SMI_CHECK);
- PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
-
- // Traverse info body.
- Visit(declaration->module());
-}
-
-
void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
}
-void AstNumberingVisitor::VisitModuleUrl(ModuleUrl* node) {
- IncrementNodeCount();
- DisableOptimization(kModuleUrl);
-}
-
-
void AstNumberingVisitor::VisitEmptyStatement(EmptyStatement* node) {
IncrementNodeCount();
}
}
-void AstNumberingVisitor::VisitModuleDeclaration(ModuleDeclaration* node) {
- IncrementNodeCount();
- DisableOptimization(kModuleDeclaration);
- VisitVariableProxy(node->proxy());
- Visit(node->module());
-}
-
-
void AstNumberingVisitor::VisitImportDeclaration(ImportDeclaration* node) {
IncrementNodeCount();
DisableOptimization(kImportDeclaration);
}
-void AstNumberingVisitor::VisitModulePath(ModulePath* node) {
- IncrementNodeCount();
- DisableOptimization(kModulePath);
- Visit(node->module());
-}
-
-
-void AstNumberingVisitor::VisitModuleStatement(ModuleStatement* node) {
- IncrementNodeCount();
- DisableOptimization(kModuleStatement);
- Visit(node->body());
-}
-
-
void AstNumberingVisitor::VisitExpressionStatement(ExpressionStatement* node) {
IncrementNodeCount();
Visit(node->expression());
}
-void AstNumberingVisitor::VisitModuleLiteral(ModuleLiteral* node) {
- IncrementNodeCount();
- DisableCaching(kModuleLiteral);
- VisitBlock(node->body());
-}
-
-
void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) {
IncrementNodeCount();
ReserveFeedbackSlots(node);
#define DECLARATION_NODE_LIST(V) \
V(VariableDeclaration) \
V(FunctionDeclaration) \
- V(ModuleDeclaration) \
V(ImportDeclaration) \
V(ExportDeclaration)
-#define MODULE_NODE_LIST(V) \
- V(ModuleLiteral) \
- V(ModulePath) \
- V(ModuleUrl)
-
#define STATEMENT_NODE_LIST(V) \
V(Block) \
- V(ModuleStatement) \
V(ExpressionStatement) \
V(EmptyStatement) \
V(IfStatement) \
#define AST_NODE_LIST(V) \
DECLARATION_NODE_LIST(V) \
- MODULE_NODE_LIST(V) \
STATEMENT_NODE_LIST(V) \
EXPRESSION_NODE_LIST(V)
};
-class ModuleDeclaration final : public Declaration {
- public:
- DECLARE_NODE_TYPE(ModuleDeclaration)
-
- Module* module() const { return module_; }
- InitializationFlag initialization() const override {
- return kCreatedInitialized;
- }
-
- protected:
- ModuleDeclaration(Zone* zone, VariableProxy* proxy, Module* module,
- Scope* scope, int pos)
- : Declaration(zone, proxy, CONST, scope, pos), module_(module) {}
-
- private:
- Module* module_;
-};
-
-
class ImportDeclaration final : public Declaration {
public:
DECLARE_NODE_TYPE(ImportDeclaration)
};
-class ModuleLiteral final : public Module {
- public:
- DECLARE_NODE_TYPE(ModuleLiteral)
-
- protected:
- ModuleLiteral(Zone* zone, Block* body, ModuleDescriptor* descriptor, int pos)
- : Module(zone, descriptor, pos, body) {}
-};
-
-
-class ModulePath final : public Module {
- public:
- DECLARE_NODE_TYPE(ModulePath)
-
- Module* module() const { return module_; }
- Handle<String> name() const { return name_->string(); }
-
- protected:
- ModulePath(Zone* zone, Module* module, const AstRawString* name, int pos)
- : Module(zone, pos), module_(module), name_(name) {}
-
- private:
- Module* module_;
- const AstRawString* name_;
-};
-
-
-class ModuleUrl final : public Module {
- public:
- DECLARE_NODE_TYPE(ModuleUrl)
-
- Handle<String> url() const { return url_; }
-
- protected:
- ModuleUrl(Zone* zone, Handle<String> url, int pos)
- : Module(zone, pos), url_(url) {
- }
-
- private:
- Handle<String> url_;
-};
-
-
-class ModuleStatement final : public Statement {
- public:
- DECLARE_NODE_TYPE(ModuleStatement)
-
- Block* body() const { return body_; }
-
- protected:
- ModuleStatement(Zone* zone, Block* body, int pos)
- : Statement(zone, pos), body_(body) {}
-
- private:
- Block* body_;
-};
-
-
class IterationStatement : public BreakableStatement {
public:
// Type testing & conversion.
return new (zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos);
}
- ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy,
- Module* module,
- Scope* scope,
- int pos) {
- return new (zone_) ModuleDeclaration(zone_, proxy, module, scope, pos);
- }
-
ImportDeclaration* NewImportDeclaration(VariableProxy* proxy,
const AstRawString* import_name,
const AstRawString* module_specifier,
return new (zone_) ExportDeclaration(zone_, proxy, scope, pos);
}
- ModuleLiteral* NewModuleLiteral(Block* body, ModuleDescriptor* descriptor,
- int pos) {
- return new (zone_) ModuleLiteral(zone_, body, descriptor, pos);
- }
-
- ModulePath* NewModulePath(Module* origin, const AstRawString* name, int pos) {
- return new (zone_) ModulePath(zone_, origin, name, pos);
- }
-
- ModuleUrl* NewModuleUrl(Handle<String> url, int pos) {
- return new (zone_) ModuleUrl(zone_, url, pos);
- }
-
Block* NewBlock(ZoneList<const AstRawString*>* labels,
int capacity,
bool is_initializer_block,
return NULL;
}
- ModuleStatement* NewModuleStatement(Block* body, int pos) {
- return new (zone_) ModuleStatement(zone_, body, pos);
- }
-
ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) {
return new (zone_) ExpressionStatement(zone_, expression, pos);
}
V(kMapBecameDeprecated, "Map became deprecated") \
V(kMapBecameUnstable, "Map became unstable") \
V(kMapIsNoLongerInEax, "Map is no longer in eax") \
- V(kModuleDeclaration, "Module declaration") \
- V(kModuleLiteral, "Module literal") \
- V(kModulePath, "Module path") \
- V(kModuleStatement, "Module statement") \
- V(kModuleVariable, "Module variable") \
- V(kModuleUrl, "Module url") \
V(kNativeFunctionLiteral, "Native function literal") \
V(kNeedSmiLiteral, "Need a Smi literal here") \
V(kNoCasesLeft, "No cases left") \
void Visit##type(type* node) override { \
HOptimizedGraphBuilder::Visit##type(node); \
}
- MODULE_NODE_LIST(DEF_VISIT)
DECLARATION_NODE_LIST(DEF_VISIT)
#undef DEF_VISIT
};
}
-void AstGraphBuilder::VisitModuleDeclaration(ModuleDeclaration* decl) {
- UNREACHABLE();
-}
-
-
void AstGraphBuilder::VisitImportDeclaration(ImportDeclaration* decl) {
UNREACHABLE();
}
}
-void AstGraphBuilder::VisitModuleLiteral(ModuleLiteral* modl) { UNREACHABLE(); }
-
-
-void AstGraphBuilder::VisitModulePath(ModulePath* modl) { UNREACHABLE(); }
-
-
-void AstGraphBuilder::VisitModuleUrl(ModuleUrl* modl) { UNREACHABLE(); }
-
-
void AstGraphBuilder::VisitBlock(Block* stmt) {
BlockBuilder block(this);
ControlScopeForBreakable scope(this, stmt, &block);
}
-void AstGraphBuilder::VisitModuleStatement(ModuleStatement* stmt) {
- UNREACHABLE();
-}
-
-
void AstGraphBuilder::VisitExpressionStatement(ExpressionStatement* stmt) {
VisitForEffect(stmt->expression());
}
void ALAA::VisitVariableDeclaration(VariableDeclaration* leaf) {}
void ALAA::VisitFunctionDeclaration(FunctionDeclaration* leaf) {}
-void ALAA::VisitModuleDeclaration(ModuleDeclaration* leaf) {}
void ALAA::VisitImportDeclaration(ImportDeclaration* leaf) {}
void ALAA::VisitExportDeclaration(ExportDeclaration* leaf) {}
-void ALAA::VisitModulePath(ModulePath* leaf) {}
-void ALAA::VisitModuleUrl(ModuleUrl* leaf) {}
void ALAA::VisitEmptyStatement(EmptyStatement* leaf) {}
void ALAA::VisitContinueStatement(ContinueStatement* leaf) {}
void ALAA::VisitBreakStatement(BreakStatement* leaf) {}
// ---------------------------------------------------------------------------
// -- Pass-through nodes------------------------------------------------------
// ---------------------------------------------------------------------------
-void ALAA::VisitModuleLiteral(ModuleLiteral* e) { Visit(e->body()); }
-
-
void ALAA::VisitBlock(Block* stmt) { VisitStatements(stmt->statements()); }
// ---------------------------------------------------------------------------
// -- Interesting nodes-------------------------------------------------------
// ---------------------------------------------------------------------------
-void ALAA::VisitModuleStatement(ModuleStatement* stmt) {
- // TODO(turbofan): can a module appear in a loop?
- Visit(stmt->body());
-}
-
-
void ALAA::VisitTryCatchStatement(TryCatchStatement* stmt) {
Visit(stmt->try_block());
Visit(stmt->catch_block());
}
-void BreakableStatementChecker::VisitModuleDeclaration(
- ModuleDeclaration* decl) {
-}
-
-
void BreakableStatementChecker::VisitImportDeclaration(
ImportDeclaration* decl) {
}
}
-void BreakableStatementChecker::VisitModuleLiteral(ModuleLiteral* module) {
-}
-
-
-void BreakableStatementChecker::VisitModulePath(ModulePath* module) {
-}
-
-
-void BreakableStatementChecker::VisitModuleUrl(ModuleUrl* module) {
-}
-
-
-void BreakableStatementChecker::VisitModuleStatement(ModuleStatement* stmt) {
-}
-
-
void BreakableStatementChecker::VisitBlock(Block* stmt) {
}
}
-void FullCodeGenerator::AllocateModules(ZoneList<Declaration*>* declarations) {
- DCHECK(scope_->is_script_scope());
-
- for (int i = 0; i < declarations->length(); i++) {
- ModuleDeclaration* declaration = declarations->at(i)->AsModuleDeclaration();
- if (declaration != NULL) {
- ModuleLiteral* module = declaration->module()->AsModuleLiteral();
- if (module != NULL) {
- Comment cmnt(masm_, "[ Link nested modules");
- Scope* scope = module->body()->scope();
- DCHECK(scope->module()->IsFrozen());
-
- scope->module()->Allocate(scope->module_var()->index());
-
- // Set up module context.
- DCHECK(scope->module()->Index() >= 0);
- __ Push(Smi::FromInt(scope->module()->Index()));
- __ Push(scope->GetScopeInfo(isolate()));
- __ CallRuntime(Runtime::kPushModuleContext, 2);
- StoreToFrameField(StandardFrameConstants::kContextOffset,
- context_register());
-
- AllocateModules(scope->declarations());
-
- // Pop module context.
- LoadContextField(context_register(), Context::PREVIOUS_INDEX);
- // Update local stack frame context field.
- StoreToFrameField(StandardFrameConstants::kContextOffset,
- context_register());
- }
- }
- }
-}
-
-
-// Modules have their own local scope, represented by their own context.
-// Module instance objects have an accessor for every export that forwards
-// access to the respective slot from the module's context. (Exports that are
-// modules themselves, however, are simple data properties.)
-//
-// All modules have a _hosting_ scope/context, which (currently) is the
-// enclosing script scope. To deal with recursion, nested modules are hosted
-// by the same scope as global ones.
-//
-// For every (global or nested) module literal, the hosting context has an
-// internal slot that points directly to the respective module context. This
-// enables quick access to (statically resolved) module members by 2-dimensional
-// access through the hosting context. For example,
-//
-// module A {
-// let x;
-// module B { let y; }
-// }
-// module C { let z; }
-//
-// allocates contexts as follows:
-//
-// [header| .A | .B | .C | A | C ] (global)
-// | | |
-// | | +-- [header| z ] (module)
-// | |
-// | +------- [header| y ] (module)
-// |
-// +------------ [header| x | B ] (module)
-//
-// Here, .A, .B, .C are the internal slots pointing to the hosted module
-// contexts, whereas A, B, C hold the actual instance objects (note that every
-// module context also points to the respective instance object through its
-// extension slot in the header).
-//
-// To deal with arbitrary recursion and aliases between modules,
-// they are created and initialized in several stages. Each stage applies to
-// all modules in the hosting script scope, including nested ones.
-//
-// 1. Allocate: for each module _literal_, allocate the module contexts and
-// respective instance object and wire them up. This happens in the
-// PushModuleContext runtime function, as generated by AllocateModules
-// (invoked by VisitDeclarations in the hosting scope).
-//
-// 2. Bind: for each module _declaration_ (i.e. literals as well as aliases),
-// assign the respective instance object to respective local variables. This
-// happens in VisitModuleDeclaration, and uses the instance objects created
-// in the previous stage.
-// For each module _literal_, this phase also constructs a module descriptor
-// for the next stage. This happens in VisitModuleLiteral.
-//
-// 3. Populate: invoke the DeclareModules runtime function to populate each
-// _instance_ object with accessors for it exports. This is generated by
-// DeclareModules (invoked by VisitDeclarations in the hosting scope again),
-// and uses the descriptors generated in the previous stage.
-//
-// 4. Initialize: execute the module bodies (and other code) in sequence. This
-// happens by the separate statements generated for module bodies. To reenter
-// the module scopes properly, the parser inserted ModuleStatements.
-
void FullCodeGenerator::VisitDeclarations(
ZoneList<Declaration*>* declarations) {
- Handle<FixedArray> saved_modules = modules_;
- int saved_module_index = module_index_;
ZoneList<Handle<Object> >* saved_globals = globals_;
ZoneList<Handle<Object> > inner_globals(10, zone());
globals_ = &inner_globals;
- if (scope_->num_modules() != 0) {
- // This is a scope hosting modules. Allocate a descriptor array to pass
- // to the runtime for initialization.
- Comment cmnt(masm_, "[ Allocate modules");
- DCHECK(scope_->is_script_scope());
- modules_ =
- isolate()->factory()->NewFixedArray(scope_->num_modules(), TENURED);
- module_index_ = 0;
-
- // Generate code for allocating all modules, including nested ones.
- // The allocated contexts are stored in internal variables in this scope.
- AllocateModules(declarations);
- }
-
AstVisitor::VisitDeclarations(declarations);
- if (scope_->num_modules() != 0) {
- // TODO(ES6): This step, which creates module instance objects,
- // can probably be delayed until an "import *" declaration
- // reifies a module instance. Until imports are implemented,
- // we skip it altogether.
- //
- // Initialize modules from descriptor array.
- // DCHECK(module_index_ == modules_->length());
- // DeclareModules(modules_);
- modules_ = saved_modules;
- module_index_ = saved_module_index;
- }
-
if (!globals_->is_empty()) {
// Invoke the platform-dependent code generator to do the actual
// declaration of the global functions and variables.
}
-void FullCodeGenerator::VisitModuleLiteral(ModuleLiteral* module) {
- Block* block = module->body();
- Scope* saved_scope = scope();
- scope_ = block->scope();
- ModuleDescriptor* descriptor = scope_->module();
-
- Comment cmnt(masm_, "[ ModuleLiteral");
- SetStatementPosition(block);
-
- DCHECK(!modules_.is_null());
- DCHECK(module_index_ < modules_->length());
- int index = module_index_++;
-
- // Set up module context.
- DCHECK(descriptor->Index() >= 0);
- __ Push(Smi::FromInt(descriptor->Index()));
- __ Push(Smi::FromInt(0));
- __ CallRuntime(Runtime::kPushModuleContext, 2);
- StoreToFrameField(StandardFrameConstants::kContextOffset, context_register());
-
- {
- Comment cmnt(masm_, "[ Declarations");
- VisitDeclarations(scope_->declarations());
- }
-
- // Populate the module description.
- Handle<ModuleInfo> description =
- ModuleInfo::Create(isolate(), descriptor, scope_);
- modules_->set(index, *description);
-
- scope_ = saved_scope;
- // Pop module context.
- LoadContextField(context_register(), Context::PREVIOUS_INDEX);
- // Update local stack frame context field.
- StoreToFrameField(StandardFrameConstants::kContextOffset, context_register());
-}
-
-
-// TODO(adamk): Delete ModulePath.
-void FullCodeGenerator::VisitModulePath(ModulePath* module) {
-}
-
-
-// TODO(adamk): Delete ModuleUrl.
-void FullCodeGenerator::VisitModuleUrl(ModuleUrl* module) {
-}
-
-
int FullCodeGenerator::DeclareGlobalsFlags() {
DCHECK(DeclareGlobalsLanguageMode::is_valid(language_mode()));
return DeclareGlobalsEvalFlag::encode(is_eval()) |
}
-void FullCodeGenerator::VisitModuleStatement(ModuleStatement* stmt) {
- Comment cmnt(masm_, "[ Module context");
-
- DCHECK(stmt->body()->scope()->is_module_scope());
-
- __ Push(Smi::FromInt(stmt->body()->scope()->module()->Index()));
- __ Push(Smi::FromInt(0));
- __ CallRuntime(Runtime::kPushModuleContext, 2);
- StoreToFrameField(
- StandardFrameConstants::kContextOffset, context_register());
-
- Scope* saved_scope = scope_;
- scope_ = stmt->body()->scope();
- VisitStatements(stmt->body()->statements());
- scope_ = saved_scope;
- LoadContextField(context_register(), Context::PREVIOUS_INDEX);
- // Update local stack frame context field.
- StoreToFrameField(StandardFrameConstants::kContextOffset,
- context_register());
-}
-
-
void FullCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) {
Comment cmnt(masm_, "[ ExpressionStatement");
SetStatementPosition(stmt);
void DeclareGlobals(Handle<FixedArray> pairs);
int DeclareGlobalsFlags();
- // Generate code to allocate all (including nested) modules and contexts.
- // Because of recursive linking and the presence of module alias declarations,
- // this has to be a separate pass _before_ populating or executing any module.
- void AllocateModules(ZoneList<Declaration*>* declarations);
-
// Generate code to create an iterator result object. The "value" property is
// set to a value popped from the stack, and "done" is set according to the
// argument. The result object is left in the result register.
}
-void HOptimizedGraphBuilder::VisitModuleDeclaration(
- ModuleDeclaration* declaration) {
- return Bailout(kModuleDeclaration);
-}
-
-
void HOptimizedGraphBuilder::VisitImportDeclaration(
ImportDeclaration* declaration) {
UNREACHABLE();
}
-void HOptimizedGraphBuilder::VisitModuleLiteral(ModuleLiteral* module) {
- UNREACHABLE();
-}
-
-
-void HOptimizedGraphBuilder::VisitModulePath(ModulePath* module) {
- UNREACHABLE();
-}
-
-
-void HOptimizedGraphBuilder::VisitModuleUrl(ModuleUrl* module) {
- UNREACHABLE();
-}
-
-
-void HOptimizedGraphBuilder::VisitModuleStatement(ModuleStatement* stmt) {
- UNREACHABLE();
-}
-
-
// Generators for inline runtime functions.
// Support for types.
void HOptimizedGraphBuilder::GenerateIsSmi(CallRuntime* call) {
}
-void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- Variable* variable = declaration->proxy()->var();
- ModuleDescriptor* descriptor = declaration->module()->descriptor();
- DCHECK(variable->location() == Variable::CONTEXT);
- DCHECK(descriptor->IsFrozen());
-
- Comment cmnt(masm_, "[ ModuleDeclaration");
- EmitDebugCheckDeclarationContext(variable);
-
- // Load instance object.
- __ LoadContext(eax, scope_->ContextChainLength(scope_->ScriptScope()));
- __ mov(eax, ContextOperand(eax, descriptor->Index()));
- __ mov(eax, ContextOperand(eax, Context::EXTENSION_INDEX));
-
- // Assign it.
- __ mov(ContextOperand(esi, variable->index()), eax);
- // We know that we have written a module, which is not a smi.
- __ RecordWriteContextSlot(esi,
- Context::SlotOffset(variable->index()),
- eax,
- ecx,
- kDontSaveFPRegs,
- EMIT_REMEMBERED_SET,
- OMIT_SMI_CHECK);
- PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
-
- // Traverse into body.
- Visit(declaration->module());
-}
-
-
void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
}
-void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- Variable* variable = declaration->proxy()->var();
- ModuleDescriptor* descriptor = declaration->module()->descriptor();
- DCHECK(variable->location() == Variable::CONTEXT);
- DCHECK(descriptor->IsFrozen());
-
- Comment cmnt(masm_, "[ ModuleDeclaration");
- EmitDebugCheckDeclarationContext(variable);
-
- // Load instance object.
- __ LoadContext(a1, scope_->ContextChainLength(scope_->ScriptScope()));
- __ lw(a1, ContextOperand(a1, descriptor->Index()));
- __ lw(a1, ContextOperand(a1, Context::EXTENSION_INDEX));
-
- // Assign it.
- __ sw(a1, ContextOperand(cp, variable->index()));
- // We know that we have written a module, which is not a smi.
- __ RecordWriteContextSlot(cp,
- Context::SlotOffset(variable->index()),
- a1,
- a3,
- kRAHasBeenSaved,
- kDontSaveFPRegs,
- EMIT_REMEMBERED_SET,
- OMIT_SMI_CHECK);
- PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
-
- // Traverse into body.
- Visit(declaration->module());
-}
-
-
void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
}
-void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- Variable* variable = declaration->proxy()->var();
- ModuleDescriptor* descriptor = declaration->module()->descriptor();
- DCHECK(variable->location() == Variable::CONTEXT);
- DCHECK(descriptor->IsFrozen());
- Comment cmnt(masm_, "[ ModuleDeclaration");
- EmitDebugCheckDeclarationContext(variable);
-
- // Load instance object.
- __ LoadContext(a1, scope_->ContextChainLength(scope_->ScriptScope()));
- __ ld(a1, ContextOperand(a1, descriptor->Index()));
- __ ld(a1, ContextOperand(a1, Context::EXTENSION_INDEX));
-
- // Assign it.
- __ sd(a1, ContextOperand(cp, variable->index()));
- // We know that we have written a module, which is not a smi.
- __ RecordWriteContextSlot(cp,
- Context::SlotOffset(variable->index()),
- a1,
- a3,
- kRAHasBeenSaved,
- kDontSaveFPRegs,
- EMIT_REMEMBERED_SET,
- OMIT_SMI_CHECK);
- PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
-
- // Traverse into body.
- Visit(declaration->module());
-}
-
-
void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
}
-void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- Variable* variable = declaration->proxy()->var();
- ModuleDescriptor* descriptor = declaration->module()->descriptor();
- DCHECK(variable->location() == Variable::CONTEXT);
- DCHECK(descriptor->IsFrozen());
-
- Comment cmnt(masm_, "[ ModuleDeclaration");
- EmitDebugCheckDeclarationContext(variable);
-
- // Load instance object.
- __ LoadContext(r4, scope_->ContextChainLength(scope_->ScriptScope()));
- __ LoadP(r4, ContextOperand(r4, descriptor->Index()));
- __ LoadP(r4, ContextOperand(r4, Context::EXTENSION_INDEX));
-
- // Assign it.
- __ StoreP(r4, ContextOperand(cp, variable->index()), r0);
- // We know that we have written a module, which is not a smi.
- __ RecordWriteContextSlot(cp, Context::SlotOffset(variable->index()), r4, r6,
- kLRHasBeenSaved, kDontSaveFPRegs,
- EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
- PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
-
- // Traverse into body.
- Visit(declaration->module());
-}
-
-
void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
void CallPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {}
-void CallPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
- Find(node->module());
-}
-
-
void CallPrinter::VisitImportDeclaration(ImportDeclaration* node) {
}
void CallPrinter::VisitExportDeclaration(ExportDeclaration* node) {}
-void CallPrinter::VisitModuleLiteral(ModuleLiteral* node) {
- VisitBlock(node->body());
-}
-
-
-void CallPrinter::VisitModulePath(ModulePath* node) { Find(node->module()); }
-
-
-void CallPrinter::VisitModuleUrl(ModuleUrl* node) {}
-
-
-void CallPrinter::VisitModuleStatement(ModuleStatement* node) {
- Find(node->body());
-}
-
-
void CallPrinter::VisitExpressionStatement(ExpressionStatement* node) {
Find(node->expression());
}
}
-void PrettyPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
- Print("module ");
- PrintLiteral(node->proxy()->name(), false);
- Print(" = ");
- Visit(node->module());
- Print(";");
-}
-
-
void PrettyPrinter::VisitImportDeclaration(ImportDeclaration* node) {
Print("import ");
PrintLiteral(node->proxy()->name(), false);
}
-void PrettyPrinter::VisitModuleLiteral(ModuleLiteral* node) {
- VisitBlock(node->body());
-}
-
-
-void PrettyPrinter::VisitModulePath(ModulePath* node) {
- Visit(node->module());
- Print(".");
- PrintLiteral(node->name(), false);
-}
-
-
-void PrettyPrinter::VisitModuleUrl(ModuleUrl* node) {
- Print("at ");
- PrintLiteral(node->url(), true);
-}
-
-
-void PrettyPrinter::VisitModuleStatement(ModuleStatement* node) {
- Print("module ");
- Visit(node->body());
-}
-
-
void PrettyPrinter::VisitExpressionStatement(ExpressionStatement* node) {
Visit(node->expression());
Print(";");
}
-void AstPrinter::VisitModuleDeclaration(ModuleDeclaration* node) {
- IndentedScope indent(this, "MODULE");
- PrintLiteralIndented("NAME", node->proxy()->name(), true);
- Visit(node->module());
-}
-
-
void AstPrinter::VisitImportDeclaration(ImportDeclaration* node) {
IndentedScope indent(this, "IMPORT");
PrintLiteralIndented("NAME", node->proxy()->name(), true);
}
-void AstPrinter::VisitModuleLiteral(ModuleLiteral* node) {
- IndentedScope indent(this, "MODULE LITERAL");
- VisitBlock(node->body());
-}
-
-
-void AstPrinter::VisitModulePath(ModulePath* node) {
- IndentedScope indent(this, "MODULE PATH");
- PrintIndentedVisit("MODULE PATH PARENT", node->module());
- PrintLiteralIndented("NAME", node->name(), true);
-}
-
-
-void AstPrinter::VisitModuleUrl(ModuleUrl* node) {
- PrintLiteralIndented("URL", node->url(), true);
-}
-
-
-void AstPrinter::VisitModuleStatement(ModuleStatement* node) {
- IndentedScope indent(this, "MODULE STATEMENT");
- PrintStatements(node->body()->statements());
-}
-
-
void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) {
IndentedScope indent(this, "EXPRESSION STATEMENT");
Visit(node->expression());
}
-void Processor::VisitModuleStatement(ModuleStatement* node) {
- bool set_after_body = is_set_;
- Visit(node->body());
- is_set_ = is_set_ && set_after_body;
-}
-
-
void Processor::VisitExpressionStatement(ExpressionStatement* node) {
// Rewrite : <x>; -> .result = <x>;
if (!is_set_ && !node->expression()->IsThrow()) {
// Do nothing:
void Processor::VisitVariableDeclaration(VariableDeclaration* node) {}
void Processor::VisitFunctionDeclaration(FunctionDeclaration* node) {}
-void Processor::VisitModuleDeclaration(ModuleDeclaration* node) {}
void Processor::VisitImportDeclaration(ImportDeclaration* node) {}
void Processor::VisitExportDeclaration(ExportDeclaration* node) {}
-void Processor::VisitModuleLiteral(ModuleLiteral* node) {}
-void Processor::VisitModulePath(ModulePath* node) {}
-void Processor::VisitModuleUrl(ModuleUrl* node) {}
void Processor::VisitEmptyStatement(EmptyStatement* node) {}
void Processor::VisitReturnStatement(ReturnStatement* node) {}
void Processor::VisitDebuggerStatement(DebuggerStatement* node) {}
}
-void AstTyper::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- RECURSE(Visit(declaration->module()));
-}
-
-
void AstTyper::VisitImportDeclaration(ImportDeclaration* declaration) {
}
}
-void AstTyper::VisitModuleLiteral(ModuleLiteral* module) {
- RECURSE(Visit(module->body()));
-}
-
-
-void AstTyper::VisitModulePath(ModulePath* module) {
- RECURSE(Visit(module->module()));
-}
-
-
-void AstTyper::VisitModuleUrl(ModuleUrl* module) {
-}
-
-
-void AstTyper::VisitModuleStatement(ModuleStatement* stmt) {
- RECURSE(Visit(stmt->body()));
-}
-
-
} } // namespace v8::internal
}
-void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- Variable* variable = declaration->proxy()->var();
- ModuleDescriptor* descriptor = declaration->module()->descriptor();
- DCHECK(variable->location() == Variable::CONTEXT);
- DCHECK(descriptor->IsFrozen());
-
- Comment cmnt(masm_, "[ ModuleDeclaration");
- EmitDebugCheckDeclarationContext(variable);
-
- // Load instance object.
- __ LoadContext(rax, scope_->ContextChainLength(scope_->ScriptScope()));
- __ movp(rax, ContextOperand(rax, descriptor->Index()));
- __ movp(rax, ContextOperand(rax, Context::EXTENSION_INDEX));
-
- // Assign it.
- __ movp(ContextOperand(rsi, variable->index()), rax);
- // We know that we have written a module, which is not a smi.
- __ RecordWriteContextSlot(rsi,
- Context::SlotOffset(variable->index()),
- rax,
- rcx,
- kDontSaveFPRegs,
- EMIT_REMEMBERED_SET,
- OMIT_SMI_CHECK);
- PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
-
- // Traverse into body.
- Visit(declaration->module());
-}
-
-
void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
}
-void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
- Variable* variable = declaration->proxy()->var();
- ModuleDescriptor* descriptor = declaration->module()->descriptor();
- DCHECK(variable->location() == Variable::CONTEXT);
- DCHECK(descriptor->IsFrozen());
-
- Comment cmnt(masm_, "[ ModuleDeclaration");
- EmitDebugCheckDeclarationContext(variable);
-
- // Load instance object.
- __ LoadContext(eax, scope_->ContextChainLength(scope_->ScriptScope()));
- __ mov(eax, ContextOperand(eax, descriptor->Index()));
- __ mov(eax, ContextOperand(eax, Context::EXTENSION_INDEX));
-
- // Assign it.
- __ mov(ContextOperand(esi, variable->index()), eax);
- // We know that we have written a module, which is not a smi.
- __ RecordWriteContextSlot(esi, Context::SlotOffset(variable->index()), eax,
- ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
- OMIT_SMI_CHECK);
- PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
-
- // Traverse into body.
- Visit(declaration->module());
-}
-
-
void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();