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

Side by Side Diff: runtime/vm/intermediate_language_arm.cc

Issue 353513002: Use range information for optimizing integer boxing and fix bug in range analysis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 5809 matching lines...) Expand 10 before | Expand all | Expand 10 after
5820 // Sign extend result_lo into result_hi. 5820 // Sign extend result_lo into result_hi.
5821 __ SignFill(result_hi, result_lo); 5821 __ SignFill(result_hi, result_lo);
5822 __ Bind(&done); 5822 __ Bind(&done);
5823 } 5823 }
5824 } 5824 }
5825 5825
5826 5826
5827 LocationSummary* BoxIntegerInstr::MakeLocationSummary(Isolate* isolate, 5827 LocationSummary* BoxIntegerInstr::MakeLocationSummary(Isolate* isolate,
5828 bool opt) const { 5828 bool opt) const {
5829 const intptr_t kNumInputs = 1; 5829 const intptr_t kNumInputs = 1;
5830 const intptr_t kNumTemps = 1; 5830 const intptr_t kNumTemps = is_smi() ? 0 : 1;
5831 LocationSummary* summary = new(isolate) LocationSummary( 5831 LocationSummary* summary = new(isolate) LocationSummary(
5832 isolate, kNumInputs, 5832 isolate, kNumInputs,
5833 kNumTemps, 5833 kNumTemps,
5834 LocationSummary::kCallOnSlowPath); 5834 is_smi()
5835 ? LocationSummary::kNoCall
5836 : LocationSummary::kCallOnSlowPath);
5835 summary->set_in(0, Location::Pair(Location::RequiresRegister(), 5837 summary->set_in(0, Location::Pair(Location::RequiresRegister(),
5836 Location::RequiresRegister())); 5838 Location::RequiresRegister()));
5837 summary->set_temp(0, Location::RequiresRegister()); 5839 if (!is_smi()) {
5840 summary->set_temp(0, Location::RequiresRegister());
5841 }
5838 summary->set_out(0, Location::RequiresRegister()); 5842 summary->set_out(0, Location::RequiresRegister());
5839 return summary; 5843 return summary;
5840 } 5844 }
5841 5845
5842 5846
5843 class BoxIntegerSlowPath : public SlowPathCode { 5847 class BoxIntegerSlowPath : public SlowPathCode {
5844 public: 5848 public:
5845 explicit BoxIntegerSlowPath(BoxIntegerInstr* instruction) 5849 explicit BoxIntegerSlowPath(BoxIntegerInstr* instruction)
5846 : instruction_(instruction) { } 5850 : instruction_(instruction) { }
5847 5851
(...skipping 19 matching lines...) Expand all
5867 5871
5868 __ b(exit_label()); 5872 __ b(exit_label());
5869 } 5873 }
5870 5874
5871 private: 5875 private:
5872 BoxIntegerInstr* instruction_; 5876 BoxIntegerInstr* instruction_;
5873 }; 5877 };
5874 5878
5875 5879
5876 void BoxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5880 void BoxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5881 if (is_smi()) {
5882 PairLocation* value_pair = locs()->in(0).AsPairLocation();
5883 Register value_lo = value_pair->At(0).reg();
5884 Register out_reg = locs()->out(0).reg();
5885 __ mov(out_reg, Operand(value_lo));
5886 __ SmiTag(out_reg);
5887 return;
5888 }
5889
5877 BoxIntegerSlowPath* slow_path = new BoxIntegerSlowPath(this); 5890 BoxIntegerSlowPath* slow_path = new BoxIntegerSlowPath(this);
5878 compiler->AddSlowPathCode(slow_path); 5891 compiler->AddSlowPathCode(slow_path);
5879 PairLocation* value_pair = locs()->in(0).AsPairLocation(); 5892 PairLocation* value_pair = locs()->in(0).AsPairLocation();
5880 Register value_lo = value_pair->At(0).reg(); 5893 Register value_lo = value_pair->At(0).reg();
5881 Register value_hi = value_pair->At(1).reg(); 5894 Register value_hi = value_pair->At(1).reg();
5882 Register tmp = locs()->temp(0).reg(); 5895 Register tmp = locs()->temp(0).reg();
5883 Register out_reg = locs()->out(0).reg(); 5896 Register out_reg = locs()->out(0).reg();
5884 5897
5885 // Unboxed operations produce smis or mint-sized values. 5898 // Unboxed operations produce smis or mint-sized values.
5886 // Check if value fits into a smi. 5899 // Check if value fits into a smi.
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
6358 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 6371 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
6359 #if defined(DEBUG) 6372 #if defined(DEBUG)
6360 __ LoadImmediate(R4, kInvalidObjectPointer); 6373 __ LoadImmediate(R4, kInvalidObjectPointer);
6361 __ LoadImmediate(R5, kInvalidObjectPointer); 6374 __ LoadImmediate(R5, kInvalidObjectPointer);
6362 #endif 6375 #endif
6363 } 6376 }
6364 6377
6365 } // namespace dart 6378 } // namespace dart
6366 6379
6367 #endif // defined TARGET_ARCH_ARM 6380 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698