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

Side by Side Diff: src/ia32/deoptimizer-ia32.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/hydrogen.cc ('k') | src/mirror-debugger.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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 ast_id, 341 ast_id,
342 input_frame_size, 342 input_frame_size,
343 output_frame_size); 343 output_frame_size);
344 } 344 }
345 345
346 // There's only one output frame in the OSR case. 346 // There's only one output frame in the OSR case.
347 output_count_ = 1; 347 output_count_ = 1;
348 output_ = new FrameDescription*[1]; 348 output_ = new FrameDescription*[1];
349 output_[0] = new(output_frame_size) FrameDescription( 349 output_[0] = new(output_frame_size) FrameDescription(
350 output_frame_size, function_); 350 output_frame_size, function_);
351 #ifdef DEBUG
352 output_[0]->SetKind(Code::OPTIMIZED_FUNCTION);
353 #endif
351 354
352 // Clear the incoming parameters in the optimized frame to avoid 355 // Clear the incoming parameters in the optimized frame to avoid
353 // confusing the garbage collector. 356 // confusing the garbage collector.
354 unsigned output_offset = output_frame_size - kPointerSize; 357 unsigned output_offset = output_frame_size - kPointerSize;
355 int parameter_count = function_->shared()->formal_parameter_count() + 1; 358 int parameter_count = function_->shared()->formal_parameter_count() + 1;
356 for (int i = 0; i < parameter_count; ++i) { 359 for (int i = 0; i < parameter_count; ++i) {
357 output_[0]->SetFrameSlot(output_offset, 0); 360 output_[0]->SetFrameSlot(output_offset, 0);
358 output_offset -= kPointerSize; 361 output_offset -= kPointerSize;
359 } 362 }
360 363
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 457
455 // The 'fixed' part of the frame consists of the incoming parameters and 458 // The 'fixed' part of the frame consists of the incoming parameters and
456 // the part described by JavaScriptFrameConstants. 459 // the part described by JavaScriptFrameConstants.
457 unsigned fixed_frame_size = ComputeFixedSize(function); 460 unsigned fixed_frame_size = ComputeFixedSize(function);
458 unsigned input_frame_size = input_->GetFrameSize(); 461 unsigned input_frame_size = input_->GetFrameSize();
459 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 462 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
460 463
461 // Allocate and store the output frame description. 464 // Allocate and store the output frame description.
462 FrameDescription* output_frame = 465 FrameDescription* output_frame =
463 new(output_frame_size) FrameDescription(output_frame_size, function); 466 new(output_frame_size) FrameDescription(output_frame_size, function);
467 #ifdef DEBUG
468 output_frame->SetKind(Code::FUNCTION);
469 #endif
464 470
465 bool is_bottommost = (0 == frame_index); 471 bool is_bottommost = (0 == frame_index);
466 bool is_topmost = (output_count_ - 1 == frame_index); 472 bool is_topmost = (output_count_ - 1 == frame_index);
467 ASSERT(frame_index >= 0 && frame_index < output_count_); 473 ASSERT(frame_index >= 0 && frame_index < output_count_);
468 ASSERT(output_[frame_index] == NULL); 474 ASSERT(output_[frame_index] == NULL);
469 output_[frame_index] = output_frame; 475 output_[frame_index] = output_frame;
470 476
471 // The top address for the bottommost output frame can be computed from 477 // The top address for the bottommost output frame can be computed from
472 // the input frame pointer and the output frame's height. For all 478 // the input frame pointer and the output frame's height. For all
473 // subsequent output frames, it can be computed from the previous one's 479 // subsequent output frames, it can be computed from the previous one's
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared()); 586 unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared());
581 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state); 587 unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state);
582 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset); 588 uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset);
583 output_frame->SetPc(pc_value); 589 output_frame->SetPc(pc_value);
584 590
585 FullCodeGenerator::State state = 591 FullCodeGenerator::State state =
586 FullCodeGenerator::StateField::decode(pc_and_state); 592 FullCodeGenerator::StateField::decode(pc_and_state);
587 output_frame->SetState(Smi::FromInt(state)); 593 output_frame->SetState(Smi::FromInt(state));
588 594
589 // Set the continuation for the topmost frame. 595 // Set the continuation for the topmost frame.
590 if (is_topmost) { 596 if (is_topmost && bailout_type_ != DEBUGGER) {
591 Builtins* builtins = isolate_->builtins(); 597 Builtins* builtins = isolate_->builtins();
592 Code* continuation = (bailout_type_ == EAGER) 598 Code* continuation = (bailout_type_ == EAGER)
593 ? builtins->builtin(Builtins::kNotifyDeoptimized) 599 ? builtins->builtin(Builtins::kNotifyDeoptimized)
594 : builtins->builtin(Builtins::kNotifyLazyDeoptimized); 600 : builtins->builtin(Builtins::kNotifyLazyDeoptimized);
595 output_frame->SetContinuation( 601 output_frame->SetContinuation(
596 reinterpret_cast<uint32_t>(continuation->entry())); 602 reinterpret_cast<uint32_t>(continuation->entry()));
597 } 603 }
598 604
599 if (output_count_ - 1 == frame_index) iterator->Done(); 605 if (output_count_ - 1 == frame_index) iterator->Done();
600 } 606 }
601 607
602 608
609 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) {
610 // Set the register values. The values are not important as there are no
611 // callee saved registers in JavaScript frames, so all registers are
612 // spilled. Registers ebp and esp are set to the correct values though.
613
614 for (int i = 0; i < Register::kNumRegisters; i++) {
615 input_->SetRegister(i, i * 4);
616 }
617 input_->SetRegister(esp.code(), reinterpret_cast<intptr_t>(frame->sp()));
618 input_->SetRegister(ebp.code(), reinterpret_cast<intptr_t>(frame->fp()));
619 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; i++) {
620 input_->SetDoubleRegister(i, 0.0);
621 }
622
623 // Fill the frame content from the actual data on the frame.
624 for (intptr_t i = 0; i < input_->GetFrameSize(); i += kPointerSize) {
625 input_->SetFrameSlot(i, Memory::uint32_at(tos + i));
626 }
627 }
628
629
603 #define __ masm()-> 630 #define __ masm()->
604 631
605 void Deoptimizer::EntryGenerator::Generate() { 632 void Deoptimizer::EntryGenerator::Generate() {
606 GeneratePrologue(); 633 GeneratePrologue();
607 CpuFeatures::Scope scope(SSE2); 634 CpuFeatures::Scope scope(SSE2);
608 635
609 Isolate* isolate = masm()->isolate(); 636 Isolate* isolate = masm()->isolate();
610 637
611 // Save all general purpose registers before messing with them. 638 // Save all general purpose registers before messing with them.
612 const int kNumberOfRegisters = Register::kNumRegisters; 639 const int kNumberOfRegisters = Register::kNumRegisters;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 } 792 }
766 __ bind(&done); 793 __ bind(&done);
767 } 794 }
768 795
769 #undef __ 796 #undef __
770 797
771 798
772 } } // namespace v8::internal 799 } } // namespace v8::internal
773 800
774 #endif // V8_TARGET_ARCH_IA32 801 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/mirror-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698