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

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

Issue 7230045: Support debugger inspection of locals in optimized frames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 9 years, 5 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/runtime.cc ('k') | test/mjsunit/debug-evaluate-locals-optimized.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 ast_id, 333 ast_id,
334 input_frame_size, 334 input_frame_size,
335 output_frame_size); 335 output_frame_size);
336 } 336 }
337 337
338 // There's only one output frame in the OSR case. 338 // There's only one output frame in the OSR case.
339 output_count_ = 1; 339 output_count_ = 1;
340 output_ = new FrameDescription*[1]; 340 output_ = new FrameDescription*[1];
341 output_[0] = new(output_frame_size) FrameDescription( 341 output_[0] = new(output_frame_size) FrameDescription(
342 output_frame_size, function_); 342 output_frame_size, function_);
343 #ifdef DEBUG
344 output_[0]->SetKind(Code::OPTIMIZED_FUNCTION);
345 #endif
343 346
344 // Clear the incoming parameters in the optimized frame to avoid 347 // Clear the incoming parameters in the optimized frame to avoid
345 // confusing the garbage collector. 348 // confusing the garbage collector.
346 unsigned output_offset = output_frame_size - kPointerSize; 349 unsigned output_offset = output_frame_size - kPointerSize;
347 int parameter_count = function_->shared()->formal_parameter_count() + 1; 350 int parameter_count = function_->shared()->formal_parameter_count() + 1;
348 for (int i = 0; i < parameter_count; ++i) { 351 for (int i = 0; i < parameter_count; ++i) {
349 output_[0]->SetFrameSlot(output_offset, 0); 352 output_[0]->SetFrameSlot(output_offset, 0);
350 output_offset -= kPointerSize; 353 output_offset -= kPointerSize;
351 } 354 }
352 355
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 450
448 // The 'fixed' part of the frame consists of the incoming parameters and 451 // The 'fixed' part of the frame consists of the incoming parameters and
449 // the part described by JavaScriptFrameConstants. 452 // the part described by JavaScriptFrameConstants.
450 unsigned fixed_frame_size = ComputeFixedSize(function); 453 unsigned fixed_frame_size = ComputeFixedSize(function);
451 unsigned input_frame_size = static_cast<unsigned>(input_->GetFrameSize()); 454 unsigned input_frame_size = static_cast<unsigned>(input_->GetFrameSize());
452 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 455 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
453 456
454 // Allocate and store the output frame description. 457 // Allocate and store the output frame description.
455 FrameDescription* output_frame = 458 FrameDescription* output_frame =
456 new(output_frame_size) FrameDescription(output_frame_size, function); 459 new(output_frame_size) FrameDescription(output_frame_size, function);
460 #ifdef DEBUG
461 output_frame->SetKind(Code::FUNCTION);
462 #endif
457 463
458 bool is_bottommost = (0 == frame_index); 464 bool is_bottommost = (0 == frame_index);
459 bool is_topmost = (output_count_ - 1 == frame_index); 465 bool is_topmost = (output_count_ - 1 == frame_index);
460 ASSERT(frame_index >= 0 && frame_index < output_count_); 466 ASSERT(frame_index >= 0 && frame_index < output_count_);
461 ASSERT(output_[frame_index] == NULL); 467 ASSERT(output_[frame_index] == NULL);
462 output_[frame_index] = output_frame; 468 output_[frame_index] = output_frame;
463 469
464 // The top address for the bottommost output frame can be computed from 470 // The top address for the bottommost output frame can be computed from
465 // the input frame pointer and the output frame's height. For all 471 // the input frame pointer and the output frame's height. For all
466 // subsequent output frames, it can be computed from the previous one's 472 // subsequent output frames, it can be computed from the previous one's
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared()); 583 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared());
578 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); 584 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state);
579 intptr_t pc_value = reinterpret_cast<intptr_t>(start + pc_offset); 585 intptr_t pc_value = reinterpret_cast<intptr_t>(start + pc_offset);
580 output_frame->SetPc(pc_value); 586 output_frame->SetPc(pc_value);
581 587
582 FullCodeGenerator::State state = 588 FullCodeGenerator::State state =
583 FullCodeGenerator::StateField::decode(pc_and_state); 589 FullCodeGenerator::StateField::decode(pc_and_state);
584 output_frame->SetState(Smi::FromInt(state)); 590 output_frame->SetState(Smi::FromInt(state));
585 591
586 // Set the continuation for the topmost frame. 592 // Set the continuation for the topmost frame.
587 if (is_topmost) { 593 if (is_topmost && bailout_type_ != DEBUGGER) {
588 Code* continuation = (bailout_type_ == EAGER) 594 Code* continuation = (bailout_type_ == EAGER)
589 ? isolate_->builtins()->builtin(Builtins::kNotifyDeoptimized) 595 ? isolate_->builtins()->builtin(Builtins::kNotifyDeoptimized)
590 : isolate_->builtins()->builtin(Builtins::kNotifyLazyDeoptimized); 596 : isolate_->builtins()->builtin(Builtins::kNotifyLazyDeoptimized);
591 output_frame->SetContinuation( 597 output_frame->SetContinuation(
592 reinterpret_cast<intptr_t>(continuation->entry())); 598 reinterpret_cast<intptr_t>(continuation->entry()));
593 } 599 }
594 600
595 if (output_count_ - 1 == frame_index) iterator->Done(); 601 if (output_count_ - 1 == frame_index) iterator->Done();
596 } 602 }
597 603
598 604
605 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
606 // Set the register values. The values are not important as there are no
607 // callee saved registers in JavaScript frames, so all registers are
608 // spilled. Registers rbp and rsp are set to the correct values though.
609 for (int i = 0; i < Register::kNumRegisters; i++) {
610 input_->SetRegister(i, i * 4);
611 }
612 input_->SetRegister(rsp.code(), reinterpret_cast<intptr_t>(frame->sp()));
613 input_->SetRegister(rbp.code(), reinterpret_cast<intptr_t>(frame->fp()));
614 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; i++) {
615 input_->SetDoubleRegister(i, 0.0);
616 }
617
618 // Fill the frame content from the actual data on the frame.
619 for (intptr_t i = 0; i < input_->GetFrameSize(); i += kPointerSize) {
620 input_->SetFrameSlot(i, Memory::uint64_at(tos + i));
621 }
622 }
623
624
599 #define __ masm()-> 625 #define __ masm()->
600 626
601 void Deoptimizer::EntryGenerator::Generate() { 627 void Deoptimizer::EntryGenerator::Generate() {
602 GeneratePrologue(); 628 GeneratePrologue();
603 629
604 // Save all general purpose registers before messing with them. 630 // Save all general purpose registers before messing with them.
605 const int kNumberOfRegisters = Register::kNumRegisters; 631 const int kNumberOfRegisters = Register::kNumRegisters;
606 632
607 const int kDoubleRegsSize = kDoubleSize * 633 const int kDoubleRegsSize = kDoubleSize *
608 XMMRegister::kNumAllocatableRegisters; 634 XMMRegister::kNumAllocatableRegisters;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 } 832 }
807 __ bind(&done); 833 __ bind(&done);
808 } 834 }
809 835
810 #undef __ 836 #undef __
811 837
812 838
813 } } // namespace v8::internal 839 } } // namespace v8::internal
814 840
815 #endif // V8_TARGET_ARCH_X64 841 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/debug-evaluate-locals-optimized.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698