| 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 } | 793 } |
| 794 | 794 |
| 795 | 795 |
| 796 void CodeGenSelector::VisitCall(Call* expr) { | 796 void CodeGenSelector::VisitCall(Call* expr) { |
| 797 Expression* fun = expr->expression(); | 797 Expression* fun = expr->expression(); |
| 798 ZoneList<Expression*>* args = expr->arguments(); | 798 ZoneList<Expression*>* args = expr->arguments(); |
| 799 Variable* var = fun->AsVariableProxy()->AsVariable(); | 799 Variable* var = fun->AsVariableProxy()->AsVariable(); |
| 800 | 800 |
| 801 // Check for supported calls | 801 // Check for supported calls |
| 802 if (var != NULL && var->is_possibly_eval()) { | 802 if (var != NULL && var->is_possibly_eval()) { |
| 803 // ---------------------------------- | 803 BAILOUT("call to the identifier 'eval'"); |
| 804 // JavaScript example: 'eval(arg)' // eval is not known to be shadowed | |
| 805 // ---------------------------------- | |
| 806 BAILOUT("Call to a function named 'eval'"); | |
| 807 } else if (var != NULL && !var->is_this() && var->is_global()) { | 804 } else if (var != NULL && !var->is_this() && var->is_global()) { |
| 808 // ---------------------------------- | 805 // Calls to global variables are supported. |
| 809 // JavaScript example: 'foo(1, 2, 3)' // foo is global | 806 } else if (var != NULL && var->slot() != NULL && |
| 810 // ---------------------------------- | 807 var->slot()->type() == Slot::LOOKUP) { |
| 808 BAILOUT("call to a lookup slot"); |
| 811 } else if (fun->AsProperty() != NULL) { | 809 } else if (fun->AsProperty() != NULL) { |
| 812 // ------------------------------------------------------------------ | |
| 813 // JavaScript example: 'object.foo(1, 2, 3)' or 'map["key"](1, 2, 3)' | |
| 814 // ------------------------------------------------------------------ | |
| 815 Property* prop = fun->AsProperty(); | 810 Property* prop = fun->AsProperty(); |
| 816 Literal* literal_key = prop->key()->AsLiteral(); | 811 Literal* literal_key = prop->key()->AsLiteral(); |
| 817 if (literal_key != NULL && literal_key->handle()->IsSymbol()) { | 812 if (literal_key != NULL && literal_key->handle()->IsSymbol()) { |
| 818 ProcessExpression(prop->obj(), Expression::kValue); | 813 ProcessExpression(prop->obj(), Expression::kValue); |
| 819 CHECK_BAILOUT; | 814 CHECK_BAILOUT; |
| 820 } else { | 815 } else { |
| 821 ProcessExpression(prop->obj(), Expression::kValue); | 816 ProcessExpression(prop->obj(), Expression::kValue); |
| 822 CHECK_BAILOUT; | 817 CHECK_BAILOUT; |
| 823 ProcessExpression(prop->key(), Expression::kValue); | 818 ProcessExpression(prop->key(), Expression::kValue); |
| 824 CHECK_BAILOUT; | 819 CHECK_BAILOUT; |
| 825 } | 820 } |
| 826 } else if (var != NULL && var->slot() != NULL && | |
| 827 var->slot()->type() == Slot::LOOKUP) { | |
| 828 // ---------------------------------- | |
| 829 // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj | |
| 830 // ---------------------------------- | |
| 831 BAILOUT("Call inside a with-statement"); | |
| 832 } else { | 821 } else { |
| 833 // ---------------------------------- | 822 // Otherwise the call is supported if the function expression is. |
| 834 // JavaScript example: 'foo(1, 2, 3)' // foo is any expression, not global | |
| 835 // ---------------------------------- | |
| 836 ProcessExpression(fun, Expression::kValue); | 823 ProcessExpression(fun, Expression::kValue); |
| 837 } | 824 } |
| 838 // Check all arguments to the call. (Relies on TEMP meaning STACK.) | 825 // Check all arguments to the call. |
| 839 for (int i = 0; i < args->length(); i++) { | 826 for (int i = 0; i < args->length(); i++) { |
| 840 ProcessExpression(args->at(i), Expression::kValue); | 827 ProcessExpression(args->at(i), Expression::kValue); |
| 841 CHECK_BAILOUT; | 828 CHECK_BAILOUT; |
| 842 } | 829 } |
| 843 } | 830 } |
| 844 | 831 |
| 845 | 832 |
| 846 void CodeGenSelector::VisitCallNew(CallNew* expr) { | 833 void CodeGenSelector::VisitCallNew(CallNew* expr) { |
| 847 ProcessExpression(expr->expression(), Expression::kValue); | 834 ProcessExpression(expr->expression(), Expression::kValue); |
| 848 CHECK_BAILOUT; | 835 CHECK_BAILOUT; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 | 964 |
| 978 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 965 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
| 979 BAILOUT("ThisFunction"); | 966 BAILOUT("ThisFunction"); |
| 980 } | 967 } |
| 981 | 968 |
| 982 #undef BAILOUT | 969 #undef BAILOUT |
| 983 #undef CHECK_BAILOUT | 970 #undef CHECK_BAILOUT |
| 984 | 971 |
| 985 | 972 |
| 986 } } // namespace v8::internal | 973 } } // namespace v8::internal |
| OLD | NEW |