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 | |
91 if (FLAG_use_flow_graph) { | 82 if (FLAG_use_flow_graph) { |
92 FlowGraphBuilder builder; | 83 FlowGraphBuilder builder; |
93 builder.Build(function); | 84 builder.Build(function); |
94 | 85 |
95 #ifdef DEBUG | 86 #ifdef DEBUG |
96 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { | 87 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { |
97 builder.graph()->PrintText(builder.postorder()); | 88 builder.graph()->PrintText(builder.postorder()); |
98 } | 89 } |
99 #endif | 90 #endif |
100 } | 91 } |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 Handle<Code> code; | 456 Handle<Code> code; |
466 if (FLAG_lazy && allow_lazy) { | 457 if (FLAG_lazy && allow_lazy) { |
467 code = ComputeLazyCompile(literal->num_parameters()); | 458 code = ComputeLazyCompile(literal->num_parameters()); |
468 } else { | 459 } else { |
469 // The bodies of function literals have not yet been visited by | 460 // The bodies of function literals have not yet been visited by |
470 // the AST optimizer/analyzer. | 461 // the AST optimizer/analyzer. |
471 if (!Rewriter::Optimize(literal)) { | 462 if (!Rewriter::Optimize(literal)) { |
472 return Handle<JSFunction>::null(); | 463 return Handle<JSFunction>::null(); |
473 } | 464 } |
474 | 465 |
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 | |
484 if (FLAG_use_flow_graph) { | 466 if (FLAG_use_flow_graph) { |
485 FlowGraphBuilder builder; | 467 FlowGraphBuilder builder; |
486 builder.Build(literal); | 468 builder.Build(literal); |
487 | 469 |
488 #ifdef DEBUG | 470 #ifdef DEBUG |
489 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { | 471 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { |
490 builder.graph()->PrintText(builder.postorder()); | 472 builder.graph()->PrintText(builder.postorder()); |
491 } | 473 } |
492 #endif | 474 #endif |
493 } | 475 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 LOG(CodeCreateEvent(tag, *code, *func_name)); | 593 LOG(CodeCreateEvent(tag, *code, *func_name)); |
612 OProfileAgent::CreateNativeCodeRegion(*func_name, | 594 OProfileAgent::CreateNativeCodeRegion(*func_name, |
613 code->instruction_start(), | 595 code->instruction_start(), |
614 code->instruction_size()); | 596 code->instruction_size()); |
615 } | 597 } |
616 } | 598 } |
617 } | 599 } |
618 #endif | 600 #endif |
619 | 601 |
620 } } // namespace v8::internal | 602 } } // namespace v8::internal |
OLD | NEW |