| OLD | NEW | 
|    1 // Copyright 2011 the V8 project authors. All rights reserved. |    1 // Copyright 2011 the V8 project authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef V8_PREPARSE_DATA_H_ |    5 #ifndef V8_PREPARSE_DATA_H_ | 
|    6 #define V8_PREPARSE_DATA_H_ |    6 #define V8_PREPARSE_DATA_H_ | 
|    7  |    7  | 
|    8 #include "src/allocation.h" |    8 #include "src/allocation.h" | 
|    9 #include "src/hashmap.h" |    9 #include "src/hashmap.h" | 
|   10 #include "src/preparse-data-format.h" |   10 #include "src/preparse-data-format.h" | 
|   11 #include "src/utils-inl.h" |   11 #include "src/utils-inl.h" | 
|   12  |   12  | 
|   13 namespace v8 { |   13 namespace v8 { | 
|   14 namespace internal { |   14 namespace internal { | 
|   15  |   15  | 
|   16 class ScriptData; |   16 class ScriptData { | 
 |   17  public: | 
 |   18   ScriptData(const byte* data, int length); | 
 |   19   ~ScriptData() { | 
 |   20     if (owns_data_) DeleteArray(data_); | 
 |   21   } | 
|   17  |   22  | 
 |   23   const byte* data() const { return data_; } | 
 |   24   int length() const { return length_; } | 
 |   25   bool rejected() const { return rejected_; } | 
 |   26  | 
 |   27   void Reject() { rejected_ = true; } | 
 |   28  | 
 |   29   void AcquireDataOwnership() { | 
 |   30     DCHECK(!owns_data_); | 
 |   31     owns_data_ = true; | 
 |   32   } | 
 |   33  | 
 |   34   void ReleaseDataOwnership() { | 
 |   35     DCHECK(owns_data_); | 
 |   36     owns_data_ = false; | 
 |   37   } | 
 |   38  | 
 |   39  private: | 
 |   40   bool owns_data_ : 1; | 
 |   41   bool rejected_ : 1; | 
 |   42   const byte* data_; | 
 |   43   int length_; | 
 |   44  | 
 |   45   DISALLOW_COPY_AND_ASSIGN(ScriptData); | 
 |   46 }; | 
|   18  |   47  | 
|   19 // Abstract interface for preparse data recorder. |   48 // Abstract interface for preparse data recorder. | 
|   20 class ParserRecorder { |   49 class ParserRecorder { | 
|   21  public: |   50  public: | 
|   22   ParserRecorder() { } |   51   ParserRecorder() { } | 
|   23   virtual ~ParserRecorder() { } |   52   virtual ~ParserRecorder() { } | 
|   24  |   53  | 
|   25   // Logs the scope and some details of a function literal in the source. |   54   // Logs the scope and some details of a function literal in the source. | 
|   26   virtual void LogFunction(int start, int end, int literals, int properties, |   55   virtual void LogFunction(int start, int end, int literals, int properties, | 
|   27                            LanguageMode language_mode, |   56                            LanguageMode language_mode, | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  169  |  198  | 
|  170 #ifdef DEBUG |  199 #ifdef DEBUG | 
|  171   int prev_start_; |  200   int prev_start_; | 
|  172 #endif |  201 #endif | 
|  173 }; |  202 }; | 
|  174  |  203  | 
|  175  |  204  | 
|  176 } }  // namespace v8::internal. |  205 } }  // namespace v8::internal. | 
|  177  |  206  | 
|  178 #endif  // V8_PREPARSE_DATA_H_ |  207 #endif  // V8_PREPARSE_DATA_H_ | 
| OLD | NEW |