| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 const Object& value_; | 355 const Object& value_; |
| 356 | 356 |
| 357 DISALLOW_COPY_AND_ASSIGN(ConstantVal); | 357 DISALLOW_COPY_AND_ASSIGN(ConstantVal); |
| 358 }; | 358 }; |
| 359 | 359 |
| 360 #undef DECLARE_VALUE | 360 #undef DECLARE_VALUE |
| 361 | 361 |
| 362 | 362 |
| 363 class AssertAssignableComp : public TemplateComputation<3> { | 363 class AssertAssignableComp : public TemplateComputation<3> { |
| 364 public: | 364 public: |
| 365 AssertAssignableComp(intptr_t token_index, | 365 AssertAssignableComp(intptr_t token_pos, |
| 366 intptr_t try_index, | 366 intptr_t try_index, |
| 367 Value* value, | 367 Value* value, |
| 368 Value* instantiator, | 368 Value* instantiator, |
| 369 Value* instantiator_type_arguments, | 369 Value* instantiator_type_arguments, |
| 370 const AbstractType& dst_type, | 370 const AbstractType& dst_type, |
| 371 const String& dst_name) | 371 const String& dst_name) |
| 372 : token_index_(token_index), | 372 : token_pos_(token_pos), |
| 373 try_index_(try_index), | 373 try_index_(try_index), |
| 374 dst_type_(dst_type), | 374 dst_type_(dst_type), |
| 375 dst_name_(dst_name) { | 375 dst_name_(dst_name) { |
| 376 ASSERT(value != NULL); | 376 ASSERT(value != NULL); |
| 377 ASSERT(instantiator != NULL); | 377 ASSERT(instantiator != NULL); |
| 378 ASSERT(instantiator_type_arguments != NULL); | 378 ASSERT(instantiator_type_arguments != NULL); |
| 379 ASSERT(!dst_type.IsNull()); | 379 ASSERT(!dst_type.IsNull()); |
| 380 ASSERT(!dst_name.IsNull()); | 380 ASSERT(!dst_name.IsNull()); |
| 381 inputs_[0] = value; | 381 inputs_[0] = value; |
| 382 inputs_[1] = instantiator; | 382 inputs_[1] = instantiator; |
| 383 inputs_[2] = instantiator_type_arguments; | 383 inputs_[2] = instantiator_type_arguments; |
| 384 } | 384 } |
| 385 | 385 |
| 386 DECLARE_COMPUTATION(AssertAssignable) | 386 DECLARE_COMPUTATION(AssertAssignable) |
| 387 | 387 |
| 388 Value* value() const { return inputs_[0]; } | 388 Value* value() const { return inputs_[0]; } |
| 389 Value* instantiator() const { return inputs_[1]; } | 389 Value* instantiator() const { return inputs_[1]; } |
| 390 Value* instantiator_type_arguments() const { return inputs_[2]; } | 390 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 391 | 391 |
| 392 intptr_t token_index() const { return token_index_; } | 392 intptr_t token_pos() const { return token_pos_; } |
| 393 intptr_t try_index() const { return try_index_; } | 393 intptr_t try_index() const { return try_index_; } |
| 394 const AbstractType& dst_type() const { return dst_type_; } | 394 const AbstractType& dst_type() const { return dst_type_; } |
| 395 const String& dst_name() const { return dst_name_; } | 395 const String& dst_name() const { return dst_name_; } |
| 396 | 396 |
| 397 virtual void PrintOperandsTo(BufferFormatter* f) const; | 397 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 398 | 398 |
| 399 private: | 399 private: |
| 400 const intptr_t token_index_; | 400 const intptr_t token_pos_; |
| 401 const intptr_t try_index_; | 401 const intptr_t try_index_; |
| 402 const AbstractType& dst_type_; | 402 const AbstractType& dst_type_; |
| 403 const String& dst_name_; | 403 const String& dst_name_; |
| 404 | 404 |
| 405 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); | 405 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); |
| 406 }; | 406 }; |
| 407 | 407 |
| 408 | 408 |
| 409 class AssertBooleanComp : public TemplateComputation<1> { | 409 class AssertBooleanComp : public TemplateComputation<1> { |
| 410 public: | 410 public: |
| 411 AssertBooleanComp(intptr_t token_index, | 411 AssertBooleanComp(intptr_t token_pos, |
| 412 intptr_t try_index, | 412 intptr_t try_index, |
| 413 Value* value) | 413 Value* value) |
| 414 : token_index_(token_index), | 414 : token_pos_(token_pos), |
| 415 try_index_(try_index) { | 415 try_index_(try_index) { |
| 416 ASSERT(value != NULL); | 416 ASSERT(value != NULL); |
| 417 inputs_[0] = value; | 417 inputs_[0] = value; |
| 418 } | 418 } |
| 419 | 419 |
| 420 DECLARE_COMPUTATION(AssertBoolean) | 420 DECLARE_COMPUTATION(AssertBoolean) |
| 421 | 421 |
| 422 intptr_t token_index() const { return token_index_; } | 422 intptr_t token_pos() const { return token_pos_; } |
| 423 intptr_t try_index() const { return try_index_; } | 423 intptr_t try_index() const { return try_index_; } |
| 424 Value* value() const { return inputs_[0]; } | 424 Value* value() const { return inputs_[0]; } |
| 425 | 425 |
| 426 private: | 426 private: |
| 427 const intptr_t token_index_; | 427 const intptr_t token_pos_; |
| 428 const intptr_t try_index_; | 428 const intptr_t try_index_; |
| 429 | 429 |
| 430 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); | 430 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); |
| 431 }; | 431 }; |
| 432 | 432 |
| 433 | 433 |
| 434 // Denotes the current context, normally held in a register. This is | 434 // Denotes the current context, normally held in a register. This is |
| 435 // a computation, not a value, because it's mutable. | 435 // a computation, not a value, because it's mutable. |
| 436 class CurrentContextComp : public TemplateComputation<0> { | 436 class CurrentContextComp : public TemplateComputation<0> { |
| 437 public: | 437 public: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 465 ClosureCallComp(ClosureCallNode* node, | 465 ClosureCallComp(ClosureCallNode* node, |
| 466 intptr_t try_index, | 466 intptr_t try_index, |
| 467 ZoneGrowableArray<Value*>* arguments) | 467 ZoneGrowableArray<Value*>* arguments) |
| 468 : ast_node_(*node), | 468 : ast_node_(*node), |
| 469 try_index_(try_index), | 469 try_index_(try_index), |
| 470 arguments_(arguments) { } | 470 arguments_(arguments) { } |
| 471 | 471 |
| 472 DECLARE_COMPUTATION(ClosureCall) | 472 DECLARE_COMPUTATION(ClosureCall) |
| 473 | 473 |
| 474 const Array& argument_names() const { return ast_node_.arguments()->names(); } | 474 const Array& argument_names() const { return ast_node_.arguments()->names(); } |
| 475 intptr_t token_index() const { return ast_node_.token_index(); } | 475 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 476 intptr_t try_index() const { return try_index_; } | 476 intptr_t try_index() const { return try_index_; } |
| 477 | 477 |
| 478 intptr_t ArgumentCount() const { return arguments_->length(); } | 478 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 479 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 479 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 480 | 480 |
| 481 virtual intptr_t InputCount() const; | 481 virtual intptr_t InputCount() const; |
| 482 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } | 482 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } |
| 483 virtual void SetInputAt(intptr_t i, Value* value) { | 483 virtual void SetInputAt(intptr_t i, Value* value) { |
| 484 (*arguments_)[i] = value; | 484 (*arguments_)[i] = value; |
| 485 } | 485 } |
| 486 | 486 |
| 487 virtual void PrintOperandsTo(BufferFormatter* f) const; | 487 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 488 | 488 |
| 489 private: | 489 private: |
| 490 const ClosureCallNode& ast_node_; | 490 const ClosureCallNode& ast_node_; |
| 491 const intptr_t try_index_; | 491 const intptr_t try_index_; |
| 492 ZoneGrowableArray<Value*>* arguments_; | 492 ZoneGrowableArray<Value*>* arguments_; |
| 493 | 493 |
| 494 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); | 494 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); |
| 495 }; | 495 }; |
| 496 | 496 |
| 497 | 497 |
| 498 class InstanceCallComp : public Computation { | 498 class InstanceCallComp : public Computation { |
| 499 public: | 499 public: |
| 500 InstanceCallComp(intptr_t token_index, | 500 InstanceCallComp(intptr_t token_pos, |
| 501 intptr_t try_index, | 501 intptr_t try_index, |
| 502 const String& function_name, | 502 const String& function_name, |
| 503 Token::Kind token_kind, | 503 Token::Kind token_kind, |
| 504 ZoneGrowableArray<Value*>* arguments, | 504 ZoneGrowableArray<Value*>* arguments, |
| 505 const Array& argument_names, | 505 const Array& argument_names, |
| 506 intptr_t checked_argument_count) | 506 intptr_t checked_argument_count) |
| 507 : token_index_(token_index), | 507 : token_pos_(token_pos), |
| 508 try_index_(try_index), | 508 try_index_(try_index), |
| 509 function_name_(function_name), | 509 function_name_(function_name), |
| 510 token_kind_(token_kind), | 510 token_kind_(token_kind), |
| 511 arguments_(arguments), | 511 arguments_(arguments), |
| 512 argument_names_(argument_names), | 512 argument_names_(argument_names), |
| 513 checked_argument_count_(checked_argument_count) { | 513 checked_argument_count_(checked_argument_count) { |
| 514 ASSERT(function_name.IsZoneHandle()); | 514 ASSERT(function_name.IsZoneHandle()); |
| 515 ASSERT(!arguments->is_empty()); | 515 ASSERT(!arguments->is_empty()); |
| 516 ASSERT(argument_names.IsZoneHandle()); | 516 ASSERT(argument_names.IsZoneHandle()); |
| 517 ASSERT(Token::IsBinaryToken(token_kind) || | 517 ASSERT(Token::IsBinaryToken(token_kind) || |
| 518 Token::IsUnaryToken(token_kind) || | 518 Token::IsUnaryToken(token_kind) || |
| 519 token_kind == Token::kGET || | 519 token_kind == Token::kGET || |
| 520 token_kind == Token::kILLEGAL); | 520 token_kind == Token::kILLEGAL); |
| 521 } | 521 } |
| 522 | 522 |
| 523 DECLARE_COMPUTATION(InstanceCall) | 523 DECLARE_COMPUTATION(InstanceCall) |
| 524 | 524 |
| 525 intptr_t token_index() const { return token_index_; } | 525 intptr_t token_pos() const { return token_pos_; } |
| 526 intptr_t try_index() const { return try_index_; } | 526 intptr_t try_index() const { return try_index_; } |
| 527 const String& function_name() const { return function_name_; } | 527 const String& function_name() const { return function_name_; } |
| 528 Token::Kind token_kind() const { return token_kind_; } | 528 Token::Kind token_kind() const { return token_kind_; } |
| 529 intptr_t ArgumentCount() const { return arguments_->length(); } | 529 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 530 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 530 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 531 const Array& argument_names() const { return argument_names_; } | 531 const Array& argument_names() const { return argument_names_; } |
| 532 intptr_t checked_argument_count() const { return checked_argument_count_; } | 532 intptr_t checked_argument_count() const { return checked_argument_count_; } |
| 533 | 533 |
| 534 virtual intptr_t InputCount() const; | 534 virtual intptr_t InputCount() const; |
| 535 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } | 535 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } |
| 536 virtual void SetInputAt(intptr_t i, Value* value) { | 536 virtual void SetInputAt(intptr_t i, Value* value) { |
| 537 (*arguments_)[i] = value; | 537 (*arguments_)[i] = value; |
| 538 } | 538 } |
| 539 | 539 |
| 540 virtual void PrintOperandsTo(BufferFormatter* f) const; | 540 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 541 | 541 |
| 542 bool VerifyComputation(); | 542 bool VerifyComputation(); |
| 543 | 543 |
| 544 private: | 544 private: |
| 545 const intptr_t token_index_; | 545 const intptr_t token_pos_; |
| 546 const intptr_t try_index_; | 546 const intptr_t try_index_; |
| 547 const String& function_name_; | 547 const String& function_name_; |
| 548 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 548 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
| 549 ZoneGrowableArray<Value*>* const arguments_; | 549 ZoneGrowableArray<Value*>* const arguments_; |
| 550 const Array& argument_names_; | 550 const Array& argument_names_; |
| 551 const intptr_t checked_argument_count_; | 551 const intptr_t checked_argument_count_; |
| 552 | 552 |
| 553 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); | 553 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); |
| 554 }; | 554 }; |
| 555 | 555 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 | 630 |
| 631 private: | 631 private: |
| 632 const Token::Kind kind_; | 632 const Token::Kind kind_; |
| 633 | 633 |
| 634 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); | 634 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); |
| 635 }; | 635 }; |
| 636 | 636 |
| 637 | 637 |
| 638 class EqualityCompareComp : public ComparisonComp { | 638 class EqualityCompareComp : public ComparisonComp { |
| 639 public: | 639 public: |
| 640 EqualityCompareComp(intptr_t token_index, | 640 EqualityCompareComp(intptr_t token_pos, |
| 641 intptr_t try_index, | 641 intptr_t try_index, |
| 642 Value* left, | 642 Value* left, |
| 643 Value* right) | 643 Value* right) |
| 644 : ComparisonComp(left, right), | 644 : ComparisonComp(left, right), |
| 645 token_index_(token_index), | 645 token_pos_(token_pos), |
| 646 try_index_(try_index) { | 646 try_index_(try_index) { |
| 647 } | 647 } |
| 648 | 648 |
| 649 DECLARE_COMPUTATION(EqualityCompare) | 649 DECLARE_COMPUTATION(EqualityCompare) |
| 650 | 650 |
| 651 intptr_t token_index() const { return token_index_; } | 651 intptr_t token_pos() const { return token_pos_; } |
| 652 intptr_t try_index() const { return try_index_; } | 652 intptr_t try_index() const { return try_index_; } |
| 653 virtual void PrintOperandsTo(BufferFormatter* f) const; | 653 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 654 | 654 |
| 655 private: | 655 private: |
| 656 const intptr_t token_index_; | 656 const intptr_t token_pos_; |
| 657 const intptr_t try_index_; | 657 const intptr_t try_index_; |
| 658 | 658 |
| 659 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); | 659 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); |
| 660 }; | 660 }; |
| 661 | 661 |
| 662 | 662 |
| 663 class RelationalOpComp : public ComparisonComp { | 663 class RelationalOpComp : public ComparisonComp { |
| 664 public: | 664 public: |
| 665 RelationalOpComp(intptr_t token_index, | 665 RelationalOpComp(intptr_t token_pos, |
| 666 intptr_t try_index, | 666 intptr_t try_index, |
| 667 Token::Kind kind, | 667 Token::Kind kind, |
| 668 Value* left, | 668 Value* left, |
| 669 Value* right) | 669 Value* right) |
| 670 : ComparisonComp(left, right), | 670 : ComparisonComp(left, right), |
| 671 token_index_(token_index), | 671 token_pos_(token_pos), |
| 672 try_index_(try_index), | 672 try_index_(try_index), |
| 673 kind_(kind), | 673 kind_(kind), |
| 674 operands_class_id_(kObject) { | 674 operands_class_id_(kObject) { |
| 675 ASSERT(Token::IsRelationalOperator(kind)); | 675 ASSERT(Token::IsRelationalOperator(kind)); |
| 676 } | 676 } |
| 677 | 677 |
| 678 DECLARE_COMPUTATION(RelationalOp) | 678 DECLARE_COMPUTATION(RelationalOp) |
| 679 | 679 |
| 680 intptr_t token_index() const { return token_index_; } | 680 intptr_t token_pos() const { return token_pos_; } |
| 681 intptr_t try_index() const { return try_index_; } | 681 intptr_t try_index() const { return try_index_; } |
| 682 Token::Kind kind() const { return kind_; } | 682 Token::Kind kind() const { return kind_; } |
| 683 | 683 |
| 684 // TODO(srdjan): instead of class-id pass an enum that can differentiate | 684 // TODO(srdjan): instead of class-id pass an enum that can differentiate |
| 685 // between boxed and unboxed doubles and integers. | 685 // between boxed and unboxed doubles and integers. |
| 686 void set_operands_class_id(intptr_t value) { | 686 void set_operands_class_id(intptr_t value) { |
| 687 operands_class_id_ = value; | 687 operands_class_id_ = value; |
| 688 } | 688 } |
| 689 | 689 |
| 690 intptr_t operands_class_id() const { return operands_class_id_; } | 690 intptr_t operands_class_id() const { return operands_class_id_; } |
| 691 | 691 |
| 692 virtual void PrintOperandsTo(BufferFormatter* f) const; | 692 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 693 | 693 |
| 694 private: | 694 private: |
| 695 const intptr_t token_index_; | 695 const intptr_t token_pos_; |
| 696 const intptr_t try_index_; | 696 const intptr_t try_index_; |
| 697 const Token::Kind kind_; | 697 const Token::Kind kind_; |
| 698 intptr_t operands_class_id_; // class id of both operands. | 698 intptr_t operands_class_id_; // class id of both operands. |
| 699 | 699 |
| 700 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); | 700 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); |
| 701 }; | 701 }; |
| 702 | 702 |
| 703 | 703 |
| 704 class StaticCallComp : public Computation { | 704 class StaticCallComp : public Computation { |
| 705 public: | 705 public: |
| 706 StaticCallComp(intptr_t token_index, | 706 StaticCallComp(intptr_t token_pos, |
| 707 intptr_t try_index, | 707 intptr_t try_index, |
| 708 const Function& function, | 708 const Function& function, |
| 709 const Array& argument_names, | 709 const Array& argument_names, |
| 710 ZoneGrowableArray<Value*>* arguments) | 710 ZoneGrowableArray<Value*>* arguments) |
| 711 : token_index_(token_index), | 711 : token_pos_(token_pos), |
| 712 try_index_(try_index), | 712 try_index_(try_index), |
| 713 function_(function), | 713 function_(function), |
| 714 argument_names_(argument_names), | 714 argument_names_(argument_names), |
| 715 arguments_(arguments), | 715 arguments_(arguments), |
| 716 recognized_(MethodRecognizer::kUnknown) { | 716 recognized_(MethodRecognizer::kUnknown) { |
| 717 ASSERT(function.IsZoneHandle()); | 717 ASSERT(function.IsZoneHandle()); |
| 718 ASSERT(argument_names.IsZoneHandle()); | 718 ASSERT(argument_names.IsZoneHandle()); |
| 719 } | 719 } |
| 720 | 720 |
| 721 DECLARE_COMPUTATION(StaticCall) | 721 DECLARE_COMPUTATION(StaticCall) |
| 722 | 722 |
| 723 // Accessors forwarded to the AST node. | 723 // Accessors forwarded to the AST node. |
| 724 const Function& function() const { return function_; } | 724 const Function& function() const { return function_; } |
| 725 const Array& argument_names() const { return argument_names_; } | 725 const Array& argument_names() const { return argument_names_; } |
| 726 intptr_t token_index() const { return token_index_; } | 726 intptr_t token_pos() const { return token_pos_; } |
| 727 intptr_t try_index() const { return try_index_; } | 727 intptr_t try_index() const { return try_index_; } |
| 728 | 728 |
| 729 intptr_t ArgumentCount() const { return arguments_->length(); } | 729 intptr_t ArgumentCount() const { return arguments_->length(); } |
| 730 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } | 730 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } |
| 731 | 731 |
| 732 MethodRecognizer::Kind recognized() const { return recognized_; } | 732 MethodRecognizer::Kind recognized() const { return recognized_; } |
| 733 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; } | 733 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; } |
| 734 | 734 |
| 735 virtual intptr_t InputCount() const; | 735 virtual intptr_t InputCount() const; |
| 736 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } | 736 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } |
| 737 virtual void SetInputAt(intptr_t i, Value* value) { | 737 virtual void SetInputAt(intptr_t i, Value* value) { |
| 738 (*arguments_)[i] = value; | 738 (*arguments_)[i] = value; |
| 739 } | 739 } |
| 740 | 740 |
| 741 virtual void PrintOperandsTo(BufferFormatter* f) const; | 741 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 742 | 742 |
| 743 private: | 743 private: |
| 744 const intptr_t token_index_; | 744 const intptr_t token_pos_; |
| 745 const intptr_t try_index_; | 745 const intptr_t try_index_; |
| 746 const Function& function_; | 746 const Function& function_; |
| 747 const Array& argument_names_; | 747 const Array& argument_names_; |
| 748 ZoneGrowableArray<Value*>* arguments_; | 748 ZoneGrowableArray<Value*>* arguments_; |
| 749 MethodRecognizer::Kind recognized_; | 749 MethodRecognizer::Kind recognized_; |
| 750 | 750 |
| 751 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); | 751 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); |
| 752 }; | 752 }; |
| 753 | 753 |
| 754 | 754 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 }; | 801 }; |
| 802 | 802 |
| 803 | 803 |
| 804 class NativeCallComp : public TemplateComputation<0> { | 804 class NativeCallComp : public TemplateComputation<0> { |
| 805 public: | 805 public: |
| 806 NativeCallComp(NativeBodyNode* node, intptr_t try_index) | 806 NativeCallComp(NativeBodyNode* node, intptr_t try_index) |
| 807 : ast_node_(*node), try_index_(try_index) {} | 807 : ast_node_(*node), try_index_(try_index) {} |
| 808 | 808 |
| 809 DECLARE_COMPUTATION(NativeCall) | 809 DECLARE_COMPUTATION(NativeCall) |
| 810 | 810 |
| 811 intptr_t token_index() const { return ast_node_.token_index(); } | 811 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 812 intptr_t try_index() const { return try_index_; } | 812 intptr_t try_index() const { return try_index_; } |
| 813 | 813 |
| 814 const String& native_name() const { | 814 const String& native_name() const { |
| 815 return ast_node_.native_c_function_name(); | 815 return ast_node_.native_c_function_name(); |
| 816 } | 816 } |
| 817 | 817 |
| 818 NativeFunction native_c_function() const { | 818 NativeFunction native_c_function() const { |
| 819 return ast_node_.native_c_function(); | 819 return ast_node_.native_c_function(); |
| 820 } | 820 } |
| 821 | 821 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 | 932 |
| 933 private: | 933 private: |
| 934 const Field& field_; | 934 const Field& field_; |
| 935 | 935 |
| 936 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp); | 936 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldComp); |
| 937 }; | 937 }; |
| 938 | 938 |
| 939 | 939 |
| 940 class LoadIndexedComp : public TemplateComputation<2> { | 940 class LoadIndexedComp : public TemplateComputation<2> { |
| 941 public: | 941 public: |
| 942 LoadIndexedComp(intptr_t token_index, | 942 LoadIndexedComp(intptr_t token_pos, |
| 943 intptr_t try_index, | 943 intptr_t try_index, |
| 944 Value* array, | 944 Value* array, |
| 945 Value* index) | 945 Value* index) |
| 946 : token_index_(token_index), | 946 : token_pos_(token_pos), |
| 947 try_index_(try_index), | 947 try_index_(try_index), |
| 948 receiver_type_(kIllegalObjectKind) { | 948 receiver_type_(kIllegalObjectKind) { |
| 949 ASSERT(array != NULL); | 949 ASSERT(array != NULL); |
| 950 ASSERT(index != NULL); | 950 ASSERT(index != NULL); |
| 951 inputs_[0] = array; | 951 inputs_[0] = array; |
| 952 inputs_[1] = index; | 952 inputs_[1] = index; |
| 953 } | 953 } |
| 954 | 954 |
| 955 DECLARE_COMPUTATION(LoadIndexed) | 955 DECLARE_COMPUTATION(LoadIndexed) |
| 956 | 956 |
| 957 intptr_t token_index() const { return token_index_; } | 957 intptr_t token_pos() const { return token_pos_; } |
| 958 intptr_t try_index() const { return try_index_; } | 958 intptr_t try_index() const { return try_index_; } |
| 959 Value* array() const { return inputs_[0]; } | 959 Value* array() const { return inputs_[0]; } |
| 960 Value* index() const { return inputs_[1]; } | 960 Value* index() const { return inputs_[1]; } |
| 961 | 961 |
| 962 void set_receiver_type(ObjectKind receiver_type) { | 962 void set_receiver_type(ObjectKind receiver_type) { |
| 963 receiver_type_ = receiver_type; | 963 receiver_type_ = receiver_type; |
| 964 } | 964 } |
| 965 | 965 |
| 966 ObjectKind receiver_type() const { | 966 ObjectKind receiver_type() const { |
| 967 return receiver_type_; | 967 return receiver_type_; |
| 968 } | 968 } |
| 969 | 969 |
| 970 private: | 970 private: |
| 971 const intptr_t token_index_; | 971 const intptr_t token_pos_; |
| 972 const intptr_t try_index_; | 972 const intptr_t try_index_; |
| 973 ObjectKind receiver_type_; | 973 ObjectKind receiver_type_; |
| 974 | 974 |
| 975 DISALLOW_COPY_AND_ASSIGN(LoadIndexedComp); | 975 DISALLOW_COPY_AND_ASSIGN(LoadIndexedComp); |
| 976 }; | 976 }; |
| 977 | 977 |
| 978 | 978 |
| 979 // Not simply an InstanceCall because it has somewhat more complicated | 979 // Not simply an InstanceCall because it has somewhat more complicated |
| 980 // semantics: the value operand is preserved before the call. | 980 // semantics: the value operand is preserved before the call. |
| 981 class StoreIndexedComp : public TemplateComputation<3> { | 981 class StoreIndexedComp : public TemplateComputation<3> { |
| 982 public: | 982 public: |
| 983 StoreIndexedComp(intptr_t token_index, | 983 StoreIndexedComp(intptr_t token_pos, |
| 984 intptr_t try_index, | 984 intptr_t try_index, |
| 985 Value* array, | 985 Value* array, |
| 986 Value* index, | 986 Value* index, |
| 987 Value* value) | 987 Value* value) |
| 988 : token_index_(token_index), | 988 : token_pos_(token_pos), |
| 989 try_index_(try_index), | 989 try_index_(try_index), |
| 990 receiver_type_(kIllegalObjectKind) { | 990 receiver_type_(kIllegalObjectKind) { |
| 991 inputs_[0] = array; | 991 inputs_[0] = array; |
| 992 inputs_[1] = index; | 992 inputs_[1] = index; |
| 993 inputs_[2] = value; | 993 inputs_[2] = value; |
| 994 } | 994 } |
| 995 | 995 |
| 996 DECLARE_COMPUTATION(StoreIndexed) | 996 DECLARE_COMPUTATION(StoreIndexed) |
| 997 | 997 |
| 998 intptr_t token_index() const { return token_index_; } | 998 intptr_t token_pos() const { return token_pos_; } |
| 999 intptr_t try_index() const { return try_index_; } | 999 intptr_t try_index() const { return try_index_; } |
| 1000 Value* array() const { return inputs_[0]; } | 1000 Value* array() const { return inputs_[0]; } |
| 1001 Value* index() const { return inputs_[1]; } | 1001 Value* index() const { return inputs_[1]; } |
| 1002 Value* value() const { return inputs_[2]; } | 1002 Value* value() const { return inputs_[2]; } |
| 1003 | 1003 |
| 1004 void set_receiver_type(ObjectKind receiver_type) { | 1004 void set_receiver_type(ObjectKind receiver_type) { |
| 1005 receiver_type_ = receiver_type; | 1005 receiver_type_ = receiver_type; |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 ObjectKind receiver_type() const { | 1008 ObjectKind receiver_type() const { |
| 1009 return receiver_type_; | 1009 return receiver_type_; |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 private: | 1012 private: |
| 1013 const intptr_t token_index_; | 1013 const intptr_t token_pos_; |
| 1014 const intptr_t try_index_; | 1014 const intptr_t try_index_; |
| 1015 ObjectKind receiver_type_; | 1015 ObjectKind receiver_type_; |
| 1016 | 1016 |
| 1017 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); | 1017 DISALLOW_COPY_AND_ASSIGN(StoreIndexedComp); |
| 1018 }; | 1018 }; |
| 1019 | 1019 |
| 1020 | 1020 |
| 1021 // Not simply an InstanceCall because it has somewhat more complicated | 1021 // Not simply an InstanceCall because it has somewhat more complicated |
| 1022 // semantics: the value operand is preserved before the call. | 1022 // semantics: the value operand is preserved before the call. |
| 1023 class InstanceSetterComp : public TemplateComputation<2> { | 1023 class InstanceSetterComp : public TemplateComputation<2> { |
| 1024 public: | 1024 public: |
| 1025 InstanceSetterComp(intptr_t token_index, | 1025 InstanceSetterComp(intptr_t token_pos, |
| 1026 intptr_t try_index, | 1026 intptr_t try_index, |
| 1027 const String& field_name, | 1027 const String& field_name, |
| 1028 Value* receiver, | 1028 Value* receiver, |
| 1029 Value* value) | 1029 Value* value) |
| 1030 : token_index_(token_index), | 1030 : token_pos_(token_pos), |
| 1031 try_index_(try_index), | 1031 try_index_(try_index), |
| 1032 field_name_(field_name) { | 1032 field_name_(field_name) { |
| 1033 inputs_[0] = receiver; | 1033 inputs_[0] = receiver; |
| 1034 inputs_[1] = value; | 1034 inputs_[1] = value; |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 DECLARE_COMPUTATION(InstanceSetter) | 1037 DECLARE_COMPUTATION(InstanceSetter) |
| 1038 | 1038 |
| 1039 intptr_t token_index() const { return token_index_; } | 1039 intptr_t token_pos() const { return token_pos_; } |
| 1040 intptr_t try_index() const { return try_index_; } | 1040 intptr_t try_index() const { return try_index_; } |
| 1041 const String& field_name() const { return field_name_; } | 1041 const String& field_name() const { return field_name_; } |
| 1042 Value* receiver() const { return inputs_[0]; } | 1042 Value* receiver() const { return inputs_[0]; } |
| 1043 Value* value() const { return inputs_[1]; } | 1043 Value* value() const { return inputs_[1]; } |
| 1044 | 1044 |
| 1045 private: | 1045 private: |
| 1046 const intptr_t token_index_; | 1046 const intptr_t token_pos_; |
| 1047 const intptr_t try_index_; | 1047 const intptr_t try_index_; |
| 1048 const String& field_name_; | 1048 const String& field_name_; |
| 1049 | 1049 |
| 1050 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp); | 1050 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp); |
| 1051 }; | 1051 }; |
| 1052 | 1052 |
| 1053 | 1053 |
| 1054 // Not simply a StaticCall because it has somewhat more complicated | 1054 // Not simply a StaticCall because it has somewhat more complicated |
| 1055 // semantics: the value operand is preserved before the call. | 1055 // semantics: the value operand is preserved before the call. |
| 1056 class StaticSetterComp : public TemplateComputation<1> { | 1056 class StaticSetterComp : public TemplateComputation<1> { |
| 1057 public: | 1057 public: |
| 1058 StaticSetterComp(intptr_t token_index, | 1058 StaticSetterComp(intptr_t token_pos, |
| 1059 intptr_t try_index, | 1059 intptr_t try_index, |
| 1060 const Function& setter_function, | 1060 const Function& setter_function, |
| 1061 Value* value) | 1061 Value* value) |
| 1062 : token_index_(token_index), | 1062 : token_pos_(token_pos), |
| 1063 try_index_(try_index), | 1063 try_index_(try_index), |
| 1064 setter_function_(setter_function) { | 1064 setter_function_(setter_function) { |
| 1065 inputs_[0] = value; | 1065 inputs_[0] = value; |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 DECLARE_COMPUTATION(StaticSetter) | 1068 DECLARE_COMPUTATION(StaticSetter) |
| 1069 | 1069 |
| 1070 intptr_t token_index() const { return token_index_; } | 1070 intptr_t token_pos() const { return token_pos_; } |
| 1071 intptr_t try_index() const { return try_index_; } | 1071 intptr_t try_index() const { return try_index_; } |
| 1072 const Function& setter_function() const { return setter_function_; } | 1072 const Function& setter_function() const { return setter_function_; } |
| 1073 Value* value() const { return inputs_[0]; } | 1073 Value* value() const { return inputs_[0]; } |
| 1074 | 1074 |
| 1075 private: | 1075 private: |
| 1076 const intptr_t token_index_; | 1076 const intptr_t token_pos_; |
| 1077 const intptr_t try_index_; | 1077 const intptr_t try_index_; |
| 1078 const Function& setter_function_; | 1078 const Function& setter_function_; |
| 1079 | 1079 |
| 1080 DISALLOW_COPY_AND_ASSIGN(StaticSetterComp); | 1080 DISALLOW_COPY_AND_ASSIGN(StaticSetterComp); |
| 1081 }; | 1081 }; |
| 1082 | 1082 |
| 1083 | 1083 |
| 1084 // Note overrideable, built-in: value? false : true. | 1084 // Note overrideable, built-in: value? false : true. |
| 1085 class BooleanNegateComp : public TemplateComputation<1> { | 1085 class BooleanNegateComp : public TemplateComputation<1> { |
| 1086 public: | 1086 public: |
| 1087 explicit BooleanNegateComp(Value* value) { | 1087 explicit BooleanNegateComp(Value* value) { |
| 1088 inputs_[0] = value; | 1088 inputs_[0] = value; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 DECLARE_COMPUTATION(BooleanNegate) | 1091 DECLARE_COMPUTATION(BooleanNegate) |
| 1092 | 1092 |
| 1093 Value* value() const { return inputs_[0]; } | 1093 Value* value() const { return inputs_[0]; } |
| 1094 | 1094 |
| 1095 private: | 1095 private: |
| 1096 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); | 1096 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); |
| 1097 }; | 1097 }; |
| 1098 | 1098 |
| 1099 | 1099 |
| 1100 class InstanceOfComp : public TemplateComputation<3> { | 1100 class InstanceOfComp : public TemplateComputation<3> { |
| 1101 public: | 1101 public: |
| 1102 InstanceOfComp(intptr_t token_index, | 1102 InstanceOfComp(intptr_t token_pos, |
| 1103 intptr_t try_index, | 1103 intptr_t try_index, |
| 1104 Value* value, | 1104 Value* value, |
| 1105 Value* instantiator, | 1105 Value* instantiator, |
| 1106 Value* instantiator_type_arguments, | 1106 Value* instantiator_type_arguments, |
| 1107 const AbstractType& type, | 1107 const AbstractType& type, |
| 1108 bool negate_result) | 1108 bool negate_result) |
| 1109 : token_index_(token_index), | 1109 : token_pos_(token_pos), |
| 1110 try_index_(try_index), | 1110 try_index_(try_index), |
| 1111 type_(type), | 1111 type_(type), |
| 1112 negate_result_(negate_result) { | 1112 negate_result_(negate_result) { |
| 1113 ASSERT(value != NULL); | 1113 ASSERT(value != NULL); |
| 1114 ASSERT(instantiator != NULL); | 1114 ASSERT(instantiator != NULL); |
| 1115 ASSERT(instantiator_type_arguments != NULL); | 1115 ASSERT(instantiator_type_arguments != NULL); |
| 1116 ASSERT(!type.IsNull()); | 1116 ASSERT(!type.IsNull()); |
| 1117 inputs_[0] = value; | 1117 inputs_[0] = value; |
| 1118 inputs_[1] = instantiator; | 1118 inputs_[1] = instantiator; |
| 1119 inputs_[2] = instantiator_type_arguments; | 1119 inputs_[2] = instantiator_type_arguments; |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 DECLARE_COMPUTATION(InstanceOf) | 1122 DECLARE_COMPUTATION(InstanceOf) |
| 1123 | 1123 |
| 1124 Value* value() const { return inputs_[0]; } | 1124 Value* value() const { return inputs_[0]; } |
| 1125 Value* instantiator() const { return inputs_[1]; } | 1125 Value* instantiator() const { return inputs_[1]; } |
| 1126 Value* instantiator_type_arguments() const { return inputs_[2]; } | 1126 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 1127 | 1127 |
| 1128 bool negate_result() const { return negate_result_; } | 1128 bool negate_result() const { return negate_result_; } |
| 1129 const AbstractType& type() const { return type_; } | 1129 const AbstractType& type() const { return type_; } |
| 1130 intptr_t token_index() const { return token_index_; } | 1130 intptr_t token_pos() const { return token_pos_; } |
| 1131 intptr_t try_index() const { return try_index_; } | 1131 intptr_t try_index() const { return try_index_; } |
| 1132 | 1132 |
| 1133 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1133 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1134 | 1134 |
| 1135 private: | 1135 private: |
| 1136 const intptr_t token_index_; | 1136 const intptr_t token_pos_; |
| 1137 const intptr_t try_index_; | 1137 const intptr_t try_index_; |
| 1138 Value* value_; | 1138 Value* value_; |
| 1139 Value* instantiator_; | 1139 Value* instantiator_; |
| 1140 Value* type_arguments_; | 1140 Value* type_arguments_; |
| 1141 const AbstractType& type_; | 1141 const AbstractType& type_; |
| 1142 const bool negate_result_; | 1142 const bool negate_result_; |
| 1143 | 1143 |
| 1144 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); | 1144 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); |
| 1145 }; | 1145 }; |
| 1146 | 1146 |
| 1147 | 1147 |
| 1148 class AllocateObjectComp : public Computation { | 1148 class AllocateObjectComp : public Computation { |
| 1149 public: | 1149 public: |
| 1150 AllocateObjectComp(ConstructorCallNode* node, | 1150 AllocateObjectComp(ConstructorCallNode* node, |
| 1151 intptr_t try_index, | 1151 intptr_t try_index, |
| 1152 ZoneGrowableArray<Value*>* arguments) | 1152 ZoneGrowableArray<Value*>* arguments) |
| 1153 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { | 1153 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { |
| 1154 // Either no arguments or one type-argument and one instantiator. | 1154 // Either no arguments or one type-argument and one instantiator. |
| 1155 ASSERT(arguments->is_empty() || (arguments->length() == 2)); | 1155 ASSERT(arguments->is_empty() || (arguments->length() == 2)); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 DECLARE_COMPUTATION(AllocateObject) | 1158 DECLARE_COMPUTATION(AllocateObject) |
| 1159 | 1159 |
| 1160 const Function& constructor() const { return ast_node_.constructor(); } | 1160 const Function& constructor() const { return ast_node_.constructor(); } |
| 1161 intptr_t token_index() const { return ast_node_.token_index(); } | 1161 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1162 intptr_t try_index() const { return try_index_; } | 1162 intptr_t try_index() const { return try_index_; } |
| 1163 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; } | 1163 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; } |
| 1164 | 1164 |
| 1165 virtual intptr_t InputCount() const; | 1165 virtual intptr_t InputCount() const; |
| 1166 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; } | 1166 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; } |
| 1167 virtual void SetInputAt(intptr_t i, Value* value) { | 1167 virtual void SetInputAt(intptr_t i, Value* value) { |
| 1168 (*arguments_)[i] = value; | 1168 (*arguments_)[i] = value; |
| 1169 } | 1169 } |
| 1170 | 1170 |
| 1171 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1171 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1184 intptr_t try_index, | 1184 intptr_t try_index, |
| 1185 ZoneGrowableArray<Value*>* arguments) | 1185 ZoneGrowableArray<Value*>* arguments) |
| 1186 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { | 1186 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { |
| 1187 // One type-argument and one instantiator. | 1187 // One type-argument and one instantiator. |
| 1188 ASSERT(arguments->length() == 2); | 1188 ASSERT(arguments->length() == 2); |
| 1189 } | 1189 } |
| 1190 | 1190 |
| 1191 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck) | 1191 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck) |
| 1192 | 1192 |
| 1193 const Function& constructor() const { return ast_node_.constructor(); } | 1193 const Function& constructor() const { return ast_node_.constructor(); } |
| 1194 intptr_t token_index() const { return ast_node_.token_index(); } | 1194 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1195 intptr_t try_index() const { return try_index_; } | 1195 intptr_t try_index() const { return try_index_; } |
| 1196 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; } | 1196 const ZoneGrowableArray<Value*>& arguments() const { return *arguments_; } |
| 1197 | 1197 |
| 1198 virtual intptr_t InputCount() const; | 1198 virtual intptr_t InputCount() const; |
| 1199 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; } | 1199 virtual Value* InputAt(intptr_t i) const { return arguments()[i]; } |
| 1200 virtual void SetInputAt(intptr_t i, Value* value) { | 1200 virtual void SetInputAt(intptr_t i, Value* value) { |
| 1201 (*arguments_)[i] = value; | 1201 (*arguments_)[i] = value; |
| 1202 } | 1202 } |
| 1203 | 1203 |
| 1204 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1204 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1205 | 1205 |
| 1206 private: | 1206 private: |
| 1207 const ConstructorCallNode& ast_node_; | 1207 const ConstructorCallNode& ast_node_; |
| 1208 const intptr_t try_index_; | 1208 const intptr_t try_index_; |
| 1209 ZoneGrowableArray<Value*>* const arguments_; | 1209 ZoneGrowableArray<Value*>* const arguments_; |
| 1210 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); | 1210 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); |
| 1211 }; | 1211 }; |
| 1212 | 1212 |
| 1213 | 1213 |
| 1214 class CreateArrayComp : public TemplateComputation<1> { | 1214 class CreateArrayComp : public TemplateComputation<1> { |
| 1215 public: | 1215 public: |
| 1216 CreateArrayComp(intptr_t token_index, | 1216 CreateArrayComp(intptr_t token_pos, |
| 1217 intptr_t try_index, | 1217 intptr_t try_index, |
| 1218 ZoneGrowableArray<Value*>* elements, | 1218 ZoneGrowableArray<Value*>* elements, |
| 1219 Value* element_type) | 1219 Value* element_type) |
| 1220 : token_index_(token_index), | 1220 : token_pos_(token_pos), |
| 1221 try_index_(try_index), | 1221 try_index_(try_index), |
| 1222 elements_(elements) { | 1222 elements_(elements) { |
| 1223 #if defined(DEBUG) | 1223 #if defined(DEBUG) |
| 1224 for (int i = 0; i < ElementCount(); ++i) { | 1224 for (int i = 0; i < ElementCount(); ++i) { |
| 1225 ASSERT(ElementAt(i) != NULL); | 1225 ASSERT(ElementAt(i) != NULL); |
| 1226 } | 1226 } |
| 1227 ASSERT(element_type != NULL); | 1227 ASSERT(element_type != NULL); |
| 1228 #endif | 1228 #endif |
| 1229 inputs_[0] = element_type; | 1229 inputs_[0] = element_type; |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 DECLARE_COMPUTATION(CreateArray) | 1232 DECLARE_COMPUTATION(CreateArray) |
| 1233 | 1233 |
| 1234 intptr_t token_index() const { return token_index_; } | 1234 intptr_t token_pos() const { return token_pos_; } |
| 1235 intptr_t try_index() const { return try_index_; } | 1235 intptr_t try_index() const { return try_index_; } |
| 1236 intptr_t ElementCount() const { return elements_->length(); } | 1236 intptr_t ElementCount() const { return elements_->length(); } |
| 1237 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } | 1237 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } |
| 1238 Value* element_type() const { return inputs_[0]; } | 1238 Value* element_type() const { return inputs_[0]; } |
| 1239 | 1239 |
| 1240 virtual intptr_t InputCount() const; | 1240 virtual intptr_t InputCount() const; |
| 1241 virtual Value* InputAt(intptr_t i) const; | 1241 virtual Value* InputAt(intptr_t i) const; |
| 1242 virtual void SetInputAt(intptr_t i, Value* value); | 1242 virtual void SetInputAt(intptr_t i, Value* value); |
| 1243 | 1243 |
| 1244 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1244 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1245 | 1245 |
| 1246 private: | 1246 private: |
| 1247 const intptr_t token_index_; | 1247 const intptr_t token_pos_; |
| 1248 const intptr_t try_index_; | 1248 const intptr_t try_index_; |
| 1249 ZoneGrowableArray<Value*>* const elements_; | 1249 ZoneGrowableArray<Value*>* const elements_; |
| 1250 | 1250 |
| 1251 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); | 1251 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); |
| 1252 }; | 1252 }; |
| 1253 | 1253 |
| 1254 | 1254 |
| 1255 class CreateClosureComp : public TemplateComputation<2> { | 1255 class CreateClosureComp : public TemplateComputation<2> { |
| 1256 public: | 1256 public: |
| 1257 CreateClosureComp(ClosureNode* node, | 1257 CreateClosureComp(ClosureNode* node, |
| 1258 intptr_t try_index, | 1258 intptr_t try_index, |
| 1259 Value* type_arguments, | 1259 Value* type_arguments, |
| 1260 Value* receiver) | 1260 Value* receiver) |
| 1261 : ast_node_(*node), | 1261 : ast_node_(*node), |
| 1262 try_index_(try_index) { | 1262 try_index_(try_index) { |
| 1263 ASSERT(type_arguments != NULL); | 1263 ASSERT(type_arguments != NULL); |
| 1264 ASSERT(receiver != NULL); | 1264 ASSERT(receiver != NULL); |
| 1265 inputs_[0] = type_arguments; | 1265 inputs_[0] = type_arguments; |
| 1266 inputs_[1] = receiver; | 1266 inputs_[1] = receiver; |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 DECLARE_COMPUTATION(CreateClosure) | 1269 DECLARE_COMPUTATION(CreateClosure) |
| 1270 | 1270 |
| 1271 intptr_t token_index() const { return ast_node_.token_index(); } | 1271 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1272 intptr_t try_index() const { return try_index_; } | 1272 intptr_t try_index() const { return try_index_; } |
| 1273 const Function& function() const { return ast_node_.function(); } | 1273 const Function& function() const { return ast_node_.function(); } |
| 1274 Value* type_arguments() const { return inputs_[0]; } | 1274 Value* type_arguments() const { return inputs_[0]; } |
| 1275 Value* receiver() const { return inputs_[1]; } | 1275 Value* receiver() const { return inputs_[1]; } |
| 1276 | 1276 |
| 1277 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1277 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1278 | 1278 |
| 1279 private: | 1279 private: |
| 1280 const ClosureNode& ast_node_; | 1280 const ClosureNode& ast_node_; |
| 1281 const intptr_t try_index_; | 1281 const intptr_t try_index_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 private: | 1342 private: |
| 1343 const intptr_t offset_in_bytes_; | 1343 const intptr_t offset_in_bytes_; |
| 1344 const AbstractType& type_; | 1344 const AbstractType& type_; |
| 1345 | 1345 |
| 1346 DISALLOW_COPY_AND_ASSIGN(StoreVMFieldComp); | 1346 DISALLOW_COPY_AND_ASSIGN(StoreVMFieldComp); |
| 1347 }; | 1347 }; |
| 1348 | 1348 |
| 1349 | 1349 |
| 1350 class InstantiateTypeArgumentsComp : public TemplateComputation<1> { | 1350 class InstantiateTypeArgumentsComp : public TemplateComputation<1> { |
| 1351 public: | 1351 public: |
| 1352 InstantiateTypeArgumentsComp(intptr_t token_index, | 1352 InstantiateTypeArgumentsComp(intptr_t token_pos, |
| 1353 intptr_t try_index, | 1353 intptr_t try_index, |
| 1354 const AbstractTypeArguments& type_arguments, | 1354 const AbstractTypeArguments& type_arguments, |
| 1355 Value* instantiator) | 1355 Value* instantiator) |
| 1356 : token_index_(token_index), | 1356 : token_pos_(token_pos), |
| 1357 try_index_(try_index), | 1357 try_index_(try_index), |
| 1358 type_arguments_(type_arguments) { | 1358 type_arguments_(type_arguments) { |
| 1359 ASSERT(instantiator != NULL); | 1359 ASSERT(instantiator != NULL); |
| 1360 inputs_[0] = instantiator; | 1360 inputs_[0] = instantiator; |
| 1361 } | 1361 } |
| 1362 | 1362 |
| 1363 DECLARE_COMPUTATION(InstantiateTypeArguments) | 1363 DECLARE_COMPUTATION(InstantiateTypeArguments) |
| 1364 | 1364 |
| 1365 Value* instantiator() const { return inputs_[0]; } | 1365 Value* instantiator() const { return inputs_[0]; } |
| 1366 const AbstractTypeArguments& type_arguments() const { | 1366 const AbstractTypeArguments& type_arguments() const { |
| 1367 return type_arguments_; | 1367 return type_arguments_; |
| 1368 } | 1368 } |
| 1369 intptr_t token_index() const { return token_index_; } | 1369 intptr_t token_pos() const { return token_pos_; } |
| 1370 intptr_t try_index() const { return try_index_; } | 1370 intptr_t try_index() const { return try_index_; } |
| 1371 | 1371 |
| 1372 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1372 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1373 | 1373 |
| 1374 private: | 1374 private: |
| 1375 const intptr_t token_index_; | 1375 const intptr_t token_pos_; |
| 1376 const intptr_t try_index_; | 1376 const intptr_t try_index_; |
| 1377 const AbstractTypeArguments& type_arguments_; | 1377 const AbstractTypeArguments& type_arguments_; |
| 1378 | 1378 |
| 1379 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp); | 1379 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp); |
| 1380 }; | 1380 }; |
| 1381 | 1381 |
| 1382 | 1382 |
| 1383 class ExtractConstructorTypeArgumentsComp : public TemplateComputation<1> { | 1383 class ExtractConstructorTypeArgumentsComp : public TemplateComputation<1> { |
| 1384 public: | 1384 public: |
| 1385 ExtractConstructorTypeArgumentsComp( | 1385 ExtractConstructorTypeArgumentsComp( |
| 1386 intptr_t token_index, | 1386 intptr_t token_pos, |
| 1387 intptr_t try_index, | 1387 intptr_t try_index, |
| 1388 const AbstractTypeArguments& type_arguments, | 1388 const AbstractTypeArguments& type_arguments, |
| 1389 Value* instantiator) | 1389 Value* instantiator) |
| 1390 : token_index_(token_index), | 1390 : token_pos_(token_pos), |
| 1391 try_index_(try_index), | 1391 try_index_(try_index), |
| 1392 type_arguments_(type_arguments) { | 1392 type_arguments_(type_arguments) { |
| 1393 ASSERT(instantiator != NULL); | 1393 ASSERT(instantiator != NULL); |
| 1394 inputs_[0] = instantiator; | 1394 inputs_[0] = instantiator; |
| 1395 } | 1395 } |
| 1396 | 1396 |
| 1397 DECLARE_COMPUTATION(ExtractConstructorTypeArguments) | 1397 DECLARE_COMPUTATION(ExtractConstructorTypeArguments) |
| 1398 | 1398 |
| 1399 Value* instantiator() const { return inputs_[0]; } | 1399 Value* instantiator() const { return inputs_[0]; } |
| 1400 const AbstractTypeArguments& type_arguments() const { | 1400 const AbstractTypeArguments& type_arguments() const { |
| 1401 return type_arguments_; | 1401 return type_arguments_; |
| 1402 } | 1402 } |
| 1403 intptr_t token_index() const { return token_index_; } | 1403 intptr_t token_pos() const { return token_pos_; } |
| 1404 intptr_t try_index() const { return try_index_; } | 1404 intptr_t try_index() const { return try_index_; } |
| 1405 | 1405 |
| 1406 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1406 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1407 | 1407 |
| 1408 private: | 1408 private: |
| 1409 const intptr_t token_index_; | 1409 const intptr_t token_pos_; |
| 1410 const intptr_t try_index_; | 1410 const intptr_t try_index_; |
| 1411 const AbstractTypeArguments& type_arguments_; | 1411 const AbstractTypeArguments& type_arguments_; |
| 1412 | 1412 |
| 1413 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp); | 1413 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp); |
| 1414 }; | 1414 }; |
| 1415 | 1415 |
| 1416 | 1416 |
| 1417 class ExtractConstructorInstantiatorComp : public TemplateComputation<1> { | 1417 class ExtractConstructorInstantiatorComp : public TemplateComputation<1> { |
| 1418 public: | 1418 public: |
| 1419 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node, | 1419 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node, |
| 1420 Value* instantiator) | 1420 Value* instantiator) |
| 1421 : ast_node_(*ast_node) { | 1421 : ast_node_(*ast_node) { |
| 1422 ASSERT(instantiator != NULL); | 1422 ASSERT(instantiator != NULL); |
| 1423 inputs_[0] = instantiator; | 1423 inputs_[0] = instantiator; |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 DECLARE_COMPUTATION(ExtractConstructorInstantiator) | 1426 DECLARE_COMPUTATION(ExtractConstructorInstantiator) |
| 1427 | 1427 |
| 1428 Value* instantiator() const { return inputs_[0]; } | 1428 Value* instantiator() const { return inputs_[0]; } |
| 1429 const AbstractTypeArguments& type_arguments() const { | 1429 const AbstractTypeArguments& type_arguments() const { |
| 1430 return ast_node_.type_arguments(); | 1430 return ast_node_.type_arguments(); |
| 1431 } | 1431 } |
| 1432 const Function& constructor() const { return ast_node_.constructor(); } | 1432 const Function& constructor() const { return ast_node_.constructor(); } |
| 1433 intptr_t token_index() const { return ast_node_.token_index(); } | 1433 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1434 | 1434 |
| 1435 private: | 1435 private: |
| 1436 const ConstructorCallNode& ast_node_; | 1436 const ConstructorCallNode& ast_node_; |
| 1437 | 1437 |
| 1438 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp); | 1438 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp); |
| 1439 }; | 1439 }; |
| 1440 | 1440 |
| 1441 | 1441 |
| 1442 class AllocateContextComp : public TemplateComputation<0> { | 1442 class AllocateContextComp : public TemplateComputation<0> { |
| 1443 public: | 1443 public: |
| 1444 AllocateContextComp(intptr_t token_index, | 1444 AllocateContextComp(intptr_t token_pos, |
| 1445 intptr_t try_index, | 1445 intptr_t try_index, |
| 1446 intptr_t num_context_variables) | 1446 intptr_t num_context_variables) |
| 1447 : token_index_(token_index), | 1447 : token_pos_(token_pos), |
| 1448 try_index_(try_index), | 1448 try_index_(try_index), |
| 1449 num_context_variables_(num_context_variables) {} | 1449 num_context_variables_(num_context_variables) {} |
| 1450 | 1450 |
| 1451 DECLARE_COMPUTATION(AllocateContext); | 1451 DECLARE_COMPUTATION(AllocateContext); |
| 1452 | 1452 |
| 1453 intptr_t token_index() const { return token_index_; } | 1453 intptr_t token_pos() const { return token_pos_; } |
| 1454 intptr_t try_index() const { return try_index_; } | 1454 intptr_t try_index() const { return try_index_; } |
| 1455 intptr_t num_context_variables() const { return num_context_variables_; } | 1455 intptr_t num_context_variables() const { return num_context_variables_; } |
| 1456 | 1456 |
| 1457 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1457 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1458 | 1458 |
| 1459 private: | 1459 private: |
| 1460 const intptr_t token_index_; | 1460 const intptr_t token_pos_; |
| 1461 const intptr_t try_index_; | 1461 const intptr_t try_index_; |
| 1462 const intptr_t num_context_variables_; | 1462 const intptr_t num_context_variables_; |
| 1463 | 1463 |
| 1464 DISALLOW_COPY_AND_ASSIGN(AllocateContextComp); | 1464 DISALLOW_COPY_AND_ASSIGN(AllocateContextComp); |
| 1465 }; | 1465 }; |
| 1466 | 1466 |
| 1467 | 1467 |
| 1468 class ChainContextComp : public TemplateComputation<1> { | 1468 class ChainContextComp : public TemplateComputation<1> { |
| 1469 public: | 1469 public: |
| 1470 explicit ChainContextComp(Value* context_value) { | 1470 explicit ChainContextComp(Value* context_value) { |
| 1471 ASSERT(context_value != NULL); | 1471 ASSERT(context_value != NULL); |
| 1472 inputs_[0] = context_value; | 1472 inputs_[0] = context_value; |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 DECLARE_COMPUTATION(ChainContext) | 1475 DECLARE_COMPUTATION(ChainContext) |
| 1476 | 1476 |
| 1477 Value* context_value() const { return inputs_[0]; } | 1477 Value* context_value() const { return inputs_[0]; } |
| 1478 | 1478 |
| 1479 private: | 1479 private: |
| 1480 DISALLOW_COPY_AND_ASSIGN(ChainContextComp); | 1480 DISALLOW_COPY_AND_ASSIGN(ChainContextComp); |
| 1481 }; | 1481 }; |
| 1482 | 1482 |
| 1483 | 1483 |
| 1484 class CloneContextComp : public TemplateComputation<1> { | 1484 class CloneContextComp : public TemplateComputation<1> { |
| 1485 public: | 1485 public: |
| 1486 CloneContextComp(intptr_t token_index, | 1486 CloneContextComp(intptr_t token_pos, |
| 1487 intptr_t try_index, | 1487 intptr_t try_index, |
| 1488 Value* context_value) | 1488 Value* context_value) |
| 1489 : token_index_(token_index), | 1489 : token_pos_(token_pos), |
| 1490 try_index_(try_index) { | 1490 try_index_(try_index) { |
| 1491 ASSERT(context_value != NULL); | 1491 ASSERT(context_value != NULL); |
| 1492 inputs_[0] = context_value; | 1492 inputs_[0] = context_value; |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 intptr_t token_index() const { return token_index_; } | 1495 intptr_t token_pos() const { return token_pos_; } |
| 1496 intptr_t try_index() const { return try_index_; } | 1496 intptr_t try_index() const { return try_index_; } |
| 1497 Value* context_value() const { return inputs_[0]; } | 1497 Value* context_value() const { return inputs_[0]; } |
| 1498 | 1498 |
| 1499 DECLARE_COMPUTATION(CloneContext) | 1499 DECLARE_COMPUTATION(CloneContext) |
| 1500 | 1500 |
| 1501 private: | 1501 private: |
| 1502 const intptr_t token_index_; | 1502 const intptr_t token_pos_; |
| 1503 const intptr_t try_index_; | 1503 const intptr_t try_index_; |
| 1504 | 1504 |
| 1505 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); | 1505 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); |
| 1506 }; | 1506 }; |
| 1507 | 1507 |
| 1508 | 1508 |
| 1509 class CatchEntryComp : public TemplateComputation<0> { | 1509 class CatchEntryComp : public TemplateComputation<0> { |
| 1510 public: | 1510 public: |
| 1511 CatchEntryComp(const LocalVariable& exception_var, | 1511 CatchEntryComp(const LocalVariable& exception_var, |
| 1512 const LocalVariable& stacktrace_var) | 1512 const LocalVariable& stacktrace_var) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 | 1616 |
| 1617 private: | 1617 private: |
| 1618 InstanceCallComp* instance_call_; | 1618 InstanceCallComp* instance_call_; |
| 1619 | 1619 |
| 1620 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); | 1620 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); |
| 1621 }; | 1621 }; |
| 1622 | 1622 |
| 1623 | 1623 |
| 1624 class CheckStackOverflowComp : public TemplateComputation<0> { | 1624 class CheckStackOverflowComp : public TemplateComputation<0> { |
| 1625 public: | 1625 public: |
| 1626 CheckStackOverflowComp(intptr_t token_index, intptr_t try_index) | 1626 CheckStackOverflowComp(intptr_t token_pos, intptr_t try_index) |
| 1627 : token_index_(token_index), | 1627 : token_pos_(token_pos), |
| 1628 try_index_(try_index) {} | 1628 try_index_(try_index) {} |
| 1629 | 1629 |
| 1630 intptr_t token_index() const { return token_index_; } | 1630 intptr_t token_pos() const { return token_pos_; } |
| 1631 intptr_t try_index() const { return try_index_; } | 1631 intptr_t try_index() const { return try_index_; } |
| 1632 | 1632 |
| 1633 DECLARE_COMPUTATION(CheckStackOverflow) | 1633 DECLARE_COMPUTATION(CheckStackOverflow) |
| 1634 | 1634 |
| 1635 private: | 1635 private: |
| 1636 const intptr_t token_index_; | 1636 const intptr_t token_pos_; |
| 1637 const intptr_t try_index_; | 1637 const intptr_t try_index_; |
| 1638 | 1638 |
| 1639 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); | 1639 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); |
| 1640 }; | 1640 }; |
| 1641 | 1641 |
| 1642 | 1642 |
| 1643 class ToDoubleComp : public TemplateComputation<1> { | 1643 class ToDoubleComp : public TemplateComputation<1> { |
| 1644 public: | 1644 public: |
| 1645 ToDoubleComp(Value* value, | 1645 ToDoubleComp(Value* value, |
| 1646 ObjectKind from, | 1646 ObjectKind from, |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2187 | 2187 |
| 2188 private: | 2188 private: |
| 2189 GrowableArray<Value*> inputs_; | 2189 GrowableArray<Value*> inputs_; |
| 2190 | 2190 |
| 2191 DISALLOW_COPY_AND_ASSIGN(PhiInstr); | 2191 DISALLOW_COPY_AND_ASSIGN(PhiInstr); |
| 2192 }; | 2192 }; |
| 2193 | 2193 |
| 2194 | 2194 |
| 2195 class ReturnInstr : public InstructionWithInputs { | 2195 class ReturnInstr : public InstructionWithInputs { |
| 2196 public: | 2196 public: |
| 2197 ReturnInstr(intptr_t token_index, Value* value) | 2197 ReturnInstr(intptr_t token_pos, Value* value) |
| 2198 : InstructionWithInputs(), token_index_(token_index), value_(value) { | 2198 : InstructionWithInputs(), token_pos_(token_pos), value_(value) { |
| 2199 ASSERT(value_ != NULL); | 2199 ASSERT(value_ != NULL); |
| 2200 } | 2200 } |
| 2201 | 2201 |
| 2202 DECLARE_INSTRUCTION(Return) | 2202 DECLARE_INSTRUCTION(Return) |
| 2203 | 2203 |
| 2204 Value* value() const { return value_; } | 2204 Value* value() const { return value_; } |
| 2205 intptr_t token_index() const { return token_index_; } | 2205 intptr_t token_pos() const { return token_pos_; } |
| 2206 | 2206 |
| 2207 virtual Instruction* StraightLineSuccessor() const { return NULL; } | 2207 virtual Instruction* StraightLineSuccessor() const { return NULL; } |
| 2208 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } | 2208 virtual void SetSuccessor(Instruction* instr) { UNREACHABLE(); } |
| 2209 | 2209 |
| 2210 virtual LocationSummary* MakeLocationSummary() const; | 2210 virtual LocationSummary* MakeLocationSummary() const; |
| 2211 | 2211 |
| 2212 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2212 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2213 | 2213 |
| 2214 private: | 2214 private: |
| 2215 const intptr_t token_index_; | 2215 const intptr_t token_pos_; |
| 2216 Value* value_; | 2216 Value* value_; |
| 2217 | 2217 |
| 2218 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 2218 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 2219 }; | 2219 }; |
| 2220 | 2220 |
| 2221 | 2221 |
| 2222 class ThrowInstr : public InstructionWithInputs { | 2222 class ThrowInstr : public InstructionWithInputs { |
| 2223 public: | 2223 public: |
| 2224 ThrowInstr(intptr_t token_index, | 2224 ThrowInstr(intptr_t token_pos, |
| 2225 intptr_t try_index, | 2225 intptr_t try_index, |
| 2226 Value* exception) | 2226 Value* exception) |
| 2227 : InstructionWithInputs(), | 2227 : InstructionWithInputs(), |
| 2228 token_index_(token_index), | 2228 token_pos_(token_pos), |
| 2229 try_index_(try_index), | 2229 try_index_(try_index), |
| 2230 exception_(exception), | 2230 exception_(exception), |
| 2231 successor_(NULL) { | 2231 successor_(NULL) { |
| 2232 ASSERT(exception_ != NULL); | 2232 ASSERT(exception_ != NULL); |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 DECLARE_INSTRUCTION(Throw) | 2235 DECLARE_INSTRUCTION(Throw) |
| 2236 | 2236 |
| 2237 intptr_t token_index() const { return token_index_; } | 2237 intptr_t token_pos() const { return token_pos_; } |
| 2238 intptr_t try_index() const { return try_index_; } | 2238 intptr_t try_index() const { return try_index_; } |
| 2239 Value* exception() const { return exception_; } | 2239 Value* exception() const { return exception_; } |
| 2240 | 2240 |
| 2241 // Parser can generate a throw within an expression tree. We never | 2241 // Parser can generate a throw within an expression tree. We never |
| 2242 // add successor instructions to the graph. | 2242 // add successor instructions to the graph. |
| 2243 virtual Instruction* StraightLineSuccessor() const { return NULL; } | 2243 virtual Instruction* StraightLineSuccessor() const { return NULL; } |
| 2244 virtual void SetSuccessor(Instruction* instr) { | 2244 virtual void SetSuccessor(Instruction* instr) { |
| 2245 ASSERT(successor_ == NULL); | 2245 ASSERT(successor_ == NULL); |
| 2246 } | 2246 } |
| 2247 | 2247 |
| 2248 virtual LocationSummary* MakeLocationSummary() const; | 2248 virtual LocationSummary* MakeLocationSummary() const; |
| 2249 | 2249 |
| 2250 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2250 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2251 | 2251 |
| 2252 private: | 2252 private: |
| 2253 const intptr_t token_index_; | 2253 const intptr_t token_pos_; |
| 2254 const intptr_t try_index_; | 2254 const intptr_t try_index_; |
| 2255 Value* exception_; | 2255 Value* exception_; |
| 2256 Instruction* successor_; | 2256 Instruction* successor_; |
| 2257 | 2257 |
| 2258 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 2258 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 2259 }; | 2259 }; |
| 2260 | 2260 |
| 2261 | 2261 |
| 2262 class ReThrowInstr : public InstructionWithInputs { | 2262 class ReThrowInstr : public InstructionWithInputs { |
| 2263 public: | 2263 public: |
| 2264 ReThrowInstr(intptr_t token_index, | 2264 ReThrowInstr(intptr_t token_pos, |
| 2265 intptr_t try_index, | 2265 intptr_t try_index, |
| 2266 Value* exception, | 2266 Value* exception, |
| 2267 Value* stack_trace) | 2267 Value* stack_trace) |
| 2268 : InstructionWithInputs(), | 2268 : InstructionWithInputs(), |
| 2269 token_index_(token_index), | 2269 token_pos_(token_pos), |
| 2270 try_index_(try_index), | 2270 try_index_(try_index), |
| 2271 exception_(exception), | 2271 exception_(exception), |
| 2272 stack_trace_(stack_trace), | 2272 stack_trace_(stack_trace), |
| 2273 successor_(NULL) { | 2273 successor_(NULL) { |
| 2274 ASSERT(exception_ != NULL); | 2274 ASSERT(exception_ != NULL); |
| 2275 ASSERT(stack_trace_ != NULL); | 2275 ASSERT(stack_trace_ != NULL); |
| 2276 } | 2276 } |
| 2277 | 2277 |
| 2278 DECLARE_INSTRUCTION(ReThrow) | 2278 DECLARE_INSTRUCTION(ReThrow) |
| 2279 | 2279 |
| 2280 intptr_t token_index() const { return token_index_; } | 2280 intptr_t token_pos() const { return token_pos_; } |
| 2281 intptr_t try_index() const { return try_index_; } | 2281 intptr_t try_index() const { return try_index_; } |
| 2282 Value* exception() const { return exception_; } | 2282 Value* exception() const { return exception_; } |
| 2283 Value* stack_trace() const { return stack_trace_; } | 2283 Value* stack_trace() const { return stack_trace_; } |
| 2284 | 2284 |
| 2285 // Parser can generate a rethrow within an expression tree. We | 2285 // Parser can generate a rethrow within an expression tree. We |
| 2286 // never add successor instructions to the graph. | 2286 // never add successor instructions to the graph. |
| 2287 virtual Instruction* StraightLineSuccessor() const { | 2287 virtual Instruction* StraightLineSuccessor() const { |
| 2288 return NULL; | 2288 return NULL; |
| 2289 } | 2289 } |
| 2290 virtual void SetSuccessor(Instruction* instr) { | 2290 virtual void SetSuccessor(Instruction* instr) { |
| 2291 ASSERT(successor_ == NULL); | 2291 ASSERT(successor_ == NULL); |
| 2292 } | 2292 } |
| 2293 | 2293 |
| 2294 virtual LocationSummary* MakeLocationSummary() const; | 2294 virtual LocationSummary* MakeLocationSummary() const; |
| 2295 | 2295 |
| 2296 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 2296 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 2297 | 2297 |
| 2298 private: | 2298 private: |
| 2299 const intptr_t token_index_; | 2299 const intptr_t token_pos_; |
| 2300 const intptr_t try_index_; | 2300 const intptr_t try_index_; |
| 2301 Value* exception_; | 2301 Value* exception_; |
| 2302 Value* stack_trace_; | 2302 Value* stack_trace_; |
| 2303 Instruction* successor_; | 2303 Instruction* successor_; |
| 2304 | 2304 |
| 2305 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 2305 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 2306 }; | 2306 }; |
| 2307 | 2307 |
| 2308 | 2308 |
| 2309 class BranchInstr : public InstructionWithInputs { | 2309 class BranchInstr : public InstructionWithInputs { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2429 const GrowableArray<BlockEntryInstr*>& block_order_; | 2429 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 2430 | 2430 |
| 2431 private: | 2431 private: |
| 2432 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 2432 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 2433 }; | 2433 }; |
| 2434 | 2434 |
| 2435 | 2435 |
| 2436 } // namespace dart | 2436 } // namespace dart |
| 2437 | 2437 |
| 2438 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 2438 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |