Index: src/code-stub-assembler.h |
diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h |
index dbdd5f0f76245fcbc474a0c72ce6d41cbb852747..d13475f2db7911abcff76f297bc6fcca77255b1d 100644 |
--- a/src/code-stub-assembler.h |
+++ b/src/code-stub-assembler.h |
@@ -19,6 +19,41 @@ class CodeStubArguments; |
class StatsCounter; |
class StubCache; |
+#if defined(DEBUG) || defined(ENABLE_SLOW_DCHECKS) |
+#define CSA_ASSERT(csa, x) \ |
+ (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__) |
+#define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \ |
+ (csa)->Assert( \ |
+ [&] { \ |
+ compiler::Node* const argc = \ |
+ (csa)->Parameter(Descriptor::kActualArgumentsCount); \ |
+ return (csa)->Op(argc, (csa)->Int32Constant(expected)); \ |
+ }, \ |
+ "argc " #op " " #expected, __FILE__, __LINE__) |
+ |
+#define CSA_ASSERT_JS_ARGC_EQ(csa, expected) \ |
+ CSA_ASSERT_JS_ARGC_OP(csa, Word32Equal, ==, expected) |
+ |
+#define BIND(label) Bind(label, {#label, __FILE__, __LINE__}) |
+#define VARIABLE(name, ...) \ |
+ Variable name(this, {#name, __FILE__, __LINE__}, __VA_ARGS__); |
+ |
+#else // DEBUG |
+#define CSA_ASSERT(csa, x) ((void)0) |
+#define CSA_ASSERT_JS_ARGC_EQ(csa, expected) ((void)0) |
+#define BIND(label) Bind(label); |
+#define VARIABLE(name, ...) Variable name(this, __VA_ARGS__); |
+#endif // DEBUG |
+ |
+#ifdef ENABLE_SLOW_DCHECKS |
+#define CSA_SLOW_ASSERT(csa, x) \ |
+ if (FLAG_enable_slow_asserts) { \ |
+ (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__); \ |
+ } |
+#else |
+#define CSA_SLOW_ASSERT(csa, x) ((void)0) |
+#endif |
+ |
enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; |
#define HEAP_CONSTANT_LIST(V) \ |
@@ -27,24 +62,25 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; |
V(AllocationSiteMap, AllocationSiteMap) \ |
V(BooleanMap, BooleanMap) \ |
V(CodeMap, CodeMap) \ |
- V(empty_string, EmptyString) \ |
- V(length_string, LengthString) \ |
- V(prototype_string, PrototypeString) \ |
V(EmptyFixedArray, EmptyFixedArray) \ |
+ V(empty_string, EmptyString) \ |
V(FalseValue, False) \ |
V(FixedArrayMap, FixedArrayMap) \ |
V(FixedCOWArrayMap, FixedCOWArrayMap) \ |
V(FixedDoubleArrayMap, FixedDoubleArrayMap) \ |
V(FunctionTemplateInfoMap, FunctionTemplateInfoMap) \ |
+ V(GlobalPropertyCellMap, PropertyCellMap) \ |
V(has_instance_symbol, HasInstanceSymbol) \ |
V(HeapNumberMap, HeapNumberMap) \ |
- V(NoClosuresCellMap, NoClosuresCellMap) \ |
- V(OneClosureCellMap, OneClosureCellMap) \ |
+ V(length_string, LengthString) \ |
V(ManyClosuresCellMap, ManyClosuresCellMap) \ |
+ V(MetaMap, MetaMap) \ |
V(MinusZeroValue, MinusZero) \ |
V(NanValue, Nan) \ |
+ V(NoClosuresCellMap, NoClosuresCellMap) \ |
V(NullValue, Null) \ |
- V(GlobalPropertyCellMap, PropertyCellMap) \ |
+ V(OneClosureCellMap, OneClosureCellMap) \ |
+ V(prototype_string, PrototypeString) \ |
V(SymbolMap, SymbolMap) \ |
V(TheHoleValue, TheHole) \ |
V(TrueValue, True) \ |
@@ -114,6 +150,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
return value; |
} |
+ Node* MatchesParameterMode(Node* value, ParameterMode mode); |
+ |
#define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName) \ |
Node* OpName(Node* a, Node* b, ParameterMode mode) { \ |
if (mode == SMI_PARAMETERS) { \ |
@@ -182,6 +220,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
// Smi operations. |
#define SMI_ARITHMETIC_BINOP(SmiOpName, IntPtrOpName) \ |
Node* SmiOpName(Node* a, Node* b) { \ |
+ CSA_SLOW_ASSERT(this, TaggedIsSmi(a)); \ |
+ CSA_SLOW_ASSERT(this, TaggedIsSmi(b)); \ |
return BitcastWordToTaggedSigned( \ |
IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b))); \ |
} |
@@ -192,10 +232,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
#undef SMI_ARITHMETIC_BINOP |
Node* SmiShl(Node* a, int shift) { |
+ CSA_SLOW_ASSERT(this, TaggedIsSmi(a)); |
return BitcastWordToTaggedSigned(WordShl(BitcastTaggedToWord(a), shift)); |
} |
Node* SmiShr(Node* a, int shift) { |
+ CSA_SLOW_ASSERT(this, TaggedIsSmi(a)); |
return BitcastWordToTaggedSigned( |
WordAnd(WordShr(BitcastTaggedToWord(a), shift), |
BitcastTaggedToWord(SmiConstant(-1)))); |
@@ -221,6 +263,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
#define SMI_COMPARISON_OP(SmiOpName, IntPtrOpName) \ |
Node* SmiOpName(Node* a, Node* b) { \ |
+ CSA_SLOW_ASSERT(this, TaggedIsSmi(a)); \ |
+ CSA_SLOW_ASSERT(this, TaggedIsSmi(b)); \ |
return IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b)); \ |
} |
SMI_COMPARISON_OP(SmiEqual, WordEqual) |
@@ -761,6 +805,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
Node* IsJSArrayInstanceType(Node* instance_type); |
Node* IsJSArray(Node* object); |
Node* IsJSArrayMap(Node* object); |
+ Node* IsFixedArray(Node* object); |
+ Node* IsFixedArrayWithKind(Node* object, ElementsKind kind); |
Node* IsNativeContext(Node* object); |
Node* IsWeakCell(Node* object); |
Node* IsFixedDoubleArray(Node* object); |
@@ -803,16 +849,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
Node* StringAdd(Node* context, Node* first, Node* second, |
AllocationFlags flags = kNone); |
- // Unpack the external string, returning a pointer that (offset-wise) looks |
- // like a sequential string. |
- // Note that this pointer is not tagged and does not point to a real |
- // sequential string instance, and may only be used to access the string |
- // data. The pointer is GC-safe as long as a reference to the container |
- // ExternalString is live. |
- // |string| must be an external string. Bailout for short external strings. |
- Node* TryDerefExternalString(Node* const string, Node* const instance_type, |
- Label* if_bailout); |
- |
// Check if |var_string| has an indirect (thin or flat cons) string type, |
// and unpack it if so. |
void MaybeDerefIndirectString(Variable* var_string, Node* instance_type, |
@@ -1556,41 +1592,6 @@ class ToDirectStringAssembler : public CodeStubAssembler { |
Variable var_is_external_; |
}; |
-#ifdef DEBUG |
-#define CSA_ASSERT(csa, x) \ |
- (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__) |
-#define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \ |
- (csa)->Assert( \ |
- [&] { \ |
- compiler::Node* const argc = \ |
- (csa)->Parameter(Descriptor::kActualArgumentsCount); \ |
- return (csa)->Op(argc, (csa)->Int32Constant(expected)); \ |
- }, \ |
- "argc " #op " " #expected, __FILE__, __LINE__) |
- |
-#define CSA_ASSERT_JS_ARGC_EQ(csa, expected) \ |
- CSA_ASSERT_JS_ARGC_OP(csa, Word32Equal, ==, expected) |
- |
-#define BIND(label) Bind(label, {#label, __FILE__, __LINE__}) |
-#define VARIABLE(name, ...) \ |
- Variable name(this, {#name, __FILE__, __LINE__}, __VA_ARGS__); |
- |
-#else // DEBUG |
-#define CSA_ASSERT(csa, x) ((void)0) |
-#define CSA_ASSERT_JS_ARGC_EQ(csa, expected) ((void)0) |
-#define BIND(label) Bind(label); |
-#define VARIABLE(name, ...) Variable name(this, __VA_ARGS__); |
-#endif // DEBUG |
- |
-#ifdef ENABLE_SLOW_DCHECKS |
-#define CSA_SLOW_ASSERT(csa, x) \ |
- if (FLAG_enable_slow_asserts) { \ |
- (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__); \ |
- } |
-#else |
-#define CSA_SLOW_ASSERT(csa, x) ((void)0) |
-#endif |
- |
DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
} // namespace internal |