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

Side by Side Diff: src/compilation-info.cc

Issue 2399833002: Teach Scopes whether they will end up being lazily compiled or not (Closed)
Patch Set: Created 4 years, 2 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
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 #include "src/compilation-info.h" 5 #include "src/compilation-info.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
11 #include "src/parsing/parse-info.h" 11 #include "src/parsing/parse-info.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 #define PARSE_INFO_GETTER(type, name) \ 16 #define PARSE_INFO_GETTER(type, name) \
17 type CompilationInfo::name() const { \ 17 type CompilationInfo::name() const { \
18 CHECK(parse_info()); \ 18 CHECK(parse_info()); \
19 return parse_info()->name(); \ 19 return parse_info()->name(); \
20 } 20 }
21 21
22 #define PARSE_INFO_GETTER_WITH_DEFAULT(type, name, def) \ 22 #define PARSE_INFO_GETTER_WITH_DEFAULT(type, name, def) \
23 type CompilationInfo::name() const { \ 23 type CompilationInfo::name() const { \
24 return parse_info() ? parse_info()->name() : def; \ 24 return parse_info() ? parse_info()->name() : def; \
25 } 25 }
26 26
27 #define PARSE_INFO_GETTER_AND_SETTER(type, name, def) \
28 type CompilationInfo::name() const { \
29 return parse_info() ? parse_info()->name() : def; \
30 } \
31 \
32 void CompilationInfo::set_##name() { \
33 CHECK(parse_info()); \
34 parse_info()->set_##name(); \
35 }
36
27 PARSE_INFO_GETTER(Handle<Script>, script) 37 PARSE_INFO_GETTER(Handle<Script>, script)
28 PARSE_INFO_GETTER(FunctionLiteral*, literal) 38 PARSE_INFO_GETTER(FunctionLiteral*, literal)
29 PARSE_INFO_GETTER_WITH_DEFAULT(DeclarationScope*, scope, nullptr) 39 PARSE_INFO_GETTER_WITH_DEFAULT(DeclarationScope*, scope, nullptr)
30 PARSE_INFO_GETTER(Handle<SharedFunctionInfo>, shared_info) 40 PARSE_INFO_GETTER(Handle<SharedFunctionInfo>, shared_info)
41 PARSE_INFO_GETTER_AND_SETTER(bool, is_debug, false)
42 PARSE_INFO_GETTER_AND_SETTER(bool, will_serialize, false)
31 43
32 #undef PARSE_INFO_GETTER 44 #undef PARSE_INFO_GETTER
33 #undef PARSE_INFO_GETTER_WITH_DEFAULT 45 #undef PARSE_INFO_GETTER_WITH_DEFAULT
46 #undef PARSE_INFO_GETTER_AND_SETTER
34 47
35 bool CompilationInfo::has_shared_info() const { 48 bool CompilationInfo::has_shared_info() const {
36 return parse_info_ && !parse_info_->shared_info().is_null(); 49 return parse_info_ && !parse_info_->shared_info().is_null();
37 } 50 }
38 51
39 CompilationInfo::CompilationInfo(ParseInfo* parse_info, 52 CompilationInfo::CompilationInfo(ParseInfo* parse_info,
40 Handle<JSFunction> closure) 53 Handle<JSFunction> closure)
41 : CompilationInfo(parse_info, {}, Code::ComputeFlags(Code::FUNCTION), BASE, 54 : CompilationInfo(parse_info, {}, Code::ComputeFlags(Code::FUNCTION), BASE,
42 parse_info->isolate(), parse_info->zone()) { 55 parse_info->isolate(), parse_info->zone()) {
43 closure_ = closure; 56 closure_ = closure;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 inlined_functions_.push_back(InlinedFunctionHolder( 218 inlined_functions_.push_back(InlinedFunctionHolder(
206 inlined_function, handle(inlined_function->code()))); 219 inlined_function, handle(inlined_function->code())));
207 } 220 }
208 221
209 Code::Kind CompilationInfo::output_code_kind() const { 222 Code::Kind CompilationInfo::output_code_kind() const {
210 return Code::ExtractKindFromFlags(code_flags_); 223 return Code::ExtractKindFromFlags(code_flags_);
211 } 224 }
212 225
213 } // namespace internal 226 } // namespace internal
214 } // namespace v8 227 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698