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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 | 276 |
277 // Mod <src> | 277 // Mod <src> |
278 // | 278 // |
279 // Modulo register <src> by accumulator. | 279 // Modulo register <src> by accumulator. |
280 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) { | 280 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) { |
281 DoBinaryOp(Context::MOD_BUILTIN_INDEX, assembler); | 281 DoBinaryOp(Context::MOD_BUILTIN_INDEX, assembler); |
282 } | 282 } |
283 | 283 |
284 | 284 |
| 285 // CallJS <first_arg_reg> <arg_count> |
| 286 // |
| 287 // Call a JS function with arguments in registers <first_arg_reg> to |
| 288 // <first_arg_reg + arg_count>. The JSfunction or Callable to call is in |
| 289 // the accumulator. |
| 290 void Interpreter::DoCallJS(compiler::InterpreterAssembler* assembler) { |
| 291 Node* first_arg_reg_index = __ BytecodeOperandReg(0); |
| 292 Node* first_arg = __ RegisterLocation(first_arg_reg_index); |
| 293 Node* args_count = __ BytecodeOperandCount(1); |
| 294 Node* args_size = __ WordShl(args_count, kPointerSizeLog2); |
| 295 Node* last_arg = __ IntPtrSub(first_arg, args_size); |
| 296 Node* function = __ GetAccumulator(); |
| 297 Node* result = __ CallJS(function, first_arg, last_arg); |
| 298 __ SetAccumulator(result); |
| 299 __ Dispatch(); |
| 300 } |
| 301 |
| 302 |
285 // Return | 303 // Return |
286 // | 304 // |
287 // Return the value in register 0. | 305 // Return the value in register 0. |
288 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 306 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
289 __ Return(); | 307 __ Return(); |
290 } | 308 } |
291 | 309 |
292 | 310 |
293 } // namespace interpreter | 311 } // namespace interpreter |
294 } // namespace internal | 312 } // namespace internal |
295 } // namespace v8 | 313 } // namespace v8 |
OLD | NEW |