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

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2015113002: DBC: Collect type feedback for fastpath smi ops (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add comment Created 4 years, 6 months 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
« no previous file with comments | « runtime/vm/object_dbc_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_dbc.cc
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index ffe4e9285c7f38ef50cbac33b65e2daccf027b2b..baafca844ed13c442ee0d7286b0eec59e7583fd2 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -754,6 +754,20 @@ static DART_NOINLINE bool InvokeNativeWrapper(
#define DECLARE_A_X int32_t rD; USE(rD)
#define DECODE_A_X rD = (static_cast<int32_t>(op) >> Bytecode::kDShift);
+
+#define SMI_FASTPATH_ICDATA_INC \
+ do { \
+ ASSERT(Bytecode::IsCallOpcode(*pc)); \
+ const uint16_t kidx = Bytecode::DecodeD(*pc); \
+ const RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx)); \
+ RawObject** data = icdata->ptr()->ic_data_->ptr()->data(); \
+ const intptr_t count_offset = ICData::CountIndexFor(2); \
+ const intptr_t raw_smi_old = \
+ reinterpret_cast<intptr_t>(data[count_offset]); \
+ const intptr_t raw_smi_new = raw_smi_old + Smi::RawValue(1); \
+ *reinterpret_cast<intptr_t*>(&data[count_offset]) = raw_smi_new; \
+ } while (0); \
+
// Declare bytecode handler for a smi operation (e.g. AddTOS) with the
// given result type and the given behavior specified as a function
// that takes left and right operands and result slot and returns
@@ -764,6 +778,7 @@ static DART_NOINLINE bool InvokeNativeWrapper(
const intptr_t rhs = reinterpret_cast<intptr_t>(SP[-0]); \
ResultT* slot = reinterpret_cast<ResultT*>(SP - 1); \
if (LIKELY(AreBothSmis(lhs, rhs) && !Func(lhs, rhs, slot))) { \
+ SMI_FASTPATH_ICDATA_INC; \
/* Fast path succeeded. Skip the generic call that follows. */ \
pc++; \
/* We dropped 2 arguments and push result */ \
« no previous file with comments | « runtime/vm/object_dbc_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698