| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 private: | 385 private: |
| 386 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); | 386 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); |
| 387 }; | 387 }; |
| 388 | 388 |
| 389 | 389 |
| 390 class ClosureCallComp : public Computation { | 390 class ClosureCallComp : public Computation { |
| 391 public: | 391 public: |
| 392 ClosureCallComp(ClosureCallNode* node, | 392 ClosureCallComp(ClosureCallNode* node, |
| 393 intptr_t try_index, | 393 intptr_t try_index, |
| 394 ZoneGrowableArray<Value*>* arguments) | 394 ZoneGrowableArray<Value*>* arguments) |
| 395 : ast_node_(*node), | 395 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { } |
| 396 try_index_(try_index), | |
| 397 arguments_(arguments), | |
| 398 location_summary_(MakeLocationSummary()) { } | |
| 399 | 396 |
| 400 DECLARE_COMPUTATION(ClosureCall) | 397 DECLARE_COMPUTATION(ClosureCall) |
| 401 | 398 |
| 402 const Array& argument_names() const { return ast_node_.arguments()->names(); } | 399 const Array& argument_names() const { return ast_node_.arguments()->names(); } |
| 403 intptr_t token_index() const { return ast_node_.token_index(); } | 400 intptr_t token_index() const { return ast_node_.token_index(); } |
| 404 intptr_t try_index() const { return try_index_; } | 401 intptr_t try_index() const { return try_index_; } |
| 405 | 402 |
| 406 intptr_t ArgumentCount() const { return arguments_->length(); } | 403 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 407 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 404 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 408 | 405 |
| 409 virtual intptr_t InputCount() const; | 406 virtual intptr_t InputCount() const; |
| 410 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } | 407 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } |
| 411 | 408 |
| 412 virtual void PrintOperandsTo(BufferFormatter* f) const; | 409 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 413 | 410 |
| 414 virtual LocationSummary* locs() const { | |
| 415 return location_summary_; | |
| 416 } | |
| 417 | |
| 418 // Platform specific summary factory for this instruction. | |
| 419 LocationSummary* MakeLocationSummary(); | |
| 420 | |
| 421 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | |
| 422 | |
| 423 private: | 411 private: |
| 424 const ClosureCallNode& ast_node_; | 412 const ClosureCallNode& ast_node_; |
| 425 const intptr_t try_index_; | 413 const intptr_t try_index_; |
| 426 ZoneGrowableArray<Value*>* arguments_; | 414 ZoneGrowableArray<Value*>* arguments_; |
| 427 LocationSummary* location_summary_; | |
| 428 | 415 |
| 429 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); | 416 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); |
| 430 }; | 417 }; |
| 431 | 418 |
| 432 | 419 |
| 433 class InstanceCallComp : public Computation { | 420 class InstanceCallComp : public Computation { |
| 434 public: | 421 public: |
| 435 InstanceCallComp(intptr_t token_index, | 422 InstanceCallComp(intptr_t token_index, |
| 436 intptr_t try_index, | 423 intptr_t try_index, |
| 437 const String& function_name, | 424 const String& function_name, |
| 438 ZoneGrowableArray<Value*>* arguments, | 425 ZoneGrowableArray<Value*>* arguments, |
| 439 const Array& argument_names, | 426 const Array& argument_names, |
| 440 intptr_t checked_argument_count) | 427 intptr_t checked_argument_count) |
| 441 : token_index_(token_index), | 428 : token_index_(token_index), |
| 442 try_index_(try_index), | 429 try_index_(try_index), |
| 443 function_name_(function_name), | 430 function_name_(function_name), |
| 444 arguments_(arguments), | 431 arguments_(arguments), |
| 445 argument_names_(argument_names), | 432 argument_names_(argument_names), |
| 446 checked_argument_count_(checked_argument_count), | 433 checked_argument_count_(checked_argument_count) { |
| 447 location_summary_(MakeLocationSummary()) { | |
| 448 ASSERT(function_name.IsZoneHandle()); | 434 ASSERT(function_name.IsZoneHandle()); |
| 449 ASSERT(!arguments->is_empty()); | 435 ASSERT(!arguments->is_empty()); |
| 450 ASSERT(argument_names.IsZoneHandle()); | 436 ASSERT(argument_names.IsZoneHandle()); |
| 451 } | 437 } |
| 452 | 438 |
| 453 DECLARE_COMPUTATION(InstanceCall) | 439 DECLARE_COMPUTATION(InstanceCall) |
| 454 | 440 |
| 455 intptr_t token_index() const { return token_index_; } | 441 intptr_t token_index() const { return token_index_; } |
| 456 intptr_t try_index() const { return try_index_; } | 442 intptr_t try_index() const { return try_index_; } |
| 457 const String& function_name() const { return function_name_; } | 443 const String& function_name() const { return function_name_; } |
| 458 intptr_t ArgumentCount() const { return arguments_->length(); } | 444 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 459 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 445 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 460 const Array& argument_names() const { return argument_names_; } | 446 const Array& argument_names() const { return argument_names_; } |
| 461 intptr_t checked_argument_count() const { return checked_argument_count_; } | 447 intptr_t checked_argument_count() const { return checked_argument_count_; } |
| 462 | 448 |
| 463 virtual intptr_t InputCount() const; | 449 virtual intptr_t InputCount() const; |
| 464 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } | 450 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } |
| 465 | 451 |
| 466 virtual void PrintOperandsTo(BufferFormatter* f) const; | 452 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 467 | 453 |
| 468 virtual LocationSummary* locs() const { | |
| 469 return location_summary_; | |
| 470 } | |
| 471 | |
| 472 // Platform specific summary factory for this instruction. | |
| 473 LocationSummary* MakeLocationSummary(); | |
| 474 | |
| 475 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | |
| 476 | |
| 477 private: | 454 private: |
| 478 const intptr_t token_index_; | 455 const intptr_t token_index_; |
| 479 const intptr_t try_index_; | 456 const intptr_t try_index_; |
| 480 const String& function_name_; | 457 const String& function_name_; |
| 481 ZoneGrowableArray<Value*>* const arguments_; | 458 ZoneGrowableArray<Value*>* const arguments_; |
| 482 const Array& argument_names_; | 459 const Array& argument_names_; |
| 483 const intptr_t checked_argument_count_; | 460 const intptr_t checked_argument_count_; |
| 484 LocationSummary* location_summary_; | |
| 485 | 461 |
| 486 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); | 462 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); |
| 487 }; | 463 }; |
| 488 | 464 |
| 489 | 465 |
| 490 class StrictCompareComp : public TemplateComputation<2> { | 466 class StrictCompareComp : public TemplateComputation<2> { |
| 491 public: | 467 public: |
| 492 StrictCompareComp(Token::Kind kind, Value* left, Value* right) | 468 StrictCompareComp(Token::Kind kind, Value* left, Value* right) |
| 493 : kind_(kind) { | 469 : kind_(kind) { |
| 494 ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT)); | 470 ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 public: | 534 public: |
| 559 StaticCallComp(intptr_t token_index, | 535 StaticCallComp(intptr_t token_index, |
| 560 intptr_t try_index, | 536 intptr_t try_index, |
| 561 const Function& function, | 537 const Function& function, |
| 562 const Array& argument_names, | 538 const Array& argument_names, |
| 563 ZoneGrowableArray<Value*>* arguments) | 539 ZoneGrowableArray<Value*>* arguments) |
| 564 : token_index_(token_index), | 540 : token_index_(token_index), |
| 565 try_index_(try_index), | 541 try_index_(try_index), |
| 566 function_(function), | 542 function_(function), |
| 567 argument_names_(argument_names), | 543 argument_names_(argument_names), |
| 568 arguments_(arguments), | 544 arguments_(arguments) { |
| 569 location_summary_(MakeLocationSummary()) { | |
| 570 ASSERT(function.IsZoneHandle()); | 545 ASSERT(function.IsZoneHandle()); |
| 571 ASSERT(argument_names.IsZoneHandle()); | 546 ASSERT(argument_names.IsZoneHandle()); |
| 572 } | 547 } |
| 573 | 548 |
| 574 DECLARE_COMPUTATION(StaticCall) | 549 DECLARE_COMPUTATION(StaticCall) |
| 575 | 550 |
| 576 // Accessors forwarded to the AST node. | 551 // Accessors forwarded to the AST node. |
| 577 const Function& function() const { return function_; } | 552 const Function& function() const { return function_; } |
| 578 const Array& argument_names() const { return argument_names_; } | 553 const Array& argument_names() const { return argument_names_; } |
| 579 intptr_t token_index() const { return token_index_; } | 554 intptr_t token_index() const { return token_index_; } |
| 580 intptr_t try_index() const { return try_index_; } | 555 intptr_t try_index() const { return try_index_; } |
| 581 | 556 |
| 582 intptr_t ArgumentCount() const { return arguments_->length(); } | 557 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 583 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 558 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 584 | 559 |
| 585 virtual intptr_t InputCount() const; | 560 virtual intptr_t InputCount() const; |
| 586 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } | 561 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } |
| 587 | 562 |
| 588 virtual void PrintOperandsTo(BufferFormatter* f) const; | 563 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 589 | 564 |
| 590 virtual LocationSummary* locs() const { | |
| 591 return location_summary_; | |
| 592 } | |
| 593 | |
| 594 // Platform specific summary factory for this instruction. | |
| 595 LocationSummary* MakeLocationSummary(); | |
| 596 | |
| 597 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | |
| 598 | |
| 599 private: | 565 private: |
| 600 const intptr_t token_index_; | 566 const intptr_t token_index_; |
| 601 const intptr_t try_index_; | 567 const intptr_t try_index_; |
| 602 const Function& function_; | 568 const Function& function_; |
| 603 const Array& argument_names_; | 569 const Array& argument_names_; |
| 604 ZoneGrowableArray<Value*>* arguments_; | 570 ZoneGrowableArray<Value*>* arguments_; |
| 605 LocationSummary* location_summary_; | |
| 606 | 571 |
| 607 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); | 572 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); |
| 608 }; | 573 }; |
| 609 | 574 |
| 610 | 575 |
| 611 class LoadLocalComp : public TemplateComputation<0> { | 576 class LoadLocalComp : public TemplateComputation<0> { |
| 612 public: | 577 public: |
| 613 LoadLocalComp(const LocalVariable& local, intptr_t context_level) | 578 LoadLocalComp(const LocalVariable& local, intptr_t context_level) |
| 614 : local_(local), context_level_(context_level) { } | 579 : local_(local), context_level_(context_level) { } |
| 615 | 580 |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 const GrowableArray<BlockEntryInstr*>& block_order_; | 1864 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 1900 | 1865 |
| 1901 private: | 1866 private: |
| 1902 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 1867 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 1903 }; | 1868 }; |
| 1904 | 1869 |
| 1905 | 1870 |
| 1906 } // namespace dart | 1871 } // namespace dart |
| 1907 | 1872 |
| 1908 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 1873 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |