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 <receiver> <arg_count> | 337 // Call <callable> <receiver> <arg_count> |
338 // | 338 // |
339 // Call a JS function with receiver and |arg_count| arguments in subsequent | 339 // Call a JSfunction or Callable in |callable| with receiver and |arg_count| |
340 // registers. The JSfunction or Callable to call is in the accumulator. | 340 // arguments in subsequent registers. |
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 | 351 |
352 | 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 |
| 367 |
353 // TestEqual <src> | 368 // TestEqual <src> |
354 // | 369 // |
355 // Test if the value in the <src> register equals the accumulator. | 370 // Test if the value in the <src> register equals the accumulator. |
356 void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) { | 371 void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) { |
357 DoBinaryOp(Runtime::kInterpreterEquals, assembler); | 372 DoBinaryOp(Runtime::kInterpreterEquals, assembler); |
358 } | 373 } |
359 | 374 |
360 | 375 |
361 // TestNotEqual <src> | 376 // TestNotEqual <src> |
362 // | 377 // |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // | 541 // |
527 // Return the value in register 0. | 542 // Return the value in register 0. |
528 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 543 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
529 __ Return(); | 544 __ Return(); |
530 } | 545 } |
531 | 546 |
532 | 547 |
533 } // namespace interpreter | 548 } // namespace interpreter |
534 } // namespace internal | 549 } // namespace internal |
535 } // namespace v8 | 550 } // namespace v8 |
OLD | NEW |