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

Side by Side Diff: src/interpreter/bytecode-array-builder.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/bytecode-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 } 982 }
983 DCHECK(FitsInIdx8Operand(arg_count)); 983 DCHECK(FitsInIdx8Operand(arg_count));
984 Output(Bytecode::kNew, constructor.ToOperand(), first_arg.ToOperand(), 984 Output(Bytecode::kNew, constructor.ToOperand(), first_arg.ToOperand(),
985 static_cast<uint8_t>(arg_count)); 985 static_cast<uint8_t>(arg_count));
986 return *this; 986 return *this;
987 } 987 }
988 988
989 989
990 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime( 990 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime(
991 Runtime::FunctionId function_id, Register first_arg, size_t arg_count) { 991 Runtime::FunctionId function_id, Register first_arg, size_t arg_count) {
992 DCHECK_EQ(1, Runtime::FunctionForId(function_id)->result_size);
992 DCHECK(FitsInIdx16Operand(function_id)); 993 DCHECK(FitsInIdx16Operand(function_id));
993 DCHECK(FitsInIdx8Operand(arg_count)); 994 DCHECK(FitsInIdx8Operand(arg_count));
994 if (!first_arg.is_valid()) { 995 if (!first_arg.is_valid()) {
995 DCHECK_EQ(0u, arg_count); 996 DCHECK_EQ(0u, arg_count);
996 first_arg = Register(0); 997 first_arg = Register(0);
997 } 998 }
998 Output(Bytecode::kCallRuntime, static_cast<uint16_t>(function_id), 999 Output(Bytecode::kCallRuntime, static_cast<uint16_t>(function_id),
999 first_arg.ToOperand(), static_cast<uint8_t>(arg_count)); 1000 first_arg.ToOperand(), static_cast<uint8_t>(arg_count));
1000 return *this; 1001 return *this;
1001 } 1002 }
1002 1003
1003 1004
1005 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimePair(
oth 2016/01/06 15:09:17 This doesn't look like it's called except in tests
rmcilroy 2016/01/06 15:23:25 Yup, as mentioned in the CL message, this is teste
1006 Runtime::FunctionId function_id, Register first_arg, size_t arg_count,
1007 Register first_return) {
1008 DCHECK_EQ(2, Runtime::FunctionForId(function_id)->result_size);
1009 DCHECK(FitsInIdx16Operand(function_id));
1010 DCHECK(FitsInIdx8Operand(arg_count));
1011 if (!first_arg.is_valid()) {
1012 DCHECK_EQ(0u, arg_count);
1013 first_arg = Register(0);
1014 }
1015 Output(Bytecode::kCallRuntimePair, static_cast<uint16_t>(function_id),
1016 first_arg.ToOperand(), static_cast<uint8_t>(arg_count),
1017 first_return.ToOperand());
1018 return *this;
1019 }
1020
1021
1004 BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(int context_index, 1022 BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(int context_index,
1005 Register receiver, 1023 Register receiver,
1006 size_t arg_count) { 1024 size_t arg_count) {
1007 DCHECK(FitsInIdx16Operand(context_index)); 1025 DCHECK(FitsInIdx16Operand(context_index));
1008 DCHECK(FitsInIdx8Operand(arg_count)); 1026 DCHECK(FitsInIdx8Operand(arg_count));
1009 Output(Bytecode::kCallJSRuntime, static_cast<uint16_t>(context_index), 1027 Output(Bytecode::kCallJSRuntime, static_cast<uint16_t>(context_index),
1010 receiver.ToOperand(), static_cast<uint8_t>(arg_count)); 1028 receiver.ToOperand(), static_cast<uint8_t>(arg_count));
1011 return *this; 1029 return *this;
1012 } 1030 }
1013 1031
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 DCHECK_GT(next_consecutive_count_, 0); 1605 DCHECK_GT(next_consecutive_count_, 0);
1588 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); 1606 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
1589 allocated_.push_back(next_consecutive_register_); 1607 allocated_.push_back(next_consecutive_register_);
1590 next_consecutive_count_--; 1608 next_consecutive_count_--;
1591 return Register(next_consecutive_register_++); 1609 return Register(next_consecutive_register_++);
1592 } 1610 }
1593 1611
1594 } // namespace interpreter 1612 } // namespace interpreter
1595 } // namespace internal 1613 } // namespace internal
1596 } // namespace v8 1614 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698