| Index: src/x64/deoptimizer-x64.cc
|
| diff --git a/src/x64/deoptimizer-x64.cc b/src/x64/deoptimizer-x64.cc
|
| index a3fe8f9cf7f6a98b4a96a6c530a48c5d3625dc23..778e39e8462d3fcdefcf6ce5fa1c2be445556a6e 100644
|
| --- a/src/x64/deoptimizer-x64.cc
|
| +++ b/src/x64/deoptimizer-x64.cc
|
| @@ -459,6 +459,53 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
|
| }
|
|
|
|
|
| +void Deoptimizer::DoCompiledStubPseudoFrame(TranslationIterator* iterator,
|
| + int frame_index) {
|
| + // Builtins* builtins = isolate_->builtins();
|
| + // Code::Kind stub_kind = static_cast<Code::Kind>(iterator->Next());
|
| + FrameDescription* output_frame = new(0) FrameDescription(0, 0);
|
| + Code* continuation =
|
| + isolate_->builtins()->builtin(Builtins::kNotifyICMiss);
|
| + output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
|
| + output_frame->SetContinuation(
|
| + reinterpret_cast<uintptr_t>(continuation->entry()));
|
| + Handle<Code> miss_ic = isolate_->builtins()->KeyedLoadIC_Miss();
|
| + output_frame->SetPc(
|
| + reinterpret_cast<intptr_t>(miss_ic->instruction_start()));
|
| +
|
| + Code::Kind stub_kind = static_cast<Code::Kind>(iterator->Next());
|
| + ASSERT(stub_kind == Code::KEYED_LOAD_IC);
|
| + USE(stub_kind);
|
| +
|
| + Translation::Opcode opcode =
|
| + static_cast<Translation::Opcode>(iterator->Next());
|
| + ASSERT(opcode == Translation::REGISTER);
|
| + USE(opcode);
|
| + int input_reg = iterator->Next();
|
| + intptr_t input_value = input_->GetRegister(input_reg);
|
| + output_frame->SetRegister(rdx.code(), input_value);
|
| +
|
| + int32_t next = iterator->Next();
|
| + opcode = static_cast<Translation::Opcode>(next);
|
| + ASSERT(opcode == Translation::REGISTER);
|
| + input_reg = iterator->Next();
|
| + input_value = input_->GetRegister(input_reg);
|
| + output_frame->SetRegister(rax.code(), input_value);
|
| +
|
| + Address frame_ptr =
|
| + reinterpret_cast<Address>(input_->GetRegister(rbp.code()));
|
| + Address context_ptr_raw = frame_ptr + StandardFrameConstants::kContextOffset;
|
| + Context** context_ptr =
|
| + reinterpret_cast<Context**>(context_ptr_raw);
|
| + output_frame->SetRegister(rsi.code(),
|
| + reinterpret_cast<intptr_t>(*context_ptr));
|
| + output_frame->SetRegister(rbp.code(), reinterpret_cast<intptr_t>(frame_ptr));
|
| +
|
| + ASSERT(frame_index == 0);
|
| + output_[frame_index] = output_frame;
|
| +}
|
| +
|
| +
|
| void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| int frame_index) {
|
| Builtins* builtins = isolate_->builtins();
|
| @@ -878,7 +925,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
|
| }
|
| input_->SetRegister(rsp.code(), reinterpret_cast<intptr_t>(frame->sp()));
|
| input_->SetRegister(rbp.code(), reinterpret_cast<intptr_t>(frame->fp()));
|
| - for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; i++) {
|
| + for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); i++) {
|
| input_->SetDoubleRegister(i, 0.0);
|
| }
|
|
|
| @@ -898,10 +945,10 @@ void Deoptimizer::EntryGenerator::Generate() {
|
| const int kNumberOfRegisters = Register::kNumRegisters;
|
|
|
| const int kDoubleRegsSize = kDoubleSize *
|
| - XMMRegister::kNumAllocatableRegisters;
|
| + XMMRegister::NumAllocatableRegisters();
|
| __ subq(rsp, Immediate(kDoubleRegsSize));
|
|
|
| - for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) {
|
| + for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) {
|
| XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
|
| int offset = i * kDoubleSize;
|
| __ movsd(Operand(rsp, offset), xmm_reg);
|
| @@ -990,7 +1037,7 @@ void Deoptimizer::EntryGenerator::Generate() {
|
|
|
| // Fill in the double input registers.
|
| int double_regs_offset = FrameDescription::double_registers_offset();
|
| - for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; i++) {
|
| + for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
|
| int dst_offset = i * kDoubleSize + double_regs_offset;
|
| __ pop(Operand(rbx, dst_offset));
|
| }
|
| @@ -1011,10 +1058,13 @@ void Deoptimizer::EntryGenerator::Generate() {
|
| // limit and copy the contents of the activation frame to the input
|
| // frame description.
|
| __ lea(rdx, Operand(rbx, FrameDescription::frame_content_offset()));
|
| + Label pop_loop_header;
|
| + __ jmp(&pop_loop_header);
|
| Label pop_loop;
|
| __ bind(&pop_loop);
|
| __ pop(Operand(rdx, 0));
|
| __ addq(rdx, Immediate(sizeof(intptr_t)));
|
| + __ bind(&pop_loop_header);
|
| __ cmpq(rcx, rsp);
|
| __ j(not_equal, &pop_loop);
|
|
|
| @@ -1031,28 +1081,33 @@ void Deoptimizer::EntryGenerator::Generate() {
|
| __ pop(rax);
|
|
|
| // Replace the current frame with the output frames.
|
| - Label outer_push_loop, inner_push_loop;
|
| + Label outer_push_loop, inner_push_loop,
|
| + outer_loop_header, inner_loop_header;
|
| // Outer loop state: rax = current FrameDescription**, rdx = one past the
|
| // last FrameDescription**.
|
| __ movl(rdx, Operand(rax, Deoptimizer::output_count_offset()));
|
| __ movq(rax, Operand(rax, Deoptimizer::output_offset()));
|
| __ lea(rdx, Operand(rax, rdx, times_8, 0));
|
| + __ jmp(&outer_loop_header);
|
| __ bind(&outer_push_loop);
|
| // Inner loop state: rbx = current FrameDescription*, rcx = loop index.
|
| __ movq(rbx, Operand(rax, 0));
|
| __ movq(rcx, Operand(rbx, FrameDescription::frame_size_offset()));
|
| + __ jmp(&inner_loop_header);
|
| __ bind(&inner_push_loop);
|
| __ subq(rcx, Immediate(sizeof(intptr_t)));
|
| __ push(Operand(rbx, rcx, times_1, FrameDescription::frame_content_offset()));
|
| + __ bind(&inner_loop_header);
|
| __ testq(rcx, rcx);
|
| __ j(not_zero, &inner_push_loop);
|
| __ addq(rax, Immediate(kPointerSize));
|
| + __ bind(&outer_loop_header);
|
| __ cmpq(rax, rdx);
|
| __ j(below, &outer_push_loop);
|
|
|
| // In case of OSR, we have to restore the XMM registers.
|
| if (type() == OSR) {
|
| - for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) {
|
| + for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); ++i) {
|
| XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
|
| int src_offset = i * kDoubleSize + double_regs_offset;
|
| __ movsd(xmm_reg, Operand(rbx, src_offset));
|
|
|