access-builder.h revision bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8
1// Copyright 2014 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_ACCESS_BUILDER_H_ 6#define V8_COMPILER_ACCESS_BUILDER_H_ 7 8#include "src/compiler/simplified-operator.h" 9 10namespace v8 { 11namespace internal { 12namespace compiler { 13 14// This access builder provides a set of static methods constructing commonly 15// used FieldAccess and ElementAccess descriptors. These descriptors serve as 16// parameters to simplified load/store operators. 17class AccessBuilder final : public AllStatic { 18 public: 19 // =========================================================================== 20 // Access to heap object fields and elements (based on tagged pointer). 21 22 // Provides access to HeapObject::map() field. 23 static FieldAccess ForMap(); 24 25 // Provides access to HeapNumber::value() field. 26 static FieldAccess ForHeapNumberValue(); 27 28 // Provides access to JSObject::properties() field. 29 static FieldAccess ForJSObjectProperties(); 30 31 // Provides access to JSObject::elements() field. 32 static FieldAccess ForJSObjectElements(); 33 34 // Provides access to JSObject inobject property fields. 35 static FieldAccess ForJSObjectInObjectProperty(Handle<Map> map, int index); 36 37 // Provides access to JSFunction::prototype_or_initial_map() field. 38 static FieldAccess ForJSFunctionPrototypeOrInitialMap(); 39 40 // Provides access to JSFunction::context() field. 41 static FieldAccess ForJSFunctionContext(); 42 43 // Provides access to JSFunction::shared() field. 44 static FieldAccess ForJSFunctionSharedFunctionInfo(); 45 46 // Provides access to JSFunction::literals() field. 47 static FieldAccess ForJSFunctionLiterals(); 48 49 // Provides access to JSFunction::code() field. 50 static FieldAccess ForJSFunctionCodeEntry(); 51 52 // Provides access to JSFunction::next_function_link() field. 53 static FieldAccess ForJSFunctionNextFunctionLink(); 54 55 // Provides access to JSArray::length() field. 56 static FieldAccess ForJSArrayLength(ElementsKind elements_kind); 57 58 // Provides access to JSArrayBuffer::backing_store() field. 59 static FieldAccess ForJSArrayBufferBackingStore(); 60 61 // Provides access to JSArrayBuffer::bit_field() field. 62 static FieldAccess ForJSArrayBufferBitField(); 63 64 // Provides access to JSArrayBufferView::buffer() field. 65 static FieldAccess ForJSArrayBufferViewBuffer(); 66 67 // Provides access to JSDate fields. 68 static FieldAccess ForJSDateField(JSDate::FieldIndex index); 69 70 // Provides access to JSIteratorResult::done() field. 71 static FieldAccess ForJSIteratorResultDone(); 72 73 // Provides access to JSIteratorResult::value() field. 74 static FieldAccess ForJSIteratorResultValue(); 75 76 // Provides access to JSRegExp::flags() field. 77 static FieldAccess ForJSRegExpFlags(); 78 79 // Provides access to JSRegExp::source() field. 80 static FieldAccess ForJSRegExpSource(); 81 82 // Provides access to FixedArray::length() field. 83 static FieldAccess ForFixedArrayLength(); 84 85 // Provides access to DescriptorArray::enum_cache() field. 86 static FieldAccess ForDescriptorArrayEnumCache(); 87 88 // Provides access to DescriptorArray::enum_cache_bridge_cache() field. 89 static FieldAccess ForDescriptorArrayEnumCacheBridgeCache(); 90 91 // Provides access to Map::bit_field() byte. 92 static FieldAccess ForMapBitField(); 93 94 // Provides access to Map::bit_field3() field. 95 static FieldAccess ForMapBitField3(); 96 97 // Provides access to Map::descriptors() field. 98 static FieldAccess ForMapDescriptors(); 99 100 // Provides access to Map::instance_type() field. 101 static FieldAccess ForMapInstanceType(); 102 103 // Provides access to Map::prototype() field. 104 static FieldAccess ForMapPrototype(); 105 106 // Provides access to String::length() field. 107 static FieldAccess ForStringLength(); 108 109 // Provides access to JSGlobalObject::global_proxy() field. 110 static FieldAccess ForJSGlobalObjectGlobalProxy(); 111 112 // Provides access to JSGlobalObject::native_context() field. 113 static FieldAccess ForJSGlobalObjectNativeContext(); 114 115 // Provides access to JSValue::value() field. 116 static FieldAccess ForValue(); 117 118 // Provides access to arguments object fields. 119 static FieldAccess ForArgumentsLength(); 120 static FieldAccess ForArgumentsCallee(); 121 122 // Provides access to FixedArray slots. 123 static FieldAccess ForFixedArraySlot(size_t index); 124 125 // Provides access to Context slots. 126 static FieldAccess ForContextSlot(size_t index); 127 128 // Provides access to PropertyCell::value() field. 129 static FieldAccess ForPropertyCellValue(); 130 static FieldAccess ForPropertyCellValue(Type* type); 131 132 // Provides access to SharedFunctionInfo::feedback_vector() field. 133 static FieldAccess ForSharedFunctionInfoTypeFeedbackVector(); 134 135 // Provides access to FixedArray elements. 136 static ElementAccess ForFixedArrayElement(); 137 138 // Provides access to FixedDoubleArray elements. 139 static ElementAccess ForFixedDoubleArrayElement(); 140 141 // Provides access to Fixed{type}TypedArray and External{type}Array elements. 142 static ElementAccess ForTypedArrayElement(ExternalArrayType type, 143 bool is_external); 144 145 private: 146 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessBuilder); 147}; 148 149} // namespace compiler 150} // namespace internal 151} // namespace v8 152 153#endif // V8_COMPILER_ACCESS_BUILDER_H_ 154