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

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

Issue 12208011: Add separate flag for --trace-stub-failures (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 10 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/deoptimizer-ia32.cc ('k') | no next file » | 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 PrintF(" => pc=0x%0" V8PRIxPTR "]\n", output_[0]->GetPc()); 345 PrintF(" => pc=0x%0" V8PRIxPTR "]\n", output_[0]->GetPc());
346 } 346 }
347 } 347 }
348 348
349 349
350 void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, 350 void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
351 int frame_index) { 351 int frame_index) {
352 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); 352 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
353 unsigned height = iterator->Next(); 353 unsigned height = iterator->Next();
354 unsigned height_in_bytes = height * kPointerSize; 354 unsigned height_in_bytes = height * kPointerSize;
355 if (FLAG_trace_deopt) { 355 if (trace_) {
356 PrintF(" translating arguments adaptor => height=%d\n", height_in_bytes); 356 PrintF(" translating arguments adaptor => height=%d\n", height_in_bytes);
357 } 357 }
358 358
359 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize; 359 unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize;
360 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 360 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
361 361
362 // Allocate and store the output frame description. 362 // Allocate and store the output frame description.
363 FrameDescription* output_frame = 363 FrameDescription* output_frame =
364 new(output_frame_size) FrameDescription(output_frame_size, function); 364 new(output_frame_size) FrameDescription(output_frame_size, function);
365 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR); 365 output_frame->SetFrameType(StackFrame::ARGUMENTS_ADAPTOR);
(...skipping 14 matching lines...) Expand all
380 unsigned output_offset = output_frame_size; 380 unsigned output_offset = output_frame_size;
381 for (int i = 0; i < parameter_count; ++i) { 381 for (int i = 0; i < parameter_count; ++i) {
382 output_offset -= kPointerSize; 382 output_offset -= kPointerSize;
383 DoTranslateCommand(iterator, frame_index, output_offset); 383 DoTranslateCommand(iterator, frame_index, output_offset);
384 } 384 }
385 385
386 // Read caller's PC from the previous frame. 386 // Read caller's PC from the previous frame.
387 output_offset -= kPointerSize; 387 output_offset -= kPointerSize;
388 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 388 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
389 output_frame->SetFrameSlot(output_offset, callers_pc); 389 output_frame->SetFrameSlot(output_offset, callers_pc);
390 if (FLAG_trace_deopt) { 390 if (trace_) {
391 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 391 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
392 V8PRIxPTR " ; caller's pc\n", 392 V8PRIxPTR " ; caller's pc\n",
393 top_address + output_offset, output_offset, callers_pc); 393 top_address + output_offset, output_offset, callers_pc);
394 } 394 }
395 395
396 // Read caller's FP from the previous frame, and set this frame's FP. 396 // Read caller's FP from the previous frame, and set this frame's FP.
397 output_offset -= kPointerSize; 397 output_offset -= kPointerSize;
398 intptr_t value = output_[frame_index - 1]->GetFp(); 398 intptr_t value = output_[frame_index - 1]->GetFp();
399 output_frame->SetFrameSlot(output_offset, value); 399 output_frame->SetFrameSlot(output_offset, value);
400 intptr_t fp_value = top_address + output_offset; 400 intptr_t fp_value = top_address + output_offset;
401 output_frame->SetFp(fp_value); 401 output_frame->SetFp(fp_value);
402 if (FLAG_trace_deopt) { 402 if (trace_) {
403 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 403 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
404 V8PRIxPTR " ; caller's fp\n", 404 V8PRIxPTR " ; caller's fp\n",
405 fp_value, output_offset, value); 405 fp_value, output_offset, value);
406 } 406 }
407 407
408 // A marker value is used in place of the context. 408 // A marker value is used in place of the context.
409 output_offset -= kPointerSize; 409 output_offset -= kPointerSize;
410 intptr_t context = reinterpret_cast<intptr_t>( 410 intptr_t context = reinterpret_cast<intptr_t>(
411 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 411 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
412 output_frame->SetFrameSlot(output_offset, context); 412 output_frame->SetFrameSlot(output_offset, context);
413 if (FLAG_trace_deopt) { 413 if (trace_) {
414 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 414 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
415 V8PRIxPTR " ; context (adaptor sentinel)\n", 415 V8PRIxPTR " ; context (adaptor sentinel)\n",
416 top_address + output_offset, output_offset, context); 416 top_address + output_offset, output_offset, context);
417 } 417 }
418 418
419 // The function was mentioned explicitly in the ARGUMENTS_ADAPTOR_FRAME. 419 // The function was mentioned explicitly in the ARGUMENTS_ADAPTOR_FRAME.
420 output_offset -= kPointerSize; 420 output_offset -= kPointerSize;
421 value = reinterpret_cast<intptr_t>(function); 421 value = reinterpret_cast<intptr_t>(function);
422 output_frame->SetFrameSlot(output_offset, value); 422 output_frame->SetFrameSlot(output_offset, value);
423 if (FLAG_trace_deopt) { 423 if (trace_) {
424 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 424 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
425 V8PRIxPTR " ; function\n", 425 V8PRIxPTR " ; function\n",
426 top_address + output_offset, output_offset, value); 426 top_address + output_offset, output_offset, value);
427 } 427 }
428 428
429 // Number of incoming arguments. 429 // Number of incoming arguments.
430 output_offset -= kPointerSize; 430 output_offset -= kPointerSize;
431 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); 431 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1));
432 output_frame->SetFrameSlot(output_offset, value); 432 output_frame->SetFrameSlot(output_offset, value);
433 if (FLAG_trace_deopt) { 433 if (trace_) {
434 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 434 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
435 V8PRIxPTR " ; argc (%d)\n", 435 V8PRIxPTR " ; argc (%d)\n",
436 top_address + output_offset, output_offset, value, height - 1); 436 top_address + output_offset, output_offset, value, height - 1);
437 } 437 }
438 438
439 ASSERT(0 == output_offset); 439 ASSERT(0 == output_offset);
440 440
441 Builtins* builtins = isolate_->builtins(); 441 Builtins* builtins = isolate_->builtins();
442 Code* adaptor_trampoline = 442 Code* adaptor_trampoline =
443 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline); 443 builtins->builtin(Builtins::kArgumentsAdaptorTrampoline);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } 585 }
586 586
587 587
588 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, 588 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
589 int frame_index) { 589 int frame_index) {
590 Builtins* builtins = isolate_->builtins(); 590 Builtins* builtins = isolate_->builtins();
591 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); 591 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
592 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next())); 592 JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
593 unsigned height = iterator->Next(); 593 unsigned height = iterator->Next();
594 unsigned height_in_bytes = height * kPointerSize; 594 unsigned height_in_bytes = height * kPointerSize;
595 if (FLAG_trace_deopt) { 595 if (trace_) {
596 PrintF(" translating construct stub => height=%d\n", height_in_bytes); 596 PrintF(" translating construct stub => height=%d\n", height_in_bytes);
597 } 597 }
598 598
599 unsigned fixed_frame_size = 7 * kPointerSize; 599 unsigned fixed_frame_size = 7 * kPointerSize;
600 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 600 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
601 601
602 // Allocate and store the output frame description. 602 // Allocate and store the output frame description.
603 FrameDescription* output_frame = 603 FrameDescription* output_frame =
604 new(output_frame_size) FrameDescription(output_frame_size, function); 604 new(output_frame_size) FrameDescription(output_frame_size, function);
605 output_frame->SetFrameType(StackFrame::CONSTRUCT); 605 output_frame->SetFrameType(StackFrame::CONSTRUCT);
(...skipping 14 matching lines...) Expand all
620 unsigned output_offset = output_frame_size; 620 unsigned output_offset = output_frame_size;
621 for (int i = 0; i < parameter_count; ++i) { 621 for (int i = 0; i < parameter_count; ++i) {
622 output_offset -= kPointerSize; 622 output_offset -= kPointerSize;
623 DoTranslateCommand(iterator, frame_index, output_offset); 623 DoTranslateCommand(iterator, frame_index, output_offset);
624 } 624 }
625 625
626 // Read caller's PC from the previous frame. 626 // Read caller's PC from the previous frame.
627 output_offset -= kPointerSize; 627 output_offset -= kPointerSize;
628 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 628 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
629 output_frame->SetFrameSlot(output_offset, callers_pc); 629 output_frame->SetFrameSlot(output_offset, callers_pc);
630 if (FLAG_trace_deopt) { 630 if (trace_) {
631 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 631 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
632 V8PRIxPTR " ; caller's pc\n", 632 V8PRIxPTR " ; caller's pc\n",
633 top_address + output_offset, output_offset, callers_pc); 633 top_address + output_offset, output_offset, callers_pc);
634 } 634 }
635 635
636 // Read caller's FP from the previous frame, and set this frame's FP. 636 // Read caller's FP from the previous frame, and set this frame's FP.
637 output_offset -= kPointerSize; 637 output_offset -= kPointerSize;
638 intptr_t value = output_[frame_index - 1]->GetFp(); 638 intptr_t value = output_[frame_index - 1]->GetFp();
639 output_frame->SetFrameSlot(output_offset, value); 639 output_frame->SetFrameSlot(output_offset, value);
640 intptr_t fp_value = top_address + output_offset; 640 intptr_t fp_value = top_address + output_offset;
641 output_frame->SetFp(fp_value); 641 output_frame->SetFp(fp_value);
642 if (FLAG_trace_deopt) { 642 if (trace_) {
643 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 643 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
644 V8PRIxPTR " ; caller's fp\n", 644 V8PRIxPTR " ; caller's fp\n",
645 fp_value, output_offset, value); 645 fp_value, output_offset, value);
646 } 646 }
647 647
648 // The context can be gotten from the previous frame. 648 // The context can be gotten from the previous frame.
649 output_offset -= kPointerSize; 649 output_offset -= kPointerSize;
650 value = output_[frame_index - 1]->GetContext(); 650 value = output_[frame_index - 1]->GetContext();
651 output_frame->SetFrameSlot(output_offset, value); 651 output_frame->SetFrameSlot(output_offset, value);
652 if (FLAG_trace_deopt) { 652 if (trace_) {
653 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 653 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
654 V8PRIxPTR " ; context\n", 654 V8PRIxPTR " ; context\n",
655 top_address + output_offset, output_offset, value); 655 top_address + output_offset, output_offset, value);
656 } 656 }
657 657
658 // A marker value is used in place of the function. 658 // A marker value is used in place of the function.
659 output_offset -= kPointerSize; 659 output_offset -= kPointerSize;
660 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); 660 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT));
661 output_frame->SetFrameSlot(output_offset, value); 661 output_frame->SetFrameSlot(output_offset, value);
662 if (FLAG_trace_deopt) { 662 if (trace_) {
663 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 663 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
664 V8PRIxPTR " ; function (construct sentinel)\n", 664 V8PRIxPTR " ; function (construct sentinel)\n",
665 top_address + output_offset, output_offset, value); 665 top_address + output_offset, output_offset, value);
666 } 666 }
667 667
668 // The output frame reflects a JSConstructStubGeneric frame. 668 // The output frame reflects a JSConstructStubGeneric frame.
669 output_offset -= kPointerSize; 669 output_offset -= kPointerSize;
670 value = reinterpret_cast<intptr_t>(construct_stub); 670 value = reinterpret_cast<intptr_t>(construct_stub);
671 output_frame->SetFrameSlot(output_offset, value); 671 output_frame->SetFrameSlot(output_offset, value);
672 if (FLAG_trace_deopt) { 672 if (trace_) {
673 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 673 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
674 V8PRIxPTR " ; code object\n", 674 V8PRIxPTR " ; code object\n",
675 top_address + output_offset, output_offset, value); 675 top_address + output_offset, output_offset, value);
676 } 676 }
677 677
678 // Number of incoming arguments. 678 // Number of incoming arguments.
679 output_offset -= kPointerSize; 679 output_offset -= kPointerSize;
680 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1)); 680 value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1));
681 output_frame->SetFrameSlot(output_offset, value); 681 output_frame->SetFrameSlot(output_offset, value);
682 if (FLAG_trace_deopt) { 682 if (trace_) {
683 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 683 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
684 V8PRIxPTR " ; argc (%d)\n", 684 V8PRIxPTR " ; argc (%d)\n",
685 top_address + output_offset, output_offset, value, height - 1); 685 top_address + output_offset, output_offset, value, height - 1);
686 } 686 }
687 687
688 // The newly allocated object was passed as receiver in the artificial 688 // The newly allocated object was passed as receiver in the artificial
689 // constructor stub environment created by HEnvironment::CopyForInlining(). 689 // constructor stub environment created by HEnvironment::CopyForInlining().
690 output_offset -= kPointerSize; 690 output_offset -= kPointerSize;
691 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); 691 value = output_frame->GetFrameSlot(output_frame_size - kPointerSize);
692 output_frame->SetFrameSlot(output_offset, value); 692 output_frame->SetFrameSlot(output_offset, value);
693 if (FLAG_trace_deopt) { 693 if (trace_) {
694 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 694 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
695 V8PRIxPTR " ; allocated receiver\n", 695 V8PRIxPTR " ; allocated receiver\n",
696 top_address + output_offset, output_offset, value); 696 top_address + output_offset, output_offset, value);
697 } 697 }
698 698
699 ASSERT(0 == output_offset); 699 ASSERT(0 == output_offset);
700 700
701 intptr_t pc = reinterpret_cast<intptr_t>( 701 intptr_t pc = reinterpret_cast<intptr_t>(
702 construct_stub->instruction_start() + 702 construct_stub->instruction_start() +
703 isolate_->heap()->construct_stub_deopt_pc_offset()->value()); 703 isolate_->heap()->construct_stub_deopt_pc_offset()->value());
704 output_frame->SetPc(pc); 704 output_frame->SetPc(pc);
705 } 705 }
706 706
707 707
708 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, 708 void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
709 int frame_index, 709 int frame_index,
710 bool is_setter_stub_frame) { 710 bool is_setter_stub_frame) {
711 JSFunction* accessor = JSFunction::cast(ComputeLiteral(iterator->Next())); 711 JSFunction* accessor = JSFunction::cast(ComputeLiteral(iterator->Next()));
712 // The receiver (and the implicit return value, if any) are expected in 712 // The receiver (and the implicit return value, if any) are expected in
713 // registers by the LoadIC/StoreIC, so they don't belong to the output stack 713 // registers by the LoadIC/StoreIC, so they don't belong to the output stack
714 // frame. This means that we have to use a height of 0. 714 // frame. This means that we have to use a height of 0.
715 unsigned height = 0; 715 unsigned height = 0;
716 unsigned height_in_bytes = height * kPointerSize; 716 unsigned height_in_bytes = height * kPointerSize;
717 const char* kind = is_setter_stub_frame ? "setter" : "getter"; 717 const char* kind = is_setter_stub_frame ? "setter" : "getter";
718 if (FLAG_trace_deopt) { 718 if (trace_) {
719 PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes); 719 PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes);
720 } 720 }
721 721
722 // We need 1 stack entry for the return address + 4 stack entries from 722 // We need 1 stack entry for the return address + 4 stack entries from
723 // StackFrame::INTERNAL (FP, context, frame type, code object, see 723 // StackFrame::INTERNAL (FP, context, frame type, code object, see
724 // MacroAssembler::EnterFrame). For a setter stub frame we need one additional 724 // MacroAssembler::EnterFrame). For a setter stub frame we need one additional
725 // entry for the implicit return value, see 725 // entry for the implicit return value, see
726 // StoreStubCompiler::CompileStoreViaSetter. 726 // StoreStubCompiler::CompileStoreViaSetter.
727 unsigned fixed_frame_entries = 1 + 4 + (is_setter_stub_frame ? 1 : 0); 727 unsigned fixed_frame_entries = 1 + 4 + (is_setter_stub_frame ? 1 : 0);
728 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize; 728 unsigned fixed_frame_size = fixed_frame_entries * kPointerSize;
(...skipping 13 matching lines...) Expand all
742 // this frame's size. 742 // this frame's size.
743 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; 743 intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
744 output_frame->SetTop(top_address); 744 output_frame->SetTop(top_address);
745 745
746 unsigned output_offset = output_frame_size; 746 unsigned output_offset = output_frame_size;
747 747
748 // Read caller's PC from the previous frame. 748 // Read caller's PC from the previous frame.
749 output_offset -= kPointerSize; 749 output_offset -= kPointerSize;
750 intptr_t callers_pc = output_[frame_index - 1]->GetPc(); 750 intptr_t callers_pc = output_[frame_index - 1]->GetPc();
751 output_frame->SetFrameSlot(output_offset, callers_pc); 751 output_frame->SetFrameSlot(output_offset, callers_pc);
752 if (FLAG_trace_deopt) { 752 if (trace_) {
753 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 753 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
754 " ; caller's pc\n", 754 " ; caller's pc\n",
755 top_address + output_offset, output_offset, callers_pc); 755 top_address + output_offset, output_offset, callers_pc);
756 } 756 }
757 757
758 // Read caller's FP from the previous frame, and set this frame's FP. 758 // Read caller's FP from the previous frame, and set this frame's FP.
759 output_offset -= kPointerSize; 759 output_offset -= kPointerSize;
760 intptr_t value = output_[frame_index - 1]->GetFp(); 760 intptr_t value = output_[frame_index - 1]->GetFp();
761 output_frame->SetFrameSlot(output_offset, value); 761 output_frame->SetFrameSlot(output_offset, value);
762 intptr_t fp_value = top_address + output_offset; 762 intptr_t fp_value = top_address + output_offset;
763 output_frame->SetFp(fp_value); 763 output_frame->SetFp(fp_value);
764 if (FLAG_trace_deopt) { 764 if (trace_) {
765 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 765 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
766 " ; caller's fp\n", 766 " ; caller's fp\n",
767 fp_value, output_offset, value); 767 fp_value, output_offset, value);
768 } 768 }
769 769
770 // The context can be gotten from the previous frame. 770 // The context can be gotten from the previous frame.
771 output_offset -= kPointerSize; 771 output_offset -= kPointerSize;
772 value = output_[frame_index - 1]->GetContext(); 772 value = output_[frame_index - 1]->GetContext();
773 output_frame->SetFrameSlot(output_offset, value); 773 output_frame->SetFrameSlot(output_offset, value);
774 if (FLAG_trace_deopt) { 774 if (trace_) {
775 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 775 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
776 " ; context\n", 776 " ; context\n",
777 top_address + output_offset, output_offset, value); 777 top_address + output_offset, output_offset, value);
778 } 778 }
779 779
780 // A marker value is used in place of the function. 780 // A marker value is used in place of the function.
781 output_offset -= kPointerSize; 781 output_offset -= kPointerSize;
782 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); 782 value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
783 output_frame->SetFrameSlot(output_offset, value); 783 output_frame->SetFrameSlot(output_offset, value);
784 if (FLAG_trace_deopt) { 784 if (trace_) {
785 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 785 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
786 " ; function (%s sentinel)\n", 786 " ; function (%s sentinel)\n",
787 top_address + output_offset, output_offset, value, kind); 787 top_address + output_offset, output_offset, value, kind);
788 } 788 }
789 789
790 // Get Code object from accessor stub. 790 // Get Code object from accessor stub.
791 output_offset -= kPointerSize; 791 output_offset -= kPointerSize;
792 Builtins::Name name = is_setter_stub_frame ? 792 Builtins::Name name = is_setter_stub_frame ?
793 Builtins::kStoreIC_Setter_ForDeopt : 793 Builtins::kStoreIC_Setter_ForDeopt :
794 Builtins::kLoadIC_Getter_ForDeopt; 794 Builtins::kLoadIC_Getter_ForDeopt;
795 Code* accessor_stub = isolate_->builtins()->builtin(name); 795 Code* accessor_stub = isolate_->builtins()->builtin(name);
796 value = reinterpret_cast<intptr_t>(accessor_stub); 796 value = reinterpret_cast<intptr_t>(accessor_stub);
797 output_frame->SetFrameSlot(output_offset, value); 797 output_frame->SetFrameSlot(output_offset, value);
798 if (FLAG_trace_deopt) { 798 if (trace_) {
799 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR 799 PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
800 " ; code object\n", 800 " ; code object\n",
801 top_address + output_offset, output_offset, value); 801 top_address + output_offset, output_offset, value);
802 } 802 }
803 803
804 // Skip receiver. 804 // Skip receiver.
805 Translation::Opcode opcode = 805 Translation::Opcode opcode =
806 static_cast<Translation::Opcode>(iterator->Next()); 806 static_cast<Translation::Opcode>(iterator->Next());
807 iterator->Skip(Translation::NumberOfOperandsFor(opcode)); 807 iterator->Skip(Translation::NumberOfOperandsFor(opcode));
808 808
(...skipping 22 matching lines...) Expand all
831 if (frame_index != 0) { 831 if (frame_index != 0) {
832 function = JSFunction::cast(ComputeLiteral(iterator->Next())); 832 function = JSFunction::cast(ComputeLiteral(iterator->Next()));
833 } else { 833 } else {
834 int closure_id = iterator->Next(); 834 int closure_id = iterator->Next();
835 USE(closure_id); 835 USE(closure_id);
836 ASSERT_EQ(Translation::kSelfLiteralId, closure_id); 836 ASSERT_EQ(Translation::kSelfLiteralId, closure_id);
837 function = function_; 837 function = function_;
838 } 838 }
839 unsigned height = iterator->Next(); 839 unsigned height = iterator->Next();
840 unsigned height_in_bytes = height * kPointerSize; 840 unsigned height_in_bytes = height * kPointerSize;
841 if (FLAG_trace_deopt) { 841 if (trace_) {
842 PrintF(" translating "); 842 PrintF(" translating ");
843 function->PrintName(); 843 function->PrintName();
844 PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); 844 PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes);
845 } 845 }
846 846
847 // The 'fixed' part of the frame consists of the incoming parameters and 847 // The 'fixed' part of the frame consists of the incoming parameters and
848 // the part described by JavaScriptFrameConstants. 848 // the part described by JavaScriptFrameConstants.
849 unsigned fixed_frame_size = ComputeFixedSize(function); 849 unsigned fixed_frame_size = ComputeFixedSize(function);
850 unsigned input_frame_size = input_->GetFrameSize(); 850 unsigned input_frame_size = input_->GetFrameSize();
851 unsigned output_frame_size = height_in_bytes + fixed_frame_size; 851 unsigned output_frame_size = height_in_bytes + fixed_frame_size;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 // function code and AST id of the bailout. 895 // function code and AST id of the bailout.
896 output_offset -= kPointerSize; 896 output_offset -= kPointerSize;
897 input_offset -= kPointerSize; 897 input_offset -= kPointerSize;
898 intptr_t value; 898 intptr_t value;
899 if (is_bottommost) { 899 if (is_bottommost) {
900 value = input_->GetFrameSlot(input_offset); 900 value = input_->GetFrameSlot(input_offset);
901 } else { 901 } else {
902 value = output_[frame_index - 1]->GetPc(); 902 value = output_[frame_index - 1]->GetPc();
903 } 903 }
904 output_frame->SetFrameSlot(output_offset, value); 904 output_frame->SetFrameSlot(output_offset, value);
905 if (FLAG_trace_deopt) { 905 if (trace_) {
906 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 906 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
907 V8PRIxPTR " ; caller's pc\n", 907 V8PRIxPTR " ; caller's pc\n",
908 top_address + output_offset, output_offset, value); 908 top_address + output_offset, output_offset, value);
909 } 909 }
910 910
911 // The caller's frame pointer for the bottommost output frame is the same 911 // The caller's frame pointer for the bottommost output frame is the same
912 // as in the input frame. For all subsequent output frames, it can be 912 // as in the input frame. For all subsequent output frames, it can be
913 // read from the previous one. Also compute and set this frame's frame 913 // read from the previous one. Also compute and set this frame's frame
914 // pointer. 914 // pointer.
915 output_offset -= kPointerSize; 915 output_offset -= kPointerSize;
916 input_offset -= kPointerSize; 916 input_offset -= kPointerSize;
917 if (is_bottommost) { 917 if (is_bottommost) {
918 value = input_->GetFrameSlot(input_offset); 918 value = input_->GetFrameSlot(input_offset);
919 } else { 919 } else {
920 value = output_[frame_index - 1]->GetFp(); 920 value = output_[frame_index - 1]->GetFp();
921 } 921 }
922 output_frame->SetFrameSlot(output_offset, value); 922 output_frame->SetFrameSlot(output_offset, value);
923 intptr_t fp_value = top_address + output_offset; 923 intptr_t fp_value = top_address + output_offset;
924 ASSERT(!is_bottommost || input_->GetRegister(rbp.code()) == fp_value); 924 ASSERT(!is_bottommost || input_->GetRegister(rbp.code()) == fp_value);
925 output_frame->SetFp(fp_value); 925 output_frame->SetFp(fp_value);
926 if (is_topmost) output_frame->SetRegister(rbp.code(), fp_value); 926 if (is_topmost) output_frame->SetRegister(rbp.code(), fp_value);
927 if (FLAG_trace_deopt) { 927 if (trace_) {
928 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 928 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
929 V8PRIxPTR " ; caller's fp\n", 929 V8PRIxPTR " ; caller's fp\n",
930 fp_value, output_offset, value); 930 fp_value, output_offset, value);
931 } 931 }
932 932
933 // For the bottommost output frame the context can be gotten from the input 933 // For the bottommost output frame the context can be gotten from the input
934 // frame. For all subsequent output frames it can be gotten from the function 934 // frame. For all subsequent output frames it can be gotten from the function
935 // so long as we don't inline functions that need local contexts. 935 // so long as we don't inline functions that need local contexts.
936 output_offset -= kPointerSize; 936 output_offset -= kPointerSize;
937 input_offset -= kPointerSize; 937 input_offset -= kPointerSize;
938 if (is_bottommost) { 938 if (is_bottommost) {
939 value = input_->GetFrameSlot(input_offset); 939 value = input_->GetFrameSlot(input_offset);
940 } else { 940 } else {
941 value = reinterpret_cast<intptr_t>(function->context()); 941 value = reinterpret_cast<intptr_t>(function->context());
942 } 942 }
943 output_frame->SetFrameSlot(output_offset, value); 943 output_frame->SetFrameSlot(output_offset, value);
944 output_frame->SetContext(value); 944 output_frame->SetContext(value);
945 if (is_topmost) output_frame->SetRegister(rsi.code(), value); 945 if (is_topmost) output_frame->SetRegister(rsi.code(), value);
946 if (FLAG_trace_deopt) { 946 if (trace_) {
947 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 947 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
948 V8PRIxPTR "; context\n", 948 V8PRIxPTR "; context\n",
949 top_address + output_offset, output_offset, value); 949 top_address + output_offset, output_offset, value);
950 } 950 }
951 951
952 // The function was mentioned explicitly in the BEGIN_FRAME. 952 // The function was mentioned explicitly in the BEGIN_FRAME.
953 output_offset -= kPointerSize; 953 output_offset -= kPointerSize;
954 input_offset -= kPointerSize; 954 input_offset -= kPointerSize;
955 value = reinterpret_cast<intptr_t>(function); 955 value = reinterpret_cast<intptr_t>(function);
956 // The function for the bottommost output frame should also agree with the 956 // The function for the bottommost output frame should also agree with the
957 // input frame. 957 // input frame.
958 ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value); 958 ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value);
959 output_frame->SetFrameSlot(output_offset, value); 959 output_frame->SetFrameSlot(output_offset, value);
960 if (FLAG_trace_deopt) { 960 if (trace_) {
961 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 961 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
962 V8PRIxPTR "; function\n", 962 V8PRIxPTR "; function\n",
963 top_address + output_offset, output_offset, value); 963 top_address + output_offset, output_offset, value);
964 } 964 }
965 965
966 // Translate the rest of the frame. 966 // Translate the rest of the frame.
967 for (unsigned i = 0; i < height; ++i) { 967 for (unsigned i = 0; i < height; ++i) {
968 output_offset -= kPointerSize; 968 output_offset -= kPointerSize;
969 DoTranslateCommand(iterator, frame_index, output_offset); 969 DoTranslateCommand(iterator, frame_index, output_offset);
970 } 970 }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 } 1236 }
1237 __ bind(&done); 1237 __ bind(&done);
1238 } 1238 }
1239 1239
1240 #undef __ 1240 #undef __
1241 1241
1242 1242
1243 } } // namespace v8::internal 1243 } } // namespace v8::internal
1244 1244
1245 #endif // V8_TARGET_ARCH_X64 1245 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/deoptimizer-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698