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

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

Issue 330263002: Eliminate overflow check for non-overflowing smi << operations. (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
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 } 2554 }
2555 if (compiler->ForceSlowPathForStackOverflow()) { 2555 if (compiler->ForceSlowPathForStackOverflow()) {
2556 __ b(slow_path->entry_label()); 2556 __ b(slow_path->entry_label());
2557 } 2557 }
2558 __ Bind(slow_path->exit_label()); 2558 __ Bind(slow_path->exit_label());
2559 } 2559 }
2560 2560
2561 2561
2562 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, 2562 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
2563 BinarySmiOpInstr* shift_left) { 2563 BinarySmiOpInstr* shift_left) {
2564 const bool is_truncating = shift_left->is_truncating(); 2564 const bool is_truncating = shift_left->IsTruncating();
2565 const LocationSummary& locs = *shift_left->locs(); 2565 const LocationSummary& locs = *shift_left->locs();
2566 Register left = locs.in(0).reg(); 2566 Register left = locs.in(0).reg();
2567 Register result = locs.out(0).reg(); 2567 Register result = locs.out(0).reg();
2568 Label* deopt = shift_left->CanDeoptimize() ? 2568 Label* deopt = shift_left->CanDeoptimize() ?
2569 compiler->AddDeoptStub(shift_left->deopt_id(), ICData::kDeoptBinarySmiOp) 2569 compiler->AddDeoptStub(shift_left->deopt_id(), ICData::kDeoptBinarySmiOp)
2570 : NULL; 2570 : NULL;
2571 2571
2572 __ TraceSimMsg("EmitSmiShiftLeft"); 2572 __ TraceSimMsg("EmitSmiShiftLeft");
2573 2573
2574 if (locs.in(1).IsConstant()) { 2574 if (locs.in(1).IsConstant()) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 } 2674 }
2675 2675
2676 2676
2677 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Isolate* isolate, 2677 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Isolate* isolate,
2678 bool opt) const { 2678 bool opt) const {
2679 const intptr_t kNumInputs = 2; 2679 const intptr_t kNumInputs = 2;
2680 const intptr_t kNumTemps = 2680 const intptr_t kNumTemps =
2681 ((op_kind() == Token::kADD) || 2681 ((op_kind() == Token::kADD) ||
2682 (op_kind() == Token::kMOD) || 2682 (op_kind() == Token::kMOD) ||
2683 (op_kind() == Token::kTRUNCDIV) || 2683 (op_kind() == Token::kTRUNCDIV) ||
2684 (((op_kind() == Token::kSHL) && !is_truncating()) || 2684 (((op_kind() == Token::kSHL) && !IsTruncating()) ||
2685 (op_kind() == Token::kSHR))) ? 1 : 0; 2685 (op_kind() == Token::kSHR))) ? 1 : 0;
2686 LocationSummary* summary = new(isolate) LocationSummary( 2686 LocationSummary* summary = new(isolate) LocationSummary(
2687 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2687 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2688 if (op_kind() == Token::kTRUNCDIV) { 2688 if (op_kind() == Token::kTRUNCDIV) {
2689 summary->set_in(0, Location::RequiresRegister()); 2689 summary->set_in(0, Location::RequiresRegister());
2690 if (RightIsPowerOfTwoConstant()) { 2690 if (RightIsPowerOfTwoConstant()) {
2691 ConstantInstr* right_constant = right()->definition()->AsConstant(); 2691 ConstantInstr* right_constant = right()->definition()->AsConstant();
2692 summary->set_in(1, Location::Constant(right_constant->value())); 2692 summary->set_in(1, Location::Constant(right_constant->value()));
2693 } else { 2693 } else {
2694 summary->set_in(1, Location::RequiresRegister()); 2694 summary->set_in(1, Location::RequiresRegister());
2695 } 2695 }
2696 summary->set_temp(0, Location::RequiresRegister()); 2696 summary->set_temp(0, Location::RequiresRegister());
2697 summary->set_out(0, Location::RequiresRegister()); 2697 summary->set_out(0, Location::RequiresRegister());
2698 return summary; 2698 return summary;
2699 } 2699 }
2700 if (op_kind() == Token::kMOD) { 2700 if (op_kind() == Token::kMOD) {
2701 summary->set_in(0, Location::RequiresRegister()); 2701 summary->set_in(0, Location::RequiresRegister());
2702 summary->set_in(1, Location::RequiresRegister()); 2702 summary->set_in(1, Location::RequiresRegister());
2703 summary->set_temp(0, Location::RequiresRegister()); 2703 summary->set_temp(0, Location::RequiresRegister());
2704 summary->set_out(0, Location::RequiresRegister()); 2704 summary->set_out(0, Location::RequiresRegister());
2705 return summary; 2705 return summary;
2706 } 2706 }
2707 summary->set_in(0, Location::RequiresRegister()); 2707 summary->set_in(0, Location::RequiresRegister());
2708 summary->set_in(1, Location::RegisterOrSmiConstant(right())); 2708 summary->set_in(1, Location::RegisterOrSmiConstant(right()));
2709 if (((op_kind() == Token::kSHL) && !is_truncating()) || 2709 if (((op_kind() == Token::kSHL) && !IsTruncating()) ||
2710 (op_kind() == Token::kSHR)) { 2710 (op_kind() == Token::kSHR)) {
2711 summary->set_temp(0, Location::RequiresRegister()); 2711 summary->set_temp(0, Location::RequiresRegister());
2712 } else if (op_kind() == Token::kADD) { 2712 } else if (op_kind() == Token::kADD) {
2713 // Need an extra temp for the overflow detection code. 2713 // Need an extra temp for the overflow detection code.
2714 summary->set_temp(0, Location::RequiresRegister()); 2714 summary->set_temp(0, Location::RequiresRegister());
2715 } 2715 }
2716 // We make use of 3-operand instructions by not requiring result register 2716 // We make use of 3-operand instructions by not requiring result register
2717 // to be identical to first input register as on Intel. 2717 // to be identical to first input register as on Intel.
2718 summary->set_out(0, Location::RequiresRegister()); 2718 summary->set_out(0, Location::RequiresRegister());
2719 return summary; 2719 return summary;
2720 } 2720 }
2721 2721
2722 2722
2723 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2723 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2724 __ TraceSimMsg("BinarySmiOpInstr"); 2724 __ TraceSimMsg("BinarySmiOpInstr");
2725 if (op_kind() == Token::kSHL) { 2725 if (op_kind() == Token::kSHL) {
2726 EmitSmiShiftLeft(compiler, this); 2726 EmitSmiShiftLeft(compiler, this);
2727 return; 2727 return;
2728 } 2728 }
2729 2729
2730 ASSERT(!is_truncating());
2731 Register left = locs()->in(0).reg(); 2730 Register left = locs()->in(0).reg();
2732 Register result = locs()->out(0).reg(); 2731 Register result = locs()->out(0).reg();
2733 Label* deopt = NULL; 2732 Label* deopt = NULL;
2734 if (CanDeoptimize()) { 2733 if (CanDeoptimize()) {
2735 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); 2734 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp);
2736 } 2735 }
2737 2736
2738 if (locs()->in(1).IsConstant()) { 2737 if (locs()->in(1).IsConstant()) {
2739 const Object& constant = locs()->in(1).constant(); 2738 const Object& constant = locs()->in(1).constant();
2740 ASSERT(constant.IsSmi()); 2739 ASSERT(constant.IsSmi());
(...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 4691 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4693 #if defined(DEBUG) 4692 #if defined(DEBUG)
4694 __ LoadImmediate(S4, kInvalidObjectPointer); 4693 __ LoadImmediate(S4, kInvalidObjectPointer);
4695 __ LoadImmediate(S5, kInvalidObjectPointer); 4694 __ LoadImmediate(S5, kInvalidObjectPointer);
4696 #endif 4695 #endif
4697 } 4696 }
4698 4697
4699 } // namespace dart 4698 } // namespace dart
4700 4699
4701 #endif // defined TARGET_ARCH_MIPS 4700 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698