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

Side by Side Diff: src/hydrogen.cc

Issue 7212025: Add support for lazy deoptimization from deferred stack checks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
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 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 AddInstruction(new(zone()) HOsrEntry(osr_entry_id)); 2782 AddInstruction(new(zone()) HOsrEntry(osr_entry_id));
2783 HContext* context = new(zone()) HContext; 2783 HContext* context = new(zone()) HContext;
2784 AddInstruction(context); 2784 AddInstruction(context);
2785 environment()->BindContext(context); 2785 environment()->BindContext(context);
2786 current_block()->Goto(loop_predecessor); 2786 current_block()->Goto(loop_predecessor);
2787 loop_predecessor->SetJoinId(statement->EntryId()); 2787 loop_predecessor->SetJoinId(statement->EntryId());
2788 set_current_block(loop_predecessor); 2788 set_current_block(loop_predecessor);
2789 } 2789 }
2790 2790
2791 2791
2792 void HGraphBuilder::VisitLoopBody(Statement* body, 2792 void HGraphBuilder::VisitLoopBody(IterationStatement* stmt,
2793 HBasicBlock* loop_entry, 2793 HBasicBlock* loop_entry,
2794 BreakAndContinueInfo* break_info) { 2794 BreakAndContinueInfo* break_info) {
2795 BreakAndContinueScope push(break_info, this); 2795 BreakAndContinueScope push(break_info, this);
2796 AddSimulate(stmt->StackCheckId());
2796 HValue* context = environment()->LookupContext(); 2797 HValue* context = environment()->LookupContext();
2797 HStackCheck* stack_check = 2798 HStackCheck* stack_check =
2798 new(zone()) HStackCheck(context, HStackCheck::kBackwardsBranch); 2799 new(zone()) HStackCheck(context, HStackCheck::kBackwardsBranch);
2799 AddInstruction(stack_check); 2800 AddInstruction(stack_check);
2800 ASSERT(loop_entry->IsLoopHeader()); 2801 ASSERT(loop_entry->IsLoopHeader());
2801 loop_entry->loop_information()->set_stack_check(stack_check); 2802 loop_entry->loop_information()->set_stack_check(stack_check);
2802 CHECK_BAILOUT(Visit(body)); 2803 CHECK_BAILOUT(Visit(stmt->body()));
2803 } 2804 }
2804 2805
2805 2806
2806 void HGraphBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) { 2807 void HGraphBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) {
2807 ASSERT(!HasStackOverflow()); 2808 ASSERT(!HasStackOverflow());
2808 ASSERT(current_block() != NULL); 2809 ASSERT(current_block() != NULL);
2809 ASSERT(current_block()->HasPredecessor()); 2810 ASSERT(current_block()->HasPredecessor());
2810 ASSERT(current_block() != NULL); 2811 ASSERT(current_block() != NULL);
2811 PreProcessOsrEntry(stmt); 2812 PreProcessOsrEntry(stmt);
2812 HBasicBlock* loop_entry = CreateLoopHeaderBlock(); 2813 HBasicBlock* loop_entry = CreateLoopHeaderBlock();
2813 current_block()->Goto(loop_entry); 2814 current_block()->Goto(loop_entry);
2814 set_current_block(loop_entry); 2815 set_current_block(loop_entry);
2815 2816
2816 BreakAndContinueInfo break_info(stmt); 2817 BreakAndContinueInfo break_info(stmt);
2817 CHECK_BAILOUT(VisitLoopBody(stmt->body(), loop_entry, &break_info)); 2818 CHECK_BAILOUT(VisitLoopBody(stmt, loop_entry, &break_info));
2818 HBasicBlock* body_exit = 2819 HBasicBlock* body_exit =
2819 JoinContinue(stmt, current_block(), break_info.continue_block()); 2820 JoinContinue(stmt, current_block(), break_info.continue_block());
2820 HBasicBlock* loop_successor = NULL; 2821 HBasicBlock* loop_successor = NULL;
2821 if (body_exit != NULL && !stmt->cond()->ToBooleanIsTrue()) { 2822 if (body_exit != NULL && !stmt->cond()->ToBooleanIsTrue()) {
2822 set_current_block(body_exit); 2823 set_current_block(body_exit);
2823 // The block for a true condition, the actual predecessor block of the 2824 // The block for a true condition, the actual predecessor block of the
2824 // back edge. 2825 // back edge.
2825 body_exit = graph()->CreateBasicBlock(); 2826 body_exit = graph()->CreateBasicBlock();
2826 loop_successor = graph()->CreateBasicBlock(); 2827 loop_successor = graph()->CreateBasicBlock();
2827 CHECK_BAILOUT(VisitForControl(stmt->cond(), body_exit, loop_successor)); 2828 CHECK_BAILOUT(VisitForControl(stmt->cond(), body_exit, loop_successor));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2868 if (loop_successor->HasPredecessor()) { 2869 if (loop_successor->HasPredecessor()) {
2869 loop_successor->SetJoinId(stmt->ExitId()); 2870 loop_successor->SetJoinId(stmt->ExitId());
2870 } else { 2871 } else {
2871 loop_successor = NULL; 2872 loop_successor = NULL;
2872 } 2873 }
2873 } 2874 }
2874 2875
2875 BreakAndContinueInfo break_info(stmt); 2876 BreakAndContinueInfo break_info(stmt);
2876 if (current_block() != NULL) { 2877 if (current_block() != NULL) {
2877 BreakAndContinueScope push(&break_info, this); 2878 BreakAndContinueScope push(&break_info, this);
2878 CHECK_BAILOUT(VisitLoopBody(stmt->body(), loop_entry, &break_info)); 2879 CHECK_BAILOUT(VisitLoopBody(stmt, loop_entry, &break_info));
2879 } 2880 }
2880 HBasicBlock* body_exit = 2881 HBasicBlock* body_exit =
2881 JoinContinue(stmt, current_block(), break_info.continue_block()); 2882 JoinContinue(stmt, current_block(), break_info.continue_block());
2882 HBasicBlock* loop_exit = CreateLoop(stmt, 2883 HBasicBlock* loop_exit = CreateLoop(stmt,
2883 loop_entry, 2884 loop_entry,
2884 body_exit, 2885 body_exit,
2885 loop_successor, 2886 loop_successor,
2886 break_info.break_block()); 2887 break_info.break_block());
2887 set_current_block(loop_exit); 2888 set_current_block(loop_exit);
2888 } 2889 }
(...skipping 24 matching lines...) Expand all
2913 if (loop_successor->HasPredecessor()) { 2914 if (loop_successor->HasPredecessor()) {
2914 loop_successor->SetJoinId(stmt->ExitId()); 2915 loop_successor->SetJoinId(stmt->ExitId());
2915 } else { 2916 } else {
2916 loop_successor = NULL; 2917 loop_successor = NULL;
2917 } 2918 }
2918 } 2919 }
2919 2920
2920 BreakAndContinueInfo break_info(stmt); 2921 BreakAndContinueInfo break_info(stmt);
2921 if (current_block() != NULL) { 2922 if (current_block() != NULL) {
2922 BreakAndContinueScope push(&break_info, this); 2923 BreakAndContinueScope push(&break_info, this);
2923 CHECK_BAILOUT(VisitLoopBody(stmt->body(), loop_entry, &break_info)); 2924 CHECK_BAILOUT(VisitLoopBody(stmt, loop_entry, &break_info));
2924 } 2925 }
2925 HBasicBlock* body_exit = 2926 HBasicBlock* body_exit =
2926 JoinContinue(stmt, current_block(), break_info.continue_block()); 2927 JoinContinue(stmt, current_block(), break_info.continue_block());
2927 2928
2928 if (stmt->next() != NULL && body_exit != NULL) { 2929 if (stmt->next() != NULL && body_exit != NULL) {
2929 set_current_block(body_exit); 2930 set_current_block(body_exit);
2930 CHECK_BAILOUT(Visit(stmt->next())); 2931 CHECK_BAILOUT(Visit(stmt->next()));
2931 body_exit = current_block(); 2932 body_exit = current_block();
2932 } 2933 }
2933 2934
(...skipping 3757 matching lines...) Expand 10 before | Expand all | Expand 10 after
6691 } 6692 }
6692 } 6693 }
6693 6694
6694 #ifdef DEBUG 6695 #ifdef DEBUG
6695 if (graph_ != NULL) graph_->Verify(); 6696 if (graph_ != NULL) graph_->Verify();
6696 if (allocator_ != NULL) allocator_->Verify(); 6697 if (allocator_ != NULL) allocator_->Verify();
6697 #endif 6698 #endif
6698 } 6699 }
6699 6700
6700 } } // namespace v8::internal 6701 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698