Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Backed out changeset 9f39547cfab3 (bug 850534) for yarr crashes on a …

…CLOSED TREE
  • Loading branch information...
commit 0341972a83c1e7cb0574490537a93d88bcfbcc30 1 parent bcf4eb9
@h4writer h4writer authored
View
1  js/src/yarr/YarrInterpreter.cpp
@@ -1734,7 +1734,6 @@ class ByteCompiler {
unsigned numSubpatterns = lastSubpatternId - subpatternId + 1;
ByteDisjunction* parenthesesDisjunction = js_new<ByteDisjunction>(numSubpatterns, callFrameSize);
- parenthesesDisjunction->terms.reserve(endTerm - beginTerm + 1);
parenthesesDisjunction->terms.append(ByteTerm::SubpatternBegin());
for (unsigned termInParentheses = beginTerm + 1; termInParentheses < endTerm; ++termInParentheses)
parenthesesDisjunction->terms.append(m_bodyDisjunction->terms[termInParentheses]);
View
19 js/src/yarr/YarrInterpreter.h
@@ -341,7 +341,7 @@ class ByteDisjunction {
struct BytecodePattern {
WTF_MAKE_FAST_ALLOCATED;
public:
- BytecodePattern(PassOwnPtr<ByteDisjunction> body, Vector<ByteDisjunction*> &allParenthesesInfo, YarrPattern& pattern, BumpPointerAllocator* allocator)
+ BytecodePattern(PassOwnPtr<ByteDisjunction> body, const Vector<ByteDisjunction*> &allParenthesesInfo, YarrPattern& pattern, BumpPointerAllocator* allocator)
: m_body(body)
, m_ignoreCase(pattern.m_ignoreCase)
, m_multiline(pattern.m_multiline)
@@ -350,17 +350,12 @@ struct BytecodePattern {
newlineCharacterClass = pattern.newlineCharacterClass();
wordcharCharacterClass = pattern.wordcharCharacterClass();
- // Trick: 'Steal' the YarrPattern's ParenthesesInfo!
- // The input vector isn't used afterwards anymore,
- // that way we don't have to copy the input.
- JS_ASSERT(m_allParenthesesInfo.size() == 0);
- m_allParenthesesInfo.swap(allParenthesesInfo);
-
- // Trick: 'Steal' the YarrPattern's CharacterClasses!
- // The input vector isn't used afterwards anymore,
- // that way we don't have to copy the input.
- JS_ASSERT(m_userCharacterClasses.size() == 0);
- m_userCharacterClasses.swap(pattern.m_userCharacterClasses);
+ m_allParenthesesInfo.append(allParenthesesInfo);
+ m_userCharacterClasses.append(pattern.m_userCharacterClasses);
+ // 'Steal' the YarrPattern's CharacterClasses! We clear its
+ // array, so that it won't delete them on destruction. We'll
+ // take responsibility for that.
+ pattern.m_userCharacterClasses.clear();
}
~BytecodePattern()
View
3  js/src/yarr/YarrPattern.cpp
@@ -491,12 +491,11 @@ class YarrPatternConstructor {
newDisjunction->m_parent = disjunction->m_parent;
}
PatternAlternative* newAlternative = newDisjunction->addNewAlternative();
- newAlternative->m_terms.reserve(alternative->m_terms.size());
for (unsigned i = 0; i < alternative->m_terms.size(); ++i)
newAlternative->m_terms.append(copyTerm(alternative->m_terms[i], filterStartsWithBOL));
}
}
-
+
if (newDisjunction)
m_pattern.m_disjunctions.append(newDisjunction);
return newDisjunction;
View
9 js/src/yarr/wtfbridge.h
@@ -204,10 +204,6 @@ class Vector {
for (T *p = impl.begin(); p != impl.end(); ++p)
js_delete(*p);
}
-
- bool reserve(size_t capacity) {
- return impl.reserve(capacity);
- }
};
template<typename T>
@@ -235,11 +231,6 @@ class Vector<OwnPtr<T> > {
delete_(*p);
return impl.clear();
}
-
- void reserve(size_t capacity) {
- // XXX yarr-oom
- (void) impl.reserve(capacity);
- }
};
template <typename T, size_t N>
Please sign in to comment.
Something went wrong with that request. Please try again.