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

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

Issue 2489743002: [stubs] Ensure CSA_ASSERT and CSA_SLOW_ASSERT do not produce unused instructions in release mode. (Closed)
Patch Set: ((void)0) 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
« no previous file with comments | « src/builtins/builtins-string.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.h
diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h
index 53b8d16893ef9ebe0383d2cb1e4efed7e72f79b0..68b2aa6354bbb11f5aa48f63419dbe786ea84474 100644
--- a/src/code-stub-assembler.h
+++ b/src/code-stub-assembler.h
@@ -161,7 +161,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
compiler::Node* offset);
compiler::Node* IsRegularHeapObjectSize(compiler::Node* size);
- void Assert(compiler::Node* condition, const char* string = nullptr,
+ typedef std::function<compiler::Node*()> ConditionBody;
+ void Assert(ConditionBody condition_body, const char* string = nullptr,
const char* file = nullptr, int line = 0);
// Check a value for smi-ness
@@ -1263,14 +1264,20 @@ class CodeStubArguments {
compiler::Node* fp_;
};
-#define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__)
+#ifdef DEBUG
+#define CSA_ASSERT(csa, x) \
+ (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__)
+#else
+#define CSA_ASSERT(csa, x) ((void)0)
+#endif
+
#ifdef ENABLE_SLOW_DCHECKS
-#define CSA_SLOW_ASSERT(x) \
- if (FLAG_enable_slow_asserts) { \
- Assert((x), #x, __FILE__, __LINE__); \
+#define CSA_SLOW_ASSERT(csa, x) \
+ if (FLAG_enable_slow_asserts) { \
+ (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__); \
}
#else
-#define CSA_SLOW_ASSERT(x)
+#define CSA_SLOW_ASSERT(csa, x) ((void)0)
#endif
DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
« no previous file with comments | « src/builtins/builtins-string.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698