Chromium Code Reviews| Index: src/interpreter/bytecode-array-builder.h |
| diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h |
| index 32786184dcdaa36c0e281190c707b0e2840f5921..21be0c3b1496e2e212a8ec655087edfe1d6c9c61 100644 |
| --- a/src/interpreter/bytecode-array-builder.h |
| +++ b/src/interpreter/bytecode-array-builder.h |
| @@ -28,14 +28,14 @@ class BytecodeArrayBuilder { |
| BytecodeArrayBuilder(Isolate* isolate, Zone* zone); |
| Handle<BytecodeArray> ToBytecodeArray(); |
| - // Set number of parameters expected by function. |
| + // Set the number of parameters expected by function. |
| void set_parameter_count(int number_of_params); |
| int parameter_count() const { |
| DCHECK_GE(parameter_count_, 0); |
| return parameter_count_; |
| } |
| - // Set number of locals required for bytecode array. |
| + // Set the number of locals required for bytecode array. |
| void set_locals_count(int number_of_locals); |
| int locals_count() const { |
| DCHECK_GE(local_register_count_, 0); |
| @@ -57,7 +57,14 @@ class BytecodeArrayBuilder { |
| Register Parameter(int parameter_index) const; |
| - // Constant loads to the accumulator. |
| + // Return true if the register |reg| represents a parameter or a |
| + // local. |
| + bool RegisterIsParameterOrLocal(Register reg) const; |
| + |
| + // Return true if the register |reg| represents a temporary register. |
| + bool RegisterIsTemporary(Register reg) const; |
| + |
| + // Constant loads to accumulator. |
| BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); |
| BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); |
| BytecodeArrayBuilder& LoadUndefined(); |
| @@ -66,7 +73,7 @@ class BytecodeArrayBuilder { |
| BytecodeArrayBuilder& LoadTrue(); |
| BytecodeArrayBuilder& LoadFalse(); |
| - // Global loads to accumulator and stores from the accumulator. |
| + // Global loads to the accumulator and stores from the accumulator. |
| BytecodeArrayBuilder& LoadGlobal(int slot_index); |
| BytecodeArrayBuilder& StoreGlobal(int slot_index, LanguageMode language_mode); |
| @@ -140,7 +147,7 @@ class BytecodeArrayBuilder { |
| BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg, |
| Strength strength); |
| - // Casts |
| + // Casts. |
| BytecodeArrayBuilder& CastAccumulatorToBoolean(); |
| BytecodeArrayBuilder& CastAccumulatorToName(); |
| @@ -205,9 +212,14 @@ class BytecodeArrayBuilder { |
| size_t GetConstantPoolEntry(Handle<Object> object); |
| - // Scope helpers used by TemporaryRegisterScope |
| int BorrowTemporaryRegister(); |
| void ReturnTemporaryRegister(int reg_index); |
| + int PrepareForConsecutiveTemporaryRegisters(size_t count); |
| + void BorrowConsecutiveTemporaryRegister(int reg_index); |
| + bool TemporaryRegisterIsLive(Register reg) const; |
| + |
| + Register first_temporary_register() const; |
| + Register last_temporary_register() const; |
| Isolate* isolate_; |
| Zone* zone_; |
| @@ -224,10 +236,11 @@ class BytecodeArrayBuilder { |
| int local_register_count_; |
| int context_register_count_; |
| int temporary_register_count_; |
| - int temporary_register_next_; |
| + |
| + ZoneSet<int> free_temporaries_; |
| friend class TemporaryRegisterScope; |
| - DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArrayBuilder); |
| + DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
| }; |
| @@ -277,13 +290,19 @@ class TemporaryRegisterScope { |
| ~TemporaryRegisterScope(); |
| Register NewRegister(); |
| + |
|
rmcilroy
2015/10/20 16:39:20
nit - remove extra newline
oth
2015/10/20 20:58:42
Done.
|
| + void PrepareForConsecutiveAllocations(size_t count); |
| + Register NextConsecutiveRegister(); |
| + |
| private: |
| void* operator new(size_t size); |
| void operator delete(void* p); |
| BytecodeArrayBuilder* builder_; |
| - int count_; |
| - int last_register_index_; |
| + const TemporaryRegisterScope* outer_; |
| + ZoneVector<int> allocated_; |
| + int next_consecutive_register_; |
| + int next_consecutive_count_; |
| DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
| }; |