| 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
| 10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 void LCodeGen::WriteTranslation(LEnvironment* environment, | 579 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 580 Translation* translation) { | 580 Translation* translation) { |
| 581 if (environment == NULL) return; | 581 if (environment == NULL) return; |
| 582 | 582 |
| 583 // The translation includes one command per value in the environment. | 583 // The translation includes one command per value in the environment. |
| 584 int translation_size = environment->translation_size(); | 584 int translation_size = environment->translation_size(); |
| 585 // The output frame height does not include the parameters. | 585 // The output frame height does not include the parameters. |
| 586 int height = translation_size - environment->parameter_count(); | 586 int height = translation_size - environment->parameter_count(); |
| 587 | 587 |
| 588 WriteTranslation(environment->outer(), translation); | 588 WriteTranslation(environment->outer(), translation); |
| 589 bool has_closure_id = !info()->closure().is_null() && | |
| 590 !info()->closure().is_identical_to(environment->closure()); | |
| 591 int closure_id = has_closure_id | |
| 592 ? DefineDeoptimizationLiteral(environment->closure()) | |
| 593 : Translation::kSelfLiteralId; | |
| 594 | 589 |
| 595 switch (environment->frame_type()) { | 590 switch (environment->frame_type()) { |
| 596 case JS_FUNCTION: | 591 case JS_FUNCTION: { |
| 597 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 592 int shared_id = DefineDeoptimizationLiteral( |
| 593 environment->entry() ? environment->entry()->shared() |
| 594 : info()->shared_info()); |
| 595 translation->BeginJSFrame(environment->ast_id(), shared_id, height); |
| 596 if (info()->closure().is_identical_to(environment->closure())) { |
| 597 translation->StoreJSFrameFunction(); |
| 598 } else { |
| 599 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 600 translation->StoreLiteral(closure_id); |
| 601 } |
| 598 break; | 602 break; |
| 599 case JS_CONSTRUCT: | 603 } |
| 600 translation->BeginConstructStubFrame(closure_id, translation_size); | 604 case JS_CONSTRUCT: { |
| 605 int shared_id = DefineDeoptimizationLiteral( |
| 606 environment->entry() ? environment->entry()->shared() |
| 607 : info()->shared_info()); |
| 608 translation->BeginConstructStubFrame(shared_id, translation_size); |
| 609 if (info()->closure().is_identical_to(environment->closure())) { |
| 610 translation->StoreJSFrameFunction(); |
| 611 } else { |
| 612 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 613 translation->StoreLiteral(closure_id); |
| 614 } |
| 601 break; | 615 break; |
| 602 case JS_GETTER: | 616 } |
| 617 case JS_GETTER: { |
| 603 DCHECK(translation_size == 1); | 618 DCHECK(translation_size == 1); |
| 604 DCHECK(height == 0); | 619 DCHECK(height == 0); |
| 605 translation->BeginGetterStubFrame(closure_id); | 620 int shared_id = DefineDeoptimizationLiteral( |
| 621 environment->entry() ? environment->entry()->shared() |
| 622 : info()->shared_info()); |
| 623 translation->BeginGetterStubFrame(shared_id); |
| 624 if (info()->closure().is_identical_to(environment->closure())) { |
| 625 translation->StoreJSFrameFunction(); |
| 626 } else { |
| 627 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 628 translation->StoreLiteral(closure_id); |
| 629 } |
| 606 break; | 630 break; |
| 607 case JS_SETTER: | 631 } |
| 632 case JS_SETTER: { |
| 608 DCHECK(translation_size == 2); | 633 DCHECK(translation_size == 2); |
| 609 DCHECK(height == 0); | 634 DCHECK(height == 0); |
| 610 translation->BeginSetterStubFrame(closure_id); | 635 int shared_id = DefineDeoptimizationLiteral( |
| 636 environment->entry() ? environment->entry()->shared() |
| 637 : info()->shared_info()); |
| 638 translation->BeginSetterStubFrame(shared_id); |
| 639 if (info()->closure().is_identical_to(environment->closure())) { |
| 640 translation->StoreJSFrameFunction(); |
| 641 } else { |
| 642 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 643 translation->StoreLiteral(closure_id); |
| 644 } |
| 611 break; | 645 break; |
| 646 } |
| 647 case ARGUMENTS_ADAPTOR: { |
| 648 int shared_id = DefineDeoptimizationLiteral( |
| 649 environment->entry() ? environment->entry()->shared() |
| 650 : info()->shared_info()); |
| 651 translation->BeginArgumentsAdaptorFrame(shared_id, translation_size); |
| 652 if (info()->closure().is_identical_to(environment->closure())) { |
| 653 translation->StoreJSFrameFunction(); |
| 654 } else { |
| 655 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 656 translation->StoreLiteral(closure_id); |
| 657 } |
| 658 break; |
| 659 } |
| 612 case STUB: | 660 case STUB: |
| 613 translation->BeginCompiledStubFrame(translation_size); | 661 translation->BeginCompiledStubFrame(translation_size); |
| 614 break; | 662 break; |
| 615 case ARGUMENTS_ADAPTOR: | |
| 616 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | |
| 617 break; | |
| 618 } | 663 } |
| 619 | 664 |
| 620 int object_index = 0; | 665 int object_index = 0; |
| 621 int dematerialized_index = 0; | 666 int dematerialized_index = 0; |
| 622 for (int i = 0; i < translation_size; ++i) { | 667 for (int i = 0; i < translation_size; ++i) { |
| 623 LOperand* value = environment->values()->at(i); | 668 LOperand* value = environment->values()->at(i); |
| 624 AddToTranslation(environment, | 669 AddToTranslation( |
| 625 translation, | 670 environment, translation, value, environment->HasTaggedValueAt(i), |
| 626 value, | 671 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); |
| 627 environment->HasTaggedValueAt(i), | |
| 628 environment->HasUint32ValueAt(i), | |
| 629 &object_index, | |
| 630 &dematerialized_index); | |
| 631 } | 672 } |
| 632 } | 673 } |
| 633 | 674 |
| 634 | 675 |
| 635 void LCodeGen::AddToTranslation(LEnvironment* environment, | 676 void LCodeGen::AddToTranslation(LEnvironment* environment, |
| 636 Translation* translation, | 677 Translation* translation, |
| 637 LOperand* op, | 678 LOperand* op, |
| 638 bool is_tagged, | 679 bool is_tagged, |
| 639 bool is_uint32, | 680 bool is_uint32, |
| 640 int* object_index_pointer, | 681 int* object_index_pointer, |
| (...skipping 5482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6123 __ Push(at, ToRegister(instr->function())); | 6164 __ Push(at, ToRegister(instr->function())); |
| 6124 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6165 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6125 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6166 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6126 } | 6167 } |
| 6127 | 6168 |
| 6128 | 6169 |
| 6129 #undef __ | 6170 #undef __ |
| 6130 | 6171 |
| 6131 } // namespace internal | 6172 } // namespace internal |
| 6132 } // namespace v8 | 6173 } // namespace v8 |
| OLD | NEW |