| 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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 __ bind(&boilerplate_exists); | 659 __ bind(&boilerplate_exists); |
| 660 // rax contains boilerplate. | 660 // rax contains boilerplate. |
| 661 // Clone boilerplate. | 661 // Clone boilerplate. |
| 662 __ push(rax); | 662 __ push(rax); |
| 663 if (expr->depth() == 1) { | 663 if (expr->depth() == 1) { |
| 664 __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1); | 664 __ CallRuntime(Runtime::kCloneShallowLiteralBoilerplate, 1); |
| 665 } else { | 665 } else { |
| 666 __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1); | 666 __ CallRuntime(Runtime::kCloneLiteralBoilerplate, 1); |
| 667 } | 667 } |
| 668 | 668 |
| 669 // If result_saved == true: the result is saved on top of the stack. | 669 // If result_saved == true: The result is saved on top of the |
| 670 // If result_saved == false: the result is not on the stack, just in rax. | 670 // stack and in rax. |
| 671 // If result_saved == false: The result not on the stack, just in rax. |
| 671 bool result_saved = false; | 672 bool result_saved = false; |
| 672 | 673 |
| 673 for (int i = 0; i < expr->properties()->length(); i++) { | 674 for (int i = 0; i < expr->properties()->length(); i++) { |
| 674 ObjectLiteral::Property* property = expr->properties()->at(i); | 675 ObjectLiteral::Property* property = expr->properties()->at(i); |
| 675 if (property->IsCompileTimeValue()) continue; | 676 if (property->IsCompileTimeValue()) continue; |
| 676 | 677 |
| 677 Literal* key = property->key(); | 678 Literal* key = property->key(); |
| 678 Expression* value = property->value(); | 679 Expression* value = property->value(); |
| 679 if (!result_saved) { | 680 if (!result_saved) { |
| 680 __ push(rax); // Save result on the stack | 681 __ push(rax); // Save result on the stack |
| 681 result_saved = true; | 682 result_saved = true; |
| 682 } | 683 } |
| 683 switch (property->kind()) { | 684 switch (property->kind()) { |
| 684 case ObjectLiteral::Property::MATERIALIZED_LITERAL: // fall through | 685 case ObjectLiteral::Property::MATERIALIZED_LITERAL: // fall through |
| 685 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); | 686 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); |
| 686 case ObjectLiteral::Property::COMPUTED: | 687 case ObjectLiteral::Property::COMPUTED: |
| 687 if (key->handle()->IsSymbol()) { | 688 if (key->handle()->IsSymbol()) { |
| 688 Visit(value); | 689 Visit(value); |
| 689 ASSERT_EQ(Expression::kValue, value->context()); | 690 ASSERT_EQ(Expression::kValue, value->context()); |
| 690 __ pop(rax); | 691 __ pop(rax); |
| 691 __ Move(rcx, key->handle()); | 692 __ Move(rcx, key->handle()); |
| 692 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); | 693 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); |
| 693 __ call(ic, RelocInfo::CODE_TARGET); | 694 __ call(ic, RelocInfo::CODE_TARGET); |
| 694 // StoreIC leaves the receiver on the stack. | 695 // StoreIC leaves the receiver on the stack. |
| 696 __ movq(rax, Operand(rsp, 0)); // Restore result back into rax. |
| 695 break; | 697 break; |
| 696 } | 698 } |
| 697 // fall through | 699 // fall through |
| 698 case ObjectLiteral::Property::PROTOTYPE: | 700 case ObjectLiteral::Property::PROTOTYPE: |
| 699 __ push(rax); | 701 __ push(rax); |
| 700 Visit(key); | 702 Visit(key); |
| 701 ASSERT_EQ(Expression::kValue, key->context()); | 703 ASSERT_EQ(Expression::kValue, key->context()); |
| 702 Visit(value); | 704 Visit(value); |
| 703 ASSERT_EQ(Expression::kValue, value->context()); | 705 ASSERT_EQ(Expression::kValue, value->context()); |
| 704 __ CallRuntime(Runtime::kSetProperty, 3); | 706 __ CallRuntime(Runtime::kSetProperty, 3); |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 true_label_ = saved_true; | 1666 true_label_ = saved_true; |
| 1665 false_label_ = saved_false; | 1667 false_label_ = saved_false; |
| 1666 // Convert current context to test context: End post-test code. | 1668 // Convert current context to test context: End post-test code. |
| 1667 } | 1669 } |
| 1668 | 1670 |
| 1669 | 1671 |
| 1670 #undef __ | 1672 #undef __ |
| 1671 | 1673 |
| 1672 | 1674 |
| 1673 } } // namespace v8::internal | 1675 } } // namespace v8::internal |
| OLD | NEW |