Remove Isolate::Current() call from jsregexp
BUG=none R=vogelheim@chromium.org LOG=n Review URL: https://codereview.chromium.org/1143583002 Cr-Commit-Position: refs/heads/master@{#28410}
This commit is contained in:
parent
85c91f639e
commit
3a319037df
@ -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);
|
||||
}
|
||||
|
@ -619,10 +619,8 @@ class RegExpNode: public ZoneObject {
|
||||
// the number of nodes we are willing to look at in order to create this data.
|
||||
static const int kRecursionBudget = 200;
|
||||
bool KeepRecursing(RegExpCompiler* compiler);
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start) {
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
@ -731,11 +729,9 @@ class SeqRegExpNode: public RegExpNode {
|
||||
RegExpNode* on_success() { return on_success_; }
|
||||
void set_on_success(RegExpNode* node) { on_success_ = node; }
|
||||
virtual RegExpNode* FilterOneByte(int depth, bool ignore_case);
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start) {
|
||||
on_success_->FillInBMInfo(offset, budget - 1, bm, not_at_start);
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start) {
|
||||
on_success_->FillInBMInfo(isolate, offset, budget - 1, bm, not_at_start);
|
||||
if (offset == 0) set_bm_info(not_at_start, bm);
|
||||
}
|
||||
|
||||
@ -786,10 +782,8 @@ class ActionNode: public SeqRegExpNode {
|
||||
return on_success()->GetQuickCheckDetails(
|
||||
details, compiler, filled_in, not_at_start);
|
||||
}
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start);
|
||||
ActionType action_type() { return action_type_; }
|
||||
// TODO(erikcorry): We should allow some action nodes in greedy loops.
|
||||
virtual int GreedyLoopTextLength() { return kNodeIsTooComplexForGreedyLoops; }
|
||||
@ -855,10 +849,8 @@ class TextNode: public SeqRegExpNode {
|
||||
virtual int GreedyLoopTextLength();
|
||||
virtual RegExpNode* GetSuccessorOfOmnivorousTextNode(
|
||||
RegExpCompiler* compiler);
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start);
|
||||
void CalculateOffsets();
|
||||
virtual RegExpNode* FilterOneByte(int depth, bool ignore_case);
|
||||
|
||||
@ -915,10 +907,8 @@ class AssertionNode: public SeqRegExpNode {
|
||||
RegExpCompiler* compiler,
|
||||
int filled_in,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start);
|
||||
AssertionType assertion_type() { return assertion_type_; }
|
||||
|
||||
private:
|
||||
@ -954,10 +944,8 @@ class BackReferenceNode: public SeqRegExpNode {
|
||||
bool not_at_start) {
|
||||
return;
|
||||
}
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start);
|
||||
|
||||
private:
|
||||
int start_reg_;
|
||||
@ -982,10 +970,8 @@ class EndNode: public RegExpNode {
|
||||
// Returning 0 from EatsAtLeast should ensure we never get here.
|
||||
UNREACHABLE();
|
||||
}
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start) {
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start) {
|
||||
// Returning 0 from EatsAtLeast should ensure we never get here.
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -1077,10 +1063,8 @@ class ChoiceNode: public RegExpNode {
|
||||
RegExpCompiler* compiler,
|
||||
int characters_filled_in,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start);
|
||||
|
||||
bool being_calculated() { return being_calculated_; }
|
||||
bool not_at_start() { return not_at_start_; }
|
||||
@ -1146,12 +1130,10 @@ class NegativeLookaheadChoiceNode: public ChoiceNode {
|
||||
RegExpCompiler* compiler,
|
||||
int characters_filled_in,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start) {
|
||||
alternatives_->at(1).node()->FillInBMInfo(
|
||||
offset, budget - 1, bm, not_at_start);
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start) {
|
||||
alternatives_->at(1).node()->FillInBMInfo(isolate, offset, budget - 1, bm,
|
||||
not_at_start);
|
||||
if (offset == 0) set_bm_info(not_at_start, bm);
|
||||
}
|
||||
// For a negative lookahead we don't emit the quick check for the
|
||||
@ -1182,10 +1164,8 @@ class LoopChoiceNode: public ChoiceNode {
|
||||
RegExpCompiler* compiler,
|
||||
int characters_filled_in,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(int offset,
|
||||
int budget,
|
||||
BoyerMooreLookahead* bm,
|
||||
bool not_at_start);
|
||||
virtual void FillInBMInfo(Isolate* isolate, int offset, int budget,
|
||||
BoyerMooreLookahead* bm, bool not_at_start);
|
||||
RegExpNode* loop_node() { return loop_node_; }
|
||||
RegExpNode* continue_node() { return continue_node_; }
|
||||
bool body_can_be_zero_length() { return body_can_be_zero_length_; }
|
||||
|
Loading…
Reference in New Issue
Block a user