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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 __ bind(&boilerplate_exists); | 658 __ bind(&boilerplate_exists); |
659 // r0 contains boilerplate. | 659 // r0 contains boilerplate. |
660 // Clone boilerplate. | 660 // Clone boilerplate. |
661 __ push(r0); | 661 __ push(r0); |
662 if (expr->depth() > 1) { | 662 if (expr->depth() > 1) { |
663 __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1); | 663 __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1); |
664 } else { | 664 } else { |
665 __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1); | 665 __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1); |
666 } | 666 } |
667 | 667 |
668 // If result_saved == true: the result is saved on top of the stack. | 668 // If result_saved == true: The result is saved on top of the |
669 // If result_saved == false: the result is in r0. | 669 // stack and in r0. |
| 670 // If result_saved == false: The result not on the stack, just in r0. |
670 bool result_saved = false; | 671 bool result_saved = false; |
671 | 672 |
672 for (int i = 0; i < expr->properties()->length(); i++) { | 673 for (int i = 0; i < expr->properties()->length(); i++) { |
673 ObjectLiteral::Property* property = expr->properties()->at(i); | 674 ObjectLiteral::Property* property = expr->properties()->at(i); |
674 if (property->IsCompileTimeValue()) continue; | 675 if (property->IsCompileTimeValue()) continue; |
675 | 676 |
676 Literal* key = property->key(); | 677 Literal* key = property->key(); |
677 Expression* value = property->value(); | 678 Expression* value = property->value(); |
678 if (!result_saved) { | 679 if (!result_saved) { |
679 __ push(r0); // Save result on stack | 680 __ push(r0); // Save result on stack |
680 result_saved = true; | 681 result_saved = true; |
681 } | 682 } |
682 switch (property->kind()) { | 683 switch (property->kind()) { |
683 case ObjectLiteral::Property::CONSTANT: | 684 case ObjectLiteral::Property::CONSTANT: |
684 UNREACHABLE(); | 685 UNREACHABLE(); |
685 | 686 |
686 case ObjectLiteral::Property::MATERIALIZED_LITERAL: // Fall through. | 687 case ObjectLiteral::Property::MATERIALIZED_LITERAL: // Fall through. |
687 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); | 688 ASSERT(!CompileTimeValue::IsCompileTimeValue(property->value())); |
688 case ObjectLiteral::Property::COMPUTED: | 689 case ObjectLiteral::Property::COMPUTED: |
689 if (key->handle()->IsSymbol()) { | 690 if (key->handle()->IsSymbol()) { |
690 Visit(value); | 691 Visit(value); |
691 ASSERT_EQ(Expression::kValue, value->context()); | 692 ASSERT_EQ(Expression::kValue, value->context()); |
692 __ pop(r0); | 693 __ pop(r0); |
693 __ mov(r2, Operand(key->handle())); | 694 __ mov(r2, Operand(key->handle())); |
694 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 695 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); |
695 __ Call(ic, RelocInfo::CODE_TARGET); | 696 __ Call(ic, RelocInfo::CODE_TARGET); |
696 // StoreIC leaves the receiver on the stack. | 697 // StoreIC leaves the receiver on the stack. |
| 698 __ ldr(r0, MemOperand(sp)); // Restore result into r0. |
697 break; | 699 break; |
698 } | 700 } |
699 // Fall through. | 701 // Fall through. |
700 | 702 |
701 case ObjectLiteral::Property::PROTOTYPE: | 703 case ObjectLiteral::Property::PROTOTYPE: |
702 __ push(r0); | 704 __ push(r0); |
703 Visit(key); | 705 Visit(key); |
704 ASSERT_EQ(Expression::kValue, key->context()); | 706 ASSERT_EQ(Expression::kValue, key->context()); |
705 Visit(value); | 707 Visit(value); |
706 ASSERT_EQ(Expression::kValue, value->context()); | 708 ASSERT_EQ(Expression::kValue, value->context()); |
707 __ CallRuntime(Runtime::kSetProperty, 3); | 709 __ CallRuntime(Runtime::kSetProperty, 3); |
708 __ ldr(r0, MemOperand(sp)); // Restore result into r0 | 710 __ ldr(r0, MemOperand(sp)); // Restore result into r0. |
709 break; | 711 break; |
710 | 712 |
711 case ObjectLiteral::Property::GETTER: // Fall through. | 713 case ObjectLiteral::Property::GETTER: // Fall through. |
712 case ObjectLiteral::Property::SETTER: | 714 case ObjectLiteral::Property::SETTER: |
713 __ push(r0); | 715 __ push(r0); |
714 Visit(key); | 716 Visit(key); |
715 ASSERT_EQ(Expression::kValue, key->context()); | 717 ASSERT_EQ(Expression::kValue, key->context()); |
716 __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ? | 718 __ mov(r1, Operand(property->kind() == ObjectLiteral::Property::SETTER ? |
717 Smi::FromInt(1) : | 719 Smi::FromInt(1) : |
718 Smi::FromInt(0))); | 720 Smi::FromInt(0))); |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 true_label_ = saved_true; | 1686 true_label_ = saved_true; |
1685 false_label_ = saved_false; | 1687 false_label_ = saved_false; |
1686 // Convert current context to test context: End post-test code. | 1688 // Convert current context to test context: End post-test code. |
1687 } | 1689 } |
1688 | 1690 |
1689 | 1691 |
1690 #undef __ | 1692 #undef __ |
1691 | 1693 |
1692 | 1694 |
1693 } } // namespace v8::internal | 1695 } } // namespace v8::internal |
OLD | NEW |