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

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

Issue 10545186: Improve equality operation (inline, direct calls). (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 class BitVector; 16 class BitVector;
17 class FlowGraphCompiler; 17 class FlowGraphCompiler;
18 class FlowGraphVisitor; 18 class FlowGraphVisitor;
19 class Function;
19 class LocalVariable; 20 class LocalVariable;
20 class LocationSummary; 21 class LocationSummary;
21 22
22 // M is a two argument macro. It is applied to each concrete value's 23 // M is a two argument macro. It is applied to each concrete value's
23 // typename and classname. 24 // typename and classname.
24 #define FOR_EACH_VALUE(M) \ 25 #define FOR_EACH_VALUE(M) \
25 M(Use, UseVal) \ 26 M(Use, UseVal) \
26 M(Constant, ConstantVal) \ 27 M(Constant, ConstantVal) \
27 28
28 29
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 606
606 class EqualityCompareComp : public ComparisonComp { 607 class EqualityCompareComp : public ComparisonComp {
607 public: 608 public:
608 EqualityCompareComp(intptr_t token_index, 609 EqualityCompareComp(intptr_t token_index,
609 intptr_t try_index, 610 intptr_t try_index,
610 Value* left, 611 Value* left,
611 Value* right) 612 Value* right)
612 : ComparisonComp(left, right), 613 : ComparisonComp(left, right),
613 token_index_(token_index), 614 token_index_(token_index),
614 try_index_(try_index), 615 try_index_(try_index),
615 operands_class_id_(kObject) { 616 class_ids_(NULL),
617 targets_(NULL) {
616 } 618 }
617 619
618 DECLARE_COMPUTATION(EqualityCompare) 620 DECLARE_COMPUTATION(EqualityCompare)
619 621
620 intptr_t token_index() const { return token_index_; } 622 intptr_t token_index() const { return token_index_; }
621 intptr_t try_index() const { return try_index_; } 623 intptr_t try_index() const { return try_index_; }
622 void set_operands_class_id(intptr_t value) { 624 void SetPolymorphicTargets(ZoneGrowableArray<intptr_t>* class_ids,
623 operands_class_id_ = value; 625 ZoneGrowableArray<Function*>* targets) {
626 class_ids_ = class_ids;
627 targets_ = targets;
628 ASSERT(targets_ != NULL);
629 ASSERT(class_ids_ != NULL);
624 } 630 }
625 intptr_t operands_class_id() const { return operands_class_id_; } 631 intptr_t NumTargets() const {
632 return class_ids_ == NULL ? 0 : class_ids_->length();
633 }
634 Function* TargetAt(intptr_t ix) const { return (*targets_)[ix]; }
635 intptr_t ClassIdAt(intptr_t ix) const { return (*class_ids_)[ix]; }
626 636
627 virtual void PrintOperandsTo(BufferFormatter* f) const; 637 virtual void PrintOperandsTo(BufferFormatter* f) const;
628 638
629 private: 639 private:
630 const intptr_t token_index_; 640 const intptr_t token_index_;
631 const intptr_t try_index_; 641 const intptr_t try_index_;
632 intptr_t operands_class_id_; // class id of both operands. 642 ZoneGrowableArray<intptr_t>* class_ids_;
643 ZoneGrowableArray<Function*>* targets_;
633 644
634 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); 645 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp);
635 }; 646 };
636 647
637 648
638 class RelationalOpComp : public ComparisonComp { 649 class RelationalOpComp : public ComparisonComp {
639 public: 650 public:
640 RelationalOpComp(intptr_t token_index, 651 RelationalOpComp(intptr_t token_index,
641 intptr_t try_index, 652 intptr_t try_index,
642 Token::Kind kind, 653 Token::Kind kind,
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 const GrowableArray<BlockEntryInstr*>& block_order_; 2381 const GrowableArray<BlockEntryInstr*>& block_order_;
2371 2382
2372 private: 2383 private:
2373 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2384 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2374 }; 2385 };
2375 2386
2376 2387
2377 } // namespace dart 2388 } // namespace dart
2378 2389
2379 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2390 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698