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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 fun->shared()->SetThisPropertyAssignmentsInfo( | 578 fun->shared()->SetThisPropertyAssignmentsInfo( |
579 lit->has_only_this_property_assignments(), | 579 lit->has_only_this_property_assignments(), |
580 lit->has_only_simple_this_property_assignments(), | 580 lit->has_only_simple_this_property_assignments(), |
581 *lit->this_property_assignments()); | 581 *lit->this_property_assignments()); |
582 fun->shared()->set_try_fast_codegen(lit->try_fast_codegen()); | 582 fun->shared()->set_try_fast_codegen(lit->try_fast_codegen()); |
583 } | 583 } |
584 | 584 |
585 | 585 |
586 CodeGenSelector::CodeGenTag CodeGenSelector::Select(FunctionLiteral* fun) { | 586 CodeGenSelector::CodeGenTag CodeGenSelector::Select(FunctionLiteral* fun) { |
587 Scope* scope = fun->scope(); | 587 Scope* scope = fun->scope(); |
| 588 |
| 589 if (scope->num_heap_slots() > 0) { |
| 590 // We support functions with a local context if they do not have |
| 591 // parameters that need to be copied into the context. |
| 592 for (int i = 0, len = scope->num_parameters(); i < len; i++) { |
| 593 Slot* slot = scope->parameter(i)->slot(); |
| 594 if (slot != NULL && slot->type() == Slot::CONTEXT) { |
| 595 if (FLAG_trace_bailout) { |
| 596 PrintF("function has context-allocated parameters"); |
| 597 } |
| 598 return NORMAL; |
| 599 } |
| 600 } |
| 601 } |
| 602 |
588 if (scope->num_heap_slots() != 0) { | 603 if (scope->num_heap_slots() != 0) { |
589 if (FLAG_trace_bailout) PrintF("function has context slots\n"); | 604 if (FLAG_trace_bailout) PrintF("function has context slots\n"); |
590 return NORMAL; | 605 return NORMAL; |
591 } | 606 } |
592 if (scope->arguments() != NULL) { | 607 if (scope->arguments() != NULL) { |
593 if (FLAG_trace_bailout) PrintF("function uses 'arguments'\n"); | 608 if (FLAG_trace_bailout) PrintF("function uses 'arguments'\n"); |
594 return NORMAL; | 609 return NORMAL; |
595 } | 610 } |
596 | 611 |
597 has_supported_syntax_ = true; | 612 has_supported_syntax_ = true; |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 | 1100 |
1086 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 1101 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
1087 BAILOUT("ThisFunction"); | 1102 BAILOUT("ThisFunction"); |
1088 } | 1103 } |
1089 | 1104 |
1090 #undef BAILOUT | 1105 #undef BAILOUT |
1091 #undef CHECK_BAILOUT | 1106 #undef CHECK_BAILOUT |
1092 | 1107 |
1093 | 1108 |
1094 } } // namespace v8::internal | 1109 } } // namespace v8::internal |
OLD | NEW |