Chromium Code Reviews| Index: src/code-stub-assembler.h |
| diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h |
| index 36e7801bdd188c082a16e0a29e594835e56a8741..0ec3ce41ce9b06f461ebbf4fc7e181d650d632b4 100644 |
| --- a/src/code-stub-assembler.h |
| +++ b/src/code-stub-assembler.h |
| @@ -161,8 +161,13 @@ 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); |
| + void SlowAssert(ConditionBody condition_body, const char* string = nullptr, |
| + const char* file = nullptr, int line = 0); |
| + // No-op. Used by CSA_ASSERT macro. |
| + inline void Nop() {} |
| // Check a value for smi-ness |
| compiler::Node* TaggedIsSmi(compiler::Node* a); |
| @@ -1257,14 +1262,17 @@ class CodeStubArguments { |
| compiler::Node* fp_; |
| }; |
| -#define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) |
| +#ifdef DEBUG |
| +#define CSA_ASSERT(x) Assert([&] { return (x); }, #x, __FILE__, __LINE__) |
|
Benedikt Meurer
2016/11/09 04:52:09
Can we please, please find a less awkward syntax f
Igor Sheludko
2016/11/09 12:10:34
Ok, I can remove this lambda code.
|
| +#else |
| +#define CSA_ASSERT(x) Nop() |
| +#endif |
| + |
| #ifdef ENABLE_SLOW_DCHECKS |
| -#define CSA_SLOW_ASSERT(x) \ |
| - if (FLAG_enable_slow_asserts) { \ |
| - Assert((x), #x, __FILE__, __LINE__); \ |
| - } |
| +#define CSA_SLOW_ASSERT(x) \ |
| + SlowAssert([&] { return (x); }, #x, __FILE__, __LINE__) |
| #else |
| -#define CSA_SLOW_ASSERT(x) |
| +#define CSA_SLOW_ASSERT(x) Nop() |
| #endif |
| DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |