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 23 matching lines...) Expand all Loading... |
34 #include "debug.h" | 34 #include "debug.h" |
35 #include "fast-codegen.h" | 35 #include "fast-codegen.h" |
36 #include "oprofile-agent.h" | 36 #include "oprofile-agent.h" |
37 #include "rewriter.h" | 37 #include "rewriter.h" |
38 #include "scopes.h" | 38 #include "scopes.h" |
39 #include "usage-analyzer.h" | 39 #include "usage-analyzer.h" |
40 | 40 |
41 namespace v8 { | 41 namespace v8 { |
42 namespace internal { | 42 namespace internal { |
43 | 43 |
44 #ifdef V8_TARGET_ARCH_IA32 | 44 #ifndef V8_TARGET_ARCH_ARM |
45 | 45 |
46 class CodeGenSelector: public AstVisitor { | 46 class CodeGenSelector: public AstVisitor { |
47 public: | 47 public: |
48 enum CodeGenTag { NORMAL, FAST }; | 48 enum CodeGenTag { NORMAL, FAST }; |
49 | 49 |
50 CodeGenSelector() : has_supported_syntax_(true) {} | 50 CodeGenSelector() : has_supported_syntax_(true) {} |
51 | 51 |
52 CodeGenTag Select(FunctionLiteral* fun); | 52 CodeGenTag Select(FunctionLiteral* fun); |
53 | 53 |
54 private: | 54 private: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #endif | 99 #endif |
100 | 100 |
101 // Optimize the AST. | 101 // Optimize the AST. |
102 if (!Rewriter::Optimize(literal)) { | 102 if (!Rewriter::Optimize(literal)) { |
103 // Signal a stack overflow by returning a null handle. The stack | 103 // Signal a stack overflow by returning a null handle. The stack |
104 // overflow exception will be thrown by the caller. | 104 // overflow exception will be thrown by the caller. |
105 return Handle<Code>::null(); | 105 return Handle<Code>::null(); |
106 } | 106 } |
107 | 107 |
108 // Generate code and return it. | 108 // Generate code and return it. |
109 #ifdef V8_TARGET_ARCH_IA32 | 109 #ifndef V8_TARGET_ARCH_ARM |
110 if (FLAG_fast_compiler) { | 110 if (FLAG_fast_compiler) { |
111 CodeGenSelector selector; | 111 CodeGenSelector selector; |
112 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); | 112 CodeGenSelector::CodeGenTag code_gen = selector.Select(literal); |
113 if (code_gen == CodeGenSelector::FAST) { | 113 if (code_gen == CodeGenSelector::FAST) { |
114 return FastCodeGenerator::MakeCode(literal, script); | 114 return FastCodeGenerator::MakeCode(literal, script); |
115 } | 115 } |
116 ASSERT(code_gen == CodeGenSelector::NORMAL); | 116 ASSERT(code_gen == CodeGenSelector::NORMAL); |
117 } | 117 } |
118 #endif | 118 #endif |
119 | 119 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 lit->has_only_this_property_assignments(), | 446 lit->has_only_this_property_assignments(), |
447 lit->has_only_simple_this_property_assignments(), | 447 lit->has_only_simple_this_property_assignments(), |
448 *lit->this_property_assignments()); | 448 *lit->this_property_assignments()); |
449 | 449 |
450 // Check the function has compiled code. | 450 // Check the function has compiled code. |
451 ASSERT(shared->is_compiled()); | 451 ASSERT(shared->is_compiled()); |
452 return true; | 452 return true; |
453 } | 453 } |
454 | 454 |
455 | 455 |
456 #ifdef V8_TARGET_ARCH_IA32 | 456 #ifndef V8_TARGET_ARCH_ARM |
457 | 457 |
458 CodeGenSelector::CodeGenTag CodeGenSelector::Select(FunctionLiteral* fun) { | 458 CodeGenSelector::CodeGenTag CodeGenSelector::Select(FunctionLiteral* fun) { |
459 Scope* scope = fun->scope(); | 459 Scope* scope = fun->scope(); |
460 | 460 |
461 if (!scope->is_global_scope()) return NORMAL; | 461 if (!scope->is_global_scope()) return NORMAL; |
462 ASSERT(scope->num_heap_slots() == 0); | 462 ASSERT(scope->num_heap_slots() == 0); |
463 ASSERT(scope->arguments() == NULL); | 463 ASSERT(scope->arguments() == NULL); |
464 | 464 |
465 if (!scope->declarations()->is_empty()) return NORMAL; | 465 if (!scope->declarations()->is_empty()) return NORMAL; |
466 if (fun->materialized_literal_count() > 0) return NORMAL; | 466 if (fun->materialized_literal_count() > 0) return NORMAL; |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 } | 711 } |
712 | 712 |
713 | 713 |
714 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 714 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
715 BAILOUT("ThisFunction"); | 715 BAILOUT("ThisFunction"); |
716 } | 716 } |
717 | 717 |
718 #undef BAILOUT | 718 #undef BAILOUT |
719 #undef CHECK_BAILOUT | 719 #undef CHECK_BAILOUT |
720 | 720 |
721 #endif // V8_TARGET_ARCH_IA32 | 721 #endif // !defined(V8_TARGET_ARCH_ARM) |
722 | 722 |
723 | 723 |
724 } } // namespace v8::internal | 724 } } // namespace v8::internal |
OLD | NEW |