OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 translation->BeginSetterStubFrame(closure_id); | 490 translation->BeginSetterStubFrame(closure_id); |
491 break; | 491 break; |
492 case ARGUMENTS_ADAPTOR: | 492 case ARGUMENTS_ADAPTOR: |
493 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 493 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
494 break; | 494 break; |
495 case STUB: | 495 case STUB: |
496 translation->BeginCompiledStubFrame(); | 496 translation->BeginCompiledStubFrame(); |
497 break; | 497 break; |
498 } | 498 } |
499 | 499 |
| 500 int object_index = 0; |
| 501 int dematerialized_index = 0; |
500 for (int i = 0; i < translation_size; ++i) { | 502 for (int i = 0; i < translation_size; ++i) { |
501 LOperand* value = environment->values()->at(i); | 503 LOperand* value = environment->values()->at(i); |
502 | 504 AddToTranslation(environment, |
503 // TODO(mstarzinger): Introduce marker operands to indicate that this value | 505 translation, |
504 // is not present and must be reconstructed from the deoptimizer. Currently | |
505 // this is only used for the arguments object. | |
506 if (value == NULL) { | |
507 int arguments_count = environment->values()->length() - translation_size; | |
508 translation->BeginArgumentsObject(arguments_count); | |
509 for (int i = 0; i < arguments_count; ++i) { | |
510 LOperand* value = environment->values()->at(translation_size + i); | |
511 AddToTranslation(translation, | |
512 value, | |
513 environment->HasTaggedValueAt(translation_size + i), | |
514 environment->HasUint32ValueAt(translation_size + i)); | |
515 } | |
516 continue; | |
517 } | |
518 | |
519 AddToTranslation(translation, | |
520 value, | 506 value, |
521 environment->HasTaggedValueAt(i), | 507 environment->HasTaggedValueAt(i), |
522 environment->HasUint32ValueAt(i)); | 508 environment->HasUint32ValueAt(i), |
| 509 &object_index, |
| 510 &dematerialized_index); |
523 } | 511 } |
524 } | 512 } |
525 | 513 |
526 | 514 |
527 void LCodeGen::AddToTranslation(Translation* translation, | 515 void LCodeGen::AddToTranslation(LEnvironment* environment, |
| 516 Translation* translation, |
528 LOperand* op, | 517 LOperand* op, |
529 bool is_tagged, | 518 bool is_tagged, |
530 bool is_uint32) { | 519 bool is_uint32, |
| 520 int* object_index_pointer, |
| 521 int* dematerialized_index_pointer) { |
| 522 if (op == LEnvironment::materialization_marker()) { |
| 523 int object_index = (*object_index_pointer)++; |
| 524 if (environment->ObjectIsDuplicateAt(object_index)) { |
| 525 int dupe_of = environment->ObjectDuplicateOfAt(object_index); |
| 526 translation->DuplicateObject(dupe_of); |
| 527 return; |
| 528 } |
| 529 int object_length = environment->ObjectLengthAt(object_index); |
| 530 if (environment->ObjectIsArgumentsAt(object_index)) { |
| 531 translation->BeginArgumentsObject(object_length); |
| 532 } else { |
| 533 translation->BeginCapturedObject(object_length); |
| 534 } |
| 535 int dematerialized_index = *dematerialized_index_pointer; |
| 536 int env_offset = environment->translation_size() + dematerialized_index; |
| 537 *dematerialized_index_pointer += object_length; |
| 538 for (int i = 0; i < object_length; ++i) { |
| 539 LOperand* value = environment->values()->at(env_offset + i); |
| 540 AddToTranslation(environment, |
| 541 translation, |
| 542 value, |
| 543 environment->HasTaggedValueAt(env_offset + i), |
| 544 environment->HasUint32ValueAt(env_offset + i), |
| 545 object_index_pointer, |
| 546 dematerialized_index_pointer); |
| 547 } |
| 548 return; |
| 549 } |
| 550 |
531 if (op->IsStackSlot()) { | 551 if (op->IsStackSlot()) { |
532 if (is_tagged) { | 552 if (is_tagged) { |
533 translation->StoreStackSlot(op->index()); | 553 translation->StoreStackSlot(op->index()); |
534 } else if (is_uint32) { | 554 } else if (is_uint32) { |
535 translation->StoreUint32StackSlot(op->index()); | 555 translation->StoreUint32StackSlot(op->index()); |
536 } else { | 556 } else { |
537 translation->StoreInt32StackSlot(op->index()); | 557 translation->StoreInt32StackSlot(op->index()); |
538 } | 558 } |
539 } else if (op->IsDoubleStackSlot()) { | 559 } else if (op->IsDoubleStackSlot()) { |
540 translation->StoreDoubleStackSlot(op->index()); | 560 translation->StoreDoubleStackSlot(op->index()); |
(...skipping 5050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5591 FixedArray::kHeaderSize - kPointerSize)); | 5611 FixedArray::kHeaderSize - kPointerSize)); |
5592 __ bind(&done); | 5612 __ bind(&done); |
5593 } | 5613 } |
5594 | 5614 |
5595 | 5615 |
5596 #undef __ | 5616 #undef __ |
5597 | 5617 |
5598 } } // namespace v8::internal | 5618 } } // namespace v8::internal |
5599 | 5619 |
5600 #endif // V8_TARGET_ARCH_X64 | 5620 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |