Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 16996004: Rollback of r15097, r15087 in trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/data-flow.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 573 }
574 574
575 575
576 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const { 576 MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
577 ASSERT(op->IsDoubleStackSlot()); 577 ASSERT(op->IsDoubleStackSlot());
578 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize); 578 return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize);
579 } 579 }
580 580
581 581
582 void LCodeGen::WriteTranslation(LEnvironment* environment, 582 void LCodeGen::WriteTranslation(LEnvironment* environment,
583 Translation* translation) { 583 Translation* translation,
584 int* pushed_arguments_index,
585 int* pushed_arguments_count) {
584 if (environment == NULL) return; 586 if (environment == NULL) return;
585 587
586 // The translation includes one command per value in the environment. 588 // The translation includes one command per value in the environment.
587 int translation_size = environment->translation_size(); 589 int translation_size = environment->values()->length();
588 // The output frame height does not include the parameters. 590 // The output frame height does not include the parameters.
589 int height = translation_size - environment->parameter_count(); 591 int height = translation_size - environment->parameter_count();
590 592
591 WriteTranslation(environment->outer(), translation); 593 // Function parameters are arguments to the outermost environment. The
594 // arguments index points to the first element of a sequence of tagged
595 // values on the stack that represent the arguments. This needs to be
596 // kept in sync with the LArgumentsElements implementation.
597 *pushed_arguments_index = -environment->parameter_count();
598 *pushed_arguments_count = environment->parameter_count();
599
600 WriteTranslation(environment->outer(),
601 translation,
602 pushed_arguments_index,
603 pushed_arguments_count);
592 bool has_closure_id = !info()->closure().is_null() && 604 bool has_closure_id = !info()->closure().is_null() &&
593 !info()->closure().is_identical_to(environment->closure()); 605 !info()->closure().is_identical_to(environment->closure());
594 int closure_id = has_closure_id 606 int closure_id = has_closure_id
595 ? DefineDeoptimizationLiteral(environment->closure()) 607 ? DefineDeoptimizationLiteral(environment->closure())
596 : Translation::kSelfLiteralId; 608 : Translation::kSelfLiteralId;
597 609
598 switch (environment->frame_type()) { 610 switch (environment->frame_type()) {
599 case JS_FUNCTION: 611 case JS_FUNCTION:
600 translation->BeginJSFrame(environment->ast_id(), closure_id, height); 612 translation->BeginJSFrame(environment->ast_id(), closure_id, height);
601 break; 613 break;
(...skipping 11 matching lines...) Expand all
613 translation->BeginSetterStubFrame(closure_id); 625 translation->BeginSetterStubFrame(closure_id);
614 break; 626 break;
615 case STUB: 627 case STUB:
616 translation->BeginCompiledStubFrame(); 628 translation->BeginCompiledStubFrame();
617 break; 629 break;
618 case ARGUMENTS_ADAPTOR: 630 case ARGUMENTS_ADAPTOR:
619 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); 631 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size);
620 break; 632 break;
621 } 633 }
622 634
635 // Inlined frames which push their arguments cause the index to be
636 // bumped and another stack area to be used for materialization,
637 // otherwise actual argument values are unknown for inlined frames.
638 bool arguments_known = true;
639 int arguments_index = *pushed_arguments_index;
640 int arguments_count = *pushed_arguments_count;
641 if (environment->entry() != NULL) {
642 arguments_known = environment->entry()->arguments_pushed();
643 arguments_index = arguments_index < 0
644 ? GetStackSlotCount() : arguments_index + arguments_count;
645 arguments_count = environment->entry()->arguments_count() + 1;
646 if (environment->entry()->arguments_pushed()) {
647 *pushed_arguments_index = arguments_index;
648 *pushed_arguments_count = arguments_count;
649 }
650 }
651
623 for (int i = 0; i < translation_size; ++i) { 652 for (int i = 0; i < translation_size; ++i) {
624 LOperand* value = environment->values()->at(i); 653 LOperand* value = environment->values()->at(i);
625 // spilled_registers_ and spilled_double_registers_ are either 654 // spilled_registers_ and spilled_double_registers_ are either
626 // both NULL or both set. 655 // both NULL or both set.
627 if (environment->spilled_registers() != NULL && value != NULL) { 656 if (environment->spilled_registers() != NULL && value != NULL) {
628 if (value->IsRegister() && 657 if (value->IsRegister() &&
629 environment->spilled_registers()[value->index()] != NULL) { 658 environment->spilled_registers()[value->index()] != NULL) {
630 translation->MarkDuplicate(); 659 translation->MarkDuplicate();
631 AddToTranslation(translation, 660 AddToTranslation(translation,
632 environment->spilled_registers()[value->index()], 661 environment->spilled_registers()[value->index()],
633 environment->HasTaggedValueAt(i), 662 environment->HasTaggedValueAt(i),
634 environment->HasUint32ValueAt(i)); 663 environment->HasUint32ValueAt(i),
664 arguments_known,
665 arguments_index,
666 arguments_count);
635 } else if ( 667 } else if (
636 value->IsDoubleRegister() && 668 value->IsDoubleRegister() &&
637 environment->spilled_double_registers()[value->index()] != NULL) { 669 environment->spilled_double_registers()[value->index()] != NULL) {
638 translation->MarkDuplicate(); 670 translation->MarkDuplicate();
639 AddToTranslation( 671 AddToTranslation(
640 translation, 672 translation,
641 environment->spilled_double_registers()[value->index()], 673 environment->spilled_double_registers()[value->index()],
642 false, 674 false,
643 false); 675 false,
676 arguments_known,
677 arguments_index,
678 arguments_count);
644 } 679 }
645 } 680 }
646 681
647 // TODO(mstarzinger): Introduce marker operands to indicate that this value
648 // is not present and must be reconstructed from the deoptimizer. Currently
649 // this is only used for the arguments object.
650 if (value == NULL) {
651 int arguments_count = environment->values()->length() - translation_size;
652 translation->BeginArgumentsObject(arguments_count);
653 for (int i = 0; i < arguments_count; ++i) {
654 LOperand* value = environment->values()->at(translation_size + i);
655 ASSERT(environment->spilled_registers() == NULL ||
656 !value->IsRegister() ||
657 environment->spilled_registers()[value->index()] == NULL);
658 ASSERT(environment->spilled_registers() == NULL ||
659 !value->IsDoubleRegister() ||
660 environment->spilled_double_registers()[value->index()] == NULL);
661 AddToTranslation(translation,
662 value,
663 environment->HasTaggedValueAt(translation_size + i),
664 environment->HasUint32ValueAt(translation_size + i));
665 }
666 continue;
667 }
668
669 AddToTranslation(translation, 682 AddToTranslation(translation,
670 value, 683 value,
671 environment->HasTaggedValueAt(i), 684 environment->HasTaggedValueAt(i),
672 environment->HasUint32ValueAt(i)); 685 environment->HasUint32ValueAt(i),
686 arguments_known,
687 arguments_index,
688 arguments_count);
673 } 689 }
674 } 690 }
675 691
676 692
677 void LCodeGen::AddToTranslation(Translation* translation, 693 void LCodeGen::AddToTranslation(Translation* translation,
678 LOperand* op, 694 LOperand* op,
679 bool is_tagged, 695 bool is_tagged,
680 bool is_uint32) { 696 bool is_uint32,
681 if (op->IsStackSlot()) { 697 bool arguments_known,
698 int arguments_index,
699 int arguments_count) {
700 if (op == NULL) {
701 // TODO(twuerthinger): Introduce marker operands to indicate that this value
702 // is not present and must be reconstructed from the deoptimizer. Currently
703 // this is only used for the arguments object.
704 translation->StoreArgumentsObject(
705 arguments_known, arguments_index, arguments_count);
706 } else if (op->IsStackSlot()) {
682 if (is_tagged) { 707 if (is_tagged) {
683 translation->StoreStackSlot(op->index()); 708 translation->StoreStackSlot(op->index());
684 } else if (is_uint32) { 709 } else if (is_uint32) {
685 translation->StoreUint32StackSlot(op->index()); 710 translation->StoreUint32StackSlot(op->index());
686 } else { 711 } else {
687 translation->StoreInt32StackSlot(op->index()); 712 translation->StoreInt32StackSlot(op->index());
688 } 713 }
689 } else if (op->IsDoubleStackSlot()) { 714 } else if (op->IsDoubleStackSlot()) {
690 translation->StoreDoubleStackSlot(op->index()); 715 translation->StoreDoubleStackSlot(op->index());
691 } else if (op->IsArgument()) { 716 } else if (op->IsArgument()) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 // 0 ..................................................... size-1 803 // 0 ..................................................... size-1
779 // [parameters] [locals] [expression stack including arguments] 804 // [parameters] [locals] [expression stack including arguments]
780 805
781 // Layout of the translation: 806 // Layout of the translation:
782 // 0 ........................................................ size - 1 + 4 807 // 0 ........................................................ size - 1 + 4
783 // [expression stack including arguments] [locals] [4 words] [parameters] 808 // [expression stack including arguments] [locals] [4 words] [parameters]
784 // |>------------ translation_size ------------<| 809 // |>------------ translation_size ------------<|
785 810
786 int frame_count = 0; 811 int frame_count = 0;
787 int jsframe_count = 0; 812 int jsframe_count = 0;
813 int args_index = 0;
814 int args_count = 0;
788 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { 815 for (LEnvironment* e = environment; e != NULL; e = e->outer()) {
789 ++frame_count; 816 ++frame_count;
790 if (e->frame_type() == JS_FUNCTION) { 817 if (e->frame_type() == JS_FUNCTION) {
791 ++jsframe_count; 818 ++jsframe_count;
792 } 819 }
793 } 820 }
794 Translation translation(&translations_, frame_count, jsframe_count, zone()); 821 Translation translation(&translations_, frame_count, jsframe_count, zone());
795 WriteTranslation(environment, &translation); 822 WriteTranslation(environment, &translation, &args_index, &args_count);
796 int deoptimization_index = deoptimizations_.length(); 823 int deoptimization_index = deoptimizations_.length();
797 int pc_offset = masm()->pc_offset(); 824 int pc_offset = masm()->pc_offset();
798 environment->Register(deoptimization_index, 825 environment->Register(deoptimization_index,
799 translation.index(), 826 translation.index(),
800 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); 827 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
801 deoptimizations_.Add(environment, zone()); 828 deoptimizations_.Add(environment, zone());
802 } 829 }
803 } 830 }
804 831
805 832
(...skipping 5074 matching lines...) Expand 10 before | Expand all | Expand 10 after
5880 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5907 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5881 __ ldr(result, FieldMemOperand(scratch, 5908 __ ldr(result, FieldMemOperand(scratch,
5882 FixedArray::kHeaderSize - kPointerSize)); 5909 FixedArray::kHeaderSize - kPointerSize));
5883 __ bind(&done); 5910 __ bind(&done);
5884 } 5911 }
5885 5912
5886 5913
5887 #undef __ 5914 #undef __
5888 5915
5889 } } // namespace v8::internal 5916 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/data-flow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698