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

Side by Side Diff: src/compiler.cc

Issue 804003: Add defensive checks to the flow graph builder. (Closed)
Patch Set: 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 | « no previous file | src/data-flow.h » ('j') | src/data-flow.cc » ('J')
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (FLAG_use_flow_graph) { 82 if (FLAG_use_flow_graph) {
83 FlowGraphBuilder builder; 83 FlowGraphBuilder builder;
84 builder.Build(function); 84 builder.Build(function);
85 85
86 #ifdef DEBUG 86 #ifdef DEBUG
87 if (FLAG_print_graph_text) { 87 if (FLAG_print_graph_text && !builder.HasStackOverflow()) {
88 builder.graph()->PrintText(builder.postorder()); 88 builder.graph()->PrintText(builder.postorder());
89 } 89 }
90 #endif 90 #endif
91 } 91 }
92 92
93 // Generate code and return it. Code generator selection is governed by 93 // Generate code and return it. Code generator selection is governed by
94 // which backends are enabled and whether the function is considered 94 // which backends are enabled and whether the function is considered
95 // run-once code or not: 95 // run-once code or not:
96 // 96 //
97 // --full-compiler enables the dedicated backend for code we expect to be 97 // --full-compiler enables the dedicated backend for code we expect to be
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // the AST optimizer/analyzer. 461 // the AST optimizer/analyzer.
462 if (!Rewriter::Optimize(literal)) { 462 if (!Rewriter::Optimize(literal)) {
463 return Handle<JSFunction>::null(); 463 return Handle<JSFunction>::null();
464 } 464 }
465 465
466 if (FLAG_use_flow_graph) { 466 if (FLAG_use_flow_graph) {
467 FlowGraphBuilder builder; 467 FlowGraphBuilder builder;
468 builder.Build(literal); 468 builder.Build(literal);
469 469
470 #ifdef DEBUG 470 #ifdef DEBUG
471 if (FLAG_print_graph_text) { 471 if (FLAG_print_graph_text) {
fschneider 2010/03/10 16:51:09 Also check for stack overflow here?
472 builder.graph()->PrintText(builder.postorder()); 472 builder.graph()->PrintText(builder.postorder());
473 } 473 }
474 #endif 474 #endif
475 } 475 }
476 476
477 // Generate code and return it. The way that the compilation mode 477 // Generate code and return it. The way that the compilation mode
478 // is controlled by the command-line flags is described in 478 // is controlled by the command-line flags is described in
479 // the static helper function MakeCode. 479 // the static helper function MakeCode.
480 CompilationInfo info(literal, script, false); 480 CompilationInfo info(literal, script, false);
481 481
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 LOG(CodeCreateEvent(tag, *code, *func_name)); 593 LOG(CodeCreateEvent(tag, *code, *func_name));
594 OProfileAgent::CreateNativeCodeRegion(*func_name, 594 OProfileAgent::CreateNativeCodeRegion(*func_name,
595 code->instruction_start(), 595 code->instruction_start(),
596 code->instruction_size()); 596 code->instruction_size());
597 } 597 }
598 } 598 }
599 } 599 }
600 #endif 600 #endif
601 601
602 } } // namespace v8::internal 602 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/data-flow.h » ('j') | src/data-flow.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698