Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…CLOSED TREE
  • Loading branch information...
commit 0341972a83c1e7cb0574490537a93d88bcfbcc30 1 parent bcf4eb9
haytjes authored March 14, 2013
1  js/src/yarr/YarrInterpreter.cpp
@@ -1734,7 +1734,6 @@ class ByteCompiler {
1734 1734
         unsigned numSubpatterns = lastSubpatternId - subpatternId + 1;
1735 1735
         ByteDisjunction* parenthesesDisjunction = js_new<ByteDisjunction>(numSubpatterns, callFrameSize);
1736 1736
 
1737  
-        parenthesesDisjunction->terms.reserve(endTerm - beginTerm + 1);
1738 1737
         parenthesesDisjunction->terms.append(ByteTerm::SubpatternBegin());
1739 1738
         for (unsigned termInParentheses = beginTerm + 1; termInParentheses < endTerm; ++termInParentheses)
1740 1739
             parenthesesDisjunction->terms.append(m_bodyDisjunction->terms[termInParentheses]);
19  js/src/yarr/YarrInterpreter.h
@@ -341,7 +341,7 @@ class ByteDisjunction {
341 341
 struct BytecodePattern {
342 342
     WTF_MAKE_FAST_ALLOCATED;
343 343
 public:
344  
-    BytecodePattern(PassOwnPtr<ByteDisjunction> body, Vector<ByteDisjunction*> &allParenthesesInfo, YarrPattern& pattern, BumpPointerAllocator* allocator)
  344
+    BytecodePattern(PassOwnPtr<ByteDisjunction> body, const Vector<ByteDisjunction*> &allParenthesesInfo, YarrPattern& pattern, BumpPointerAllocator* allocator)
345 345
         : m_body(body)
346 346
         , m_ignoreCase(pattern.m_ignoreCase)
347 347
         , m_multiline(pattern.m_multiline)
@@ -350,17 +350,12 @@ struct BytecodePattern {
350 350
         newlineCharacterClass = pattern.newlineCharacterClass();
351 351
         wordcharCharacterClass = pattern.wordcharCharacterClass();
352 352
 
353  
-        // Trick: 'Steal' the YarrPattern's ParenthesesInfo!
354  
-        // The input vector isn't used afterwards anymore,
355  
-        // that way we don't have to copy the input.
356  
-        JS_ASSERT(m_allParenthesesInfo.size() == 0);
357  
-        m_allParenthesesInfo.swap(allParenthesesInfo);
358  
-
359  
-        // Trick: 'Steal' the YarrPattern's CharacterClasses!
360  
-        // The input vector isn't used afterwards anymore,
361  
-        // that way we don't have to copy the input.
362  
-        JS_ASSERT(m_userCharacterClasses.size() == 0);
363  
-        m_userCharacterClasses.swap(pattern.m_userCharacterClasses);
  353
+        m_allParenthesesInfo.append(allParenthesesInfo);
  354
+        m_userCharacterClasses.append(pattern.m_userCharacterClasses);
  355
+        // 'Steal' the YarrPattern's CharacterClasses!  We clear its
  356
+        // array, so that it won't delete them on destruction.  We'll
  357
+        // take responsibility for that.
  358
+        pattern.m_userCharacterClasses.clear();
364 359
     }
365 360
 
366 361
     ~BytecodePattern()
3  js/src/yarr/YarrPattern.cpp
@@ -491,12 +491,11 @@ class YarrPatternConstructor {
491 491
                     newDisjunction->m_parent = disjunction->m_parent;
492 492
                 }
493 493
                 PatternAlternative* newAlternative = newDisjunction->addNewAlternative();
494  
-                newAlternative->m_terms.reserve(alternative->m_terms.size());
495 494
                 for (unsigned i = 0; i < alternative->m_terms.size(); ++i)
496 495
                     newAlternative->m_terms.append(copyTerm(alternative->m_terms[i], filterStartsWithBOL));
497 496
             }
498 497
         }
499  
-
  498
+        
500 499
         if (newDisjunction)
501 500
             m_pattern.m_disjunctions.append(newDisjunction);
502 501
         return newDisjunction;
9  js/src/yarr/wtfbridge.h
@@ -204,10 +204,6 @@ class Vector {
204 204
         for (T *p = impl.begin(); p != impl.end(); ++p)
205 205
             js_delete(*p);
206 206
     }
207  
-
208  
-    bool reserve(size_t capacity) {
209  
-        return impl.reserve(capacity);
210  
-    }
211 207
 };
212 208
 
213 209
 template<typename T>
@@ -235,11 +231,6 @@ class Vector<OwnPtr<T> > {
235 231
             delete_(*p);
236 232
         return impl.clear();
237 233
     }
238  
-
239  
-    void reserve(size_t capacity) {
240  
-        // XXX yarr-oom
241  
-        (void) impl.reserve(capacity);
242  
-    }
243 234
 };
244 235
 
245 236
 template <typename T, size_t N>

0 notes on commit 0341972

Please sign in to comment.
Something went wrong with that request. Please try again.