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" |
34 #include "debug.h" | 35 #include "debug.h" |
35 #include "fast-codegen.h" | 36 #include "fast-codegen.h" |
36 #include "full-codegen.h" | 37 #include "full-codegen.h" |
37 #include "oprofile-agent.h" | 38 #include "oprofile-agent.h" |
38 #include "rewriter.h" | 39 #include "rewriter.h" |
39 #include "scopes.h" | 40 #include "scopes.h" |
40 #include "usage-analyzer.h" | 41 #include "usage-analyzer.h" |
41 | 42 |
42 namespace v8 { | 43 namespace v8 { |
43 namespace internal { | 44 namespace internal { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 if (FLAG_always_full_compiler || (FLAG_full_compiler && is_run_once)) { | 104 if (FLAG_always_full_compiler || (FLAG_full_compiler && is_run_once)) { |
104 FullCodeGenSyntaxChecker checker; | 105 FullCodeGenSyntaxChecker checker; |
105 checker.Check(literal); | 106 checker.Check(literal); |
106 if (checker.has_supported_syntax()) { | 107 if (checker.has_supported_syntax()) { |
107 return FullCodeGenerator::MakeCode(literal, script, is_eval); | 108 return FullCodeGenerator::MakeCode(literal, script, is_eval); |
108 } | 109 } |
109 } else if (FLAG_always_fast_compiler || | 110 } else if (FLAG_always_fast_compiler || |
110 (FLAG_fast_compiler && !is_run_once)) { | 111 (FLAG_fast_compiler && !is_run_once)) { |
111 FastCodeGenSyntaxChecker checker; | 112 FastCodeGenSyntaxChecker checker; |
112 checker.Check(literal); | 113 checker.Check(literal); |
| 114 if (checker.has_supported_syntax()) { |
| 115 AstLabeler labeler; |
| 116 labeler.Label(literal); |
| 117 } |
113 // Does not yet generate code. | 118 // Does not yet generate code. |
114 } | 119 } |
115 | 120 |
116 return CodeGenerator::MakeCode(literal, script, is_eval); | 121 return CodeGenerator::MakeCode(literal, script, is_eval); |
117 } | 122 } |
118 | 123 |
119 | 124 |
120 static bool IsValidJSON(FunctionLiteral* lit) { | 125 static bool IsValidJSON(FunctionLiteral* lit) { |
121 if (lit->body()->length() != 1) | 126 if (lit->body()->length() != 1) |
122 return false; | 127 return false; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 if (checker.has_supported_syntax()) { | 496 if (checker.has_supported_syntax()) { |
492 code = FullCodeGenerator::MakeCode(literal, | 497 code = FullCodeGenerator::MakeCode(literal, |
493 script, | 498 script, |
494 false); // Not eval. | 499 false); // Not eval. |
495 is_compiled = true; | 500 is_compiled = true; |
496 } | 501 } |
497 } else if (FLAG_always_fast_compiler || | 502 } else if (FLAG_always_fast_compiler || |
498 (FLAG_fast_compiler && !is_run_once)) { | 503 (FLAG_fast_compiler && !is_run_once)) { |
499 FastCodeGenSyntaxChecker checker; | 504 FastCodeGenSyntaxChecker checker; |
500 checker.Check(literal); | 505 checker.Check(literal); |
| 506 if (checker.has_supported_syntax()) { |
| 507 AstLabeler label_nodes; |
| 508 label_nodes.Label(literal); |
| 509 } |
501 // Generate no code. | 510 // Generate no code. |
502 } | 511 } |
503 | 512 |
504 if (!is_compiled) { | 513 if (!is_compiled) { |
505 // We fall back to the classic V8 code generator. | 514 // We fall back to the classic V8 code generator. |
506 code = CodeGenerator::MakeCode(literal, | 515 code = CodeGenerator::MakeCode(literal, |
507 script, | 516 script, |
508 false); // Not eval. | 517 false); // Not eval. |
509 } | 518 } |
510 | 519 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 fun->shared()->set_is_toplevel(is_toplevel); | 571 fun->shared()->set_is_toplevel(is_toplevel); |
563 fun->shared()->set_inferred_name(*lit->inferred_name()); | 572 fun->shared()->set_inferred_name(*lit->inferred_name()); |
564 fun->shared()->SetThisPropertyAssignmentsInfo( | 573 fun->shared()->SetThisPropertyAssignmentsInfo( |
565 lit->has_only_simple_this_property_assignments(), | 574 lit->has_only_simple_this_property_assignments(), |
566 *lit->this_property_assignments()); | 575 *lit->this_property_assignments()); |
567 fun->shared()->set_try_full_codegen(lit->try_full_codegen()); | 576 fun->shared()->set_try_full_codegen(lit->try_full_codegen()); |
568 } | 577 } |
569 | 578 |
570 | 579 |
571 } } // namespace v8::internal | 580 } } // namespace v8::internal |
OLD | NEW |