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

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

Issue 10915022: Implement argument definition test in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class FlowGraphCompiler; 47 class FlowGraphCompiler;
48 class FlowGraphVisitor; 48 class FlowGraphVisitor;
49 class Function; 49 class Function;
50 class LocalVariable; 50 class LocalVariable;
51 51
52 // M is a two argument macro. It is applied to each concrete instruction's 52 // M is a two argument macro. It is applied to each concrete instruction's
53 // (including the values) typename and classname. 53 // (including the values) typename and classname.
54 #define FOR_EACH_COMPUTATION(M) \ 54 #define FOR_EACH_COMPUTATION(M) \
55 M(AssertAssignable, AssertAssignableComp) \ 55 M(AssertAssignable, AssertAssignableComp) \
56 M(AssertBoolean, AssertBooleanComp) \ 56 M(AssertBoolean, AssertBooleanComp) \
57 M(ArgumentDefinitionTest, ArgumentDefinitionTestComp) \
57 M(CurrentContext, CurrentContextComp) \ 58 M(CurrentContext, CurrentContextComp) \
58 M(StoreContext, StoreContextComp) \ 59 M(StoreContext, StoreContextComp) \
59 M(ClosureCall, ClosureCallComp) \ 60 M(ClosureCall, ClosureCallComp) \
60 M(InstanceCall, InstanceCallComp) \ 61 M(InstanceCall, InstanceCallComp) \
61 M(PolymorphicInstanceCall, PolymorphicInstanceCallComp) \ 62 M(PolymorphicInstanceCall, PolymorphicInstanceCallComp) \
62 M(StaticCall, StaticCallComp) \ 63 M(StaticCall, StaticCallComp) \
63 M(LoadLocal, LoadLocalComp) \ 64 M(LoadLocal, LoadLocalComp) \
64 M(StoreLocal, StoreLocalComp) \ 65 M(StoreLocal, StoreLocalComp) \
65 M(StrictCompare, StrictCompareComp) \ 66 M(StrictCompare, StrictCompareComp) \
66 M(EqualityCompare, EqualityCompareComp) \ 67 M(EqualityCompare, EqualityCompareComp) \
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 virtual intptr_t ResultCid() const { return kBoolCid; } 544 virtual intptr_t ResultCid() const { return kBoolCid; }
544 545
545 private: 546 private:
546 const intptr_t token_pos_; 547 const intptr_t token_pos_;
547 bool is_eliminated_; 548 bool is_eliminated_;
548 549
549 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); 550 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp);
550 }; 551 };
551 552
552 553
554 class ArgumentDefinitionTestComp : public TemplateComputation<1> {
555 public:
556 ArgumentDefinitionTestComp(ArgumentDefinitionTestNode* node,
557 Value* saved_arguments_descriptor)
558 : ast_node_(*node) {
559 ASSERT(saved_arguments_descriptor != NULL);
560 inputs_[0] = saved_arguments_descriptor;
561 }
562
563 DECLARE_COMPUTATION(ArgumentDefinitionTest)
564
565 intptr_t token_pos() const { return ast_node_.token_pos(); }
566 intptr_t formal_parameter_index() const {
567 return ast_node_.formal_parameter_index();
568 }
569 const String& formal_parameter_name() const {
570 return ast_node_.formal_parameter_name();
571 }
572 Value* saved_arguments_descriptor() const { return inputs_[0]; }
573
574 virtual void PrintOperandsTo(BufferFormatter* f) const;
575
576 virtual bool CanDeoptimize() const { return true; }
577 virtual intptr_t ResultCid() const { return kBoolCid; }
578
579 private:
580 const ArgumentDefinitionTestNode& ast_node_;
581
582 DISALLOW_COPY_AND_ASSIGN(ArgumentDefinitionTestComp);
583 };
584
585
553 // Denotes the current context, normally held in a register. This is 586 // Denotes the current context, normally held in a register. This is
554 // a computation, not a value, because it's mutable. 587 // a computation, not a value, because it's mutable.
555 class CurrentContextComp : public TemplateComputation<0> { 588 class CurrentContextComp : public TemplateComputation<0> {
556 public: 589 public:
557 CurrentContextComp() { } 590 CurrentContextComp() { }
558 591
559 DECLARE_COMPUTATION(CurrentContext) 592 DECLARE_COMPUTATION(CurrentContext)
560 593
561 virtual bool CanDeoptimize() const { return false; } 594 virtual bool CanDeoptimize() const { return false; }
562 virtual intptr_t ResultCid() const { return kDynamicCid; } 595 virtual intptr_t ResultCid() const { return kDynamicCid; }
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3304 ForwardInstructionIterator* current_iterator_; 3337 ForwardInstructionIterator* current_iterator_;
3305 3338
3306 private: 3339 private:
3307 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 3340 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
3308 }; 3341 };
3309 3342
3310 3343
3311 } // namespace dart 3344 } // namespace dart
3312 3345
3313 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 3346 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698