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 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 // We support plain non-compound assignments to properties, parameters and | 884 // We support plain non-compound assignments to properties, parameters and |
885 // non-context (stack-allocated) locals, and global variables. | 885 // non-context (stack-allocated) locals, and global variables. |
886 Token::Value op = expr->op(); | 886 Token::Value op = expr->op(); |
887 if (op == Token::INIT_CONST) BAILOUT("initialize constant"); | 887 if (op == Token::INIT_CONST) BAILOUT("initialize constant"); |
888 if (op != Token::ASSIGN && op != Token::INIT_VAR) { | 888 if (op != Token::ASSIGN && op != Token::INIT_VAR) { |
889 BAILOUT("compound assignment"); | 889 BAILOUT("compound assignment"); |
890 } | 890 } |
891 | 891 |
892 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 892 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); |
893 Property* prop = expr->target()->AsProperty(); | 893 Property* prop = expr->target()->AsProperty(); |
| 894 ASSERT(var == NULL || prop == NULL); |
894 if (var != NULL) { | 895 if (var != NULL) { |
895 // All global variables are supported. | 896 // All global variables are supported. |
896 if (!var->is_global()) { | 897 if (!var->is_global()) { |
897 if (var->slot() == NULL) { | 898 ASSERT(var->slot() != NULL); |
898 Property* property = var->AsProperty(); | 899 Slot::Type type = var->slot()->type(); |
899 if (property == NULL) { | 900 if (type == Slot::LOOKUP) { |
900 BAILOUT("non-global/non-slot/non-property assignment"); | 901 BAILOUT("Lookup slot"); |
901 } | |
902 if (property->obj()->AsSlot() == NULL) { | |
903 BAILOUT("variable rewritten to property non slot object assignment"); | |
904 } | |
905 if (property->key()->AsLiteral() == NULL) { | |
906 BAILOUT("variable rewritten to property non literal key assignment"); | |
907 } | |
908 } else { | |
909 Slot::Type type = var->slot()->type(); | |
910 if (type == Slot::LOOKUP) { | |
911 BAILOUT("Lookup slot"); | |
912 } | |
913 } | 902 } |
914 } | 903 } |
915 } else if (prop != NULL) { | 904 } else if (prop != NULL) { |
| 905 ASSERT(prop->obj()->context() == Expression::kUninitialized || |
| 906 prop->obj()->context() == Expression::kValue); |
916 ProcessExpression(prop->obj(), Expression::kValue); | 907 ProcessExpression(prop->obj(), Expression::kValue); |
917 CHECK_BAILOUT; | 908 CHECK_BAILOUT; |
918 // We will only visit the key during code generation for keyed property | 909 // We will only visit the key during code generation for keyed property |
919 // stores. Leave its expression context uninitialized for named | 910 // stores. Leave its expression context uninitialized for named |
920 // property stores. | 911 // property stores. |
921 Literal* lit = prop->key()->AsLiteral(); | 912 Literal* lit = prop->key()->AsLiteral(); |
922 uint32_t ignored; | 913 uint32_t ignored; |
923 if (lit == NULL || | 914 if (lit == NULL || |
924 !lit->handle()->IsSymbol() || | 915 !lit->handle()->IsSymbol() || |
925 String::cast(*(lit->handle()))->AsArrayIndex(&ignored)) { | 916 String::cast(*(lit->handle()))->AsArrayIndex(&ignored)) { |
| 917 ASSERT(prop->key()->context() == Expression::kUninitialized || |
| 918 prop->key()->context() == Expression::kValue); |
926 ProcessExpression(prop->key(), Expression::kValue); | 919 ProcessExpression(prop->key(), Expression::kValue); |
927 CHECK_BAILOUT; | 920 CHECK_BAILOUT; |
928 } | 921 } |
929 } else { | 922 } else { |
930 // This is a throw reference error. | 923 // This is a throw reference error. |
931 BAILOUT("non-variable/non-property assignment"); | 924 BAILOUT("non-variable/non-property assignment"); |
932 } | 925 } |
933 | 926 |
934 ProcessExpression(expr->value(), Expression::kValue); | 927 ProcessExpression(expr->value(), Expression::kValue); |
935 } | 928 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 | 1112 |
1120 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 1113 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
1121 BAILOUT("ThisFunction"); | 1114 BAILOUT("ThisFunction"); |
1122 } | 1115 } |
1123 | 1116 |
1124 #undef BAILOUT | 1117 #undef BAILOUT |
1125 #undef CHECK_BAILOUT | 1118 #undef CHECK_BAILOUT |
1126 | 1119 |
1127 | 1120 |
1128 } } // namespace v8::internal | 1121 } } // namespace v8::internal |
OLD | NEW |