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

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: 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
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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 Node* function_id = __ BytecodeOperandIdx(0); 1039 Node* function_id = __ BytecodeOperandIdx(0);
1040 Node* first_arg_reg = __ BytecodeOperandReg(1); 1040 Node* first_arg_reg = __ BytecodeOperandReg(1);
1041 Node* first_arg = __ RegisterLocation(first_arg_reg); 1041 Node* first_arg = __ RegisterLocation(first_arg_reg);
1042 Node* args_count = __ BytecodeOperandCount(2); 1042 Node* args_count = __ BytecodeOperandCount(2);
1043 Node* result = __ CallRuntime(function_id, first_arg, args_count); 1043 Node* result = __ CallRuntime(function_id, first_arg, args_count);
1044 __ SetAccumulator(result); 1044 __ SetAccumulator(result);
1045 __ Dispatch(); 1045 __ Dispatch();
1046 } 1046 }
1047 1047
1048 1048
1049 // CallRuntimePair <function_id> <first_arg> <arg_count> <first_return>
1050 //
1051 // Call the runtime function |function_id| which returns a pair, with the
1052 // first argument in register |first_arg| and |arg_count| arguments in
1053 // subsequent registers.
1054 void Interpreter::DoCallRuntimePair(compiler::InterpreterAssembler* assembler) {
1055 // Call the runtime function.
1056 Node* function_id = __ BytecodeOperandIdx(0);
1057 Node* first_arg_reg = __ BytecodeOperandReg(1);
1058 Node* first_arg = __ RegisterLocation(first_arg_reg);
1059 Node* args_count = __ BytecodeOperandCount(2);
1060 Node* result_pair = __ CallRuntimePair(function_id, first_arg, args_count);
1061
1062 // Store the results in <first_return> and <first_return + 1>
1063 Node* first_return_reg = __ BytecodeOperandReg(3);
1064 Node* second_return_reg = __ NextRegister(first_return_reg);
1065 Node* result_0 = __ Projection(0, result_pair);
oth 2016/01/06 16:26:07 More widely used convention result0, result1, e.g.
rmcilroy 2016/01/07 17:21:43 Done.
1066 Node* result_1 = __ Projection(1, result_pair);
1067 __ StoreRegister(result_0, first_return_reg);
1068 __ StoreRegister(result_1, second_return_reg);
1069
1070 __ Dispatch();
1071 }
1072
1073
1049 // CallJSRuntime <context_index> <receiver> <arg_count> 1074 // CallJSRuntime <context_index> <receiver> <arg_count>
1050 // 1075 //
1051 // Call the JS runtime function that has the |context_index| with the receiver 1076 // Call the JS runtime function that has the |context_index| with the receiver
1052 // in register |receiver| and |arg_count| arguments in subsequent registers. 1077 // in register |receiver| and |arg_count| arguments in subsequent registers.
1053 void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) { 1078 void Interpreter::DoCallJSRuntime(compiler::InterpreterAssembler* assembler) {
1054 Node* context_index = __ BytecodeOperandIdx(0); 1079 Node* context_index = __ BytecodeOperandIdx(0);
1055 Node* receiver_reg = __ BytecodeOperandReg(1); 1080 Node* receiver_reg = __ BytecodeOperandReg(1);
1056 Node* first_arg = __ RegisterLocation(receiver_reg); 1081 Node* first_arg = __ RegisterLocation(receiver_reg);
1057 Node* args_count = __ BytecodeOperandCount(2); 1082 Node* args_count = __ BytecodeOperandCount(2);
1058 1083
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 Node* index_reg = __ BytecodeOperandReg(0); 1639 Node* index_reg = __ BytecodeOperandReg(0);
1615 Node* index = __ LoadRegister(index_reg); 1640 Node* index = __ LoadRegister(index_reg);
1616 Node* result = __ CallRuntime(Runtime::kForInStep, index); 1641 Node* result = __ CallRuntime(Runtime::kForInStep, index);
1617 __ SetAccumulator(result); 1642 __ SetAccumulator(result);
1618 __ Dispatch(); 1643 __ Dispatch();
1619 } 1644 }
1620 1645
1621 } // namespace interpreter 1646 } // namespace interpreter
1622 } // namespace internal 1647 } // namespace internal
1623 } // namespace v8 1648 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698