Chromium Code Reviews| Index: src/parser.h |
| diff --git a/src/parser.h b/src/parser.h |
| index cb13f716e985a0b9200f21bd1cd49b39a601c0a6..6c8795fd9ca155904290ff243bf14403056e9f9d 100644 |
| --- a/src/parser.h |
| +++ b/src/parser.h |
| @@ -82,15 +82,22 @@ class FunctionEntry BASE_EMBEDDED { |
| }; |
| -class ScriptDataImpl : public ScriptData { |
| +class ScriptDataImpl { |
|
Sven Panne
2014/04/07 12:44:44
Rename this to simply ScriptData, or perhaps even
marja
2014/04/09 12:53:55
Done.
|
| public: |
| + // Create an empty ScriptDataImpl that is guaranteed to not satisfy |
| + // a SanityCheck. |
| + ScriptDataImpl() : owns_store_(false) { } |
| + |
| + // Won't take ownership of the data. |
| + ScriptDataImpl(const char* data, int length); |
| + |
| explicit ScriptDataImpl(Vector<unsigned> store) |
| : store_(store), |
| owns_store_(true) { } |
| - // Create an empty ScriptDataImpl that is guaranteed to not satisfy |
| - // a SanityCheck. |
| - ScriptDataImpl() : owns_store_(false) { } |
| + // ScriptDataImpl won't take ownership of data. If the alignment is not |
| + // correct, this will copy the data (and take ownership of the copy). |
| + static ScriptDataImpl* New(const char* data, int length); |
|
Sven Panne
2014/04/07 12:44:44
I can't see the implementation of this function.
marja
2014/04/09 12:53:55
Oops. This doesn't exist, ScriptDataImpl(const cha
|
| virtual ~ScriptDataImpl(); |
| virtual int Length(); |
| @@ -128,6 +135,10 @@ class ScriptDataImpl : public ScriptData { |
| unsigned version() { return store_[PreparseDataConstants::kVersionOffset]; } |
| private: |
| + // Disable copying and assigning; because of owns_store they won't be correct. |
| + ScriptDataImpl(const ScriptDataImpl&); |
| + ScriptDataImpl& operator=(const ScriptDataImpl&); |
| + |
| friend class v8::ScriptCompiler; |
| Vector<unsigned> store_; |
| unsigned char* symbol_data_; |
| @@ -140,30 +151,8 @@ class ScriptDataImpl : public ScriptData { |
| // Reads a number from the current symbols |
| int ReadNumber(byte** source); |
| - ScriptDataImpl(const char* backing_store, int length) |
| - : store_(reinterpret_cast<unsigned*>(const_cast<char*>(backing_store)), |
| - length / static_cast<int>(sizeof(unsigned))), |
| - owns_store_(false) { |
| - ASSERT_EQ(0, static_cast<int>( |
| - reinterpret_cast<intptr_t>(backing_store) % sizeof(unsigned))); |
| - } |
| - |
| // Read strings written by ParserRecorder::WriteString. |
| static const char* ReadString(unsigned* start, int* chars); |
| - |
| - friend class ScriptData; |
| -}; |
| - |
| - |
| -class PreParserApi { |
| - public: |
| - // Pre-parse a character stream and return full preparse data. |
| - // |
| - // This interface is here instead of in preparser.h because it instantiates a |
| - // preparser recorder object that is suited to the parser's purposes. Also, |
| - // the preparser doesn't know about ScriptDataImpl. |
| - static ScriptDataImpl* PreParse(Isolate* isolate, |
| - Utf16CharacterStream* source); |
| }; |