Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: src/parsing/preparsed-scope-data.cc

Issue 2650703003: [parser]: Skipping inner funcs / initial implemetation of storing scope analysis data from preparse… (Closed)
Patch Set: rebased - argh, forced to format build.gn Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/preparsed-scope-data.h ('k') | src/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparsed-scope-data.cc
diff --git a/src/parsing/preparsed-scope-data.cc b/src/parsing/preparsed-scope-data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..47f1deeecd77fca91981fe70b0b8b095acd71816
--- /dev/null
+++ b/src/parsing/preparsed-scope-data.cc
@@ -0,0 +1,39 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/parsing/preparsed-scope-data.h"
+
+namespace v8 {
+namespace internal {
+
+PreParsedScopeData::ScopeScope::ScopeScope(PreParsedScopeData* data,
+ ScopeType scope_type,
+ int start_position, int end_position)
+ : data_(data),
+ previous_scope_(data->current_scope_),
+ inner_scope_count_(0),
+ variable_count_(0) {
+ data->current_scope_ = this;
+ if (previous_scope_ != nullptr) {
+ ++previous_scope_->inner_scope_count_;
+ }
+
+ data->backing_store_.push_back(scope_type);
+ data->backing_store_.push_back(start_position);
+ data->backing_store_.push_back(end_position);
+ // Reserve space for variable and inner scope count (we don't know yet how
+ // many will be added).
+ index_in_data_ = data->backing_store_.size();
+ data->backing_store_.push_back(-1);
+ data->backing_store_.push_back(-1);
+}
+
+PreParsedScopeData::ScopeScope::~ScopeScope() {
+ data_->current_scope_ = previous_scope_;
+ data_->backing_store_[index_in_data_] = inner_scope_count_;
+ data_->backing_store_[index_in_data_ + 1] = variable_count_;
+}
+
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/parsing/preparsed-scope-data.h ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698