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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 translation->BeginSetterStubFrame(closure_id); | 485 translation->BeginSetterStubFrame(closure_id); |
486 break; | 486 break; |
487 case ARGUMENTS_ADAPTOR: | 487 case ARGUMENTS_ADAPTOR: |
488 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 488 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
489 break; | 489 break; |
490 case STUB: | 490 case STUB: |
491 translation->BeginCompiledStubFrame(); | 491 translation->BeginCompiledStubFrame(); |
492 break; | 492 break; |
493 } | 493 } |
494 | 494 |
| 495 int object_index = 0; |
| 496 int dematerialized_index = 0; |
495 for (int i = 0; i < translation_size; ++i) { | 497 for (int i = 0; i < translation_size; ++i) { |
496 LOperand* value = environment->values()->at(i); | 498 LOperand* value = environment->values()->at(i); |
497 | 499 AddToTranslation(environment, |
498 // TODO(mstarzinger): Introduce marker operands to indicate that this value | 500 translation, |
499 // is not present and must be reconstructed from the deoptimizer. Currently | |
500 // this is only used for the arguments object. | |
501 if (value == NULL) { | |
502 int arguments_count = environment->values()->length() - translation_size; | |
503 translation->BeginArgumentsObject(arguments_count); | |
504 for (int i = 0; i < arguments_count; ++i) { | |
505 LOperand* value = environment->values()->at(translation_size + i); | |
506 AddToTranslation(translation, | |
507 value, | |
508 environment->HasTaggedValueAt(translation_size + i), | |
509 environment->HasUint32ValueAt(translation_size + i)); | |
510 } | |
511 continue; | |
512 } | |
513 | |
514 AddToTranslation(translation, | |
515 value, | 501 value, |
516 environment->HasTaggedValueAt(i), | 502 environment->HasTaggedValueAt(i), |
517 environment->HasUint32ValueAt(i)); | 503 environment->HasUint32ValueAt(i), |
| 504 &object_index, |
| 505 &dematerialized_index); |
518 } | 506 } |
519 } | 507 } |
520 | 508 |
521 | 509 |
522 void LCodeGen::AddToTranslation(Translation* translation, | 510 void LCodeGen::AddToTranslation(LEnvironment* environment, |
| 511 Translation* translation, |
523 LOperand* op, | 512 LOperand* op, |
524 bool is_tagged, | 513 bool is_tagged, |
525 bool is_uint32) { | 514 bool is_uint32, |
| 515 int* object_index_pointer, |
| 516 int* dematerialized_index_pointer) { |
| 517 if (op == LEnvironment::materialization_marker()) { |
| 518 int object_index = (*object_index_pointer)++; |
| 519 if (environment->ObjectIsDuplicateAt(object_index)) { |
| 520 int dupe_of = environment->ObjectDuplicateOfAt(object_index); |
| 521 translation->DuplicateObject(dupe_of); |
| 522 return; |
| 523 } |
| 524 int object_length = environment->ObjectLengthAt(object_index); |
| 525 if (environment->ObjectIsArgumentsAt(object_index)) { |
| 526 translation->BeginArgumentsObject(object_length); |
| 527 } else { |
| 528 translation->BeginCapturedObject(object_length); |
| 529 } |
| 530 int dematerialized_index = *dematerialized_index_pointer; |
| 531 int env_offset = environment->translation_size() + dematerialized_index; |
| 532 *dematerialized_index_pointer += object_length; |
| 533 for (int i = 0; i < object_length; ++i) { |
| 534 LOperand* value = environment->values()->at(env_offset + i); |
| 535 AddToTranslation(environment, |
| 536 translation, |
| 537 value, |
| 538 environment->HasTaggedValueAt(env_offset + i), |
| 539 environment->HasUint32ValueAt(env_offset + i), |
| 540 object_index_pointer, |
| 541 dematerialized_index_pointer); |
| 542 } |
| 543 return; |
| 544 } |
| 545 |
526 if (op->IsStackSlot()) { | 546 if (op->IsStackSlot()) { |
527 if (is_tagged) { | 547 if (is_tagged) { |
528 translation->StoreStackSlot(op->index()); | 548 translation->StoreStackSlot(op->index()); |
529 } else if (is_uint32) { | 549 } else if (is_uint32) { |
530 translation->StoreUint32StackSlot(op->index()); | 550 translation->StoreUint32StackSlot(op->index()); |
531 } else { | 551 } else { |
532 translation->StoreInt32StackSlot(op->index()); | 552 translation->StoreInt32StackSlot(op->index()); |
533 } | 553 } |
534 } else if (op->IsDoubleStackSlot()) { | 554 } else if (op->IsDoubleStackSlot()) { |
535 translation->StoreDoubleStackSlot(op->index()); | 555 translation->StoreDoubleStackSlot(op->index()); |
(...skipping 5042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5578 FixedArray::kHeaderSize - kPointerSize)); | 5598 FixedArray::kHeaderSize - kPointerSize)); |
5579 __ bind(&done); | 5599 __ bind(&done); |
5580 } | 5600 } |
5581 | 5601 |
5582 | 5602 |
5583 #undef __ | 5603 #undef __ |
5584 | 5604 |
5585 } } // namespace v8::internal | 5605 } } // namespace v8::internal |
5586 | 5606 |
5587 #endif // V8_TARGET_ARCH_X64 | 5607 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |