OLD | NEW |
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/debug/debug.h" |
10 #include "src/isolate.h" | 11 #include "src/isolate.h" |
11 #include "src/parsing/parse-info.h" | 12 #include "src/parsing/parse-info.h" |
12 #include "src/source-position.h" | 13 #include "src/source-position.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
17 #define PARSE_INFO_GETTER(type, name) \ | 18 #define PARSE_INFO_GETTER(type, name) \ |
18 type CompilationInfo::name() const { \ | 19 type CompilationInfo::name() const { \ |
19 CHECK(parse_info()); \ | 20 CHECK(parse_info()); \ |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // compiling later on. This means that code recompiled with deoptimization | 62 // compiling later on. This means that code recompiled with deoptimization |
62 // support won't be "equivalent" (as defined by SharedFunctionInfo:: | 63 // support won't be "equivalent" (as defined by SharedFunctionInfo:: |
63 // EnableDeoptimizationSupport), so it will replace the old code and all | 64 // EnableDeoptimizationSupport), so it will replace the old code and all |
64 // its type feedback. To avoid this, always compile functions in the snapshot | 65 // its type feedback. To avoid this, always compile functions in the snapshot |
65 // with deoptimization support. | 66 // with deoptimization support. |
66 if (isolate_->serializer_enabled()) EnableDeoptimizationSupport(); | 67 if (isolate_->serializer_enabled()) EnableDeoptimizationSupport(); |
67 | 68 |
68 if (FLAG_function_context_specialization) MarkAsFunctionContextSpecializing(); | 69 if (FLAG_function_context_specialization) MarkAsFunctionContextSpecializing(); |
69 if (FLAG_turbo_splitting) MarkAsSplittingEnabled(); | 70 if (FLAG_turbo_splitting) MarkAsSplittingEnabled(); |
70 | 71 |
| 72 // Collect source positions for optimized code when profiling or if debugger |
| 73 // is active, to be able to get more precise source positions at the price of |
| 74 // more memory consumption. |
71 if (FLAG_trace_deopt || FLAG_trace_turbo || FLAG_trace_turbo_graph || | 75 if (FLAG_trace_deopt || FLAG_trace_turbo || FLAG_trace_turbo_graph || |
72 FLAG_turbo_profiling || isolate_->is_profiling()) { | 76 FLAG_turbo_profiling || isolate_->is_profiling() || |
| 77 isolate_->debug()->is_active()) { |
73 MarkAsSourcePositionsEnabled(); | 78 MarkAsSourcePositionsEnabled(); |
74 } | 79 } |
75 } | 80 } |
76 | 81 |
77 CompilationInfo::CompilationInfo(Vector<const char> debug_name, | 82 CompilationInfo::CompilationInfo(Vector<const char> debug_name, |
78 Isolate* isolate, Zone* zone, | 83 Isolate* isolate, Zone* zone, |
79 Code::Flags code_flags) | 84 Code::Flags code_flags) |
80 : CompilationInfo(nullptr, debug_name, code_flags, STUB, isolate, zone) {} | 85 : CompilationInfo(nullptr, debug_name, code_flags, STUB, isolate, zone) {} |
81 | 86 |
82 CompilationInfo::CompilationInfo(ParseInfo* parse_info, | 87 CompilationInfo::CompilationInfo(ParseInfo* parse_info, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 inlined_function, handle(inlined_function->code()), pos)); | 231 inlined_function, handle(inlined_function->code()), pos)); |
227 return id; | 232 return id; |
228 } | 233 } |
229 | 234 |
230 Code::Kind CompilationInfo::output_code_kind() const { | 235 Code::Kind CompilationInfo::output_code_kind() const { |
231 return Code::ExtractKindFromFlags(code_flags_); | 236 return Code::ExtractKindFromFlags(code_flags_); |
232 } | 237 } |
233 | 238 |
234 } // namespace internal | 239 } // namespace internal |
235 } // namespace v8 | 240 } // namespace v8 |
OLD | NEW |