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

Side by Side Diff: src/compiler.cc

Issue 159695: Basic infrastructure for fast two-pass compilation. A CFG is... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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 | Annotate | Revision Log
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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "bootstrapper.h" 30 #include "bootstrapper.h"
31 #include "cfg.h"
31 #include "codegen-inl.h" 32 #include "codegen-inl.h"
32 #include "compilation-cache.h" 33 #include "compilation-cache.h"
33 #include "compiler.h" 34 #include "compiler.h"
34 #include "debug.h" 35 #include "debug.h"
35 #include "oprofile-agent.h" 36 #include "oprofile-agent.h"
36 #include "rewriter.h" 37 #include "rewriter.h"
37 #include "scopes.h" 38 #include "scopes.h"
38 #include "usage-analyzer.h" 39 #include "usage-analyzer.h"
39 40
40 namespace v8 { 41 namespace v8 {
(...skipping 30 matching lines...) Expand all
71 } 72 }
72 #endif 73 #endif
73 74
74 // Optimize the AST. 75 // Optimize the AST.
75 if (!Rewriter::Optimize(literal)) { 76 if (!Rewriter::Optimize(literal)) {
76 // Signal a stack overflow by returning a null handle. The stack 77 // Signal a stack overflow by returning a null handle. The stack
77 // overflow exception will be thrown by the caller. 78 // overflow exception will be thrown by the caller.
78 return Handle<Code>::null(); 79 return Handle<Code>::null();
79 } 80 }
80 81
82 if (FLAG_multipass) {
83 Cfg* cfg = Cfg::Build(literal);
84 #ifdef DEBUG
85 if (FLAG_print_cfg && cfg != NULL) {
86 SmartPointer<char> name = literal->name()->ToCString();
87 PrintF("Function \"%s\":\n", *name);
88 cfg->Print();
89 PrintF("\n");
90 }
91 #endif
92 if (cfg != NULL) {
93 return cfg->Compile(literal, script);
94 }
95 }
96
81 // Generate code and return it. 97 // Generate code and return it.
82 Handle<Code> result = CodeGenerator::MakeCode(literal, script, is_eval); 98 Handle<Code> result = CodeGenerator::MakeCode(literal, script, is_eval);
83 return result; 99 return result;
84 } 100 }
85 101
86 102
87 static bool IsValidJSON(FunctionLiteral* lit) { 103 static bool IsValidJSON(FunctionLiteral* lit) {
88 if (!lit->body()->length() == 1) 104 if (!lit->body()->length() == 1)
89 return false; 105 return false;
90 Statement* stmt = lit->body()->at(0); 106 Statement* stmt = lit->body()->at(0);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 // Set the expected number of properties for instances. 416 // Set the expected number of properties for instances.
401 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 417 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
402 418
403 // Check the function has compiled code. 419 // Check the function has compiled code.
404 ASSERT(shared->is_compiled()); 420 ASSERT(shared->is_compiled());
405 return true; 421 return true;
406 } 422 }
407 423
408 424
409 } } // namespace v8::internal 425 } } // namespace v8::internal
OLDNEW
« src/cfg.h ('K') | « src/cfg.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698