OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 void LCodeGen::WriteTranslation(LEnvironment* environment, | 534 void LCodeGen::WriteTranslation(LEnvironment* environment, |
535 Translation* translation) { | 535 Translation* translation) { |
536 if (environment == NULL) return; | 536 if (environment == NULL) return; |
537 | 537 |
538 // The translation includes one command per value in the environment. | 538 // The translation includes one command per value in the environment. |
539 int translation_size = environment->translation_size(); | 539 int translation_size = environment->translation_size(); |
540 // The output frame height does not include the parameters. | 540 // The output frame height does not include the parameters. |
541 int height = translation_size - environment->parameter_count(); | 541 int height = translation_size - environment->parameter_count(); |
542 | 542 |
543 WriteTranslation(environment->outer(), translation); | 543 WriteTranslation(environment->outer(), translation); |
544 bool has_closure_id = !info()->closure().is_null() && | |
545 !info()->closure().is_identical_to(environment->closure()); | |
546 int closure_id = has_closure_id | |
547 ? DefineDeoptimizationLiteral(environment->closure()) | |
548 : Translation::kSelfLiteralId; | |
549 | 544 |
550 switch (environment->frame_type()) { | 545 switch (environment->frame_type()) { |
551 case JS_FUNCTION: | 546 case JS_FUNCTION: { |
552 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 547 int shared_id = DefineDeoptimizationLiteral( |
| 548 environment->entry() ? environment->entry()->shared() |
| 549 : info()->shared_info()); |
| 550 translation->BeginJSFrame(environment->ast_id(), shared_id, height); |
| 551 if (info()->closure().is_identical_to(environment->closure())) { |
| 552 translation->StoreJSFrameFunction(); |
| 553 } else { |
| 554 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 555 translation->StoreLiteral(closure_id); |
| 556 } |
553 break; | 557 break; |
554 case JS_CONSTRUCT: | 558 } |
555 translation->BeginConstructStubFrame(closure_id, translation_size); | 559 case JS_CONSTRUCT: { |
| 560 int shared_id = DefineDeoptimizationLiteral( |
| 561 environment->entry() ? environment->entry()->shared() |
| 562 : info()->shared_info()); |
| 563 translation->BeginConstructStubFrame(shared_id, translation_size); |
| 564 if (info()->closure().is_identical_to(environment->closure())) { |
| 565 translation->StoreJSFrameFunction(); |
| 566 } else { |
| 567 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 568 translation->StoreLiteral(closure_id); |
| 569 } |
556 break; | 570 break; |
557 case JS_GETTER: | 571 } |
| 572 case JS_GETTER: { |
558 DCHECK(translation_size == 1); | 573 DCHECK(translation_size == 1); |
559 DCHECK(height == 0); | 574 DCHECK(height == 0); |
560 translation->BeginGetterStubFrame(closure_id); | 575 int shared_id = DefineDeoptimizationLiteral( |
| 576 environment->entry() ? environment->entry()->shared() |
| 577 : info()->shared_info()); |
| 578 translation->BeginGetterStubFrame(shared_id); |
| 579 if (info()->closure().is_identical_to(environment->closure())) { |
| 580 translation->StoreJSFrameFunction(); |
| 581 } else { |
| 582 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 583 translation->StoreLiteral(closure_id); |
| 584 } |
561 break; | 585 break; |
562 case JS_SETTER: | 586 } |
| 587 case JS_SETTER: { |
563 DCHECK(translation_size == 2); | 588 DCHECK(translation_size == 2); |
564 DCHECK(height == 0); | 589 DCHECK(height == 0); |
565 translation->BeginSetterStubFrame(closure_id); | 590 int shared_id = DefineDeoptimizationLiteral( |
| 591 environment->entry() ? environment->entry()->shared() |
| 592 : info()->shared_info()); |
| 593 translation->BeginSetterStubFrame(shared_id); |
| 594 if (info()->closure().is_identical_to(environment->closure())) { |
| 595 translation->StoreJSFrameFunction(); |
| 596 } else { |
| 597 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 598 translation->StoreLiteral(closure_id); |
| 599 } |
566 break; | 600 break; |
567 case ARGUMENTS_ADAPTOR: | 601 } |
568 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 602 case ARGUMENTS_ADAPTOR: { |
| 603 int shared_id = DefineDeoptimizationLiteral( |
| 604 environment->entry() ? environment->entry()->shared() |
| 605 : info()->shared_info()); |
| 606 translation->BeginArgumentsAdaptorFrame(shared_id, translation_size); |
| 607 if (info()->closure().is_identical_to(environment->closure())) { |
| 608 translation->StoreJSFrameFunction(); |
| 609 } else { |
| 610 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 611 translation->StoreLiteral(closure_id); |
| 612 } |
569 break; | 613 break; |
| 614 } |
570 case STUB: | 615 case STUB: |
571 translation->BeginCompiledStubFrame(translation_size); | 616 translation->BeginCompiledStubFrame(translation_size); |
572 break; | 617 break; |
573 } | 618 } |
574 | 619 |
575 int object_index = 0; | 620 int object_index = 0; |
576 int dematerialized_index = 0; | 621 int dematerialized_index = 0; |
577 for (int i = 0; i < translation_size; ++i) { | 622 for (int i = 0; i < translation_size; ++i) { |
578 LOperand* value = environment->values()->at(i); | 623 LOperand* value = environment->values()->at(i); |
579 AddToTranslation(environment, | 624 AddToTranslation( |
580 translation, | 625 environment, translation, value, environment->HasTaggedValueAt(i), |
581 value, | 626 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); |
582 environment->HasTaggedValueAt(i), | |
583 environment->HasUint32ValueAt(i), | |
584 &object_index, | |
585 &dematerialized_index); | |
586 } | 627 } |
587 } | 628 } |
588 | 629 |
589 | 630 |
590 void LCodeGen::AddToTranslation(LEnvironment* environment, | 631 void LCodeGen::AddToTranslation(LEnvironment* environment, |
591 Translation* translation, | 632 Translation* translation, |
592 LOperand* op, | 633 LOperand* op, |
593 bool is_tagged, | 634 bool is_tagged, |
594 bool is_uint32, | 635 bool is_uint32, |
595 int* object_index_pointer, | 636 int* object_index_pointer, |
(...skipping 5432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6028 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6069 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6029 } | 6070 } |
6030 | 6071 |
6031 | 6072 |
6032 #undef __ | 6073 #undef __ |
6033 | 6074 |
6034 } // namespace internal | 6075 } // namespace internal |
6035 } // namespace v8 | 6076 } // namespace v8 |
6036 | 6077 |
6037 #endif // V8_TARGET_ARCH_X64 | 6078 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |