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

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
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 LocalVariable; 47 class LocalVariable;
20 class LocationSummary; 48 class LocationSummary;
21 49
22 // M is a two argument macro. It is applied to each concrete value's 50 // M is a two argument macro. It is applied to each concrete value's
23 // typename and classname. 51 // typename and classname.
24 #define FOR_EACH_VALUE(M) \ 52 #define FOR_EACH_VALUE(M) \
25 M(Use, UseVal) \ 53 M(Use, UseVal) \
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 public: 708 public:
681 StaticCallComp(intptr_t token_index, 709 StaticCallComp(intptr_t token_index,
682 intptr_t try_index, 710 intptr_t try_index,
683 const Function& function, 711 const Function& function,
684 const Array& argument_names, 712 const Array& argument_names,
685 ZoneGrowableArray<Value*>* arguments) 713 ZoneGrowableArray<Value*>* arguments)
686 : token_index_(token_index), 714 : token_index_(token_index),
687 try_index_(try_index), 715 try_index_(try_index),
688 function_(function), 716 function_(function),
689 argument_names_(argument_names), 717 argument_names_(argument_names),
690 arguments_(arguments) { 718 arguments_(arguments),
719 recognized_(MethodRecognizer::kUnknown) {
691 ASSERT(function.IsZoneHandle()); 720 ASSERT(function.IsZoneHandle());
692 ASSERT(argument_names.IsZoneHandle()); 721 ASSERT(argument_names.IsZoneHandle());
693 } 722 }
694 723
695 DECLARE_COMPUTATION(StaticCall) 724 DECLARE_COMPUTATION(StaticCall)
696 725
697 // Accessors forwarded to the AST node. 726 // Accessors forwarded to the AST node.
698 const Function& function() const { return function_; } 727 const Function& function() const { return function_; }
699 const Array& argument_names() const { return argument_names_; } 728 const Array& argument_names() const { return argument_names_; }
700 intptr_t token_index() const { return token_index_; } 729 intptr_t token_index() const { return token_index_; }
701 intptr_t try_index() const { return try_index_; } 730 intptr_t try_index() const { return try_index_; }
702 731
703 intptr_t ArgumentCount() const { return arguments_->length(); } 732 intptr_t ArgumentCount() const { return arguments_->length(); }
704 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 733 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
705 734
735 MethodRecognizer::Kind recognized() const { return recognized_; }
736 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; }
737
706 virtual intptr_t InputCount() const; 738 virtual intptr_t InputCount() const;
707 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } 739 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
708 740
709 virtual void PrintOperandsTo(BufferFormatter* f) const; 741 virtual void PrintOperandsTo(BufferFormatter* f) const;
710 742
711 private: 743 private:
712 const intptr_t token_index_; 744 const intptr_t token_index_;
713 const intptr_t try_index_; 745 const intptr_t try_index_;
714 const Function& function_; 746 const Function& function_;
715 const Array& argument_names_; 747 const Array& argument_names_;
716 ZoneGrowableArray<Value*>* arguments_; 748 ZoneGrowableArray<Value*>* arguments_;
749 MethodRecognizer::Kind recognized_;
717 750
718 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); 751 DISALLOW_COPY_AND_ASSIGN(StaticCallComp);
719 }; 752 };
720 753
721 754
722 class LoadLocalComp : public TemplateComputation<0> { 755 class LoadLocalComp : public TemplateComputation<0> {
723 public: 756 public:
724 LoadLocalComp(const LocalVariable& local, intptr_t context_level) 757 LoadLocalComp(const LocalVariable& local, intptr_t context_level)
725 : local_(local), 758 : local_(local),
726 context_level_(context_level) { } 759 context_level_(context_level) { }
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 const GrowableArray<BlockEntryInstr*>& block_order_; 2403 const GrowableArray<BlockEntryInstr*>& block_order_;
2371 2404
2372 private: 2405 private:
2373 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2406 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2374 }; 2407 };
2375 2408
2376 2409
2377 } // namespace dart 2410 } // namespace dart
2378 2411
2379 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2412 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698