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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 Translation* translation) { | 440 Translation* translation) { |
441 if (environment == NULL) return; | 441 if (environment == NULL) return; |
442 | 442 |
443 // The translation includes one command per value in the environment. | 443 // The translation includes one command per value in the environment. |
444 int translation_size = environment->values()->length(); | 444 int translation_size = environment->values()->length(); |
445 // The output frame height does not include the parameters. | 445 // The output frame height does not include the parameters. |
446 int height = translation_size - environment->parameter_count(); | 446 int height = translation_size - environment->parameter_count(); |
447 | 447 |
448 WriteTranslation(environment->outer(), translation); | 448 WriteTranslation(environment->outer(), translation); |
449 int closure_id = DefineDeoptimizationLiteral(environment->closure()); | 449 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
450 translation->BeginFrame(environment->ast_id(), closure_id, height); | 450 if (environment->is_arguments_adaptor()) { |
| 451 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
| 452 } else { |
| 453 translation->BeginJSFrame(environment->ast_id(), closure_id, height); |
| 454 } |
451 for (int i = 0; i < translation_size; ++i) { | 455 for (int i = 0; i < translation_size; ++i) { |
452 LOperand* value = environment->values()->at(i); | 456 LOperand* value = environment->values()->at(i); |
453 // spilled_registers_ and spilled_double_registers_ are either | 457 // spilled_registers_ and spilled_double_registers_ are either |
454 // both NULL or both set. | 458 // both NULL or both set. |
455 if (environment->spilled_registers() != NULL && value != NULL) { | 459 if (environment->spilled_registers() != NULL && value != NULL) { |
456 if (value->IsRegister() && | 460 if (value->IsRegister() && |
457 environment->spilled_registers()[value->index()] != NULL) { | 461 environment->spilled_registers()[value->index()] != NULL) { |
458 translation->MarkDuplicate(); | 462 translation->MarkDuplicate(); |
459 AddToTranslation(translation, | 463 AddToTranslation(translation, |
460 environment->spilled_registers()[value->index()], | 464 environment->spilled_registers()[value->index()], |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 // Layout of the environment: | 570 // Layout of the environment: |
567 // 0 ..................................................... size-1 | 571 // 0 ..................................................... size-1 |
568 // [parameters] [locals] [expression stack including arguments] | 572 // [parameters] [locals] [expression stack including arguments] |
569 | 573 |
570 // Layout of the translation: | 574 // Layout of the translation: |
571 // 0 ........................................................ size - 1 + 4 | 575 // 0 ........................................................ size - 1 + 4 |
572 // [expression stack including arguments] [locals] [4 words] [parameters] | 576 // [expression stack including arguments] [locals] [4 words] [parameters] |
573 // |>------------ translation_size ------------<| | 577 // |>------------ translation_size ------------<| |
574 | 578 |
575 int frame_count = 0; | 579 int frame_count = 0; |
| 580 int jsframe_count = 0; |
576 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { | 581 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { |
577 ++frame_count; | 582 ++frame_count; |
| 583 if (!e->is_arguments_adaptor()) { |
| 584 ++jsframe_count; |
| 585 } |
578 } | 586 } |
579 Translation translation(&translations_, frame_count); | 587 Translation translation(&translations_, frame_count, jsframe_count); |
580 WriteTranslation(environment, &translation); | 588 WriteTranslation(environment, &translation); |
581 int deoptimization_index = deoptimizations_.length(); | 589 int deoptimization_index = deoptimizations_.length(); |
582 int pc_offset = masm()->pc_offset(); | 590 int pc_offset = masm()->pc_offset(); |
583 environment->Register(deoptimization_index, | 591 environment->Register(deoptimization_index, |
584 translation.index(), | 592 translation.index(), |
585 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); | 593 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); |
586 deoptimizations_.Add(environment); | 594 deoptimizations_.Add(environment); |
587 } | 595 } |
588 } | 596 } |
589 | 597 |
(...skipping 4142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4732 ASSERT(!environment->HasBeenRegistered()); | 4740 ASSERT(!environment->HasBeenRegistered()); |
4733 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4741 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4734 ASSERT(osr_pc_offset_ == -1); | 4742 ASSERT(osr_pc_offset_ == -1); |
4735 osr_pc_offset_ = masm()->pc_offset(); | 4743 osr_pc_offset_ = masm()->pc_offset(); |
4736 } | 4744 } |
4737 | 4745 |
4738 | 4746 |
4739 #undef __ | 4747 #undef __ |
4740 | 4748 |
4741 } } // namespace v8::internal | 4749 } } // namespace v8::internal |
OLD | NEW |