OLD | NEW |
(Empty) | |
| 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 |
| 17 class CompilationDependencies; |
| 18 |
| 19 namespace compiler { |
| 20 |
| 21 class CommonOperatorBuilder; |
| 22 class Graph; |
| 23 class JSGraph; |
| 24 class Node; |
| 25 class PropertyAccessInfo; |
| 26 class SimplifiedOperatorBuilder; |
| 27 |
| 28 class PropertyAccessBuilder { |
| 29 public: |
| 30 PropertyAccessBuilder(JSGraph* jsgraph, CompilationDependencies* dependencies) |
| 31 : jsgraph_(jsgraph), dependencies_(dependencies) {} |
| 32 |
| 33 // Builds the appropriate string check if the maps are only string |
| 34 // maps. |
| 35 bool TryBuildStringCheck(MapHandles const& maps, Node** receiver, |
| 36 Node** effect, Node* control); |
| 37 // Builds a number check if all maps are number maps. |
| 38 bool TryBuildNumberCheck(MapHandles const& maps, Node** receiver, |
| 39 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 |
| 45 // Adds stability dependencies on all prototypes of every class in |
| 46 // {receiver_type} up to (and including) the {holder}. |
| 47 void AssumePrototypesStable(Handle<Context> native_context, |
| 48 std::vector<Handle<Map>> const& receiver_maps, |
| 49 Handle<JSObject> holder); |
| 50 |
| 51 // Builds the actual load for data-field and data-constant-field |
| 52 // properties (without heap-object or map checks). |
| 53 Node* BuildLoadDataField(Handle<Name> name, |
| 54 PropertyAccessInfo const& access_info, |
| 55 Node* receiver, Node** effect, Node** control); |
| 56 |
| 57 private: |
| 58 JSGraph* jsgraph() const { return jsgraph_; } |
| 59 CompilationDependencies* dependencies() const { return dependencies_; } |
| 60 Graph* graph() const; |
| 61 Isolate* isolate() const; |
| 62 CommonOperatorBuilder* common() const; |
| 63 SimplifiedOperatorBuilder* simplified() const; |
| 64 |
| 65 Node* TryBuildLoadConstantDataField(Handle<Name> name, |
| 66 PropertyAccessInfo const& access_info, |
| 67 Node* receiver); |
| 68 // Returns a node with the holder for the property access described by |
| 69 // {access_info}. |
| 70 Node* ResolveHolder(PropertyAccessInfo const& access_info, Node* receiver); |
| 71 |
| 72 JSGraph* jsgraph_; |
| 73 CompilationDependencies* dependencies_; |
| 74 }; |
| 75 |
| 76 } // namespace compiler |
| 77 } // namespace internal |
| 78 } // namespace v8 |
| 79 |
| 80 #endif // V8_COMPILER_PROPERTY_ACCESS_BUILDER_H_ |
OLD | NEW |