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

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

Issue 2650703003: [parser]: Skipping inner funcs / initial implemetation of storing scope analysis data from preparse… (Closed)
Patch Set: bugfixes + tests 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
Index: src/parsing/preparsed-scope-data.h
diff --git a/src/parsing/preparsed-scope-data.h b/src/parsing/preparsed-scope-data.h
new file mode 100644
index 0000000000000000000000000000000000000000..3ca4dd20cbfa4c0201330f7da6b43de14a2699ab
--- /dev/null
+++ b/src/parsing/preparsed-scope-data.h
@@ -0,0 +1,53 @@
+// 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.
+
+#ifndef V8_PARSING_PREPARSED_SCOPE_DATA_H_
+#define V8_PARSING_PREPARSED_SCOPE_DATA_H_
+
+#include <vector>
+
+#include "src/globals.h"
+
+namespace v8 {
+namespace internal {
+
+class PreParsedScopeData {
+ public:
+ PreParsedScopeData() : current_scope_data_(nullptr) {}
+
+ class ScopeData {
vogelheim 2017/01/25 10:00:18 troll nitpick: V8 style calls objects that open+fi
vogelheim 2017/01/25 10:00:18 maybe: Have a PreParsedScopeData::AddScope(ScopeTy
marja 2017/01/25 10:21:26 Used this opportunity to rename it to ScopeScope w
marja 2017/01/25 10:21:26 Acknowledged. Offline discussion: Won't do anythi
+ public:
+ ScopeData(PreParsedScopeData* data, ScopeType scope_type,
+ int start_position, int end_position);
+ ~ScopeData();
+
+ // TODO(marja): The functions for adding information about local variables
+ // will appar here.
vogelheim 2017/01/25 10:00:18 nitpick: appar -> appear.
marja 2017/01/25 10:21:26 Done.
+
+ private:
+ PreParsedScopeData* data_;
+ size_t index_in_data_;
+ ScopeData* previous_scope_;
+
+ int inner_scope_count_;
+ int variable_count_;
+ DISALLOW_COPY_AND_ASSIGN(ScopeData);
+ };
+
+ private:
+ friend class ScopeData;
+ friend class ScopeTestHelper;
+
+ // TODO(marja): Make the backing store more efficient once we know exactly
+ // what data is needed.
+ std::vector<int> backing_store_;
+ ScopeData* current_scope_data_;
+
+ DISALLOW_COPY_AND_ASSIGN(PreParsedScopeData);
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // PREPARSED_SCOPE_DATA_H_
vogelheim 2017/01/25 10:00:18 nitpick: // V8_PARSING_PREPARSED_SCOPE_DATA_H_
marja 2017/01/25 10:21:26 Done.

Powered by Google App Engine
This is Rietveld 408576698