| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
| 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 void LCodeGen::WriteTranslation(LEnvironment* environment, | 591 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 592 Translation* translation) { | 592 Translation* translation) { |
| 593 if (environment == NULL) return; | 593 if (environment == NULL) return; |
| 594 | 594 |
| 595 // The translation includes one command per value in the environment. | 595 // The translation includes one command per value in the environment. |
| 596 int translation_size = environment->translation_size(); | 596 int translation_size = environment->translation_size(); |
| 597 // The output frame height does not include the parameters. | 597 // The output frame height does not include the parameters. |
| 598 int height = translation_size - environment->parameter_count(); | 598 int height = translation_size - environment->parameter_count(); |
| 599 | 599 |
| 600 WriteTranslation(environment->outer(), translation); | 600 WriteTranslation(environment->outer(), translation); |
| 601 bool has_closure_id = !info()->closure().is_null() && | |
| 602 !info()->closure().is_identical_to(environment->closure()); | |
| 603 int closure_id = has_closure_id | |
| 604 ? DefineDeoptimizationLiteral(environment->closure()) | |
| 605 : Translation::kSelfLiteralId; | |
| 606 | 601 |
| 607 switch (environment->frame_type()) { | 602 switch (environment->frame_type()) { |
| 608 case JS_FUNCTION: | 603 case JS_FUNCTION: { |
| 609 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 604 int shared_id = DefineDeoptimizationLiteral( |
| 605 environment->entry() ? environment->entry()->shared() |
| 606 : info()->shared_info()); |
| 607 translation->BeginJSFrame(environment->ast_id(), shared_id, height); |
| 608 if (info()->closure().is_identical_to(environment->closure())) { |
| 609 translation->StoreJSFrameFunction(); |
| 610 } else { |
| 611 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 612 translation->StoreLiteral(closure_id); |
| 613 } |
| 610 break; | 614 break; |
| 611 case JS_CONSTRUCT: | 615 } |
| 612 translation->BeginConstructStubFrame(closure_id, translation_size); | 616 case JS_CONSTRUCT: { |
| 617 int shared_id = DefineDeoptimizationLiteral( |
| 618 environment->entry() ? environment->entry()->shared() |
| 619 : info()->shared_info()); |
| 620 translation->BeginConstructStubFrame(shared_id, translation_size); |
| 621 if (info()->closure().is_identical_to(environment->closure())) { |
| 622 translation->StoreJSFrameFunction(); |
| 623 } else { |
| 624 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 625 translation->StoreLiteral(closure_id); |
| 626 } |
| 613 break; | 627 break; |
| 614 case JS_GETTER: | 628 } |
| 629 case JS_GETTER: { |
| 615 DCHECK(translation_size == 1); | 630 DCHECK(translation_size == 1); |
| 616 DCHECK(height == 0); | 631 DCHECK(height == 0); |
| 617 translation->BeginGetterStubFrame(closure_id); | 632 int shared_id = DefineDeoptimizationLiteral( |
| 633 environment->entry() ? environment->entry()->shared() |
| 634 : info()->shared_info()); |
| 635 translation->BeginGetterStubFrame(shared_id); |
| 636 if (info()->closure().is_identical_to(environment->closure())) { |
| 637 translation->StoreJSFrameFunction(); |
| 638 } else { |
| 639 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 640 translation->StoreLiteral(closure_id); |
| 641 } |
| 618 break; | 642 break; |
| 619 case JS_SETTER: | 643 } |
| 644 case JS_SETTER: { |
| 620 DCHECK(translation_size == 2); | 645 DCHECK(translation_size == 2); |
| 621 DCHECK(height == 0); | 646 DCHECK(height == 0); |
| 622 translation->BeginSetterStubFrame(closure_id); | 647 int shared_id = DefineDeoptimizationLiteral( |
| 648 environment->entry() ? environment->entry()->shared() |
| 649 : info()->shared_info()); |
| 650 translation->BeginSetterStubFrame(shared_id); |
| 651 if (info()->closure().is_identical_to(environment->closure())) { |
| 652 translation->StoreJSFrameFunction(); |
| 653 } else { |
| 654 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 655 translation->StoreLiteral(closure_id); |
| 656 } |
| 623 break; | 657 break; |
| 658 } |
| 659 case ARGUMENTS_ADAPTOR: { |
| 660 int shared_id = DefineDeoptimizationLiteral( |
| 661 environment->entry() ? environment->entry()->shared() |
| 662 : info()->shared_info()); |
| 663 translation->BeginArgumentsAdaptorFrame(shared_id, translation_size); |
| 664 if (info()->closure().is_identical_to(environment->closure())) { |
| 665 translation->StoreJSFrameFunction(); |
| 666 } else { |
| 667 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 668 translation->StoreLiteral(closure_id); |
| 669 } |
| 670 break; |
| 671 } |
| 624 case STUB: | 672 case STUB: |
| 625 translation->BeginCompiledStubFrame(translation_size); | 673 translation->BeginCompiledStubFrame(translation_size); |
| 626 break; | 674 break; |
| 627 case ARGUMENTS_ADAPTOR: | |
| 628 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | |
| 629 break; | |
| 630 } | 675 } |
| 631 | 676 |
| 632 int object_index = 0; | 677 int object_index = 0; |
| 633 int dematerialized_index = 0; | 678 int dematerialized_index = 0; |
| 634 for (int i = 0; i < translation_size; ++i) { | 679 for (int i = 0; i < translation_size; ++i) { |
| 635 LOperand* value = environment->values()->at(i); | 680 LOperand* value = environment->values()->at(i); |
| 636 AddToTranslation(environment, | 681 AddToTranslation( |
| 637 translation, | 682 environment, translation, value, environment->HasTaggedValueAt(i), |
| 638 value, | 683 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); |
| 639 environment->HasTaggedValueAt(i), | |
| 640 environment->HasUint32ValueAt(i), | |
| 641 &object_index, | |
| 642 &dematerialized_index); | |
| 643 } | 684 } |
| 644 } | 685 } |
| 645 | 686 |
| 646 | 687 |
| 647 void LCodeGen::AddToTranslation(LEnvironment* environment, | 688 void LCodeGen::AddToTranslation(LEnvironment* environment, |
| 648 Translation* translation, | 689 Translation* translation, |
| 649 LOperand* op, | 690 LOperand* op, |
| 650 bool is_tagged, | 691 bool is_tagged, |
| 651 bool is_uint32, | 692 bool is_uint32, |
| 652 int* object_index_pointer, | 693 int* object_index_pointer, |
| (...skipping 5404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6057 __ Push(at, ToRegister(instr->function())); | 6098 __ Push(at, ToRegister(instr->function())); |
| 6058 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6099 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6059 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6100 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6060 } | 6101 } |
| 6061 | 6102 |
| 6062 | 6103 |
| 6063 #undef __ | 6104 #undef __ |
| 6064 | 6105 |
| 6065 } // namespace internal | 6106 } // namespace internal |
| 6066 } // namespace v8 | 6107 } // namespace v8 |
| OLD | NEW |