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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // |context|. | 85 // |context|. |
86 BytecodeArrayBuilder& PushContext(Register context); | 86 BytecodeArrayBuilder& PushContext(Register context); |
87 // Pop the current context and replace with |context| | 87 // Pop the current context and replace with |context| |
88 BytecodeArrayBuilder& PopContext(Register context); | 88 BytecodeArrayBuilder& PopContext(Register context); |
89 | 89 |
90 // Create a new closure for the SharedFunctionInfo in the accumulator. | 90 // Create a new closure for the SharedFunctionInfo in the accumulator. |
91 BytecodeArrayBuilder& CreateClosure(PretenureFlag tenured); | 91 BytecodeArrayBuilder& CreateClosure(PretenureFlag tenured); |
92 | 92 |
93 // Literals creation. Constant elements should be in the accumulator. | 93 // Literals creation. Constant elements should be in the accumulator. |
94 BytecodeArrayBuilder& CreateArrayLiteral(int literal_index, int flags); | 94 BytecodeArrayBuilder& CreateArrayLiteral(int literal_index, int flags); |
| 95 BytecodeArrayBuilder& CreateObjectLiteral(int literal_index, int flags); |
95 | 96 |
96 // Call a JS function. The JSFunction or Callable to be called should be in | 97 // Call a JS function. The JSFunction or Callable to be called should be in |
97 // |callable|, the receiver should be in |receiver| and all subsequent | 98 // |callable|, the receiver should be in |receiver| and all subsequent |
98 // arguments should be in registers <receiver + 1> to | 99 // arguments should be in registers <receiver + 1> to |
99 // <receiver + 1 + arg_count>. | 100 // <receiver + 1 + arg_count>. |
100 BytecodeArrayBuilder& Call(Register callable, Register receiver, | 101 BytecodeArrayBuilder& Call(Register callable, Register receiver, |
101 size_t arg_count); | 102 size_t arg_count); |
102 | 103 |
103 // Call the runtime function with |function_id|. The first argument should be | 104 // Call the runtime function with |function_id|. The first argument should be |
104 // in |first_arg| and all subsequent arguments should be in registers | 105 // in |first_arg| and all subsequent arguments should be in registers |
105 // <first_arg + 1> to <first_arg + 1 + arg_count>. | 106 // <first_arg + 1> to <first_arg + 1 + arg_count>. |
106 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, | 107 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, |
107 Register first_arg, size_t arg_count); | 108 Register first_arg, size_t arg_count); |
108 | 109 |
109 // Operators (register == lhs, accumulator = rhs). | 110 // Operators (register == lhs, accumulator = rhs). |
110 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, | 111 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, |
111 Strength strength); | 112 Strength strength); |
112 | 113 |
113 // Unary Operators. | 114 // Unary Operators. |
114 BytecodeArrayBuilder& LogicalNot(); | 115 BytecodeArrayBuilder& LogicalNot(); |
115 BytecodeArrayBuilder& TypeOf(); | 116 BytecodeArrayBuilder& TypeOf(); |
116 | 117 |
117 // Tests. | 118 // Tests. |
118 BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg, | 119 BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg, |
119 Strength strength); | 120 Strength strength); |
120 | 121 |
121 // Casts | 122 // Casts |
122 BytecodeArrayBuilder& CastAccumulatorToBoolean(); | 123 BytecodeArrayBuilder& CastAccumulatorToBoolean(); |
| 124 BytecodeArrayBuilder& CastAccumulatorToName(); |
123 | 125 |
124 // Flow Control. | 126 // Flow Control. |
125 BytecodeArrayBuilder& Bind(BytecodeLabel* label); | 127 BytecodeArrayBuilder& Bind(BytecodeLabel* label); |
126 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); | 128 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); |
127 | 129 |
128 BytecodeArrayBuilder& Jump(BytecodeLabel* label); | 130 BytecodeArrayBuilder& Jump(BytecodeLabel* label); |
129 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); | 131 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); |
130 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); | 132 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); |
131 BytecodeArrayBuilder& Return(); | 133 BytecodeArrayBuilder& Return(); |
132 | 134 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 260 |
259 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 261 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
260 }; | 262 }; |
261 | 263 |
262 | 264 |
263 } // namespace interpreter | 265 } // namespace interpreter |
264 } // namespace internal | 266 } // namespace internal |
265 } // namespace v8 | 267 } // namespace v8 |
266 | 268 |
267 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 269 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |