OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 void LCodeGen::WriteTranslation(LEnvironment* environment, | 615 void LCodeGen::WriteTranslation(LEnvironment* environment, |
616 Translation* translation) { | 616 Translation* translation) { |
617 if (environment == NULL) return; | 617 if (environment == NULL) return; |
618 | 618 |
619 // The translation includes one command per value in the environment. | 619 // The translation includes one command per value in the environment. |
620 int translation_size = environment->translation_size(); | 620 int translation_size = environment->translation_size(); |
621 // The output frame height does not include the parameters. | 621 // The output frame height does not include the parameters. |
622 int height = translation_size - environment->parameter_count(); | 622 int height = translation_size - environment->parameter_count(); |
623 | 623 |
624 WriteTranslation(environment->outer(), translation); | 624 WriteTranslation(environment->outer(), translation); |
625 bool has_closure_id = !info()->closure().is_null() && | 625 |
626 !info()->closure().is_identical_to(environment->closure()); | |
627 int closure_id = has_closure_id | |
628 ? DefineDeoptimizationLiteral(environment->closure()) | |
629 : Translation::kSelfLiteralId; | |
630 switch (environment->frame_type()) { | 626 switch (environment->frame_type()) { |
631 case JS_FUNCTION: | 627 case JS_FUNCTION: { |
632 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 628 int shared_id = DefineDeoptimizationLiteral( |
| 629 environment->entry() ? environment->entry()->shared() |
| 630 : info()->shared_info()); |
| 631 translation->BeginJSFrame(environment->ast_id(), shared_id, height); |
| 632 if (info()->closure().is_identical_to(environment->closure())) { |
| 633 translation->StoreJSFrameFunction(); |
| 634 } else { |
| 635 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 636 translation->StoreLiteral(closure_id); |
| 637 } |
633 break; | 638 break; |
634 case JS_CONSTRUCT: | 639 } |
635 translation->BeginConstructStubFrame(closure_id, translation_size); | 640 case JS_CONSTRUCT: { |
| 641 int shared_id = DefineDeoptimizationLiteral( |
| 642 environment->entry() ? environment->entry()->shared() |
| 643 : info()->shared_info()); |
| 644 translation->BeginConstructStubFrame(shared_id, translation_size); |
| 645 if (info()->closure().is_identical_to(environment->closure())) { |
| 646 translation->StoreJSFrameFunction(); |
| 647 } else { |
| 648 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 649 translation->StoreLiteral(closure_id); |
| 650 } |
636 break; | 651 break; |
637 case JS_GETTER: | 652 } |
| 653 case JS_GETTER: { |
638 DCHECK(translation_size == 1); | 654 DCHECK(translation_size == 1); |
639 DCHECK(height == 0); | 655 DCHECK(height == 0); |
640 translation->BeginGetterStubFrame(closure_id); | 656 int shared_id = DefineDeoptimizationLiteral( |
| 657 environment->entry() ? environment->entry()->shared() |
| 658 : info()->shared_info()); |
| 659 translation->BeginGetterStubFrame(shared_id); |
| 660 if (info()->closure().is_identical_to(environment->closure())) { |
| 661 translation->StoreJSFrameFunction(); |
| 662 } else { |
| 663 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 664 translation->StoreLiteral(closure_id); |
| 665 } |
641 break; | 666 break; |
642 case JS_SETTER: | 667 } |
| 668 case JS_SETTER: { |
643 DCHECK(translation_size == 2); | 669 DCHECK(translation_size == 2); |
644 DCHECK(height == 0); | 670 DCHECK(height == 0); |
645 translation->BeginSetterStubFrame(closure_id); | 671 int shared_id = DefineDeoptimizationLiteral( |
| 672 environment->entry() ? environment->entry()->shared() |
| 673 : info()->shared_info()); |
| 674 translation->BeginSetterStubFrame(shared_id); |
| 675 if (info()->closure().is_identical_to(environment->closure())) { |
| 676 translation->StoreJSFrameFunction(); |
| 677 } else { |
| 678 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 679 translation->StoreLiteral(closure_id); |
| 680 } |
646 break; | 681 break; |
647 case ARGUMENTS_ADAPTOR: | 682 } |
648 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 683 case ARGUMENTS_ADAPTOR: { |
| 684 int shared_id = DefineDeoptimizationLiteral( |
| 685 environment->entry() ? environment->entry()->shared() |
| 686 : info()->shared_info()); |
| 687 translation->BeginArgumentsAdaptorFrame(shared_id, translation_size); |
| 688 if (info()->closure().is_identical_to(environment->closure())) { |
| 689 translation->StoreJSFrameFunction(); |
| 690 } else { |
| 691 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 692 translation->StoreLiteral(closure_id); |
| 693 } |
649 break; | 694 break; |
| 695 } |
650 case STUB: | 696 case STUB: |
651 translation->BeginCompiledStubFrame(translation_size); | 697 translation->BeginCompiledStubFrame(translation_size); |
652 break; | 698 break; |
653 default: | |
654 UNREACHABLE(); | |
655 } | 699 } |
656 | 700 |
657 int object_index = 0; | 701 int object_index = 0; |
658 int dematerialized_index = 0; | 702 int dematerialized_index = 0; |
659 for (int i = 0; i < translation_size; ++i) { | 703 for (int i = 0; i < translation_size; ++i) { |
660 LOperand* value = environment->values()->at(i); | 704 LOperand* value = environment->values()->at(i); |
661 AddToTranslation(environment, | 705 AddToTranslation( |
662 translation, | 706 environment, translation, value, environment->HasTaggedValueAt(i), |
663 value, | 707 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); |
664 environment->HasTaggedValueAt(i), | |
665 environment->HasUint32ValueAt(i), | |
666 &object_index, | |
667 &dematerialized_index); | |
668 } | 708 } |
669 } | 709 } |
670 | 710 |
671 | 711 |
672 void LCodeGen::AddToTranslation(LEnvironment* environment, | 712 void LCodeGen::AddToTranslation(LEnvironment* environment, |
673 Translation* translation, | 713 Translation* translation, |
674 LOperand* op, | 714 LOperand* op, |
675 bool is_tagged, | 715 bool is_tagged, |
676 bool is_uint32, | 716 bool is_uint32, |
677 int* object_index_pointer, | 717 int* object_index_pointer, |
(...skipping 5151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5829 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5869 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5830 } | 5870 } |
5831 | 5871 |
5832 | 5872 |
5833 #undef __ | 5873 #undef __ |
5834 | 5874 |
5835 } // namespace internal | 5875 } // namespace internal |
5836 } // namespace v8 | 5876 } // namespace v8 |
5837 | 5877 |
5838 #endif // V8_TARGET_ARCH_IA32 | 5878 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |