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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (function->scope()->num_parameters() > 0 || | 82 if (function->scope()->num_parameters() > 0 || |
83 function->scope()->num_stack_slots()) { | 83 function->scope()->num_stack_slots()) { |
84 AssignedVariablesAnalyzer ava(function); | 84 AssignedVariablesAnalyzer ava(function); |
85 ava.Analyze(); | 85 ava.Analyze(); |
86 if (ava.HasStackOverflow()) { | 86 if (ava.HasStackOverflow()) { |
87 return Handle<Code>::null(); | 87 return Handle<Code>::null(); |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 if (FLAG_use_flow_graph) { | 91 if (FLAG_use_flow_graph) { |
92 FlowGraphBuilder builder; | 92 int variable_count = |
| 93 function->num_parameters() + function->scope()->num_stack_slots(); |
| 94 FlowGraphBuilder builder(variable_count); |
93 builder.Build(function); | 95 builder.Build(function); |
94 | 96 |
95 if (!builder.HasStackOverflow()) { | 97 if (!builder.HasStackOverflow()) { |
96 int variable_count = | 98 if (variable_count > 0) { |
97 function->num_parameters() + function->scope()->num_stack_slots(); | |
98 if (variable_count > 0 && builder.definitions()->length() > 0) { | |
99 ReachingDefinitions rd(builder.postorder(), | 99 ReachingDefinitions rd(builder.postorder(), |
100 builder.definitions(), | 100 builder.body_definitions(), |
101 variable_count); | 101 variable_count); |
102 rd.Compute(); | 102 rd.Compute(); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 #ifdef DEBUG | 106 #ifdef DEBUG |
107 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { | 107 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { |
108 builder.graph()->PrintText(builder.postorder()); | 108 builder.graph()->PrintText(builder.postorder()); |
109 } | 109 } |
110 #endif | 110 #endif |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 if (literal->scope()->num_parameters() > 0 || | 490 if (literal->scope()->num_parameters() > 0 || |
491 literal->scope()->num_stack_slots()) { | 491 literal->scope()->num_stack_slots()) { |
492 AssignedVariablesAnalyzer ava(literal); | 492 AssignedVariablesAnalyzer ava(literal); |
493 ava.Analyze(); | 493 ava.Analyze(); |
494 if (ava.HasStackOverflow()) { | 494 if (ava.HasStackOverflow()) { |
495 return Handle<JSFunction>::null(); | 495 return Handle<JSFunction>::null(); |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 if (FLAG_use_flow_graph) { | 499 if (FLAG_use_flow_graph) { |
500 FlowGraphBuilder builder; | 500 int variable_count = |
| 501 literal->num_parameters() + literal->scope()->num_stack_slots(); |
| 502 FlowGraphBuilder builder(variable_count); |
501 builder.Build(literal); | 503 builder.Build(literal); |
502 | 504 |
503 if (!builder.HasStackOverflow()) { | 505 if (!builder.HasStackOverflow()) { |
504 int variable_count = | 506 if (variable_count > 0) { |
505 literal->num_parameters() + literal->scope()->num_stack_slots(); | |
506 if (variable_count > 0 && builder.definitions()->length() > 0) { | |
507 ReachingDefinitions rd(builder.postorder(), | 507 ReachingDefinitions rd(builder.postorder(), |
508 builder.definitions(), | 508 builder.body_definitions(), |
509 variable_count); | 509 variable_count); |
510 rd.Compute(); | 510 rd.Compute(); |
511 } | 511 } |
512 } | 512 } |
513 | 513 |
514 #ifdef DEBUG | 514 #ifdef DEBUG |
515 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { | 515 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { |
516 builder.graph()->PrintText(builder.postorder()); | 516 builder.graph()->PrintText(builder.postorder()); |
517 } | 517 } |
518 #endif | 518 #endif |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 LOG(CodeCreateEvent(tag, *code, *func_name)); | 637 LOG(CodeCreateEvent(tag, *code, *func_name)); |
638 OProfileAgent::CreateNativeCodeRegion(*func_name, | 638 OProfileAgent::CreateNativeCodeRegion(*func_name, |
639 code->instruction_start(), | 639 code->instruction_start(), |
640 code->instruction_size()); | 640 code->instruction_size()); |
641 } | 641 } |
642 } | 642 } |
643 } | 643 } |
644 #endif | 644 #endif |
645 | 645 |
646 } } // namespace v8::internal | 646 } } // namespace v8::internal |
OLD | NEW |