Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1568493002: [Interpreter] Add support for calling runtime functions which return a pair. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michi's review comments. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/unittests/compiler/interpreter-assembler-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 Node* function_id = __ BytecodeOperandIdx(0); 1079 Node* function_id = __ BytecodeOperandIdx(0);
1080 Node* first_arg_reg = __ BytecodeOperandReg(1); 1080 Node* first_arg_reg = __ BytecodeOperandReg(1);
1081 Node* first_arg = __ RegisterLocation(first_arg_reg); 1081 Node* first_arg = __ RegisterLocation(first_arg_reg);
1082 Node* args_count = __ BytecodeOperandCount(2); 1082 Node* args_count = __ BytecodeOperandCount(2);
1083 Node* result = __ CallRuntime(function_id, first_arg, args_count); 1083 Node* result = __ CallRuntime(function_id, first_arg, args_count);
1084 __ SetAccumulator(result); 1084 __ SetAccumulator(result);
1085 __ Dispatch(); 1085 __ Dispatch();
1086 } 1086 }
1087 1087
1088 1088
1089 // CallRuntimeForPair <function_id> <first_arg> <arg_count> <first_return>
1090 //
1091 // Call the runtime function |function_id| which returns a pair, with the
1092 // first argument in register |first_arg| and |arg_count| arguments in
1093 // subsequent registers. Returns the result in <first_return> and
1094 // <first_return + 1>
1095 void Interpreter::DoCallRuntimeForPair(
1096 compiler::InterpreterAssembler* assembler) {
1097 // Call the runtime function.
1098 Node* function_id = __ BytecodeOperandIdx(0);
1099 Node* first_arg_reg = __ BytecodeOperandReg(1);
1100 Node* first_arg = __ RegisterLocation(first_arg_reg);
1101 Node* args_count = __ BytecodeOperandCount(2);
1102 Node* result_pair = __ CallRuntime(function_id, first_arg, args_count, 2);
1103
1104 // Store the results in <first_return> and <first_return + 1>
1105 Node* first_return_reg = __ BytecodeOperandReg(3);
1106 Node* second_return_reg = __ NextRegister(first_return_reg);
1107 Node* result0 = __ Projection(0, result_pair);
1108 Node* result1 = __ Projection(1, result_pair);
1109 __ StoreRegister(result0, first_return_reg);
1110 __ StoreRegister(result1, second_return_reg);
1111
1112 __ Dispatch();
1113 }
1114
1115
1089 // CallJSRuntime <context_index> <receiver> <arg_count> 1116 // CallJSRuntime <context_index> <receiver> <arg_count>
1090 // 1117 //
1091 // Call the JS runtime function that has the |context_index| with the receiver 1118 // Call the JS runtime function that has the |context_index| with the receiver
1092 // in register |receiver| and |arg_count| arguments in subsequent registers. 1119 // in register |receiver| and |arg_count| arguments in subsequent registers.
1093 void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) { 1120 void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) {
1094 Node* context_index = __ BytecodeOperandIdx(0); 1121 Node* context_index = __ BytecodeOperandIdx(0);
1095 Node* receiver_reg = __ BytecodeOperandReg(1); 1122 Node* receiver_reg = __ BytecodeOperandReg(1);
1096 Node* first_arg = __ RegisterLocation(receiver_reg); 1123 Node* first_arg = __ RegisterLocation(receiver_reg);
1097 Node* args_count = __ BytecodeOperandCount(2); 1124 Node* args_count = __ BytecodeOperandCount(2);
1098 1125
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 Node* index_reg = __ BytecodeOperandReg(0); 1753 Node* index_reg = __ BytecodeOperandReg(0);
1727 Node* index = __ LoadRegister(index_reg); 1754 Node* index = __ LoadRegister(index_reg);
1728 Node* result = __ CallRuntime(Runtime::kForInStep, index); 1755 Node* result = __ CallRuntime(Runtime::kForInStep, index);
1729 __ SetAccumulator(result); 1756 __ SetAccumulator(result);
1730 __ Dispatch(); 1757 __ Dispatch();
1731 } 1758 }
1732 1759
1733 } // namespace interpreter 1760 } // namespace interpreter
1734 } // namespace internal 1761 } // namespace internal
1735 } // namespace v8 1762 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | test/unittests/compiler/interpreter-assembler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698