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

Side by Side Diff: src/interpreter/bytecode-array-builder.h

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/compiler/linkage.cc ('k') | src/interpreter/bytecode-array-builder.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 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/interpreter/bytecodes.h" 9 #include "src/interpreter/bytecodes.h"
10 #include "src/interpreter/constant-array-builder.h" 10 #include "src/interpreter/constant-array-builder.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // applied to the constructor. 160 // applied to the constructor.
161 BytecodeArrayBuilder& New(Register constructor, Register first_arg, 161 BytecodeArrayBuilder& New(Register constructor, Register first_arg,
162 size_t arg_count); 162 size_t arg_count);
163 163
164 // Call the runtime function with |function_id|. The first argument should be 164 // Call the runtime function with |function_id|. The first argument should be
165 // in |first_arg| and all subsequent arguments should be in registers 165 // in |first_arg| and all subsequent arguments should be in registers
166 // <first_arg + 1> to <first_arg + 1 + arg_count>. 166 // <first_arg + 1> to <first_arg + 1 + arg_count>.
167 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, 167 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id,
168 Register first_arg, size_t arg_count); 168 Register first_arg, size_t arg_count);
169 169
170 // Call the runtime function with |function_id| that returns a pair of values.
171 // The first argument should be in |first_arg| and all subsequent arguments
172 // should be in registers <first_arg + 1> to <first_arg + 1 + arg_count>. The
173 // return values will be returned in <first_return> and <first_return + 1>.
174 BytecodeArrayBuilder& CallRuntimeForPair(Runtime::FunctionId function_id,
175 Register first_arg, size_t arg_count,
176 Register first_return);
177
170 // Call the JS runtime function with |context_index|. The the receiver should 178 // Call the JS runtime function with |context_index|. The the receiver should
171 // be in |receiver| and all subsequent arguments should be in registers 179 // be in |receiver| and all subsequent arguments should be in registers
172 // <receiver + 1> to <receiver + 1 + arg_count>. 180 // <receiver + 1> to <receiver + 1 + arg_count>.
173 BytecodeArrayBuilder& CallJSRuntime(int context_index, Register receiver, 181 BytecodeArrayBuilder& CallJSRuntime(int context_index, Register receiver,
174 size_t arg_count); 182 size_t arg_count);
175 183
176 // Operators (register holds the lhs value, accumulator holds the rhs value). 184 // Operators (register holds the lhs value, accumulator holds the rhs value).
177 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, 185 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg,
178 Strength strength); 186 Strength strength);
179 187
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void LeaveBasicBlock(); 294 void LeaveBasicBlock();
287 void EnsureReturn(); 295 void EnsureReturn();
288 296
289 bool OperandIsValid(Bytecode bytecode, int operand_index, 297 bool OperandIsValid(Bytecode bytecode, int operand_index,
290 uint32_t operand_value) const; 298 uint32_t operand_value) const;
291 bool LastBytecodeInSameBlock() const; 299 bool LastBytecodeInSameBlock() const;
292 300
293 bool NeedToBooleanCast(); 301 bool NeedToBooleanCast();
294 bool IsRegisterInAccumulator(Register reg); 302 bool IsRegisterInAccumulator(Register reg);
295 303
304 bool RegisterIsValid(Register reg) const;
305
296 // Temporary register management. 306 // Temporary register management.
297 int BorrowTemporaryRegister(); 307 int BorrowTemporaryRegister();
298 int BorrowTemporaryRegisterNotInRange(int start_index, int end_index); 308 int BorrowTemporaryRegisterNotInRange(int start_index, int end_index);
299 int AllocateAndBorrowTemporaryRegister(); 309 int AllocateAndBorrowTemporaryRegister();
300 void ReturnTemporaryRegister(int reg_index); 310 void ReturnTemporaryRegister(int reg_index);
301 int PrepareForConsecutiveTemporaryRegisters(size_t count); 311 int PrepareForConsecutiveTemporaryRegisters(size_t count);
302 void BorrowConsecutiveTemporaryRegister(int reg_index); 312 void BorrowConsecutiveTemporaryRegister(int reg_index);
303 bool TemporaryRegisterIsLive(Register reg) const; 313 bool TemporaryRegisterIsLive(Register reg) const;
304 314
305 Register first_temporary_register() const; 315 Register first_temporary_register() const;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 411
402 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); 412 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope);
403 }; 413 };
404 414
405 415
406 } // namespace interpreter 416 } // namespace interpreter
407 } // namespace internal 417 } // namespace internal
408 } // namespace v8 418 } // namespace v8
409 419
410 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 420 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698