OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CODE_STUB_ASSEMBLER_H_ | 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_ |
6 #define V8_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_CODE_STUB_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/compiler/code-assembler.h" | 8 #include "src/compiler/code-assembler.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Create with JSCall linkage. | 31 // Create with JSCall linkage. |
32 CodeStubAssembler(Isolate* isolate, Zone* zone, int parameter_count, | 32 CodeStubAssembler(Isolate* isolate, Zone* zone, int parameter_count, |
33 Code::Flags flags, const char* name); | 33 Code::Flags flags, const char* name); |
34 | 34 |
35 compiler::Node* BooleanMapConstant(); | 35 compiler::Node* BooleanMapConstant(); |
36 compiler::Node* EmptyStringConstant(); | 36 compiler::Node* EmptyStringConstant(); |
37 compiler::Node* HeapNumberMapConstant(); | 37 compiler::Node* HeapNumberMapConstant(); |
38 compiler::Node* NoContextConstant(); | 38 compiler::Node* NoContextConstant(); |
39 compiler::Node* NullConstant(); | 39 compiler::Node* NullConstant(); |
40 compiler::Node* UndefinedConstant(); | 40 compiler::Node* UndefinedConstant(); |
| 41 compiler::Node* TheHoleConstant(); |
| 42 compiler::Node* HashSeed(); |
41 compiler::Node* StaleRegisterConstant(); | 43 compiler::Node* StaleRegisterConstant(); |
42 | 44 |
43 // Float64 operations. | 45 // Float64 operations. |
44 compiler::Node* Float64Ceil(compiler::Node* x); | 46 compiler::Node* Float64Ceil(compiler::Node* x); |
45 compiler::Node* Float64Floor(compiler::Node* x); | 47 compiler::Node* Float64Floor(compiler::Node* x); |
46 compiler::Node* Float64Round(compiler::Node* x); | 48 compiler::Node* Float64Round(compiler::Node* x); |
47 compiler::Node* Float64Trunc(compiler::Node* x); | 49 compiler::Node* Float64Trunc(compiler::Node* x); |
48 | 50 |
49 // Tag a Word as a Smi value. | 51 // Tag a Word as a Smi value. |
50 compiler::Node* SmiTag(compiler::Node* value); | 52 compiler::Node* SmiTag(compiler::Node* value); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 MachineType rep = MachineType::AnyTagged()); | 102 MachineType rep = MachineType::AnyTagged()); |
101 // Load a field from an object on the heap. | 103 // Load a field from an object on the heap. |
102 compiler::Node* LoadObjectField(compiler::Node* object, int offset, | 104 compiler::Node* LoadObjectField(compiler::Node* object, int offset, |
103 MachineType rep = MachineType::AnyTagged()); | 105 MachineType rep = MachineType::AnyTagged()); |
104 // Load the floating point value of a HeapNumber. | 106 // Load the floating point value of a HeapNumber. |
105 compiler::Node* LoadHeapNumberValue(compiler::Node* object); | 107 compiler::Node* LoadHeapNumberValue(compiler::Node* object); |
106 // Load the Map of an HeapObject. | 108 // Load the Map of an HeapObject. |
107 compiler::Node* LoadMap(compiler::Node* object); | 109 compiler::Node* LoadMap(compiler::Node* object); |
108 // Load the instance type of an HeapObject. | 110 // Load the instance type of an HeapObject. |
109 compiler::Node* LoadInstanceType(compiler::Node* object); | 111 compiler::Node* LoadInstanceType(compiler::Node* object); |
| 112 // Load the properties backing store of a JSObject. |
| 113 compiler::Node* LoadProperties(compiler::Node* object); |
110 // Load the elements backing store of a JSObject. | 114 // Load the elements backing store of a JSObject. |
111 compiler::Node* LoadElements(compiler::Node* object); | 115 compiler::Node* LoadElements(compiler::Node* object); |
112 // Load the length of a fixed array base instance. | 116 // Load the length of a fixed array base instance. |
113 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); | 117 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); |
114 // Load the bit field of a Map. | 118 // Load the bit field of a Map. |
115 compiler::Node* LoadMapBitField(compiler::Node* map); | 119 compiler::Node* LoadMapBitField(compiler::Node* map); |
116 // Load bit field 2 of a map. | 120 // Load bit field 2 of a map. |
117 compiler::Node* LoadMapBitField2(compiler::Node* map); | 121 compiler::Node* LoadMapBitField2(compiler::Node* map); |
118 // Load bit field 3 of a map. | 122 // Load bit field 3 of a map. |
119 compiler::Node* LoadMapBitField3(compiler::Node* map); | 123 compiler::Node* LoadMapBitField3(compiler::Node* map); |
120 // Load the instance type of a map. | 124 // Load the instance type of a map. |
121 compiler::Node* LoadMapInstanceType(compiler::Node* map); | 125 compiler::Node* LoadMapInstanceType(compiler::Node* map); |
122 // Load the instance descriptors of a map. | 126 // Load the instance descriptors of a map. |
123 compiler::Node* LoadMapDescriptors(compiler::Node* map); | 127 compiler::Node* LoadMapDescriptors(compiler::Node* map); |
124 // Load the prototype of a map. | 128 // Load the prototype of a map. |
125 compiler::Node* LoadMapPrototype(compiler::Node* map); | 129 compiler::Node* LoadMapPrototype(compiler::Node* map); |
126 | 130 |
127 // Load the hash field of a name. | 131 // Load the hash field of a name. |
128 compiler::Node* LoadNameHash(compiler::Node* name); | 132 compiler::Node* LoadNameHashField(compiler::Node* name); |
| 133 // Load the hash value of a name. If {if_hash_not_computed} label |
| 134 // is specified then it also checks if hash is actually computed. |
| 135 compiler::Node* LoadNameHash(compiler::Node* name, |
| 136 Label* if_hash_not_computed = nullptr); |
129 // Load the instance size of a Map. | 137 // Load the instance size of a Map. |
130 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 138 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
131 | 139 |
132 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); | 140 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); |
133 | 141 |
134 // Load an array element from a FixedArray. | 142 // Load an array element from a FixedArray. |
135 compiler::Node* LoadFixedArrayElementInt32Index(compiler::Node* object, | 143 compiler::Node* LoadFixedArrayElementInt32Index(compiler::Node* object, |
136 compiler::Node* int32_index, | 144 compiler::Node* int32_index, |
137 int additional_offset = 0); | 145 int additional_offset = 0); |
138 compiler::Node* LoadFixedArrayElementSmiIndex(compiler::Node* object, | 146 compiler::Node* LoadFixedArrayElementSmiIndex(compiler::Node* object, |
139 compiler::Node* smi_index, | 147 compiler::Node* smi_index, |
140 int additional_offset = 0); | 148 int additional_offset = 0); |
141 compiler::Node* LoadFixedArrayElementConstantIndex(compiler::Node* object, | 149 compiler::Node* LoadFixedArrayElementConstantIndex(compiler::Node* object, |
142 int index); | 150 int index); |
| 151 // Load an array element from a FixedDoubleArray. |
| 152 compiler::Node* OffsetOfFixedDoubleArrayElementInt32Index( |
| 153 compiler::Node* int32_index, int additional_offset = 0); |
| 154 compiler::Node* LoadFixedDoubleArrayElementInt32Index( |
| 155 compiler::Node* object, compiler::Node* int32_index, |
| 156 MachineType machine_type, int additional_offset = 0); |
143 | 157 |
144 // Context manipulation | 158 // Context manipulation |
145 compiler::Node* LoadNativeContext(compiler::Node* context); | 159 compiler::Node* LoadNativeContext(compiler::Node* context); |
146 | 160 |
147 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, | 161 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, |
148 compiler::Node* native_context); | 162 compiler::Node* native_context); |
149 | 163 |
150 // Store the floating point value of a HeapNumber. | 164 // Store the floating point value of a HeapNumber. |
151 compiler::Node* StoreHeapNumberValue(compiler::Node* object, | 165 compiler::Node* StoreHeapNumberValue(compiler::Node* object, |
152 compiler::Node* value); | 166 compiler::Node* value); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 return BitFieldDecode(word32, T::kShift, T::kMask); | 242 return BitFieldDecode(word32, T::kShift, T::kMask); |
229 } | 243 } |
230 | 244 |
231 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, | 245 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, |
232 uint32_t mask); | 246 uint32_t mask); |
233 | 247 |
234 // Various building blocks for stubs doing property lookups. | 248 // Various building blocks for stubs doing property lookups. |
235 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, | 249 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, |
236 Label* if_keyisunique, Label* call_runtime); | 250 Label* if_keyisunique, Label* call_runtime); |
237 | 251 |
| 252 static const int kInlinedDictionaryProbes = 4; |
| 253 template <typename Dictionary> |
| 254 void NameDictionaryLookup(compiler::Node* dictionary, |
| 255 compiler::Node* unique_name, Label* if_found, |
| 256 Label* if_not_found, Label* call_runtime, |
| 257 int inlined_probes = kInlinedDictionaryProbes); |
| 258 |
| 259 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); |
| 260 |
| 261 template <typename Dictionary> |
| 262 void NumberDictionaryLookup(compiler::Node* dictionary, compiler::Node* key, |
| 263 Label* if_found, Label* if_not_found, |
| 264 Label* call_runtime); |
| 265 |
238 void TryLookupProperty(compiler::Node* object, compiler::Node* map, | 266 void TryLookupProperty(compiler::Node* object, compiler::Node* map, |
239 compiler::Node* instance_type, compiler::Node* name, | 267 compiler::Node* instance_type, |
240 Label* if_found, Label* if_not_found, | 268 compiler::Node* unique_name, Label* if_found, |
241 Label* call_runtime); | 269 Label* if_not_found, Label* call_runtime); |
242 | 270 |
243 void TryLookupElement(compiler::Node* object, compiler::Node* map, | 271 void TryLookupElement(compiler::Node* object, compiler::Node* map, |
244 compiler::Node* instance_type, compiler::Node* index, | 272 compiler::Node* instance_type, compiler::Node* index, |
245 Label* if_found, Label* if_not_found, | 273 Label* if_found, Label* if_not_found, |
246 Label* call_runtime); | 274 Label* call_runtime); |
247 | 275 |
248 // Instanceof helpers. | 276 // Instanceof helpers. |
249 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) | 277 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) |
250 compiler::Node* OrdinaryHasInstance(compiler::Node* context, | 278 compiler::Node* OrdinaryHasInstance(compiler::Node* context, |
251 compiler::Node* callable, | 279 compiler::Node* callable, |
252 compiler::Node* object); | 280 compiler::Node* object); |
253 | 281 |
254 private: | 282 private: |
255 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, | 283 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, |
256 AllocationFlags flags, | 284 AllocationFlags flags, |
257 compiler::Node* top_address, | 285 compiler::Node* top_address, |
258 compiler::Node* limit_address); | 286 compiler::Node* limit_address); |
259 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, | 287 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, |
260 AllocationFlags flags, | 288 AllocationFlags flags, |
261 compiler::Node* top_adddress, | 289 compiler::Node* top_adddress, |
262 compiler::Node* limit_address); | 290 compiler::Node* limit_address); |
263 | 291 |
264 static const int kElementLoopUnrollThreshold = 8; | 292 static const int kElementLoopUnrollThreshold = 8; |
265 }; | 293 }; |
266 | 294 |
267 } // namespace internal | 295 } // namespace internal |
268 } // namespace v8 | 296 } // namespace v8 |
269 | 297 |
270 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 298 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |