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

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

Issue 10542167: Inline Math.sqrt in new compilers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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/flow_graph_optimizer.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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"
11 #include "vm/handles_impl.h" 11 #include "vm/handles_impl.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 // TODO(srdjan): Add _ByteArrayBase, get:length.
17
18 #define RECOGNIZED_LIST(V) \
19 V(ObjectArray, get:length, ObjectArrayLength) \
20 V(ImmutableArray, get:length, ImmutableArrayLength) \
21 V(GrowableObjectArray, get:length, GrowableArrayLength) \
22 V(StringBase, get:length, StringBaseLength) \
23 V(IntegerImplementation, toDouble, IntegerToDouble) \
24 V(Double, toDouble, DoubleToDouble) \
25 V(Math, sqrt, MathSqrt) \
26
27 // Class that recognizes the name and owner of a function and returns the
28 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable
29 // functions.
30 class MethodRecognizer : public AllStatic {
31 public:
32 enum Kind {
33 kUnknown,
34 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name) k##enum_name,
35 RECOGNIZED_LIST(DEFINE_ENUM_LIST)
36 #undef DEFINE_ENUM_LIST
37 };
38
39 static Kind RecognizeKind(const Function& function);
40 static const char* KindToCString(Kind kind);
41 };
42
43
16 class BitVector; 44 class BitVector;
17 class FlowGraphCompiler; 45 class FlowGraphCompiler;
18 class FlowGraphVisitor; 46 class FlowGraphVisitor;
19 class Function; 47 class Function;
20 class LocalVariable; 48 class LocalVariable;
21 class LocationSummary; 49 class LocationSummary;
22 50
23 // M is a two argument macro. It is applied to each concrete value's 51 // M is a two argument macro. It is applied to each concrete value's
24 // typename and classname. 52 // typename and classname.
25 #define FOR_EACH_VALUE(M) \ 53 #define FOR_EACH_VALUE(M) \
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 public: 725 public:
698 StaticCallComp(intptr_t token_index, 726 StaticCallComp(intptr_t token_index,
699 intptr_t try_index, 727 intptr_t try_index,
700 const Function& function, 728 const Function& function,
701 const Array& argument_names, 729 const Array& argument_names,
702 ZoneGrowableArray<Value*>* arguments) 730 ZoneGrowableArray<Value*>* arguments)
703 : token_index_(token_index), 731 : token_index_(token_index),
704 try_index_(try_index), 732 try_index_(try_index),
705 function_(function), 733 function_(function),
706 argument_names_(argument_names), 734 argument_names_(argument_names),
707 arguments_(arguments) { 735 arguments_(arguments),
736 recognized_(MethodRecognizer::kUnknown) {
708 ASSERT(function.IsZoneHandle()); 737 ASSERT(function.IsZoneHandle());
709 ASSERT(argument_names.IsZoneHandle()); 738 ASSERT(argument_names.IsZoneHandle());
710 } 739 }
711 740
712 DECLARE_COMPUTATION(StaticCall) 741 DECLARE_COMPUTATION(StaticCall)
713 742
714 // Accessors forwarded to the AST node. 743 // Accessors forwarded to the AST node.
715 const Function& function() const { return function_; } 744 const Function& function() const { return function_; }
716 const Array& argument_names() const { return argument_names_; } 745 const Array& argument_names() const { return argument_names_; }
717 intptr_t token_index() const { return token_index_; } 746 intptr_t token_index() const { return token_index_; }
718 intptr_t try_index() const { return try_index_; } 747 intptr_t try_index() const { return try_index_; }
719 748
720 intptr_t ArgumentCount() const { return arguments_->length(); } 749 intptr_t ArgumentCount() const { return arguments_->length(); }
721 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 750 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
722 751
752 MethodRecognizer::Kind recognized() const { return recognized_; }
753 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; }
754
723 virtual intptr_t InputCount() const; 755 virtual intptr_t InputCount() const;
724 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } 756 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
725 757
726 virtual void PrintOperandsTo(BufferFormatter* f) const; 758 virtual void PrintOperandsTo(BufferFormatter* f) const;
727 759
728 private: 760 private:
729 const intptr_t token_index_; 761 const intptr_t token_index_;
730 const intptr_t try_index_; 762 const intptr_t try_index_;
731 const Function& function_; 763 const Function& function_;
732 const Array& argument_names_; 764 const Array& argument_names_;
733 ZoneGrowableArray<Value*>* arguments_; 765 ZoneGrowableArray<Value*>* arguments_;
766 MethodRecognizer::Kind recognized_;
734 767
735 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); 768 DISALLOW_COPY_AND_ASSIGN(StaticCallComp);
736 }; 769 };
737 770
738 771
739 class LoadLocalComp : public TemplateComputation<0> { 772 class LoadLocalComp : public TemplateComputation<0> {
740 public: 773 public:
741 LoadLocalComp(const LocalVariable& local, intptr_t context_level) 774 LoadLocalComp(const LocalVariable& local, intptr_t context_level)
742 : local_(local), 775 : local_(local),
743 context_level_(context_level) { } 776 context_level_(context_level) { }
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 const GrowableArray<BlockEntryInstr*>& block_order_; 2420 const GrowableArray<BlockEntryInstr*>& block_order_;
2388 2421
2389 private: 2422 private:
2390 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2423 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2391 }; 2424 };
2392 2425
2393 2426
2394 } // namespace dart 2427 } // namespace dart
2395 2428
2396 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2429 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698