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

Unified Diff: runtime/vm/intermediate_language_arm64.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/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_arm64.cc
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
index 0e001d1b5f65bd75c71ce9bb57d7d4fb038349bd..d427823800cd181f1519c8af081168052cca7786 100644
--- a/runtime/vm/intermediate_language_arm64.cc
+++ b/runtime/vm/intermediate_language_arm64.cc
@@ -2766,6 +2766,91 @@ static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
}
+class CheckedSmiSlowPath : public SlowPathCode {
+ public:
+ CheckedSmiSlowPath(CheckedSmiOpInstr* instruction, intptr_t try_index)
+ : instruction_(instruction), try_index_(try_index) { }
+
+ virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
+ if (Assembler::EmittingComments()) {
+ __ Comment("slow path smi operation");
+ }
+ __ Bind(entry_label());
+ LocationSummary* locs = instruction_->locs();
+ Register result = locs->out(0).reg();
+ locs->live_registers()->Remove(Location::RegisterLocation(result));
+
+ compiler->SaveLiveRegisters(locs);
+ __ Push(locs->in(0).reg());
+ __ Push(locs->in(1).reg());
+ compiler->EmitMegamorphicInstanceCall(
+ *instruction_->call()->ic_data(),
+ instruction_->call()->ArgumentCount(),
+ instruction_->call()->deopt_id(),
+ instruction_->call()->token_pos(),
+ locs,
+ try_index_,
+ /* slow_path_argument_count = */ 2);
+ __ mov(result, R0);
+ compiler->RestoreLiveRegisters(locs);
+ __ b(exit_label());
+ }
+
+ private:
+ CheckedSmiOpInstr* instruction_;
+ intptr_t try_index_;
+};
+
+
+LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ const intptr_t kNumInputs = 2;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary = new(zone) LocationSummary(
+ zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath);
+ summary->set_in(0, Location::RequiresRegister());
+ summary->set_in(1, Location::RequiresRegister());
+ summary->set_out(0, Location::RequiresRegister());
+ return summary;
+}
+
+
+void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ CheckedSmiSlowPath* slow_path =
+ new CheckedSmiSlowPath(this, compiler->CurrentTryIndex());
+ compiler->AddSlowPathCode(slow_path);
+ // Test operands if necessary.
+ Register left = locs()->in(0).reg();
+ Register right = locs()->in(1).reg();
+ Register result = locs()->out(0).reg();
+ __ orr(result, left, Operand(right));
+ __ tsti(result, Immediate(kSmiTagMask));
+ __ b(slow_path->entry_label(), NE);
+ switch (op_kind()) {
+ case Token::kADD:
+ __ adds(result, left, Operand(right));
+ __ b(slow_path->entry_label(), VS);
+ break;
+ case Token::kSUB:
+ __ subs(result, left, Operand(right));
+ __ b(slow_path->entry_label(), VS);
+ break;
+ case Token::kBIT_OR:
+ // Operation part of combined smi check.
+ break;
+ case Token::kBIT_AND:
+ __ and_(result, left, Operand(right));
+ break;
+ case Token::kBIT_XOR:
+ __ eor(result, left, Operand(right));
+ break;
+ default:
+ UNIMPLEMENTED();
+ }
+ __ Bind(slow_path->exit_label());
+}
+
+
LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 2;
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698