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

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

Issue 2268513002: Cleanup: Move ParseInfo to a separate file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 3 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/parsing/parse-info.h ('k') | src/parsing/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/parsing/parse-info.h"
6
7 #include "src/ast/ast-value-factory.h"
8 #include "src/ast/ast.h"
9
10 namespace v8 {
11 namespace internal {
12
13 ParseInfo::ParseInfo(Zone* zone)
14 : zone_(zone),
15 flags_(0),
16 source_stream_(nullptr),
17 source_stream_encoding_(ScriptCompiler::StreamedSource::ONE_BYTE),
18 character_stream_(nullptr),
19 extension_(nullptr),
20 compile_options_(ScriptCompiler::kNoCompileOptions),
21 script_scope_(nullptr),
22 unicode_cache_(nullptr),
23 stack_limit_(0),
24 hash_seed_(0),
25 compiler_hints_(0),
26 start_position_(0),
27 end_position_(0),
28 isolate_(nullptr),
29 cached_data_(nullptr),
30 ast_value_factory_(nullptr),
31 function_name_(nullptr),
32 literal_(nullptr) {}
33
34 ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function)
35 : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {
36 set_context(Handle<Context>(function->context()));
37 }
38
39 ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared)
40 : ParseInfo(zone) {
41 isolate_ = shared->GetIsolate();
42
43 set_lazy();
44 set_hash_seed(isolate_->heap()->HashSeed());
45 set_is_named_expression(shared->is_named_expression());
46 set_calls_eval(shared->scope_info()->CallsEval());
47 set_compiler_hints(shared->compiler_hints());
48 set_start_position(shared->start_position());
49 set_end_position(shared->end_position());
50 set_stack_limit(isolate_->stack_guard()->real_climit());
51 set_unicode_cache(isolate_->unicode_cache());
52 set_language_mode(shared->language_mode());
53 set_shared_info(shared);
54
55 Handle<Script> script(Script::cast(shared->script()));
56 set_script(script);
57 if (!script.is_null() && script->type() == Script::TYPE_NATIVE) {
58 set_native();
59 }
60 }
61
62 ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) {
63 isolate_ = script->GetIsolate();
64
65 set_hash_seed(isolate_->heap()->HashSeed());
66 set_stack_limit(isolate_->stack_guard()->real_climit());
67 set_unicode_cache(isolate_->unicode_cache());
68 set_script(script);
69
70 if (script->type() == Script::TYPE_NATIVE) {
71 set_native();
72 }
73 }
74
75 ParseInfo::~ParseInfo() {
marja 2016/08/22 09:37:41 De-inlined
76 if (ast_value_factory_owned()) {
77 delete ast_value_factory_;
78 set_ast_value_factory_owned(false);
79 }
80 ast_value_factory_ = nullptr;
81 }
82
83 DeclarationScope* ParseInfo::scope() const { return literal()->scope(); }
marja 2016/08/22 09:37:41 De-inlined
84
85 bool ParseInfo::is_declaration() const {
86 return (compiler_hints_ & (1 << SharedFunctionInfo::kIsDeclaration)) != 0;
87 }
88
89 bool ParseInfo::is_arrow() const {
90 return (compiler_hints_ & (1 << SharedFunctionInfo::kIsArrow)) != 0;
91 }
92
93 bool ParseInfo::is_async() const {
94 return (compiler_hints_ & (1 << SharedFunctionInfo::kIsAsyncFunction)) != 0;
95 }
96
97 bool ParseInfo::is_default_constructor() const {
98 return (compiler_hints_ & (1 << SharedFunctionInfo::kIsDefaultConstructor)) !=
99 0;
100 }
101
102 FunctionKind ParseInfo::function_kind() const {
103 return SharedFunctionInfo::FunctionKindBits::decode(compiler_hints_);
104 }
105
106 #ifdef DEBUG
107 bool ParseInfo::script_is_native() const {
marja 2016/08/22 09:37:41 De-inlined
108 return script_->type() == Script::TYPE_NATIVE;
109 }
110 #endif // DEBUG
111
112 } // namespace internal
113 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parse-info.h ('k') | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698