| 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 "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
| 10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 Handle<FixedArray> constant_properties, int literal_index, int flags); | 157 Handle<FixedArray> constant_properties, int literal_index, int flags); |
| 158 | 158 |
| 159 // Push the context in accumulator as the new context, and store in register | 159 // Push the context in accumulator as the new context, and store in register |
| 160 // |context|. | 160 // |context|. |
| 161 BytecodeArrayBuilder& PushContext(Register context); | 161 BytecodeArrayBuilder& PushContext(Register context); |
| 162 | 162 |
| 163 // Pop the current context and replace with |context|. | 163 // Pop the current context and replace with |context|. |
| 164 BytecodeArrayBuilder& PopContext(Register context); | 164 BytecodeArrayBuilder& PopContext(Register context); |
| 165 | 165 |
| 166 // Call a JS function. The JSFunction or Callable to be called should be in | 166 // Call a JS function. The JSFunction or Callable to be called should be in |
| 167 // |callable|, the receiver should be in |receiver| and all subsequent | 167 // |callable|, the receiver should be in |receiver_args| and all subsequent |
| 168 // arguments should be in registers <receiver + 1> to | 168 // arguments should be in registers <receiver_args + 1> to |
| 169 // <receiver + 1 + arg_count>. | 169 // <receiver_args + receiver_arg_count - 1>. |
| 170 BytecodeArrayBuilder& Call(Register callable, Register receiver, | 170 BytecodeArrayBuilder& Call(Register callable, Register receiver_args, |
| 171 size_t arg_count, int feedback_slot); | 171 size_t receiver_arg_count, int feedback_slot); |
| 172 | 172 |
| 173 // Call the new operator. The |constructor| register is followed by | 173 // Call the new operator. The |constructor| register is followed by |
| 174 // |arg_count| consecutive registers containing arguments to be | 174 // |arg_count| consecutive registers containing arguments to be |
| 175 // applied to the constructor. | 175 // applied to the constructor. |
| 176 BytecodeArrayBuilder& New(Register constructor, Register first_arg, | 176 BytecodeArrayBuilder& New(Register constructor, Register first_arg, |
| 177 size_t arg_count); | 177 size_t arg_count); |
| 178 | 178 |
| 179 // Call the runtime function with |function_id|. The first argument should be | 179 // Call the runtime function with |function_id|. The first argument should be |
| 180 // in |first_arg| and all subsequent arguments should be in registers | 180 // in |first_arg| and all subsequent arguments should be in registers |
| 181 // <first_arg + 1> to <first_arg + 1 + arg_count>. | 181 // <first_arg + 1> to <first_arg + arg_count - 1>. |
| 182 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, | 182 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, |
| 183 Register first_arg, size_t arg_count); | 183 Register first_arg, size_t arg_count); |
| 184 | 184 |
| 185 // Call the runtime function with |function_id| that returns a pair of values. | 185 // Call the runtime function with |function_id| that returns a pair of values. |
| 186 // The first argument should be in |first_arg| and all subsequent arguments | 186 // The first argument should be in |first_arg| and all subsequent arguments |
| 187 // should be in registers <first_arg + 1> to <first_arg + 1 + arg_count>. The | 187 // should be in registers <first_arg + 1> to <first_arg + arg_count - 1>. The |
| 188 // return values will be returned in <first_return> and <first_return + 1>. | 188 // return values will be returned in <first_return> and <first_return + 1>. |
| 189 BytecodeArrayBuilder& CallRuntimeForPair(Runtime::FunctionId function_id, | 189 BytecodeArrayBuilder& CallRuntimeForPair(Runtime::FunctionId function_id, |
| 190 Register first_arg, size_t arg_count, | 190 Register first_arg, size_t arg_count, |
| 191 Register first_return); | 191 Register first_return); |
| 192 | 192 |
| 193 // Call the JS runtime function with |context_index|. The the receiver should | 193 // Call the JS runtime function with |context_index|. The the receiver should |
| 194 // be in |receiver| and all subsequent arguments should be in registers | 194 // be in |receiver_args| and all subsequent arguments should be in registers |
| 195 // <receiver + 1> to <receiver + 1 + arg_count>. | 195 // <receiver + 1> to <receiver + receiver_args_count - 1>. |
| 196 BytecodeArrayBuilder& CallJSRuntime(int context_index, Register receiver, | 196 BytecodeArrayBuilder& CallJSRuntime(int context_index, Register receiver_args, |
| 197 size_t arg_count); | 197 size_t receiver_args_count); |
| 198 | 198 |
| 199 // Operators (register holds the lhs value, accumulator holds the rhs value). | 199 // Operators (register holds the lhs value, accumulator holds the rhs value). |
| 200 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, | 200 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, |
| 201 Strength strength); | 201 Strength strength); |
| 202 | 202 |
| 203 // Count Operators (value stored in accumulator). | 203 // Count Operators (value stored in accumulator). |
| 204 BytecodeArrayBuilder& CountOperation(Token::Value op, Strength strength); | 204 BytecodeArrayBuilder& CountOperation(Token::Value op, Strength strength); |
| 205 | 205 |
| 206 // Unary Operators. | 206 // Unary Operators. |
| 207 BytecodeArrayBuilder& LogicalNot(); | 207 BytecodeArrayBuilder& LogicalNot(); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 size_t offset_; | 402 size_t offset_; |
| 403 | 403 |
| 404 friend class BytecodeArrayBuilder; | 404 friend class BytecodeArrayBuilder; |
| 405 }; | 405 }; |
| 406 | 406 |
| 407 } // namespace interpreter | 407 } // namespace interpreter |
| 408 } // namespace internal | 408 } // namespace internal |
| 409 } // namespace v8 | 409 } // namespace v8 |
| 410 | 410 |
| 411 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 411 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |