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

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

Issue 11635015: Generalize calling to C++ on stub deopt (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes 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.h » ('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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 <-ebp
566 // | .... | | .... | 566 // | .... | | .... |
567 // +-------------------------+ +-------------------------+ 567 // +-------------------------+ +-------------------------+
568 // | JSFunction continuation | | JSFunction continuation | 568 // | JSFunction continuation | | parameter 1 |
569 // +-------------------------+ +-------------------------+
570 // | | saved frame (ebp) | | .... |
571 // | +=========================+<-ebp +-------------------------+
572 // | | JSFunction context | | parameter n |
573 // v +-------------------------+ +-------------------------|
574 // | COMPILED_STUB marker | | JSFunction continuation |
569 // +-------------------------+ +-------------------------+<-esp 575 // +-------------------------+ +-------------------------+<-esp
570 // | | saved frame (ebp) | 576 // | | eax = number of parameters
571 // | +=========================+<-ebp 577 // | ... | ebx = failure handler address
572 // | | JSFunction context | 578 // | | ebp = saved frame
573 // v +-------------------------+ 579 // +-------------------------+<-esp esi = JSFunction context
574 // | COMPILED_STUB marker | ebp = saved frame
575 // +-------------------------+ esi = JSFunction context
576 // | |
577 // | ... |
578 // | |
579 // +-------------------------+<-esp
580 // 580 //
581 // 581 //
582 int output_frame_size = 1 * kPointerSize;
583 FrameDescription* output_frame =
584 new(output_frame_size) FrameDescription(output_frame_size, 0);
585 Code* notify_miss =
586 isolate_->builtins()->builtin(Builtins::kNotifyICMiss);
587 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
588 output_frame->SetContinuation(
589 reinterpret_cast<uint32_t>(notify_miss->entry()));
590 582
591 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); 583 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
592 int major_key = compiled_code_->major_key(); 584 int major_key = compiled_code_->major_key();
593 CodeStubInterfaceDescriptor* descriptor = 585 CodeStubInterfaceDescriptor* descriptor =
594 isolate_->code_stub_interface_descriptor(major_key); 586 isolate_->code_stub_interface_descriptor(major_key);
595 Handle<Code> miss_ic(descriptor->deoptimization_handler_); 587
596 output_frame->SetPc(reinterpret_cast<intptr_t>(miss_ic->instruction_start())); 588 int output_frame_size =
589 (1 + descriptor->register_param_count_) * kPointerSize;
590 FrameDescription* output_frame =
591 new(output_frame_size) FrameDescription(output_frame_size, 0);
592 Code* notify_failure =
593 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
594 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
595 output_frame->SetContinuation(
596 reinterpret_cast<uint32_t>(notify_failure->entry()));
597
598 Code* code;
599 CEntryStub(1, kSaveFPRegs).FindCodeInCache(&code, isolate_);
600 output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start()));
597 unsigned input_frame_size = input_->GetFrameSize(); 601 unsigned input_frame_size = input_->GetFrameSize();
598 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); 602 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize);
599 output_frame->SetFrameSlot(0, value); 603 output_frame->SetFrameSlot(0, value);
600 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize); 604 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize);
601 output_frame->SetRegister(ebp.code(), value); 605 output_frame->SetRegister(ebp.code(), value);
602 output_frame->SetFp(value); 606 output_frame->SetFp(value);
603 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize); 607 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
604 output_frame->SetRegister(esi.code(), value); 608 output_frame->SetRegister(esi.code(), value);
605 609
606 Translation::Opcode opcode = 610 int parameter_offset = kPointerSize * descriptor->register_param_count_;
607 static_cast<Translation::Opcode>(iterator->Next()); 611 for (int i = 0; i < descriptor->register_param_count_; ++i) {
608 ASSERT(opcode == Translation::REGISTER); 612 Translation::Opcode opcode =
609 USE(opcode); 613 static_cast<Translation::Opcode>(iterator->Next());
610 int input_reg = iterator->Next(); 614 ASSERT(opcode == Translation::REGISTER);
611 intptr_t input_value = input_->GetRegister(input_reg); 615 USE(opcode);
612 output_frame->SetRegister(edx.code(), input_value); 616 int input_reg = iterator->Next();
617 intptr_t reg_value = input_->GetRegister(input_reg);
618 output_frame->SetFrameSlot(parameter_offset, reg_value);
619 parameter_offset -= kPointerSize;
620 }
613 621
614 int32_t next = iterator->Next(); 622 intptr_t handler =
615 opcode = static_cast<Translation::Opcode>(next); 623 reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_);
616 ASSERT(opcode == Translation::REGISTER); 624 output_frame->SetRegister(eax.code(), descriptor->register_param_count_);
617 input_reg = iterator->Next(); 625 output_frame->SetRegister(ebx.code(), handler);
618 input_value = input_->GetRegister(input_reg);
619 output_frame->SetRegister(ecx.code(), input_value);
620 626
621 ASSERT(frame_index == 0); 627 ASSERT(frame_index == 0);
622 output_[frame_index] = output_frame; 628 output_[frame_index] = output_frame;
623 } 629 }
624 630
625 631
626 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, 632 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
627 int frame_index) { 633 int frame_index) {
628 Builtins* builtins = isolate_->builtins(); 634 Builtins* builtins = isolate_->builtins();
629 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); 635 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 } 1278 }
1273 __ bind(&done); 1279 __ bind(&done);
1274 } 1280 }
1275 1281
1276 #undef __ 1282 #undef __
1277 1283
1278 1284
1279 } } // namespace v8::internal 1285 } } // namespace v8::internal
1280 1286
1281 #endif // V8_TARGET_ARCH_IA32 1287 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698