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

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

Issue 9615025: Implement '==', '!=' and instanceof (without code generation). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 17 matching lines...) Expand all
28 // | LoadLocal <LocalVariable> 28 // | LoadLocal <LocalVariable>
29 // | StoreLocal <LocalVariable> <Value> 29 // | StoreLocal <LocalVariable> <Value>
30 // | StrictCompare <Token::kind> <Value> <Value> 30 // | StrictCompare <Token::kind> <Value> <Value>
31 // | NativeCall <NativeBodyNode> 31 // | NativeCall <NativeBodyNode>
32 // | StoreIndexed <StoreIndexedNode> <Value> <Value> <Value> 32 // | StoreIndexed <StoreIndexedNode> <Value> <Value> <Value>
33 // | InstanceSetter <InstanceSetterNode> <Value> <Value> 33 // | InstanceSetter <InstanceSetterNode> <Value> <Value>
34 // | LoadInstanceField <LoadInstanceFieldNode> <Value> 34 // | LoadInstanceField <LoadInstanceFieldNode> <Value>
35 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value> 35 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value>
36 // | LoadStaticField <Field> 36 // | LoadStaticField <Field>
37 // | StoreStaticField <StoreStaticFieldNode> <Value> 37 // | StoreStaticField <StoreStaticFieldNode> <Value>
38 // | BooleanNegate <Value>
39 // | InstanceOf <Value> <Type>
38 // 40 //
39 // <Value> ::= 41 // <Value> ::=
40 // Temp <int> 42 // Temp <int>
41 // | Constant <Instance> 43 // | Constant <Instance>
42 44
43 // M is a two argument macro. It is applied to each concrete value's 45 // M is a two argument macro. It is applied to each concrete value's
44 // typename and classname. 46 // typename and classname.
45 #define FOR_EACH_VALUE(M) \ 47 #define FOR_EACH_VALUE(M) \
46 M(Temp, TempVal) \ 48 M(Temp, TempVal) \
47 M(Constant, ConstantVal) \ 49 M(Constant, ConstantVal) \
(...skipping 10 matching lines...) Expand all
58 M(StaticCall, StaticCallComp) \ 60 M(StaticCall, StaticCallComp) \
59 M(LoadLocal, LoadLocalComp) \ 61 M(LoadLocal, LoadLocalComp) \
60 M(StoreLocal, StoreLocalComp) \ 62 M(StoreLocal, StoreLocalComp) \
61 M(StrictCompare, StrictCompareComp) \ 63 M(StrictCompare, StrictCompareComp) \
62 M(NativeCall, NativeCallComp) \ 64 M(NativeCall, NativeCallComp) \
63 M(StoreIndexed, StoreIndexedComp) \ 65 M(StoreIndexed, StoreIndexedComp) \
64 M(InstanceSetter, InstanceSetterComp) \ 66 M(InstanceSetter, InstanceSetterComp) \
65 M(LoadInstanceField, LoadInstanceFieldComp) \ 67 M(LoadInstanceField, LoadInstanceFieldComp) \
66 M(StoreInstanceField, StoreInstanceFieldComp) \ 68 M(StoreInstanceField, StoreInstanceFieldComp) \
67 M(LoadStaticField, LoadStaticFieldComp) \ 69 M(LoadStaticField, LoadStaticFieldComp) \
68 M(StoreStaticField, StoreStaticFieldComp) 70 M(StoreStaticField, StoreStaticFieldComp) \
71 M(BooleanNegate, BooleanNegateComp) \
72 M(InstanceOf, InstanceOfComp)
69 73
70 74
71 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; 75 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
72 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) 76 FOR_EACH_COMPUTATION(FORWARD_DECLARATION)
73 #undef FORWARD_DECLARATION 77 #undef FORWARD_DECLARATION
74 78
75 class Computation : public ZoneAllocated { 79 class Computation : public ZoneAllocated {
76 public: 80 public:
77 Computation() { } 81 Computation() { }
78 82
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 484
481 private: 485 private:
482 const InstanceSetterNode& ast_node_; 486 const InstanceSetterNode& ast_node_;
483 Value* receiver_; 487 Value* receiver_;
484 Value* value_; 488 Value* value_;
485 489
486 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp); 490 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp);
487 }; 491 };
488 492
489 493
494 // Note overrideable, built-in: value? false : true.
495 class BooleanNegateComp : public Computation {
496 public:
497 explicit BooleanNegateComp(Value* value) : value_(value) {}
498
499 DECLARE_COMPUTATION(BooleanNegateComp)
500
501 Value* value() const { return value_; }
502
503 private:
504 Value* value_;
505
506 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp);
507 };
508
509
510 class InstanceOfComp : public Computation {
511 public:
512 InstanceOfComp(intptr_t node_id,
513 intptr_t token_index,
514 Value* value,
515 const AbstractType& type,
516 bool negate_result)
517 : node_id_(node_id),
518 token_index_(token_index),
519 value_(value),
520 type_(type),
521 negate_result_(negate_result) {}
522
523 DECLARE_COMPUTATION(InstanceOfComp)
524
525 Value* value() const { return value_; }
526 bool negate_result() const { return negate_result_; }
527 const AbstractType& type() const { return type_; }
528
529 private:
530 const intptr_t node_id_;
531 const intptr_t token_index_;
532 Value* value_;
533 const AbstractType& type_;
534 const bool negate_result_;
535
536 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp);
537 };
538
539
490 #undef DECLARE_COMPUTATION 540 #undef DECLARE_COMPUTATION
491 541
492 542
493 // Instructions. 543 // Instructions.
494 // 544 //
495 // <Instruction> ::= Do <Computation> <Instruction> 545 // <Instruction> ::= Do <Computation> <Instruction>
496 // | Bind <int> <Computation> <Instruction> 546 // | Bind <int> <Computation> <Instruction>
497 // | Return <Value> 547 // | Return <Value>
498 // | Branch <Value> <Instruction> <Instruction> 548 // | Branch <Value> <Instruction> <Instruction>
499 // | Empty <Instruction> 549 // | Empty <Instruction>
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 #undef DECLARE_VISIT_INSTRUCTION 808 #undef DECLARE_VISIT_INSTRUCTION
759 809
760 private: 810 private:
761 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 811 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
762 }; 812 };
763 813
764 814
765 } // namespace dart 815 } // namespace dart
766 816
767 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 817 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« runtime/vm/flow_graph_compiler_x64.cc ('K') | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698