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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 ZoneList<Expression*>* args = expr->arguments(); | 763 ZoneList<Expression*>* args = expr->arguments(); |
764 Variable* var = fun->AsVariableProxy()->AsVariable(); | 764 Variable* var = fun->AsVariableProxy()->AsVariable(); |
765 | 765 |
766 // Check for supported calls | 766 // Check for supported calls |
767 if (var != NULL && var->is_possibly_eval()) { | 767 if (var != NULL && var->is_possibly_eval()) { |
768 BAILOUT("Call to a function named 'eval'"); | 768 BAILOUT("Call to a function named 'eval'"); |
769 } else if (var != NULL && !var->is_this() && var->is_global()) { | 769 } else if (var != NULL && !var->is_this() && var->is_global()) { |
770 // ---------------------------------- | 770 // ---------------------------------- |
771 // JavaScript example: 'foo(1, 2, 3)' // foo is global | 771 // JavaScript example: 'foo(1, 2, 3)' // foo is global |
772 // ---------------------------------- | 772 // ---------------------------------- |
| 773 } else if (fun->AsProperty() != NULL) { |
| 774 // ------------------------------------------------------------------ |
| 775 // JavaScript example: 'object.foo(1, 2, 3)' or 'map["key"](1, 2, 3)' |
| 776 // ------------------------------------------------------------------ |
| 777 Property* prop = fun->AsProperty(); |
| 778 Literal* literal_key = prop->key()->AsLiteral(); |
| 779 if (literal_key != NULL && literal_key->handle()->IsSymbol()) { |
| 780 ProcessExpression(prop->obj(), Expression::kValue); |
| 781 CHECK_BAILOUT; |
| 782 } else { |
| 783 ProcessExpression(prop->obj(), Expression::kValue); |
| 784 CHECK_BAILOUT; |
| 785 ProcessExpression(prop->key(), Expression::kValue); |
| 786 CHECK_BAILOUT; |
| 787 } |
773 } else { | 788 } else { |
774 BAILOUT("Call to a non-global function"); | 789 BAILOUT("Unsupported call to a function"); |
775 } | 790 } |
776 // Check all arguments to the call. (Relies on TEMP meaning STACK.) | 791 // Check all arguments to the call. (Relies on TEMP meaning STACK.) |
777 for (int i = 0; i < args->length(); i++) { | 792 for (int i = 0; i < args->length(); i++) { |
778 ProcessExpression(args->at(i), Expression::kValue); | 793 ProcessExpression(args->at(i), Expression::kValue); |
779 CHECK_BAILOUT; | 794 CHECK_BAILOUT; |
780 } | 795 } |
781 } | 796 } |
782 | 797 |
783 | 798 |
784 void CodeGenSelector::VisitCallNew(CallNew* expr) { | 799 void CodeGenSelector::VisitCallNew(CallNew* expr) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 | 877 |
863 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 878 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
864 BAILOUT("ThisFunction"); | 879 BAILOUT("ThisFunction"); |
865 } | 880 } |
866 | 881 |
867 #undef BAILOUT | 882 #undef BAILOUT |
868 #undef CHECK_BAILOUT | 883 #undef CHECK_BAILOUT |
869 | 884 |
870 | 885 |
871 } } // namespace v8::internal | 886 } } // namespace v8::internal |
OLD | NEW |