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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 // No initial value! | 739 // No initial value! |
740 __ mov(a0, zero_reg); // Operand(Smi::FromInt(0))); | 740 __ mov(a0, zero_reg); // Operand(Smi::FromInt(0))); |
741 __ Push(cp, a2, a1, a0); | 741 __ Push(cp, a2, a1, a0); |
742 } | 742 } |
743 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 743 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
744 break; | 744 break; |
745 } | 745 } |
746 } | 746 } |
747 | 747 |
748 } else if (prop != NULL) { | 748 } else if (prop != NULL) { |
749 if (function != NULL || mode == Variable::CONST) { | 749 ASSERT(mode != Variable::CONST); |
750 // We are declaring a function or constant that rewrites to a | 750 ASSERT(function != NULL); |
751 // property. Use (keyed) IC to set the initial value. We | 751 // We are declaring a function that rewrites to a property. |
752 // cannot visit the rewrite because it's shared and we risk | 752 // Use (keyed) IC to set the initial value. We cannot visit the |
753 // recording duplicate AST IDs for bailouts from optimized code. | 753 // rewrite because it's shared and we risk recording duplicate AST |
754 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 754 // IDs for bailouts from optimized code. |
755 { AccumulatorValueContext for_object(this); | 755 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
756 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 756 { AccumulatorValueContext for_object(this); |
757 } | 757 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
758 if (function != NULL) { | 758 } |
759 __ push(result_register()); | |
760 VisitForAccumulatorValue(function); | |
761 __ mov(a0, result_register()); | |
762 __ pop(a2); | |
763 } else { | |
764 __ mov(a2, result_register()); | |
765 __ LoadRoot(a0, Heap::kTheHoleValueRootIndex); | |
766 } | |
767 ASSERT(prop->key()->AsLiteral() != NULL && | |
768 prop->key()->AsLiteral()->handle()->IsSmi()); | |
769 __ li(a1, Operand(prop->key()->AsLiteral()->handle())); | |
770 | 759 |
771 Handle<Code> ic = is_strict_mode() | 760 __ push(result_register()); |
772 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 761 VisitForAccumulatorValue(function); |
773 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 762 __ mov(a0, result_register()); |
774 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); | 763 __ pop(a2); |
775 // Value in v0 is ignored (declarations are statements). | 764 |
776 } | 765 ASSERT(prop->key()->AsLiteral() != NULL && |
| 766 prop->key()->AsLiteral()->handle()->IsSmi()); |
| 767 __ li(a1, Operand(prop->key()->AsLiteral()->handle())); |
| 768 |
| 769 Handle<Code> ic = is_strict_mode() |
| 770 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
| 771 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
| 772 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
| 773 // Value in v0 is ignored (declarations are statements). |
777 } | 774 } |
778 } | 775 } |
779 | 776 |
780 | 777 |
781 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 778 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
782 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 779 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
783 } | 780 } |
784 | 781 |
785 | 782 |
786 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 783 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
(...skipping 3581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4368 __ Addu(at, a1, Operand(masm_->CodeObject())); | 4365 __ Addu(at, a1, Operand(masm_->CodeObject())); |
4369 __ Jump(at); | 4366 __ Jump(at); |
4370 } | 4367 } |
4371 | 4368 |
4372 | 4369 |
4373 #undef __ | 4370 #undef __ |
4374 | 4371 |
4375 } } // namespace v8::internal | 4372 } } // namespace v8::internal |
4376 | 4373 |
4377 #endif // V8_TARGET_ARCH_MIPS | 4374 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |