Index: runtime/vm/regexp_assembler_ir.cc |
diff --git a/runtime/vm/regexp_assembler_ir.cc b/runtime/vm/regexp_assembler_ir.cc |
index 2bdc701b8315cd222701a57599d7709d829dae86..fe7c4827b446dddf0bed4595f4091f4389db08c7 100644 |
--- a/runtime/vm/regexp_assembler_ir.cc |
+++ b/runtime/vm/regexp_assembler_ir.cc |
@@ -78,6 +78,7 @@ IRRegExpMacroAssembler::IRRegExpMacroAssembler( |
intptr_t capture_count, |
const ParsedFunction* parsed_function, |
const ZoneGrowableArray<const ICData*>& ic_data_array, |
+ intptr_t osr_id, |
Zone* zone) |
: RegExpMacroAssembler(zone), |
thread_(Thread::Current()), |
@@ -125,7 +126,7 @@ IRRegExpMacroAssembler::IRRegExpMacroAssembler( |
*parsed_function_, |
new (zone) TargetEntryInstr(block_id_.Alloc(), kInvalidTryIndex, |
GetNextDeoptId()), |
- Compiler::kNoOSRDeoptId); |
+ osr_id); |
start_block_ = new (zone) |
JoinEntryInstr(block_id_.Alloc(), kInvalidTryIndex, GetNextDeoptId()); |
success_block_ = new (zone) |
@@ -223,7 +224,7 @@ void IRRegExpMacroAssembler::GenerateEntryBlock() { |
void IRRegExpMacroAssembler::GenerateBacktrackBlock() { |
set_current_instruction(backtrack_block_); |
TAG(); |
- CheckPreemption(); |
+ CheckPreemption(/*is_backtrack=*/true); |
const intptr_t entries_count = entry_block_->indirect_entries().length(); |
@@ -1767,10 +1768,16 @@ IndirectEntryInstr* IRRegExpMacroAssembler::IndirectWithJoinGoto( |
} |
-void IRRegExpMacroAssembler::CheckPreemption() { |
+void IRRegExpMacroAssembler::CheckPreemption(bool is_backtrack) { |
TAG(); |
- AppendInstruction(new (Z) CheckStackOverflowInstr(TokenPosition::kNoSource, 0, |
- GetNextDeoptId())); |
+ |
+ // Setting non-zero loop_depth turns this CheckStackOverflow into |
erikcorry
2017/06/21 07:54:07
This is confusing. "Turns it into an OSR entry" s
Vyacheslav Egorov (Google)
2017/06/21 11:42:04
Done.
|
+ // an OSR entry. |
+ AppendInstruction(new (Z) CheckStackOverflowInstr( |
+ TokenPosition::kNoSource, |
+ /*loop_depth=*/1, GetNextDeoptId(), |
+ is_backtrack ? CheckStackOverflowInstr::kFull |
+ : CheckStackOverflowInstr::kOsrEntry)); |
} |