Turn on DCHECKs and other debugging code if dcheck_always_on is 1
When compiling with the macro DCHECK_ALWAYS_ON defined, DCHECKs and supporting code gets compiled and enabled. This increases test coverage for chromium release buildbots BUG=v8:3731 R=jkummerow@chromium.org LOG=y Review URL: https://codereview.chromium.org/760213005 Cr-Commit-Position: refs/heads/master@{#25701}
This commit is contained in:
parent
46762966c4
commit
97c1f4b15c
@ -62,6 +62,9 @@
|
||||
# Use external files for startup data blobs:
|
||||
# the JS builtins sources and the start snapshot.
|
||||
'v8_use_external_startup_data%': 0,
|
||||
|
||||
# Set to 1 to enable DCHECKs in release builds.
|
||||
'dcheck_always_on%': 0,
|
||||
},
|
||||
'target_defaults': {
|
||||
'conditions': [
|
||||
@ -95,6 +98,9 @@
|
||||
['v8_use_external_startup_data==1', {
|
||||
'defines': ['V8_USE_EXTERNAL_STARTUP_DATA',],
|
||||
}],
|
||||
['dcheck_always_on!=0', {
|
||||
'defines': ['DEBUG',],
|
||||
}],
|
||||
], # conditions
|
||||
'configurations': {
|
||||
'DebugBaseCommon': {
|
||||
|
@ -903,6 +903,9 @@
|
||||
},
|
||||
}],
|
||||
],
|
||||
'defines': [
|
||||
'ENABLE_SLOW_DCHECKS',
|
||||
],
|
||||
}, # DebugBase0
|
||||
# Abstract configuration for v8_optimized_debug == 1.
|
||||
'DebugBase1': {
|
||||
@ -927,6 +930,9 @@
|
||||
'LinkIncremental': '2',
|
||||
},
|
||||
},
|
||||
'defines': [
|
||||
'ENABLE_SLOW_DCHECKS',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
|
||||
OS=="qnx"', {
|
||||
@ -987,9 +993,6 @@
|
||||
'-fdata-sections',
|
||||
'-ffunction-sections',
|
||||
],
|
||||
'defines': [
|
||||
'OPTIMIZED_DEBUG'
|
||||
],
|
||||
'conditions': [
|
||||
# TODO(crbug.com/272548): Avoid -O3 in NaCl
|
||||
['nacl_target_arch=="none"', {
|
||||
|
@ -339,18 +339,18 @@ void SetResourceConstraints(i::Isolate* isolate,
|
||||
i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) {
|
||||
LOG_API(isolate, "Persistent::New");
|
||||
i::Handle<i::Object> result = isolate->global_handles()->Create(*obj);
|
||||
#ifdef DEBUG
|
||||
#ifdef VERIFY_HEAP
|
||||
(*obj)->ObjectVerify();
|
||||
#endif // DEBUG
|
||||
#endif // VERIFY_HEAP
|
||||
return result.location();
|
||||
}
|
||||
|
||||
|
||||
i::Object** V8::CopyPersistent(i::Object** obj) {
|
||||
i::Handle<i::Object> result = i::GlobalHandles::CopyGlobal(obj);
|
||||
#ifdef DEBUG
|
||||
#ifdef VERIFY_HEAP
|
||||
(*obj)->ObjectVerify();
|
||||
#endif // DEBUG
|
||||
#endif // VERIFY_HEAP
|
||||
return result.location();
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,6 @@
|
||||
|
||||
#include "src/base/logging.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifndef OPTIMIZED_DEBUG
|
||||
#define ENABLE_SLOW_DCHECKS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace v8 {
|
||||
|
||||
class Value;
|
||||
|
@ -1104,12 +1104,14 @@ RegExpEngine::CompilationResult RegExpCompiler::Assemble(
|
||||
Handle<HeapObject> code = macro_assembler_->GetCode(pattern);
|
||||
heap->IncreaseTotalRegexpCodeGenerated(code->Size());
|
||||
work_list_ = NULL;
|
||||
#ifdef DEBUG
|
||||
#ifdef ENABLE_DISASSEMBLER
|
||||
if (FLAG_print_code) {
|
||||
CodeTracer::Scope trace_scope(heap->isolate()->GetCodeTracer());
|
||||
OFStream os(trace_scope.file());
|
||||
Handle<Code>::cast(code)->Disassemble(pattern->ToCString().get(), os);
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
if (FLAG_trace_regexp_assembler) {
|
||||
delete macro_assembler_;
|
||||
}
|
||||
|
@ -6536,7 +6536,7 @@ void JSRegExp::SetDataAt(int index, Object* value) {
|
||||
|
||||
ElementsKind JSObject::GetElementsKind() {
|
||||
ElementsKind kind = map()->elements_kind();
|
||||
#if DEBUG
|
||||
#if VERIFY_HEAP
|
||||
FixedArrayBase* fixed_array =
|
||||
reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset));
|
||||
|
||||
|
@ -346,12 +346,6 @@ void JSObject::PrintElements(std::ostream& os) { // NOLINT
|
||||
}
|
||||
|
||||
|
||||
void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
|
||||
if (!map()->HasTransitionArray()) return;
|
||||
map()->transitions()->PrintTransitions(os, false);
|
||||
}
|
||||
|
||||
|
||||
void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT
|
||||
HeapObject::PrintHeader(os, "JSObject");
|
||||
// Don't call GetElementsKind, its validation code can cause the printer to
|
||||
@ -592,21 +586,6 @@ void Name::NamePrint(std::ostream& os) { // NOLINT
|
||||
}
|
||||
|
||||
|
||||
// This method is only meant to be called from gdb for debugging purposes.
|
||||
// Since the string can also be in two-byte encoding, non-Latin1 characters
|
||||
// will be ignored in the output.
|
||||
char* String::ToAsciiArray() {
|
||||
// Static so that subsequent calls frees previously allocated space.
|
||||
// This also means that previous results will be overwritten.
|
||||
static char* buffer = NULL;
|
||||
if (buffer != NULL) delete[] buffer;
|
||||
buffer = new char[length()+1];
|
||||
WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
|
||||
buffer[length()] = 0;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
static const char* const weekdays[] = {
|
||||
"???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
@ -1067,25 +1046,6 @@ void BreakPointInfo::BreakPointInfoPrint(std::ostream& os) { // NOLINT
|
||||
}
|
||||
|
||||
|
||||
void DescriptorArray::Print() {
|
||||
OFStream os(stdout);
|
||||
this->PrintDescriptors(os);
|
||||
os << std::flush;
|
||||
}
|
||||
|
||||
|
||||
void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
|
||||
HandleScope scope(GetIsolate());
|
||||
os << "Descriptor array " << number_of_descriptors() << "\n";
|
||||
for (int i = 0; i < number_of_descriptors(); i++) {
|
||||
Descriptor desc;
|
||||
Get(i, &desc);
|
||||
os << " " << i << ": " << desc << "\n";
|
||||
}
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
|
||||
static void PrintBitMask(std::ostream& os, uint32_t value) { // NOLINT
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if ((i & 7) == 0) os << " ";
|
||||
@ -1123,51 +1083,6 @@ void LayoutDescriptor::Print(std::ostream& os) { // NOLINT
|
||||
}
|
||||
|
||||
|
||||
void TransitionArray::Print() {
|
||||
OFStream os(stdout);
|
||||
this->PrintTransitions(os);
|
||||
os << std::flush;
|
||||
}
|
||||
|
||||
|
||||
void TransitionArray::PrintTransitions(std::ostream& os,
|
||||
bool print_header) { // NOLINT
|
||||
if (print_header) {
|
||||
os << "Transition array " << number_of_transitions() << "\n";
|
||||
}
|
||||
for (int i = 0; i < number_of_transitions(); i++) {
|
||||
Name* key = GetKey(i);
|
||||
os << " ";
|
||||
key->NamePrint(os);
|
||||
os << ": ";
|
||||
if (key == GetHeap()->frozen_symbol()) {
|
||||
os << " (transition to frozen)";
|
||||
} else if (key == GetHeap()->elements_transition_symbol()) {
|
||||
os << " (transition to "
|
||||
<< ElementsKindToString(GetTarget(i)->elements_kind()) << ")";
|
||||
} else if (key == GetHeap()->observed_symbol()) {
|
||||
os << " (transition to Object.observe)";
|
||||
} else {
|
||||
PropertyDetails details = GetTargetDetails(i);
|
||||
switch (details.type()) {
|
||||
case FIELD: {
|
||||
os << " (transition to field)";
|
||||
break;
|
||||
}
|
||||
case CONSTANT:
|
||||
os << " (transition to constant " << Brief(GetTargetValue(i)) << ")";
|
||||
break;
|
||||
case CALLBACKS:
|
||||
os << " (transition to callback " << Brief(GetTargetValue(i)) << ")";
|
||||
break;
|
||||
}
|
||||
os << ", attrs: " << details.attributes();
|
||||
}
|
||||
os << " -> " << Brief(GetTarget(i)) << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // OBJECT_PRINT
|
||||
|
||||
|
||||
@ -1205,4 +1120,95 @@ int Name::NameShortPrint(Vector<char> str) {
|
||||
|
||||
|
||||
#endif // TRACE_MAPS
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
// This method is only meant to be called from gdb for debugging purposes.
|
||||
// Since the string can also be in two-byte encoding, non-Latin1 characters
|
||||
// will be ignored in the output.
|
||||
char* String::ToAsciiArray() {
|
||||
// Static so that subsequent calls frees previously allocated space.
|
||||
// This also means that previous results will be overwritten.
|
||||
static char* buffer = NULL;
|
||||
if (buffer != NULL) delete[] buffer;
|
||||
buffer = new char[length() + 1];
|
||||
WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
|
||||
buffer[length()] = 0;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
void DescriptorArray::Print() {
|
||||
OFStream os(stdout);
|
||||
this->PrintDescriptors(os);
|
||||
os << std::flush;
|
||||
}
|
||||
|
||||
|
||||
void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
|
||||
HandleScope scope(GetIsolate());
|
||||
os << "Descriptor array " << number_of_descriptors() << "\n";
|
||||
for (int i = 0; i < number_of_descriptors(); i++) {
|
||||
Descriptor desc;
|
||||
Get(i, &desc);
|
||||
os << " " << i << ": " << desc << "\n";
|
||||
}
|
||||
os << "\n";
|
||||
}
|
||||
|
||||
|
||||
void TransitionArray::Print() {
|
||||
OFStream os(stdout);
|
||||
this->PrintTransitions(os);
|
||||
os << std::flush;
|
||||
}
|
||||
|
||||
|
||||
void TransitionArray::PrintTransitions(std::ostream& os,
|
||||
bool print_header) { // NOLINT
|
||||
if (print_header) {
|
||||
os << "Transition array " << number_of_transitions() << "\n";
|
||||
}
|
||||
for (int i = 0; i < number_of_transitions(); i++) {
|
||||
Name* key = GetKey(i);
|
||||
os << " ";
|
||||
#ifdef OBJECT_PRINT
|
||||
key->NamePrint(os);
|
||||
#else
|
||||
key->ShortPrint(os);
|
||||
#endif
|
||||
os << ": ";
|
||||
if (key == GetHeap()->frozen_symbol()) {
|
||||
os << " (transition to frozen)";
|
||||
} else if (key == GetHeap()->elements_transition_symbol()) {
|
||||
os << " (transition to "
|
||||
<< ElementsKindToString(GetTarget(i)->elements_kind()) << ")";
|
||||
} else if (key == GetHeap()->observed_symbol()) {
|
||||
os << " (transition to Object.observe)";
|
||||
} else {
|
||||
PropertyDetails details = GetTargetDetails(i);
|
||||
switch (details.type()) {
|
||||
case FIELD: {
|
||||
os << " (transition to field)";
|
||||
break;
|
||||
}
|
||||
case CONSTANT:
|
||||
os << " (transition to constant " << Brief(GetTargetValue(i)) << ")";
|
||||
break;
|
||||
case CALLBACKS:
|
||||
os << " (transition to callback " << Brief(GetTargetValue(i)) << ")";
|
||||
break;
|
||||
}
|
||||
os << ", attrs: " << details.attributes();
|
||||
}
|
||||
os << " -> " << Brief(GetTarget(i)) << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
|
||||
if (!map()->HasTransitionArray()) return;
|
||||
map()->transitions()->PrintTransitions(os, false);
|
||||
}
|
||||
#endif // DEBUG
|
||||
} } // namespace v8::internal
|
||||
|
@ -983,6 +983,9 @@ void Object::ShortPrint(StringStream* accumulator) {
|
||||
}
|
||||
|
||||
|
||||
void Object::ShortPrint(std::ostream& os) { os << Brief(this); }
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const Brief& v) {
|
||||
if (v.value->IsSmi()) {
|
||||
Smi::cast(v.value)->SmiPrint(os);
|
||||
|
@ -1230,6 +1230,8 @@ class Object {
|
||||
// Prints this object without details to a message accumulator.
|
||||
void ShortPrint(StringStream* accumulator);
|
||||
|
||||
void ShortPrint(std::ostream& os); // NOLINT
|
||||
|
||||
DECLARE_CAST(Object)
|
||||
|
||||
// Layout description.
|
||||
@ -1241,6 +1243,9 @@ class Object {
|
||||
|
||||
// Prints this object with details.
|
||||
void Print(std::ostream& os); // NOLINT
|
||||
#else
|
||||
void Print() { ShortPrint(); }
|
||||
void Print(std::ostream& os) { ShortPrint(os); } // NOLINT
|
||||
#endif
|
||||
|
||||
private:
|
||||
@ -2137,6 +2142,8 @@ class JSObject: public JSReceiver {
|
||||
#ifdef OBJECT_PRINT
|
||||
void PrintProperties(std::ostream& os); // NOLINT
|
||||
void PrintElements(std::ostream& os); // NOLINT
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void PrintTransitions(std::ostream& os); // NOLINT
|
||||
#endif
|
||||
|
||||
@ -3063,15 +3070,13 @@ class DescriptorArray: public FixedArray {
|
||||
static const int kDescriptorValue = 2;
|
||||
static const int kDescriptorSize = 3;
|
||||
|
||||
#ifdef OBJECT_PRINT
|
||||
#ifdef DEBUG
|
||||
// For our gdb macros, we should perhaps change these in the future.
|
||||
void Print();
|
||||
|
||||
// Print all the descriptors.
|
||||
void PrintDescriptors(std::ostream& os); // NOLINT
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
// Is the descriptor array sorted and without duplicates?
|
||||
bool IsSortedNoDuplicates(int valid_descriptors = -1);
|
||||
|
||||
@ -8953,7 +8958,7 @@ class String: public Name {
|
||||
// Dispatched behavior.
|
||||
void StringShortPrint(StringStream* accumulator);
|
||||
void PrintUC16(std::ostream& os, int start = 0, int end = -1); // NOLINT
|
||||
#ifdef OBJECT_PRINT
|
||||
#ifdef DEBUG
|
||||
char* ToAsciiArray();
|
||||
#endif
|
||||
DECLARE_PRINTER(String)
|
||||
|
@ -155,15 +155,13 @@ class TransitionArray: public FixedArray {
|
||||
static const int kTransitionTarget = 1;
|
||||
static const int kTransitionSize = 2;
|
||||
|
||||
#ifdef OBJECT_PRINT
|
||||
#ifdef DEBUG
|
||||
// For our gdb macros, we should perhaps change these in the future.
|
||||
void Print();
|
||||
|
||||
// Print all the transitions.
|
||||
void PrintTransitions(std::ostream& os, bool print_header = true); // NOLINT
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
bool IsSortedNoDuplicates(int valid_entries = -1);
|
||||
bool IsConsistentWithBackPointers(Map* current_map);
|
||||
bool IsEqualTo(TransitionArray* other);
|
||||
|
@ -22040,7 +22040,7 @@ TEST(Regress385349) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef ENABLE_DISASSEMBLER
|
||||
static int probes_counter = 0;
|
||||
static int misses_counter = 0;
|
||||
static int updates_counter = 0;
|
||||
@ -22074,7 +22074,7 @@ static const char* kMegamorphicTestProgram =
|
||||
|
||||
|
||||
static void StubCacheHelper(bool primary) {
|
||||
#ifdef DEBUG
|
||||
#ifdef ENABLE_DISASSEMBLER
|
||||
i::FLAG_native_code_counters = true;
|
||||
if (primary) {
|
||||
i::FLAG_test_primary_stub_cache = true;
|
||||
|
@ -174,7 +174,7 @@
|
||||
##############################################################################
|
||||
# Tests verifying CHECK and ASSERT.
|
||||
'verify-check-false': [FAIL, NO_VARIANTS],
|
||||
'verify-assert-false': [NO_VARIANTS, ['mode == release', PASS], ['mode == debug', FAIL]],
|
||||
'verify-assert-false': [NO_VARIANTS, ['mode == release and dcheck_always_on == False', PASS], ['mode == debug or dcheck_always_on == True', FAIL]],
|
||||
|
||||
##############################################################################
|
||||
# Tests with different versions for release and debug.
|
||||
|
@ -57,6 +57,10 @@
|
||||
['arch == arm64 and simulator_run == True', {
|
||||
'dfg-int-overflow-in-loop': [SKIP],
|
||||
}], # 'arch == arm64 and simulator_run == True'
|
||||
['dcheck_always_on == True and arch == arm64', {
|
||||
# Doesn't work with gcc 4.6 on arm64 for some reason.
|
||||
'reentrant-caching': [SKIP],
|
||||
}], # 'dcheck_always_on == True and arch == arm64'
|
||||
|
||||
|
||||
##############################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user