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

Unified Diff: runtime/vm/aot_optimizer.cc

Issue 1756403002: VM: Add smi fast path operations for precompiled code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 4 years, 10 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/aot_optimizer.h ('k') | runtime/vm/constant_propagator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/aot_optimizer.cc
diff --git a/runtime/vm/aot_optimizer.cc b/runtime/vm/aot_optimizer.cc
index f813eb8e43afc2327b09cc92e758a11d34e6f233..440cbb241e534e0f2c95b4eeaa625c022de15d2c 100644
--- a/runtime/vm/aot_optimizer.cc
+++ b/runtime/vm/aot_optimizer.cc
@@ -2406,8 +2406,11 @@ bool AotOptimizer::IsBlackListedForInlining(intptr_t call_deopt_id) {
return false;
}
-// Special optimizations when running in --noopt mode.
-void AotOptimizer::InstanceCallNoopt(InstanceCallInstr* instr) {
+
+// Tries to optimize instance call by replacing it with a faster instruction
+// (e.g, binary op, field load, ..).
+void AotOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
+ ASSERT(FLAG_precompiled_mode);
// TODO(srdjan): Investigate other attempts, as they are not allowed to
// deoptimize.
@@ -2484,6 +2487,28 @@ void AotOptimizer::InstanceCallNoopt(InstanceCallInstr* instr) {
return;
}
}
+ switch (instr->token_kind()) {
+ case Token::kBIT_OR:
+ case Token::kBIT_XOR:
+ case Token::kBIT_AND:
+ case Token::kADD:
+ case Token::kSUB: {
+ if (HasOnlyTwoOf(*instr->ic_data(), kSmiCid)) {
+ Definition* left = instr->ArgumentAt(0);
+ Definition* right = instr->ArgumentAt(1);
+ CheckedSmiOpInstr* smi_op =
+ new(Z) CheckedSmiOpInstr(instr->token_kind(),
+ new(Z) Value(left),
+ new(Z) Value(right),
+ instr);
+
+ ReplaceCall(instr, smi_op);
+ return;
+ }
+ }
+ default:
+ break;
+ }
// More than one targets. Generate generic polymorphic call without
// deoptimization.
@@ -2539,19 +2564,10 @@ void AotOptimizer::InstanceCallNoopt(InstanceCallInstr* instr) {
new(Z) PolymorphicInstanceCallInstr(instr, ic_data,
/* with_checks = */ false);
instr->ReplaceWith(call, current_iterator());
- return;
}
}
-// Tries to optimize instance call by replacing it with a faster instruction
-// (e.g, binary op, field load, ..).
-void AotOptimizer::VisitInstanceCall(InstanceCallInstr* instr) {
- ASSERT(FLAG_precompiled_mode);
- InstanceCallNoopt(instr);
-}
-
-
void AotOptimizer::VisitStaticCall(StaticCallInstr* call) {
if (!CanUnboxDouble()) {
return;
« no previous file with comments | « runtime/vm/aot_optimizer.h ('k') | runtime/vm/constant_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698