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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 } | 766 } |
767 | 767 |
768 | 768 |
769 void CodeGenSelector::VisitCall(Call* expr) { | 769 void CodeGenSelector::VisitCall(Call* expr) { |
770 Expression* fun = expr->expression(); | 770 Expression* fun = expr->expression(); |
771 ZoneList<Expression*>* args = expr->arguments(); | 771 ZoneList<Expression*>* args = expr->arguments(); |
772 Variable* var = fun->AsVariableProxy()->AsVariable(); | 772 Variable* var = fun->AsVariableProxy()->AsVariable(); |
773 | 773 |
774 // Check for supported calls | 774 // Check for supported calls |
775 if (var != NULL && var->is_possibly_eval()) { | 775 if (var != NULL && var->is_possibly_eval()) { |
| 776 // ---------------------------------- |
| 777 // JavaScript example: 'eval(arg)' // eval is not known to be shadowed |
| 778 // ---------------------------------- |
776 BAILOUT("Call to a function named 'eval'"); | 779 BAILOUT("Call to a function named 'eval'"); |
777 } else if (var != NULL && !var->is_this() && var->is_global()) { | 780 } else if (var != NULL && !var->is_this() && var->is_global()) { |
778 // ---------------------------------- | 781 // ---------------------------------- |
779 // JavaScript example: 'foo(1, 2, 3)' // foo is global | 782 // JavaScript example: 'foo(1, 2, 3)' // foo is global |
780 // ---------------------------------- | 783 // ---------------------------------- |
781 } else if (fun->AsProperty() != NULL) { | 784 } else if (fun->AsProperty() != NULL) { |
782 // ------------------------------------------------------------------ | 785 // ------------------------------------------------------------------ |
783 // JavaScript example: 'object.foo(1, 2, 3)' or 'map["key"](1, 2, 3)' | 786 // JavaScript example: 'object.foo(1, 2, 3)' or 'map["key"](1, 2, 3)' |
784 // ------------------------------------------------------------------ | 787 // ------------------------------------------------------------------ |
785 Property* prop = fun->AsProperty(); | 788 Property* prop = fun->AsProperty(); |
786 Literal* literal_key = prop->key()->AsLiteral(); | 789 Literal* literal_key = prop->key()->AsLiteral(); |
787 if (literal_key != NULL && literal_key->handle()->IsSymbol()) { | 790 if (literal_key != NULL && literal_key->handle()->IsSymbol()) { |
788 ProcessExpression(prop->obj(), Expression::kValue); | 791 ProcessExpression(prop->obj(), Expression::kValue); |
789 CHECK_BAILOUT; | 792 CHECK_BAILOUT; |
790 } else { | 793 } else { |
791 ProcessExpression(prop->obj(), Expression::kValue); | 794 ProcessExpression(prop->obj(), Expression::kValue); |
792 CHECK_BAILOUT; | 795 CHECK_BAILOUT; |
793 ProcessExpression(prop->key(), Expression::kValue); | 796 ProcessExpression(prop->key(), Expression::kValue); |
794 CHECK_BAILOUT; | 797 CHECK_BAILOUT; |
795 } | 798 } |
| 799 } else if (var != NULL && var->slot() != NULL && |
| 800 var->slot()->type() == Slot::LOOKUP) { |
| 801 // ---------------------------------- |
| 802 // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj |
| 803 // ---------------------------------- |
| 804 BAILOUT("Call inside a with-statement"); |
796 } else { | 805 } else { |
797 BAILOUT("Unsupported call to a function"); | 806 // ---------------------------------- |
| 807 // JavaScript example: 'foo(1, 2, 3)' // foo is any expression, not global |
| 808 // ---------------------------------- |
| 809 ProcessExpression(fun, Expression::kValue); |
798 } | 810 } |
799 // Check all arguments to the call. (Relies on TEMP meaning STACK.) | 811 // Check all arguments to the call. (Relies on TEMP meaning STACK.) |
800 for (int i = 0; i < args->length(); i++) { | 812 for (int i = 0; i < args->length(); i++) { |
801 ProcessExpression(args->at(i), Expression::kValue); | 813 ProcessExpression(args->at(i), Expression::kValue); |
802 CHECK_BAILOUT; | 814 CHECK_BAILOUT; |
803 } | 815 } |
804 } | 816 } |
805 | 817 |
806 | 818 |
807 void CodeGenSelector::VisitCallNew(CallNew* expr) { | 819 void CodeGenSelector::VisitCallNew(CallNew* expr) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 | 948 |
937 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 949 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
938 BAILOUT("ThisFunction"); | 950 BAILOUT("ThisFunction"); |
939 } | 951 } |
940 | 952 |
941 #undef BAILOUT | 953 #undef BAILOUT |
942 #undef CHECK_BAILOUT | 954 #undef CHECK_BAILOUT |
943 | 955 |
944 | 956 |
945 } } // namespace v8::internal | 957 } } // namespace v8::internal |
OLD | NEW |