| 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 #include "src/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/compiler/interpreter-assembler.h" | 9 #include "src/compiler/interpreter-assembler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 | 328 |
| 329 // Mod <src> | 329 // Mod <src> |
| 330 // | 330 // |
| 331 // Modulo register <src> by accumulator. | 331 // Modulo register <src> by accumulator. |
| 332 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) { | 332 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) { |
| 333 DoBinaryOp(Runtime::kModulus, assembler); | 333 DoBinaryOp(Runtime::kModulus, assembler); |
| 334 } | 334 } |
| 335 | 335 |
| 336 | 336 |
| 337 // Call <callable> <receiver> <arg_count> | 337 // Call <receiver> <arg_count> |
| 338 // | 338 // |
| 339 // Call a JSfunction or Callable in |callable| with receiver and |arg_count| | 339 // Call a JS function with receiver and |arg_count| arguments in subsequent |
| 340 // arguments in subsequent registers. | 340 // registers. The JSfunction or Callable to call is in the accumulator. |
| 341 void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) { | 341 void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) { |
| 342 Node* function_reg = __ BytecodeOperandReg8(0); | 342 Node* function_reg = __ BytecodeOperandReg8(0); |
| 343 Node* function = __ LoadRegister(function_reg); | 343 Node* function = __ LoadRegister(function_reg); |
| 344 Node* receiver_reg = __ BytecodeOperandReg8(1); | 344 Node* receiver_reg = __ BytecodeOperandReg8(1); |
| 345 Node* first_arg = __ RegisterLocation(receiver_reg); | 345 Node* first_arg = __ RegisterLocation(receiver_reg); |
| 346 Node* args_count = __ BytecodeOperandCount8(2); | 346 Node* args_count = __ BytecodeOperandCount8(2); |
| 347 Node* result = __ CallJS(function, first_arg, args_count); | 347 Node* result = __ CallJS(function, first_arg, args_count); |
| 348 __ SetAccumulator(result); | 348 __ SetAccumulator(result); |
| 349 __ Dispatch(); | 349 __ Dispatch(); |
| 350 } | 350 } |
| 351 | |
| 352 | |
| 353 // CallRuntime <function_id> <first_arg> <arg_count> | |
| 354 // | |
| 355 // Call the runtime function |function_id| with first argument in register | |
| 356 // |first_arg| and |arg_count| arguments in subsequent registers. | |
| 357 void Interpreter::DoCallRuntime(compiler::InterpreterAssembler* assembler) { | |
| 358 Node* function_id = __ BytecodeOperandIdx16(0); | |
| 359 Node* first_arg_reg = __ BytecodeOperandReg8(1); | |
| 360 Node* first_arg = __ RegisterLocation(first_arg_reg); | |
| 361 Node* args_count = __ BytecodeOperandCount8(2); | |
| 362 Node* result = __ CallRuntime(function_id, first_arg, args_count); | |
| 363 __ SetAccumulator(result); | |
| 364 __ Dispatch(); | |
| 365 } | |
| 366 | 351 |
| 367 | 352 |
| 368 // TestEqual <src> | 353 // TestEqual <src> |
| 369 // | 354 // |
| 370 // Test if the value in the <src> register equals the accumulator. | 355 // Test if the value in the <src> register equals the accumulator. |
| 371 void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) { | 356 void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) { |
| 372 DoBinaryOp(Runtime::kInterpreterEquals, assembler); | 357 DoBinaryOp(Runtime::kInterpreterEquals, assembler); |
| 373 } | 358 } |
| 374 | 359 |
| 375 | 360 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 // | 526 // |
| 542 // Return the value in register 0. | 527 // Return the value in register 0. |
| 543 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 528 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 544 __ Return(); | 529 __ Return(); |
| 545 } | 530 } |
| 546 | 531 |
| 547 | 532 |
| 548 } // namespace interpreter | 533 } // namespace interpreter |
| 549 } // namespace internal | 534 } // namespace internal |
| 550 } // namespace v8 | 535 } // namespace v8 |
| OLD | NEW |