Line data Source code
1 : // Copyright 2017 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_PROPERTY_ACCESS_BUILDER_H_
6 : #define V8_COMPILER_PROPERTY_ACCESS_BUILDER_H_
7 :
8 : #include <vector>
9 :
10 : #include "src/handles.h"
11 : #include "src/objects/map.h"
12 : #include "src/zone/zone-containers.h"
13 :
14 : namespace v8 {
15 : namespace internal {
16 : namespace compiler {
17 :
18 : class CommonOperatorBuilder;
19 : class CompilationDependencies;
20 : class Graph;
21 : class JSGraph;
22 : class JSHeapBroker;
23 : class Node;
24 : class PropertyAccessInfo;
25 : class SimplifiedOperatorBuilder;
26 :
27 : class PropertyAccessBuilder {
28 : public:
29 : PropertyAccessBuilder(JSGraph* jsgraph, JSHeapBroker* broker,
30 : CompilationDependencies* dependencies)
31 277962 : : jsgraph_(jsgraph), broker_(broker), dependencies_(dependencies) {}
32 :
33 : // Builds the appropriate string check if the maps are only string
34 : // maps.
35 : bool TryBuildStringCheck(JSHeapBroker* broker, MapHandles const& maps,
36 : Node** receiver, Node** effect, Node* control);
37 : // Builds a number check if all maps are number maps.
38 : bool TryBuildNumberCheck(JSHeapBroker* broker, MapHandles const& maps,
39 : Node** receiver, Node** effect, Node* control);
40 :
41 : Node* BuildCheckHeapObject(Node* receiver, Node** effect, Node* control);
42 : void BuildCheckMaps(Node* receiver, Node** effect, Node* control,
43 : std::vector<Handle<Map>> const& receiver_maps);
44 : Node* BuildCheckValue(Node* receiver, Node** effect, Node* control,
45 : Handle<HeapObject> value);
46 :
47 : // Builds the actual load for data-field and data-constant-field
48 : // properties (without heap-object or map checks).
49 : Node* BuildLoadDataField(Handle<Name> name,
50 : PropertyAccessInfo const& access_info,
51 : Node* receiver, Node** effect, Node** control);
52 :
53 : private:
54 : JSGraph* jsgraph() const { return jsgraph_; }
55 : JSHeapBroker* broker() const { return broker_; }
56 : CompilationDependencies* dependencies() const { return dependencies_; }
57 : Graph* graph() const;
58 : Isolate* isolate() const;
59 : CommonOperatorBuilder* common() const;
60 : SimplifiedOperatorBuilder* simplified() const;
61 :
62 : Node* TryBuildLoadConstantDataField(Handle<Name> name,
63 : PropertyAccessInfo const& access_info,
64 : Node* receiver);
65 : // Returns a node with the holder for the property access described by
66 : // {access_info}.
67 : Node* ResolveHolder(PropertyAccessInfo const& access_info, Node* receiver);
68 :
69 : JSGraph* jsgraph_;
70 : JSHeapBroker* broker_;
71 : CompilationDependencies* dependencies_;
72 : };
73 :
74 : bool HasOnlyStringMaps(JSHeapBroker* broker, MapHandles const& maps);
75 :
76 : } // namespace compiler
77 : } // namespace internal
78 : } // namespace v8
79 :
80 : #endif // V8_COMPILER_PROPERTY_ACCESS_BUILDER_H_
|