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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 VisitForStackValue(function); | 720 VisitForStackValue(function); |
721 } else { | 721 } else { |
722 __ push(Immediate(Smi::FromInt(0))); // No initial value! | 722 __ push(Immediate(Smi::FromInt(0))); // No initial value! |
723 } | 723 } |
724 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 724 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
725 break; | 725 break; |
726 } | 726 } |
727 } | 727 } |
728 | 728 |
729 } else if (prop != NULL) { | 729 } else if (prop != NULL) { |
730 if (function != NULL || mode == Variable::CONST) { | 730 // A const declaration aliasing a parameter is an illegal redeclaration. |
731 // We are declaring a function or constant that rewrites to a | 731 ASSERT(mode != Variable::CONST); |
732 // property. Use (keyed) IC to set the initial value. We cannot | 732 if (function != NULL) { |
733 // visit the rewrite because it's shared and we risk recording | 733 // We are declaring a function that rewrites to a property. |
734 // duplicate AST IDs for bailouts from optimized code. | 734 // Use (keyed) IC to set the initial value. We cannot visit the |
| 735 // rewrite because it's shared and we risk recording duplicate AST |
| 736 // IDs for bailouts from optimized code. |
735 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 737 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
736 { AccumulatorValueContext for_object(this); | 738 { AccumulatorValueContext for_object(this); |
737 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 739 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
738 } | 740 } |
739 | 741 |
740 if (function != NULL) { | 742 __ push(eax); |
741 __ push(eax); | 743 VisitForAccumulatorValue(function); |
742 VisitForAccumulatorValue(function); | 744 __ pop(edx); |
743 __ pop(edx); | 745 |
744 } else { | |
745 __ mov(edx, eax); | |
746 __ mov(eax, isolate()->factory()->the_hole_value()); | |
747 } | |
748 ASSERT(prop->key()->AsLiteral() != NULL && | 746 ASSERT(prop->key()->AsLiteral() != NULL && |
749 prop->key()->AsLiteral()->handle()->IsSmi()); | 747 prop->key()->AsLiteral()->handle()->IsSmi()); |
750 __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle())); | 748 __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle())); |
751 | 749 |
752 Handle<Code> ic = is_strict_mode() | 750 Handle<Code> ic = is_strict_mode() |
753 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 751 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
754 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 752 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
755 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); | 753 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
756 } | 754 } |
757 } | 755 } |
(...skipping 3573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4331 // And return. | 4329 // And return. |
4332 __ ret(0); | 4330 __ ret(0); |
4333 } | 4331 } |
4334 | 4332 |
4335 | 4333 |
4336 #undef __ | 4334 #undef __ |
4337 | 4335 |
4338 } } // namespace v8::internal | 4336 } } // namespace v8::internal |
4339 | 4337 |
4340 #endif // V8_TARGET_ARCH_IA32 | 4338 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |