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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 92433002: Merge sin(a), cos(a) into one instruction. TODO: Implement for ARM and MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 6649 matching lines...) Expand 10 before | Expand all | Expand 10 after
6660 kSinCos, 6660 kSinCos,
6661 }; 6661 };
6662 6662
6663 MergedMathInstr(ZoneGrowableArray<Value*>* inputs, 6663 MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
6664 intptr_t original_deopt_id, 6664 intptr_t original_deopt_id,
6665 MergedMathInstr::Kind kind); 6665 MergedMathInstr::Kind kind);
6666 6666
6667 static intptr_t InputCountFor(MergedMathInstr::Kind kind) { 6667 static intptr_t InputCountFor(MergedMathInstr::Kind kind) {
6668 if (kind == kTruncDivMod) { 6668 if (kind == kTruncDivMod) {
6669 return 2; 6669 return 2;
6670 } else if (kind == kSinCos) {
6671 return 1;
6670 } else { 6672 } else {
6671 UNIMPLEMENTED(); 6673 UNIMPLEMENTED();
6672 return -1; 6674 return -1;
6673 } 6675 }
6674 } 6676 }
6675 6677
6676 MergedMathInstr::Kind kind() const { return kind_; } 6678 MergedMathInstr::Kind kind() const { return kind_; }
6677 6679
6678 virtual intptr_t InputCount() const { return inputs_->length(); } 6680 virtual intptr_t InputCount() const { return inputs_->length(); }
6679 6681
6680 virtual Value* InputAt(intptr_t i) const { 6682 virtual Value* InputAt(intptr_t i) const {
6681 return (*inputs_)[i]; 6683 return (*inputs_)[i];
6682 } 6684 }
6683 6685
6684 virtual CompileType ComputeType() const; 6686 virtual CompileType ComputeType() const;
6685 virtual void PrintOperandsTo(BufferFormatter* f) const; 6687 virtual void PrintOperandsTo(BufferFormatter* f) const;
6686 6688
6687 virtual bool CanDeoptimize() const { 6689 virtual bool CanDeoptimize() const {
6688 if (kind_ == kTruncDivMod) { 6690 if (kind_ == kTruncDivMod) {
6689 return true; 6691 return true;
6692 } else if (kind_ == kSinCos) {
6693 return false;
6690 } else { 6694 } else {
6691 UNIMPLEMENTED(); 6695 UNIMPLEMENTED();
6692 return false; 6696 return false;
6693 } 6697 }
6694 } 6698 }
6695 6699
6696 virtual Representation representation() const { 6700 virtual Representation representation() const {
6697 if (kind_ == kTruncDivMod) { 6701 if (kind_ == kTruncDivMod) {
6698 return kTagged; 6702 return kTagged;
6703 } else if (kind_ == kSinCos) {
6704 return kTagged;
6699 } else { 6705 } else {
6700 UNIMPLEMENTED(); 6706 UNIMPLEMENTED();
6701 return kTagged; 6707 return kTagged;
6702 } 6708 }
6703 } 6709 }
6704 6710
6705 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6711 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6712 ASSERT((0 <= idx) && (idx < InputCount()));
6706 if (kind_ == kTruncDivMod) { 6713 if (kind_ == kTruncDivMod) {
6707 ASSERT((0 <= idx) && (idx < InputCount()));
6708 return kTagged; 6714 return kTagged;
6715 } else if (kind_ == kSinCos) {
6716 return kUnboxedDouble;
6709 } else { 6717 } else {
6710 UNIMPLEMENTED(); 6718 UNIMPLEMENTED();
6711 return kTagged; 6719 return kTagged;
6712 } 6720 }
6713 } 6721 }
6714 6722
6715 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 6723 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
6716 6724
6725 // Returns the result index for one of the merged instructjons
6726 static intptr_t ResultIndexOf(MethodRecognizer::Kind kind);
6727 static intptr_t ResultIndexOf(Token::Kind token);
6728
6717 DECLARE_INSTRUCTION(MergedMath) 6729 DECLARE_INSTRUCTION(MergedMath)
6718 6730
6719 // Returns a structure describing the location constraints required 6731 // Returns a structure describing the location constraints required
6720 // to emit native code for this definition. 6732 // to emit native code for this definition.
6721 LocationSummary* locs() { 6733 LocationSummary* locs() {
6722 if (locs_ == NULL) { 6734 if (locs_ == NULL) {
6723 locs_ = MakeLocationSummary(); 6735 locs_ = MakeLocationSummary();
6724 } 6736 }
6725 return locs_; 6737 return locs_;
6726 } 6738 }
6727 6739
6728 virtual bool AllowsCSE() const { return true; } 6740 virtual bool AllowsCSE() const { return true; }
6729 virtual EffectSet Effects() const { return EffectSet::None(); } 6741 virtual EffectSet Effects() const { return EffectSet::None(); }
6730 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6742 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6731 virtual bool AttributesEqual(Instruction* other) const { 6743 virtual bool AttributesEqual(Instruction* other) const {
6732 MergedMathInstr* other_invoke = other->AsMergedMath(); 6744 MergedMathInstr* other_invoke = other->AsMergedMath();
6733 return other_invoke->kind() == kind(); 6745 return other_invoke->kind() == kind();
6734 } 6746 }
6735 6747
6736 virtual bool MayThrow() const { return false; } 6748 virtual bool MayThrow() const { return false; }
6737 6749
6738 static const char* KindToCString(MergedMathInstr::Kind kind) { 6750 static const char* KindToCString(MergedMathInstr::Kind kind) {
6739 if (kind == kTruncDivMod) return "TruncDivMod"; 6751 if (kind == kTruncDivMod) return "TruncDivMod";
6752 if (kind == kSinCos) return "SinCos";
6740 UNIMPLEMENTED(); 6753 UNIMPLEMENTED();
6741 return ""; 6754 return "";
6742 } 6755 }
6743 6756
6744 private: 6757 private:
6745 virtual void RawSetInputAt(intptr_t i, Value* value) { 6758 virtual void RawSetInputAt(intptr_t i, Value* value) {
6746 (*inputs_)[i] = value; 6759 (*inputs_)[i] = value;
6747 } 6760 }
6748 6761
6749 ZoneGrowableArray<Value*>* inputs_; 6762 ZoneGrowableArray<Value*>* inputs_;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
7083 ForwardInstructionIterator* current_iterator_; 7096 ForwardInstructionIterator* current_iterator_;
7084 7097
7085 private: 7098 private:
7086 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 7099 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
7087 }; 7100 };
7088 7101
7089 7102
7090 } // namespace dart 7103 } // namespace dart
7091 7104
7092 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7105 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698