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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 | 336 |
| 337 | 337 |
| 338 // Mod <src> | 338 // Mod <src> |
| 339 // | 339 // |
| 340 // Modulo register <src> by accumulator. | 340 // Modulo register <src> by accumulator. |
| 341 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) { | 341 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) { |
| 342 DoBinaryOp(Runtime::kModulus, assembler); | 342 DoBinaryOp(Runtime::kModulus, assembler); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 // Call <receiver> <arg_count> | 346 // Call <callable> <receiver> <arg_count> |
| 347 // | 347 // |
| 348 // Call a JS function with receiver and |arg_count| arguments in subsequent | 348 // Call a JSfunction or Callable in |callable| with receiver and |arg_count| |
| 349 // registers. The JSfunction or Callable to call is in the accumulator. | 349 // arguments in subsequent registers. |
| 350 void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) { | 350 void Interpreter::DoCall(compiler::InterpreterAssembler* assembler) { |
| 351 Node* function_reg = __ BytecodeOperandReg(0); | 351 Node* function_reg = __ BytecodeOperandReg(0); |
| 352 Node* function = __ LoadRegister(function_reg); | 352 Node* function = __ LoadRegister(function_reg); |
| 353 Node* receiver_reg = __ BytecodeOperandReg(1); | 353 Node* receiver_reg = __ BytecodeOperandReg(1); |
| 354 Node* first_arg = __ RegisterLocation(receiver_reg); | 354 Node* first_arg = __ RegisterLocation(receiver_reg); |
| 355 Node* args_count = __ BytecodeOperandCount(2); | 355 Node* args_count = __ BytecodeOperandCount(2); |
| 356 Node* result = __ CallJS(function, first_arg, args_count); | 356 Node* result = __ CallJS(function, first_arg, args_count); |
| 357 __ SetAccumulator(result); | 357 __ SetAccumulator(result); |
| 358 __ Dispatch(); | 358 __ Dispatch(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 | 361 |
| 362 // CallRuntime <function_id> <first_arg> <arg_count> | |
| 363 // | |
| 364 // Call the runtime function |function_id| with first argument in register | |
| 365 // |first_arg| and |arg_count| arguments in subsequent registers. | |
| 366 void Interpreter::DoCallRuntime(compiler::InterpreterAssembler* assembler) { | |
| 367 Node* function_id = __ BytecodeOperandIdx(0); | |
|
oth
2015/09/25 09:49:27
A TODO for the wider operand(s) discussed for func
rmcilroy
2015/09/28 16:20:47
Implemented as a wide operand now.
| |
| 368 Node* first_arg_reg = __ BytecodeOperandReg(1); | |
| 369 Node* first_arg = __ RegisterLocation(first_arg_reg); | |
| 370 Node* args_count = __ BytecodeOperandCount(2); | |
| 371 Node* result = __ CallRuntime(function_id, first_arg, args_count); | |
| 372 __ SetAccumulator(result); | |
| 373 __ Dispatch(); | |
| 374 } | |
| 375 | |
| 376 | |
| 362 // TestEqual <src> | 377 // TestEqual <src> |
| 363 // | 378 // |
| 364 // Test if the value in the <src> register equals the accumulator. | 379 // Test if the value in the <src> register equals the accumulator. |
| 365 void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) { | 380 void Interpreter::DoTestEqual(compiler::InterpreterAssembler* assembler) { |
| 366 DoCompareOp(Token::Value::EQ, assembler); | 381 DoCompareOp(Token::Value::EQ, assembler); |
| 367 } | 382 } |
| 368 | 383 |
| 369 | 384 |
| 370 // TestNotEqual <src> | 385 // TestNotEqual <src> |
| 371 // | 386 // |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 // | 550 // |
| 536 // Return the value in register 0. | 551 // Return the value in register 0. |
| 537 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 552 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 538 __ Return(); | 553 __ Return(); |
| 539 } | 554 } |
| 540 | 555 |
| 541 | 556 |
| 542 } // namespace interpreter | 557 } // namespace interpreter |
| 543 } // namespace internal | 558 } // namespace internal |
| 544 } // namespace v8 | 559 } // namespace v8 |
| OLD | NEW |