| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 virtual ComparisonComp* AsComparison() { return NULL; } | 205 virtual ComparisonComp* AsComparison() { return NULL; } |
| 206 | 206 |
| 207 // Create a location summary for this computation. | 207 // Create a location summary for this computation. |
| 208 // TODO(fschneider): Temporarily returns NULL for instructions | 208 // TODO(fschneider): Temporarily returns NULL for instructions |
| 209 // that are not yet converted to the location based code generation. | 209 // that are not yet converted to the location based code generation. |
| 210 virtual LocationSummary* MakeLocationSummary() const = 0; | 210 virtual LocationSummary* MakeLocationSummary() const = 0; |
| 211 | 211 |
| 212 // TODO(fschneider): Make EmitNativeCode and locs const. | 212 // TODO(fschneider): Make EmitNativeCode and locs const. |
| 213 virtual void EmitNativeCode(FlowGraphCompiler* compiler) = 0; | 213 virtual void EmitNativeCode(FlowGraphCompiler* compiler) = 0; |
| 214 | 214 |
| 215 virtual void RemoveInputUses() = 0; | |
| 216 | |
| 217 static LocationSummary* MakeCallSummary(); | 215 static LocationSummary* MakeCallSummary(); |
| 218 | 216 |
| 219 // Declare an enum value used to define kind-test predicates. | 217 // Declare an enum value used to define kind-test predicates. |
| 220 enum ComputationKind { | 218 enum ComputationKind { |
| 221 #define DECLARE_COMPUTATION_KIND(ShortName, ClassName) k##ShortName, | 219 #define DECLARE_COMPUTATION_KIND(ShortName, ClassName) k##ShortName, |
| 222 | 220 |
| 223 FOR_EACH_COMPUTATION(DECLARE_COMPUTATION_KIND) | 221 FOR_EACH_COMPUTATION(DECLARE_COMPUTATION_KIND) |
| 224 | 222 |
| 225 #undef DECLARE_COMPUTATION_KIND | 223 #undef DECLARE_COMPUTATION_KIND |
| 226 }; | 224 }; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 295 |
| 298 template<intptr_t N> | 296 template<intptr_t N> |
| 299 class TemplateComputation : public Computation { | 297 class TemplateComputation : public Computation { |
| 300 public: | 298 public: |
| 301 virtual intptr_t InputCount() const { return N; } | 299 virtual intptr_t InputCount() const { return N; } |
| 302 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } | 300 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| 303 virtual void SetInputAt(intptr_t i, Value* value) { | 301 virtual void SetInputAt(intptr_t i, Value* value) { |
| 304 ASSERT(value != NULL); | 302 ASSERT(value != NULL); |
| 305 inputs_[i] = value; | 303 inputs_[i] = value; |
| 306 } | 304 } |
| 307 virtual void RemoveInputUses() { | |
| 308 for (intptr_t i = 0; i < N; ++i) { | |
| 309 ASSERT(inputs_[i] != NULL); | |
| 310 inputs_[i]->RemoveFromUseList(); | |
| 311 } | |
| 312 } | |
| 313 | 305 |
| 314 protected: | 306 protected: |
| 315 EmbeddedArray<Value*, N> inputs_; | 307 EmbeddedArray<Value*, N> inputs_; |
| 316 }; | 308 }; |
| 317 | 309 |
| 318 | 310 |
| 319 class Value : public ZoneAllocated { | 311 class Value : public ZoneAllocated { |
| 320 public: | 312 public: |
| 321 Value() { } | 313 Value() { } |
| 322 | 314 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 348 // Returns true if the value represents constant null. | 340 // Returns true if the value represents constant null. |
| 349 virtual bool BindsToConstantNull() const = 0; | 341 virtual bool BindsToConstantNull() const = 0; |
| 350 | 342 |
| 351 // Assert if BindsToConstant() is false, otherwise returns constant. | 343 // Assert if BindsToConstant() is false, otherwise returns constant. |
| 352 virtual const Object& BoundConstant() const = 0; | 344 virtual const Object& BoundConstant() const = 0; |
| 353 | 345 |
| 354 // Reminder: The type of the constant null is the bottom type, which is more | 346 // Reminder: The type of the constant null is the bottom type, which is more |
| 355 // specific than any type. | 347 // specific than any type. |
| 356 bool CompileTypeIsMoreSpecificThan(const AbstractType& dst_type) const; | 348 bool CompileTypeIsMoreSpecificThan(const AbstractType& dst_type) const; |
| 357 | 349 |
| 358 virtual void RemoveFromUseList() = 0; | 350 virtual bool Equals(Value* other) const = 0; |
| 359 | 351 |
| 360 virtual bool Equals(Value* other) const = 0; | 352 virtual Value* CopyValue() = 0; |
| 361 | 353 |
| 362 private: | 354 private: |
| 363 DISALLOW_COPY_AND_ASSIGN(Value); | 355 DISALLOW_COPY_AND_ASSIGN(Value); |
| 364 }; | 356 }; |
| 365 | 357 |
| 366 | 358 |
| 367 // Functions defined in all concrete computation classes. | 359 // Functions defined in all concrete computation classes. |
| 368 #define DECLARE_COMPUTATION(ShortName) \ | 360 #define DECLARE_COMPUTATION(ShortName) \ |
| 369 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr); \ | 361 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr); \ |
| 370 virtual ComputationKind computation_kind() const { \ | 362 virtual ComputationKind computation_kind() const { \ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 397 virtual RawAbstractType* CompileType() const; \ | 389 virtual RawAbstractType* CompileType() const; \ |
| 398 virtual LocationSummary* MakeLocationSummary() const; \ | 390 virtual LocationSummary* MakeLocationSummary() const; \ |
| 399 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 391 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 400 | 392 |
| 401 | 393 |
| 402 class Definition; | 394 class Definition; |
| 403 class PhiInstr; | 395 class PhiInstr; |
| 404 | 396 |
| 405 class UseVal : public Value { | 397 class UseVal : public Value { |
| 406 public: | 398 public: |
| 407 explicit UseVal(Definition* definition); | 399 explicit UseVal(Definition* definition) |
| 400 : definition_(definition), |
| 401 next_use_(NULL), |
| 402 instruction_(NULL), |
| 403 use_index_(-1) { } |
| 408 | 404 |
| 409 DECLARE_VALUE(Use) | 405 DECLARE_VALUE(Use) |
| 410 | 406 |
| 411 inline Definition* definition() const; | 407 inline Definition* definition() const { return definition_; } |
| 412 void SetDefinition(Definition* definition); | 408 void set_definition(Definition* definition) { definition_ = definition; } |
| 413 | 409 |
| 414 // Returns true if the value represents a constant. | 410 // Returns true if the value represents a constant. |
| 415 virtual bool BindsToConstant() const; | 411 virtual bool BindsToConstant() const; |
| 416 virtual const Object& BoundConstant() const; | 412 virtual const Object& BoundConstant() const; |
| 417 | 413 |
| 418 // Returns true if the value represents constant null. | 414 // Returns true if the value represents constant null. |
| 419 virtual bool BindsToConstantNull() const; | 415 virtual bool BindsToConstantNull() const; |
| 420 | 416 |
| 421 virtual bool CanDeoptimize() const { return false; } | 417 virtual bool CanDeoptimize() const { return false; } |
| 422 | 418 |
| 423 UseVal* next_use() const { return next_use_; } | 419 UseVal* next_use() const { return next_use_; } |
| 424 UseVal* previous_use() const { return previous_use_; } | 420 void set_next_use(UseVal* next) { next_use_ = next; } |
| 425 virtual void RemoveFromUseList(); | 421 |
| 426 virtual void RemoveInputUses() { RemoveFromUseList(); } | 422 Instruction* instruction() const { return instruction_; } |
| 423 void set_instruction(Instruction* instruction) { instruction_ = instruction; } |
| 424 |
| 425 intptr_t use_index() const { return use_index_; } |
| 426 void set_use_index(intptr_t index) { use_index_ = index; } |
| 427 | 427 |
| 428 virtual intptr_t ResultCid() const; | 428 virtual intptr_t ResultCid() const; |
| 429 | 429 |
| 430 virtual Value* CopyValue() { return new UseVal(definition_); } |
| 431 |
| 430 private: | 432 private: |
| 431 void AddToUseList(); | |
| 432 Definition* definition_; | 433 Definition* definition_; |
| 433 UseVal* next_use_; | 434 UseVal* next_use_; |
| 434 UseVal* previous_use_; | 435 Instruction* instruction_; |
| 435 | 436 intptr_t use_index_; |
| 436 friend class Definition; | |
| 437 | 437 |
| 438 DISALLOW_COPY_AND_ASSIGN(UseVal); | 438 DISALLOW_COPY_AND_ASSIGN(UseVal); |
| 439 }; | 439 }; |
| 440 | 440 |
| 441 | 441 |
| 442 class ConstantVal : public Value { | 442 class ConstantVal : public Value { |
| 443 public: | 443 public: |
| 444 explicit ConstantVal(const Object& value) | 444 explicit ConstantVal(const Object& value) |
| 445 : value_(value) { | 445 : value_(value) { |
| 446 ASSERT(value.IsZoneHandle()); | 446 ASSERT(value.IsZoneHandle()); |
| 447 ASSERT(value.IsSmi() || value.IsOld()); | 447 ASSERT(value.IsSmi() || value.IsOld()); |
| 448 } | 448 } |
| 449 | 449 |
| 450 DECLARE_VALUE(Constant) | 450 DECLARE_VALUE(Constant) |
| 451 | 451 |
| 452 const Object& value() const { return value_; } | 452 const Object& value() const { return value_; } |
| 453 | 453 |
| 454 // Returns true if the value represents a constant. | 454 // Returns true if the value represents a constant. |
| 455 virtual bool BindsToConstant() const { return true; } | 455 virtual bool BindsToConstant() const { return true; } |
| 456 virtual const Object& BoundConstant() const { return value(); } | 456 virtual const Object& BoundConstant() const { return value(); } |
| 457 | 457 |
| 458 // Returns true if the value represents constant null. | 458 // Returns true if the value represents constant null. |
| 459 virtual bool BindsToConstantNull() const { return value().IsNull(); } | 459 virtual bool BindsToConstantNull() const { return value().IsNull(); } |
| 460 | 460 |
| 461 virtual bool CanDeoptimize() const { return false; } | 461 virtual bool CanDeoptimize() const { return false; } |
| 462 | 462 |
| 463 virtual void RemoveFromUseList() { } | 463 virtual intptr_t ResultCid() const; |
| 464 | 464 |
| 465 virtual intptr_t ResultCid() const; | 465 virtual Value* CopyValue() { return this; } |
| 466 | 466 |
| 467 private: | 467 private: |
| 468 const Object& value_; | 468 const Object& value_; |
| 469 | 469 |
| 470 DISALLOW_COPY_AND_ASSIGN(ConstantVal); | 470 DISALLOW_COPY_AND_ASSIGN(ConstantVal); |
| 471 }; | 471 }; |
| 472 | 472 |
| 473 #undef DECLARE_VALUE | 473 #undef DECLARE_VALUE |
| 474 | 474 |
| 475 | 475 |
| (...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2050 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions | 2050 // TODO(fschneider): Also add Throw and ReThrow to the list of instructions |
| 2051 // that do not have a successor. Currently, the graph builder will continue | 2051 // that do not have a successor. Currently, the graph builder will continue |
| 2052 // to append instruction in case of a Throw inside an expression. This | 2052 // to append instruction in case of a Throw inside an expression. This |
| 2053 // condition should be handled in the graph builder | 2053 // condition should be handled in the graph builder |
| 2054 next_ = instr; | 2054 next_ = instr; |
| 2055 } | 2055 } |
| 2056 | 2056 |
| 2057 // Removed this instruction from the graph. | 2057 // Removed this instruction from the graph. |
| 2058 Instruction* RemoveFromGraph(bool return_previous = true); | 2058 Instruction* RemoveFromGraph(bool return_previous = true); |
| 2059 | 2059 |
| 2060 // Remove value uses within this instruction and its inputs. | |
| 2061 virtual void RemoveInputUses() = 0; | |
| 2062 | |
| 2063 // Normal instructions can have 0 (inside a block) or 1 (last instruction in | 2060 // Normal instructions can have 0 (inside a block) or 1 (last instruction in |
| 2064 // a block) successors. Branch instruction with >1 successors override this | 2061 // a block) successors. Branch instruction with >1 successors override this |
| 2065 // function. | 2062 // function. |
| 2066 virtual intptr_t SuccessorCount() const; | 2063 virtual intptr_t SuccessorCount() const; |
| 2067 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; | 2064 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; |
| 2068 | 2065 |
| 2069 void Goto(JoinEntryInstr* entry); | 2066 void Goto(JoinEntryInstr* entry); |
| 2070 | 2067 |
| 2071 // Discover basic-block structure by performing a recursive depth first | 2068 // Discover basic-block structure by performing a recursive depth first |
| 2072 // traversal of the instruction graph reachable from this instruction. As | 2069 // traversal of the instruction graph reachable from this instruction. As |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 | 2151 |
| 2155 virtual LocationSummary* locs() { | 2152 virtual LocationSummary* locs() { |
| 2156 if (locs_ == NULL) { | 2153 if (locs_ == NULL) { |
| 2157 locs_ = MakeLocationSummary(); | 2154 locs_ = MakeLocationSummary(); |
| 2158 } | 2155 } |
| 2159 return locs_; | 2156 return locs_; |
| 2160 } | 2157 } |
| 2161 | 2158 |
| 2162 virtual LocationSummary* MakeLocationSummary() const = 0; | 2159 virtual LocationSummary* MakeLocationSummary() const = 0; |
| 2163 | 2160 |
| 2164 virtual void RemoveInputUses() { | |
| 2165 for (intptr_t i = 0; i < N; ++i) { | |
| 2166 ASSERT(inputs_[i] != NULL); | |
| 2167 inputs_[i]->RemoveFromUseList(); | |
| 2168 } | |
| 2169 } | |
| 2170 | |
| 2171 protected: | 2161 protected: |
| 2172 EmbeddedArray<Value*, N> inputs_; | 2162 EmbeddedArray<Value*, N> inputs_; |
| 2173 | 2163 |
| 2174 private: | 2164 private: |
| 2175 LocationSummary* locs_; | 2165 LocationSummary* locs_; |
| 2176 }; | 2166 }; |
| 2177 | 2167 |
| 2178 | 2168 |
| 2179 class MoveOperands : public ZoneAllocated { | 2169 class MoveOperands : public ZoneAllocated { |
| 2180 public: | 2170 public: |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2338 virtual Value* InputAt(intptr_t i) const { | 2328 virtual Value* InputAt(intptr_t i) const { |
| 2339 UNREACHABLE(); | 2329 UNREACHABLE(); |
| 2340 return NULL; | 2330 return NULL; |
| 2341 } | 2331 } |
| 2342 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } | 2332 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| 2343 | 2333 |
| 2344 virtual intptr_t ArgumentCount() const { return 0; } | 2334 virtual intptr_t ArgumentCount() const { return 0; } |
| 2345 | 2335 |
| 2346 virtual bool CanDeoptimize() const { return false; } | 2336 virtual bool CanDeoptimize() const { return false; } |
| 2347 | 2337 |
| 2348 virtual void RemoveInputUses() { } | |
| 2349 | |
| 2350 protected: | 2338 protected: |
| 2351 BlockEntryInstr() | 2339 BlockEntryInstr() |
| 2352 : preorder_number_(-1), | 2340 : preorder_number_(-1), |
| 2353 postorder_number_(-1), | 2341 postorder_number_(-1), |
| 2354 block_id_(-1), | 2342 block_id_(-1), |
| 2355 dominator_(NULL), | 2343 dominator_(NULL), |
| 2356 dominated_blocks_(1), | 2344 dominated_blocks_(1), |
| 2357 last_instruction_(NULL), | 2345 last_instruction_(NULL), |
| 2358 parallel_move_(NULL) { } | 2346 parallel_move_(NULL) { } |
| 2359 | 2347 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2565 | 2553 |
| 2566 | 2554 |
| 2567 // Abstract super-class of all instructions that define a value (Bind, Phi). | 2555 // Abstract super-class of all instructions that define a value (Bind, Phi). |
| 2568 class Definition : public Instruction { | 2556 class Definition : public Instruction { |
| 2569 public: | 2557 public: |
| 2570 Definition() | 2558 Definition() |
| 2571 : temp_index_(-1), | 2559 : temp_index_(-1), |
| 2572 ssa_temp_index_(-1), | 2560 ssa_temp_index_(-1), |
| 2573 propagated_type_(AbstractType::Handle()), | 2561 propagated_type_(AbstractType::Handle()), |
| 2574 propagated_cid_(kIllegalCid), | 2562 propagated_cid_(kIllegalCid), |
| 2575 use_list_(NULL) { } | 2563 instr_use_list_(NULL), |
| 2564 env_use_list_(NULL) { } |
| 2576 | 2565 |
| 2577 virtual bool IsDefinition() const { return true; } | 2566 virtual bool IsDefinition() const { return true; } |
| 2578 virtual Definition* AsDefinition() { return this; } | 2567 virtual Definition* AsDefinition() { return this; } |
| 2579 | 2568 |
| 2580 intptr_t temp_index() const { return temp_index_; } | 2569 intptr_t temp_index() const { return temp_index_; } |
| 2581 void set_temp_index(intptr_t index) { temp_index_ = index; } | 2570 void set_temp_index(intptr_t index) { temp_index_ = index; } |
| 2582 | 2571 |
| 2583 intptr_t ssa_temp_index() const { return ssa_temp_index_; } | 2572 intptr_t ssa_temp_index() const { return ssa_temp_index_; } |
| 2584 void set_ssa_temp_index(intptr_t index) { | 2573 void set_ssa_temp_index(intptr_t index) { |
| 2585 ASSERT(index >= 0); | 2574 ASSERT(index >= 0); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2611 } | 2600 } |
| 2612 | 2601 |
| 2613 bool has_propagated_cid() const { return propagated_cid_ != kIllegalCid; } | 2602 bool has_propagated_cid() const { return propagated_cid_ != kIllegalCid; } |
| 2614 intptr_t propagated_cid() const { return propagated_cid_; } | 2603 intptr_t propagated_cid() const { return propagated_cid_; } |
| 2615 // May compute and set propagated cid. | 2604 // May compute and set propagated cid. |
| 2616 virtual intptr_t GetPropagatedCid() = 0; | 2605 virtual intptr_t GetPropagatedCid() = 0; |
| 2617 | 2606 |
| 2618 // Returns true if the propagated cid has changed. | 2607 // Returns true if the propagated cid has changed. |
| 2619 bool SetPropagatedCid(intptr_t cid); | 2608 bool SetPropagatedCid(intptr_t cid); |
| 2620 | 2609 |
| 2621 UseVal* use_list() { return use_list_; } | 2610 UseVal* instr_use_list() { return instr_use_list_; } |
| 2622 void set_use_list(UseVal* head) { | 2611 void set_instr_use_list(UseVal* head) { instr_use_list_ = head; } |
| 2623 ASSERT(head == NULL || head->previous_use() == NULL); | |
| 2624 use_list_ = head; | |
| 2625 } | |
| 2626 | 2612 |
| 2613 UseVal* env_use_list() { return env_use_list_; } |
| 2614 void set_env_use_list(UseVal* head) { env_use_list_ = head; } |
| 2615 |
| 2616 // Replace all uses of this definition with uses of other definition. |
| 2617 // Assumes properly calculated def-use lists. |
| 2627 void ReplaceUsesWith(Definition* other); | 2618 void ReplaceUsesWith(Definition* other); |
| 2628 | 2619 |
| 2629 private: | 2620 private: |
| 2630 intptr_t temp_index_; | 2621 intptr_t temp_index_; |
| 2631 intptr_t ssa_temp_index_; | 2622 intptr_t ssa_temp_index_; |
| 2632 // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; | 2623 // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; |
| 2633 // For now: | 2624 // For now: |
| 2634 AbstractType& propagated_type_; | 2625 AbstractType& propagated_type_; |
| 2635 intptr_t propagated_cid_; | 2626 intptr_t propagated_cid_; |
| 2636 UseVal* use_list_; | 2627 UseVal* instr_use_list_; |
| 2628 UseVal* env_use_list_; |
| 2637 | 2629 |
| 2638 DISALLOW_COPY_AND_ASSIGN(Definition); | 2630 DISALLOW_COPY_AND_ASSIGN(Definition); |
| 2639 }; | 2631 }; |
| 2640 | 2632 |
| 2641 | 2633 |
| 2642 Definition* UseVal::definition() const { | |
| 2643 // Check that the definition is either a Phi or a linked in the the IR. | |
| 2644 ASSERT(definition_ != NULL); | |
| 2645 return definition_; | |
| 2646 } | |
| 2647 | |
| 2648 | |
| 2649 class BindInstr : public Definition { | 2634 class BindInstr : public Definition { |
| 2650 public: | 2635 public: |
| 2651 enum UseKind { kUnused, kUsed }; | 2636 enum UseKind { kUnused, kUsed }; |
| 2652 | 2637 |
| 2653 BindInstr(UseKind used, Computation* computation) | 2638 BindInstr(UseKind used, Computation* computation) |
| 2654 : computation_(computation), is_used_(used != kUnused) { | 2639 : computation_(computation), is_used_(used != kUnused) { |
| 2655 ASSERT(computation != NULL); | 2640 ASSERT(computation != NULL); |
| 2656 } | 2641 } |
| 2657 | 2642 |
| 2658 DECLARE_INSTRUCTION(Bind) | 2643 DECLARE_INSTRUCTION(Bind) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2685 bool Equals(BindInstr* other) const { | 2670 bool Equals(BindInstr* other) const { |
| 2686 return computation()->Equals(other->computation()); | 2671 return computation()->Equals(other->computation()); |
| 2687 } | 2672 } |
| 2688 | 2673 |
| 2689 virtual LocationSummary* locs() { | 2674 virtual LocationSummary* locs() { |
| 2690 return computation()->locs(); | 2675 return computation()->locs(); |
| 2691 } | 2676 } |
| 2692 | 2677 |
| 2693 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2678 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2694 | 2679 |
| 2695 virtual void RemoveInputUses() { computation()->RemoveInputUses(); } | |
| 2696 | |
| 2697 // Insert this instruction before 'next'. | 2680 // Insert this instruction before 'next'. |
| 2698 void InsertBefore(BindInstr* next); | 2681 void InsertBefore(BindInstr* next); |
| 2699 | 2682 |
| 2700 private: | 2683 private: |
| 2701 Computation* computation_; | 2684 Computation* computation_; |
| 2702 const bool is_used_; | 2685 const bool is_used_; |
| 2703 | 2686 |
| 2704 DISALLOW_COPY_AND_ASSIGN(BindInstr); | 2687 DISALLOW_COPY_AND_ASSIGN(BindInstr); |
| 2705 }; | 2688 }; |
| 2706 | 2689 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2720 virtual intptr_t ArgumentCount() const { return 0; } | 2703 virtual intptr_t ArgumentCount() const { return 0; } |
| 2721 | 2704 |
| 2722 intptr_t InputCount() const { return inputs_.length(); } | 2705 intptr_t InputCount() const { return inputs_.length(); } |
| 2723 | 2706 |
| 2724 Value* InputAt(intptr_t i) const { return inputs_[i]; } | 2707 Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| 2725 | 2708 |
| 2726 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } | 2709 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
| 2727 | 2710 |
| 2728 virtual bool CanDeoptimize() const { return false; } | 2711 virtual bool CanDeoptimize() const { return false; } |
| 2729 | 2712 |
| 2730 virtual void RemoveInputUses() { | |
| 2731 for (intptr_t i = 0; i < inputs_.length(); ++i) { | |
| 2732 ASSERT(inputs_[i] != NULL); | |
| 2733 inputs_[i]->RemoveFromUseList(); | |
| 2734 } | |
| 2735 } | |
| 2736 | |
| 2737 // TODO(regis): This helper will be removed once we support type sets. | 2713 // TODO(regis): This helper will be removed once we support type sets. |
| 2738 RawAbstractType* LeastSpecificInputType() const; | 2714 RawAbstractType* LeastSpecificInputType() const; |
| 2739 | 2715 |
| 2740 // Phi is alive if it reaches a non-environment use. | 2716 // Phi is alive if it reaches a non-environment use. |
| 2741 bool is_alive() const { return is_alive_; } | 2717 bool is_alive() const { return is_alive_; } |
| 2742 void mark_alive() { is_alive_ = true; } | 2718 void mark_alive() { is_alive_ = true; } |
| 2743 | 2719 |
| 2744 DECLARE_INSTRUCTION(Phi) | 2720 DECLARE_INSTRUCTION(Phi) |
| 2745 | 2721 |
| 2746 private: | 2722 private: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2768 | 2744 |
| 2769 intptr_t InputCount() const { return 0; } | 2745 intptr_t InputCount() const { return 0; } |
| 2770 Value* InputAt(intptr_t i) const { | 2746 Value* InputAt(intptr_t i) const { |
| 2771 UNREACHABLE(); | 2747 UNREACHABLE(); |
| 2772 return NULL; | 2748 return NULL; |
| 2773 } | 2749 } |
| 2774 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } | 2750 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| 2775 | 2751 |
| 2776 virtual bool CanDeoptimize() const { return false; } | 2752 virtual bool CanDeoptimize() const { return false; } |
| 2777 | 2753 |
| 2778 virtual void RemoveInputUses() { } | |
| 2779 | |
| 2780 private: | 2754 private: |
| 2781 const intptr_t index_; | 2755 const intptr_t index_; |
| 2782 | 2756 |
| 2783 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); | 2757 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); |
| 2784 }; | 2758 }; |
| 2785 | 2759 |
| 2786 | 2760 |
| 2787 class PushArgumentInstr : public Definition { | 2761 class PushArgumentInstr : public Definition { |
| 2788 public: | 2762 public: |
| 2789 explicit PushArgumentInstr(Value* value) : value_(value), locs_(NULL) { | 2763 explicit PushArgumentInstr(Value* value) : value_(value), locs_(NULL) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2819 LocationSummary* MakeLocationSummary() const; | 2793 LocationSummary* MakeLocationSummary() const; |
| 2820 | 2794 |
| 2821 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2795 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2822 | 2796 |
| 2823 virtual bool CanDeoptimize() const { return false; } | 2797 virtual bool CanDeoptimize() const { return false; } |
| 2824 | 2798 |
| 2825 bool WasEliminated() const { | 2799 bool WasEliminated() const { |
| 2826 return next() == NULL; | 2800 return next() == NULL; |
| 2827 } | 2801 } |
| 2828 | 2802 |
| 2829 virtual void RemoveInputUses() { value_->RemoveFromUseList(); } | |
| 2830 | |
| 2831 private: | 2803 private: |
| 2832 Value* value_; | 2804 Value* value_; |
| 2833 LocationSummary* locs_; | 2805 LocationSummary* locs_; |
| 2834 | 2806 |
| 2835 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); | 2807 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); |
| 2836 }; | 2808 }; |
| 2837 | 2809 |
| 2838 | 2810 |
| 2839 class ReturnInstr : public TemplateInstruction<1> { | 2811 class ReturnInstr : public TemplateInstruction<1> { |
| 2840 public: | 2812 public: |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 ForwardInstructionIterator* current_iterator_; | 3124 ForwardInstructionIterator* current_iterator_; |
| 3153 | 3125 |
| 3154 private: | 3126 private: |
| 3155 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 3127 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 3156 }; | 3128 }; |
| 3157 | 3129 |
| 3158 | 3130 |
| 3159 } // namespace dart | 3131 } // namespace dart |
| 3160 | 3132 |
| 3161 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 3133 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |