Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1271)

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2473213002: DBC: When calling DRT_OptimizeInvokedFunction, patch the stack to have a stub instead of the to-be-… (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/simulator_dbc.cc
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index c02e1bfcaa5dfe5e11de27f647c661240756c608..748be51b4c14a94b22823118d5cf633f15b2211b 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -38,6 +38,7 @@ DEFINE_FLAG(uint64_t, stop_sim_at, ULLONG_MAX,
"Instruction address or instruction count to stop simulator at.");
#define LIKELY(cond) __builtin_expect((cond), 1)
+#define UNLIKELY(cond) __builtin_expect((cond), 0)
// SimulatorSetjmpBuffer are linked together, and the last created one
// is referenced by the Simulator. When an exception is thrown, the exception
@@ -1435,9 +1436,17 @@ RawObject* Simulator::Call(const Code& code,
counter += increment;
f->ptr()->usage_counter_ = counter;
}
- if (counter >= threshold) {
+ if (UNLIKELY(counter >= threshold)) {
FP[0] = f;
FP[1] = 0;
+
+ // Make the DRT_OptimizeInvokedFunction see a stub as its caller for
+ // consistency with the other architectures, and to avoid needing to
+ // generate a stackmap for the HotCheck pc.
+ const StubEntry* stub = StubCode::OptimizeFunction_entry();
zra 2016/11/04 16:01:05 Is it okay for this to be *any* stub, or does it h
rmacnak 2016/11/04 16:50:27 Right, any stub because we'll switch to the new op
+ FP[kPcMarkerSlotFromFp] = stub->code();
+ pc = reinterpret_cast<uint32_t*>(stub->EntryPoint());
+
Exit(thread, FP, FP + 2, pc);
NativeArguments args(thread, 1, FP, FP + 1);
INVOKE_RUNTIME(DRT_OptimizeInvokedFunction, args);

Powered by Google App Engine
This is Rietveld 408576698