OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
6 #define V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 6 #define V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
7 | 7 |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/interpreter/bytecode-array-builder.h" | 9 #include "src/interpreter/bytecode-array-builder.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 class ExpressionResultScope; | 34 class ExpressionResultScope; |
35 class EffectResultScope; | 35 class EffectResultScope; |
36 class AccumulatorResultScope; | 36 class AccumulatorResultScope; |
37 class RegisterResultScope; | 37 class RegisterResultScope; |
38 | 38 |
39 void MakeBytecodeBody(); | 39 void MakeBytecodeBody(); |
40 Register NextContextRegister() const; | 40 Register NextContextRegister() const; |
41 | 41 |
42 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 42 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
43 | 43 |
44 Register VisitArguments(ZoneList<Expression*>* arguments); | 44 // Dispatched from VisitBinaryOperation. |
45 | |
46 void VisitArithmeticExpression(BinaryOperation* binop); | 45 void VisitArithmeticExpression(BinaryOperation* binop); |
47 void VisitCommaExpression(BinaryOperation* binop); | 46 void VisitCommaExpression(BinaryOperation* binop); |
48 void VisitLogicalOrExpression(BinaryOperation* binop); | 47 void VisitLogicalOrExpression(BinaryOperation* binop); |
49 void VisitLogicalAndExpression(BinaryOperation* binop); | 48 void VisitLogicalAndExpression(BinaryOperation* binop); |
50 | 49 |
| 50 // Dispatched from VisitUnaryOperation. |
| 51 void VisitVoid(UnaryOperation* expr); |
| 52 void VisitTypeOf(UnaryOperation* expr); |
| 53 void VisitNot(UnaryOperation* expr); |
| 54 |
| 55 // Helper visitors which perform common operations. |
| 56 Register VisitArguments(ZoneList<Expression*>* arguments); |
| 57 |
51 void VisitPropertyLoad(Register obj, Property* expr); | 58 void VisitPropertyLoad(Register obj, Property* expr); |
52 void VisitPropertyLoadForAccumulator(Register obj, Property* expr); | 59 void VisitPropertyLoadForAccumulator(Register obj, Property* expr); |
53 | 60 |
54 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot); | 61 void VisitVariableLoad(Variable* variable, FeedbackVectorSlot slot); |
| 62 void VisitVariableLoadForAccumulatorValue(Variable* variable, |
| 63 FeedbackVectorSlot slot); |
| 64 MUST_USE_RESULT Register VisitVariableLoadForRegisterValue( |
| 65 Variable* variable, FeedbackVectorSlot slot); |
55 void VisitVariableAssignment(Variable* variable, FeedbackVectorSlot slot); | 66 void VisitVariableAssignment(Variable* variable, FeedbackVectorSlot slot); |
56 | 67 |
57 void VisitNewLocalFunctionContext(); | 68 void VisitNewLocalFunctionContext(); |
58 void VisitBuildLocalActivationContext(); | 69 void VisitBuildLocalActivationContext(); |
59 void VisitNewLocalBlockContext(Scope* scope); | 70 void VisitNewLocalBlockContext(Scope* scope); |
60 void VisitFunctionClosureForContext(); | 71 void VisitFunctionClosureForContext(); |
61 void VisitSetHomeObject(Register value, Register home_object, | 72 void VisitSetHomeObject(Register value, Register home_object, |
62 ObjectLiteralProperty* property, int slot_number = 0); | 73 ObjectLiteralProperty* property, int slot_number = 0); |
63 void VisitObjectLiteralAccessor(Register home_object, | 74 void VisitObjectLiteralAccessor(Register home_object, |
64 ObjectLiteralProperty* property, | 75 ObjectLiteralProperty* property, |
65 Register value_out); | 76 Register value_out); |
66 | 77 |
67 // Dispatched from VisitUnaryOperation. | |
68 void VisitVoid(UnaryOperation* expr); | |
69 void VisitTypeOf(UnaryOperation* expr); | |
70 void VisitNot(UnaryOperation* expr); | |
71 | 78 |
72 // Visitors for obtaining expression result in the accumulator, in a | 79 // Visitors for obtaining expression result in the accumulator, in a |
73 // register, or just getting the effect. | 80 // register, or just getting the effect. |
74 void VisitForAccumulatorValue(Expression* expression); | 81 void VisitForAccumulatorValue(Expression* expression); |
75 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression); | 82 MUST_USE_RESULT Register VisitForRegisterValue(Expression* expression); |
76 void VisitForEffect(Expression* node); | 83 void VisitForEffect(Expression* node); |
77 | 84 |
78 // Methods marking the start and end of binary expressions. | 85 // Methods marking the start and end of binary expressions. |
79 void PrepareForBinaryExpression(); | 86 void PrepareForBinaryExpression(); |
80 void CompleteBinaryExpression(); | 87 void CompleteBinaryExpression(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 130 |
124 int binary_expression_depth_; | 131 int binary_expression_depth_; |
125 ZoneSet<int> binary_expression_hazard_set_; | 132 ZoneSet<int> binary_expression_hazard_set_; |
126 }; | 133 }; |
127 | 134 |
128 } // namespace interpreter | 135 } // namespace interpreter |
129 } // namespace internal | 136 } // namespace internal |
130 } // namespace v8 | 137 } // namespace v8 |
131 | 138 |
132 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ | 139 #endif // V8_INTERPRETER_BYTECODE_GENERATOR_H_ |
OLD | NEW |