OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 void LCodeGen::WriteTranslation(LEnvironment* environment, | 563 void LCodeGen::WriteTranslation(LEnvironment* environment, |
564 Translation* translation) { | 564 Translation* translation) { |
565 if (environment == NULL) return; | 565 if (environment == NULL) return; |
566 | 566 |
567 // The translation includes one command per value in the environment. | 567 // The translation includes one command per value in the environment. |
568 int translation_size = environment->translation_size(); | 568 int translation_size = environment->translation_size(); |
569 // The output frame height does not include the parameters. | 569 // The output frame height does not include the parameters. |
570 int height = translation_size - environment->parameter_count(); | 570 int height = translation_size - environment->parameter_count(); |
571 | 571 |
572 WriteTranslation(environment->outer(), translation); | 572 WriteTranslation(environment->outer(), translation); |
573 bool has_closure_id = | |
574 !info()->closure().is_null() && | |
575 !info()->closure().is_identical_to(environment->closure()); | |
576 int closure_id = has_closure_id | |
577 ? DefineDeoptimizationLiteral(environment->closure()) | |
578 : Translation::kSelfLiteralId; | |
579 | 573 |
580 switch (environment->frame_type()) { | 574 switch (environment->frame_type()) { |
581 case JS_FUNCTION: | 575 case JS_FUNCTION: { |
582 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 576 int shared_id = DefineDeoptimizationLiteral( |
| 577 environment->entry() ? environment->entry()->shared() |
| 578 : info()->shared_info()); |
| 579 translation->BeginJSFrame(environment->ast_id(), shared_id, height); |
| 580 if (info()->closure().is_identical_to(environment->closure())) { |
| 581 translation->StoreJSFrameFunction(); |
| 582 } else { |
| 583 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 584 translation->StoreLiteral(closure_id); |
| 585 } |
583 break; | 586 break; |
584 case JS_CONSTRUCT: | 587 } |
585 translation->BeginConstructStubFrame(closure_id, translation_size); | 588 case JS_CONSTRUCT: { |
| 589 int shared_id = DefineDeoptimizationLiteral( |
| 590 environment->entry() ? environment->entry()->shared() |
| 591 : info()->shared_info()); |
| 592 translation->BeginConstructStubFrame(shared_id, translation_size); |
| 593 if (info()->closure().is_identical_to(environment->closure())) { |
| 594 translation->StoreJSFrameFunction(); |
| 595 } else { |
| 596 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 597 translation->StoreLiteral(closure_id); |
| 598 } |
586 break; | 599 break; |
587 case JS_GETTER: | 600 } |
| 601 case JS_GETTER: { |
588 DCHECK(translation_size == 1); | 602 DCHECK(translation_size == 1); |
589 DCHECK(height == 0); | 603 DCHECK(height == 0); |
590 translation->BeginGetterStubFrame(closure_id); | 604 int shared_id = DefineDeoptimizationLiteral( |
| 605 environment->entry() ? environment->entry()->shared() |
| 606 : info()->shared_info()); |
| 607 translation->BeginGetterStubFrame(shared_id); |
| 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 } |
591 break; | 614 break; |
592 case JS_SETTER: | 615 } |
| 616 case JS_SETTER: { |
593 DCHECK(translation_size == 2); | 617 DCHECK(translation_size == 2); |
594 DCHECK(height == 0); | 618 DCHECK(height == 0); |
595 translation->BeginSetterStubFrame(closure_id); | 619 int shared_id = DefineDeoptimizationLiteral( |
| 620 environment->entry() ? environment->entry()->shared() |
| 621 : info()->shared_info()); |
| 622 translation->BeginSetterStubFrame(shared_id); |
| 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 } |
596 break; | 629 break; |
| 630 } |
| 631 case ARGUMENTS_ADAPTOR: { |
| 632 int shared_id = DefineDeoptimizationLiteral( |
| 633 environment->entry() ? environment->entry()->shared() |
| 634 : info()->shared_info()); |
| 635 translation->BeginArgumentsAdaptorFrame(shared_id, translation_size); |
| 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 } |
| 642 break; |
| 643 } |
597 case STUB: | 644 case STUB: |
598 translation->BeginCompiledStubFrame(translation_size); | 645 translation->BeginCompiledStubFrame(translation_size); |
599 break; | 646 break; |
600 case ARGUMENTS_ADAPTOR: | |
601 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | |
602 break; | |
603 } | 647 } |
604 | 648 |
605 int object_index = 0; | 649 int object_index = 0; |
606 int dematerialized_index = 0; | 650 int dematerialized_index = 0; |
607 for (int i = 0; i < translation_size; ++i) { | 651 for (int i = 0; i < translation_size; ++i) { |
608 LOperand* value = environment->values()->at(i); | 652 LOperand* value = environment->values()->at(i); |
609 AddToTranslation( | 653 AddToTranslation( |
610 environment, translation, value, environment->HasTaggedValueAt(i), | 654 environment, translation, value, environment->HasTaggedValueAt(i), |
611 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); | 655 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); |
612 } | 656 } |
(...skipping 5662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6275 __ Push(scope_info); | 6319 __ Push(scope_info); |
6276 __ push(ToRegister(instr->function())); | 6320 __ push(ToRegister(instr->function())); |
6277 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6321 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6278 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6322 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6279 } | 6323 } |
6280 | 6324 |
6281 | 6325 |
6282 #undef __ | 6326 #undef __ |
6283 } // namespace internal | 6327 } // namespace internal |
6284 } // namespace v8 | 6328 } // namespace v8 |
OLD | NEW |