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 <functional> | 8 #include <functional> |
9 | 9 |
10 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // On 32-bit platforms, there is a slight performance advantage to doing all | 70 // On 32-bit platforms, there is a slight performance advantage to doing all |
71 // of the array offset/index arithmetic with SMIs, since it's possible | 71 // of the array offset/index arithmetic with SMIs, since it's possible |
72 // to save a few tag/untag operations without paying an extra expense when | 72 // to save a few tag/untag operations without paying an extra expense when |
73 // calculating array offset (the smi math can be folded away) and there are | 73 // calculating array offset (the smi math can be folded away) and there are |
74 // fewer live ranges. Thus only convert indices to untagged value on 64-bit | 74 // fewer live ranges. Thus only convert indices to untagged value on 64-bit |
75 // platforms. | 75 // platforms. |
76 ParameterMode OptimalParameterMode() const { | 76 ParameterMode OptimalParameterMode() const { |
77 return Is64() ? INTPTR_PARAMETERS : SMI_PARAMETERS; | 77 return Is64() ? INTPTR_PARAMETERS : SMI_PARAMETERS; |
78 } | 78 } |
79 | 79 |
| 80 MachineRepresentation ParameterRepresentation(ParameterMode mode) const { |
| 81 return mode == INTPTR_PARAMETERS ? MachineType::PointerRepresentation() |
| 82 : MachineRepresentation::kTaggedSigned; |
| 83 } |
| 84 |
80 MachineRepresentation OptimalParameterRepresentation() const { | 85 MachineRepresentation OptimalParameterRepresentation() const { |
81 return OptimalParameterMode() == INTPTR_PARAMETERS | 86 return ParameterRepresentation(OptimalParameterMode()); |
82 ? MachineType::PointerRepresentation() | |
83 : MachineRepresentation::kTaggedSigned; | |
84 } | 87 } |
85 | 88 |
86 Node* ParameterToWord(Node* value, ParameterMode mode) { | 89 Node* ParameterToWord(Node* value, ParameterMode mode) { |
87 if (mode == SMI_PARAMETERS) value = SmiUntag(value); | 90 if (mode == SMI_PARAMETERS) value = SmiUntag(value); |
88 return value; | 91 return value; |
89 } | 92 } |
90 | 93 |
91 Node* WordToParameter(Node* value, ParameterMode mode) { | 94 Node* WordToParameter(Node* value, ParameterMode mode) { |
92 if (mode == SMI_PARAMETERS) value = SmiTag(value); | 95 if (mode == SMI_PARAMETERS) value = SmiTag(value); |
93 return value; | 96 return value; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // prototype info object or not. | 380 // prototype info object or not. |
378 Node* LoadMapPrototypeInfo(Node* map, Label* if_has_no_proto_info); | 381 Node* LoadMapPrototypeInfo(Node* map, Label* if_has_no_proto_info); |
379 // Load the instance size of a Map. | 382 // Load the instance size of a Map. |
380 Node* LoadMapInstanceSize(Node* map); | 383 Node* LoadMapInstanceSize(Node* map); |
381 // Load the inobject properties count of a Map (valid only for JSObjects). | 384 // Load the inobject properties count of a Map (valid only for JSObjects). |
382 Node* LoadMapInobjectProperties(Node* map); | 385 Node* LoadMapInobjectProperties(Node* map); |
383 // Load the constructor function index of a Map (only for primitive maps). | 386 // Load the constructor function index of a Map (only for primitive maps). |
384 Node* LoadMapConstructorFunctionIndex(Node* map); | 387 Node* LoadMapConstructorFunctionIndex(Node* map); |
385 // Load the constructor of a Map (equivalent to Map::GetConstructor()). | 388 // Load the constructor of a Map (equivalent to Map::GetConstructor()). |
386 Node* LoadMapConstructor(Node* map); | 389 Node* LoadMapConstructor(Node* map); |
| 390 // Loads a value from the specially encoded integer fields in the |
| 391 // SharedFunctionInfo object. |
| 392 // TODO(danno): This currently only works for the integer fields that are |
| 393 // mapped to the upper part of 64-bit words. We should customize |
| 394 // SFI::BodyDescriptor and store int32 values directly. |
| 395 Node* LoadSharedFunctionInfoSpecialField(Node* shared, int offset, |
| 396 ParameterMode param_mode); |
| 397 |
387 // Check if the map is set for slow properties. | 398 // Check if the map is set for slow properties. |
388 Node* IsDictionaryMap(Node* map); | 399 Node* IsDictionaryMap(Node* map); |
389 | 400 |
390 // Load the hash field of a name as an uint32 value. | 401 // Load the hash field of a name as an uint32 value. |
391 Node* LoadNameHashField(Node* name); | 402 Node* LoadNameHashField(Node* name); |
392 // Load the hash value of a name as an uint32 value. | 403 // Load the hash value of a name as an uint32 value. |
393 // If {if_hash_not_computed} label is specified then it also checks if | 404 // If {if_hash_not_computed} label is specified then it also checks if |
394 // hash is actually computed. | 405 // hash is actually computed. |
395 Node* LoadNameHash(Node* name, Label* if_hash_not_computed = nullptr); | 406 Node* LoadNameHash(Node* name, Label* if_hash_not_computed = nullptr); |
396 | 407 |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 ParameterMode mode, int header_size) { | 1119 ParameterMode mode, int header_size) { |
1109 return ElementOffsetFromIndex(element_count, kind, mode, header_size); | 1120 return ElementOffsetFromIndex(element_count, kind, mode, header_size); |
1110 } | 1121 } |
1111 | 1122 |
1112 Node* GetFixedArrayAllocationSize(Node* element_count, ElementsKind kind, | 1123 Node* GetFixedArrayAllocationSize(Node* element_count, ElementsKind kind, |
1113 ParameterMode mode) { | 1124 ParameterMode mode) { |
1114 return GetArrayAllocationSize(element_count, kind, mode, | 1125 return GetArrayAllocationSize(element_count, kind, mode, |
1115 FixedArray::kHeaderSize); | 1126 FixedArray::kHeaderSize); |
1116 } | 1127 } |
1117 | 1128 |
| 1129 void GotoIfFixedArraySizeDoesntFitInNewSpace(Node* element_count, |
| 1130 Label* doesnt_fit, int base_size, |
| 1131 ParameterMode mode); |
| 1132 |
1118 void InitializeFieldsWithRoot(Node* object, Node* start_offset, | 1133 void InitializeFieldsWithRoot(Node* object, Node* start_offset, |
1119 Node* end_offset, Heap::RootListIndex root); | 1134 Node* end_offset, Heap::RootListIndex root); |
1120 | 1135 |
1121 enum RelationalComparisonMode { | 1136 enum RelationalComparisonMode { |
1122 kLessThan, | 1137 kLessThan, |
1123 kLessThanOrEqual, | 1138 kLessThanOrEqual, |
1124 kGreaterThan, | 1139 kGreaterThan, |
1125 kGreaterThanOrEqual | 1140 kGreaterThanOrEqual |
1126 }; | 1141 }; |
1127 | 1142 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 } | 1327 } |
1313 #else | 1328 #else |
1314 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | 1329 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
1315 #endif | 1330 #endif |
1316 | 1331 |
1317 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1332 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
1318 | 1333 |
1319 } // namespace internal | 1334 } // namespace internal |
1320 } // namespace v8 | 1335 } // namespace v8 |
1321 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1336 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |