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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Load value from current parent frame by given offset in bytes. | 110 // Load value from current parent frame by given offset in bytes. |
111 compiler::Node* LoadFromParentFrame( | 111 compiler::Node* LoadFromParentFrame( |
112 int offset, MachineType rep = MachineType::AnyTagged()); | 112 int offset, MachineType rep = MachineType::AnyTagged()); |
113 | 113 |
114 // Load an object pointer from a buffer that isn't in the heap. | 114 // Load an object pointer from a buffer that isn't in the heap. |
115 compiler::Node* LoadBufferObject(compiler::Node* buffer, int offset, | 115 compiler::Node* LoadBufferObject(compiler::Node* buffer, int offset, |
116 MachineType rep = MachineType::AnyTagged()); | 116 MachineType rep = MachineType::AnyTagged()); |
117 // Load a field from an object on the heap. | 117 // Load a field from an object on the heap. |
118 compiler::Node* LoadObjectField(compiler::Node* object, int offset, | 118 compiler::Node* LoadObjectField(compiler::Node* object, int offset, |
119 MachineType rep = MachineType::AnyTagged()); | 119 MachineType rep = MachineType::AnyTagged()); |
| 120 compiler::Node* LoadObjectField(compiler::Node* object, |
| 121 compiler::Node* offset, |
| 122 MachineType rep = MachineType::AnyTagged()); |
| 123 |
120 // Load the floating point value of a HeapNumber. | 124 // Load the floating point value of a HeapNumber. |
121 compiler::Node* LoadHeapNumberValue(compiler::Node* object); | 125 compiler::Node* LoadHeapNumberValue(compiler::Node* object); |
122 // Load the Map of an HeapObject. | 126 // Load the Map of an HeapObject. |
123 compiler::Node* LoadMap(compiler::Node* object); | 127 compiler::Node* LoadMap(compiler::Node* object); |
124 // Load the instance type of an HeapObject. | 128 // Load the instance type of an HeapObject. |
125 compiler::Node* LoadInstanceType(compiler::Node* object); | 129 compiler::Node* LoadInstanceType(compiler::Node* object); |
126 // Checks that given heap object has given instance type. | 130 // Checks that given heap object has given instance type. |
127 void AssertInstanceType(compiler::Node* object, InstanceType instance_type); | 131 void AssertInstanceType(compiler::Node* object, InstanceType instance_type); |
128 // Load the properties backing store of a JSObject. | 132 // Load the properties backing store of a JSObject. |
129 compiler::Node* LoadProperties(compiler::Node* object); | 133 compiler::Node* LoadProperties(compiler::Node* object); |
130 // Load the elements backing store of a JSObject. | 134 // Load the elements backing store of a JSObject. |
131 compiler::Node* LoadElements(compiler::Node* object); | 135 compiler::Node* LoadElements(compiler::Node* object); |
132 // Load the length of a fixed array base instance. | 136 // Load the length of a fixed array base instance. |
133 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); | 137 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); |
134 // Load the bit field of a Map. | 138 // Load the bit field of a Map. |
135 compiler::Node* LoadMapBitField(compiler::Node* map); | 139 compiler::Node* LoadMapBitField(compiler::Node* map); |
136 // Load bit field 2 of a map. | 140 // Load bit field 2 of a map. |
137 compiler::Node* LoadMapBitField2(compiler::Node* map); | 141 compiler::Node* LoadMapBitField2(compiler::Node* map); |
138 // Load bit field 3 of a map. | 142 // Load bit field 3 of a map. |
139 compiler::Node* LoadMapBitField3(compiler::Node* map); | 143 compiler::Node* LoadMapBitField3(compiler::Node* map); |
140 // Load the instance type of a map. | 144 // Load the instance type of a map. |
141 compiler::Node* LoadMapInstanceType(compiler::Node* map); | 145 compiler::Node* LoadMapInstanceType(compiler::Node* map); |
142 // Load the instance descriptors of a map. | 146 // Load the instance descriptors of a map. |
143 compiler::Node* LoadMapDescriptors(compiler::Node* map); | 147 compiler::Node* LoadMapDescriptors(compiler::Node* map); |
144 // Load the prototype of a map. | 148 // Load the prototype of a map. |
145 compiler::Node* LoadMapPrototype(compiler::Node* map); | 149 compiler::Node* LoadMapPrototype(compiler::Node* map); |
146 // Load the instance size of a Map. | 150 // Load the instance size of a Map. |
147 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 151 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
| 152 // Load the inobject properties count of a Map (valid only for JSObjects). |
| 153 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); |
148 | 154 |
149 // Load the hash field of a name. | 155 // Load the hash field of a name. |
150 compiler::Node* LoadNameHashField(compiler::Node* name); | 156 compiler::Node* LoadNameHashField(compiler::Node* name); |
151 // Load the hash value of a name. If {if_hash_not_computed} label | 157 // Load the hash value of a name. If {if_hash_not_computed} label |
152 // is specified then it also checks if hash is actually computed. | 158 // is specified then it also checks if hash is actually computed. |
153 compiler::Node* LoadNameHash(compiler::Node* name, | 159 compiler::Node* LoadNameHash(compiler::Node* name, |
154 Label* if_hash_not_computed = nullptr); | 160 Label* if_hash_not_computed = nullptr); |
155 | 161 |
156 // Load length field of a String object. | 162 // Load length field of a String object. |
157 compiler::Node* LoadStringLength(compiler::Node* object); | 163 compiler::Node* LoadStringLength(compiler::Node* object); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 uint32_t mask); | 267 uint32_t mask); |
262 | 268 |
263 void SetCounter(StatsCounter* counter, int value); | 269 void SetCounter(StatsCounter* counter, int value); |
264 void IncrementCounter(StatsCounter* counter, int delta); | 270 void IncrementCounter(StatsCounter* counter, int delta); |
265 void DecrementCounter(StatsCounter* counter, int delta); | 271 void DecrementCounter(StatsCounter* counter, int delta); |
266 | 272 |
267 // Various building blocks for stubs doing property lookups. | 273 // Various building blocks for stubs doing property lookups. |
268 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, | 274 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, |
269 Label* if_keyisunique, Label* if_bailout); | 275 Label* if_keyisunique, Label* if_bailout); |
270 | 276 |
| 277 // Calculates array index for given dictionary entry and entry field. |
| 278 // See Dictionary::EntryToIndex(). |
| 279 template <typename Dictionary> |
| 280 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index); |
| 281 template <typename Dictionary> |
| 282 compiler::Node* EntryToIndex(compiler::Node* entry) { |
| 283 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); |
| 284 } |
| 285 |
| 286 // Looks up an entry in a NameDictionaryBase successor. If the entry is found |
| 287 // control goes to {if_found} and {var_name_index} contains an index of the |
| 288 // key field of the entry found. If the key is not found control goes to |
| 289 // {if_not_found}. |
271 static const int kInlinedDictionaryProbes = 4; | 290 static const int kInlinedDictionaryProbes = 4; |
272 template <typename Dictionary> | 291 template <typename Dictionary> |
273 void NameDictionaryLookup(compiler::Node* dictionary, | 292 void NameDictionaryLookup(compiler::Node* dictionary, |
274 compiler::Node* unique_name, Label* if_found, | 293 compiler::Node* unique_name, Label* if_found, |
275 Variable* var_entry, Label* if_not_found, | 294 Variable* var_name_index, Label* if_not_found, |
276 int inlined_probes = kInlinedDictionaryProbes); | 295 int inlined_probes = kInlinedDictionaryProbes); |
277 | 296 |
278 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); | 297 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); |
279 | 298 |
280 template <typename Dictionary> | 299 template <typename Dictionary> |
281 void NumberDictionaryLookup(compiler::Node* dictionary, compiler::Node* key, | 300 void NumberDictionaryLookup(compiler::Node* dictionary, compiler::Node* key, |
282 Label* if_found, Variable* var_entry, | 301 Label* if_found, Variable* var_entry, |
283 Label* if_not_found); | 302 Label* if_not_found); |
284 | 303 |
| 304 // Tries to check if {object} has own {unique_name} property. |
| 305 void TryHasOwnProperty(compiler::Node* object, compiler::Node* map, |
| 306 compiler::Node* instance_type, |
| 307 compiler::Node* unique_name, Label* if_found, |
| 308 Label* if_not_found, Label* if_bailout); |
| 309 |
| 310 // Tries to get {object}'s own {unique_name} property value. If the property |
| 311 // is an accessor then it also calls a getter. If the property is a double |
| 312 // field it re-wraps value in an immutable heap number. |
| 313 void TryGetOwnProperty(compiler::Node* context, compiler::Node* receiver, |
| 314 compiler::Node* object, compiler::Node* map, |
| 315 compiler::Node* instance_type, |
| 316 compiler::Node* unique_name, Label* if_found, |
| 317 Variable* var_value, Label* if_not_found, |
| 318 Label* if_bailout); |
| 319 |
| 320 void LoadPropertyFromFastObject(compiler::Node* object, compiler::Node* map, |
| 321 compiler::Node* descriptors, |
| 322 compiler::Node* name_index, |
| 323 Variable* var_details, Variable* var_value); |
| 324 |
| 325 void LoadPropertyFromNameDictionary(compiler::Node* dictionary, |
| 326 compiler::Node* entry, |
| 327 Variable* var_details, |
| 328 Variable* var_value); |
| 329 |
| 330 void LoadPropertyFromGlobalDictionary(compiler::Node* dictionary, |
| 331 compiler::Node* entry, |
| 332 Variable* var_details, |
| 333 Variable* var_value, Label* if_deleted); |
| 334 |
| 335 // Generic property lookup generator. If the {object} is fast and |
| 336 // {unique_name} property is found then the control goes to {if_found_fast} |
| 337 // label and {var_meta_storage} and {var_name_index} will contain |
| 338 // DescriptorArray and an index of the descriptor's name respectively. |
| 339 // If the {object} is slow or global then the control goes to {if_found_dict} |
| 340 // or {if_found_global} and the {var_meta_storage} and {var_name_index} will |
| 341 // contain a dictionary and an index of the key field of the found entry. |
| 342 // If property is not found or given lookup is not supported then |
| 343 // the control goes to {if_not_found} or {if_bailout} respectively. |
285 void TryLookupProperty(compiler::Node* object, compiler::Node* map, | 344 void TryLookupProperty(compiler::Node* object, compiler::Node* map, |
286 compiler::Node* instance_type, | 345 compiler::Node* instance_type, |
287 compiler::Node* unique_name, Label* if_found, | 346 compiler::Node* unique_name, Label* if_found_fast, |
| 347 Label* if_found_dict, Label* if_found_global, |
| 348 Variable* var_meta_storage, Variable* var_name_index, |
288 Label* if_not_found, Label* if_bailout); | 349 Label* if_not_found, Label* if_bailout); |
289 | 350 |
290 void TryLookupElement(compiler::Node* object, compiler::Node* map, | 351 void TryLookupElement(compiler::Node* object, compiler::Node* map, |
291 compiler::Node* instance_type, compiler::Node* index, | 352 compiler::Node* instance_type, compiler::Node* index, |
292 Label* if_found, Label* if_not_found, | 353 Label* if_found, Label* if_not_found, |
293 Label* if_bailout); | 354 Label* if_bailout); |
294 | 355 |
295 // Instanceof helpers. | 356 // Instanceof helpers. |
296 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) | 357 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) |
297 compiler::Node* OrdinaryHasInstance(compiler::Node* context, | 358 compiler::Node* OrdinaryHasInstance(compiler::Node* context, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 AllocationFlags flags, | 432 AllocationFlags flags, |
372 compiler::Node* top_adddress, | 433 compiler::Node* top_adddress, |
373 compiler::Node* limit_address); | 434 compiler::Node* limit_address); |
374 | 435 |
375 static const int kElementLoopUnrollThreshold = 8; | 436 static const int kElementLoopUnrollThreshold = 8; |
376 }; | 437 }; |
377 | 438 |
378 } // namespace internal | 439 } // namespace internal |
379 } // namespace v8 | 440 } // namespace v8 |
380 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 441 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |