OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 VisitForStackValue(function); | 723 VisitForStackValue(function); |
724 } else { | 724 } else { |
725 __ Push(Smi::FromInt(0)); // no initial value! | 725 __ Push(Smi::FromInt(0)); // no initial value! |
726 } | 726 } |
727 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 727 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
728 break; | 728 break; |
729 } | 729 } |
730 } | 730 } |
731 | 731 |
732 } else if (prop != NULL) { | 732 } else if (prop != NULL) { |
733 if (function != NULL || mode == Variable::CONST) { | 733 // A const declaration aliasing a parameter is an illegal redeclaration. |
734 // We are declaring a function or constant that rewrites to a | 734 ASSERT(mode != Variable::CONST); |
735 // property. Use (keyed) IC to set the initial value. We | 735 if (function != NULL) { |
736 // cannot visit the rewrite because it's shared and we risk | 736 // We are declaring a function that rewrites to a property. |
737 // recording duplicate AST IDs for bailouts from optimized code. | 737 // Use (keyed) IC to set the initial value. We cannot visit the |
| 738 // rewrite because it's shared and we risk recording duplicate AST |
| 739 // IDs for bailouts from optimized code. |
738 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 740 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
739 { AccumulatorValueContext for_object(this); | 741 { AccumulatorValueContext for_object(this); |
740 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 742 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
741 } | 743 } |
742 if (function != NULL) { | 744 __ push(rax); |
743 __ push(rax); | 745 VisitForAccumulatorValue(function); |
744 VisitForAccumulatorValue(function); | 746 __ pop(rdx); |
745 __ pop(rdx); | |
746 } else { | |
747 __ movq(rdx, rax); | |
748 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex); | |
749 } | |
750 ASSERT(prop->key()->AsLiteral() != NULL && | 747 ASSERT(prop->key()->AsLiteral() != NULL && |
751 prop->key()->AsLiteral()->handle()->IsSmi()); | 748 prop->key()->AsLiteral()->handle()->IsSmi()); |
752 __ Move(rcx, prop->key()->AsLiteral()->handle()); | 749 __ Move(rcx, prop->key()->AsLiteral()->handle()); |
753 | 750 |
754 Handle<Code> ic = is_strict_mode() | 751 Handle<Code> ic = is_strict_mode() |
755 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 752 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
756 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 753 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
757 EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); | 754 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
758 } | 755 } |
759 } | 756 } |
760 } | 757 } |
761 | 758 |
762 | 759 |
763 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 760 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
764 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 761 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
765 } | 762 } |
766 | 763 |
767 | 764 |
(...skipping 3544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4312 __ ret(0); | 4309 __ ret(0); |
4313 } | 4310 } |
4314 | 4311 |
4315 | 4312 |
4316 #undef __ | 4313 #undef __ |
4317 | 4314 |
4318 | 4315 |
4319 } } // namespace v8::internal | 4316 } } // namespace v8::internal |
4320 | 4317 |
4321 #endif // V8_TARGET_ARCH_X64 | 4318 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |