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

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

Issue 1362383002: [Interpreter] Add CallRuntime support to the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move function address calculation into bytecode handler and have an option on CEntry stub for argv_… Created 5 years, 2 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 #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 <vector> 8 #include <vector>
9 9
10 #include "src/ast.h" 10 #include "src/ast.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 int feedback_slot, 68 int feedback_slot,
69 LanguageMode language_mode); 69 LanguageMode language_mode);
70 70
71 // Call a JS function. The JSFunction or Callable to be called should be in 71 // Call a JS function. The JSFunction or Callable to be called should be in
72 // |callable|, the receiver should be in |receiver| and all subsequent 72 // |callable|, the receiver should be in |receiver| and all subsequent
73 // arguments should be in registers <receiver + 1> to 73 // arguments should be in registers <receiver + 1> to
74 // <receiver + 1 + arg_count>. 74 // <receiver + 1 + arg_count>.
75 BytecodeArrayBuilder& Call(Register callable, Register receiver, 75 BytecodeArrayBuilder& Call(Register callable, Register receiver,
76 size_t arg_count); 76 size_t arg_count);
77 77
78 // Call the runtime function with |function_id|. The first argument should be
79 // in |first_arg| and all subsequent arguments should be in registers \
80 // <first_arg + 1> to <first_arg + 1 + arg_count>.
81 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id,
82 Register first_arg, size_t arg_count);
83
78 // Operators (register == lhs, accumulator = rhs). 84 // Operators (register == lhs, accumulator = rhs).
79 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg); 85 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg);
80 86
81 // Tests. 87 // Tests.
82 BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg, 88 BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg,
83 LanguageMode language_mode); 89 LanguageMode language_mode);
84 90
85 // Casts 91 // Casts
86 BytecodeArrayBuilder& CastAccumulatorToBoolean(); 92 BytecodeArrayBuilder& CastAccumulatorToBoolean();
87 93
88 // Flow Control. 94 // Flow Control.
89 BytecodeArrayBuilder& Bind(BytecodeLabel* label); 95 BytecodeArrayBuilder& Bind(BytecodeLabel* label);
90 BytecodeArrayBuilder& Jump(BytecodeLabel* label); 96 BytecodeArrayBuilder& Jump(BytecodeLabel* label);
91 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); 97 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label);
92 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); 98 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label);
93 BytecodeArrayBuilder& Return(); 99 BytecodeArrayBuilder& Return();
94 100
95 BytecodeArrayBuilder& EnterBlock(); 101 BytecodeArrayBuilder& EnterBlock();
96 BytecodeArrayBuilder& LeaveBlock(); 102 BytecodeArrayBuilder& LeaveBlock();
97 103
98 private: 104 private:
99 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } 105 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; }
100 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } 106 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; }
101 Isolate* isolate() const { return isolate_; } 107 Isolate* isolate() const { return isolate_; }
102 108
103 static Bytecode BytecodeForBinaryOperation(Token::Value op); 109 static Bytecode BytecodeForBinaryOperation(Token::Value op);
104 static Bytecode BytecodeForCompareOperation(Token::Value op); 110 static Bytecode BytecodeForCompareOperation(Token::Value op);
111
105 static bool FitsInIdxOperand(int value); 112 static bool FitsInIdxOperand(int value);
106 static bool FitsInIdxOperand(size_t value); 113 static bool FitsInIdxOperand(size_t value);
107 static bool FitsInImm8Operand(int value); 114 static bool FitsInImm8Operand(int value);
115 static bool FitsInWideIdxOperand(int value);
116
108 static bool IsJumpWithImm8Operand(Bytecode jump_bytecode); 117 static bool IsJumpWithImm8Operand(Bytecode jump_bytecode);
109 static Bytecode GetJumpWithConstantOperand(Bytecode jump_with_smi8_operand); 118 static Bytecode GetJumpWithConstantOperand(Bytecode jump_with_smi8_operand);
110 119
111 template <size_t N> 120 template <size_t N>
112 INLINE(void Output(Bytecode bytecode, uint32_t(&oprands)[N])); 121 INLINE(void Output(Bytecode bytecode, uint32_t(&oprands)[N]));
113 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, 122 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
114 uint32_t operand2); 123 uint32_t operand2);
115 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); 124 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1);
116 void Output(Bytecode bytecode, uint32_t operand0); 125 void Output(Bytecode bytecode, uint32_t operand0);
117 void Output(Bytecode bytecode); 126 void Output(Bytecode bytecode);
127
118 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, 128 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode,
119 BytecodeLabel* label); 129 BytecodeLabel* label);
120 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target, 130 void PatchJump(const ZoneVector<uint8_t>::iterator& jump_target,
121 ZoneVector<uint8_t>::iterator jump_location); 131 ZoneVector<uint8_t>::iterator jump_location);
122 132
123 void EnsureReturn(); 133 void EnsureReturn();
124 134
125 bool OperandIsValid(Bytecode bytecode, int operand_index, 135 bool OperandIsValid(Bytecode bytecode, int operand_index,
126 uint32_t operand_value) const; 136 uint32_t operand_value) const;
127 bool LastBytecodeInSameBlock() const; 137 bool LastBytecodeInSameBlock() const;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 220
211 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); 221 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope);
212 }; 222 };
213 223
214 224
215 } // namespace interpreter 225 } // namespace interpreter
216 } // namespace internal 226 } // namespace internal
217 } // namespace v8 227 } // namespace v8
218 228
219 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 229 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698