OLD | NEW |
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 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 | 2326 |
2327 // Handle implicit declaration of the function name in named function | 2327 // Handle implicit declaration of the function name in named function |
2328 // expressions before other declarations. | 2328 // expressions before other declarations. |
2329 if (scope->is_function_scope() && scope->function() != NULL) { | 2329 if (scope->is_function_scope() && scope->function() != NULL) { |
2330 HandleDeclaration(scope->function(), CONST, NULL); | 2330 HandleDeclaration(scope->function(), CONST, NULL); |
2331 } | 2331 } |
2332 VisitDeclarations(scope->declarations()); | 2332 VisitDeclarations(scope->declarations()); |
2333 AddSimulate(AstNode::kDeclarationsId); | 2333 AddSimulate(AstNode::kDeclarationsId); |
2334 | 2334 |
2335 HValue* context = environment()->LookupContext(); | 2335 HValue* context = environment()->LookupContext(); |
2336 AddInstruction(new(zone()) HStackCheck(context)); | 2336 AddInstruction( |
| 2337 new(zone()) HStackCheck(context, HStackCheck::kFunctionEntry)); |
2337 | 2338 |
2338 VisitStatements(info()->function()->body()); | 2339 VisitStatements(info()->function()->body()); |
2339 if (HasStackOverflow()) return NULL; | 2340 if (HasStackOverflow()) return NULL; |
2340 | 2341 |
2341 if (current_block() != NULL) { | 2342 if (current_block() != NULL) { |
2342 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); | 2343 HReturn* instr = new(zone()) HReturn(graph()->GetConstantUndefined()); |
2343 current_block()->FinishExit(instr); | 2344 current_block()->FinishExit(instr); |
2344 set_current_block(NULL); | 2345 set_current_block(NULL); |
2345 } | 2346 } |
2346 } | 2347 } |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2914 set_current_block(loop_predecessor); | 2915 set_current_block(loop_predecessor); |
2915 } | 2916 } |
2916 | 2917 |
2917 | 2918 |
2918 void HGraphBuilder::VisitLoopBody(IterationStatement* stmt, | 2919 void HGraphBuilder::VisitLoopBody(IterationStatement* stmt, |
2919 HBasicBlock* loop_entry, | 2920 HBasicBlock* loop_entry, |
2920 BreakAndContinueInfo* break_info) { | 2921 BreakAndContinueInfo* break_info) { |
2921 BreakAndContinueScope push(break_info, this); | 2922 BreakAndContinueScope push(break_info, this); |
2922 AddSimulate(stmt->StackCheckId()); | 2923 AddSimulate(stmt->StackCheckId()); |
2923 HValue* context = environment()->LookupContext(); | 2924 HValue* context = environment()->LookupContext(); |
2924 HStackCheck* stack_check = new(zone()) HStackCheck(context); | 2925 HStackCheck* stack_check = |
| 2926 new(zone()) HStackCheck(context, HStackCheck::kBackwardsBranch); |
2925 AddInstruction(stack_check); | 2927 AddInstruction(stack_check); |
2926 ASSERT(loop_entry->IsLoopHeader()); | 2928 ASSERT(loop_entry->IsLoopHeader()); |
2927 loop_entry->loop_information()->set_stack_check(stack_check); | 2929 loop_entry->loop_information()->set_stack_check(stack_check); |
2928 CHECK_BAILOUT(Visit(stmt->body())); | 2930 CHECK_BAILOUT(Visit(stmt->body())); |
2929 } | 2931 } |
2930 | 2932 |
2931 | 2933 |
2932 void HGraphBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) { | 2934 void HGraphBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) { |
2933 ASSERT(!HasStackOverflow()); | 2935 ASSERT(!HasStackOverflow()); |
2934 ASSERT(current_block() != NULL); | 2936 ASSERT(current_block() != NULL); |
(...skipping 4287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7222 } | 7224 } |
7223 } | 7225 } |
7224 | 7226 |
7225 #ifdef DEBUG | 7227 #ifdef DEBUG |
7226 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7228 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7227 if (allocator_ != NULL) allocator_->Verify(); | 7229 if (allocator_ != NULL) allocator_->Verify(); |
7228 #endif | 7230 #endif |
7229 } | 7231 } |
7230 | 7232 |
7231 } } // namespace v8::internal | 7233 } } // namespace v8::internal |
OLD | NEW |