| 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 14 matching lines...) Expand all Loading... |
| 25 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. | 25 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. |
| 26 CodeStubAssembler(Isolate* isolate, Zone* zone, | 26 CodeStubAssembler(Isolate* isolate, Zone* zone, |
| 27 const CallInterfaceDescriptor& descriptor, | 27 const CallInterfaceDescriptor& descriptor, |
| 28 Code::Flags flags, const char* name, | 28 Code::Flags flags, const char* name, |
| 29 size_t result_size = 1); | 29 size_t result_size = 1); |
| 30 | 30 |
| 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 enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS }; |
| 36 |
| 35 compiler::Node* BooleanMapConstant(); | 37 compiler::Node* BooleanMapConstant(); |
| 36 compiler::Node* EmptyStringConstant(); | 38 compiler::Node* EmptyStringConstant(); |
| 37 compiler::Node* HeapNumberMapConstant(); | 39 compiler::Node* HeapNumberMapConstant(); |
| 38 compiler::Node* NoContextConstant(); | 40 compiler::Node* NoContextConstant(); |
| 39 compiler::Node* NullConstant(); | 41 compiler::Node* NullConstant(); |
| 40 compiler::Node* UndefinedConstant(); | 42 compiler::Node* UndefinedConstant(); |
| 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); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 compiler::Node* LoadMapPrototype(compiler::Node* map); | 127 compiler::Node* LoadMapPrototype(compiler::Node* map); |
| 126 | 128 |
| 127 // Load the hash field of a name. | 129 // Load the hash field of a name. |
| 128 compiler::Node* LoadNameHash(compiler::Node* name); | 130 compiler::Node* LoadNameHash(compiler::Node* name); |
| 129 // Load the instance size of a Map. | 131 // Load the instance size of a Map. |
| 130 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 132 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
| 131 | 133 |
| 132 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); | 134 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); |
| 133 | 135 |
| 134 // Load an array element from a FixedArray. | 136 // Load an array element from a FixedArray. |
| 135 compiler::Node* LoadFixedArrayElementInt32Index(compiler::Node* object, | 137 compiler::Node* LoadFixedArrayElement( |
| 136 compiler::Node* int32_index, | 138 compiler::Node* object, compiler::Node* int32_index, |
| 137 int additional_offset = 0); | 139 int additional_offset = 0, |
| 138 compiler::Node* LoadFixedArrayElementSmiIndex(compiler::Node* object, | 140 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 139 compiler::Node* smi_index, | |
| 140 int additional_offset = 0); | |
| 141 compiler::Node* LoadFixedArrayElementConstantIndex(compiler::Node* object, | |
| 142 int index); | |
| 143 | 141 |
| 144 // Context manipulation | 142 // Context manipulation |
| 145 compiler::Node* LoadNativeContext(compiler::Node* context); | 143 compiler::Node* LoadNativeContext(compiler::Node* context); |
| 146 | 144 |
| 147 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, | 145 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, |
| 148 compiler::Node* native_context); | 146 compiler::Node* native_context); |
| 149 | 147 |
| 150 // Store the floating point value of a HeapNumber. | 148 // Store the floating point value of a HeapNumber. |
| 151 compiler::Node* StoreHeapNumberValue(compiler::Node* object, | 149 compiler::Node* StoreHeapNumberValue(compiler::Node* object, |
| 152 compiler::Node* value); | 150 compiler::Node* value); |
| 153 // Store a field to an object on the heap. | 151 // Store a field to an object on the heap. |
| 154 compiler::Node* StoreObjectField( | 152 compiler::Node* StoreObjectField( |
| 155 compiler::Node* object, int offset, compiler::Node* value); | 153 compiler::Node* object, int offset, compiler::Node* value); |
| 156 compiler::Node* StoreObjectFieldNoWriteBarrier( | 154 compiler::Node* StoreObjectFieldNoWriteBarrier( |
| 157 compiler::Node* object, int offset, compiler::Node* value, | 155 compiler::Node* object, int offset, compiler::Node* value, |
| 158 MachineRepresentation rep = MachineRepresentation::kTagged); | 156 MachineRepresentation rep = MachineRepresentation::kTagged); |
| 159 // Store the Map of an HeapObject. | 157 // Store the Map of an HeapObject. |
| 160 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, | 158 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, |
| 161 compiler::Node* map); | 159 compiler::Node* map); |
| 162 // Store an array element to a FixedArray. | 160 // Store an array element to a FixedArray. |
| 163 compiler::Node* StoreFixedArrayElementInt32Index(compiler::Node* object, | 161 compiler::Node* StoreFixedArrayElement( |
| 164 compiler::Node* index, | 162 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
| 165 compiler::Node* value); | 163 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
| 166 compiler::Node* StoreFixedArrayElementNoWriteBarrier(compiler::Node* object, | 164 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 167 compiler::Node* index, | 165 |
| 168 compiler::Node* value); | 166 compiler::Node* StoreFixedDoubleArrayElement( |
| 169 compiler::Node* StoreFixedDoubleArrayElementInt32Index(compiler::Node* object, | 167 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
| 170 compiler::Node* index, | 168 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 171 compiler::Node* value); | |
| 172 compiler::Node* StoreFixedArrayElementInt32Index(compiler::Node* object, | |
| 173 int index, | |
| 174 compiler::Node* value); | |
| 175 compiler::Node* StoreFixedArrayElementNoWriteBarrier(compiler::Node* object, | |
| 176 int index, | |
| 177 compiler::Node* value); | |
| 178 compiler::Node* StoreFixedDoubleArrayElementInt32Index(compiler::Node* object, | |
| 179 int index, | |
| 180 compiler::Node* value); | |
| 181 | 169 |
| 182 // Allocate a HeapNumber without initializing its value. | 170 // Allocate a HeapNumber without initializing its value. |
| 183 compiler::Node* AllocateHeapNumber(); | 171 compiler::Node* AllocateHeapNumber(); |
| 184 // Allocate a HeapNumber with a specific value. | 172 // Allocate a HeapNumber with a specific value. |
| 185 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value); | 173 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value); |
| 186 // Allocate a SeqOneByteString with the given length. | 174 // Allocate a SeqOneByteString with the given length. |
| 187 compiler::Node* AllocateSeqOneByteString(int length); | 175 compiler::Node* AllocateSeqOneByteString(int length); |
| 188 // Allocate a SeqTwoByteString with the given length. | 176 // Allocate a SeqTwoByteString with the given length. |
| 189 compiler::Node* AllocateSeqTwoByteString(int length); | 177 compiler::Node* AllocateSeqTwoByteString(int length); |
| 190 // Allocated an JSArray | 178 // Allocated an JSArray |
| 191 compiler::Node* AllocateJSArray(ElementsKind kind, compiler::Node* array_map, | 179 compiler::Node* AllocateJSArray(ElementsKind kind, compiler::Node* array_map, |
| 192 int capacity, int length, | 180 compiler::Node* capacity, |
| 193 compiler::Node* allocation_site = nullptr); | 181 compiler::Node* length, |
| 182 compiler::Node* allocation_site = nullptr, |
| 183 ParameterMode mode = INTEGER_PARAMETERS); |
| 194 | 184 |
| 195 // Allocation site manipulation | 185 // Allocation site manipulation |
| 196 void InitializeAllocationMemento(compiler::Node* base_allocation, | 186 void InitializeAllocationMemento(compiler::Node* base_allocation, |
| 197 int base_allocation_size, | 187 int base_allocation_size, |
| 198 compiler::Node* allocation_site); | 188 compiler::Node* allocation_site); |
| 199 | 189 |
| 200 compiler::Node* TruncateTaggedToFloat64(compiler::Node* context, | 190 compiler::Node* TruncateTaggedToFloat64(compiler::Node* context, |
| 201 compiler::Node* value); | 191 compiler::Node* value); |
| 202 compiler::Node* TruncateTaggedToWord32(compiler::Node* context, | 192 compiler::Node* TruncateTaggedToWord32(compiler::Node* context, |
| 203 compiler::Node* value); | 193 compiler::Node* value); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 Label* if_found, Label* if_not_found, | 235 Label* if_found, Label* if_not_found, |
| 246 Label* call_runtime); | 236 Label* call_runtime); |
| 247 | 237 |
| 248 // Instanceof helpers. | 238 // Instanceof helpers. |
| 249 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) | 239 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) |
| 250 compiler::Node* OrdinaryHasInstance(compiler::Node* context, | 240 compiler::Node* OrdinaryHasInstance(compiler::Node* context, |
| 251 compiler::Node* callable, | 241 compiler::Node* callable, |
| 252 compiler::Node* object); | 242 compiler::Node* object); |
| 253 | 243 |
| 254 private: | 244 private: |
| 245 compiler::Node* ElementOffsetFromIndex(compiler::Node* index, |
| 246 ElementsKind kind, ParameterMode mode, |
| 247 int base_size = 0); |
| 248 |
| 255 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, | 249 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, |
| 256 AllocationFlags flags, | 250 AllocationFlags flags, |
| 257 compiler::Node* top_address, | 251 compiler::Node* top_address, |
| 258 compiler::Node* limit_address); | 252 compiler::Node* limit_address); |
| 259 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, | 253 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, |
| 260 AllocationFlags flags, | 254 AllocationFlags flags, |
| 261 compiler::Node* top_adddress, | 255 compiler::Node* top_adddress, |
| 262 compiler::Node* limit_address); | 256 compiler::Node* limit_address); |
| 263 | 257 |
| 264 static const int kElementLoopUnrollThreshold = 8; | 258 static const int kElementLoopUnrollThreshold = 8; |
| 265 }; | 259 }; |
| 266 | 260 |
| 267 } // namespace internal | 261 } // namespace internal |
| 268 } // namespace v8 | 262 } // namespace v8 |
| 269 | 263 |
| 270 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 264 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |