| 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 |
| 428 void AddToInputUseList(); |
| 429 void AddToEnvUseList(); |
| 427 | 430 |
| 428 virtual intptr_t ResultCid() const; | 431 virtual intptr_t ResultCid() const; |
| 429 | 432 |
| 433 virtual Value* CopyValue() { return new UseVal(definition_); } |
| 434 |
| 430 private: | 435 private: |
| 431 void AddToUseList(); | |
| 432 Definition* definition_; | 436 Definition* definition_; |
| 433 UseVal* next_use_; | 437 UseVal* next_use_; |
| 434 UseVal* previous_use_; | 438 Instruction* instruction_; |
| 435 | 439 intptr_t use_index_; |
| 436 friend class Definition; | |
| 437 | 440 |
| 438 DISALLOW_COPY_AND_ASSIGN(UseVal); | 441 DISALLOW_COPY_AND_ASSIGN(UseVal); |
| 439 }; | 442 }; |
| 440 | 443 |
| 441 | 444 |
| 442 class ConstantVal : public Value { | 445 class ConstantVal : public Value { |
| 443 public: | 446 public: |
| 444 explicit ConstantVal(const Object& value) | 447 explicit ConstantVal(const Object& value) |
| 445 : value_(value) { | 448 : value_(value) { |
| 446 ASSERT(value.IsZoneHandle()); | 449 ASSERT(value.IsZoneHandle()); |
| 447 ASSERT(value.IsSmi() || value.IsOld()); | 450 ASSERT(value.IsSmi() || value.IsOld()); |
| 448 } | 451 } |
| 449 | 452 |
| 450 DECLARE_VALUE(Constant) | 453 DECLARE_VALUE(Constant) |
| 451 | 454 |
| 452 const Object& value() const { return value_; } | 455 const Object& value() const { return value_; } |
| 453 | 456 |
| 454 // Returns true if the value represents a constant. | 457 // Returns true if the value represents a constant. |
| 455 virtual bool BindsToConstant() const { return true; } | 458 virtual bool BindsToConstant() const { return true; } |
| 456 virtual const Object& BoundConstant() const { return value(); } | 459 virtual const Object& BoundConstant() const { return value(); } |
| 457 | 460 |
| 458 // Returns true if the value represents constant null. | 461 // Returns true if the value represents constant null. |
| 459 virtual bool BindsToConstantNull() const { return value().IsNull(); } | 462 virtual bool BindsToConstantNull() const { return value().IsNull(); } |
| 460 | 463 |
| 461 virtual bool CanDeoptimize() const { return false; } | 464 virtual bool CanDeoptimize() const { return false; } |
| 462 | 465 |
| 463 virtual void RemoveFromUseList() { } | 466 virtual intptr_t ResultCid() const; |
| 464 | 467 |
| 465 virtual intptr_t ResultCid() const; | 468 virtual Value* CopyValue() { return this; } |
| 466 | 469 |
| 467 private: | 470 private: |
| 468 const Object& value_; | 471 const Object& value_; |
| 469 | 472 |
| 470 DISALLOW_COPY_AND_ASSIGN(ConstantVal); | 473 DISALLOW_COPY_AND_ASSIGN(ConstantVal); |
| 471 }; | 474 }; |
| 472 | 475 |
| 473 #undef DECLARE_VALUE | 476 #undef DECLARE_VALUE |
| 474 | 477 |
| 475 | 478 |
| (...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 | 2053 // 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 | 2054 // 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 | 2055 // to append instruction in case of a Throw inside an expression. This |
| 2053 // condition should be handled in the graph builder | 2056 // condition should be handled in the graph builder |
| 2054 next_ = instr; | 2057 next_ = instr; |
| 2055 } | 2058 } |
| 2056 | 2059 |
| 2057 // Removed this instruction from the graph. | 2060 // Removed this instruction from the graph. |
| 2058 Instruction* RemoveFromGraph(bool return_previous = true); | 2061 Instruction* RemoveFromGraph(bool return_previous = true); |
| 2059 | 2062 |
| 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 | 2063 // Normal instructions can have 0 (inside a block) or 1 (last instruction in |
| 2064 // a block) successors. Branch instruction with >1 successors override this | 2064 // a block) successors. Branch instruction with >1 successors override this |
| 2065 // function. | 2065 // function. |
| 2066 virtual intptr_t SuccessorCount() const; | 2066 virtual intptr_t SuccessorCount() const; |
| 2067 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; | 2067 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; |
| 2068 | 2068 |
| 2069 void Goto(JoinEntryInstr* entry); | 2069 void Goto(JoinEntryInstr* entry); |
| 2070 | 2070 |
| 2071 // Discover basic-block structure by performing a recursive depth first | 2071 // Discover basic-block structure by performing a recursive depth first |
| 2072 // traversal of the instruction graph reachable from this instruction. As | 2072 // traversal of the instruction graph reachable from this instruction. As |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 | 2154 |
| 2155 virtual LocationSummary* locs() { | 2155 virtual LocationSummary* locs() { |
| 2156 if (locs_ == NULL) { | 2156 if (locs_ == NULL) { |
| 2157 locs_ = MakeLocationSummary(); | 2157 locs_ = MakeLocationSummary(); |
| 2158 } | 2158 } |
| 2159 return locs_; | 2159 return locs_; |
| 2160 } | 2160 } |
| 2161 | 2161 |
| 2162 virtual LocationSummary* MakeLocationSummary() const = 0; | 2162 virtual LocationSummary* MakeLocationSummary() const = 0; |
| 2163 | 2163 |
| 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: | 2164 protected: |
| 2172 EmbeddedArray<Value*, N> inputs_; | 2165 EmbeddedArray<Value*, N> inputs_; |
| 2173 | 2166 |
| 2174 private: | 2167 private: |
| 2175 LocationSummary* locs_; | 2168 LocationSummary* locs_; |
| 2176 }; | 2169 }; |
| 2177 | 2170 |
| 2178 | 2171 |
| 2179 class MoveOperands : public ZoneAllocated { | 2172 class MoveOperands : public ZoneAllocated { |
| 2180 public: | 2173 public: |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2338 virtual Value* InputAt(intptr_t i) const { | 2331 virtual Value* InputAt(intptr_t i) const { |
| 2339 UNREACHABLE(); | 2332 UNREACHABLE(); |
| 2340 return NULL; | 2333 return NULL; |
| 2341 } | 2334 } |
| 2342 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } | 2335 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| 2343 | 2336 |
| 2344 virtual intptr_t ArgumentCount() const { return 0; } | 2337 virtual intptr_t ArgumentCount() const { return 0; } |
| 2345 | 2338 |
| 2346 virtual bool CanDeoptimize() const { return false; } | 2339 virtual bool CanDeoptimize() const { return false; } |
| 2347 | 2340 |
| 2348 virtual void RemoveInputUses() { } | |
| 2349 | |
| 2350 protected: | 2341 protected: |
| 2351 BlockEntryInstr() | 2342 BlockEntryInstr() |
| 2352 : preorder_number_(-1), | 2343 : preorder_number_(-1), |
| 2353 postorder_number_(-1), | 2344 postorder_number_(-1), |
| 2354 block_id_(-1), | 2345 block_id_(-1), |
| 2355 dominator_(NULL), | 2346 dominator_(NULL), |
| 2356 dominated_blocks_(1), | 2347 dominated_blocks_(1), |
| 2357 last_instruction_(NULL), | 2348 last_instruction_(NULL), |
| 2358 parallel_move_(NULL) { } | 2349 parallel_move_(NULL) { } |
| 2359 | 2350 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2565 | 2556 |
| 2566 | 2557 |
| 2567 // Abstract super-class of all instructions that define a value (Bind, Phi). | 2558 // Abstract super-class of all instructions that define a value (Bind, Phi). |
| 2568 class Definition : public Instruction { | 2559 class Definition : public Instruction { |
| 2569 public: | 2560 public: |
| 2570 Definition() | 2561 Definition() |
| 2571 : temp_index_(-1), | 2562 : temp_index_(-1), |
| 2572 ssa_temp_index_(-1), | 2563 ssa_temp_index_(-1), |
| 2573 propagated_type_(AbstractType::Handle()), | 2564 propagated_type_(AbstractType::Handle()), |
| 2574 propagated_cid_(kIllegalCid), | 2565 propagated_cid_(kIllegalCid), |
| 2575 use_list_(NULL) { } | 2566 input_use_list_(NULL), |
| 2567 env_use_list_(NULL) { } |
| 2576 | 2568 |
| 2577 virtual bool IsDefinition() const { return true; } | 2569 virtual bool IsDefinition() const { return true; } |
| 2578 virtual Definition* AsDefinition() { return this; } | 2570 virtual Definition* AsDefinition() { return this; } |
| 2579 | 2571 |
| 2580 intptr_t temp_index() const { return temp_index_; } | 2572 intptr_t temp_index() const { return temp_index_; } |
| 2581 void set_temp_index(intptr_t index) { temp_index_ = index; } | 2573 void set_temp_index(intptr_t index) { temp_index_ = index; } |
| 2582 | 2574 |
| 2583 intptr_t ssa_temp_index() const { return ssa_temp_index_; } | 2575 intptr_t ssa_temp_index() const { return ssa_temp_index_; } |
| 2584 void set_ssa_temp_index(intptr_t index) { | 2576 void set_ssa_temp_index(intptr_t index) { |
| 2585 ASSERT(index >= 0); | 2577 ASSERT(index >= 0); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2611 } | 2603 } |
| 2612 | 2604 |
| 2613 bool has_propagated_cid() const { return propagated_cid_ != kIllegalCid; } | 2605 bool has_propagated_cid() const { return propagated_cid_ != kIllegalCid; } |
| 2614 intptr_t propagated_cid() const { return propagated_cid_; } | 2606 intptr_t propagated_cid() const { return propagated_cid_; } |
| 2615 // May compute and set propagated cid. | 2607 // May compute and set propagated cid. |
| 2616 virtual intptr_t GetPropagatedCid() = 0; | 2608 virtual intptr_t GetPropagatedCid() = 0; |
| 2617 | 2609 |
| 2618 // Returns true if the propagated cid has changed. | 2610 // Returns true if the propagated cid has changed. |
| 2619 bool SetPropagatedCid(intptr_t cid); | 2611 bool SetPropagatedCid(intptr_t cid); |
| 2620 | 2612 |
| 2621 UseVal* use_list() { return use_list_; } | 2613 UseVal* input_use_list() { return input_use_list_; } |
| 2622 void set_use_list(UseVal* head) { | 2614 void set_input_use_list(UseVal* head) { input_use_list_ = head; } |
| 2623 ASSERT(head == NULL || head->previous_use() == NULL); | |
| 2624 use_list_ = head; | |
| 2625 } | |
| 2626 | 2615 |
| 2616 UseVal* env_use_list() { return env_use_list_; } |
| 2617 void set_env_use_list(UseVal* head) { env_use_list_ = head; } |
| 2618 |
| 2619 // Replace uses of this definition with uses of other definition or value. |
| 2620 // Precondition: use lists must be properly calculated. |
| 2621 // Postcondition: use lists and use values are still valid. |
| 2627 void ReplaceUsesWith(Definition* other); | 2622 void ReplaceUsesWith(Definition* other); |
| 2623 void ReplaceUsesWith(Value* value); |
| 2628 | 2624 |
| 2629 private: | 2625 private: |
| 2630 intptr_t temp_index_; | 2626 intptr_t temp_index_; |
| 2631 intptr_t ssa_temp_index_; | 2627 intptr_t ssa_temp_index_; |
| 2632 // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; | 2628 // TODO(regis): GrowableArray<const AbstractType*> propagated_types_; |
| 2633 // For now: | 2629 // For now: |
| 2634 AbstractType& propagated_type_; | 2630 AbstractType& propagated_type_; |
| 2635 intptr_t propagated_cid_; | 2631 intptr_t propagated_cid_; |
| 2636 UseVal* use_list_; | 2632 UseVal* input_use_list_; |
| 2633 UseVal* env_use_list_; |
| 2637 | 2634 |
| 2638 DISALLOW_COPY_AND_ASSIGN(Definition); | 2635 DISALLOW_COPY_AND_ASSIGN(Definition); |
| 2639 }; | 2636 }; |
| 2640 | 2637 |
| 2641 | 2638 |
| 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 { | 2639 class BindInstr : public Definition { |
| 2650 public: | 2640 public: |
| 2651 enum UseKind { kUnused, kUsed }; | 2641 enum UseKind { kUnused, kUsed }; |
| 2652 | 2642 |
| 2653 BindInstr(UseKind used, Computation* computation) | 2643 BindInstr(UseKind used, Computation* computation) |
| 2654 : computation_(computation), is_used_(used != kUnused) { | 2644 : computation_(computation), is_used_(used != kUnused) { |
| 2655 ASSERT(computation != NULL); | 2645 ASSERT(computation != NULL); |
| 2656 } | 2646 } |
| 2657 | 2647 |
| 2658 DECLARE_INSTRUCTION(Bind) | 2648 DECLARE_INSTRUCTION(Bind) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2685 bool Equals(BindInstr* other) const { | 2675 bool Equals(BindInstr* other) const { |
| 2686 return computation()->Equals(other->computation()); | 2676 return computation()->Equals(other->computation()); |
| 2687 } | 2677 } |
| 2688 | 2678 |
| 2689 virtual LocationSummary* locs() { | 2679 virtual LocationSummary* locs() { |
| 2690 return computation()->locs(); | 2680 return computation()->locs(); |
| 2691 } | 2681 } |
| 2692 | 2682 |
| 2693 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2683 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2694 | 2684 |
| 2695 virtual void RemoveInputUses() { computation()->RemoveInputUses(); } | |
| 2696 | |
| 2697 // Insert this instruction before 'next'. | 2685 // Insert this instruction before 'next'. |
| 2698 void InsertBefore(BindInstr* next); | 2686 void InsertBefore(BindInstr* next); |
| 2699 | 2687 |
| 2700 private: | 2688 private: |
| 2701 Computation* computation_; | 2689 Computation* computation_; |
| 2702 const bool is_used_; | 2690 const bool is_used_; |
| 2703 | 2691 |
| 2704 DISALLOW_COPY_AND_ASSIGN(BindInstr); | 2692 DISALLOW_COPY_AND_ASSIGN(BindInstr); |
| 2705 }; | 2693 }; |
| 2706 | 2694 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2720 virtual intptr_t ArgumentCount() const { return 0; } | 2708 virtual intptr_t ArgumentCount() const { return 0; } |
| 2721 | 2709 |
| 2722 intptr_t InputCount() const { return inputs_.length(); } | 2710 intptr_t InputCount() const { return inputs_.length(); } |
| 2723 | 2711 |
| 2724 Value* InputAt(intptr_t i) const { return inputs_[i]; } | 2712 Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| 2725 | 2713 |
| 2726 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } | 2714 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
| 2727 | 2715 |
| 2728 virtual bool CanDeoptimize() const { return false; } | 2716 virtual bool CanDeoptimize() const { return false; } |
| 2729 | 2717 |
| 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. | 2718 // TODO(regis): This helper will be removed once we support type sets. |
| 2738 RawAbstractType* LeastSpecificInputType() const; | 2719 RawAbstractType* LeastSpecificInputType() const; |
| 2739 | 2720 |
| 2740 // Phi is alive if it reaches a non-environment use. | 2721 // Phi is alive if it reaches a non-environment use. |
| 2741 bool is_alive() const { return is_alive_; } | 2722 bool is_alive() const { return is_alive_; } |
| 2742 void mark_alive() { is_alive_ = true; } | 2723 void mark_alive() { is_alive_ = true; } |
| 2743 | 2724 |
| 2744 DECLARE_INSTRUCTION(Phi) | 2725 DECLARE_INSTRUCTION(Phi) |
| 2745 | 2726 |
| 2746 private: | 2727 private: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2768 | 2749 |
| 2769 intptr_t InputCount() const { return 0; } | 2750 intptr_t InputCount() const { return 0; } |
| 2770 Value* InputAt(intptr_t i) const { | 2751 Value* InputAt(intptr_t i) const { |
| 2771 UNREACHABLE(); | 2752 UNREACHABLE(); |
| 2772 return NULL; | 2753 return NULL; |
| 2773 } | 2754 } |
| 2774 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } | 2755 void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| 2775 | 2756 |
| 2776 virtual bool CanDeoptimize() const { return false; } | 2757 virtual bool CanDeoptimize() const { return false; } |
| 2777 | 2758 |
| 2778 virtual void RemoveInputUses() { } | |
| 2779 | |
| 2780 private: | 2759 private: |
| 2781 const intptr_t index_; | 2760 const intptr_t index_; |
| 2782 | 2761 |
| 2783 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); | 2762 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); |
| 2784 }; | 2763 }; |
| 2785 | 2764 |
| 2786 | 2765 |
| 2787 class PushArgumentInstr : public Definition { | 2766 class PushArgumentInstr : public Definition { |
| 2788 public: | 2767 public: |
| 2789 explicit PushArgumentInstr(Value* value) : value_(value), locs_(NULL) { | 2768 explicit PushArgumentInstr(Value* value) : value_(value), locs_(NULL) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2819 LocationSummary* MakeLocationSummary() const; | 2798 LocationSummary* MakeLocationSummary() const; |
| 2820 | 2799 |
| 2821 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2800 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2822 | 2801 |
| 2823 virtual bool CanDeoptimize() const { return false; } | 2802 virtual bool CanDeoptimize() const { return false; } |
| 2824 | 2803 |
| 2825 bool WasEliminated() const { | 2804 bool WasEliminated() const { |
| 2826 return next() == NULL; | 2805 return next() == NULL; |
| 2827 } | 2806 } |
| 2828 | 2807 |
| 2829 virtual void RemoveInputUses() { value_->RemoveFromUseList(); } | |
| 2830 | |
| 2831 private: | 2808 private: |
| 2832 Value* value_; | 2809 Value* value_; |
| 2833 LocationSummary* locs_; | 2810 LocationSummary* locs_; |
| 2834 | 2811 |
| 2835 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); | 2812 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); |
| 2836 }; | 2813 }; |
| 2837 | 2814 |
| 2838 | 2815 |
| 2839 class ReturnInstr : public TemplateInstruction<1> { | 2816 class ReturnInstr : public TemplateInstruction<1> { |
| 2840 public: | 2817 public: |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 ForwardInstructionIterator* current_iterator_; | 3129 ForwardInstructionIterator* current_iterator_; |
| 3153 | 3130 |
| 3154 private: | 3131 private: |
| 3155 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 3132 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 3156 }; | 3133 }; |
| 3157 | 3134 |
| 3158 | 3135 |
| 3159 } // namespace dart | 3136 } // namespace dart |
| 3160 | 3137 |
| 3161 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 3138 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |