aboutsummaryrefslogtreecommitdiff
path: root/src/interpreter/bytecode-generator.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/interpreter/bytecode-generator.h')
-rw-r--r--src/interpreter/bytecode-generator.h50
1 files changed, 29 insertions, 21 deletions
diff --git a/src/interpreter/bytecode-generator.h b/src/interpreter/bytecode-generator.h
index bcab9975..755648eb 100644
--- a/src/interpreter/bytecode-generator.h
+++ b/src/interpreter/bytecode-generator.h
@@ -18,6 +18,7 @@ class CompilationInfo;
namespace interpreter {
+class GlobalDeclarationsBuilder;
class LoopBuilder;
class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
@@ -43,6 +44,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
class ControlScopeForTopLevel;
class ControlScopeForTryCatch;
class ControlScopeForTryFinally;
+ class CurrentScope;
class ExpressionResultScope;
class EffectResultScope;
class GlobalDeclarationsBuilder;
@@ -53,7 +55,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
enum class TestFallthrough { kThen, kElse, kNone };
void GenerateBytecodeBody();
- void AllocateDeferredConstants();
+ void AllocateDeferredConstants(Isolate* isolate);
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
@@ -94,23 +96,22 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void VisitPropertyLoadForRegister(Register obj, Property* expr,
Register destination);
- void BuildVariableLoad(Variable* variable, FeedbackVectorSlot slot,
+ void BuildVariableLoad(Variable* variable, FeedbackSlot slot,
HoleCheckMode hole_check_mode,
TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
void BuildVariableLoadForAccumulatorValue(
- Variable* variable, FeedbackVectorSlot slot,
- HoleCheckMode hole_check_mode,
+ Variable* variable, FeedbackSlot slot, HoleCheckMode hole_check_mode,
TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
void BuildVariableAssignment(Variable* variable, Token::Value op,
- FeedbackVectorSlot slot,
+ FeedbackSlot slot,
HoleCheckMode hole_check_mode);
void BuildReturn();
+ void BuildAsyncReturn();
void BuildReThrow();
void BuildAbort(BailoutReason bailout_reason);
- void BuildThrowIfHole(Handle<String> name);
- void BuildThrowIfNotHole(Handle<String> name);
- void BuildThrowReferenceError(Handle<String> name);
+ void BuildThrowIfHole(const AstRawString* name);
+ void BuildThrowReferenceError(const AstRawString* name);
void BuildHoleCheckForVariableAssignment(Variable* variable, Token::Value op);
// Build jump to targets[value], where
@@ -129,9 +130,9 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void VisitArgumentsObject(Variable* variable);
void VisitRestArgumentsArray(Variable* rest);
void VisitCallSuper(Call* call);
- void VisitClassLiteralForRuntimeDefinition(ClassLiteral* expr);
- void VisitClassLiteralProperties(ClassLiteral* expr, Register literal,
+ void VisitClassLiteralProperties(ClassLiteral* expr, Register constructor,
Register prototype);
+ void BuildClassLiteralNameProperty(ClassLiteral* expr, Register constructor);
void VisitThisFunctionVariable(Variable* variable);
void VisitNewTargetVariable(Variable* variable);
void VisitBlockDeclarationsAndStatements(Block* stmt);
@@ -141,7 +142,7 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
void VisitObjectLiteralAccessor(Register home_object,
ObjectLiteralProperty* property,
Register value_out);
- void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot);
+ void VisitForInAssignment(Expression* expr, FeedbackSlot slot);
void VisitModuleNamespaceImports();
// Visit the header/body of a loop iteration.
@@ -172,9 +173,12 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
inline BytecodeArrayBuilder* builder() const { return builder_; }
inline Zone* zone() const { return zone_; }
- inline DeclarationScope* scope() const { return scope_; }
+ inline DeclarationScope* closure_scope() const { return closure_scope_; }
inline CompilationInfo* info() const { return info_; }
+ inline Scope* current_scope() const { return current_scope_; }
+ inline void set_current_scope(Scope* scope) { current_scope_ = scope; }
+
inline ControlScope* execution_control() const { return execution_control_; }
inline void set_execution_control(ControlScope* scope) {
execution_control_ = scope;
@@ -191,24 +195,29 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
return builder()->register_allocator();
}
- GlobalDeclarationsBuilder* globals_builder() { return globals_builder_; }
+ GlobalDeclarationsBuilder* globals_builder() {
+ DCHECK_NOT_NULL(globals_builder_);
+ return globals_builder_;
+ }
inline LanguageMode language_mode() const;
- int feedback_index(FeedbackVectorSlot slot) const;
+ int feedback_index(FeedbackSlot slot) const;
- Handle<Name> home_object_symbol() const { return home_object_symbol_; }
- Handle<Name> prototype_string() const { return prototype_string_; }
- Handle<FixedArray> empty_fixed_array() const { return empty_fixed_array_; }
+ const AstRawString* prototype_string() const { return prototype_string_; }
+ const AstRawString* undefined_string() const { return undefined_string_; }
Zone* zone_;
BytecodeArrayBuilder* builder_;
CompilationInfo* info_;
- DeclarationScope* scope_;
+ DeclarationScope* closure_scope_;
+ Scope* current_scope_;
GlobalDeclarationsBuilder* globals_builder_;
ZoneVector<GlobalDeclarationsBuilder*> global_declarations_;
ZoneVector<std::pair<FunctionLiteral*, size_t>> function_literals_;
ZoneVector<std::pair<NativeFunctionLiteral*, size_t>>
native_function_literals_;
+ ZoneVector<std::pair<ObjectLiteral*, size_t>> object_literals_;
+ ZoneVector<std::pair<ArrayLiteral*, size_t>> array_literals_;
ControlScope* execution_control_;
ContextScope* execution_context_;
@@ -218,9 +227,8 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
Register generator_state_;
int loop_depth_;
- Handle<Name> home_object_symbol_;
- Handle<Name> prototype_string_;
- Handle<FixedArray> empty_fixed_array_;
+ const AstRawString* prototype_string_;
+ const AstRawString* undefined_string_;
};
} // namespace interpreter