Chromium Code Reviews| 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 // LogicalNot | |
| 338 // | |
| 339 // Perform logical-not on the accumulator, first casting the | |
| 340 // accumulator to a boolean value if required. | |
| 341 void Interpreter::DoLogicalNot(compiler::InterpreterAssembler* assembler) { | |
| 342 Node* accumulator = __ GetAccumulator(); | |
| 343 Node* result = __ CallRuntime(Runtime::kInterpreterLogicalNot, accumulator); | |
| 344 __ SetAccumulator(result); | |
| 345 __ Dispatch(); | |
| 346 } | |
| 347 | |
| 348 | |
| 349 // TypeOf | |
| 350 // | |
| 351 // Load accumulator with string representating type of object in accumulator. | |
|
rmcilroy
2015/10/06 10:39:15
nit - a string representation of the type of the o
oth
2015/10/06 12:35:06
Done, and added the definite and indefinite articl
| |
| 352 void Interpreter::DoTypeOf(compiler::InterpreterAssembler* assembler) { | |
| 353 Node* accumulator = __ GetAccumulator(); | |
| 354 Node* result = __ CallRuntime(Runtime::kInterpreterTypeOf, accumulator); | |
| 355 __ SetAccumulator(result); | |
| 356 __ Dispatch(); | |
| 357 } | |
| 358 | |
| 359 | |
| 337 // Call <callable> <receiver> <arg_count> | 360 // Call <callable> <receiver> <arg_count> |
| 338 // | 361 // |
| 339 // Call a JSfunction or Callable in |callable| with receiver and |arg_count| | 362 // Call a JSfunction or Callable in |callable| with receiver and |arg_count| |
| 340 // arguments in subsequent registers. | 363 // arguments in subsequent registers. |
| 341 void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) { | 364 void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) { |
| 342 Node* function_reg = __ BytecodeOperandReg8(0); | 365 Node* function_reg = __ BytecodeOperandReg8(0); |
| 343 Node* function = __ LoadRegister(function_reg); | 366 Node* function = __ LoadRegister(function_reg); |
| 344 Node* receiver_reg = __ BytecodeOperandReg8(1); | 367 Node* receiver_reg = __ BytecodeOperandReg8(1); |
| 345 Node* first_arg = __ RegisterLocation(receiver_reg); | 368 Node* first_arg = __ RegisterLocation(receiver_reg); |
| 346 Node* args_count = __ BytecodeOperandCount8(2); | 369 Node* args_count = __ BytecodeOperandCount8(2); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 // referenced by the accumulator. | 473 // referenced by the accumulator. |
| 451 void Interpreter::DoTestInstanceOf(compiler::InterpreterAssembler* assembler) { | 474 void Interpreter::DoTestInstanceOf(compiler::InterpreterAssembler* assembler) { |
| 452 DoBinaryOp(Runtime::kInstanceOf, assembler); | 475 DoBinaryOp(Runtime::kInstanceOf, assembler); |
| 453 } | 476 } |
| 454 | 477 |
| 455 | 478 |
| 456 // ToBoolean | 479 // ToBoolean |
| 457 // | 480 // |
| 458 // Cast the object referenced by the accumulator to a boolean. | 481 // Cast the object referenced by the accumulator to a boolean. |
| 459 void Interpreter::DoToBoolean(compiler::InterpreterAssembler* assembler) { | 482 void Interpreter::DoToBoolean(compiler::InterpreterAssembler* assembler) { |
| 460 // TODO(oth): The next CL for test operations has interpreter specific | 483 Node* accumulator = __ GetAccumulator(); |
| 461 // runtime calls. This looks like another candidate. | 484 Node* result = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); |
|
rmcilroy
2015/10/06 10:39:15
Looks like you aren't rebased on master - this cha
oth
2015/10/06 12:35:06
Acknowledged.
| |
| 485 __ SetAccumulator(result); | |
| 462 __ Dispatch(); | 486 __ Dispatch(); |
| 463 } | 487 } |
| 464 | 488 |
| 465 | 489 |
| 466 // Jump <imm8> | 490 // Jump <imm8> |
| 467 // | 491 // |
| 468 // Jump by number of bytes represented by an immediate operand. | 492 // Jump by number of bytes represented by an immediate operand. |
| 469 void Interpreter::DoJump(compiler::InterpreterAssembler* assembler) { | 493 void Interpreter::DoJump(compiler::InterpreterAssembler* assembler) { |
| 470 Node* relative_jump = __ BytecodeOperandImm8(0); | 494 Node* relative_jump = __ BytecodeOperandImm8(0); |
| 471 __ Jump(relative_jump); | 495 __ Jump(relative_jump); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 // | 565 // |
| 542 // Return the value in register 0. | 566 // Return the value in register 0. |
| 543 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 567 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 544 __ Return(); | 568 __ Return(); |
| 545 } | 569 } |
| 546 | 570 |
| 547 | 571 |
| 548 } // namespace interpreter | 572 } // namespace interpreter |
| 549 } // namespace internal | 573 } // namespace internal |
| 550 } // namespace v8 | 574 } // namespace v8 |
| OLD | NEW |