Chromium Code Reviews| Index: src/compiler/bytecode-graph-builder.cc |
| diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc |
| index 157a21d03bf1cf7fc220d536f55e20807a4a5b01..8f17adbb97a3223fdb8538ea37b3be28bf7e754a 100644 |
| --- a/src/compiler/bytecode-graph-builder.cc |
| +++ b/src/compiler/bytecode-graph-builder.cc |
| @@ -1018,7 +1018,6 @@ void BytecodeGraphBuilder::BuildBinaryOp( |
| Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| Node* right = environment()->LookupAccumulator(); |
| Node* node = NewNode(js_op, left, right); |
| - |
| AddEmptyFrameStateInputs(node); |
| environment()->BindAccumulator(node); |
| } |
| @@ -1255,15 +1254,15 @@ void BytecodeGraphBuilder::VisitToName( |
| } |
| -void BytecodeGraphBuilder::VisitToNumber( |
| +void BytecodeGraphBuilder::VisitToObject( |
| const interpreter::BytecodeArrayIterator& iterator) { |
| - BuildCastOperator(javascript()->ToNumber(), iterator); |
| + BuildCastOperator(javascript()->ToObject(), iterator); |
| } |
| -void BytecodeGraphBuilder::VisitToObject( |
| +void BytecodeGraphBuilder::VisitToNumber( |
| const interpreter::BytecodeArrayIterator& iterator) { |
| - BuildCastOperator(javascript()->ToObject(), iterator); |
| + BuildCastOperator(javascript()->ToNumber(), iterator); |
| } |
| @@ -1374,19 +1373,56 @@ void BytecodeGraphBuilder::VisitReturn( |
| void BytecodeGraphBuilder::VisitForInPrepare( |
| const interpreter::BytecodeArrayIterator& iterator) { |
| - UNIMPLEMENTED(); |
| + // Bytecode generator only reaches here if the receiver is not null |
| + // or undefined, whereas ast-graph-builder has to check. Bytecodes |
| + // have already cast the object to JSReceiver, but JSForInPrepare |
|
Benedikt Meurer
2015/12/18 07:55:50
Hm, I don't understand this comment. JSForInPrepar
|
| + // will do it again. |
| + Node* receiver = |
| + environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| + Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); |
| + AddEmptyFrameStateInputs(prepare); |
| + Node* cache_type = NewNode(common()->Projection(0), prepare); |
| + Node* cache_array = NewNode(common()->Projection(1), prepare); |
| + Node* cache_length = NewNode(common()->Projection(2), prepare); |
| + environment()->BindRegister(iterator.GetRegisterOperand(1), cache_type); |
| + environment()->BindRegister(iterator.GetRegisterOperand(2), cache_array); |
| + environment()->BindRegister(iterator.GetRegisterOperand(3), cache_length); |
| +} |
| + |
| + |
| +void BytecodeGraphBuilder::VisitForInDone( |
| + const interpreter::BytecodeArrayIterator& iterator) { |
| + Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| + Node* cache_length = |
| + environment()->LookupRegister(iterator.GetRegisterOperand(1)); |
| + Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); |
| + AddEmptyFrameStateInputs(exit_cond); |
| + environment()->BindAccumulator(exit_cond); |
| } |
| void BytecodeGraphBuilder::VisitForInNext( |
| const interpreter::BytecodeArrayIterator& iterator) { |
| - UNIMPLEMENTED(); |
| + Node* receiver = |
| + environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| + Node* cache_type = |
| + environment()->LookupRegister(iterator.GetRegisterOperand(1)); |
| + Node* cache_array = |
| + environment()->LookupRegister(iterator.GetRegisterOperand(2)); |
| + Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(3)); |
| + Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, |
| + cache_type, index); |
| + AddEmptyFrameStateInputs(value); |
| + environment()->BindAccumulator(value); |
| } |
| -void BytecodeGraphBuilder::VisitForInDone( |
| +void BytecodeGraphBuilder::VisitForInStep( |
| const interpreter::BytecodeArrayIterator& iterator) { |
| - UNIMPLEMENTED(); |
| + Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| + index = NewNode(javascript()->ForInStep(), index); |
| + AddEmptyFrameStateInputs(index); |
| + environment()->BindRegister(iterator.GetRegisterOperand(0), index); |
| } |