LCOV - code coverage report
Current view: top level - src - compilation-dependencies.h (source / functions) Hit Total Coverage
Test: app.info Lines: 9 9 100.0 %
Date: 2017-04-26 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2015 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             : #ifndef V8_DEPENDENCIES_H_
       6             : #define V8_DEPENDENCIES_H_
       7             : 
       8             : #include "src/handles.h"
       9             : #include "src/objects.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14             : // Collects dependencies for this compilation, e.g. assumptions about
      15             : // stable maps, constant globals, etc.
      16             : class CompilationDependencies {
      17             :  public:
      18             :   CompilationDependencies(Isolate* isolate, Zone* zone)
      19             :       : isolate_(isolate),
      20             :         zone_(zone),
      21             :         object_wrapper_(Handle<Foreign>::null()),
      22     4835418 :         aborted_(false) {
      23     4835418 :     std::fill_n(groups_, DependentCode::kGroupCount, nullptr);
      24             :   }
      25             : 
      26             :   void Insert(DependentCode::DependencyGroup group, Handle<HeapObject> handle);
      27             : 
      28             :   void AssumeInitialMapCantChange(Handle<Map> map) {
      29        6591 :     Insert(DependentCode::kInitialMapChangedGroup, map);
      30             :   }
      31             :   void AssumeFieldOwner(Handle<Map> map) {
      32       14760 :     Insert(DependentCode::kFieldOwnerGroup, map);
      33             :   }
      34             :   void AssumeMapStable(Handle<Map> map);
      35             :   void AssumePrototypeMapsStable(
      36             :       Handle<Map> map,
      37             :       MaybeHandle<JSReceiver> prototype = MaybeHandle<JSReceiver>());
      38             :   void AssumeMapNotDeprecated(Handle<Map> map);
      39             :   void AssumePropertyCell(Handle<PropertyCell> cell) {
      40      733085 :     Insert(DependentCode::kPropertyCellChangedGroup, cell);
      41             :   }
      42             :   void AssumeTenuringDecision(Handle<AllocationSite> site) {
      43       34793 :     Insert(DependentCode::kAllocationSiteTenuringChangedGroup, site);
      44             :   }
      45             :   void AssumeTransitionStable(Handle<AllocationSite> site);
      46             : 
      47             :   void Commit(Handle<Code> code);
      48             :   void Rollback();
      49         228 :   void Abort() { aborted_ = true; }
      50             :   bool HasAborted() const { return aborted_; }
      51             : 
      52             :   bool IsEmpty() const {
      53    42452990 :     for (int i = 0; i < DependentCode::kGroupCount; i++) {
      54    42720410 :       if (groups_[i]) return false;
      55             :     }
      56             :     return true;
      57             :   }
      58             : 
      59             :  private:
      60             :   Isolate* isolate_;
      61             :   Zone* zone_;
      62             :   Handle<Foreign> object_wrapper_;
      63             :   bool aborted_;
      64             :   ZoneList<Handle<HeapObject> >* groups_[DependentCode::kGroupCount];
      65             : 
      66             :   DependentCode* Get(Handle<Object> object) const;
      67             :   void Set(Handle<Object> object, Handle<DependentCode> dep);
      68             : };
      69             : }  // namespace internal
      70             : }  // namespace v8
      71             : 
      72             : #endif  // V8_DEPENDENCIES_H_

Generated by: LCOV version 1.10