OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 #endif | 73 #endif |
74 | 74 |
75 // Optimize the AST. | 75 // Optimize the AST. |
76 if (!Rewriter::Optimize(function)) { | 76 if (!Rewriter::Optimize(function)) { |
77 // Signal a stack overflow by returning a null handle. The stack | 77 // Signal a stack overflow by returning a null handle. The stack |
78 // overflow exception will be thrown by the caller. | 78 // overflow exception will be thrown by the caller. |
79 return Handle<Code>::null(); | 79 return Handle<Code>::null(); |
80 } | 80 } |
81 | 81 |
| 82 if (function->scope()->num_parameters() > 0 || |
| 83 function->scope()->num_stack_slots()) { |
| 84 AssignedVariablesAnalyzer ava(function); |
| 85 ava.Analyze(); |
| 86 if (ava.HasStackOverflow()) { |
| 87 return Handle<Code>::null(); |
| 88 } |
| 89 } |
| 90 |
82 if (FLAG_use_flow_graph) { | 91 if (FLAG_use_flow_graph) { |
83 FlowGraphBuilder builder; | 92 FlowGraphBuilder builder; |
84 builder.Build(function); | 93 builder.Build(function); |
85 | 94 |
86 #ifdef DEBUG | 95 #ifdef DEBUG |
87 if (FLAG_print_graph_text) { | 96 if (FLAG_print_graph_text) { |
88 builder.graph()->PrintText(builder.postorder()); | 97 builder.graph()->PrintText(builder.postorder()); |
89 } | 98 } |
90 #endif | 99 #endif |
91 } | 100 } |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 Handle<Code> code; | 465 Handle<Code> code; |
457 if (FLAG_lazy && allow_lazy) { | 466 if (FLAG_lazy && allow_lazy) { |
458 code = ComputeLazyCompile(literal->num_parameters()); | 467 code = ComputeLazyCompile(literal->num_parameters()); |
459 } else { | 468 } else { |
460 // The bodies of function literals have not yet been visited by | 469 // The bodies of function literals have not yet been visited by |
461 // the AST optimizer/analyzer. | 470 // the AST optimizer/analyzer. |
462 if (!Rewriter::Optimize(literal)) { | 471 if (!Rewriter::Optimize(literal)) { |
463 return Handle<JSFunction>::null(); | 472 return Handle<JSFunction>::null(); |
464 } | 473 } |
465 | 474 |
| 475 if (literal->scope()->num_parameters() > 0 || |
| 476 literal->scope()->num_stack_slots()) { |
| 477 AssignedVariablesAnalyzer ava(literal); |
| 478 ava.Analyze(); |
| 479 if (ava.HasStackOverflow()) { |
| 480 return Handle<JSFunction>::null(); |
| 481 } |
| 482 } |
| 483 |
466 if (FLAG_use_flow_graph) { | 484 if (FLAG_use_flow_graph) { |
467 FlowGraphBuilder builder; | 485 FlowGraphBuilder builder; |
468 builder.Build(literal); | 486 builder.Build(literal); |
469 | 487 |
470 #ifdef DEBUG | 488 #ifdef DEBUG |
471 if (FLAG_print_graph_text) { | 489 if (FLAG_print_graph_text) { |
472 builder.graph()->PrintText(builder.postorder()); | 490 builder.graph()->PrintText(builder.postorder()); |
473 } | 491 } |
474 #endif | 492 #endif |
475 } | 493 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 LOG(CodeCreateEvent(tag, *code, *func_name)); | 611 LOG(CodeCreateEvent(tag, *code, *func_name)); |
594 OProfileAgent::CreateNativeCodeRegion(*func_name, | 612 OProfileAgent::CreateNativeCodeRegion(*func_name, |
595 code->instruction_start(), | 613 code->instruction_start(), |
596 code->instruction_size()); | 614 code->instruction_size()); |
597 } | 615 } |
598 } | 616 } |
599 } | 617 } |
600 #endif | 618 #endif |
601 | 619 |
602 } } // namespace v8::internal | 620 } } // namespace v8::internal |
OLD | NEW |