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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 Visit(stmts->at(i)); | 643 Visit(stmts->at(i)); |
644 CHECK_BAILOUT; | 644 CHECK_BAILOUT; |
645 } | 645 } |
646 } | 646 } |
647 | 647 |
648 | 648 |
649 void CodeGenSelector::VisitDeclaration(Declaration* decl) { | 649 void CodeGenSelector::VisitDeclaration(Declaration* decl) { |
650 if (decl->fun() != NULL) { | 650 if (decl->fun() != NULL) { |
651 ProcessExpression(decl->fun(), Expression::kValue); | 651 ProcessExpression(decl->fun(), Expression::kValue); |
652 } | 652 } |
| 653 Variable* var = decl->proxy()->var(); |
| 654 ASSERT_NOT_NULL(var); |
| 655 if ((!var->is_global() && decl->fun() != NULL)) { |
| 656 BAILOUT("Non-global function declaration"); |
| 657 } |
| 658 if ((!var->is_global() && |
| 659 var->slot() != NULL && |
| 660 var->slot()->type() == Slot::LOOKUP)) { |
| 661 BAILOUT("Lookup slot encountered in declaration"); |
| 662 } |
653 } | 663 } |
654 | 664 |
655 | 665 |
656 void CodeGenSelector::VisitBlock(Block* stmt) { | 666 void CodeGenSelector::VisitBlock(Block* stmt) { |
657 VisitStatements(stmt->statements()); | 667 VisitStatements(stmt->statements()); |
658 } | 668 } |
659 | 669 |
660 | 670 |
661 void CodeGenSelector::VisitExpressionStatement(ExpressionStatement* stmt) { | 671 void CodeGenSelector::VisitExpressionStatement(ExpressionStatement* stmt) { |
662 ProcessExpression(stmt->expression(), Expression::kEffect); | 672 ProcessExpression(stmt->expression(), Expression::kEffect); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 if (rewrite != NULL) { | 797 if (rewrite != NULL) { |
788 // Non-global. | 798 // Non-global. |
789 Slot* slot = rewrite->AsSlot(); | 799 Slot* slot = rewrite->AsSlot(); |
790 if (slot == NULL) { | 800 if (slot == NULL) { |
791 // This is a variable rewritten to an explicit property access | 801 // This is a variable rewritten to an explicit property access |
792 // on the arguments object. | 802 // on the arguments object. |
793 BAILOUT("non-global/non-slot variable reference"); | 803 BAILOUT("non-global/non-slot variable reference"); |
794 } | 804 } |
795 | 805 |
796 Slot::Type type = slot->type(); | 806 Slot::Type type = slot->type(); |
797 if (type != Slot::PARAMETER && type != Slot::LOCAL) { | 807 // When LOOKUP slots are enabled, some currently dead code |
798 BAILOUT("non-parameter/non-local slot reference"); | 808 // implementing unary typeof will become live. |
| 809 if (type == Slot::LOOKUP) { |
| 810 BAILOUT("Lookup slot"); |
799 } | 811 } |
800 } | 812 } |
801 } | 813 } |
802 | 814 |
803 | 815 |
804 void CodeGenSelector::VisitLiteral(Literal* expr) { | 816 void CodeGenSelector::VisitLiteral(Literal* expr) { |
805 /* Nothing to do. */ | 817 /* Nothing to do. */ |
806 } | 818 } |
807 | 819 |
808 | 820 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 888 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); |
877 Property* prop = expr->target()->AsProperty(); | 889 Property* prop = expr->target()->AsProperty(); |
878 if (var != NULL) { | 890 if (var != NULL) { |
879 // All global variables are supported. | 891 // All global variables are supported. |
880 if (!var->is_global()) { | 892 if (!var->is_global()) { |
881 if (var->slot() == NULL) { | 893 if (var->slot() == NULL) { |
882 // This is a parameter that has rewritten to an arguments access. | 894 // This is a parameter that has rewritten to an arguments access. |
883 BAILOUT("non-global/non-slot assignment"); | 895 BAILOUT("non-global/non-slot assignment"); |
884 } | 896 } |
885 Slot::Type type = var->slot()->type(); | 897 Slot::Type type = var->slot()->type(); |
886 if (type != Slot::PARAMETER && type != Slot::LOCAL) { | 898 if (type == Slot::LOOKUP) { |
887 BAILOUT("non-parameter/non-local slot assignment"); | 899 BAILOUT("Lookup slot"); |
888 } | 900 } |
889 } | 901 } |
890 } else if (prop != NULL) { | 902 } else if (prop != NULL) { |
891 ProcessExpression(prop->obj(), Expression::kValue); | 903 ProcessExpression(prop->obj(), Expression::kValue); |
892 CHECK_BAILOUT; | 904 CHECK_BAILOUT; |
893 // We will only visit the key during code generation for keyed property | 905 // We will only visit the key during code generation for keyed property |
894 // stores. Leave its expression context uninitialized for named | 906 // stores. Leave its expression context uninitialized for named |
895 // property stores. | 907 // property stores. |
896 Literal* lit = prop->key()->AsLiteral(); | 908 Literal* lit = prop->key()->AsLiteral(); |
897 uint32_t ignored; | 909 uint32_t ignored; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 | 1108 |
1097 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 1109 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
1098 BAILOUT("ThisFunction"); | 1110 BAILOUT("ThisFunction"); |
1099 } | 1111 } |
1100 | 1112 |
1101 #undef BAILOUT | 1113 #undef BAILOUT |
1102 #undef CHECK_BAILOUT | 1114 #undef CHECK_BAILOUT |
1103 | 1115 |
1104 | 1116 |
1105 } } // namespace v8::internal | 1117 } } // namespace v8::internal |
OLD | NEW |