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

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

Issue 2565093003: [interpreter] Add check for max number of operands. (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | 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/bytecode-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 #include "src/globals.h" 7 #include "src/globals.h"
8 #include "src/interpreter/bytecode-array-writer.h" 8 #include "src/interpreter/bytecode-array-writer.h"
9 #include "src/interpreter/bytecode-dead-code-optimizer.h" 9 #include "src/interpreter/bytecode-dead-code-optimizer.h"
10 #include "src/interpreter/bytecode-label.h" 10 #include "src/interpreter/bytecode-label.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // OperandHelper<OperandType::kImm>::Convert(builder, immediate), 228 // OperandHelper<OperandType::kImm>::Convert(builder, immediate),
229 return BytecodeNode( 229 return BytecodeNode(
230 bytecode, OperandHelper<operand_types>::Convert(builder, operands)..., 230 bytecode, OperandHelper<operand_types>::Convert(builder, operands)...,
231 source_info); 231 source_info);
232 } 232 }
233 }; 233 };
234 234
235 #define DEFINE_BYTECODE_OUTPUT(name, accumulator_use, ...) \ 235 #define DEFINE_BYTECODE_OUTPUT(name, accumulator_use, ...) \
236 template <typename... Operands> \ 236 template <typename... Operands> \
237 void BytecodeArrayBuilder::Output##name(Operands... operands) { \ 237 void BytecodeArrayBuilder::Output##name(Operands... operands) { \
238 static_assert(sizeof...(Operands) <= Bytecodes::kMaxOperands, \
239 "too many operands for bytecode"); \
238 BytecodeNode node(BytecodeNodeBuilder<__VA_ARGS__>::Make<Operands...>( \ 240 BytecodeNode node(BytecodeNodeBuilder<__VA_ARGS__>::Make<Operands...>( \
239 this, CurrentSourcePosition(Bytecode::k##name), Bytecode::k##name, \ 241 this, CurrentSourcePosition(Bytecode::k##name), Bytecode::k##name, \
240 operands...)); \ 242 operands...)); \
241 pipeline()->Write(&node); \ 243 pipeline()->Write(&node); \
242 } \ 244 } \
243 \ 245 \
244 template <typename... Operands> \ 246 template <typename... Operands> \
245 void BytecodeArrayBuilder::Output##name(BytecodeLabel* label, \ 247 void BytecodeArrayBuilder::Output##name(BytecodeLabel* label, \
246 Operands... operands) { \ 248 Operands... operands) { \
247 DCHECK(Bytecodes::IsJump(Bytecode::k##name)); \ 249 DCHECK(Bytecodes::IsJump(Bytecode::k##name)); \
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 RegisterList reg_list) { 1028 RegisterList reg_list) {
1027 DCHECK(RegisterListIsValid(reg_list)); 1029 DCHECK(RegisterListIsValid(reg_list));
1028 if (register_optimizer_) 1030 if (register_optimizer_)
1029 register_optimizer_->PrepareOutputRegisterList(reg_list); 1031 register_optimizer_->PrepareOutputRegisterList(reg_list);
1030 return static_cast<uint32_t>(reg_list.first_register().ToOperand()); 1032 return static_cast<uint32_t>(reg_list.first_register().ToOperand());
1031 } 1033 }
1032 1034
1033 } // namespace interpreter 1035 } // namespace interpreter
1034 } // namespace internal 1036 } // namespace internal
1035 } // namespace v8 1037 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698