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

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

Issue 2041913002: [interpreter] Remove OperandScale from front stages of pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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 "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/interpreter/bytecode-array-writer.h" 9 #include "src/interpreter/bytecode-array-writer.h"
10 #include "src/interpreter/bytecode-register-allocator.h" 10 #include "src/interpreter/bytecode-register-allocator.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 TemporaryRegisterAllocator* temporary_register_allocator() { 268 TemporaryRegisterAllocator* temporary_register_allocator() {
269 return &temporary_allocator_; 269 return &temporary_allocator_;
270 } 270 }
271 const TemporaryRegisterAllocator* temporary_register_allocator() const { 271 const TemporaryRegisterAllocator* temporary_register_allocator() const {
272 return &temporary_allocator_; 272 return &temporary_allocator_;
273 } 273 }
274 Zone* zone() const { return zone_; } 274 Zone* zone() const { return zone_; }
275 275
276 void EnsureReturn(); 276 void EnsureReturn();
277 277
278 static uint32_t RegisterOperand(Register reg); 278 static uint32_t RegisterOperand(Register reg) {
279 static Register RegisterFromOperand(uint32_t operand); 279 return static_cast<uint32_t>(reg.ToOperand());
280 static uint32_t SignedOperand(int value, OperandSize size); 280 }
281 static uint32_t UnsignedOperand(int value); 281
282 static uint32_t UnsignedOperand(size_t value); 282 static uint32_t SignedOperand(int value) {
283 return static_cast<uint32_t>(value);
284 }
285
286 static uint32_t UnsignedOperand(int value) {
287 DCHECK_GE(value, 0);
288 return static_cast<uint32_t>(value);
289 }
290
291 static uint32_t UnsignedOperand(size_t value) {
292 DCHECK_LE(value, kMaxUInt32);
293 return static_cast<uint32_t>(value);
294 }
283 295
284 private: 296 private:
285 friend class BytecodeRegisterAllocator; 297 friend class BytecodeRegisterAllocator;
286 298
287 static Bytecode BytecodeForBinaryOperation(Token::Value op); 299 static Bytecode BytecodeForBinaryOperation(Token::Value op);
288 static Bytecode BytecodeForCountOperation(Token::Value op); 300 static Bytecode BytecodeForCountOperation(Token::Value op);
289 static Bytecode BytecodeForCompareOperation(Token::Value op); 301 static Bytecode BytecodeForCompareOperation(Token::Value op);
290 static Bytecode BytecodeForStoreNamedProperty(LanguageMode language_mode); 302 static Bytecode BytecodeForStoreNamedProperty(LanguageMode language_mode);
291 static Bytecode BytecodeForStoreKeyedProperty(LanguageMode language_mode); 303 static Bytecode BytecodeForStoreKeyedProperty(LanguageMode language_mode);
292 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); 304 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode);
293 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); 305 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode);
294 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); 306 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode);
295 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); 307 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type);
296 static Bytecode BytecodeForDelete(LanguageMode language_mode); 308 static Bytecode BytecodeForDelete(LanguageMode language_mode);
297 static Bytecode BytecodeForCall(TailCallMode tail_call_mode); 309 static Bytecode BytecodeForCall(TailCallMode tail_call_mode);
298 310
299 void Output(Bytecode bytecode); 311 void Output(Bytecode bytecode);
300 void OutputScaled(Bytecode bytecode, OperandScale operand_scale, 312 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
301 uint32_t operand0, uint32_t operand1, uint32_t operand2, 313 uint32_t operand2, uint32_t operand3);
302 uint32_t operand3); 314 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
303 void OutputScaled(Bytecode bytecode, OperandScale operand_scale, 315 uint32_t operand2);
304 uint32_t operand0, uint32_t operand1, uint32_t operand2); 316 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1);
305 void OutputScaled(Bytecode bytecode, OperandScale operand_scale, 317 void Output(Bytecode bytecode, uint32_t operand0);
306 uint32_t operand0, uint32_t operand1);
307 void OutputScaled(Bytecode bytecode, OperandScale operand_scale,
308 uint32_t operand0);
309 318
310 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, 319 BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode,
311 BytecodeLabel* label); 320 BytecodeLabel* label);
312 321
313
314 bool OperandIsValid(Bytecode bytecode, OperandScale operand_scale,
315 int operand_index, uint32_t operand_value) const;
316 bool RegisterIsValid(Register reg, OperandSize reg_size) const;
317
318 // Attach latest source position to |node|. 322 // Attach latest source position to |node|.
319 void AttachSourceInfo(BytecodeNode* node); 323 void AttachSourceInfo(BytecodeNode* node);
320 324
321 // Gets a constant pool entry for the |object|. 325 // Gets a constant pool entry for the |object|.
322 size_t GetConstantPoolEntry(Handle<Object> object); 326 size_t GetConstantPoolEntry(Handle<Object> object);
323 327
324 // Not implemented as the illegal bytecode is used inside internally 328 // Not implemented as the illegal bytecode is used inside internally
325 // to indicate a bytecode field is not valid or an error has occured 329 // to indicate a bytecode field is not valid or an error has occured
326 // during bytecode generation. 330 // during bytecode generation.
327 BytecodeArrayBuilder& Illegal(); 331 BytecodeArrayBuilder& Illegal();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 BytecodeSourceInfo latest_source_info_; 363 BytecodeSourceInfo latest_source_info_;
360 364
361 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); 365 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder);
362 }; 366 };
363 367
364 } // namespace interpreter 368 } // namespace interpreter
365 } // namespace internal 369 } // namespace internal
366 } // namespace v8 370 } // namespace v8
367 371
368 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 372 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | src/interpreter/bytecode-array-builder.cc » ('j') | src/interpreter/bytecode-array-writer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698