| 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" |
| 11 #include "src/globals.h" | 11 #include "src/globals.h" |
| 12 #include "src/objects.h" | 12 #include "src/objects.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 class CallInterfaceDescriptor; | 17 class CallInterfaceDescriptor; |
| 18 class CodeStubArguments; | 18 class CodeStubArguments; |
| 19 class StatsCounter; | 19 class StatsCounter; |
| 20 class StubCache; | 20 class StubCache; |
| 21 | 21 |
| 22 #define CSA_CHECK(csa, x) \ | |
| 23 (csa)->Check([&] { return (x); }, #x, __FILE__, __LINE__) | |
| 24 | |
| 25 #ifdef DEBUG | |
| 26 #define CSA_ASSERT(csa, x) \ | |
| 27 (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__) | |
| 28 #define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \ | |
| 29 (csa)->Assert( \ | |
| 30 [&] { \ | |
| 31 compiler::Node* const argc = \ | |
| 32 (csa)->Parameter(Descriptor::kActualArgumentsCount); \ | |
| 33 return (csa)->Op(argc, (csa)->Int32Constant(expected)); \ | |
| 34 }, \ | |
| 35 "argc " #op " " #expected, __FILE__, __LINE__) | |
| 36 | |
| 37 #define CSA_ASSERT_JS_ARGC_EQ(csa, expected) \ | |
| 38 CSA_ASSERT_JS_ARGC_OP(csa, Word32Equal, ==, expected) | |
| 39 | |
| 40 #define BIND(label) Bind(label, {#label, __FILE__, __LINE__}) | |
| 41 #define VARIABLE(name, ...) \ | |
| 42 Variable name(this, {#name, __FILE__, __LINE__}, __VA_ARGS__); | |
| 43 | |
| 44 #else // DEBUG | |
| 45 #define CSA_ASSERT(csa, x) ((void)0) | |
| 46 #define CSA_ASSERT_JS_ARGC_EQ(csa, expected) ((void)0) | |
| 47 #define BIND(label) Bind(label); | |
| 48 #define VARIABLE(name, ...) Variable name(this, __VA_ARGS__); | |
| 49 #endif // DEBUG | |
| 50 | |
| 51 #ifdef ENABLE_SLOW_DCHECKS | |
| 52 #define CSA_SLOW_ASSERT(csa, x) \ | |
| 53 if (FLAG_enable_slow_asserts) { \ | |
| 54 CSA_ASSERT(csa, x); \ | |
| 55 } | |
| 56 #else | |
| 57 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | |
| 58 #endif | |
| 59 | |
| 60 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; | 22 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; |
| 61 | 23 |
| 62 #define HEAP_CONSTANT_LIST(V) \ | 24 #define HEAP_CONSTANT_LIST(V) \ |
| 63 V(AccessorInfoMap, AccessorInfoMap) \ | 25 V(AccessorInfoMap, AccessorInfoMap) \ |
| 64 V(AccessorPairMap, AccessorPairMap) \ | 26 V(AccessorPairMap, AccessorPairMap) \ |
| 65 V(AllocationSiteMap, AllocationSiteMap) \ | 27 V(AllocationSiteMap, AllocationSiteMap) \ |
| 66 V(BooleanMap, BooleanMap) \ | 28 V(BooleanMap, BooleanMap) \ |
| 67 V(CodeMap, CodeMap) \ | 29 V(CodeMap, CodeMap) \ |
| 30 V(empty_string, EmptyString) \ |
| 31 V(length_string, LengthString) \ |
| 32 V(prototype_string, PrototypeString) \ |
| 68 V(EmptyFixedArray, EmptyFixedArray) \ | 33 V(EmptyFixedArray, EmptyFixedArray) \ |
| 69 V(empty_string, EmptyString) \ | |
| 70 V(EmptyWeakCell, EmptyWeakCell) \ | 34 V(EmptyWeakCell, EmptyWeakCell) \ |
| 71 V(FalseValue, False) \ | 35 V(FalseValue, False) \ |
| 72 V(FeedbackVectorMap, FeedbackVectorMap) \ | 36 V(FeedbackVectorMap, FeedbackVectorMap) \ |
| 73 V(FixedArrayMap, FixedArrayMap) \ | 37 V(FixedArrayMap, FixedArrayMap) \ |
| 74 V(FixedCOWArrayMap, FixedCOWArrayMap) \ | 38 V(FixedCOWArrayMap, FixedCOWArrayMap) \ |
| 75 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \ | 39 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \ |
| 76 V(FunctionTemplateInfoMap, FunctionTemplateInfoMap) \ | 40 V(FunctionTemplateInfoMap, FunctionTemplateInfoMap) \ |
| 77 V(GlobalPropertyCellMap, PropertyCellMap) \ | |
| 78 V(has_instance_symbol, HasInstanceSymbol) \ | 41 V(has_instance_symbol, HasInstanceSymbol) \ |
| 79 V(HeapNumberMap, HeapNumberMap) \ | 42 V(HeapNumberMap, HeapNumberMap) \ |
| 80 V(length_string, LengthString) \ | 43 V(NoClosuresCellMap, NoClosuresCellMap) \ |
| 44 V(OneClosureCellMap, OneClosureCellMap) \ |
| 81 V(ManyClosuresCellMap, ManyClosuresCellMap) \ | 45 V(ManyClosuresCellMap, ManyClosuresCellMap) \ |
| 82 V(MetaMap, MetaMap) \ | |
| 83 V(MinusZeroValue, MinusZero) \ | 46 V(MinusZeroValue, MinusZero) \ |
| 84 V(MutableHeapNumberMap, MutableHeapNumberMap) \ | |
| 85 V(NanValue, Nan) \ | 47 V(NanValue, Nan) \ |
| 86 V(NoClosuresCellMap, NoClosuresCellMap) \ | |
| 87 V(NullValue, Null) \ | 48 V(NullValue, Null) \ |
| 88 V(OneClosureCellMap, OneClosureCellMap) \ | 49 V(GlobalPropertyCellMap, PropertyCellMap) \ |
| 89 V(prototype_string, PrototypeString) \ | |
| 90 V(SpeciesProtector, SpeciesProtector) \ | |
| 91 V(SymbolMap, SymbolMap) \ | 50 V(SymbolMap, SymbolMap) \ |
| 92 V(TheHoleValue, TheHole) \ | 51 V(TheHoleValue, TheHole) \ |
| 93 V(TrueValue, True) \ | 52 V(TrueValue, True) \ |
| 94 V(Tuple2Map, Tuple2Map) \ | 53 V(Tuple2Map, Tuple2Map) \ |
| 95 V(Tuple3Map, Tuple3Map) \ | 54 V(Tuple3Map, Tuple3Map) \ |
| 96 V(UndefinedValue, Undefined) \ | 55 V(UndefinedValue, Undefined) \ |
| 97 V(WeakCellMap, WeakCellMap) | 56 V(WeakCellMap, WeakCellMap) \ |
| 57 V(SpeciesProtector, SpeciesProtector) |
| 98 | 58 |
| 99 // Provides JavaScript-specific "macro-assembler" functionality on top of the | 59 // Provides JavaScript-specific "macro-assembler" functionality on top of the |
| 100 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, | 60 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, |
| 101 // it's possible to add JavaScript-specific useful CodeAssembler "macros" | 61 // it's possible to add JavaScript-specific useful CodeAssembler "macros" |
| 102 // without modifying files in the compiler directory (and requiring a review | 62 // without modifying files in the compiler directory (and requiring a review |
| 103 // from a compiler directory OWNER). | 63 // from a compiler directory OWNER). |
| 104 class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { | 64 class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
| 105 public: | 65 public: |
| 106 typedef compiler::Node Node; | 66 typedef compiler::Node Node; |
| 107 | 67 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 Node* ParameterToTagged(Node* value, ParameterMode mode) { | 110 Node* ParameterToTagged(Node* value, ParameterMode mode) { |
| 151 if (mode != SMI_PARAMETERS) value = SmiTag(value); | 111 if (mode != SMI_PARAMETERS) value = SmiTag(value); |
| 152 return value; | 112 return value; |
| 153 } | 113 } |
| 154 | 114 |
| 155 Node* TaggedToParameter(Node* value, ParameterMode mode) { | 115 Node* TaggedToParameter(Node* value, ParameterMode mode) { |
| 156 if (mode != SMI_PARAMETERS) value = SmiUntag(value); | 116 if (mode != SMI_PARAMETERS) value = SmiUntag(value); |
| 157 return value; | 117 return value; |
| 158 } | 118 } |
| 159 | 119 |
| 160 Node* MatchesParameterMode(Node* value, ParameterMode mode); | |
| 161 | |
| 162 #define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName) \ | 120 #define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName) \ |
| 163 Node* OpName(Node* a, Node* b, ParameterMode mode) { \ | 121 Node* OpName(Node* a, Node* b, ParameterMode mode) { \ |
| 164 if (mode == SMI_PARAMETERS) { \ | 122 if (mode == SMI_PARAMETERS) { \ |
| 165 return SmiOpName(a, b); \ | 123 return SmiOpName(a, b); \ |
| 166 } else { \ | 124 } else { \ |
| 167 DCHECK_EQ(INTPTR_PARAMETERS, mode); \ | 125 DCHECK_EQ(INTPTR_PARAMETERS, mode); \ |
| 168 return IntPtrOpName(a, b); \ | 126 return IntPtrOpName(a, b); \ |
| 169 } \ | 127 } \ |
| 170 } | 128 } |
| 171 PARAMETER_BINOP(IntPtrOrSmiMin, IntPtrMin, SmiMin) | 129 PARAMETER_BINOP(IntPtrOrSmiMin, IntPtrMin, SmiMin) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // Smi conversions. | 178 // Smi conversions. |
| 221 Node* SmiToFloat64(Node* value); | 179 Node* SmiToFloat64(Node* value); |
| 222 Node* SmiFromWord(Node* value) { return SmiTag(value); } | 180 Node* SmiFromWord(Node* value) { return SmiTag(value); } |
| 223 Node* SmiFromWord32(Node* value); | 181 Node* SmiFromWord32(Node* value); |
| 224 Node* SmiToWord(Node* value) { return SmiUntag(value); } | 182 Node* SmiToWord(Node* value) { return SmiUntag(value); } |
| 225 Node* SmiToWord32(Node* value); | 183 Node* SmiToWord32(Node* value); |
| 226 | 184 |
| 227 // Smi operations. | 185 // Smi operations. |
| 228 #define SMI_ARITHMETIC_BINOP(SmiOpName, IntPtrOpName) \ | 186 #define SMI_ARITHMETIC_BINOP(SmiOpName, IntPtrOpName) \ |
| 229 Node* SmiOpName(Node* a, Node* b) { \ | 187 Node* SmiOpName(Node* a, Node* b) { \ |
| 230 CSA_SLOW_ASSERT(this, TaggedIsSmi(a)); \ | |
| 231 CSA_SLOW_ASSERT(this, TaggedIsSmi(b)); \ | |
| 232 return BitcastWordToTaggedSigned( \ | 188 return BitcastWordToTaggedSigned( \ |
| 233 IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b))); \ | 189 IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b))); \ |
| 234 } | 190 } |
| 235 SMI_ARITHMETIC_BINOP(SmiAdd, IntPtrAdd) | 191 SMI_ARITHMETIC_BINOP(SmiAdd, IntPtrAdd) |
| 236 SMI_ARITHMETIC_BINOP(SmiSub, IntPtrSub) | 192 SMI_ARITHMETIC_BINOP(SmiSub, IntPtrSub) |
| 237 SMI_ARITHMETIC_BINOP(SmiAnd, WordAnd) | 193 SMI_ARITHMETIC_BINOP(SmiAnd, WordAnd) |
| 238 SMI_ARITHMETIC_BINOP(SmiOr, WordOr) | 194 SMI_ARITHMETIC_BINOP(SmiOr, WordOr) |
| 239 #undef SMI_ARITHMETIC_BINOP | 195 #undef SMI_ARITHMETIC_BINOP |
| 240 | 196 |
| 241 Node* SmiShl(Node* a, int shift) { | 197 Node* SmiShl(Node* a, int shift) { |
| 242 CSA_SLOW_ASSERT(this, TaggedIsSmi(a)); | |
| 243 return BitcastWordToTaggedSigned(WordShl(BitcastTaggedToWord(a), shift)); | 198 return BitcastWordToTaggedSigned(WordShl(BitcastTaggedToWord(a), shift)); |
| 244 } | 199 } |
| 245 | 200 |
| 246 Node* SmiShr(Node* a, int shift) { | 201 Node* SmiShr(Node* a, int shift) { |
| 247 CSA_SLOW_ASSERT(this, TaggedIsSmi(a)); | |
| 248 return BitcastWordToTaggedSigned( | 202 return BitcastWordToTaggedSigned( |
| 249 WordAnd(WordShr(BitcastTaggedToWord(a), shift), | 203 WordAnd(WordShr(BitcastTaggedToWord(a), shift), |
| 250 BitcastTaggedToWord(SmiConstant(-1)))); | 204 BitcastTaggedToWord(SmiConstant(-1)))); |
| 251 } | 205 } |
| 252 | 206 |
| 253 Node* WordOrSmiShl(Node* a, int shift, ParameterMode mode) { | 207 Node* WordOrSmiShl(Node* a, int shift, ParameterMode mode) { |
| 254 if (mode == SMI_PARAMETERS) { | 208 if (mode == SMI_PARAMETERS) { |
| 255 return SmiShl(a, shift); | 209 return SmiShl(a, shift); |
| 256 } else { | 210 } else { |
| 257 DCHECK_EQ(INTPTR_PARAMETERS, mode); | 211 DCHECK_EQ(INTPTR_PARAMETERS, mode); |
| 258 return WordShl(a, shift); | 212 return WordShl(a, shift); |
| 259 } | 213 } |
| 260 } | 214 } |
| 261 | 215 |
| 262 Node* WordOrSmiShr(Node* a, int shift, ParameterMode mode) { | 216 Node* WordOrSmiShr(Node* a, int shift, ParameterMode mode) { |
| 263 if (mode == SMI_PARAMETERS) { | 217 if (mode == SMI_PARAMETERS) { |
| 264 return SmiShr(a, shift); | 218 return SmiShr(a, shift); |
| 265 } else { | 219 } else { |
| 266 DCHECK_EQ(INTPTR_PARAMETERS, mode); | 220 DCHECK_EQ(INTPTR_PARAMETERS, mode); |
| 267 return WordShr(a, shift); | 221 return WordShr(a, shift); |
| 268 } | 222 } |
| 269 } | 223 } |
| 270 | 224 |
| 271 #define SMI_COMPARISON_OP(SmiOpName, IntPtrOpName) \ | 225 #define SMI_COMPARISON_OP(SmiOpName, IntPtrOpName) \ |
| 272 Node* SmiOpName(Node* a, Node* b) { \ | 226 Node* SmiOpName(Node* a, Node* b) { \ |
| 273 CSA_SLOW_ASSERT(this, TaggedIsSmi(a)); \ | |
| 274 CSA_SLOW_ASSERT(this, TaggedIsSmi(b)); \ | |
| 275 return IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b)); \ | 227 return IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b)); \ |
| 276 } | 228 } |
| 277 SMI_COMPARISON_OP(SmiEqual, WordEqual) | 229 SMI_COMPARISON_OP(SmiEqual, WordEqual) |
| 278 SMI_COMPARISON_OP(SmiNotEqual, WordNotEqual) | 230 SMI_COMPARISON_OP(SmiNotEqual, WordNotEqual) |
| 279 SMI_COMPARISON_OP(SmiAbove, UintPtrGreaterThan) | 231 SMI_COMPARISON_OP(SmiAbove, UintPtrGreaterThan) |
| 280 SMI_COMPARISON_OP(SmiAboveOrEqual, UintPtrGreaterThanOrEqual) | 232 SMI_COMPARISON_OP(SmiAboveOrEqual, UintPtrGreaterThanOrEqual) |
| 281 SMI_COMPARISON_OP(SmiBelow, UintPtrLessThan) | 233 SMI_COMPARISON_OP(SmiBelow, UintPtrLessThan) |
| 282 SMI_COMPARISON_OP(SmiLessThan, IntPtrLessThan) | 234 SMI_COMPARISON_OP(SmiLessThan, IntPtrLessThan) |
| 283 SMI_COMPARISON_OP(SmiLessThanOrEqual, IntPtrLessThanOrEqual) | 235 SMI_COMPARISON_OP(SmiLessThanOrEqual, IntPtrLessThanOrEqual) |
| 284 SMI_COMPARISON_OP(SmiGreaterThan, IntPtrGreaterThan) | 236 SMI_COMPARISON_OP(SmiGreaterThan, IntPtrGreaterThan) |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 Node* IsJSReceiver(Node* object); | 756 Node* IsJSReceiver(Node* object); |
| 805 Node* IsJSReceiverMap(Node* map); | 757 Node* IsJSReceiverMap(Node* map); |
| 806 Node* IsMap(Node* object); | 758 Node* IsMap(Node* object); |
| 807 Node* IsCallableMap(Node* map); | 759 Node* IsCallableMap(Node* map); |
| 808 Node* IsDeprecatedMap(Node* map); | 760 Node* IsDeprecatedMap(Node* map); |
| 809 Node* IsCallable(Node* object); | 761 Node* IsCallable(Node* object); |
| 810 Node* IsBoolean(Node* object); | 762 Node* IsBoolean(Node* object); |
| 811 Node* IsPropertyCell(Node* object); | 763 Node* IsPropertyCell(Node* object); |
| 812 Node* IsAccessorInfo(Node* object); | 764 Node* IsAccessorInfo(Node* object); |
| 813 Node* IsAccessorPair(Node* object); | 765 Node* IsAccessorPair(Node* object); |
| 814 Node* IsAnyHeapNumber(Node* object); | |
| 815 Node* IsMutableHeapNumber(Node* object); | |
| 816 Node* IsHeapNumber(Node* object); | 766 Node* IsHeapNumber(Node* object); |
| 817 Node* IsName(Node* object); | 767 Node* IsName(Node* object); |
| 818 Node* IsSymbol(Node* object); | 768 Node* IsSymbol(Node* object); |
| 819 Node* IsPrivateSymbol(Node* object); | 769 Node* IsPrivateSymbol(Node* object); |
| 820 Node* IsJSValueInstanceType(Node* instance_type); | 770 Node* IsJSValueInstanceType(Node* instance_type); |
| 821 Node* IsJSValue(Node* object); | 771 Node* IsJSValue(Node* object); |
| 822 Node* IsJSValueMap(Node* map); | 772 Node* IsJSValueMap(Node* map); |
| 823 Node* IsJSArrayInstanceType(Node* instance_type); | 773 Node* IsJSArrayInstanceType(Node* instance_type); |
| 824 Node* IsJSArray(Node* object); | 774 Node* IsJSArray(Node* object); |
| 825 Node* IsJSArrayMap(Node* object); | 775 Node* IsJSArrayMap(Node* object); |
| 826 Node* IsFixedArray(Node* object); | |
| 827 Node* IsFixedArrayWithKindOrEmpty(Node* object, ElementsKind kind); | |
| 828 Node* IsFixedArrayWithKind(Node* object, ElementsKind kind); | |
| 829 Node* IsNativeContext(Node* object); | 776 Node* IsNativeContext(Node* object); |
| 830 Node* IsWeakCell(Node* object); | 777 Node* IsWeakCell(Node* object); |
| 831 Node* IsFixedDoubleArray(Node* object); | 778 Node* IsFixedDoubleArray(Node* object); |
| 832 Node* IsHashTable(Node* object); | 779 Node* IsHashTable(Node* object); |
| 833 Node* IsDictionary(Node* object); | 780 Node* IsDictionary(Node* object); |
| 834 Node* IsUnseededNumberDictionary(Node* object); | 781 Node* IsUnseededNumberDictionary(Node* object); |
| 835 Node* IsConstructorMap(Node* map); | 782 Node* IsConstructorMap(Node* map); |
| 836 Node* IsJSFunctionInstanceType(Node* instance_type); | 783 Node* IsJSFunctionInstanceType(Node* instance_type); |
| 837 Node* IsJSFunction(Node* object); | 784 Node* IsJSFunction(Node* object); |
| 838 Node* IsJSFunctionMap(Node* object); | 785 Node* IsJSFunctionMap(Node* object); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 869 // [from,to[ of string. |from| and |to| are expected to be tagged. | 816 // [from,to[ of string. |from| and |to| are expected to be tagged. |
| 870 // If flags has the value FROM_TO_ARE_BOUNDED then from and to are in | 817 // If flags has the value FROM_TO_ARE_BOUNDED then from and to are in |
| 871 // the range [0, string-length) | 818 // the range [0, string-length) |
| 872 Node* SubString(Node* context, Node* string, Node* from, Node* to, | 819 Node* SubString(Node* context, Node* string, Node* from, Node* to, |
| 873 SubStringFlags flags = SubStringFlags::NONE); | 820 SubStringFlags flags = SubStringFlags::NONE); |
| 874 | 821 |
| 875 // Return a new string object produced by concatenating |first| with |second|. | 822 // Return a new string object produced by concatenating |first| with |second|. |
| 876 Node* StringAdd(Node* context, Node* first, Node* second, | 823 Node* StringAdd(Node* context, Node* first, Node* second, |
| 877 AllocationFlags flags = kNone); | 824 AllocationFlags flags = kNone); |
| 878 | 825 |
| 826 // Unpack the external string, returning a pointer that (offset-wise) looks |
| 827 // like a sequential string. |
| 828 // Note that this pointer is not tagged and does not point to a real |
| 829 // sequential string instance, and may only be used to access the string |
| 830 // data. The pointer is GC-safe as long as a reference to the container |
| 831 // ExternalString is live. |
| 832 // |string| must be an external string. Bailout for short external strings. |
| 833 Node* TryDerefExternalString(Node* const string, Node* const instance_type, |
| 834 Label* if_bailout); |
| 835 |
| 879 // Check if |var_string| has an indirect (thin or flat cons) string type, | 836 // Check if |var_string| has an indirect (thin or flat cons) string type, |
| 880 // and unpack it if so. | 837 // and unpack it if so. |
| 881 void MaybeDerefIndirectString(Variable* var_string, Node* instance_type, | 838 void MaybeDerefIndirectString(Variable* var_string, Node* instance_type, |
| 882 Variable* var_did_something); | 839 Variable* var_did_something); |
| 883 // Check if |var_left| or |var_right| has an indirect (thin or flat cons) | 840 // Check if |var_left| or |var_right| has an indirect (thin or flat cons) |
| 884 // string type, and unpack it/them if so. Fall through if nothing was done. | 841 // string type, and unpack it/them if so. Fall through if nothing was done. |
| 885 void MaybeDerefIndirectStrings(Variable* var_left, Node* left_instance_type, | 842 void MaybeDerefIndirectStrings(Variable* var_left, Node* left_instance_type, |
| 886 Variable* var_right, Node* right_instance_type, | 843 Variable* var_right, Node* right_instance_type, |
| 887 Label* did_something); | 844 Label* did_something); |
| 888 | 845 |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 Node* TryToSequential(StringPointerKind ptr_kind, Label* if_bailout); | 1595 Node* TryToSequential(StringPointerKind ptr_kind, Label* if_bailout); |
| 1639 | 1596 |
| 1640 Variable var_string_; | 1597 Variable var_string_; |
| 1641 Variable var_instance_type_; | 1598 Variable var_instance_type_; |
| 1642 Variable var_offset_; | 1599 Variable var_offset_; |
| 1643 Variable var_is_external_; | 1600 Variable var_is_external_; |
| 1644 | 1601 |
| 1645 const Flags flags_; | 1602 const Flags flags_; |
| 1646 }; | 1603 }; |
| 1647 | 1604 |
| 1605 #define CSA_CHECK(csa, x) \ |
| 1606 (csa)->Check([&] { return (x); }, #x, __FILE__, __LINE__) |
| 1607 |
| 1608 #ifdef DEBUG |
| 1609 #define CSA_ASSERT(csa, x) \ |
| 1610 (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__) |
| 1611 #define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \ |
| 1612 (csa)->Assert( \ |
| 1613 [&] { \ |
| 1614 compiler::Node* const argc = \ |
| 1615 (csa)->Parameter(Descriptor::kActualArgumentsCount); \ |
| 1616 return (csa)->Op(argc, (csa)->Int32Constant(expected)); \ |
| 1617 }, \ |
| 1618 "argc " #op " " #expected, __FILE__, __LINE__) |
| 1619 |
| 1620 #define CSA_ASSERT_JS_ARGC_EQ(csa, expected) \ |
| 1621 CSA_ASSERT_JS_ARGC_OP(csa, Word32Equal, ==, expected) |
| 1622 |
| 1623 #define BIND(label) Bind(label, {#label, __FILE__, __LINE__}) |
| 1624 #define VARIABLE(name, ...) \ |
| 1625 Variable name(this, {#name, __FILE__, __LINE__}, __VA_ARGS__); |
| 1626 |
| 1627 #else // DEBUG |
| 1628 #define CSA_ASSERT(csa, x) ((void)0) |
| 1629 #define CSA_ASSERT_JS_ARGC_EQ(csa, expected) ((void)0) |
| 1630 #define BIND(label) Bind(label); |
| 1631 #define VARIABLE(name, ...) Variable name(this, __VA_ARGS__); |
| 1632 #endif // DEBUG |
| 1633 |
| 1634 #ifdef ENABLE_SLOW_DCHECKS |
| 1635 #define CSA_SLOW_ASSERT(csa, x) \ |
| 1636 if (FLAG_enable_slow_asserts) { \ |
| 1637 CSA_ASSERT(csa, x); \ |
| 1638 } |
| 1639 #else |
| 1640 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
| 1641 #endif |
| 1642 |
| 1648 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1643 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 1649 | 1644 |
| 1650 } // namespace internal | 1645 } // namespace internal |
| 1651 } // namespace v8 | 1646 } // namespace v8 |
| 1652 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1647 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |