1014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch// Copyright 2015 the V8 project authors. All rights reserved.
2014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
3014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch// found in the LICENSE file.
4014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
5014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#ifndef V8_INTERPRETER_BYTECODE_GENERATOR_H_
6014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define V8_INTERPRETER_BYTECODE_GENERATOR_H_
7014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
8014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#include "src/ast/ast.h"
9014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#include "src/interpreter/bytecode-array-builder.h"
1021efce637eb329c94f1323b6a2334a1c977e1a9dBen Murdoch#include "src/interpreter/bytecode-label.h"
11014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#include "src/interpreter/bytecodes.h"
12014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
13014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochnamespace v8 {
14014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochnamespace internal {
15537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch
16537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdochclass CompilationInfo;
17537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch
18014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochnamespace interpreter {
19014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
20342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdochclass LoopBuilder;
21342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
22014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochclass BytecodeGenerator final : public AstVisitor {
23014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch public:
24537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  explicit BytecodeGenerator(CompilationInfo* info);
25014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
26537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  Handle<BytecodeArray> MakeBytecode();
27014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
28014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define DECLARE_VISIT(type) void Visit##type(type* node) override;
29014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  AST_NODE_LIST(DECLARE_VISIT)
30014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#undef DECLARE_VISIT
31014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
32014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  // Visiting function for declarations list and statements are overridden.
33014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitDeclarations(ZoneList<Declaration*>* declarations) override;
34014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitStatements(ZoneList<Statement*>* statments) override;
35014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
36014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch private:
37014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class ContextScope;
38014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class ControlScope;
39014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class ControlScopeForBreakable;
40014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class ControlScopeForIteration;
41342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  class ControlScopeForTopLevel;
42342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  class ControlScopeForTryCatch;
43342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  class ControlScopeForTryFinally;
44014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class ExpressionResultScope;
45014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class EffectResultScope;
46014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class AccumulatorResultScope;
47014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class RegisterResultScope;
48014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  class RegisterAllocationScope;
49014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
50014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void MakeBytecodeBody();
51014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
52014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
53014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
54014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  // Dispatched from VisitBinaryOperation.
55014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitArithmeticExpression(BinaryOperation* binop);
56014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitCommaExpression(BinaryOperation* binop);
57014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitLogicalOrExpression(BinaryOperation* binop);
58014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitLogicalAndExpression(BinaryOperation* binop);
59014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
60014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  // Dispatched from VisitUnaryOperation.
61014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitVoid(UnaryOperation* expr);
62014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitTypeOf(UnaryOperation* expr);
63014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitNot(UnaryOperation* expr);
64014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitDelete(UnaryOperation* expr);
65014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
66014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  // Used by flow control routines to evaluate loop condition.
67014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitCondition(Expression* expr);
68014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
69014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  // Helper visitors which perform common operations.
70014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  Register VisitArguments(ZoneList<Expression*>* arguments);
71014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
72342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // Visit a keyed super property load. The optional
73342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // |opt_receiver_out| register will have the receiver stored to it
74342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // if it's a valid register. The loaded value is placed in the
75342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // accumulator.
76342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitKeyedSuperPropertyLoad(Property* property,
77342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch                                   Register opt_receiver_out);
78342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
79342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // Visit a named super property load. The optional
80342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // |opt_receiver_out| register will have the receiver stored to it
81342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // if it's a valid register. The loaded value is placed in the
82342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // accumulator.
83342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitNamedSuperPropertyLoad(Property* property,
84342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch                                   Register opt_receiver_out);
85342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
86014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitPropertyLoad(Register obj, Property* expr);
87014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitPropertyLoadForAccumulator(Register obj, Property* expr);
88014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
89014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot,
90014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch                         TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
91014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitVariableLoadForAccumulatorValue(
92014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch      Variable* variable, FeedbackVectorSlot slot,
93014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch      TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
94014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  MUST_USE_RESULT Register
95014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  VisitVariableLoadForRegisterValue(Variable* variable, FeedbackVectorSlot slot,
96014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch                                    TypeofMode typeof_mode = NOT_INSIDE_TYPEOF);
97342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitVariableAssignment(Variable* variable, Token::Value op,
98342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch                               FeedbackVectorSlot slot);
99342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
100342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildNamedSuperPropertyStore(Register receiver, Register home_object,
101342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch                                    Register name, Register value);
102342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildKeyedSuperPropertyStore(Register receiver, Register home_object,
103342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch                                    Register key, Register value);
104342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildNamedSuperPropertyLoad(Register receiver, Register home_object,
105342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch                                   Register name);
106342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildKeyedSuperPropertyLoad(Register receiver, Register home_object,
107342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch                                   Register key);
108342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
10921efce637eb329c94f1323b6a2334a1c977e1a9dBen Murdoch  void BuildAbort(BailoutReason bailout_reason);
110342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildThrowIfHole(Handle<String> name);
111342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildThrowIfNotHole(Handle<String> name);
112342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildThrowReassignConstant(Handle<String> name);
113342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildThrowReferenceError(Handle<String> name);
114342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildHoleCheckForVariableLoad(VariableMode mode, Handle<String> name);
115342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void BuildHoleCheckForVariableAssignment(Variable* variable, Token::Value op);
116014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
117537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  // Build jump to targets[value], where
118537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  // start_index <= value < start_index + size.
119537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  void BuildIndexedJump(Register value, size_t start_index, size_t size,
120537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch                        ZoneVector<BytecodeLabel>& targets);
121537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch
122537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  void VisitGeneratorPrologue();
123537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch
124014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitArgumentsObject(Variable* variable);
125342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitRestArgumentsArray(Variable* rest);
126342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitCallSuper(Call* call);
127342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitClassLiteralContents(ClassLiteral* expr);
128342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitClassLiteralForRuntimeDefinition(ClassLiteral* expr);
129342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitClassLiteralProperties(ClassLiteral* expr, Register literal,
130342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch                                   Register prototype);
131342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitClassLiteralStaticPrototypeWithComputedName(Register name);
132014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitThisFunctionVariable(Variable* variable);
133014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitNewTargetVariable(Variable* variable);
134014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitNewLocalFunctionContext();
135014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitBuildLocalActivationContext();
136342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitBlockDeclarationsAndStatements(Block* stmt);
137014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitNewLocalBlockContext(Scope* scope);
138342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitNewLocalCatchContext(Variable* variable);
139342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitNewLocalWithContext();
140014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitFunctionClosureForContext();
141014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitSetHomeObject(Register value, Register home_object,
142014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch                          ObjectLiteralProperty* property, int slot_number = 0);
143014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitObjectLiteralAccessor(Register home_object,
144014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch                                  ObjectLiteralProperty* property,
145014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch                                  Register value_out);
146014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void VisitForInAssignment(Expression* expr, FeedbackVectorSlot slot);
147014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
148537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  // Visit the header/body of a loop iteration.
149537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  void VisitIterationHeader(IterationStatement* stmt,
150537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch                            LoopBuilder* loop_builder);
151342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitIterationBody(IterationStatement* stmt, LoopBuilder* loop_builder);
152342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
153342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // Visit a statement and switch scopes, the context is in the accumulator.
154342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitInScope(Statement* stmt, Scope* scope);
155342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
156014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  // Visitors for obtaining expression result in the accumulator, in a
157014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  // register, or just getting the effect.
158342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitForAccumulatorValue(Expression* expr);
159342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitForAccumulatorValueOrTheHole(Expression* expr);
160342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  MUST_USE_RESULT Register VisitForRegisterValue(Expression* expr);
161342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitForRegisterValue(Expression* expr, Register destination);
162342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void VisitForEffect(Expression* expr);
163014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
164014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  // Methods for tracking and remapping register.
165014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  void RecordStoreToRegister(Register reg);
166014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  Register LoadFromAliasedRegister(Register reg);
167014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
168342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // Methods for tracking try-block nesting.
169342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  bool IsInsideTryCatch() const { return try_catch_nesting_level_ > 0; }
170342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  bool IsInsideTryFinally() const { return try_finally_nesting_level_ > 0; }
171342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
172342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  // Initialize an array of temporary registers with consecutive registers.
173342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  template <size_t N>
174342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  void InitializeWithConsecutiveRegisters(Register (&registers)[N]);
175342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch
176342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  inline BytecodeArrayBuilder* builder() const { return builder_; }
177014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline Isolate* isolate() const { return isolate_; }
178014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline Zone* zone() const { return zone_; }
179014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline Scope* scope() const { return scope_; }
180014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline CompilationInfo* info() const { return info_; }
181014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
182014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline ControlScope* execution_control() const { return execution_control_; }
183014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline void set_execution_control(ControlScope* scope) {
184014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch    execution_control_ = scope;
185014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  }
186014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline ContextScope* execution_context() const { return execution_context_; }
187014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline void set_execution_context(ContextScope* context) {
188014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch    execution_context_ = context;
189014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  }
190014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline void set_execution_result(ExpressionResultScope* execution_result) {
191014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch    execution_result_ = execution_result;
192014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  }
193014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  ExpressionResultScope* execution_result() const { return execution_result_; }
194014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline void set_register_allocator(
195014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch      RegisterAllocationScope* register_allocator) {
196014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch    register_allocator_ = register_allocator;
197014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  }
198014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  RegisterAllocationScope* register_allocator() const {
199014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch    return register_allocator_;
200014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  }
201014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
202014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  ZoneVector<Handle<Object>>* globals() { return &globals_; }
203014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  inline LanguageMode language_mode() const;
204014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  int feedback_index(FeedbackVectorSlot slot) const;
205014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
206014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  Isolate* isolate_;
207014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  Zone* zone_;
208342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  BytecodeArrayBuilder* builder_;
209014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  CompilationInfo* info_;
210014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  Scope* scope_;
211014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  ZoneVector<Handle<Object>> globals_;
212014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  ControlScope* execution_control_;
213014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  ContextScope* execution_context_;
214014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  ExpressionResultScope* execution_result_;
215014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  RegisterAllocationScope* register_allocator_;
216537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  ZoneVector<BytecodeLabel> generator_resume_points_;
217537ba893e2530051ec7f296e769fdd37bb4ae4a0Ben Murdoch  Register generator_state_;
218342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  int try_catch_nesting_level_;
219342c50ce1624b485728b9a4fc41d8bbf37eb46cfBen Murdoch  int try_finally_nesting_level_;
220014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch};
221014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
222014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}  // namespace interpreter
223014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}  // namespace internal
224014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}  // namespace v8
225014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch
226014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#endif  // V8_INTERPRETER_BYTECODE_GENERATOR_H_
227