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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
733 } else { | 733 } else { |
734 __ mov(r0, Operand(Smi::FromInt(0))); // No initial value! | 734 __ mov(r0, Operand(Smi::FromInt(0))); // No initial value! |
735 __ Push(cp, r2, r1, r0); | 735 __ Push(cp, r2, r1, r0); |
736 } | 736 } |
737 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 737 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
738 break; | 738 break; |
739 } | 739 } |
740 } | 740 } |
741 | 741 |
742 } else if (prop != NULL) { | 742 } else if (prop != NULL) { |
743 if (function != NULL || mode == Variable::CONST) { | 743 ASSERT(mode != Variable::CONST); |
Kevin Millikin (Chromium)
2011/05/24 12:57:27
This needs a comment that a const declaration of a
William Hesse
2011/05/24 14:21:43
Done.
| |
744 // We are declaring a function or constant that rewrites to a | 744 ASSERT(function != NULL); |
Kevin Millikin (Chromium)
2011/05/24 12:57:27
I think this is wrong:
function f(x) { var x = ar
William Hesse
2011/05/24 14:21:43
Done.
| |
745 // property. Use (keyed) IC to set the initial value. We | 745 // We are declaring a function that rewrites to a property. |
746 // cannot visit the rewrite because it's shared and we risk | 746 // Use (keyed) IC to set the initial value. We cannot visit the |
747 // recording duplicate AST IDs for bailouts from optimized code. | 747 // rewrite because it's shared and we risk recording duplicate AST |
748 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 748 // IDs for bailouts from optimized code. |
749 { AccumulatorValueContext for_object(this); | 749 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
750 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 750 { AccumulatorValueContext for_object(this); |
751 } | 751 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
752 if (function != NULL) { | 752 } |
753 __ push(r0); | |
754 VisitForAccumulatorValue(function); | |
755 __ pop(r2); | |
756 } else { | |
757 __ mov(r2, r0); | |
758 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); | |
759 } | |
760 ASSERT(prop->key()->AsLiteral() != NULL && | |
761 prop->key()->AsLiteral()->handle()->IsSmi()); | |
762 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); | |
763 | 753 |
764 Handle<Code> ic = is_strict_mode() | 754 __ push(r0); |
765 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 755 VisitForAccumulatorValue(function); |
766 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 756 __ pop(r2); |
767 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); | 757 |
768 // Value in r0 is ignored (declarations are statements). | 758 ASSERT(prop->key()->AsLiteral() != NULL && |
769 } | 759 prop->key()->AsLiteral()->handle()->IsSmi()); |
760 __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); | |
761 | |
762 Handle<Code> ic = is_strict_mode() | |
763 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | |
764 : isolate()->builtins()->KeyedStoreIC_Initialize(); | |
765 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); | |
766 // Value in r0 is ignored (declarations are statements). | |
770 } | 767 } |
771 } | 768 } |
772 | 769 |
773 | 770 |
774 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 771 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
775 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 772 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
776 } | 773 } |
777 | 774 |
778 | 775 |
779 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 776 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
(...skipping 3574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4354 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4351 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4355 __ add(pc, r1, Operand(masm_->CodeObject())); | 4352 __ add(pc, r1, Operand(masm_->CodeObject())); |
4356 } | 4353 } |
4357 | 4354 |
4358 | 4355 |
4359 #undef __ | 4356 #undef __ |
4360 | 4357 |
4361 } } // namespace v8::internal | 4358 } } // namespace v8::internal |
4362 | 4359 |
4363 #endif // V8_TARGET_ARCH_ARM | 4360 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |