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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 2951053003: VM(RegExp): Allow OSR optimization of RegExp :matcher functions. (Closed)
Patch Set: Fix bugs with stack growing and block pruning Created 3 years, 6 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
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index cfb7622d3a7f58b48206093d101e2b65f94acd93..a91c26be2a5ab27d2e3196ac79b315e9b112d125 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1084,10 +1084,20 @@ bool BlockEntryInstr::DiscoverBlock(BlockEntryInstr* predecessor,
}
+void GraphEntryInstr::PruneUnreachableForOSR(Zone* zone,
+ intptr_t max_block_id) {
+ ASSERT(osr_id_ != Compiler::kNoOSRDeoptId);
+ BitVector* block_marks = new (zone) BitVector(zone, max_block_id + 1);
+ bool found = PruneUnreachable(this, /*parent=*/NULL, block_marks);
+ ASSERT(found);
+}
+
+
bool BlockEntryInstr::PruneUnreachable(GraphEntryInstr* graph_entry,
Instruction* parent,
- intptr_t osr_id,
BitVector* block_marks) {
+ const intptr_t osr_id = graph_entry->osr_id();
+
// Search for the instruction with the OSR id. Use a depth first search
// because basic blocks have not been discovered yet. Prune unreachable
// blocks by replacing the normal entry with a jump to the block
@@ -1121,7 +1131,7 @@ bool BlockEntryInstr::PruneUnreachable(GraphEntryInstr* graph_entry,
// Recursively search the successors.
for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) {
- if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry, instr, osr_id,
+ if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry, instr,
block_marks)) {
return true;
}
@@ -2066,6 +2076,22 @@ Definition* RedefinitionInstr::Canonicalize(FlowGraph* flow_graph) {
}
+Instruction* CheckStackOverflowInstr::Canonicalize(FlowGraph* flow_graph) {
+ switch (kind_) {
+ case kOsrAndPreemption:
+ return this;
+ case kOsrOnly:
+ // Don't need OSR entries in the optimized code.
+ return NULL;
+ }
+
+ // Switch above exhausts all possibilities but some compilers can't figure
+ // it out.
+ UNREACHABLE();
+ return this;
+}
+
+
bool LoadFieldInstr::IsImmutableLengthLoad() const {
switch (recognized_kind()) {
case MethodRecognizer::kObjectArrayLength:

Powered by Google App Engine
This is Rietveld 408576698