Index: src/compiler/raw-machine-assembler.cc |
diff --git a/src/compiler/raw-machine-assembler.cc b/src/compiler/raw-machine-assembler.cc |
index 5782eba57410ef5ffbf18347a015c0920b5d4116..fc1df1ecb601f85587e2fb8792d2918783902409 100644 |
--- a/src/compiler/raw-machine-assembler.cc |
+++ b/src/compiler/raw-machine-assembler.cc |
@@ -76,6 +76,20 @@ void RawMachineAssembler::Branch(Node* condition, Label* true_val, |
} |
+void RawMachineAssembler::Switch(Node* index, Label** succ_labels, |
+ size_t succ_count) { |
+ DCHECK_NE(schedule()->end(), current_block_); |
+ Node* sw = NewNode(common()->Switch(succ_count), index); |
+ BasicBlock** succ_blocks = |
+ zone()->NewArray<BasicBlock*>(static_cast<int>(succ_count)); |
+ for (size_t index = 0; index < succ_count; ++index) { |
+ succ_blocks[index] = Use(succ_labels[index]); |
+ } |
+ schedule()->AddSwitch(CurrentBlock(), sw, succ_blocks, succ_count); |
+ current_block_ = nullptr; |
+} |
+ |
+ |
void RawMachineAssembler::Return(Node* value) { |
schedule()->AddReturn(CurrentBlock(), value); |
current_block_ = NULL; |