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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); | 541 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); |
542 uint32_t pc = reinterpret_cast<uint32_t>( | 542 uint32_t pc = reinterpret_cast<uint32_t>( |
543 adaptor_trampoline->instruction_start() + | 543 adaptor_trampoline->instruction_start() + |
544 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); | 544 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); |
545 output_frame->SetPc(pc); | 545 output_frame->SetPc(pc); |
546 } | 546 } |
547 | 547 |
548 | 548 |
549 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, | 549 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, |
550 int frame_index) { | 550 int frame_index) { |
| 551 Builtins* builtins = isolate_->builtins(); |
| 552 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); |
551 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); | 553 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); |
552 unsigned height = iterator->Next(); | 554 unsigned height = iterator->Next(); |
553 unsigned height_in_bytes = height * kPointerSize; | 555 unsigned height_in_bytes = height * kPointerSize; |
554 if (FLAG_trace_deopt) { | 556 if (FLAG_trace_deopt) { |
555 PrintF(" translating construct stub => height=%d\n", height_in_bytes); | 557 PrintF(" translating construct stub => height=%d\n", height_in_bytes); |
556 } | 558 } |
557 | 559 |
558 unsigned fixed_frame_size = 6 * kPointerSize; | 560 unsigned fixed_frame_size = 7 * kPointerSize; |
559 unsigned output_frame_size = height_in_bytes + fixed_frame_size; | 561 unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
560 | 562 |
561 // Allocate and store the output frame description. | 563 // Allocate and store the output frame description. |
562 FrameDescription* output_frame = | 564 FrameDescription* output_frame = |
563 new(output_frame_size) FrameDescription(output_frame_size, function); | 565 new(output_frame_size) FrameDescription(output_frame_size, function); |
564 output_frame->SetFrameType(StackFrame::CONSTRUCT); | 566 output_frame->SetFrameType(StackFrame::CONSTRUCT); |
565 | 567 |
566 // Construct stub can not be topmost or bottommost. | 568 // Construct stub can not be topmost or bottommost. |
567 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); | 569 ASSERT(frame_index > 0 && frame_index < output_count_ - 1); |
568 ASSERT(output_[frame_index] == NULL); | 570 ASSERT(output_[frame_index] == NULL); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 | 615 |
614 // A marker value is used in place of the function. | 616 // A marker value is used in place of the function. |
615 output_offset -= kPointerSize; | 617 output_offset -= kPointerSize; |
616 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); | 618 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); |
617 output_frame->SetFrameSlot(output_offset, value); | 619 output_frame->SetFrameSlot(output_offset, value); |
618 if (FLAG_trace_deopt) { | 620 if (FLAG_trace_deopt) { |
619 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function (construct sentinel)\n", | 621 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function (construct sentinel)\n", |
620 top_address + output_offset, output_offset, value); | 622 top_address + output_offset, output_offset, value); |
621 } | 623 } |
622 | 624 |
| 625 // The output frame reflects a JSConstructStubGeneric frame. |
| 626 output_offset -= kPointerSize; |
| 627 value = reinterpret_cast<intptr_t>(construct_stub); |
| 628 output_frame->SetFrameSlot(output_offset, value); |
| 629 if (FLAG_trace_deopt) { |
| 630 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; code object\n", |
| 631 top_address + output_offset, output_offset, value); |
| 632 } |
| 633 |
623 // Number of incoming arguments. | 634 // Number of incoming arguments. |
624 output_offset -= kPointerSize; | 635 output_offset -= kPointerSize; |
625 value = reinterpret_cast<uint32_t>(Smi::FromInt(height - 1)); | 636 value = reinterpret_cast<uint32_t>(Smi::FromInt(height - 1)); |
626 output_frame->SetFrameSlot(output_offset, value); | 637 output_frame->SetFrameSlot(output_offset, value); |
627 if (FLAG_trace_deopt) { | 638 if (FLAG_trace_deopt) { |
628 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; argc (%d)\n", | 639 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; argc (%d)\n", |
629 top_address + output_offset, output_offset, value, height - 1); | 640 top_address + output_offset, output_offset, value, height - 1); |
630 } | 641 } |
631 | 642 |
632 // The newly allocated object was passed as receiver in the artificial | 643 // The newly allocated object was passed as receiver in the artificial |
633 // constructor stub environment created by HEnvironment::CopyForInlining(). | 644 // constructor stub environment created by HEnvironment::CopyForInlining(). |
634 output_offset -= kPointerSize; | 645 output_offset -= kPointerSize; |
635 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); | 646 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); |
636 output_frame->SetFrameSlot(output_offset, value); | 647 output_frame->SetFrameSlot(output_offset, value); |
637 if (FLAG_trace_deopt) { | 648 if (FLAG_trace_deopt) { |
638 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; allocated receiver\n", | 649 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; allocated receiver\n", |
639 top_address + output_offset, output_offset, value); | 650 top_address + output_offset, output_offset, value); |
640 } | 651 } |
641 | 652 |
642 ASSERT(0 == output_offset); | 653 ASSERT(0 == output_offset); |
643 | 654 |
644 Builtins* builtins = isolate_->builtins(); | |
645 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); | |
646 uint32_t pc = reinterpret_cast<uint32_t>( | 655 uint32_t pc = reinterpret_cast<uint32_t>( |
647 construct_stub->instruction_start() + | 656 construct_stub->instruction_start() + |
648 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); | 657 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); |
649 output_frame->SetPc(pc); | 658 output_frame->SetPc(pc); |
650 } | 659 } |
651 | 660 |
652 | 661 |
653 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 662 void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
654 int frame_index) { | 663 int frame_index) { |
655 int node_id = iterator->Next(); | 664 int node_id = iterator->Next(); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 } | 1011 } |
1003 __ bind(&done); | 1012 __ bind(&done); |
1004 } | 1013 } |
1005 | 1014 |
1006 #undef __ | 1015 #undef __ |
1007 | 1016 |
1008 | 1017 |
1009 } } // namespace v8::internal | 1018 } } // namespace v8::internal |
1010 | 1019 |
1011 #endif // V8_TARGET_ARCH_IA32 | 1020 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |