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

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

Issue 12335132: Fix materialization of arguments objects with unknown values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Sven Panne. Created 7 years, 9 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/ia32/lithium-codegen-ia32.h ('k') | src/objects.cc » ('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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 561
562 562
563 Operand LCodeGen::HighOperand(LOperand* op) { 563 Operand LCodeGen::HighOperand(LOperand* op) {
564 ASSERT(op->IsDoubleStackSlot()); 564 ASSERT(op->IsDoubleStackSlot());
565 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize); 565 return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize);
566 } 566 }
567 567
568 568
569 void LCodeGen::WriteTranslation(LEnvironment* environment, 569 void LCodeGen::WriteTranslation(LEnvironment* environment,
570 Translation* translation, 570 Translation* translation,
571 int* arguments_index, 571 int* pushed_arguments_index,
572 int* arguments_count) { 572 int* pushed_arguments_count) {
573 if (environment == NULL) return; 573 if (environment == NULL) return;
574 574
575 // The translation includes one command per value in the environment. 575 // The translation includes one command per value in the environment.
576 int translation_size = environment->values()->length(); 576 int translation_size = environment->values()->length();
577 // The output frame height does not include the parameters. 577 // The output frame height does not include the parameters.
578 int height = translation_size - environment->parameter_count(); 578 int height = translation_size - environment->parameter_count();
579 579
580 // Function parameters are arguments to the outermost environment. The 580 // Function parameters are arguments to the outermost environment. The
581 // arguments index points to the first element of a sequence of tagged 581 // arguments index points to the first element of a sequence of tagged
582 // values on the stack that represent the arguments. This needs to be 582 // values on the stack that represent the arguments. This needs to be
583 // kept in sync with the LArgumentsElements implementation. 583 // kept in sync with the LArgumentsElements implementation.
584 *arguments_index = -environment->parameter_count(); 584 *pushed_arguments_index = -environment->parameter_count();
585 *arguments_count = environment->parameter_count(); 585 *pushed_arguments_count = environment->parameter_count();
586 586
587 WriteTranslation(environment->outer(), 587 WriteTranslation(environment->outer(),
588 translation, 588 translation,
589 arguments_index, 589 pushed_arguments_index,
590 arguments_count); 590 pushed_arguments_count);
591 bool has_closure_id = !info()->closure().is_null() && 591 bool has_closure_id = !info()->closure().is_null() &&
592 *info()->closure() != *environment->closure(); 592 *info()->closure() != *environment->closure();
593 int closure_id = has_closure_id 593 int closure_id = has_closure_id
594 ? DefineDeoptimizationLiteral(environment->closure()) 594 ? DefineDeoptimizationLiteral(environment->closure())
595 : Translation::kSelfLiteralId; 595 : Translation::kSelfLiteralId;
596 switch (environment->frame_type()) { 596 switch (environment->frame_type()) {
597 case JS_FUNCTION: 597 case JS_FUNCTION:
598 translation->BeginJSFrame(environment->ast_id(), closure_id, height); 598 translation->BeginJSFrame(environment->ast_id(), closure_id, height);
599 break; 599 break;
600 case JS_CONSTRUCT: 600 case JS_CONSTRUCT:
(...skipping 13 matching lines...) Expand all
614 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); 614 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size);
615 break; 615 break;
616 case STUB: 616 case STUB:
617 translation->BeginCompiledStubFrame(); 617 translation->BeginCompiledStubFrame();
618 break; 618 break;
619 default: 619 default:
620 UNREACHABLE(); 620 UNREACHABLE();
621 } 621 }
622 622
623 // Inlined frames which push their arguments cause the index to be 623 // Inlined frames which push their arguments cause the index to be
624 // bumped and another stack area to be used for materialization. 624 // bumped and another stack area to be used for materialization,
625 if (environment->entry() != NULL && 625 // otherwise actual argument values are unknown for inlined frames.
626 environment->entry()->arguments_pushed()) { 626 bool arguments_known = true;
627 *arguments_index = *arguments_index < 0 627 int arguments_index = *pushed_arguments_index;
628 ? GetStackSlotCount() 628 int arguments_count = *pushed_arguments_count;
629 : *arguments_index + *arguments_count; 629 if (environment->entry() != NULL) {
630 *arguments_count = environment->entry()->arguments_count() + 1; 630 arguments_known = environment->entry()->arguments_pushed();
631 arguments_index = arguments_index < 0
632 ? GetStackSlotCount() : arguments_index + arguments_count;
633 arguments_count = environment->entry()->arguments_count() + 1;
634 if (environment->entry()->arguments_pushed()) {
635 *pushed_arguments_index = arguments_index;
636 *pushed_arguments_count = arguments_count;
637 }
631 } 638 }
632 639
633 for (int i = 0; i < translation_size; ++i) { 640 for (int i = 0; i < translation_size; ++i) {
634 LOperand* value = environment->values()->at(i); 641 LOperand* value = environment->values()->at(i);
635 // spilled_registers_ and spilled_double_registers_ are either 642 // spilled_registers_ and spilled_double_registers_ are either
636 // both NULL or both set. 643 // both NULL or both set.
637 if (environment->spilled_registers() != NULL && value != NULL) { 644 if (environment->spilled_registers() != NULL && value != NULL) {
638 if (value->IsRegister() && 645 if (value->IsRegister() &&
639 environment->spilled_registers()[value->index()] != NULL) { 646 environment->spilled_registers()[value->index()] != NULL) {
640 translation->MarkDuplicate(); 647 translation->MarkDuplicate();
641 AddToTranslation(translation, 648 AddToTranslation(translation,
642 environment->spilled_registers()[value->index()], 649 environment->spilled_registers()[value->index()],
643 environment->HasTaggedValueAt(i), 650 environment->HasTaggedValueAt(i),
644 environment->HasUint32ValueAt(i), 651 environment->HasUint32ValueAt(i),
645 *arguments_index, 652 arguments_known,
646 *arguments_count); 653 arguments_index,
654 arguments_count);
647 } else if ( 655 } else if (
648 value->IsDoubleRegister() && 656 value->IsDoubleRegister() &&
649 environment->spilled_double_registers()[value->index()] != NULL) { 657 environment->spilled_double_registers()[value->index()] != NULL) {
650 translation->MarkDuplicate(); 658 translation->MarkDuplicate();
651 AddToTranslation( 659 AddToTranslation(
652 translation, 660 translation,
653 environment->spilled_double_registers()[value->index()], 661 environment->spilled_double_registers()[value->index()],
654 false, 662 false,
655 false, 663 false,
656 *arguments_index, 664 arguments_known,
657 *arguments_count); 665 arguments_index,
666 arguments_count);
658 } 667 }
659 } 668 }
660 669
661 AddToTranslation(translation, 670 AddToTranslation(translation,
662 value, 671 value,
663 environment->HasTaggedValueAt(i), 672 environment->HasTaggedValueAt(i),
664 environment->HasUint32ValueAt(i), 673 environment->HasUint32ValueAt(i),
665 *arguments_index, 674 arguments_known,
666 *arguments_count); 675 arguments_index,
676 arguments_count);
667 } 677 }
668 } 678 }
669 679
670 680
671 void LCodeGen::AddToTranslation(Translation* translation, 681 void LCodeGen::AddToTranslation(Translation* translation,
672 LOperand* op, 682 LOperand* op,
673 bool is_tagged, 683 bool is_tagged,
674 bool is_uint32, 684 bool is_uint32,
685 bool arguments_known,
675 int arguments_index, 686 int arguments_index,
676 int arguments_count) { 687 int arguments_count) {
677 if (op == NULL) { 688 if (op == NULL) {
678 // TODO(twuerthinger): Introduce marker operands to indicate that this value 689 // TODO(twuerthinger): Introduce marker operands to indicate that this value
679 // is not present and must be reconstructed from the deoptimizer. Currently 690 // is not present and must be reconstructed from the deoptimizer. Currently
680 // this is only used for the arguments object. 691 // this is only used for the arguments object.
681 translation->StoreArgumentsObject(arguments_index, arguments_count); 692 translation->StoreArgumentsObject(
693 arguments_known, arguments_index, arguments_count);
682 } else if (op->IsStackSlot()) { 694 } else if (op->IsStackSlot()) {
683 if (is_tagged) { 695 if (is_tagged) {
684 translation->StoreStackSlot(op->index()); 696 translation->StoreStackSlot(op->index());
685 } else if (is_uint32) { 697 } else if (is_uint32) {
686 translation->StoreUint32StackSlot(op->index()); 698 translation->StoreUint32StackSlot(op->index());
687 } else { 699 } else {
688 translation->StoreInt32StackSlot(op->index()); 700 translation->StoreInt32StackSlot(op->index());
689 } 701 }
690 } else if (op->IsDoubleStackSlot()) { 702 } else if (op->IsDoubleStackSlot()) {
691 translation->StoreDoubleStackSlot(op->index()); 703 translation->StoreDoubleStackSlot(op->index());
(...skipping 5510 matching lines...) Expand 10 before | Expand all | Expand 10 after
6202 FixedArray::kHeaderSize - kPointerSize)); 6214 FixedArray::kHeaderSize - kPointerSize));
6203 __ bind(&done); 6215 __ bind(&done);
6204 } 6216 }
6205 6217
6206 6218
6207 #undef __ 6219 #undef __
6208 6220
6209 } } // namespace v8::internal 6221 } } // namespace v8::internal
6210 6222
6211 #endif // V8_TARGET_ARCH_IA32 6223 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698