OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 | 657 |
658 Comment cmnt(masm_, "[ LoadReference"); | 658 Comment cmnt(masm_, "[ LoadReference"); |
659 Expression* e = ref->expression(); | 659 Expression* e = ref->expression(); |
660 Property* property = e->AsProperty(); | 660 Property* property = e->AsProperty(); |
661 Variable* var = e->AsVariableProxy()->AsVariable(); | 661 Variable* var = e->AsVariableProxy()->AsVariable(); |
662 | 662 |
663 if (property != NULL) { | 663 if (property != NULL) { |
664 // The expression is either a property or a variable proxy that rewrites | 664 // The expression is either a property or a variable proxy that rewrites |
665 // to a property. | 665 // to a property. |
666 Load(property->obj()); | 666 Load(property->obj()); |
667 // We use a named reference if the key is a literal symbol, unless it is | 667 if (property->key()->IsPropertyName()) { |
668 // a string that can be legally parsed as an integer. This is because | |
669 // otherwise we will not get into the slow case code that handles [] on | |
670 // String objects. | |
671 Literal* literal = property->key()->AsLiteral(); | |
672 uint32_t dummy; | |
673 if (literal != NULL && | |
674 literal->handle()->IsSymbol() && | |
675 !String::cast(*(literal->handle()))->AsArrayIndex(&dummy)) { | |
676 ref->set_type(Reference::NAMED); | 668 ref->set_type(Reference::NAMED); |
677 } else { | 669 } else { |
678 Load(property->key()); | 670 Load(property->key()); |
679 ref->set_type(Reference::KEYED); | 671 ref->set_type(Reference::KEYED); |
680 } | 672 } |
681 } else if (var != NULL) { | 673 } else if (var != NULL) { |
682 // The expression is a variable proxy that does not rewrite to a | 674 // The expression is a variable proxy that does not rewrite to a |
683 // property. Global variables are treated as named property references. | 675 // property. Global variables are treated as named property references. |
684 if (var->is_global()) { | 676 if (var->is_global()) { |
685 LoadGlobal(); | 677 LoadGlobal(); |
(...skipping 9081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9767 | 9759 |
9768 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 9760 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
9769 // tagged as a small integer. | 9761 // tagged as a small integer. |
9770 __ bind(&runtime); | 9762 __ bind(&runtime); |
9771 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); | 9763 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); |
9772 } | 9764 } |
9773 | 9765 |
9774 #undef __ | 9766 #undef __ |
9775 | 9767 |
9776 } } // namespace v8::internal | 9768 } } // namespace v8::internal |
OLD | NEW |