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

Side by Side Diff: src/parsing/parse-info.h

Issue 2650883002: Reland: [Compiler] Enable handles created during parsing and scope analysis to be deferred. (Closed)
Patch Set: Remove unused variable Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/handles.h ('k') | src/parsing/parse-info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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_PARSING_PARSE_INFO_H_ 5 #ifndef V8_PARSING_PARSE_INFO_H_
6 #define V8_PARSING_PARSE_INFO_H_ 6 #define V8_PARSING_PARSE_INFO_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "include/v8.h" 10 #include "include/v8.h"
11 #include "src/globals.h" 11 #include "src/globals.h"
12 #include "src/handles.h" 12 #include "src/handles.h"
13 #include "src/parsing/preparsed-scope-data.h" 13 #include "src/parsing/preparsed-scope-data.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 16
17 class Extension; 17 class Extension;
18 18
19 namespace internal { 19 namespace internal {
20 20
21 class AccountingAllocator; 21 class AccountingAllocator;
22 class AstRawString; 22 class AstRawString;
23 class AstValueFactory; 23 class AstValueFactory;
24 class DeclarationScope; 24 class DeclarationScope;
25 class DeferredHandles;
25 class FunctionLiteral; 26 class FunctionLiteral;
26 class ScriptData; 27 class ScriptData;
27 class SharedFunctionInfo; 28 class SharedFunctionInfo;
28 class UnicodeCache; 29 class UnicodeCache;
29 class Utf16CharacterStream; 30 class Utf16CharacterStream;
30 class Zone; 31 class Zone;
31 32
32 // A container for the inputs, configuration options, and outputs of parsing. 33 // A container for the inputs, configuration options, and outputs of parsing.
33 class V8_EXPORT_PRIVATE ParseInfo { 34 class V8_EXPORT_PRIVATE ParseInfo {
34 public: 35 public:
35 explicit ParseInfo(AccountingAllocator* zone_allocator); 36 explicit ParseInfo(AccountingAllocator* zone_allocator);
36 ParseInfo(Handle<Script> script); 37 ParseInfo(Handle<Script> script);
37 ParseInfo(Handle<SharedFunctionInfo> shared); 38 ParseInfo(Handle<SharedFunctionInfo> shared);
38 39
39 // TODO(rmcilroy): Remove once Hydrogen no longer needs this. 40 // TODO(rmcilroy): Remove once Hydrogen no longer needs this.
40 ParseInfo(Handle<SharedFunctionInfo> shared, std::shared_ptr<Zone> zone); 41 ParseInfo(Handle<SharedFunctionInfo> shared, std::shared_ptr<Zone> zone);
41 42
42 ~ParseInfo(); 43 ~ParseInfo();
43 44
44 Zone* zone() const { return zone_.get(); } 45 Zone* zone() const { return zone_.get(); }
45 46
46 std::shared_ptr<Zone> zone_shared() const { return zone_; } 47 std::shared_ptr<Zone> zone_shared() const { return zone_; }
47 48
49 void set_deferred_handles(std::shared_ptr<DeferredHandles> deferred_handles);
50 void set_deferred_handles(DeferredHandles* deferred_handles);
51 std::shared_ptr<DeferredHandles> deferred_handles() const {
52 return deferred_handles_;
53 }
54
48 // Convenience accessor methods for flags. 55 // Convenience accessor methods for flags.
49 #define FLAG_ACCESSOR(flag, getter, setter) \ 56 #define FLAG_ACCESSOR(flag, getter, setter) \
50 bool getter() const { return GetFlag(flag); } \ 57 bool getter() const { return GetFlag(flag); } \
51 void setter() { SetFlag(flag); } \ 58 void setter() { SetFlag(flag); } \
52 void setter(bool val) { SetFlag(flag, val); } 59 void setter(bool val) { SetFlag(flag, val); }
53 60
54 FLAG_ACCESSOR(kToplevel, is_toplevel, set_toplevel) 61 FLAG_ACCESSOR(kToplevel, is_toplevel, set_toplevel)
55 FLAG_ACCESSOR(kEval, is_eval, set_eval) 62 FLAG_ACCESSOR(kEval, is_eval, set_eval)
56 FLAG_ACCESSOR(kStrictMode, is_strict_mode, set_strict_mode) 63 FLAG_ACCESSOR(kStrictMode, is_strict_mode, set_strict_mode)
57 FLAG_ACCESSOR(kNative, is_native, set_native) 64 FLAG_ACCESSOR(kNative, is_native, set_native)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 201
195 LanguageMode language_mode() const { 202 LanguageMode language_mode() const {
196 return construct_language_mode(is_strict_mode()); 203 return construct_language_mode(is_strict_mode());
197 } 204 }
198 void set_language_mode(LanguageMode language_mode) { 205 void set_language_mode(LanguageMode language_mode) {
199 STATIC_ASSERT(LANGUAGE_END == 2); 206 STATIC_ASSERT(LANGUAGE_END == 2);
200 set_strict_mode(is_strict(language_mode)); 207 set_strict_mode(is_strict(language_mode));
201 } 208 }
202 209
203 void ReopenHandlesInNewHandleScope() { 210 void ReopenHandlesInNewHandleScope() {
204 shared_ = Handle<SharedFunctionInfo>(*shared_); 211 if (!script_.is_null()) {
205 script_ = Handle<Script>(*script_); 212 script_ = Handle<Script>(*script_);
213 }
214 if (!shared_.is_null()) {
215 shared_ = Handle<SharedFunctionInfo>(*shared_);
216 }
206 Handle<ScopeInfo> outer_scope_info; 217 Handle<ScopeInfo> outer_scope_info;
207 if (maybe_outer_scope_info_.ToHandle(&outer_scope_info)) { 218 if (maybe_outer_scope_info_.ToHandle(&outer_scope_info)) {
208 maybe_outer_scope_info_ = Handle<ScopeInfo>(*outer_scope_info); 219 maybe_outer_scope_info_ = Handle<ScopeInfo>(*outer_scope_info);
209 } 220 }
210 } 221 }
211 222
212 #ifdef DEBUG 223 #ifdef DEBUG
213 bool script_is_native() const; 224 bool script_is_native() const;
214 #endif // DEBUG 225 #endif // DEBUG
215 226
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 MaybeHandle<ScopeInfo> maybe_outer_scope_info_; 270 MaybeHandle<ScopeInfo> maybe_outer_scope_info_;
260 271
261 //----------- Inputs+Outputs of parsing and scope analysis ----------------- 272 //----------- Inputs+Outputs of parsing and scope analysis -----------------
262 ScriptData** cached_data_; // used if available, populated if requested. 273 ScriptData** cached_data_; // used if available, populated if requested.
263 PreParsedScopeData preparsed_scope_data_; 274 PreParsedScopeData preparsed_scope_data_;
264 AstValueFactory* ast_value_factory_; // used if available, otherwise new. 275 AstValueFactory* ast_value_factory_; // used if available, otherwise new.
265 const AstRawString* function_name_; 276 const AstRawString* function_name_;
266 277
267 //----------- Output of parsing and scope analysis ------------------------ 278 //----------- Output of parsing and scope analysis ------------------------
268 FunctionLiteral* literal_; 279 FunctionLiteral* literal_;
280 std::shared_ptr<DeferredHandles> deferred_handles_;
269 281
270 void SetFlag(Flag f) { flags_ |= f; } 282 void SetFlag(Flag f) { flags_ |= f; }
271 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; } 283 void SetFlag(Flag f, bool v) { flags_ = v ? flags_ | f : flags_ & ~f; }
272 bool GetFlag(Flag f) const { return (flags_ & f) != 0; } 284 bool GetFlag(Flag f) const { return (flags_ & f) != 0; }
273 }; 285 };
274 286
275 } // namespace internal 287 } // namespace internal
276 } // namespace v8 288 } // namespace v8
277 289
278 #endif // V8_PARSING_PARSE_INFO_H_ 290 #endif // V8_PARSING_PARSE_INFO_H_
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/parsing/parse-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698