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

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

Issue 2847923003: [csa] Add assertions to CSA (Closed)
Patch Set: Compile fixes Created 3 years, 7 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
« no previous file with comments | « no previous file | src/code-stub-assembler.cc » ('j') | src/code-stub-assembler.cc » ('J')
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Node* ParameterToTagged(Node* value, ParameterMode mode) { 107 Node* ParameterToTagged(Node* value, ParameterMode mode) {
108 if (mode != SMI_PARAMETERS) value = SmiTag(value); 108 if (mode != SMI_PARAMETERS) value = SmiTag(value);
109 return value; 109 return value;
110 } 110 }
111 111
112 Node* TaggedToParameter(Node* value, ParameterMode mode) { 112 Node* TaggedToParameter(Node* value, ParameterMode mode) {
113 if (mode != SMI_PARAMETERS) value = SmiUntag(value); 113 if (mode != SMI_PARAMETERS) value = SmiUntag(value);
114 return value; 114 return value;
115 } 115 }
116 116
117 Node* IsParameterMode(Node* value, ParameterMode mode);
Camillo Bruni 2017/04/28 15:57:44 A bit a confusing name, how about: IsParameterMode
jgruber 2017/05/03 11:11:50 Agreed, changed to MatchesParameterMode.
118
117 #define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName) \ 119 #define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName) \
118 Node* OpName(Node* a, Node* b, ParameterMode mode) { \ 120 Node* OpName(Node* a, Node* b, ParameterMode mode) { \
119 if (mode == SMI_PARAMETERS) { \ 121 if (mode == SMI_PARAMETERS) { \
120 return SmiOpName(a, b); \ 122 return SmiOpName(a, b); \
121 } else { \ 123 } else { \
122 DCHECK_EQ(INTPTR_PARAMETERS, mode); \ 124 DCHECK_EQ(INTPTR_PARAMETERS, mode); \
123 return IntPtrOpName(a, b); \ 125 return IntPtrOpName(a, b); \
124 } \ 126 } \
125 } 127 }
126 PARAMETER_BINOP(IntPtrOrSmiMin, IntPtrMin, SmiMin) 128 PARAMETER_BINOP(IntPtrOrSmiMin, IntPtrMin, SmiMin)
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 Node* IsHeapNumber(Node* object); 756 Node* IsHeapNumber(Node* object);
755 Node* IsName(Node* object); 757 Node* IsName(Node* object);
756 Node* IsSymbol(Node* object); 758 Node* IsSymbol(Node* object);
757 Node* IsPrivateSymbol(Node* object); 759 Node* IsPrivateSymbol(Node* object);
758 Node* IsJSValueInstanceType(Node* instance_type); 760 Node* IsJSValueInstanceType(Node* instance_type);
759 Node* IsJSValue(Node* object); 761 Node* IsJSValue(Node* object);
760 Node* IsJSValueMap(Node* map); 762 Node* IsJSValueMap(Node* map);
761 Node* IsJSArrayInstanceType(Node* instance_type); 763 Node* IsJSArrayInstanceType(Node* instance_type);
762 Node* IsJSArray(Node* object); 764 Node* IsJSArray(Node* object);
763 Node* IsJSArrayMap(Node* object); 765 Node* IsJSArrayMap(Node* object);
766 Node* IsFixedArray(Node* object);
764 Node* IsNativeContext(Node* object); 767 Node* IsNativeContext(Node* object);
765 Node* IsWeakCell(Node* object); 768 Node* IsWeakCell(Node* object);
766 Node* IsFixedDoubleArray(Node* object); 769 Node* IsFixedDoubleArray(Node* object);
767 Node* IsHashTable(Node* object); 770 Node* IsHashTable(Node* object);
768 Node* IsDictionary(Node* object); 771 Node* IsDictionary(Node* object);
769 Node* IsUnseededNumberDictionary(Node* object); 772 Node* IsUnseededNumberDictionary(Node* object);
770 Node* IsConstructorMap(Node* map); 773 Node* IsConstructorMap(Node* map);
771 Node* IsJSFunctionInstanceType(Node* instance_type); 774 Node* IsJSFunctionInstanceType(Node* instance_type);
772 Node* IsJSFunction(Node* object); 775 Node* IsJSFunction(Node* object);
773 Node* IsJSFunctionMap(Node* object); 776 Node* IsJSFunctionMap(Node* object);
(...skipping 22 matching lines...) Expand all
796 // Return the single character string with only {code}. 799 // Return the single character string with only {code}.
797 Node* StringFromCharCode(Node* code); 800 Node* StringFromCharCode(Node* code);
798 // Return a new string object which holds a substring containing the range 801 // Return a new string object which holds a substring containing the range
799 // [from,to[ of string. |from| and |to| are expected to be tagged. 802 // [from,to[ of string. |from| and |to| are expected to be tagged.
800 Node* SubString(Node* context, Node* string, Node* from, Node* to); 803 Node* SubString(Node* context, Node* string, Node* from, Node* to);
801 804
802 // Return a new string object produced by concatenating |first| with |second|. 805 // Return a new string object produced by concatenating |first| with |second|.
803 Node* StringAdd(Node* context, Node* first, Node* second, 806 Node* StringAdd(Node* context, Node* first, Node* second,
804 AllocationFlags flags = kNone); 807 AllocationFlags flags = kNone);
805 808
806 // Unpack the external string, returning a pointer that (offset-wise) looks
807 // like a sequential string.
808 // Note that this pointer is not tagged and does not point to a real
809 // sequential string instance, and may only be used to access the string
810 // data. The pointer is GC-safe as long as a reference to the container
811 // ExternalString is live.
812 // |string| must be an external string. Bailout for short external strings.
813 Node* TryDerefExternalString(Node* const string, Node* const instance_type,
814 Label* if_bailout);
815
816 // Check if |var_string| has an indirect (thin or flat cons) string type, 809 // Check if |var_string| has an indirect (thin or flat cons) string type,
817 // and unpack it if so. 810 // and unpack it if so.
818 void MaybeDerefIndirectString(Variable* var_string, Node* instance_type, 811 void MaybeDerefIndirectString(Variable* var_string, Node* instance_type,
819 Variable* var_did_something); 812 Variable* var_did_something);
820 // Check if |var_left| or |var_right| has an indirect (thin or flat cons) 813 // Check if |var_left| or |var_right| has an indirect (thin or flat cons)
821 // string type, and unpack it/them if so. Fall through if nothing was done. 814 // string type, and unpack it/them if so. Fall through if nothing was done.
822 void MaybeDerefIndirectStrings(Variable* var_left, Node* left_instance_type, 815 void MaybeDerefIndirectStrings(Variable* var_left, Node* left_instance_type,
823 Variable* var_right, Node* right_instance_type, 816 Variable* var_right, Node* right_instance_type,
824 Label* did_something); 817 Label* did_something);
825 818
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 1539
1547 private: 1540 private:
1548 Node* TryToSequential(StringPointerKind ptr_kind, Label* if_bailout); 1541 Node* TryToSequential(StringPointerKind ptr_kind, Label* if_bailout);
1549 1542
1550 Variable var_string_; 1543 Variable var_string_;
1551 Variable var_instance_type_; 1544 Variable var_instance_type_;
1552 Variable var_offset_; 1545 Variable var_offset_;
1553 Variable var_is_external_; 1546 Variable var_is_external_;
1554 }; 1547 };
1555 1548
1556 #ifdef DEBUG 1549 #if defined(DEBUG) || defined(ENABLE_SLOW_DCHECKS)
1557 #define CSA_ASSERT(csa, x) \ 1550 #define CSA_ASSERT(csa, x) \
1558 (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__) 1551 (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__)
1559 #define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \ 1552 #define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \
1560 (csa)->Assert( \ 1553 (csa)->Assert( \
1561 [&] { \ 1554 [&] { \
1562 compiler::Node* const argc = \ 1555 compiler::Node* const argc = \
1563 (csa)->Parameter(Descriptor::kActualArgumentsCount); \ 1556 (csa)->Parameter(Descriptor::kActualArgumentsCount); \
1564 return (csa)->Op(argc, (csa)->Int32Constant(expected)); \ 1557 return (csa)->Op(argc, (csa)->Int32Constant(expected)); \
1565 }, \ 1558 }, \
1566 "argc " #op " " #expected, __FILE__, __LINE__) 1559 "argc " #op " " #expected, __FILE__, __LINE__)
(...skipping 19 matching lines...) Expand all
1586 } 1579 }
1587 #else 1580 #else
1588 #define CSA_SLOW_ASSERT(csa, x) ((void)0) 1581 #define CSA_SLOW_ASSERT(csa, x) ((void)0)
1589 #endif 1582 #endif
1590 1583
1591 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 1584 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
1592 1585
1593 } // namespace internal 1586 } // namespace internal
1594 } // namespace v8 1587 } // namespace v8
1595 #endif // V8_CODE_STUB_ASSEMBLER_H_ 1588 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stub-assembler.cc » ('j') | src/code-stub-assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698