| 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-array-writer.h" | 9 #include "src/interpreter/bytecode-array-writer.h" |
| 10 #include "src/interpreter/bytecode-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Push the context in accumulator as the new context, and store in register | 145 // Push the context in accumulator as the new context, and store in register |
| 146 // |context|. | 146 // |context|. |
| 147 BytecodeArrayBuilder& PushContext(Register context); | 147 BytecodeArrayBuilder& PushContext(Register context); |
| 148 | 148 |
| 149 // Pop the current context and replace with |context|. | 149 // Pop the current context and replace with |context|. |
| 150 BytecodeArrayBuilder& PopContext(Register context); | 150 BytecodeArrayBuilder& PopContext(Register context); |
| 151 | 151 |
| 152 // Call a JS function. The JSFunction or Callable to be called should be in | 152 // Call a JS function. The JSFunction or Callable to be called should be in |
| 153 // |callable|, the receiver should be in |receiver_args| and all subsequent | 153 // |callable|, the receiver should be in |receiver_args| and all subsequent |
| 154 // arguments should be in registers <receiver_args + 1> to | 154 // arguments should be in registers <receiver_args + 1> to |
| 155 // <receiver_args + receiver_arg_count - 1>. Type feedback is recorded in |
| 156 // the |feedback_slot| in the type feedback vector. |
| 157 BytecodeArrayBuilder& CallWithFeedback( |
| 158 Register callable, Register receiver_args, size_t receiver_arg_count, |
| 159 int feedback_slot, TailCallMode tail_call_mode = TailCallMode::kDisallow); |
| 160 |
| 161 BytecodeArrayBuilder& TailCallWithFeedback(Register callable, |
| 162 Register receiver_args, |
| 163 size_t receiver_arg_count, |
| 164 int feedback_slot) { |
| 165 return CallWithFeedback(callable, receiver_args, receiver_arg_count, |
| 166 feedback_slot, TailCallMode::kAllow); |
| 167 } |
| 168 |
| 169 // Call a JS function. The JSFunction or Callable to be called should be in |
| 170 // |callable|, the receiver should be in |receiver_args| and all subsequent |
| 171 // arguments should be in registers <receiver_args + 1> to |
| 155 // <receiver_args + receiver_arg_count - 1>. | 172 // <receiver_args + receiver_arg_count - 1>. |
| 156 BytecodeArrayBuilder& Call( | 173 BytecodeArrayBuilder& Call( |
| 157 Register callable, Register receiver_args, size_t receiver_arg_count, | 174 Register callable, Register receiver_args, size_t receiver_arg_count, |
| 158 int feedback_slot, TailCallMode tail_call_mode = TailCallMode::kDisallow); | 175 TailCallMode tail_call_mode = TailCallMode::kDisallow); |
| 159 | 176 |
| 160 BytecodeArrayBuilder& TailCall(Register callable, Register receiver_args, | 177 BytecodeArrayBuilder& TailCall(Register callable, Register receiver_args, |
| 161 size_t receiver_arg_count, int feedback_slot) { | 178 size_t receiver_arg_count) { |
| 162 return Call(callable, receiver_args, receiver_arg_count, feedback_slot, | 179 return Call(callable, receiver_args, receiver_arg_count, |
| 163 TailCallMode::kAllow); | 180 TailCallMode::kAllow); |
| 164 } | 181 } |
| 165 | 182 |
| 166 // Call the new operator. The accumulator holds the |new_target|. | 183 // Call the new operator. The accumulator holds the |new_target|. |
| 167 // The |constructor| is in a register followed by |arg_count| | 184 // The |constructor| is in a register followed by |arg_count| |
| 168 // consecutive arguments starting at |first_arg| for the constuctor | 185 // consecutive arguments starting at |first_arg| for the constuctor |
| 169 // invocation. | 186 // invocation. |
| 170 BytecodeArrayBuilder& New(Register constructor, Register first_arg, | 187 BytecodeArrayBuilder& New(Register constructor, Register first_arg, |
| 171 size_t arg_count); | 188 size_t arg_count); |
| 172 | 189 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 static Bytecode BytecodeForCountOperation(Token::Value op); | 313 static Bytecode BytecodeForCountOperation(Token::Value op); |
| 297 static Bytecode BytecodeForCompareOperation(Token::Value op); | 314 static Bytecode BytecodeForCompareOperation(Token::Value op); |
| 298 static Bytecode BytecodeForStoreNamedProperty(LanguageMode language_mode); | 315 static Bytecode BytecodeForStoreNamedProperty(LanguageMode language_mode); |
| 299 static Bytecode BytecodeForStoreKeyedProperty(LanguageMode language_mode); | 316 static Bytecode BytecodeForStoreKeyedProperty(LanguageMode language_mode); |
| 300 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); | 317 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); |
| 301 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); | 318 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); |
| 302 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); | 319 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); |
| 303 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); | 320 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); |
| 304 static Bytecode BytecodeForDelete(LanguageMode language_mode); | 321 static Bytecode BytecodeForDelete(LanguageMode language_mode); |
| 305 static Bytecode BytecodeForCall(TailCallMode tail_call_mode); | 322 static Bytecode BytecodeForCall(TailCallMode tail_call_mode); |
| 323 static Bytecode BytecodeForCallWithFeedback(TailCallMode tail_call_mode); |
| 306 | 324 |
| 307 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, | 325 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
| 308 uint32_t operand2, uint32_t operand3); | 326 uint32_t operand2, uint32_t operand3); |
| 309 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, | 327 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
| 310 uint32_t operand2); | 328 uint32_t operand2); |
| 311 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); | 329 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); |
| 312 void Output(Bytecode bytecode, uint32_t operand0); | 330 void Output(Bytecode bytecode, uint32_t operand0); |
| 313 void Output(Bytecode bytecode); | 331 void Output(Bytecode bytecode); |
| 314 | 332 |
| 315 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, | 333 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 BytecodeSourceInfo latest_source_info_; | 385 BytecodeSourceInfo latest_source_info_; |
| 368 | 386 |
| 369 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 387 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
| 370 }; | 388 }; |
| 371 | 389 |
| 372 } // namespace interpreter | 390 } // namespace interpreter |
| 373 } // namespace internal | 391 } // namespace internal |
| 374 } // namespace v8 | 392 } // namespace v8 |
| 375 | 393 |
| 376 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 394 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |