Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: src/compiler/raw-machine-assembler.cc

Issue 892513003: [turbofan] Initial support for Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Wuschelstudio build. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/schedule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/schedule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698