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

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

Issue 2882973002: [coverage] Block coverage with support for IfStatements (Closed)
Patch Set: Address comments Created 3 years, 6 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/ast/ast.h ('k') | src/compilation-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_COMPILATION_INFO_H_ 5 #ifndef V8_COMPILATION_INFO_H_
6 #define V8_COMPILATION_INFO_H_ 6 #define V8_COMPILATION_INFO_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/compilation-dependencies.h" 10 #include "src/compilation-dependencies.h"
11 #include "src/frames.h" 11 #include "src/frames.h"
12 #include "src/globals.h" 12 #include "src/globals.h"
13 #include "src/handles.h" 13 #include "src/handles.h"
14 #include "src/objects.h" 14 #include "src/objects.h"
15 #include "src/source-position-table.h" 15 #include "src/source-position-table.h"
16 #include "src/utils.h" 16 #include "src/utils.h"
17 #include "src/vector.h" 17 #include "src/vector.h"
18 18
19 namespace v8 { 19 namespace v8 {
20 namespace internal { 20 namespace internal {
21 21
22 class CoverageInfo;
22 class DeclarationScope; 23 class DeclarationScope;
23 class DeferredHandles; 24 class DeferredHandles;
24 class FunctionLiteral; 25 class FunctionLiteral;
25 class JavaScriptFrame; 26 class JavaScriptFrame;
26 class ParseInfo; 27 class ParseInfo;
27 class Isolate; 28 class Isolate;
28 class Zone; 29 class Zone;
29 30
30 // CompilationInfo encapsulates some information known at compile time. It 31 // CompilationInfo encapsulates some information known at compile time. It
31 // is constructed based on the resources available at compile-time. 32 // is constructed based on the resources available at compile-time.
(...skipping 12 matching lines...) Expand all
44 kFunctionContextSpecializing = 1 << 7, 45 kFunctionContextSpecializing = 1 << 7,
45 kFrameSpecializing = 1 << 8, 46 kFrameSpecializing = 1 << 8,
46 kInliningEnabled = 1 << 9, 47 kInliningEnabled = 1 << 9,
47 kDisableFutureOptimization = 1 << 10, 48 kDisableFutureOptimization = 1 << 10,
48 kSplittingEnabled = 1 << 11, 49 kSplittingEnabled = 1 << 11,
49 kDeoptimizationEnabled = 1 << 12, 50 kDeoptimizationEnabled = 1 << 12,
50 kSourcePositionsEnabled = 1 << 13, 51 kSourcePositionsEnabled = 1 << 13,
51 kBailoutOnUninitialized = 1 << 14, 52 kBailoutOnUninitialized = 1 << 14,
52 kOptimizeFromBytecode = 1 << 15, 53 kOptimizeFromBytecode = 1 << 15,
53 kLoopPeelingEnabled = 1 << 16, 54 kLoopPeelingEnabled = 1 << 16,
55 kBlockCoverageEnabled = 1 << 17,
54 }; 56 };
55 57
56 CompilationInfo(Zone* zone, ParseInfo* parse_info, Isolate* isolate, 58 CompilationInfo(Zone* zone, ParseInfo* parse_info, Isolate* isolate,
57 Handle<JSFunction> closure); 59 Handle<JSFunction> closure);
58 CompilationInfo(Vector<const char> debug_name, Isolate* isolate, Zone* zone, 60 CompilationInfo(Vector<const char> debug_name, Isolate* isolate, Zone* zone,
59 Code::Flags code_flags); 61 Code::Flags code_flags);
60 ~CompilationInfo(); 62 ~CompilationInfo();
61 63
62 ParseInfo* parse_info() const { return parse_info_; } 64 ParseInfo* parse_info() const { return parse_info_; }
63 65
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void MarkAsOptimizeFromBytecode() { SetFlag(kOptimizeFromBytecode); } 174 void MarkAsOptimizeFromBytecode() { SetFlag(kOptimizeFromBytecode); }
173 175
174 bool is_optimizing_from_bytecode() const { 176 bool is_optimizing_from_bytecode() const {
175 return GetFlag(kOptimizeFromBytecode); 177 return GetFlag(kOptimizeFromBytecode);
176 } 178 }
177 179
178 void MarkAsLoopPeelingEnabled() { SetFlag(kLoopPeelingEnabled); } 180 void MarkAsLoopPeelingEnabled() { SetFlag(kLoopPeelingEnabled); }
179 181
180 bool is_loop_peeling_enabled() const { return GetFlag(kLoopPeelingEnabled); } 182 bool is_loop_peeling_enabled() const { return GetFlag(kLoopPeelingEnabled); }
181 183
184 void MarkAsBlockCoverageEnabled() { SetFlag(kBlockCoverageEnabled); }
185
186 bool is_block_coverage_enabled() const {
187 return GetFlag(kBlockCoverageEnabled);
188 }
189
182 bool GeneratePreagedPrologue() const { 190 bool GeneratePreagedPrologue() const {
183 // Generate a pre-aged prologue if we are optimizing for size, which 191 // Generate a pre-aged prologue if we are optimizing for size, which
184 // will make code old more aggressive. Only apply to Code::FUNCTION, 192 // will make code old more aggressive. Only apply to Code::FUNCTION,
185 // since only functions are aged in the compilation cache. 193 // since only functions are aged in the compilation cache.
186 return FLAG_optimize_for_size && FLAG_age_code && !is_debug() && 194 return FLAG_optimize_for_size && FLAG_age_code && !is_debug() &&
187 output_code_kind() == Code::FUNCTION; 195 output_code_kind() == Code::FUNCTION;
188 } 196 }
189 197
190 void SetCode(Handle<Code> code) { code_ = code; } 198 void SetCode(Handle<Code> code) { code_ = code; }
191 199
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 std::unique_ptr<char[]> GetDebugName() const; 313 std::unique_ptr<char[]> GetDebugName() const;
306 314
307 Code::Kind output_code_kind() const; 315 Code::Kind output_code_kind() const;
308 316
309 StackFrame::Type GetOutputStackFrameType() const; 317 StackFrame::Type GetOutputStackFrameType() const;
310 318
311 int GetDeclareGlobalsFlags() const; 319 int GetDeclareGlobalsFlags() const;
312 320
313 SourcePositionTableBuilder::RecordingMode SourcePositionRecordingMode() const; 321 SourcePositionTableBuilder::RecordingMode SourcePositionRecordingMode() const;
314 322
323 bool has_coverage_info() const { return !coverage_info_.is_null(); }
324 Handle<CoverageInfo> coverage_info() const { return coverage_info_; }
325 void set_coverage_info(Handle<CoverageInfo> coverage_info) {
326 coverage_info_ = coverage_info;
327 }
328
315 private: 329 private:
316 // Compilation mode. 330 // Compilation mode.
317 // BASE is generated by the full codegen, optionally prepared for bailouts. 331 // BASE is generated by the full codegen, optionally prepared for bailouts.
318 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. 332 // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
319 enum Mode { BASE, OPTIMIZE, STUB }; 333 enum Mode { BASE, OPTIMIZE, STUB };
320 334
321 CompilationInfo(ParseInfo* parse_info, Vector<const char> debug_name, 335 CompilationInfo(ParseInfo* parse_info, Vector<const char> debug_name,
322 Code::Flags code_flags, Mode mode, Isolate* isolate, 336 Code::Flags code_flags, Mode mode, Isolate* isolate,
323 Zone* zone); 337 Zone* zone);
324 338
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 389
376 int optimization_id_; 390 int optimization_id_;
377 391
378 int osr_expr_stack_height_; 392 int osr_expr_stack_height_;
379 393
380 // The current OSR frame for specialization or {nullptr}. 394 // The current OSR frame for specialization or {nullptr}.
381 JavaScriptFrame* osr_frame_ = nullptr; 395 JavaScriptFrame* osr_frame_ = nullptr;
382 396
383 Vector<const char> debug_name_; 397 Vector<const char> debug_name_;
384 398
399 // Encapsulates coverage information gathered by the bytecode generator.
400 // Needs to be stored on the shared function info once compilation completes.
401 Handle<CoverageInfo> coverage_info_;
402
385 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); 403 DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
386 }; 404 };
387 405
388 } // namespace internal 406 } // namespace internal
389 } // namespace v8 407 } // namespace v8
390 408
391 #endif // V8_COMPILATION_INFO_H_ 409 #endif // V8_COMPILATION_INFO_H_
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/compilation-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698