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

Unified Diff: src/code-stub-assembler.cc

Issue 2489743002: [stubs] Ensure CSA_ASSERT and CSA_SLOW_ASSERT do not produce unused instructions in release mode. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index a92daad4979715e5a27d6af92e7d70fba13b4434..978fb9a555e17e756d939071694a7e1585e4d992 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -25,7 +25,7 @@ CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
const char* name)
: compiler::CodeAssembler(isolate, zone, parameter_count, flags, name) {}
-void CodeStubAssembler::Assert(Node* condition, const char* message,
+void CodeStubAssembler::Assert(ConditionBody codition_body, const char* message,
const char* file, int line) {
#if defined(DEBUG)
Label ok(this);
@@ -33,9 +33,10 @@ void CodeStubAssembler::Assert(Node* condition, const char* message,
if (message != nullptr && FLAG_code_comments) {
Comment("[ Assert: %s", message);
} else {
- Comment("[ Assert ");
+ Comment("[ Assert");
}
-
+ Node* condition = codition_body();
+ DCHECK_NOT_NULL(condition);
Branch(condition, &ok, &not_ok);
Bind(&not_ok);
if (message != nullptr) {
@@ -57,6 +58,16 @@ void CodeStubAssembler::Assert(Node* condition, const char* message,
#endif
}
+void CodeStubAssembler::SlowAssert(ConditionBody codition_body,
+ const char* message, const char* file,
+ int line) {
+#ifdef ENABLE_SLOW_DCHECKS
+ if (FLAG_enable_slow_asserts) {
+ Assert(codition_body, message, file, line);
+ }
+#endif
+}
+
Node* CodeStubAssembler::NoContextConstant() { return NumberConstant(0); }
#define HEAP_CONSTANT_ACCESSOR(rootName, name) \
@@ -1630,6 +1641,7 @@ Node* CodeStubAssembler::AllocateRegExpResult(Node* context, Node* length,
Node* const max_length =
SmiConstant(Smi::FromInt(JSArray::kInitialMaxFastElementArray));
CSA_ASSERT(SmiLessThanOrEqual(length, max_length));
+ USE(max_length);
// Allocate the JSRegExpResult.
// TODO(jgruber): Fold JSArray and FixedArray allocations, then remove
@@ -2643,12 +2655,12 @@ Node* CodeStubAssembler::ThrowIfNotInstanceType(Node* context, Node* value,
Node* CodeStubAssembler::IsSpecialReceiverMap(Node* map) {
Node* is_special = IsSpecialReceiverInstanceType(LoadMapInstanceType(map));
- Node* bit_field = LoadMapBitField(map);
uint32_t mask =
1 << Map::kHasNamedInterceptor | 1 << Map::kIsAccessCheckNeeded;
+ USE(mask);
// Interceptors or access checks imply special receiver.
- CSA_ASSERT(
- Select(IsSetWord32(bit_field, mask), is_special, Int32Constant(1)));
+ CSA_ASSERT(Select(IsSetWord32(LoadMapBitField(map), mask), is_special,
+ Int32Constant(1), MachineRepresentation::kWord32));
return is_special;
}
@@ -4215,10 +4227,10 @@ void CodeStubAssembler::TryLookupProperty(
Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)),
&if_objectisspecial);
- Node* bit_field = LoadMapBitField(map);
- Node* mask = Int32Constant(1 << Map::kHasNamedInterceptor |
- 1 << Map::kIsAccessCheckNeeded);
- CSA_ASSERT(Word32Equal(Word32And(bit_field, mask), Int32Constant(0)));
+ uint32_t mask =
+ 1 << Map::kHasNamedInterceptor | 1 << Map::kIsAccessCheckNeeded;
+ CSA_ASSERT(Word32BinaryNot(IsSetWord32(LoadMapBitField(map), mask)));
+ USE(mask);
Node* bit_field3 = LoadMapBitField3(map);
Label if_isfastmap(this), if_isslowmap(this);
« src/code-stub-assembler.h ('K') | « src/code-stub-assembler.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698