| Index: src/jsregexp.cc
|
| diff --git a/src/jsregexp.cc b/src/jsregexp.cc
|
| index 78cd7df3407bf409687c23189cb0cc8c820a7440..edfead9483c7f1ed1b97e8b6668461ad022dceb8 100644
|
| --- a/src/jsregexp.cc
|
| +++ b/src/jsregexp.cc
|
| @@ -2281,14 +2281,12 @@ int ActionNode::EatsAtLeast(int still_to_find,
|
| }
|
|
|
|
|
| -void ActionNode::FillInBMInfo(int offset,
|
| - int budget,
|
| - BoyerMooreLookahead* bm,
|
| - bool not_at_start) {
|
| +void ActionNode::FillInBMInfo(Isolate* isolate, int offset, int budget,
|
| + BoyerMooreLookahead* bm, bool not_at_start) {
|
| if (action_type_ == BEGIN_SUBMATCH) {
|
| bm->SetRest(offset);
|
| } else if (action_type_ != POSITIVE_SUBMATCH_SUCCESS) {
|
| - on_success()->FillInBMInfo(offset, budget - 1, bm, not_at_start);
|
| + on_success()->FillInBMInfo(isolate, offset, budget - 1, bm, not_at_start);
|
| }
|
| SaveBMInfo(bm, not_at_start, offset);
|
| }
|
| @@ -2310,13 +2308,11 @@ int AssertionNode::EatsAtLeast(int still_to_find,
|
| }
|
|
|
|
|
| -void AssertionNode::FillInBMInfo(int offset,
|
| - int budget,
|
| - BoyerMooreLookahead* bm,
|
| - bool not_at_start) {
|
| +void AssertionNode::FillInBMInfo(Isolate* isolate, int offset, int budget,
|
| + BoyerMooreLookahead* bm, bool not_at_start) {
|
| // Match the behaviour of EatsAtLeast on this node.
|
| if (assertion_type() == AT_START && not_at_start) return;
|
| - on_success()->FillInBMInfo(offset, budget - 1, bm, not_at_start);
|
| + on_success()->FillInBMInfo(isolate, offset, budget - 1, bm, not_at_start);
|
| SaveBMInfo(bm, not_at_start, offset);
|
| }
|
|
|
| @@ -2945,16 +2941,14 @@ void LoopChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details,
|
| }
|
|
|
|
|
| -void LoopChoiceNode::FillInBMInfo(int offset,
|
| - int budget,
|
| - BoyerMooreLookahead* bm,
|
| - bool not_at_start) {
|
| +void LoopChoiceNode::FillInBMInfo(Isolate* isolate, int offset, int budget,
|
| + BoyerMooreLookahead* bm, bool not_at_start) {
|
| if (body_can_be_zero_length_ || budget <= 0) {
|
| bm->SetRest(offset);
|
| SaveBMInfo(bm, not_at_start, offset);
|
| return;
|
| }
|
| - ChoiceNode::FillInBMInfo(offset, budget - 1, bm, not_at_start);
|
| + ChoiceNode::FillInBMInfo(isolate, offset, budget - 1, bm, not_at_start);
|
| SaveBMInfo(bm, not_at_start, offset);
|
| }
|
|
|
| @@ -3046,6 +3040,7 @@ static void EmitHat(RegExpCompiler* compiler,
|
| // Emit the code to handle \b and \B (word-boundary or non-word-boundary).
|
| void AssertionNode::EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace) {
|
| RegExpMacroAssembler* assembler = compiler->macro_assembler();
|
| + Isolate* isolate = assembler->isolate();
|
| Trace::TriBool next_is_word_character = Trace::UNKNOWN;
|
| bool not_at_start = (trace->at_start() == Trace::FALSE_VALUE);
|
| BoyerMooreLookahead* lookahead = bm_info(not_at_start);
|
| @@ -3057,7 +3052,7 @@ void AssertionNode::EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace) {
|
| if (eats_at_least >= 1) {
|
| BoyerMooreLookahead* bm =
|
| new(zone()) BoyerMooreLookahead(eats_at_least, compiler, zone());
|
| - FillInBMInfo(0, kRecursionBudget, bm, not_at_start);
|
| + FillInBMInfo(isolate, 0, kRecursionBudget, bm, not_at_start);
|
| if (bm->at(0)->is_non_word())
|
| next_is_word_character = Trace::FALSE_VALUE;
|
| if (bm->at(0)->is_word()) next_is_word_character = Trace::TRUE_VALUE;
|
| @@ -4072,6 +4067,7 @@ int ChoiceNode::EmitOptimizedUnanchoredSearch(RegExpCompiler* compiler,
|
| DCHECK(trace->is_trivial());
|
|
|
| RegExpMacroAssembler* macro_assembler = compiler->macro_assembler();
|
| + Isolate* isolate = macro_assembler->isolate();
|
| // At this point we know that we are at a non-greedy loop that will eat
|
| // any character one at a time. Any non-anchored regexp has such a
|
| // loop prepended to it in order to find where it starts. We look for
|
| @@ -4090,7 +4086,7 @@ int ChoiceNode::EmitOptimizedUnanchoredSearch(RegExpCompiler* compiler,
|
| compiler,
|
| zone());
|
| GuardedAlternative alt0 = alternatives_->at(0);
|
| - alt0.node()->FillInBMInfo(0, kRecursionBudget, bm, false);
|
| + alt0.node()->FillInBMInfo(isolate, 0, kRecursionBudget, bm, false);
|
| }
|
| }
|
| if (bm != NULL) {
|
| @@ -5825,8 +5821,7 @@ void Analysis::VisitAssertion(AssertionNode* that) {
|
| }
|
|
|
|
|
| -void BackReferenceNode::FillInBMInfo(int offset,
|
| - int budget,
|
| +void BackReferenceNode::FillInBMInfo(Isolate* isolate, int offset, int budget,
|
| BoyerMooreLookahead* bm,
|
| bool not_at_start) {
|
| // Working out the set of characters that a backreference can match is too
|
| @@ -5840,10 +5835,8 @@ STATIC_ASSERT(BoyerMoorePositionInfo::kMapSize ==
|
| RegExpMacroAssembler::kTableSize);
|
|
|
|
|
| -void ChoiceNode::FillInBMInfo(int offset,
|
| - int budget,
|
| - BoyerMooreLookahead* bm,
|
| - bool not_at_start) {
|
| +void ChoiceNode::FillInBMInfo(Isolate* isolate, int offset, int budget,
|
| + BoyerMooreLookahead* bm, bool not_at_start) {
|
| ZoneList<GuardedAlternative>* alts = alternatives();
|
| budget = (budget - 1) / alts->length();
|
| for (int i = 0; i < alts->length(); i++) {
|
| @@ -5853,16 +5846,14 @@ void ChoiceNode::FillInBMInfo(int offset,
|
| SaveBMInfo(bm, not_at_start, offset);
|
| return;
|
| }
|
| - alt.node()->FillInBMInfo(offset, budget, bm, not_at_start);
|
| + alt.node()->FillInBMInfo(isolate, offset, budget, bm, not_at_start);
|
| }
|
| SaveBMInfo(bm, not_at_start, offset);
|
| }
|
|
|
|
|
| -void TextNode::FillInBMInfo(int initial_offset,
|
| - int budget,
|
| - BoyerMooreLookahead* bm,
|
| - bool not_at_start) {
|
| +void TextNode::FillInBMInfo(Isolate* isolate, int initial_offset, int budget,
|
| + BoyerMooreLookahead* bm, bool not_at_start) {
|
| if (initial_offset >= bm->length()) return;
|
| int offset = initial_offset;
|
| int max_char = bm->max_char();
|
| @@ -5883,9 +5874,7 @@ void TextNode::FillInBMInfo(int initial_offset,
|
| if (bm->compiler()->ignore_case()) {
|
| unibrow::uchar chars[unibrow::Ecma262UnCanonicalize::kMaxWidth];
|
| int length = GetCaseIndependentLetters(
|
| - Isolate::Current(),
|
| - character,
|
| - bm->max_char() == String::kMaxOneByteCharCode,
|
| + isolate, character, bm->max_char() == String::kMaxOneByteCharCode,
|
| chars);
|
| for (int j = 0; j < length; j++) {
|
| bm->Set(offset, chars[j]);
|
| @@ -5915,9 +5904,7 @@ void TextNode::FillInBMInfo(int initial_offset,
|
| if (initial_offset == 0) set_bm_info(not_at_start, bm);
|
| return;
|
| }
|
| - on_success()->FillInBMInfo(offset,
|
| - budget - 1,
|
| - bm,
|
| + on_success()->FillInBMInfo(isolate, offset, budget - 1, bm,
|
| true); // Not at start after a text node.
|
| if (initial_offset == 0) set_bm_info(not_at_start, bm);
|
| }
|
|
|