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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 #define HEAP_CONSTANT_TEST(rootName, name) \ | 94 #define HEAP_CONSTANT_TEST(rootName, name) \ |
95 compiler::Node* Is##name(compiler::Node* value); | 95 compiler::Node* Is##name(compiler::Node* value); |
96 HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST) | 96 HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST) |
97 #undef HEAP_CONSTANT_TEST | 97 #undef HEAP_CONSTANT_TEST |
98 | 98 |
99 compiler::Node* HashSeed(); | 99 compiler::Node* HashSeed(); |
100 compiler::Node* StaleRegisterConstant(); | 100 compiler::Node* StaleRegisterConstant(); |
101 | 101 |
102 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); | 102 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); |
103 | 103 |
104 compiler::Node* IntPtrAddFoldConstants(compiler::Node* left, | |
105 compiler::Node* right); | |
106 compiler::Node* IntPtrSubFoldConstants(compiler::Node* left, | |
107 compiler::Node* right); | |
108 | |
104 // Float64 operations. | 109 // Float64 operations. |
105 compiler::Node* Float64Ceil(compiler::Node* x); | 110 compiler::Node* Float64Ceil(compiler::Node* x); |
106 compiler::Node* Float64Floor(compiler::Node* x); | 111 compiler::Node* Float64Floor(compiler::Node* x); |
107 compiler::Node* Float64Round(compiler::Node* x); | 112 compiler::Node* Float64Round(compiler::Node* x); |
108 compiler::Node* Float64Trunc(compiler::Node* x); | 113 compiler::Node* Float64Trunc(compiler::Node* x); |
109 | 114 |
110 // Tag a Word as a Smi value. | 115 // Tag a Word as a Smi value. |
111 compiler::Node* SmiTag(compiler::Node* value); | 116 compiler::Node* SmiTag(compiler::Node* value); |
112 // Untag a Smi value as a Word. | 117 // Untag a Smi value as a Word. |
113 compiler::Node* SmiUntag(compiler::Node* value); | 118 compiler::Node* SmiUntag(compiler::Node* value); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 compiler::Node* StoreFixedDoubleArrayElement( | 339 compiler::Node* StoreFixedDoubleArrayElement( |
335 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 340 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
336 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 341 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
337 | 342 |
338 // Allocate a HeapNumber without initializing its value. | 343 // Allocate a HeapNumber without initializing its value. |
339 compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); | 344 compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); |
340 // Allocate a HeapNumber with a specific value. | 345 // Allocate a HeapNumber with a specific value. |
341 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, | 346 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, |
342 MutableMode mode = IMMUTABLE); | 347 MutableMode mode = IMMUTABLE); |
343 // Allocate a SeqOneByteString with the given length. | 348 // Allocate a SeqOneByteString with the given length. |
344 compiler::Node* AllocateSeqOneByteString(int length); | 349 compiler::Node* AllocateSeqOneByteString(int length, |
350 AllocationFlags flags = kNone); | |
345 compiler::Node* AllocateSeqOneByteString(compiler::Node* context, | 351 compiler::Node* AllocateSeqOneByteString(compiler::Node* context, |
346 compiler::Node* length); | 352 compiler::Node* length, |
353 AllocationFlags flags = kNone); | |
347 // Allocate a SeqTwoByteString with the given length. | 354 // Allocate a SeqTwoByteString with the given length. |
348 compiler::Node* AllocateSeqTwoByteString(int length); | 355 compiler::Node* AllocateSeqTwoByteString(int length, |
356 AllocationFlags flags = kNone); | |
349 compiler::Node* AllocateSeqTwoByteString(compiler::Node* context, | 357 compiler::Node* AllocateSeqTwoByteString(compiler::Node* context, |
350 compiler::Node* length); | 358 compiler::Node* length, |
359 AllocationFlags flags = kNone); | |
351 | 360 |
352 // Allocate a SlicedOneByteString with the given length, parent and offset. | 361 // Allocate a SlicedOneByteString with the given length, parent and offset. |
353 // |length| and |offset| are expected to be tagged. | 362 // |length| and |offset| are expected to be tagged. |
354 compiler::Node* AllocateSlicedOneByteString(compiler::Node* length, | 363 compiler::Node* AllocateSlicedOneByteString(compiler::Node* length, |
355 compiler::Node* parent, | 364 compiler::Node* parent, |
356 compiler::Node* offset); | 365 compiler::Node* offset); |
357 // Allocate a SlicedTwoByteString with the given length, parent and offset. | 366 // Allocate a SlicedTwoByteString with the given length, parent and offset. |
358 // |length| and |offset| are expected to be tagged. | 367 // |length| and |offset| are expected to be tagged. |
359 compiler::Node* AllocateSlicedTwoByteString(compiler::Node* length, | 368 compiler::Node* AllocateSlicedTwoByteString(compiler::Node* length, |
360 compiler::Node* parent, | 369 compiler::Node* parent, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 void CopyFixedArrayElements( | 437 void CopyFixedArrayElements( |
429 ElementsKind from_kind, compiler::Node* from_array, ElementsKind to_kind, | 438 ElementsKind from_kind, compiler::Node* from_array, ElementsKind to_kind, |
430 compiler::Node* to_array, compiler::Node* element_count, | 439 compiler::Node* to_array, compiler::Node* element_count, |
431 compiler::Node* capacity, | 440 compiler::Node* capacity, |
432 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, | 441 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
433 ParameterMode mode = INTEGER_PARAMETERS); | 442 ParameterMode mode = INTEGER_PARAMETERS); |
434 | 443 |
435 // Copies |character_count| elements from |from_string| to |to_string| | 444 // Copies |character_count| elements from |from_string| to |to_string| |
436 // starting at the |from_index|'th character. |from_string| and |to_string| | 445 // starting at the |from_index|'th character. |from_string| and |to_string| |
437 // must be either both one-byte strings or both two-byte strings. | 446 // must be either both one-byte strings or both two-byte strings. |
438 // |from_index|, |to_index| and |character_count| must be Smis s.t. | 447 // |from_index|, |to_index| and |character_count| must be Smis s.t. |
jgruber
2016/10/13 14:10:16
Comment should be updated (or removed) to reflect
danno
2016/10/17 14:23:26
Done.
| |
439 // 0 <= |from_index| <= |from_index| + |character_count| <= from_string.length | 448 // 0 <= |from_index| <= |from_index| + |character_count| <= from_string.length |
440 // and | 449 // and |
441 // 0 <= |to_index| <= |to_index| + |character_count| <= to_string.length. | 450 // 0 <= |to_index| <= |to_index| + |character_count| <= to_string.length. |
442 void CopyStringCharacters(compiler::Node* from_string, | 451 void CopyStringCharacters(compiler::Node* from_string, |
443 compiler::Node* to_string, | 452 compiler::Node* to_string, |
444 compiler::Node* from_index, | 453 compiler::Node* from_index, |
445 compiler::Node* to_index, | 454 compiler::Node* to_index, |
446 compiler::Node* character_count, | 455 compiler::Node* character_count, |
447 String::Encoding encoding); | 456 String::Encoding encoding, ParameterMode mode); |
448 | 457 |
449 // Loads an element from |array| of |from_kind| elements by given |offset| | 458 // Loads an element from |array| of |from_kind| elements by given |offset| |
450 // (NOTE: not index!), does a hole check if |if_hole| is provided and | 459 // (NOTE: not index!), does a hole check if |if_hole| is provided and |
451 // converts the value so that it becomes ready for storing to array of | 460 // converts the value so that it becomes ready for storing to array of |
452 // |to_kind| elements. | 461 // |to_kind| elements. |
453 compiler::Node* LoadElementAndPrepareForStore(compiler::Node* array, | 462 compiler::Node* LoadElementAndPrepareForStore(compiler::Node* array, |
454 compiler::Node* offset, | 463 compiler::Node* offset, |
455 ElementsKind from_kind, | 464 ElementsKind from_kind, |
456 ElementsKind to_kind, | 465 ElementsKind to_kind, |
457 Label* if_hole); | 466 Label* if_hole); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 compiler::Node* NumberToString(compiler::Node* context, | 565 compiler::Node* NumberToString(compiler::Node* context, |
557 compiler::Node* input); | 566 compiler::Node* input); |
558 // Convert an object to a name. | 567 // Convert an object to a name. |
559 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); | 568 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); |
560 // Convert a Non-Number object to a Number. | 569 // Convert a Non-Number object to a Number. |
561 compiler::Node* NonNumberToNumber(compiler::Node* context, | 570 compiler::Node* NonNumberToNumber(compiler::Node* context, |
562 compiler::Node* input); | 571 compiler::Node* input); |
563 // Convert any object to a Number. | 572 // Convert any object to a Number. |
564 compiler::Node* ToNumber(compiler::Node* context, compiler::Node* input); | 573 compiler::Node* ToNumber(compiler::Node* context, compiler::Node* input); |
565 | 574 |
575 // Convert any object to a String. | |
576 compiler::Node* ToString(compiler::Node* context, compiler::Node* input); | |
577 | |
578 // Convert any object to a Primitive. | |
579 compiler::Node* JSReceiverToPrimitive(compiler::Node* context, | |
580 compiler::Node* input); | |
581 | |
566 enum ToIntegerTruncationMode { | 582 enum ToIntegerTruncationMode { |
567 kNoTruncation, | 583 kNoTruncation, |
568 kTruncateMinusZero, | 584 kTruncateMinusZero, |
569 }; | 585 }; |
570 | 586 |
571 // Convert any object to an Integer. | 587 // Convert any object to an Integer. |
572 compiler::Node* ToInteger(compiler::Node* context, compiler::Node* input, | 588 compiler::Node* ToInteger(compiler::Node* context, compiler::Node* input, |
573 ToIntegerTruncationMode mode = kNoTruncation); | 589 ToIntegerTruncationMode mode = kNoTruncation); |
574 | 590 |
591 compiler::Node* NewConsString(compiler::Node* context, compiler::Node* length, | |
592 compiler::Node* left, compiler::Node* right, | |
593 AllocationFlags flags = kNone); | |
594 | |
595 compiler::Node* StringAdd(compiler::Node* context, compiler::Node* left, | |
596 compiler::Node* right, | |
597 AllocationFlags flags = kNone); | |
598 | |
575 // Returns a node that contains a decoded (unsigned!) value of a bit | 599 // Returns a node that contains a decoded (unsigned!) value of a bit |
576 // field |T| in |word32|. Returns result as an uint32 node. | 600 // field |T| in |word32|. Returns result as an uint32 node. |
577 template <typename T> | 601 template <typename T> |
578 compiler::Node* BitFieldDecode(compiler::Node* word32) { | 602 compiler::Node* BitFieldDecode(compiler::Node* word32) { |
579 return BitFieldDecode(word32, T::kShift, T::kMask); | 603 return BitFieldDecode(word32, T::kShift, T::kMask); |
580 } | 604 } |
581 | 605 |
582 // Returns a node that contains a decoded (unsigned!) value of a bit | 606 // Returns a node that contains a decoded (unsigned!) value of a bit |
583 // field |T| in |word32|. Returns result as a word-size node. | 607 // field |T| in |word32|. Returns result as a word-size node. |
584 template <typename T> | 608 template <typename T> |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
988 Label* bailout); | 1012 Label* bailout); |
989 | 1013 |
990 static const int kElementLoopUnrollThreshold = 8; | 1014 static const int kElementLoopUnrollThreshold = 8; |
991 }; | 1015 }; |
992 | 1016 |
993 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1017 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
994 | 1018 |
995 } // namespace internal | 1019 } // namespace internal |
996 } // namespace v8 | 1020 } // namespace v8 |
997 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1021 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |