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

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

Issue 27192005: Add new style of string interpolation optimization: new nodes, working constant folding. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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_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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 static CompileType Dynamic(); 295 static CompileType Dynamic();
296 296
297 static CompileType Null(); 297 static CompileType Null();
298 298
299 // Create non-nullable Bool type. 299 // Create non-nullable Bool type.
300 static CompileType Bool(); 300 static CompileType Bool();
301 301
302 // Create non-nullable Int type. 302 // Create non-nullable Int type.
303 static CompileType Int(); 303 static CompileType Int();
304 304
305 // Create non-nullable String type.
306 static CompileType String();
307
305 // Perform a join operation over the type lattice. 308 // Perform a join operation over the type lattice.
306 void Union(CompileType* other); 309 void Union(CompileType* other);
307 310
308 // Returns true if this and other types are the same. 311 // Returns true if this and other types are the same.
309 bool IsEqualTo(CompileType* other) { 312 bool IsEqualTo(CompileType* other) {
310 return (is_nullable_ == other->is_nullable_) && 313 return (is_nullable_ == other->is_nullable_) &&
311 (ToNullableCid() == other->ToNullableCid()) && 314 (ToNullableCid() == other->ToNullableCid()) &&
312 (ToAbstractType()->Equals(*other->ToAbstractType())); 315 (ToAbstractType()->Equals(*other->ToAbstractType()));
313 } 316 }
314 317
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 M(BoxUint32x4) \ 646 M(BoxUint32x4) \
644 M(UnboxUint32x4) \ 647 M(UnboxUint32x4) \
645 M(UnboxInteger) \ 648 M(UnboxInteger) \
646 M(BoxInteger) \ 649 M(BoxInteger) \
647 M(BinaryMintOp) \ 650 M(BinaryMintOp) \
648 M(ShiftMintOp) \ 651 M(ShiftMintOp) \
649 M(UnaryMintOp) \ 652 M(UnaryMintOp) \
650 M(CheckArrayBound) \ 653 M(CheckArrayBound) \
651 M(Constraint) \ 654 M(Constraint) \
652 M(StringFromCharCode) \ 655 M(StringFromCharCode) \
656 M(StringInterpolate) \
653 M(InvokeMathCFunction) \ 657 M(InvokeMathCFunction) \
654 M(GuardField) \ 658 M(GuardField) \
655 M(IfThenElse) \ 659 M(IfThenElse) \
656 M(BinaryFloat32x4Op) \ 660 M(BinaryFloat32x4Op) \
657 M(Float32x4Shuffle) \ 661 M(Float32x4Shuffle) \
658 M(Simd32x4GetSignMask) \ 662 M(Simd32x4GetSignMask) \
659 M(Float32x4Constructor) \ 663 M(Float32x4Constructor) \
660 M(Float32x4Zero) \ 664 M(Float32x4Zero) \
661 M(Float32x4Splat) \ 665 M(Float32x4Splat) \
662 M(Float32x4Comparison) \ 666 M(Float32x4Comparison) \
(...skipping 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after
3642 3646
3643 virtual bool MayThrow() const { return false; } 3647 virtual bool MayThrow() const { return false; }
3644 3648
3645 private: 3649 private:
3646 const intptr_t cid_; 3650 const intptr_t cid_;
3647 3651
3648 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr); 3652 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr);
3649 }; 3653 };
3650 3654
3651 3655
3656 class StringInterpolateInstr : public TemplateDefinition<1> {
3657 public:
3658 StringInterpolateInstr(Value* value, intptr_t token_pos)
3659 : token_pos_(token_pos), function_(Function::Handle()) {
3660 SetInputAt(0, value);
3661 }
3662
3663 Value* value() const { return inputs_[0]; }
3664 intptr_t token_pos() const { return token_pos_; }
3665
3666 virtual CompileType ComputeType() const;
3667 // Issues a static call to Dart code whihc calls toString on objects.
3668 virtual EffectSet Effects() const { return EffectSet::All(); }
3669 virtual bool CanDeoptimize() const { return true; }
3670 virtual bool MayThrow() const { return true; }
3671
3672 const Function& CallFunction() const;
3673
3674 DECLARE_INSTRUCTION(StringInterpolate)
3675
3676 private:
3677 const intptr_t token_pos_;
3678 Function& function_;
3679
3680 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr);
3681 };
3682
3683
3652 class StoreIndexedInstr : public TemplateDefinition<3> { 3684 class StoreIndexedInstr : public TemplateDefinition<3> {
3653 public: 3685 public:
3654 StoreIndexedInstr(Value* array, 3686 StoreIndexedInstr(Value* array,
3655 Value* index, 3687 Value* index,
3656 Value* value, 3688 Value* value,
3657 StoreBarrierType emit_store_barrier, 3689 StoreBarrierType emit_store_barrier,
3658 intptr_t index_scale, 3690 intptr_t index_scale,
3659 intptr_t class_id, 3691 intptr_t class_id,
3660 intptr_t deopt_id) 3692 intptr_t deopt_id)
3661 : emit_store_barrier_(emit_store_barrier), 3693 : emit_store_barrier_(emit_store_barrier),
(...skipping 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after
6822 ForwardInstructionIterator* current_iterator_; 6854 ForwardInstructionIterator* current_iterator_;
6823 6855
6824 private: 6856 private:
6825 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6857 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6826 }; 6858 };
6827 6859
6828 6860
6829 } // namespace dart 6861 } // namespace dart
6830 6862
6831 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6863 #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