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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
707 VisitForStackValue(function); | 707 VisitForStackValue(function); |
708 } else { | 708 } else { |
709 __ Push(Smi::FromInt(0)); // no initial value! | 709 __ Push(Smi::FromInt(0)); // no initial value! |
710 } | 710 } |
711 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 711 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
712 break; | 712 break; |
713 } | 713 } |
714 } | 714 } |
715 | 715 |
716 } else if (prop != NULL) { | 716 } else if (prop != NULL) { |
717 if (function != NULL || mode == Variable::CONST) { | 717 ASSERT(mode != Variable::CONST); |
718 // We are declaring a function or constant that rewrites to a | 718 ASSERT(function != NULL); |
Kevin Millikin (Chromium)
2011/05/24 14:36:25
You still can't assert this here.
| |
719 // property. Use (keyed) IC to set the initial value. We | 719 // We are declaring a function that rewrites to a property. |
720 // cannot visit the rewrite because it's shared and we risk | 720 // Use (keyed) IC to set the initial value. We cannot visit the |
721 // recording duplicate AST IDs for bailouts from optimized code. | 721 // rewrite because it's shared and we risk recording duplicate AST |
722 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 722 // IDs for bailouts from optimized code. |
723 { AccumulatorValueContext for_object(this); | 723 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
724 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 724 { AccumulatorValueContext for_object(this); |
725 } | 725 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
726 if (function != NULL) { | 726 } |
727 __ push(rax); | 727 __ push(rax); |
728 VisitForAccumulatorValue(function); | 728 VisitForAccumulatorValue(function); |
729 __ pop(rdx); | 729 __ pop(rdx); |
730 } else { | 730 ASSERT(prop->key()->AsLiteral() != NULL && |
731 __ movq(rdx, rax); | 731 prop->key()->AsLiteral()->handle()->IsSmi()); |
732 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex); | 732 __ Move(rcx, prop->key()->AsLiteral()->handle()); |
733 } | |
734 ASSERT(prop->key()->AsLiteral() != NULL && | |
735 prop->key()->AsLiteral()->handle()->IsSmi()); | |
736 __ Move(rcx, prop->key()->AsLiteral()->handle()); | |
737 | 733 |
738 Handle<Code> ic = is_strict_mode() | 734 Handle<Code> ic = is_strict_mode() |
739 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 735 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
740 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 736 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
741 EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); | 737 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
742 } | |
743 } | 738 } |
744 } | 739 } |
745 | 740 |
746 | 741 |
747 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 742 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
748 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 743 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
749 } | 744 } |
750 | 745 |
751 | 746 |
752 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 747 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
(...skipping 3542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4295 __ ret(0); | 4290 __ ret(0); |
4296 } | 4291 } |
4297 | 4292 |
4298 | 4293 |
4299 #undef __ | 4294 #undef __ |
4300 | 4295 |
4301 | 4296 |
4302 } } // namespace v8::internal | 4297 } } // namespace v8::internal |
4303 | 4298 |
4304 #endif // V8_TARGET_ARCH_X64 | 4299 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |