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

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

Issue 2436893003: [stubs] Cleanup CSA::BitFieldDecode() and friends. (Closed)
Patch Set: Addressing comments Created 4 years, 1 month 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
« no previous file with comments | « src/builtins/builtins-sharedarraybuffer.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 kTruncateMinusZero, 649 kTruncateMinusZero,
650 }; 650 };
651 651
652 // Convert any object to an Integer. 652 // Convert any object to an Integer.
653 compiler::Node* ToInteger(compiler::Node* context, compiler::Node* input, 653 compiler::Node* ToInteger(compiler::Node* context, compiler::Node* input,
654 ToIntegerTruncationMode mode = kNoTruncation); 654 ToIntegerTruncationMode mode = kNoTruncation);
655 655
656 // Returns a node that contains a decoded (unsigned!) value of a bit 656 // Returns a node that contains a decoded (unsigned!) value of a bit
657 // field |T| in |word32|. Returns result as an uint32 node. 657 // field |T| in |word32|. Returns result as an uint32 node.
658 template <typename T> 658 template <typename T>
659 compiler::Node* BitFieldDecode(compiler::Node* word32) { 659 compiler::Node* DecodeWord32(compiler::Node* word32) {
660 return BitFieldDecode(word32, T::kShift, T::kMask); 660 return DecodeWord32(word32, T::kShift, T::kMask);
661 }
662
663 // Returns a node that contains a decoded (unsigned!) value of a bit
664 // field |T| in |word|. Returns result as a word-size node.
665 template <typename T>
666 compiler::Node* DecodeWord(compiler::Node* word) {
667 return DecodeWord(word, T::kShift, T::kMask);
661 } 668 }
662 669
663 // Returns a node that contains a decoded (unsigned!) value of a bit 670 // Returns a node that contains a decoded (unsigned!) value of a bit
664 // field |T| in |word32|. Returns result as a word-size node. 671 // field |T| in |word32|. Returns result as a word-size node.
665 template <typename T> 672 template <typename T>
666 compiler::Node* BitFieldDecodeWord(compiler::Node* word32) { 673 compiler::Node* DecodeWordFromWord32(compiler::Node* word32) {
667 return ChangeUint32ToWord(BitFieldDecode<T>(word32)); 674 return DecodeWord<T>(ChangeUint32ToWord(word32));
668 } 675 }
669 676
670 // Decodes an unsigned (!) value from |word32| to an uint32 node. 677 // Decodes an unsigned (!) value from |word32| to an uint32 node.
671 compiler::Node* BitFieldDecode(compiler::Node* word32, uint32_t shift, 678 compiler::Node* DecodeWord32(compiler::Node* word32, uint32_t shift,
672 uint32_t mask); 679 uint32_t mask);
680
681 // Decodes an unsigned (!) value from |word| to a word-size node.
682 compiler::Node* DecodeWord(compiler::Node* word, uint32_t shift,
683 uint32_t mask);
684
685 // Returns true if any of the |T|'s bits in given |word32| are set.
686 template <typename T>
687 compiler::Node* IsSetWord32(compiler::Node* word32) {
688 return Word32NotEqual(Word32And(word32, Int32Constant(T::kMask)),
689 Int32Constant(0));
690 }
691
692 // Returns true if any of the |T|'s bits in given |word| are set.
693 template <typename T>
694 compiler::Node* IsSetWord(compiler::Node* word) {
695 return WordNotEqual(WordAnd(word, IntPtrConstant(T::kMask)),
696 IntPtrConstant(0));
697 }
673 698
674 void SetCounter(StatsCounter* counter, int value); 699 void SetCounter(StatsCounter* counter, int value);
675 void IncrementCounter(StatsCounter* counter, int delta); 700 void IncrementCounter(StatsCounter* counter, int delta);
676 void DecrementCounter(StatsCounter* counter, int delta); 701 void DecrementCounter(StatsCounter* counter, int delta);
677 702
678 // Generates "if (false) goto label" code. Useful for marking a label as 703 // Generates "if (false) goto label" code. Useful for marking a label as
679 // "live" to avoid assertion failures during graph building. In the resulting 704 // "live" to avoid assertion failures during graph building. In the resulting
680 // code this check will be eliminated. 705 // code this check will be eliminated.
681 void Use(Label* label); 706 void Use(Label* label);
682 707
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 static const int kElementLoopUnrollThreshold = 8; 1120 static const int kElementLoopUnrollThreshold = 8;
1096 }; 1121 };
1097 1122
1098 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) 1123 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__)
1099 1124
1100 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 1125 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
1101 1126
1102 } // namespace internal 1127 } // namespace internal
1103 } // namespace v8 1128 } // namespace v8
1104 #endif // V8_CODE_STUB_ASSEMBLER_H_ 1129 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-sharedarraybuffer.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698