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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 __ Push(Smi::FromInt(0)); // no initial value! | 704 __ Push(Smi::FromInt(0)); // no initial value! |
705 } | 705 } |
706 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 706 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
707 break; | 707 break; |
708 } | 708 } |
709 } | 709 } |
710 | 710 |
711 } else if (prop != NULL) { | 711 } else if (prop != NULL) { |
712 if (function != NULL || mode == Variable::CONST) { | 712 if (function != NULL || mode == Variable::CONST) { |
713 // We are declaring a function or constant that rewrites to a | 713 // We are declaring a function or constant that rewrites to a |
714 // property. Use (keyed) IC to set the initial value. | 714 // property. Use (keyed) IC to set the initial value. We |
715 VisitForStackValue(prop->obj()); | 715 // cannot visit the rewrite because it's shared and we risk |
| 716 // recording duplicate AST IDs for bailouts from optimized code. |
| 717 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 718 { AccumulatorValueContext for_object(this); |
| 719 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
| 720 } |
716 if (function != NULL) { | 721 if (function != NULL) { |
717 VisitForStackValue(prop->key()); | 722 __ push(rax); |
718 VisitForAccumulatorValue(function); | 723 VisitForAccumulatorValue(function); |
719 __ pop(rcx); | 724 __ pop(rdx); |
720 } else { | 725 } else { |
721 VisitForAccumulatorValue(prop->key()); | 726 __ movq(rdx, rax); |
722 __ movq(rcx, result_register()); | 727 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex); |
723 __ LoadRoot(result_register(), Heap::kTheHoleValueRootIndex); | |
724 } | 728 } |
725 __ pop(rdx); | 729 ASSERT(prop->key()->AsLiteral() != NULL && |
| 730 prop->key()->AsLiteral()->handle()->IsSmi()); |
| 731 __ Move(rcx, prop->key()->AsLiteral()->handle()); |
726 | 732 |
727 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); | 733 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |
728 EmitCallIC(ic, RelocInfo::CODE_TARGET); | 734 EmitCallIC(ic, RelocInfo::CODE_TARGET); |
729 } | 735 } |
730 } | 736 } |
731 } | 737 } |
732 | 738 |
733 | 739 |
734 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 740 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
735 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 741 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
(...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3731 __ ret(0); | 3737 __ ret(0); |
3732 } | 3738 } |
3733 | 3739 |
3734 | 3740 |
3735 #undef __ | 3741 #undef __ |
3736 | 3742 |
3737 | 3743 |
3738 } } // namespace v8::internal | 3744 } } // namespace v8::internal |
3739 | 3745 |
3740 #endif // V8_TARGET_ARCH_X64 | 3746 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |