Commit 165b411f authored by bmeurer's avatar bmeurer Committed by Commit bot

[csa] Make CSA::Assert depend on --debug-code.

This way it's possible to disable Assert() even in Debug
builds via --nodebug-code.

R=danno@chromium.org
BUG=v8:5268

Review-Url: https://codereview.chromium.org/2690983002
Cr-Commit-Position: refs/heads/master@{#43143}
parent ba3f96f4
...@@ -47,33 +47,36 @@ void CodeStubAssembler::Assert(const NodeGenerator& codition_body, ...@@ -47,33 +47,36 @@ void CodeStubAssembler::Assert(const NodeGenerator& codition_body,
const char* message, const char* file, const char* message, const char* file,
int line) { int line) {
#if defined(DEBUG) #if defined(DEBUG)
Label ok(this); if (FLAG_debug_code) {
Label not_ok(this, Label::kDeferred); Label ok(this);
if (message != nullptr && FLAG_code_comments) { Label not_ok(this, Label::kDeferred);
Comment("[ Assert: %s", message); if (message != nullptr && FLAG_code_comments) {
} else { Comment("[ Assert: %s", message);
Comment("[ Assert");
}
Node* condition = codition_body();
DCHECK_NOT_NULL(condition);
Branch(condition, &ok, &not_ok);
Bind(&not_ok);
if (message != nullptr) {
char chars[1024];
Vector<char> buffer(chars);
if (file != nullptr) {
SNPrintF(buffer, "CSA_ASSERT failed: %s [%s:%d]\n", message, file, line);
} else { } else {
SNPrintF(buffer, "CSA_ASSERT failed: %s\n", message); Comment("[ Assert");
} }
CallRuntime( Node* condition = codition_body();
Runtime::kGlobalPrint, SmiConstant(Smi::kZero), DCHECK_NOT_NULL(condition);
HeapConstant(factory()->NewStringFromAsciiChecked(&(buffer[0])))); Branch(condition, &ok, &not_ok);
} Bind(&not_ok);
DebugBreak(); if (message != nullptr) {
Goto(&ok); char chars[1024];
Bind(&ok); Vector<char> buffer(chars);
Comment("] Assert"); if (file != nullptr) {
SNPrintF(buffer, "CSA_ASSERT failed: %s [%s:%d]\n", message, file,
line);
} else {
SNPrintF(buffer, "CSA_ASSERT failed: %s\n", message);
}
CallRuntime(
Runtime::kGlobalPrint, SmiConstant(Smi::kZero),
HeapConstant(factory()->NewStringFromAsciiChecked(&(buffer[0]))));
}
DebugBreak();
Goto(&ok);
Bind(&ok);
Comment("] Assert");
}
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment