| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 translation->BeginSetterStubFrame(closure_id); | 584 translation->BeginSetterStubFrame(closure_id); |
| 585 break; | 585 break; |
| 586 case STUB: | 586 case STUB: |
| 587 translation->BeginCompiledStubFrame(); | 587 translation->BeginCompiledStubFrame(); |
| 588 break; | 588 break; |
| 589 case ARGUMENTS_ADAPTOR: | 589 case ARGUMENTS_ADAPTOR: |
| 590 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 590 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
| 591 break; | 591 break; |
| 592 } | 592 } |
| 593 | 593 |
| 594 int object_index = 0; |
| 595 int dematerialized_index = 0; |
| 594 for (int i = 0; i < translation_size; ++i) { | 596 for (int i = 0; i < translation_size; ++i) { |
| 595 LOperand* value = environment->values()->at(i); | 597 LOperand* value = environment->values()->at(i); |
| 596 | 598 AddToTranslation(environment, |
| 597 // TODO(mstarzinger): Introduce marker operands to indicate that this value | 599 translation, |
| 598 // is not present and must be reconstructed from the deoptimizer. Currently | |
| 599 // this is only used for the arguments object. | |
| 600 if (value == NULL) { | |
| 601 int arguments_count = environment->values()->length() - translation_size; | |
| 602 translation->BeginArgumentsObject(arguments_count); | |
| 603 for (int i = 0; i < arguments_count; ++i) { | |
| 604 LOperand* value = environment->values()->at(translation_size + i); | |
| 605 AddToTranslation(translation, | |
| 606 value, | |
| 607 environment->HasTaggedValueAt(translation_size + i), | |
| 608 environment->HasUint32ValueAt(translation_size + i)); | |
| 609 } | |
| 610 continue; | |
| 611 } | |
| 612 | |
| 613 AddToTranslation(translation, | |
| 614 value, | 600 value, |
| 615 environment->HasTaggedValueAt(i), | 601 environment->HasTaggedValueAt(i), |
| 616 environment->HasUint32ValueAt(i)); | 602 environment->HasUint32ValueAt(i), |
| 603 &object_index, |
| 604 &dematerialized_index); |
| 617 } | 605 } |
| 618 } | 606 } |
| 619 | 607 |
| 620 | 608 |
| 621 void LCodeGen::AddToTranslation(Translation* translation, | 609 void LCodeGen::AddToTranslation(LEnvironment* environment, |
| 610 Translation* translation, |
| 622 LOperand* op, | 611 LOperand* op, |
| 623 bool is_tagged, | 612 bool is_tagged, |
| 624 bool is_uint32) { | 613 bool is_uint32, |
| 614 int* object_index_pointer, |
| 615 int* dematerialized_index_pointer) { |
| 616 if (op == LEnvironment::materialization_marker()) { |
| 617 int object_index = (*object_index_pointer)++; |
| 618 if (environment->ObjectIsDuplicateAt(object_index)) { |
| 619 int dupe_of = environment->ObjectDuplicateOfAt(object_index); |
| 620 translation->DuplicateObject(dupe_of); |
| 621 return; |
| 622 } |
| 623 int object_length = environment->ObjectLengthAt(object_index); |
| 624 if (environment->ObjectIsArgumentsAt(object_index)) { |
| 625 translation->BeginArgumentsObject(object_length); |
| 626 } else { |
| 627 translation->BeginCapturedObject(object_length); |
| 628 } |
| 629 int dematerialized_index = *dematerialized_index_pointer; |
| 630 int env_offset = environment->translation_size() + dematerialized_index; |
| 631 *dematerialized_index_pointer += object_length; |
| 632 for (int i = 0; i < object_length; ++i) { |
| 633 LOperand* value = environment->values()->at(env_offset + i); |
| 634 AddToTranslation(environment, |
| 635 translation, |
| 636 value, |
| 637 environment->HasTaggedValueAt(env_offset + i), |
| 638 environment->HasUint32ValueAt(env_offset + i), |
| 639 object_index_pointer, |
| 640 dematerialized_index_pointer); |
| 641 } |
| 642 return; |
| 643 } |
| 644 |
| 625 if (op->IsStackSlot()) { | 645 if (op->IsStackSlot()) { |
| 626 if (is_tagged) { | 646 if (is_tagged) { |
| 627 translation->StoreStackSlot(op->index()); | 647 translation->StoreStackSlot(op->index()); |
| 628 } else if (is_uint32) { | 648 } else if (is_uint32) { |
| 629 translation->StoreUint32StackSlot(op->index()); | 649 translation->StoreUint32StackSlot(op->index()); |
| 630 } else { | 650 } else { |
| 631 translation->StoreInt32StackSlot(op->index()); | 651 translation->StoreInt32StackSlot(op->index()); |
| 632 } | 652 } |
| 633 } else if (op->IsDoubleStackSlot()) { | 653 } else if (op->IsDoubleStackSlot()) { |
| 634 translation->StoreDoubleStackSlot(op->index()); | 654 translation->StoreDoubleStackSlot(op->index()); |
| (...skipping 5210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5845 __ Subu(scratch, result, scratch); | 5865 __ Subu(scratch, result, scratch); |
| 5846 __ lw(result, FieldMemOperand(scratch, | 5866 __ lw(result, FieldMemOperand(scratch, |
| 5847 FixedArray::kHeaderSize - kPointerSize)); | 5867 FixedArray::kHeaderSize - kPointerSize)); |
| 5848 __ bind(&done); | 5868 __ bind(&done); |
| 5849 } | 5869 } |
| 5850 | 5870 |
| 5851 | 5871 |
| 5852 #undef __ | 5872 #undef __ |
| 5853 | 5873 |
| 5854 } } // namespace v8::internal | 5874 } } // namespace v8::internal |
| OLD | NEW |