[vm, aot] Debugging aids for null function encountered when writing DWARF inlining data.

Bug: https://github.com/dart-lang/sdk/issues/31952
Change-Id: I884c1a0c6f7255935743c4ec7c78c9501708a2f7
Reviewed-on: https://dart-review.googlesource.com/40203
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2018-02-09 18:49:39 +00:00 committed by commit-bot@chromium.org
parent 75a2661f0e
commit 692eaba189
2 changed files with 19 additions and 8 deletions

View file

@ -28,7 +28,10 @@ class InliningNode : public ZoneAllocated {
end_pc_offset(-1),
children_head(NULL),
children_tail(NULL),
children_next(NULL) {}
children_next(NULL) {
ASSERT(!function.IsNull());
ASSERT(function.IsNotTemporaryScopedHandle());
}
void AppendChild(InliningNode* child) {
if (children_tail == NULL) {
@ -86,7 +89,7 @@ intptr_t Dwarf::AddCode(const Code& code) {
}
intptr_t Dwarf::AddFunction(const Function& function) {
ASSERT(!function.IsNull());
RELEASE_ASSERT(!function.IsNull());
FunctionIndexPair* pair = function_to_index_.Lookup(&function);
if (pair != NULL) {
return pair->index_;
@ -349,7 +352,7 @@ InliningNode* Dwarf::ExpandInliningTree(const Code& code) {
return NULL;
}
const Array& functions = Array::Handle(zone_, code.inlined_id_to_function());
const Function& root_function = Function::Handle(zone_, code.function());
const Function& root_function = Function::ZoneHandle(zone_, code.function());
GrowableArray<InliningNode*> node_stack(zone_, 4);
GrowableArray<TokenPosition> token_positions(zone_, 4);
@ -380,7 +383,7 @@ InliningNode* Dwarf::ExpandInliningTree(const Code& code) {
case CodeSourceMapBuilder::kPushFunction: {
int32_t func = stream.Read<int32_t>();
const Function& child_func =
Function::Handle(zone_, Function::RawCast(functions.At(func)));
Function::ZoneHandle(zone_, Function::RawCast(functions.At(func)));
TokenPosition call_pos = token_positions.Last();
InliningNode* child_node =
new (zone_) InliningNode(child_func, call_pos, current_pc_offset);

View file

@ -34,8 +34,10 @@ struct ScriptIndexPair {
return pair.script_->raw() == key->raw();
}
ScriptIndexPair(const Script* s, intptr_t index)
: script_(s), index_(index) {}
ScriptIndexPair(const Script* s, intptr_t index) : script_(s), index_(index) {
ASSERT(!s->IsNull());
ASSERT(s->IsNotTemporaryScopedHandle());
}
ScriptIndexPair() : script_(NULL), index_(-1) {}
@ -64,7 +66,10 @@ struct FunctionIndexPair {
}
FunctionIndexPair(const Function* f, intptr_t index)
: function_(f), index_(index) {}
: function_(f), index_(index) {
ASSERT(!f->IsNull());
ASSERT(f->IsNotTemporaryScopedHandle());
}
FunctionIndexPair() : function_(NULL), index_(-1) {}
@ -95,7 +100,10 @@ struct CodeIndexPair {
return pair.code_->raw() == key->raw();
}
CodeIndexPair(const Code* c, intptr_t index) : code_(c), index_(index) {}
CodeIndexPair(const Code* c, intptr_t index) : code_(c), index_(index) {
ASSERT(!c->IsNull());
ASSERT(c->IsNotTemporaryScopedHandle());
}
CodeIndexPair() : code_(NULL), index_(-1) {}