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 13 matching lines...) Expand all Loading... |
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 "codegen-inl.h" | 31 #include "codegen-inl.h" |
32 #include "compilation-cache.h" | 32 #include "compilation-cache.h" |
33 #include "compiler.h" | 33 #include "compiler.h" |
34 #include "data-flow.h" | |
35 #include "debug.h" | 34 #include "debug.h" |
36 #include "fast-codegen.h" | 35 #include "fast-codegen.h" |
37 #include "full-codegen.h" | 36 #include "full-codegen.h" |
38 #include "oprofile-agent.h" | 37 #include "oprofile-agent.h" |
39 #include "rewriter.h" | 38 #include "rewriter.h" |
40 #include "scopes.h" | 39 #include "scopes.h" |
41 #include "usage-analyzer.h" | 40 #include "usage-analyzer.h" |
42 | 41 |
43 namespace v8 { | 42 namespace v8 { |
44 namespace internal { | 43 namespace internal { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 FullCodeGenSyntaxChecker checker; | 105 FullCodeGenSyntaxChecker checker; |
107 checker.Check(literal); | 106 checker.Check(literal); |
108 if (checker.has_supported_syntax()) { | 107 if (checker.has_supported_syntax()) { |
109 return FullCodeGenerator::MakeCode(literal, script, is_eval); | 108 return FullCodeGenerator::MakeCode(literal, script, is_eval); |
110 } | 109 } |
111 } else if (FLAG_always_fast_compiler || | 110 } else if (FLAG_always_fast_compiler || |
112 (FLAG_fast_compiler && !is_run_once)) { | 111 (FLAG_fast_compiler && !is_run_once)) { |
113 FastCodeGenSyntaxChecker checker; | 112 FastCodeGenSyntaxChecker checker; |
114 checker.Check(literal, info); | 113 checker.Check(literal, info); |
115 if (checker.has_supported_syntax()) { | 114 if (checker.has_supported_syntax()) { |
116 AstLabeler labeler; | 115 // Does not yet generate code. |
117 labeler.Label(literal); | 116 FastCodeGenerator::MakeCode(literal, script, is_eval, info); |
118 } | 117 } |
119 // Does not yet generate code. | |
120 } | 118 } |
121 | 119 |
122 return CodeGenerator::MakeCode(literal, script, is_eval, info); | 120 return CodeGenerator::MakeCode(literal, script, is_eval, info); |
123 } | 121 } |
124 | 122 |
125 | 123 |
126 static bool IsValidJSON(FunctionLiteral* lit) { | 124 static bool IsValidJSON(FunctionLiteral* lit) { |
127 if (lit->body()->length() != 1) | 125 if (lit->body()->length() != 1) |
128 return false; | 126 return false; |
129 Statement* stmt = lit->body()->at(0); | 127 Statement* stmt = lit->body()->at(0); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 false); // Not eval. | 504 false); // Not eval. |
507 is_compiled = true; | 505 is_compiled = true; |
508 } | 506 } |
509 } else if (FLAG_always_fast_compiler || | 507 } else if (FLAG_always_fast_compiler || |
510 (FLAG_fast_compiler && !is_run_once)) { | 508 (FLAG_fast_compiler && !is_run_once)) { |
511 // Since we are not lazily compiling we do not have a receiver to | 509 // Since we are not lazily compiling we do not have a receiver to |
512 // specialize for. | 510 // specialize for. |
513 FastCodeGenSyntaxChecker checker; | 511 FastCodeGenSyntaxChecker checker; |
514 checker.Check(literal, &info); | 512 checker.Check(literal, &info); |
515 if (checker.has_supported_syntax()) { | 513 if (checker.has_supported_syntax()) { |
516 AstLabeler label_nodes; | 514 // Does not yet generate code. |
517 label_nodes.Label(literal); | 515 FastCodeGenerator::MakeCode(literal, script, false, &info); |
518 } | 516 } |
519 // Generate no code. | |
520 } | 517 } |
521 | 518 |
522 if (!is_compiled) { | 519 if (!is_compiled) { |
523 // We fall back to the classic V8 code generator. | 520 // We fall back to the classic V8 code generator. |
524 code = CodeGenerator::MakeCode(literal, | 521 code = CodeGenerator::MakeCode(literal, |
525 script, | 522 script, |
526 false, // Not eval. | 523 false, // Not eval. |
527 &info); | 524 &info); |
528 } | 525 } |
529 | 526 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 fun->shared()->set_is_toplevel(is_toplevel); | 578 fun->shared()->set_is_toplevel(is_toplevel); |
582 fun->shared()->set_inferred_name(*lit->inferred_name()); | 579 fun->shared()->set_inferred_name(*lit->inferred_name()); |
583 fun->shared()->SetThisPropertyAssignmentsInfo( | 580 fun->shared()->SetThisPropertyAssignmentsInfo( |
584 lit->has_only_simple_this_property_assignments(), | 581 lit->has_only_simple_this_property_assignments(), |
585 *lit->this_property_assignments()); | 582 *lit->this_property_assignments()); |
586 fun->shared()->set_try_full_codegen(lit->try_full_codegen()); | 583 fun->shared()->set_try_full_codegen(lit->try_full_codegen()); |
587 } | 584 } |
588 | 585 |
589 | 586 |
590 } } // namespace v8::internal | 587 } } // namespace v8::internal |
OLD | NEW |