diff options
Diffstat (limited to 'deps/v8/src/parsing/preparsed-scope-data.h')
-rw-r--r-- | deps/v8/src/parsing/preparsed-scope-data.h | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/deps/v8/src/parsing/preparsed-scope-data.h b/deps/v8/src/parsing/preparsed-scope-data.h index fb8acab696..5d4fc3a3a0 100644 --- a/deps/v8/src/parsing/preparsed-scope-data.h +++ b/deps/v8/src/parsing/preparsed-scope-data.h @@ -5,6 +5,7 @@ #ifndef V8_PARSING_PREPARSED_SCOPE_DATA_H_ #define V8_PARSING_PREPARSED_SCOPE_DATA_H_ +#include <set> #include <unordered_map> #include <vector> @@ -65,40 +66,60 @@ class PreParsedScopeData { // subscopes') variables. void SaveData(Scope* scope); + // Save data for a function we might skip later. The data is used later for + // creating a FunctionLiteral. + void AddSkippableFunction(int start_position, + const PreParseData::FunctionData& function_data); + + // Save variable allocation data for function which contains skippable + // functions. + void AddFunction(int start_position, + const PreParseData::FunctionData& function_data); + + // FIXME(marja): We need different kinds of data for the two types of + // functions. For a skippable function we need the end position + the data + // needed for creating a FunctionLiteral. For a function which contains + // skippable functions, we need the data affecting context allocation status + // of the variables (but e.g., no end position). Currently we just save the + // same data for both. Here we can save less data. + // Restores the information needed for allocating the Scopes's (and its // subscopes') variables. - void RestoreData(Scope* scope, int* index_ptr) const; + void RestoreData(Scope* scope, uint32_t* index_ptr) const; void RestoreData(DeclarationScope* scope) const; - FixedUint32Array* Serialize(Isolate* isolate) const; - void Deserialize(Handle<FixedUint32Array> array); + Handle<PodArray<uint32_t>> Serialize(Isolate* isolate) const; + void Deserialize(PodArray<uint32_t>* array); bool Consuming() const { return has_data_; } bool Producing() const { return !has_data_; } - PreParseData::FunctionData FindFunction(int start_pos) const; + PreParseData::FunctionData FindSkippableFunction(int start_pos) const; private: friend class ScopeTestHelper; void SaveDataForVariable(Variable* var); - void RestoreDataForVariable(Variable* var, int* index_ptr) const; + void RestoreDataForVariable(Variable* var, uint32_t* index_ptr) const; void SaveDataForInnerScopes(Scope* scope); - void RestoreDataForInnerScopes(Scope* scope, int* index_ptr) const; - bool FindFunctionData(int start_pos, int* index) const; + void RestoreDataForInnerScopes(Scope* scope, uint32_t* index_ptr) const; + bool FindFunctionData(int start_pos, uint32_t* index) const; static bool ScopeNeedsData(Scope* scope); static bool IsSkippedFunctionScope(Scope* scope); // TODO(marja): Make the backing store more efficient once we know exactly // what data is needed. - std::vector<byte> backing_store_; + std::vector<uint32_t> backing_store_; - // Start pos -> FunctionData. + // Start pos -> FunctionData. Used for creating FunctionLiterals for skipped + // functions (when they're actually skipped). PreParseData function_index_; // Start pos -> position in backing_store_. std::unordered_map<uint32_t, uint32_t> function_data_positions_; + // Start positions of skippable functions. + std::set<uint32_t> skippable_functions_; bool has_data_ = false; |