Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: src/code-stub-assembler.h

Issue 2405253006: [builtins] implement Array.prototype[@@iterator] in TFJ builtins (Closed)
Patch Set: fix JSArrayIteratorVerify() Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "src/objects.h" 11 #include "src/objects.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 class CallInterfaceDescriptor; 16 class CallInterfaceDescriptor;
17 class StatsCounter; 17 class StatsCounter;
18 class StubCache; 18 class StubCache;
19 19
20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; 20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
21 21
22 enum class IterationKind { kKeys, kValues, kEntries };
23
22 #define HEAP_CONSTANT_LIST(V) \ 24 #define HEAP_CONSTANT_LIST(V) \
23 V(BooleanMap, BooleanMap) \ 25 V(BooleanMap, BooleanMap) \
24 V(empty_string, EmptyString) \ 26 V(empty_string, EmptyString) \
25 V(EmptyFixedArray, EmptyFixedArray) \ 27 V(EmptyFixedArray, EmptyFixedArray) \
26 V(FalseValue, False) \ 28 V(FalseValue, False) \
27 V(FixedArrayMap, FixedArrayMap) \ 29 V(FixedArrayMap, FixedArrayMap) \
28 V(FixedCOWArrayMap, FixedCOWArrayMap) \ 30 V(FixedCOWArrayMap, FixedCOWArrayMap) \
29 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \ 31 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \
30 V(HeapNumberMap, HeapNumberMap) \ 32 V(HeapNumberMap, HeapNumberMap) \
31 V(MinusZeroValue, MinusZero) \ 33 V(MinusZeroValue, MinusZero) \
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b); 134 compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b);
133 // Computes a % b for Smi inputs a and b; result is not necessarily a Smi. 135 // Computes a % b for Smi inputs a and b; result is not necessarily a Smi.
134 compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b); 136 compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b);
135 // Computes a * b for Smi inputs a and b; result is not necessarily a Smi. 137 // Computes a * b for Smi inputs a and b; result is not necessarily a Smi.
136 compiler::Node* SmiMul(compiler::Node* a, compiler::Node* b); 138 compiler::Node* SmiMul(compiler::Node* a, compiler::Node* b);
137 compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) { 139 compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) {
138 return BitcastWordToTaggedSigned( 140 return BitcastWordToTaggedSigned(
139 WordOr(BitcastTaggedToWord(a), BitcastTaggedToWord(b))); 141 WordOr(BitcastTaggedToWord(a), BitcastTaggedToWord(b)));
140 } 142 }
141 143
144 // Smi | HeapNumber operations.
145 compiler::Node* NumberInc(compiler::Node* value);
146
142 // Allocate an object of the given size. 147 // Allocate an object of the given size.
143 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); 148 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone);
144 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); 149 compiler::Node* Allocate(int size, AllocationFlags flags = kNone);
145 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); 150 compiler::Node* InnerAllocate(compiler::Node* previous, int offset);
146 compiler::Node* InnerAllocate(compiler::Node* previous, 151 compiler::Node* InnerAllocate(compiler::Node* previous,
147 compiler::Node* offset); 152 compiler::Node* offset);
148 153
149 void Assert(compiler::Node* condition, const char* string = nullptr, 154 void Assert(compiler::Node* condition, const char* string = nullptr,
150 const char* file = nullptr, int line = 0); 155 const char* file = nullptr, int line = 0);
151 156
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 int additional_offset = 0, 293 int additional_offset = 0,
289 ParameterMode parameter_mode = INTEGER_PARAMETERS, 294 ParameterMode parameter_mode = INTEGER_PARAMETERS,
290 Label* if_hole = nullptr); 295 Label* if_hole = nullptr);
291 296
292 // Load Float64 value by |base| + |offset| address. If the value is a double 297 // Load Float64 value by |base| + |offset| address. If the value is a double
293 // hole then jump to |if_hole|. If |machine_type| is None then only the hole 298 // hole then jump to |if_hole|. If |machine_type| is None then only the hole
294 // check is generated. 299 // check is generated.
295 compiler::Node* LoadDoubleWithHoleCheck( 300 compiler::Node* LoadDoubleWithHoleCheck(
296 compiler::Node* base, compiler::Node* offset, Label* if_hole, 301 compiler::Node* base, compiler::Node* offset, Label* if_hole,
297 MachineType machine_type = MachineType::Float64()); 302 MachineType machine_type = MachineType::Float64());
303 compiler::Node* LoadFixedTypedArrayElement(
304 compiler::Node* data_pointer, compiler::Node* index_node,
305 ElementsKind elements_kind,
306 ParameterMode parameter_mode = INTEGER_PARAMETERS);
298 307
299 // Context manipulation 308 // Context manipulation
300 compiler::Node* LoadContextElement(compiler::Node* context, int slot_index); 309 compiler::Node* LoadContextElement(compiler::Node* context, int slot_index);
301 compiler::Node* StoreContextElement(compiler::Node* context, int slot_index, 310 compiler::Node* StoreContextElement(compiler::Node* context, int slot_index,
302 compiler::Node* value); 311 compiler::Node* value);
303 compiler::Node* LoadNativeContext(compiler::Node* context); 312 compiler::Node* LoadNativeContext(compiler::Node* context);
304 313
305 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, 314 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind,
306 compiler::Node* native_context); 315 compiler::Node* native_context);
307 316
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 compiler::Node* AllocateJSArray( 408 compiler::Node* AllocateJSArray(
400 ElementsKind kind, compiler::Node* array_map, compiler::Node* capacity, 409 ElementsKind kind, compiler::Node* array_map, compiler::Node* capacity,
401 compiler::Node* length, compiler::Node* allocation_site = nullptr, 410 compiler::Node* length, compiler::Node* allocation_site = nullptr,
402 ParameterMode capacity_mode = INTEGER_PARAMETERS); 411 ParameterMode capacity_mode = INTEGER_PARAMETERS);
403 412
404 compiler::Node* AllocateFixedArray(ElementsKind kind, 413 compiler::Node* AllocateFixedArray(ElementsKind kind,
405 compiler::Node* capacity, 414 compiler::Node* capacity,
406 ParameterMode mode = INTEGER_PARAMETERS, 415 ParameterMode mode = INTEGER_PARAMETERS,
407 AllocationFlags flags = kNone); 416 AllocationFlags flags = kNone);
408 417
418 // Perform CreateArrayIterator (ES6 #sec-createarrayiterator).
419 compiler::Node* CreateArrayIterator(compiler::Node* array,
420 compiler::Node* array_map,
421 compiler::Node* array_type,
422 compiler::Node* context,
423 IterationKind mode);
424
425 compiler::Node* AllocateJSArrayIterator(compiler::Node* array,
426 compiler::Node* array_map,
427 compiler::Node* map);
428
409 void FillFixedArrayWithValue(ElementsKind kind, compiler::Node* array, 429 void FillFixedArrayWithValue(ElementsKind kind, compiler::Node* array,
410 compiler::Node* from_index, 430 compiler::Node* from_index,
411 compiler::Node* to_index, 431 compiler::Node* to_index,
412 Heap::RootListIndex value_root_index, 432 Heap::RootListIndex value_root_index,
413 ParameterMode mode = INTEGER_PARAMETERS); 433 ParameterMode mode = INTEGER_PARAMETERS);
414 434
415 // Copies all elements from |from_array| of |length| size to 435 // Copies all elements from |from_array| of |length| size to
416 // |to_array| of the same size respecting the elements kind. 436 // |to_array| of the same size respecting the elements kind.
417 void CopyFixedArrayElements( 437 void CopyFixedArrayElements(
418 ElementsKind kind, compiler::Node* from_array, compiler::Node* to_array, 438 ElementsKind kind, compiler::Node* from_array, compiler::Node* to_array,
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 kLessThan, 920 kLessThan,
901 kLessThanOrEqual, 921 kLessThanOrEqual,
902 kGreaterThan, 922 kGreaterThan,
903 kGreaterThanOrEqual 923 kGreaterThanOrEqual
904 }; 924 };
905 925
906 compiler::Node* RelationalComparison(RelationalComparisonMode mode, 926 compiler::Node* RelationalComparison(RelationalComparisonMode mode,
907 compiler::Node* lhs, compiler::Node* rhs, 927 compiler::Node* lhs, compiler::Node* rhs,
908 compiler::Node* context); 928 compiler::Node* context);
909 929
930 void BranchIfNumericRelationalComparison(RelationalComparisonMode mode,
931 compiler::Node* lhs,
932 compiler::Node* rhs, Label* if_true,
933 Label* if_false);
934
935 void GotoUnlessNumberLessThan(compiler::Node* lhs, compiler::Node* rhs,
936 Label* if_false);
937
910 enum ResultMode { kDontNegateResult, kNegateResult }; 938 enum ResultMode { kDontNegateResult, kNegateResult };
911 939
912 compiler::Node* Equal(ResultMode mode, compiler::Node* lhs, 940 compiler::Node* Equal(ResultMode mode, compiler::Node* lhs,
913 compiler::Node* rhs, compiler::Node* context); 941 compiler::Node* rhs, compiler::Node* context);
914 942
915 compiler::Node* StrictEqual(ResultMode mode, compiler::Node* lhs, 943 compiler::Node* StrictEqual(ResultMode mode, compiler::Node* lhs,
916 compiler::Node* rhs, compiler::Node* context); 944 compiler::Node* rhs, compiler::Node* context);
917 945
918 compiler::Node* HasProperty( 946 compiler::Node* HasProperty(
919 compiler::Node* object, compiler::Node* key, compiler::Node* context, 947 compiler::Node* object, compiler::Node* key, compiler::Node* context,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 static const int kElementLoopUnrollThreshold = 8; 1018 static const int kElementLoopUnrollThreshold = 8;
991 }; 1019 };
992 1020
993 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) 1021 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__)
994 1022
995 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 1023 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
996 1024
997 } // namespace internal 1025 } // namespace internal
998 } // namespace v8 1026 } // namespace v8
999 #endif // V8_CODE_STUB_ASSEMBLER_H_ 1027 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698