]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/SmallStrings.cpp
JavaScriptCore-621.1.tar.gz
[apple/javascriptcore.git] / runtime / SmallStrings.cpp
index 78bd4e42c4f7b4290695a23dbe11bdd5285b674e..0f5df4a23884bfe40f651fc335dda7a1f13ecfeb 100644 (file)
@@ -43,10 +43,10 @@ class SmallStringsStorage : public Noncopyable {
 public:
     SmallStringsStorage();
 
-    UString::Rep* rep(unsigned char character) { return &m_reps[character]; }
+    UString::Rep* rep(unsigned char character) { return m_reps[character].get(); }
 
 private:
-    UString::Rep m_reps[numCharactersToStore];
+    RefPtr<UString::Rep> m_reps[numCharactersToStore];
 };
 
 SmallStringsStorage::SmallStringsStorage()
@@ -55,7 +55,7 @@ SmallStringsStorage::SmallStringsStorage()
     RefPtr<UStringImpl> baseString = UStringImpl::createUninitialized(numCharactersToStore, characterBuffer);
     for (unsigned i = 0; i < numCharactersToStore; ++i) {
         characterBuffer[i] = i;
-        new (&m_reps[i]) UString::Rep(&characterBuffer[i], 1, PassRefPtr<UStringImpl>(baseString));
+        m_reps[i] = UStringImpl::create(baseString, i, 1);
     }
 }