Chromium Code Reviews| Index: src/compiler/interpreter-assembler.cc |
| diff --git a/src/compiler/interpreter-assembler.cc b/src/compiler/interpreter-assembler.cc |
| index 11f75edf8f3360e018325f6eaa8b87b52e9bc2d1..cc52d635a56c8af793205127a6f0b1cac5bc1f6d 100644 |
| --- a/src/compiler/interpreter-assembler.cc |
| +++ b/src/compiler/interpreter-assembler.cc |
| @@ -32,7 +32,7 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, |
| isolate, new (zone) Graph(zone), |
| Linkage::GetInterpreterDispatchDescriptor(zone), kMachPtr, |
| InstructionSelector::SupportedMachineOperatorFlags())), |
| - end_node_(nullptr), |
| + end_nodes_(zone), |
| accumulator_( |
| raw_assembler_->Parameter(Linkage::kInterpreterAccumulatorParameter)), |
| code_generated_(false) {} |
| @@ -193,6 +193,11 @@ Node* InterpreterAssembler::HeapConstant(Handle<HeapObject> object) { |
| } |
| +Node* InterpreterAssembler::BooleanConstant(bool value) { |
| + return raw_assembler_->BooleanConstant(value); |
| +} |
| + |
| + |
| Node* InterpreterAssembler::SmiShiftBitsConstant() { |
| return Int32Constant(kSmiShiftSize + kSmiTagSize); |
| } |
| @@ -341,7 +346,7 @@ void InterpreterAssembler::Return() { |
| Node* tail_call = raw_assembler_->TailCallN( |
| call_descriptor(), exit_trampoline_code_object, args); |
| // This should always be the end node. |
| - SetEndInput(tail_call); |
| + AddEndInput(tail_call); |
| } |
| @@ -350,8 +355,42 @@ Node* InterpreterAssembler::Advance(int delta) { |
| } |
| +Node* InterpreterAssembler::Advance(Node* delta) { |
| + return raw_assembler_->IntPtrAdd(BytecodeOffset(), delta); |
| +} |
| + |
| + |
| +void InterpreterAssembler::Jump(Node* delta) { DispatchTo(Advance(delta)); } |
| + |
| + |
| +void InterpreterAssembler::JumpIfEqual(Node* lhs, Node* rhs, Node* delta) { |
|
Benedikt Meurer
2015/09/17 17:04:17
Nit: Can you rename that to JumpIfWordEqual or som
oth
2015/09/23 10:46:55
Done.
|
| + RawMachineAssembler::Label match, no_match; |
| + Node* condition = raw_assembler_->WordEqual(lhs, rhs); |
| + raw_assembler_->Branch(condition, &match, &no_match); |
| + raw_assembler_->Bind(&match); |
| + DispatchTo(Advance(delta)); |
| + raw_assembler_->Bind(&no_match); |
| + Dispatch(); |
| +} |
| + |
| + |
| +void InterpreterAssembler::JumpIfNotEqual(Node* lhs, Node* rhs, Node* delta) { |
|
Benedikt Meurer
2015/09/17 17:04:17
Same here.
rmcilroy
2015/09/18 10:42:23
Looks like you don't use this yet, let's just remo
oth
2015/09/23 10:46:55
Done.
oth
2015/09/23 10:46:55
Acknowledged.
|
| + RawMachineAssembler::Label match, no_match; |
| + Node* condition = raw_assembler_->WordNotEqual(lhs, rhs); |
| + raw_assembler_->Branch(condition, &match, &no_match); |
| + raw_assembler_->Bind(&match); |
| + DispatchTo(Advance(delta)); |
| + raw_assembler_->Bind(&no_match); |
| + Dispatch(); |
| +} |
| + |
| + |
| void InterpreterAssembler::Dispatch() { |
| - Node* new_bytecode_offset = Advance(interpreter::Bytecodes::Size(bytecode_)); |
| + DispatchTo(Advance(interpreter::Bytecodes::Size(bytecode_))); |
| +} |
| + |
| + |
| +void InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) { |
| Node* target_bytecode = raw_assembler_->Load( |
| kMachUint8, BytecodeArrayTaggedPointer(), new_bytecode_offset); |
| @@ -378,20 +417,21 @@ void InterpreterAssembler::Dispatch() { |
| Node* tail_call = |
| raw_assembler_->TailCallN(call_descriptor(), target_code_object, args); |
| // This should always be the end node. |
| - SetEndInput(tail_call); |
| + AddEndInput(tail_call); |
| } |
| -void InterpreterAssembler::SetEndInput(Node* input) { |
| - DCHECK(!end_node_); |
| - end_node_ = input; |
| +void InterpreterAssembler::AddEndInput(Node* input) { |
| + DCHECK(input); |
| + end_nodes_.push_back(input); |
| } |
| void InterpreterAssembler::End() { |
| - DCHECK(end_node_); |
| - // TODO(rmcilroy): Support more than 1 end input. |
| - Node* end = graph()->NewNode(raw_assembler_->common()->End(1), end_node_); |
| + DCHECK(end_nodes_.size() > 0); |
|
Benedikt Meurer
2015/09/17 17:04:17
Nit: Use !end_nodes_.empty()
oth
2015/09/23 10:46:55
Done.
|
| + int end_count = static_cast<int>(end_nodes_.size()); |
| + Node* end = graph()->NewNode(raw_assembler_->common()->End(end_count), |
| + end_count, &end_nodes_[0]); |
| graph()->SetEnd(end); |
| } |