Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 bool is_eliminated() const { | 495 bool is_eliminated() const { |
| 496 return is_eliminated_; | 496 return is_eliminated_; |
| 497 } | 497 } |
| 498 void eliminate() { | 498 void eliminate() { |
| 499 ASSERT(!is_eliminated_); | 499 ASSERT(!is_eliminated_); |
| 500 is_eliminated_ = true; | 500 is_eliminated_ = true; |
| 501 } | 501 } |
| 502 | 502 |
| 503 virtual void PrintOperandsTo(BufferFormatter* f) const; | 503 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 504 | 504 |
| 505 virtual bool CanDeoptimize() const { return true; } | 505 virtual bool CanDeoptimize() const { return false; } |
| 506 virtual intptr_t ResultCid() const { return kDynamicCid; } | 506 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 507 | 507 |
| 508 private: | 508 private: |
| 509 const intptr_t token_pos_; | 509 const intptr_t token_pos_; |
| 510 const AbstractType& dst_type_; | 510 const AbstractType& dst_type_; |
| 511 const String& dst_name_; | 511 const String& dst_name_; |
| 512 bool is_eliminated_; | 512 bool is_eliminated_; |
| 513 | 513 |
| 514 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); | 514 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); |
| 515 }; | 515 }; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 533 bool is_eliminated() const { | 533 bool is_eliminated() const { |
| 534 return is_eliminated_; | 534 return is_eliminated_; |
| 535 } | 535 } |
| 536 void eliminate() { | 536 void eliminate() { |
| 537 ASSERT(!is_eliminated_); | 537 ASSERT(!is_eliminated_); |
| 538 is_eliminated_ = true; | 538 is_eliminated_ = true; |
| 539 } | 539 } |
| 540 | 540 |
| 541 virtual void PrintOperandsTo(BufferFormatter* f) const; | 541 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 542 | 542 |
| 543 virtual bool CanDeoptimize() const { return true; } | 543 virtual bool CanDeoptimize() const { return false; } |
| 544 virtual intptr_t ResultCid() const { return kBoolCid; } | 544 virtual intptr_t ResultCid() const { return kBoolCid; } |
| 545 | 545 |
| 546 private: | 546 private: |
| 547 const intptr_t token_pos_; | 547 const intptr_t token_pos_; |
| 548 bool is_eliminated_; | 548 bool is_eliminated_; |
| 549 | 549 |
| 550 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); | 550 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); |
| 551 }; | 551 }; |
| 552 | 552 |
| 553 | 553 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 566 intptr_t formal_parameter_index() const { | 566 intptr_t formal_parameter_index() const { |
| 567 return ast_node_.formal_parameter_index(); | 567 return ast_node_.formal_parameter_index(); |
| 568 } | 568 } |
| 569 const String& formal_parameter_name() const { | 569 const String& formal_parameter_name() const { |
| 570 return ast_node_.formal_parameter_name(); | 570 return ast_node_.formal_parameter_name(); |
| 571 } | 571 } |
| 572 Value* saved_arguments_descriptor() const { return inputs_[0]; } | 572 Value* saved_arguments_descriptor() const { return inputs_[0]; } |
| 573 | 573 |
| 574 virtual void PrintOperandsTo(BufferFormatter* f) const; | 574 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 575 | 575 |
| 576 virtual bool CanDeoptimize() const { return true; } | 576 virtual bool CanDeoptimize() const { return false; } |
| 577 virtual intptr_t ResultCid() const { return kBoolCid; } | 577 virtual intptr_t ResultCid() const { return kBoolCid; } |
| 578 | 578 |
| 579 private: | 579 private: |
| 580 const ArgumentDefinitionTestNode& ast_node_; | 580 const ArgumentDefinitionTestNode& ast_node_; |
| 581 | 581 |
| 582 DISALLOW_COPY_AND_ASSIGN(ArgumentDefinitionTestComp); | 582 DISALLOW_COPY_AND_ASSIGN(ArgumentDefinitionTestComp); |
| 583 }; | 583 }; |
| 584 | 584 |
| 585 | 585 |
| 586 // Denotes the current context, normally held in a register. This is | 586 // Denotes the current context, normally held in a register. This is |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1228 Value* value() const { return inputs_[0]; } | 1228 Value* value() const { return inputs_[0]; } |
| 1229 Value* instantiator() const { return inputs_[1]; } | 1229 Value* instantiator() const { return inputs_[1]; } |
| 1230 Value* instantiator_type_arguments() const { return inputs_[2]; } | 1230 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 1231 | 1231 |
| 1232 bool negate_result() const { return negate_result_; } | 1232 bool negate_result() const { return negate_result_; } |
| 1233 const AbstractType& type() const { return type_; } | 1233 const AbstractType& type() const { return type_; } |
| 1234 intptr_t token_pos() const { return token_pos_; } | 1234 intptr_t token_pos() const { return token_pos_; } |
| 1235 | 1235 |
| 1236 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1236 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1237 | 1237 |
| 1238 virtual bool CanDeoptimize() const { return true; } | 1238 virtual bool CanDeoptimize() const { return false; } |
| 1239 virtual intptr_t ResultCid() const { return kBoolCid; } | 1239 virtual intptr_t ResultCid() const { return kBoolCid; } |
| 1240 | 1240 |
| 1241 private: | 1241 private: |
| 1242 const intptr_t token_pos_; | 1242 const intptr_t token_pos_; |
| 1243 Value* value_; | 1243 Value* value_; |
| 1244 Value* instantiator_; | 1244 Value* instantiator_; |
| 1245 Value* type_arguments_; | 1245 Value* type_arguments_; |
| 1246 const AbstractType& type_; | 1246 const AbstractType& type_; |
| 1247 const bool negate_result_; | 1247 const bool negate_result_; |
| 1248 | 1248 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1294 inputs_[1] = instantiator; | 1294 inputs_[1] = instantiator; |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck) | 1297 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck) |
| 1298 | 1298 |
| 1299 const Function& constructor() const { return ast_node_.constructor(); } | 1299 const Function& constructor() const { return ast_node_.constructor(); } |
| 1300 intptr_t token_pos() const { return ast_node_.token_pos(); } | 1300 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1301 | 1301 |
| 1302 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1302 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1303 | 1303 |
| 1304 virtual bool CanDeoptimize() const { return true; } | 1304 virtual bool CanDeoptimize() const { return false; } |
| 1305 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1305 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1306 | 1306 |
| 1307 private: | 1307 private: |
| 1308 const ConstructorCallNode& ast_node_; | 1308 const ConstructorCallNode& ast_node_; |
| 1309 | 1309 |
| 1310 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); | 1310 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); |
| 1311 }; | 1311 }; |
| 1312 | 1312 |
| 1313 | 1313 |
| 1314 class CreateArrayComp : public TemplateComputation<1> { | 1314 class CreateArrayComp : public TemplateComputation<1> { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1468 DECLARE_COMPUTATION(InstantiateTypeArguments) | 1468 DECLARE_COMPUTATION(InstantiateTypeArguments) |
| 1469 | 1469 |
| 1470 Value* instantiator() const { return inputs_[0]; } | 1470 Value* instantiator() const { return inputs_[0]; } |
| 1471 const AbstractTypeArguments& type_arguments() const { | 1471 const AbstractTypeArguments& type_arguments() const { |
| 1472 return type_arguments_; | 1472 return type_arguments_; |
| 1473 } | 1473 } |
| 1474 intptr_t token_pos() const { return token_pos_; } | 1474 intptr_t token_pos() const { return token_pos_; } |
| 1475 | 1475 |
| 1476 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1476 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1477 | 1477 |
| 1478 virtual bool CanDeoptimize() const { return true; } | 1478 virtual bool CanDeoptimize() const { return false; } |
| 1479 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1479 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1480 | 1480 |
| 1481 private: | 1481 private: |
| 1482 const intptr_t token_pos_; | 1482 const intptr_t token_pos_; |
| 1483 const AbstractTypeArguments& type_arguments_; | 1483 const AbstractTypeArguments& type_arguments_; |
| 1484 | 1484 |
| 1485 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp); | 1485 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp); |
| 1486 }; | 1486 }; |
| 1487 | 1487 |
| 1488 | 1488 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1598 : token_pos_(token_pos) { | 1598 : token_pos_(token_pos) { |
| 1599 ASSERT(context_value != NULL); | 1599 ASSERT(context_value != NULL); |
| 1600 inputs_[0] = context_value; | 1600 inputs_[0] = context_value; |
| 1601 } | 1601 } |
| 1602 | 1602 |
| 1603 intptr_t token_pos() const { return token_pos_; } | 1603 intptr_t token_pos() const { return token_pos_; } |
| 1604 Value* context_value() const { return inputs_[0]; } | 1604 Value* context_value() const { return inputs_[0]; } |
| 1605 | 1605 |
| 1606 DECLARE_COMPUTATION(CloneContext) | 1606 DECLARE_COMPUTATION(CloneContext) |
| 1607 | 1607 |
| 1608 virtual bool CanDeoptimize() const { return true; } | 1608 virtual bool CanDeoptimize() const { return false; } |
| 1609 virtual intptr_t ResultCid() const { return kIllegalCid; } | 1609 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 1610 | 1610 |
| 1611 private: | 1611 private: |
| 1612 const intptr_t token_pos_; | 1612 const intptr_t token_pos_; |
| 1613 | 1613 |
| 1614 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); | 1614 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); |
| 1615 }; | 1615 }; |
| 1616 | 1616 |
| 1617 | 1617 |
| 1618 class CatchEntryComp : public TemplateComputation<0> { | 1618 class CatchEntryComp : public TemplateComputation<0> { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1949 | 1949 |
| 1950 class CheckStackOverflowComp : public TemplateComputation<0> { | 1950 class CheckStackOverflowComp : public TemplateComputation<0> { |
| 1951 public: | 1951 public: |
| 1952 explicit CheckStackOverflowComp(intptr_t token_pos) | 1952 explicit CheckStackOverflowComp(intptr_t token_pos) |
| 1953 : token_pos_(token_pos) {} | 1953 : token_pos_(token_pos) {} |
| 1954 | 1954 |
| 1955 intptr_t token_pos() const { return token_pos_; } | 1955 intptr_t token_pos() const { return token_pos_; } |
| 1956 | 1956 |
| 1957 DECLARE_COMPUTATION(CheckStackOverflow) | 1957 DECLARE_COMPUTATION(CheckStackOverflow) |
| 1958 | 1958 |
| 1959 virtual bool CanDeoptimize() const { return true; } | 1959 virtual bool CanDeoptimize() const { return false; } |
| 1960 virtual intptr_t ResultCid() const { return kIllegalCid; } | 1960 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 1961 | 1961 |
| 1962 private: | 1962 private: |
| 1963 const intptr_t token_pos_; | 1963 const intptr_t token_pos_; |
| 1964 | 1964 |
| 1965 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); | 1965 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); |
| 1966 }; | 1966 }; |
| 1967 | 1967 |
| 1968 | 1968 |
| 1969 class DoubleToDoubleComp : public TemplateComputation<1> { | 1969 class DoubleToDoubleComp : public TemplateComputation<1> { |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3058 const intptr_t deopt_id_; | 3058 const intptr_t deopt_id_; |
| 3059 const intptr_t token_pos_; | 3059 const intptr_t token_pos_; |
| 3060 | 3060 |
| 3061 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 3061 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 3062 }; | 3062 }; |
| 3063 | 3063 |
| 3064 | 3064 |
| 3065 class ThrowInstr : public TemplateInstruction<0> { | 3065 class ThrowInstr : public TemplateInstruction<0> { |
| 3066 public: | 3066 public: |
| 3067 explicit ThrowInstr(intptr_t token_pos) | 3067 explicit ThrowInstr(intptr_t token_pos) |
| 3068 : deopt_id_(Isolate::Current()->GetNextDeoptId()), | 3068 : token_pos_(token_pos) { } |
|
regis
2012/08/31 01:20:41
one line?
srdjan
2012/08/31 15:24:01
Done.
| |
| 3069 token_pos_(token_pos) { } | |
| 3070 | 3069 |
| 3071 DECLARE_INSTRUCTION(Throw) | 3070 DECLARE_INSTRUCTION(Throw) |
| 3072 | 3071 |
| 3073 virtual intptr_t ArgumentCount() const { return 1; } | 3072 virtual intptr_t ArgumentCount() const { return 1; } |
| 3074 | 3073 |
| 3075 intptr_t deopt_id() const { return deopt_id_; } | |
| 3076 intptr_t token_pos() const { return token_pos_; } | 3074 intptr_t token_pos() const { return token_pos_; } |
| 3077 | 3075 |
| 3078 virtual LocationSummary* MakeLocationSummary() const; | 3076 virtual LocationSummary* MakeLocationSummary() const; |
| 3079 | 3077 |
| 3080 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 3078 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 3081 | 3079 |
| 3082 virtual bool CanDeoptimize() const { return false; } | 3080 virtual bool CanDeoptimize() const { return false; } |
| 3083 | 3081 |
| 3084 private: | 3082 private: |
| 3085 const intptr_t deopt_id_; | |
| 3086 const intptr_t token_pos_; | 3083 const intptr_t token_pos_; |
| 3087 | 3084 |
| 3088 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 3085 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 3089 }; | 3086 }; |
| 3090 | 3087 |
| 3091 | 3088 |
| 3092 class ReThrowInstr : public TemplateInstruction<0> { | 3089 class ReThrowInstr : public TemplateInstruction<0> { |
| 3093 public: | 3090 public: |
| 3094 explicit ReThrowInstr(intptr_t token_pos) | 3091 explicit ReThrowInstr(intptr_t token_pos) |
| 3095 : deopt_id_(Isolate::Current()->GetNextDeoptId()), | 3092 : token_pos_(token_pos) { } |
|
regis
2012/08/31 01:20:41
one line?
srdjan
2012/08/31 15:24:01
Done.
| |
| 3096 token_pos_(token_pos) { } | |
| 3097 | 3093 |
| 3098 DECLARE_INSTRUCTION(ReThrow) | 3094 DECLARE_INSTRUCTION(ReThrow) |
| 3099 | 3095 |
| 3100 virtual intptr_t ArgumentCount() const { return 2; } | 3096 virtual intptr_t ArgumentCount() const { return 2; } |
| 3101 | 3097 |
| 3102 intptr_t deopt_id() const { return deopt_id_; } | |
| 3103 intptr_t token_pos() const { return token_pos_; } | 3098 intptr_t token_pos() const { return token_pos_; } |
| 3104 | 3099 |
| 3105 virtual LocationSummary* MakeLocationSummary() const; | 3100 virtual LocationSummary* MakeLocationSummary() const; |
| 3106 | 3101 |
| 3107 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 3102 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 3108 | 3103 |
| 3109 virtual bool CanDeoptimize() const { return false; } | 3104 virtual bool CanDeoptimize() const { return false; } |
| 3110 | 3105 |
| 3111 private: | 3106 private: |
| 3112 const intptr_t deopt_id_; | |
| 3113 const intptr_t token_pos_; | 3107 const intptr_t token_pos_; |
| 3114 | 3108 |
| 3115 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 3109 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 3116 }; | 3110 }; |
| 3117 | 3111 |
| 3118 | 3112 |
| 3119 class GotoInstr : public TemplateInstruction<0> { | 3113 class GotoInstr : public TemplateInstruction<0> { |
| 3120 public: | 3114 public: |
| 3121 explicit GotoInstr(JoinEntryInstr* entry) | 3115 explicit GotoInstr(JoinEntryInstr* entry) |
| 3122 : successor_(entry), | 3116 : successor_(entry), |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3337 ForwardInstructionIterator* current_iterator_; | 3331 ForwardInstructionIterator* current_iterator_; |
| 3338 | 3332 |
| 3339 private: | 3333 private: |
| 3340 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 3334 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 3341 }; | 3335 }; |
| 3342 | 3336 |
| 3343 | 3337 |
| 3344 } // namespace dart | 3338 } // namespace dart |
| 3345 | 3339 |
| 3346 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 3340 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |