| 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 if (environment->is_arguments_adaptor()) { | 450 switch (environment->frame_type()) { |
| 451 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 451 case JS_FUNCTION: |
| 452 } else { | 452 translation->BeginJSFrame(environment->ast_id(), closure_id, height); |
| 453 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 453 break; |
| 454 case JS_CONSTRUCT: |
| 455 translation->BeginConstructStubFrame(closure_id, translation_size); |
| 456 break; |
| 457 case ARGUMENTS_ADAPTOR: |
| 458 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
| 459 break; |
| 460 default: |
| 461 UNREACHABLE(); |
| 454 } | 462 } |
| 455 for (int i = 0; i < translation_size; ++i) { | 463 for (int i = 0; i < translation_size; ++i) { |
| 456 LOperand* value = environment->values()->at(i); | 464 LOperand* value = environment->values()->at(i); |
| 457 // spilled_registers_ and spilled_double_registers_ are either | 465 // spilled_registers_ and spilled_double_registers_ are either |
| 458 // both NULL or both set. | 466 // both NULL or both set. |
| 459 if (environment->spilled_registers() != NULL && value != NULL) { | 467 if (environment->spilled_registers() != NULL && value != NULL) { |
| 460 if (value->IsRegister() && | 468 if (value->IsRegister() && |
| 461 environment->spilled_registers()[value->index()] != NULL) { | 469 environment->spilled_registers()[value->index()] != NULL) { |
| 462 translation->MarkDuplicate(); | 470 translation->MarkDuplicate(); |
| 463 AddToTranslation(translation, | 471 AddToTranslation(translation, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 581 |
| 574 // Layout of the translation: | 582 // Layout of the translation: |
| 575 // 0 ........................................................ size - 1 + 4 | 583 // 0 ........................................................ size - 1 + 4 |
| 576 // [expression stack including arguments] [locals] [4 words] [parameters] | 584 // [expression stack including arguments] [locals] [4 words] [parameters] |
| 577 // |>------------ translation_size ------------<| | 585 // |>------------ translation_size ------------<| |
| 578 | 586 |
| 579 int frame_count = 0; | 587 int frame_count = 0; |
| 580 int jsframe_count = 0; | 588 int jsframe_count = 0; |
| 581 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { | 589 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { |
| 582 ++frame_count; | 590 ++frame_count; |
| 583 if (!e->is_arguments_adaptor()) { | 591 if (e->frame_type() == JS_FUNCTION) { |
| 584 ++jsframe_count; | 592 ++jsframe_count; |
| 585 } | 593 } |
| 586 } | 594 } |
| 587 Translation translation(&translations_, frame_count, jsframe_count); | 595 Translation translation(&translations_, frame_count, jsframe_count); |
| 588 WriteTranslation(environment, &translation); | 596 WriteTranslation(environment, &translation); |
| 589 int deoptimization_index = deoptimizations_.length(); | 597 int deoptimization_index = deoptimizations_.length(); |
| 590 int pc_offset = masm()->pc_offset(); | 598 int pc_offset = masm()->pc_offset(); |
| 591 environment->Register(deoptimization_index, | 599 environment->Register(deoptimization_index, |
| 592 translation.index(), | 600 translation.index(), |
| 593 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); | 601 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); |
| (...skipping 4230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4824 ASSERT(!environment->HasBeenRegistered()); | 4832 ASSERT(!environment->HasBeenRegistered()); |
| 4825 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4833 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4826 ASSERT(osr_pc_offset_ == -1); | 4834 ASSERT(osr_pc_offset_ == -1); |
| 4827 osr_pc_offset_ = masm()->pc_offset(); | 4835 osr_pc_offset_ = masm()->pc_offset(); |
| 4828 } | 4836 } |
| 4829 | 4837 |
| 4830 | 4838 |
| 4831 #undef __ | 4839 #undef __ |
| 4832 | 4840 |
| 4833 } } // namespace v8::internal | 4841 } } // namespace v8::internal |
| OLD | NEW |