| 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 22 matching lines...) Expand all Loading... |
| 33 Code::Flags flags, const char* name); | 33 Code::Flags flags, const char* name); |
| 34 | 34 |
| 35 enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS }; | 35 enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS }; |
| 36 | 36 |
| 37 compiler::Node* BooleanMapConstant(); | 37 compiler::Node* BooleanMapConstant(); |
| 38 compiler::Node* EmptyStringConstant(); | 38 compiler::Node* EmptyStringConstant(); |
| 39 compiler::Node* HeapNumberMapConstant(); | 39 compiler::Node* HeapNumberMapConstant(); |
| 40 compiler::Node* NoContextConstant(); | 40 compiler::Node* NoContextConstant(); |
| 41 compiler::Node* NullConstant(); | 41 compiler::Node* NullConstant(); |
| 42 compiler::Node* UndefinedConstant(); | 42 compiler::Node* UndefinedConstant(); |
| 43 compiler::Node* TheHoleConstant(); | |
| 44 compiler::Node* HashSeed(); | |
| 45 compiler::Node* StaleRegisterConstant(); | 43 compiler::Node* StaleRegisterConstant(); |
| 46 | 44 |
| 47 // Float64 operations. | 45 // Float64 operations. |
| 48 compiler::Node* Float64Ceil(compiler::Node* x); | 46 compiler::Node* Float64Ceil(compiler::Node* x); |
| 49 compiler::Node* Float64Floor(compiler::Node* x); | 47 compiler::Node* Float64Floor(compiler::Node* x); |
| 50 compiler::Node* Float64Round(compiler::Node* x); | 48 compiler::Node* Float64Round(compiler::Node* x); |
| 51 compiler::Node* Float64Trunc(compiler::Node* x); | 49 compiler::Node* Float64Trunc(compiler::Node* x); |
| 52 | 50 |
| 53 // Tag a Word as a Smi value. | 51 // Tag a Word as a Smi value. |
| 54 compiler::Node* SmiTag(compiler::Node* value); | 52 compiler::Node* SmiTag(compiler::Node* value); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 MachineType rep = MachineType::AnyTagged()); | 105 MachineType rep = MachineType::AnyTagged()); |
| 108 // Load a field from an object on the heap. | 106 // Load a field from an object on the heap. |
| 109 compiler::Node* LoadObjectField(compiler::Node* object, int offset, | 107 compiler::Node* LoadObjectField(compiler::Node* object, int offset, |
| 110 MachineType rep = MachineType::AnyTagged()); | 108 MachineType rep = MachineType::AnyTagged()); |
| 111 // Load the floating point value of a HeapNumber. | 109 // Load the floating point value of a HeapNumber. |
| 112 compiler::Node* LoadHeapNumberValue(compiler::Node* object); | 110 compiler::Node* LoadHeapNumberValue(compiler::Node* object); |
| 113 // Load the Map of an HeapObject. | 111 // Load the Map of an HeapObject. |
| 114 compiler::Node* LoadMap(compiler::Node* object); | 112 compiler::Node* LoadMap(compiler::Node* object); |
| 115 // Load the instance type of an HeapObject. | 113 // Load the instance type of an HeapObject. |
| 116 compiler::Node* LoadInstanceType(compiler::Node* object); | 114 compiler::Node* LoadInstanceType(compiler::Node* object); |
| 117 // Load the properties backing store of a JSObject. | |
| 118 compiler::Node* LoadProperties(compiler::Node* object); | |
| 119 // Load the elements backing store of a JSObject. | 115 // Load the elements backing store of a JSObject. |
| 120 compiler::Node* LoadElements(compiler::Node* object); | 116 compiler::Node* LoadElements(compiler::Node* object); |
| 121 // Load the length of a fixed array base instance. | 117 // Load the length of a fixed array base instance. |
| 122 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); | 118 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); |
| 123 // Load the bit field of a Map. | 119 // Load the bit field of a Map. |
| 124 compiler::Node* LoadMapBitField(compiler::Node* map); | 120 compiler::Node* LoadMapBitField(compiler::Node* map); |
| 125 // Load bit field 2 of a map. | 121 // Load bit field 2 of a map. |
| 126 compiler::Node* LoadMapBitField2(compiler::Node* map); | 122 compiler::Node* LoadMapBitField2(compiler::Node* map); |
| 127 // Load bit field 3 of a map. | 123 // Load bit field 3 of a map. |
| 128 compiler::Node* LoadMapBitField3(compiler::Node* map); | 124 compiler::Node* LoadMapBitField3(compiler::Node* map); |
| 129 // Load the instance type of a map. | 125 // Load the instance type of a map. |
| 130 compiler::Node* LoadMapInstanceType(compiler::Node* map); | 126 compiler::Node* LoadMapInstanceType(compiler::Node* map); |
| 131 // Load the instance descriptors of a map. | 127 // Load the instance descriptors of a map. |
| 132 compiler::Node* LoadMapDescriptors(compiler::Node* map); | 128 compiler::Node* LoadMapDescriptors(compiler::Node* map); |
| 133 // Load the prototype of a map. | 129 // Load the prototype of a map. |
| 134 compiler::Node* LoadMapPrototype(compiler::Node* map); | 130 compiler::Node* LoadMapPrototype(compiler::Node* map); |
| 131 |
| 132 // Load the hash field of a name. |
| 133 compiler::Node* LoadNameHash(compiler::Node* name); |
| 135 // Load the instance size of a Map. | 134 // Load the instance size of a Map. |
| 136 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 135 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
| 137 | 136 |
| 138 // Load the hash field of a name. | |
| 139 compiler::Node* LoadNameHashField(compiler::Node* name); | |
| 140 // Load the hash value of a name. If {if_hash_not_computed} label | |
| 141 // is specified then it also checks if hash is actually computed. | |
| 142 compiler::Node* LoadNameHash(compiler::Node* name, | |
| 143 Label* if_hash_not_computed = nullptr); | |
| 144 | |
| 145 // Load length field of a String object. | |
| 146 compiler::Node* LoadStringLength(compiler::Node* object); | |
| 147 // Load value field of a JSValue object. | |
| 148 compiler::Node* LoadJSValueValue(compiler::Node* object); | |
| 149 | |
| 150 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); | 137 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); |
| 151 | 138 |
| 152 // Load an array element from a FixedArray. | 139 // Load an array element from a FixedArray. |
| 153 compiler::Node* LoadFixedArrayElement( | 140 compiler::Node* LoadFixedArrayElement( |
| 154 compiler::Node* object, compiler::Node* int32_index, | 141 compiler::Node* object, compiler::Node* int32_index, |
| 155 int additional_offset = 0, | 142 int additional_offset = 0, |
| 156 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 143 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 157 // Load an array element from a FixedDoubleArray. | |
| 158 compiler::Node* LoadFixedDoubleArrayElement( | |
| 159 compiler::Node* object, compiler::Node* int32_index, | |
| 160 MachineType machine_type, int additional_offset = 0, | |
| 161 ParameterMode parameter_mode = INTEGER_PARAMETERS); | |
| 162 | 144 |
| 163 // Context manipulation | 145 // Context manipulation |
| 164 compiler::Node* LoadNativeContext(compiler::Node* context); | 146 compiler::Node* LoadNativeContext(compiler::Node* context); |
| 165 | 147 |
| 166 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, | 148 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, |
| 167 compiler::Node* native_context); | 149 compiler::Node* native_context); |
| 168 | 150 |
| 169 // Store the floating point value of a HeapNumber. | 151 // Store the floating point value of a HeapNumber. |
| 170 compiler::Node* StoreHeapNumberValue(compiler::Node* object, | 152 compiler::Node* StoreHeapNumberValue(compiler::Node* object, |
| 171 compiler::Node* value); | 153 compiler::Node* value); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 template <typename T> | 223 template <typename T> |
| 242 compiler::Node* BitFieldDecode(compiler::Node* word32) { | 224 compiler::Node* BitFieldDecode(compiler::Node* word32) { |
| 243 return BitFieldDecode(word32, T::kShift, T::kMask); | 225 return BitFieldDecode(word32, T::kShift, T::kMask); |
| 244 } | 226 } |
| 245 | 227 |
| 246 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, | 228 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, |
| 247 uint32_t mask); | 229 uint32_t mask); |
| 248 | 230 |
| 249 // Various building blocks for stubs doing property lookups. | 231 // Various building blocks for stubs doing property lookups. |
| 250 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, | 232 void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, |
| 251 Label* if_keyisunique, Label* if_bailout); | 233 Label* if_keyisunique, Label* call_runtime); |
| 252 | |
| 253 static const int kInlinedDictionaryProbes = 4; | |
| 254 template <typename Dictionary> | |
| 255 void NameDictionaryLookup(compiler::Node* dictionary, | |
| 256 compiler::Node* unique_name, Label* if_found, | |
| 257 Variable* var_entry, Label* if_not_found, | |
| 258 int inlined_probes = kInlinedDictionaryProbes); | |
| 259 | |
| 260 compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); | |
| 261 | |
| 262 template <typename Dictionary> | |
| 263 void NumberDictionaryLookup(compiler::Node* dictionary, compiler::Node* key, | |
| 264 Label* if_found, Variable* var_entry, | |
| 265 Label* if_not_found); | |
| 266 | 234 |
| 267 void TryLookupProperty(compiler::Node* object, compiler::Node* map, | 235 void TryLookupProperty(compiler::Node* object, compiler::Node* map, |
| 268 compiler::Node* instance_type, | 236 compiler::Node* instance_type, compiler::Node* name, |
| 269 compiler::Node* unique_name, Label* if_found, | 237 Label* if_found, Label* if_not_found, |
| 270 Label* if_not_found, Label* if_bailout); | 238 Label* call_runtime); |
| 271 | 239 |
| 272 void TryLookupElement(compiler::Node* object, compiler::Node* map, | 240 void TryLookupElement(compiler::Node* object, compiler::Node* map, |
| 273 compiler::Node* instance_type, compiler::Node* index, | 241 compiler::Node* instance_type, compiler::Node* index, |
| 274 Label* if_found, Label* if_not_found, | 242 Label* if_found, Label* if_not_found, |
| 275 Label* if_bailout); | 243 Label* call_runtime); |
| 276 | 244 |
| 277 // Instanceof helpers. | 245 // Instanceof helpers. |
| 278 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) | 246 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) |
| 279 compiler::Node* OrdinaryHasInstance(compiler::Node* context, | 247 compiler::Node* OrdinaryHasInstance(compiler::Node* context, |
| 280 compiler::Node* callable, | 248 compiler::Node* callable, |
| 281 compiler::Node* object); | 249 compiler::Node* object); |
| 282 | 250 |
| 283 private: | 251 private: |
| 284 compiler::Node* ElementOffsetFromIndex(compiler::Node* index, | 252 compiler::Node* ElementOffsetFromIndex(compiler::Node* index, |
| 285 ElementsKind kind, ParameterMode mode, | 253 ElementsKind kind, ParameterMode mode, |
| 286 int base_size = 0); | 254 int base_size = 0); |
| 287 | 255 |
| 288 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, | 256 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, |
| 289 AllocationFlags flags, | 257 AllocationFlags flags, |
| 290 compiler::Node* top_address, | 258 compiler::Node* top_address, |
| 291 compiler::Node* limit_address); | 259 compiler::Node* limit_address); |
| 292 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, | 260 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, |
| 293 AllocationFlags flags, | 261 AllocationFlags flags, |
| 294 compiler::Node* top_adddress, | 262 compiler::Node* top_adddress, |
| 295 compiler::Node* limit_address); | 263 compiler::Node* limit_address); |
| 296 | 264 |
| 297 static const int kElementLoopUnrollThreshold = 8; | 265 static const int kElementLoopUnrollThreshold = 8; |
| 298 }; | 266 }; |
| 299 | 267 |
| 300 } // namespace internal | 268 } // namespace internal |
| 301 } // namespace v8 | 269 } // namespace v8 |
| 302 | 270 |
| 303 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 271 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |