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..de0c5a9eff87c0ea1086e4bb197d273686a3f2d3 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,11 @@ 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; | 
| + | 
| + // Constant loads to accumulator. | 
| BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); | 
| BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); | 
| BytecodeArrayBuilder& LoadUndefined(); | 
| @@ -66,7 +70,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 +144,7 @@ class BytecodeArrayBuilder { | 
| BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg, | 
| Strength strength); | 
| - // Casts | 
| + // Casts. | 
| BytecodeArrayBuilder& CastAccumulatorToBoolean(); | 
| BytecodeArrayBuilder& CastAccumulatorToName(); | 
| @@ -206,8 +210,12 @@ class BytecodeArrayBuilder { | 
| size_t GetConstantPoolEntry(Handle<Object> object); | 
| // Scope helpers used by TemporaryRegisterScope | 
| + Register first_temporary_register() const; | 
| + Register last_temporary_register() const; | 
| 
 
rmcilroy
2015/10/19 12:56:22
nit - move getters below TemporaryRegisterIsLive()
 
oth
2015/10/20 15:28:52
Done.
 
 | 
| int BorrowTemporaryRegister(); | 
| void ReturnTemporaryRegister(int reg_index); | 
| + void PrepareForConsecutiveTemporaryRegisters(size_t count); | 
| + bool TemporaryRegisterIsLive(Register reg) const; | 
| Isolate* isolate_; | 
| Zone* zone_; | 
| @@ -223,11 +231,11 @@ class BytecodeArrayBuilder { | 
| int parameter_count_; | 
| int local_register_count_; | 
| int context_register_count_; | 
| + ZoneVector<int> free_temporaries_; | 
| int temporary_register_count_; | 
| - int temporary_register_next_; | 
| friend class TemporaryRegisterScope; | 
| - DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArrayBuilder); | 
| + DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 
| }; | 
| @@ -276,14 +284,15 @@ class TemporaryRegisterScope { | 
| explicit TemporaryRegisterScope(BytecodeArrayBuilder* builder); | 
| ~TemporaryRegisterScope(); | 
| Register NewRegister(); | 
| + void PrepareForConsecutiveAllocations(size_t count); | 
| 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_; | 
| DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 
| }; |