V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
compilation-dependencies.h
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_COMPILER_COMPILATION_DEPENDENCIES_H_
6 #define V8_COMPILER_COMPILATION_DEPENDENCIES_H_
7 
8 #include "src/compiler/js-heap-broker.h"
9 #include "src/objects.h"
10 #include "src/zone/zone-containers.h"
11 
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15 
17  public:
18  SlackTrackingPrediction(MapRef initial_map, int instance_size);
19 
20  int inobject_property_count() const { return inobject_property_count_; }
21  int instance_size() const { return instance_size_; }
22 
23  private:
24  int instance_size_;
25  int inobject_property_count_;
26 };
27 
28 // Collects and installs dependencies of the code that is being generated.
29 class V8_EXPORT_PRIVATE CompilationDependencies : public ZoneObject {
30  public:
31  CompilationDependencies(Isolate* isolate, Zone* zone);
32 
33  V8_WARN_UNUSED_RESULT bool Commit(Handle<Code> code);
34 
35  // Return the initial map of {function} and record the assumption that it
36  // stays the initial map.
37  MapRef DependOnInitialMap(const JSFunctionRef& function);
38 
39  // Return the "prototype" property of the given function and record the
40  // assumption that it doesn't change.
41  ObjectRef DependOnPrototypeProperty(const JSFunctionRef& function);
42 
43  // Record the assumption that {map} stays stable.
44  void DependOnStableMap(const MapRef& map);
45 
46  // Record the assumption that {target_map} can be transitioned to, i.e., that
47  // it does not become deprecated.
48  void DependOnTransition(const MapRef& target_map);
49 
50  // Return the pretenure mode of {site} and record the assumption that it does
51  // not change.
52  PretenureFlag DependOnPretenureMode(const AllocationSiteRef& site);
53 
54  // Record the assumption that the field type of a field does not change. The
55  // field is identified by the arguments.
56  void DependOnFieldType(const MapRef& map, int descriptor);
57 
58  // Record the assumption that neither {cell}'s {CellType} changes, nor the
59  // {IsReadOnly()} flag of {cell}'s {PropertyDetails}.
60  void DependOnGlobalProperty(const PropertyCellRef& cell);
61 
62  // Record the assumption that the protector remains valid.
63  void DependOnProtector(const PropertyCellRef& cell);
64 
65  // Record the assumption that {site}'s {ElementsKind} doesn't change.
66  void DependOnElementsKind(const AllocationSiteRef& site);
67 
68  // Depend on the stability of (the maps of) all prototypes of every class in
69  // {receiver_type} up to (and including) the {holder}.
70  void DependOnStablePrototypeChains(
71  JSHeapBroker* broker, std::vector<Handle<Map>> const& receiver_maps,
72  const JSObjectRef& holder);
73 
74  // Like DependOnElementsKind but also applies to all nested allocation sites.
75  void DependOnElementsKinds(const AllocationSiteRef& site);
76 
77  // Predict the final instance size for {function}'s initial map and record
78  // the assumption that this prediction is correct. In addition, register
79  // the initial map dependency. This method returns the {function}'s the
80  // predicted minimum slack instance size count (wrapped together with
81  // the corresponding in-object property count for convenience).
82  SlackTrackingPrediction DependOnInitialMapInstanceSizePrediction(
83  const JSFunctionRef& function);
84 
85  // Exposed only for testing purposes.
86  bool AreValid() const;
87 
88  // Exposed only because C++.
89  class Dependency;
90 
91  private:
92  Zone* zone_;
93  ZoneForwardList<Dependency*> dependencies_;
94 };
95 
96 } // namespace compiler
97 } // namespace internal
98 } // namespace v8
99 
100 #endif // V8_COMPILER_COMPILATION_DEPENDENCIES_H_
Definition: libplatform.h:13