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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 __ push(Immediate(Smi::FromInt(0))); // No initial value! | 710 __ push(Immediate(Smi::FromInt(0))); // No initial value! |
711 } | 711 } |
712 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 712 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
713 break; | 713 break; |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 } else if (prop != NULL) { | 717 } else if (prop != NULL) { |
718 if (function != NULL || mode == Variable::CONST) { | 718 if (function != NULL || mode == Variable::CONST) { |
719 // We are declaring a function or constant that rewrites to a | 719 // We are declaring a function or constant that rewrites to a |
720 // property. Use (keyed) IC to set the initial value. | 720 // property. Use (keyed) IC to set the initial value. We cannot |
721 VisitForStackValue(prop->obj()); | 721 // visit the rewrite because it's shared and we risk recording |
| 722 // duplicate AST IDs for bailouts from optimized code. |
| 723 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 724 { AccumulatorValueContext for_object(this); |
| 725 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
| 726 } |
| 727 |
722 if (function != NULL) { | 728 if (function != NULL) { |
723 VisitForStackValue(prop->key()); | 729 __ push(eax); |
724 VisitForAccumulatorValue(function); | 730 VisitForAccumulatorValue(function); |
725 __ pop(ecx); | 731 __ pop(edx); |
726 } else { | 732 } else { |
727 VisitForAccumulatorValue(prop->key()); | 733 __ mov(edx, eax); |
728 __ mov(ecx, result_register()); | 734 __ mov(eax, Factory::the_hole_value()); |
729 __ mov(result_register(), Factory::the_hole_value()); | |
730 } | 735 } |
731 __ pop(edx); | 736 ASSERT(prop->key()->AsLiteral() != NULL && |
| 737 prop->key()->AsLiteral()->handle()->IsSmi()); |
| 738 __ Set(ecx, Immediate(prop->key()->AsLiteral()->handle())); |
732 | 739 |
733 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 740 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |
734 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 741 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
735 } | 742 } |
736 } | 743 } |
737 } | 744 } |
738 | 745 |
739 | 746 |
740 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 747 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
741 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 748 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
(...skipping 3650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4392 // And return. | 4399 // And return. |
4393 __ ret(0); | 4400 __ ret(0); |
4394 } | 4401 } |
4395 | 4402 |
4396 | 4403 |
4397 #undef __ | 4404 #undef __ |
4398 | 4405 |
4399 } } // namespace v8::internal | 4406 } } // namespace v8::internal |
4400 | 4407 |
4401 #endif // V8_TARGET_ARCH_IA32 | 4408 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |