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

Generated by: LCOV version 1.10