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 #include "src/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 void LCodeGen::WriteTranslation(LEnvironment* environment, | 593 void LCodeGen::WriteTranslation(LEnvironment* environment, |
594 Translation* translation) { | 594 Translation* translation) { |
595 if (environment == NULL) return; | 595 if (environment == NULL) return; |
596 | 596 |
597 // The translation includes one command per value in the environment. | 597 // The translation includes one command per value in the environment. |
598 int translation_size = environment->translation_size(); | 598 int translation_size = environment->translation_size(); |
599 // The output frame height does not include the parameters. | 599 // The output frame height does not include the parameters. |
600 int height = translation_size - environment->parameter_count(); | 600 int height = translation_size - environment->parameter_count(); |
601 | 601 |
602 WriteTranslation(environment->outer(), translation); | 602 WriteTranslation(environment->outer(), translation); |
603 bool has_closure_id = !info()->closure().is_null() && | |
604 !info()->closure().is_identical_to(environment->closure()); | |
605 int closure_id = has_closure_id | |
606 ? DefineDeoptimizationLiteral(environment->closure()) | |
607 : Translation::kSelfLiteralId; | |
608 | 603 |
609 switch (environment->frame_type()) { | 604 switch (environment->frame_type()) { |
610 case JS_FUNCTION: | 605 case JS_FUNCTION: { |
611 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 606 int shared_id = DefineDeoptimizationLiteral( |
| 607 environment->entry() ? environment->entry()->shared() |
| 608 : info()->shared_info()); |
| 609 translation->BeginJSFrame(environment->ast_id(), shared_id, height); |
| 610 if (info()->closure().is_identical_to(environment->closure())) { |
| 611 translation->StoreJSFrameFunction(); |
| 612 } else { |
| 613 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 614 translation->StoreLiteral(closure_id); |
| 615 } |
612 break; | 616 break; |
613 case JS_CONSTRUCT: | 617 } |
614 translation->BeginConstructStubFrame(closure_id, translation_size); | 618 case JS_CONSTRUCT: { |
| 619 int shared_id = DefineDeoptimizationLiteral( |
| 620 environment->entry() ? environment->entry()->shared() |
| 621 : info()->shared_info()); |
| 622 translation->BeginConstructStubFrame(shared_id, translation_size); |
| 623 if (info()->closure().is_identical_to(environment->closure())) { |
| 624 translation->StoreJSFrameFunction(); |
| 625 } else { |
| 626 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 627 translation->StoreLiteral(closure_id); |
| 628 } |
615 break; | 629 break; |
616 case JS_GETTER: | 630 } |
| 631 case JS_GETTER: { |
617 DCHECK(translation_size == 1); | 632 DCHECK(translation_size == 1); |
618 DCHECK(height == 0); | 633 DCHECK(height == 0); |
619 translation->BeginGetterStubFrame(closure_id); | 634 int shared_id = DefineDeoptimizationLiteral( |
| 635 environment->entry() ? environment->entry()->shared() |
| 636 : info()->shared_info()); |
| 637 translation->BeginGetterStubFrame(shared_id); |
| 638 if (info()->closure().is_identical_to(environment->closure())) { |
| 639 translation->StoreJSFrameFunction(); |
| 640 } else { |
| 641 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 642 translation->StoreLiteral(closure_id); |
| 643 } |
620 break; | 644 break; |
621 case JS_SETTER: | 645 } |
| 646 case JS_SETTER: { |
622 DCHECK(translation_size == 2); | 647 DCHECK(translation_size == 2); |
623 DCHECK(height == 0); | 648 DCHECK(height == 0); |
624 translation->BeginSetterStubFrame(closure_id); | 649 int shared_id = DefineDeoptimizationLiteral( |
| 650 environment->entry() ? environment->entry()->shared() |
| 651 : info()->shared_info()); |
| 652 translation->BeginSetterStubFrame(shared_id); |
| 653 if (info()->closure().is_identical_to(environment->closure())) { |
| 654 translation->StoreJSFrameFunction(); |
| 655 } else { |
| 656 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 657 translation->StoreLiteral(closure_id); |
| 658 } |
625 break; | 659 break; |
| 660 } |
| 661 case ARGUMENTS_ADAPTOR: { |
| 662 int shared_id = DefineDeoptimizationLiteral( |
| 663 environment->entry() ? environment->entry()->shared() |
| 664 : info()->shared_info()); |
| 665 translation->BeginArgumentsAdaptorFrame(shared_id, translation_size); |
| 666 if (info()->closure().is_identical_to(environment->closure())) { |
| 667 translation->StoreJSFrameFunction(); |
| 668 } else { |
| 669 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 670 translation->StoreLiteral(closure_id); |
| 671 } |
| 672 break; |
| 673 } |
626 case STUB: | 674 case STUB: |
627 translation->BeginCompiledStubFrame(translation_size); | 675 translation->BeginCompiledStubFrame(translation_size); |
628 break; | 676 break; |
629 case ARGUMENTS_ADAPTOR: | |
630 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | |
631 break; | |
632 } | 677 } |
633 | 678 |
634 int object_index = 0; | 679 int object_index = 0; |
635 int dematerialized_index = 0; | 680 int dematerialized_index = 0; |
636 for (int i = 0; i < translation_size; ++i) { | 681 for (int i = 0; i < translation_size; ++i) { |
637 LOperand* value = environment->values()->at(i); | 682 LOperand* value = environment->values()->at(i); |
638 AddToTranslation(environment, | 683 AddToTranslation( |
639 translation, | 684 environment, translation, value, environment->HasTaggedValueAt(i), |
640 value, | 685 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); |
641 environment->HasTaggedValueAt(i), | |
642 environment->HasUint32ValueAt(i), | |
643 &object_index, | |
644 &dematerialized_index); | |
645 } | 686 } |
646 } | 687 } |
647 | 688 |
648 | 689 |
649 void LCodeGen::AddToTranslation(LEnvironment* environment, | 690 void LCodeGen::AddToTranslation(LEnvironment* environment, |
650 Translation* translation, | 691 Translation* translation, |
651 LOperand* op, | 692 LOperand* op, |
652 bool is_tagged, | 693 bool is_tagged, |
653 bool is_uint32, | 694 bool is_uint32, |
654 int* object_index_pointer, | 695 int* object_index_pointer, |
(...skipping 5350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6005 __ push(ToRegister(instr->function())); | 6046 __ push(ToRegister(instr->function())); |
6006 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6047 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6007 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6048 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6008 } | 6049 } |
6009 | 6050 |
6010 | 6051 |
6011 #undef __ | 6052 #undef __ |
6012 | 6053 |
6013 } // namespace internal | 6054 } // namespace internal |
6014 } // namespace v8 | 6055 } // namespace v8 |
OLD | NEW |