Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: src/ia32/deoptimizer-ia32.cc

Issue 12052053: Add StubFailureTrampolineFrames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove extraneous change Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 uint32_t pc = reinterpret_cast<uint32_t>( 555 uint32_t pc = reinterpret_cast<uint32_t>(
556 adaptor_trampoline->instruction_start() + 556 adaptor_trampoline->instruction_start() +
557 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value()); 557 isolate_->heap()->arguments_adaptor_deopt_pc_offset()->value());
558 output_frame->SetPc(pc); 558 output_frame->SetPc(pc);
559 } 559 }
560 560
561 561
562 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator, 562 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
563 int frame_index) { 563 int frame_index) {
564 // 564 //
565 // FROM TO <-ebp 565 // FROM TO
566 // | .... | | .... | 566 // | .... | | .... |
567 // +-------------------------+ +-------------------------+ 567 // +-------------------------+ +-------------------------+
568 // | JSFunction continuation | | parameter 1 | 568 // | JSFunction continuation | | JSFunction continuation |
569 // +-------------------------+ +-------------------------+ 569 // +-------------------------+ +-------------------------+
570 // | | saved frame (ebp) | | .... | 570 // | | saved frame (ebp) | | saved frame (ebp) |
571 // | +=========================+<-ebp +-------------------------+ 571 // | +=========================+<-ebp +=========================+<-ebp
572 // | | JSFunction context | | parameter n | 572 // | | JSFunction context | | JSFunction context |
573 // v +-------------------------+ +-------------------------| 573 // v +-------------------------+ +-------------------------|
574 // | COMPILED_STUB marker | | JSFunction continuation | 574 // | COMPILED_STUB marker | | STUB_FAILURE marker |
575 // +-------------------------+ +-------------------------+<-esp 575 // +-------------------------+ +-------------------------+
576 // | | eax = number of parameters 576 // | | | stub parameter 1 |
577 // | ... | ebx = failure handler address 577 // | ... | +-------------------------+
578 // | | ebp = saved frame 578 // | | | ... |
579 // +-------------------------+<-esp esi = JSFunction context 579 // |-------------------------|<-esp +-------------------------+
580 // 580 // | stub parameter n |
581 // parameters in registers +-------------------------+<-esp
582 // and spilled to stack eax = number of parameters
583 // ebx = failure handler address
584 // ebp = saved frame
585 // esi = JSFunction context
581 // 586 //
582 587
583 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); 588 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
584 int major_key = compiled_code_->major_key(); 589 int major_key = compiled_code_->major_key();
585 CodeStubInterfaceDescriptor* descriptor = 590 CodeStubInterfaceDescriptor* descriptor =
586 isolate_->code_stub_interface_descriptor(major_key); 591 isolate_->code_stub_interface_descriptor(major_key);
587 592
588 int output_frame_size = 593 int output_frame_size = StandardFrameConstants::kFixedFrameSize +
589 (1 + descriptor->register_param_count_) * kPointerSize; 594 kPointerSize * descriptor->register_param_count_;
595
590 FrameDescription* output_frame = 596 FrameDescription* output_frame =
591 new(output_frame_size) FrameDescription(output_frame_size, 0); 597 new(output_frame_size) FrameDescription(output_frame_size, 0);
598 ASSERT(frame_index == 0);
599 output_[frame_index] = output_frame;
592 Code* notify_failure = 600 Code* notify_failure =
593 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure); 601 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
594 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); 602 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
595 output_frame->SetContinuation( 603 output_frame->SetContinuation(
596 reinterpret_cast<uint32_t>(notify_failure->entry())); 604 reinterpret_cast<intptr_t>(notify_failure->entry()));
597 605
598 Code* code; 606 Code* trampoline = NULL;
599 SaveFPRegsMode mode = 607 StubFailureTrampolineStub().FindCodeInCache(&trampoline, isolate_);
600 CpuFeatures::IsSupported(SSE2) ? kSaveFPRegs : kDontSaveFPRegs; 608 ASSERT(trampoline != NULL);
601 CEntryStub(1, mode).FindCodeInCache(&code, isolate_); 609 output_frame->SetPc(reinterpret_cast<intptr_t>(
602 output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start())); 610 trampoline->instruction_start()));
603 unsigned input_frame_size = input_->GetFrameSize(); 611 unsigned input_frame_size = input_->GetFrameSize();
604 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); 612
605 output_frame->SetFrameSlot(0, value); 613 // JSFunction continuation
606 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize); 614 intptr_t input_frame_offset = input_frame_size - kPointerSize;
615 intptr_t output_frame_offset = output_frame_size - kPointerSize;
616 intptr_t value = input_->GetFrameSlot(input_frame_offset);
617 output_frame->SetFrameSlot(output_frame_offset, value);
618
619 // saved frame ptr
620 input_frame_offset -= kPointerSize;
621 value = input_->GetFrameSlot(input_frame_offset);
622 output_frame_offset -= kPointerSize;
623 output_frame->SetFrameSlot(output_frame_offset, value);
624
625 // Restore context
626 input_frame_offset -= kPointerSize;
627 value = input_->GetFrameSlot(input_frame_offset);
628 output_frame->SetRegister(esi.code(), value);
629 output_frame_offset -= kPointerSize;
630 output_frame->SetFrameSlot(output_frame_offset, value);
631
632 // Internal frame markers
633 output_frame_offset -= kPointerSize;
634 value = reinterpret_cast<intptr_t>(
635 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
636 output_frame->SetFrameSlot(output_frame_offset, value);
637
638 for (int i = 0; i < descriptor->register_param_count_; ++i) {
639 output_frame_offset -= kPointerSize;
640 DoTranslateCommand(iterator, 0, output_frame_offset);
641 }
642
643 value = input_->GetRegister(ebp.code());
607 output_frame->SetRegister(ebp.code(), value); 644 output_frame->SetRegister(ebp.code(), value);
608 output_frame->SetFp(value); 645 output_frame->SetFp(value);
609 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
610 output_frame->SetRegister(esi.code(), value);
611
612 int parameter_offset = kPointerSize * descriptor->register_param_count_;
613 for (int i = 0; i < descriptor->register_param_count_; ++i) {
614 Translation::Opcode opcode =
615 static_cast<Translation::Opcode>(iterator->Next());
616 ASSERT(opcode == Translation::REGISTER);
617 USE(opcode);
618 int input_reg = iterator->Next();
619 intptr_t reg_value = input_->GetRegister(input_reg);
620 output_frame->SetFrameSlot(parameter_offset, reg_value);
621 parameter_offset -= kPointerSize;
622 }
623 646
624 intptr_t handler = 647 intptr_t handler =
625 reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_); 648 reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_);
626 output_frame->SetRegister(eax.code(), descriptor->register_param_count_); 649 output_frame->SetRegister(eax.code(), descriptor->register_param_count_);
627 output_frame->SetRegister(ebx.code(), handler); 650 output_frame->SetRegister(ebx.code(), handler);
628
629 ASSERT(frame_index == 0);
630 output_[frame_index] = output_frame;
631 } 651 }
632 652
633 653
634 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, 654 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
635 int frame_index) { 655 int frame_index) {
636 Builtins* builtins = isolate_->builtins(); 656 Builtins* builtins = isolate_->builtins();
637 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); 657 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
638 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); 658 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
639 unsigned height = iterator->Next(); 659 unsigned height = iterator->Next();
640 unsigned height_in_bytes = height * kPointerSize; 660 unsigned height_in_bytes = height * kPointerSize;
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 } 1309 }
1290 __ bind(&done); 1310 __ bind(&done);
1291 } 1311 }
1292 1312
1293 #undef __ 1313 #undef __
1294 1314
1295 1315
1296 } } // namespace v8::internal 1316 } } // namespace v8::internal
1297 1317
1298 #endif // V8_TARGET_ARCH_IA32 1318 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698