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

Side by Side Diff: src/compiler.cc

Issue 876001: Initialize reaching definitions state for all flow graph nodes. (Closed)
Patch Set: Incorporated review comments. Created 10 years, 9 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
« no previous file with comments | « src/ast.h ('k') | src/data-flow.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 FlowGraphBuilder builder;
93 builder.Build(function); 93 builder.Build(function);
94 94
95 if (!builder.HasStackOverflow()) {
96 int variable_count =
97 function->num_parameters() + function->scope()->num_stack_slots();
98 ReachingDefinitions rd(builder.postorder(),
99 builder.definitions(),
100 variable_count);
101 rd.Compute();
102 }
103
95 #ifdef DEBUG 104 #ifdef DEBUG
96 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { 105 if (FLAG_print_graph_text && !builder.HasStackOverflow()) {
97 builder.graph()->PrintText(builder.postorder()); 106 builder.graph()->PrintText(builder.postorder());
98 } 107 }
99 #endif 108 #endif
100 } 109 }
101 110
102 // Generate code and return it. Code generator selection is governed by 111 // Generate code and return it. Code generator selection is governed by
103 // which backends are enabled and whether the function is considered 112 // which backends are enabled and whether the function is considered
104 // run-once code or not: 113 // run-once code or not:
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 ava.Analyze(); 487 ava.Analyze();
479 if (ava.HasStackOverflow()) { 488 if (ava.HasStackOverflow()) {
480 return Handle<JSFunction>::null(); 489 return Handle<JSFunction>::null();
481 } 490 }
482 } 491 }
483 492
484 if (FLAG_use_flow_graph) { 493 if (FLAG_use_flow_graph) {
485 FlowGraphBuilder builder; 494 FlowGraphBuilder builder;
486 builder.Build(literal); 495 builder.Build(literal);
487 496
497 if (!builder.HasStackOverflow()) {
498 int variable_count =
499 literal->num_parameters() + literal->scope()->num_stack_slots();
500 ReachingDefinitions rd(builder.postorder(),
501 builder.definitions(),
502 variable_count);
503 rd.Compute();
504 }
505
488 #ifdef DEBUG 506 #ifdef DEBUG
489 if (FLAG_print_graph_text && !builder.HasStackOverflow()) { 507 if (FLAG_print_graph_text && !builder.HasStackOverflow()) {
490 builder.graph()->PrintText(builder.postorder()); 508 builder.graph()->PrintText(builder.postorder());
491 } 509 }
492 #endif 510 #endif
493 } 511 }
494 512
495 // Generate code and return it. The way that the compilation mode 513 // Generate code and return it. The way that the compilation mode
496 // is controlled by the command-line flags is described in 514 // is controlled by the command-line flags is described in
497 // the static helper function MakeCode. 515 // the static helper function MakeCode.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 LOG(CodeCreateEvent(tag, *code, *func_name)); 629 LOG(CodeCreateEvent(tag, *code, *func_name));
612 OProfileAgent::CreateNativeCodeRegion(*func_name, 630 OProfileAgent::CreateNativeCodeRegion(*func_name,
613 code->instruction_start(), 631 code->instruction_start(),
614 code->instruction_size()); 632 code->instruction_size());
615 } 633 }
616 } 634 }
617 } 635 }
618 #endif 636 #endif
619 637
620 } } // namespace v8::internal 638 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/data-flow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698