 Chromium Code Reviews
 Chromium Code Reviews Issue 1852213002:
  [interpreter] Add accumulator use description to bytecodes.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1852213002:
  [interpreter] Add accumulator use description to bytecodes.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/interpreter/interpreter-assembler.cc | 
| diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc | 
| index 8e983e24d2a3735aac941fe387791a67107e699c..f31abf2a12dce08ab60229c802b2796c7f9b6cc1 100644 | 
| --- a/src/interpreter/interpreter-assembler.cc | 
| +++ b/src/interpreter/interpreter-assembler.cc | 
| @@ -31,6 +31,7 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, | 
| bytecode_(bytecode), | 
| operand_scale_(operand_scale), | 
| accumulator_(this, MachineRepresentation::kTagged), | 
| + accumulator_use_(AccumulatorUse::kNone), | 
| context_(this, MachineRepresentation::kTagged), | 
| bytecode_array_(this, MachineRepresentation::kTagged), | 
| disable_stack_check_across_call_(false), | 
| @@ -45,11 +46,23 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, | 
| } | 
| } | 
| -InterpreterAssembler::~InterpreterAssembler() {} | 
| +InterpreterAssembler::~InterpreterAssembler() { | 
| + CHECK_EQ(accumulator_use_, Bytecodes::GetAccumulatorUse(bytecode_)); | 
| 
rmcilroy
2016/04/05 12:59:22
DCHECK_EQ - also please add a comment on how to fi
 
oth
2016/04/05 14:12:10
Comment added and switched to DCHECK though I disa
 | 
| +} | 
| + | 
| +Node* InterpreterAssembler::GetAccumulatorUnchecked() { | 
| + return accumulator_.value(); | 
| +} | 
| -Node* InterpreterAssembler::GetAccumulator() { return accumulator_.value(); } | 
| +Node* InterpreterAssembler::GetAccumulator() { | 
| + DCHECK(Bytecodes::ReadsAccumulator(bytecode_)); | 
| + accumulator_use_ = accumulator_use_ | AccumulatorUse::kRead; | 
| + return GetAccumulatorUnchecked(); | 
| +} | 
| void InterpreterAssembler::SetAccumulator(Node* value) { | 
| + DCHECK(Bytecodes::WritesAccumulator(bytecode_)); | 
| + accumulator_use_ = accumulator_use_ | AccumulatorUse::kWrite; | 
| accumulator_.Bind(value); | 
| } | 
| @@ -554,7 +567,7 @@ void InterpreterAssembler::DispatchToBytecodeHandler(Node* handler, | 
| } | 
| InterpreterDispatchDescriptor descriptor(isolate()); | 
| - Node* args[] = {GetAccumulator(), RegisterFileRawPointer(), | 
| + Node* args[] = {GetAccumulatorUnchecked(), RegisterFileRawPointer(), | 
| bytecode_offset, BytecodeArrayTaggedPointer(), | 
| DispatchTableRawPointer(), GetContext()}; | 
| TailCall(descriptor, handler, args, 0); | 
| @@ -654,7 +667,7 @@ void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs, | 
| void InterpreterAssembler::TraceBytecode(Runtime::FunctionId function_id) { | 
| CallRuntime(function_id, GetContext(), BytecodeArrayTaggedPointer(), | 
| - SmiTag(BytecodeOffset()), GetAccumulator()); | 
| + SmiTag(BytecodeOffset()), GetAccumulatorUnchecked()); | 
| } | 
| // static |