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_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 BytecodeArrayBuilder& Call(Register callable, Register receiver, | 75 BytecodeArrayBuilder& Call(Register callable, Register receiver, |
76 size_t arg_count); | 76 size_t arg_count); |
77 | 77 |
78 // Call the runtime function with |function_id|. The first argument should be | 78 // Call the runtime function with |function_id|. The first argument should be |
79 // in |first_arg| and all subsequent arguments should be in registers | 79 // in |first_arg| and all subsequent arguments should be in registers |
80 // <first_arg + 1> to <first_arg + 1 + arg_count>. | 80 // <first_arg + 1> to <first_arg + 1 + arg_count>. |
81 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, | 81 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, |
82 Register first_arg, size_t arg_count); | 82 Register first_arg, size_t arg_count); |
83 | 83 |
84 // Operators (register == lhs, accumulator = rhs). | 84 // Operators (register == lhs, accumulator = rhs). |
85 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg); | 85 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, |
| 86 Strength strength); |
86 | 87 |
87 // Unary Operators. | 88 // Unary Operators. |
88 BytecodeArrayBuilder& LogicalNot(); | 89 BytecodeArrayBuilder& LogicalNot(); |
89 BytecodeArrayBuilder& TypeOf(); | 90 BytecodeArrayBuilder& TypeOf(); |
90 | 91 |
91 // Tests. | 92 // Tests. |
92 BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg, | 93 BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg, |
93 LanguageMode language_mode); | 94 Strength strength); |
94 | 95 |
95 // Casts | 96 // Casts |
96 BytecodeArrayBuilder& CastAccumulatorToBoolean(); | 97 BytecodeArrayBuilder& CastAccumulatorToBoolean(); |
97 | 98 |
98 // Flow Control. | 99 // Flow Control. |
99 BytecodeArrayBuilder& Bind(BytecodeLabel* label); | 100 BytecodeArrayBuilder& Bind(BytecodeLabel* label); |
100 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); | 101 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); |
101 | 102 |
102 BytecodeArrayBuilder& Jump(BytecodeLabel* label); | 103 BytecodeArrayBuilder& Jump(BytecodeLabel* label); |
103 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); | 104 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); |
104 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); | 105 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); |
105 BytecodeArrayBuilder& Return(); | 106 BytecodeArrayBuilder& Return(); |
106 | 107 |
107 BytecodeArrayBuilder& EnterBlock(); | 108 BytecodeArrayBuilder& EnterBlock(); |
108 BytecodeArrayBuilder& LeaveBlock(); | 109 BytecodeArrayBuilder& LeaveBlock(); |
109 | 110 |
110 // Accessors | 111 // Accessors |
111 Zone* zone() const { return zone_; } | 112 Zone* zone() const { return zone_; } |
112 | 113 |
113 private: | 114 private: |
114 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } | 115 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } |
115 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } | 116 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } |
116 Isolate* isolate() const { return isolate_; } | 117 Isolate* isolate() const { return isolate_; } |
117 | 118 |
118 static Bytecode BytecodeForBinaryOperation(Token::Value op); | 119 static Bytecode BytecodeForBinaryOperation(Token::Value op); |
119 static Bytecode BytecodeForCompareOperation(Token::Value op); | 120 static Bytecode BytecodeForCompareOperation(Token::Value op); |
| 121 static Bytecode BytecodeForLoadIC(LanguageMode language_mode); |
| 122 static Bytecode BytecodeForKeyedLoadIC(LanguageMode language_mode); |
| 123 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); |
| 124 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); |
120 | 125 |
121 static bool FitsInIdx8Operand(int value); | 126 static bool FitsInIdx8Operand(int value); |
122 static bool FitsInIdx8Operand(size_t value); | 127 static bool FitsInIdx8Operand(size_t value); |
123 static bool FitsInImm8Operand(int value); | 128 static bool FitsInImm8Operand(int value); |
124 static bool FitsInIdx16Operand(int value); | 129 static bool FitsInIdx16Operand(int value); |
125 | 130 |
126 static Bytecode GetJumpWithConstantOperand(Bytecode jump_with_smi8_operand); | 131 static Bytecode GetJumpWithConstantOperand(Bytecode jump_with_smi8_operand); |
127 | 132 |
128 template <size_t N> | 133 template <size_t N> |
129 INLINE(void Output(Bytecode bytecode, uint32_t(&oprands)[N])); | 134 INLINE(void Output(Bytecode bytecode, uint32_t(&oprands)[N])); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 232 |
228 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 233 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
229 }; | 234 }; |
230 | 235 |
231 | 236 |
232 } // namespace interpreter | 237 } // namespace interpreter |
233 } // namespace internal | 238 } // namespace internal |
234 } // namespace v8 | 239 } // namespace v8 |
235 | 240 |
236 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 241 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |