[VM] Do not use the contents of the megamorphic miss code in stack_frame

The megamorphic miss stub might not be initialized at the point in time
when we access it.

Fixes https://github.com/dart-lang/sdk/issues/35405

Change-Id: If20622bd4f3b14d6ece5a8de6f006d7081d6cf76
Reviewed-on: https://dart-review.googlesource.com/c/87322
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
Martin Kustermann 2018-12-14 15:06:10 +00:00 committed by commit-bot@chromium.org
parent 8dd03bee13
commit 08c386a33e
3 changed files with 10 additions and 41 deletions

View file

@ -91,16 +91,9 @@ bool StackFrame::IsBareInstructionsDartFrame() const {
auto rct = isolate->reverse_pc_lookup_cache();
code = rct->Lookup(pc());
// All stub codes have a `null` owner except for the megamorphic miss
// stub. So if it's neither of those, we are know it must be a
// precompiled dart frame.
RawObject* owner = code.owner();
if (owner != Object::null()) {
if (code.raw() ==
Isolate::Current()->object_store()->megamorphic_miss_code()) {
return true;
}
}
const intptr_t cid = code.owner()->GetClassId();
ASSERT(cid == kNullCid || cid == kClassCid || cid == kFunctionCid);
return cid == kFunctionCid;
}
return false;
}
@ -113,37 +106,13 @@ bool StackFrame::IsBareInstructionsStubFrame() const {
auto rct = isolate->reverse_pc_lookup_cache();
code = rct->Lookup(pc());
// All stub codes have a `null` owner except for the megamorphic miss stub.
// So if it's either of those, we are know it must be a precompiled stub
// frame.
RawObject* owner = code.owner();
if (owner == Object::null()) {
return true;
}
if (code.raw() ==
Isolate::Current()->object_store()->megamorphic_miss_code()) {
return true;
}
const intptr_t cid = code.owner()->GetClassId();
ASSERT(cid == kNullCid || cid == kClassCid || cid == kFunctionCid);
return cid == kNullCid || cid == kClassCid;
}
return false;
}
bool StackFrame::IsDartFrame(bool validate) const {
ASSERT(!validate || IsValid());
if (IsEntryFrame() || IsExitFrame()) return false;
// Even though the megamorphic miss stub is a stub, we consider it as a
// dart frame for all practical purposes.
const bool is_megamorphic_miss_stub = Code::ContainsInstructionAt(
thread_->isolate()->object_store()->megamorphic_miss_code(), pc_);
if (is_megamorphic_miss_stub) return true;
return !IsStubFrame();
}
bool StackFrame::IsStubFrame() const {
if (is_interpreted()) {
return false;

View file

@ -165,7 +165,10 @@ class StackFrame : public ValueObject {
bool IsBareInstructionsStubFrame() const;
// Frame type.
virtual bool IsDartFrame(bool validate = true) const;
virtual bool IsDartFrame(bool validate = true) const {
ASSERT(!validate || IsValid());
return !(IsEntryFrame() || IsExitFrame() || IsStubFrame());
}
virtual bool IsStubFrame() const;
virtual bool IsEntryFrame() const { return false; }
virtual bool IsExitFrame() const { return false; }

View file

@ -240,9 +240,6 @@ vm/debug_break_enabled_vm_test/01: CompileTimeError # KernelVM bug: Bad test usi
vm/debug_break_enabled_vm_test/none: CompileTimeError # KernelVM bug: Bad test using extended break syntax.
vm/regress_27201_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
[ $arch == ia32 && $compiler == dartk && $system == windows ]
deferred_optimized_test: Pass, Crash # Issue 35405 (Flaky failure).
[ $builder_tag == obfuscated && $compiler == dartkp ]
generic_function_dcall_test/01: SkipByDesign # Prints type names
invocation_mirror_test: RuntimeError # Issue 34911