[vm, bytecode] Fix Interpreter::Current when called for the first time outside of kThreadInGenerated state.

Fixes vm/cc/FunctionWithBreakpointNotInlined.

Change-Id: Ie1e7616559c0d758477494c26f03e6ffde0b5e43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107683
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2019-06-28 22:20:03 +00:00 committed by commit-bot@chromium.org
parent f91375405e
commit 55370b8b17
4 changed files with 14 additions and 8 deletions

View file

@ -404,9 +404,9 @@ Interpreter* Interpreter::Current() {
Thread* thread = Thread::Current();
Interpreter* interpreter = thread->interpreter();
if (interpreter == nullptr) {
TransitionGeneratedToVM transition(thread);
NoSafepointScope no_safepoint;
interpreter = new Interpreter();
Thread::Current()->set_interpreter(interpreter);
thread->set_interpreter(interpreter);
}
return interpreter;
}

View file

@ -829,10 +829,12 @@ uword Simulator::FunctionForRedirect(uword redirect) {
// Get the active Simulator for the current isolate.
Simulator* Simulator::Current() {
Simulator* simulator = Isolate::Current()->simulator();
Isolate* isolate = Isolate::Current();
Simulator* simulator = isolate->simulator();
if (simulator == NULL) {
NoSafepointScope no_safepoint;
simulator = new Simulator();
Isolate::Current()->set_simulator(simulator);
isolate->set_simulator(simulator);
}
return simulator;
}

View file

@ -869,10 +869,12 @@ uword Simulator::FunctionForRedirect(uword redirect) {
// Get the active Simulator for the current isolate.
Simulator* Simulator::Current() {
Simulator* simulator = Isolate::Current()->simulator();
Isolate* isolate = Isolate::Current();
Simulator* simulator = isolate->simulator();
if (simulator == NULL) {
NoSafepointScope no_safepoint;
simulator = new Simulator();
Isolate::Current()->set_simulator(simulator);
isolate->set_simulator(simulator);
}
return simulator;
}

View file

@ -584,10 +584,12 @@ Simulator::~Simulator() {
// Get the active Simulator for the current isolate.
Simulator* Simulator::Current() {
Simulator* simulator = Isolate::Current()->simulator();
Isolate* isolate = Isolate::Current();
Simulator* simulator = isolate->simulator();
if (simulator == NULL) {
NoSafepointScope no_safepoint;
simulator = new Simulator();
Isolate::Current()->set_simulator(simulator);
isolate->set_simulator(simulator);
}
return simulator;
}