| 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 VisitForStackValue(function); | 704 VisitForStackValue(function); |
| 705 } else { | 705 } else { |
| 706 __ push(Immediate(Smi::FromInt(0))); // No initial value! | 706 __ push(Immediate(Smi::FromInt(0))); // No initial value! |
| 707 } | 707 } |
| 708 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 708 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
| 709 break; | 709 break; |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| 713 } else if (prop != NULL) { | 713 } else if (prop != NULL) { |
| 714 if (function != NULL || mode == Variable::CONST) { | 714 ASSERT(mode != Variable::CONST); |
| 715 // We are declaring a function or constant that rewrites to a | 715 ASSERT(function != NULL); |
| 716 // property. Use (keyed) IC to set the initial value. We cannot | 716 // We are declaring a function that rewrites to a property. |
| 717 // visit the rewrite because it's shared and we risk recording | 717 // Use (keyed) IC to set the initial value. We cannot visit the |
| 718 // duplicate AST IDs for bailouts from optimized code. | 718 // rewrite because it's shared and we risk recording duplicate AST |
| 719 ASSERT(prop->obj()->AsVariableProxy() != NULL); | 719 // IDs for bailouts from optimized code. |
| 720 { AccumulatorValueContext for_object(this); | 720 ASSERT(prop->obj()->AsVariableProxy() != NULL); |
| 721 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 721 { AccumulatorValueContext for_object(this); |
| 722 } | 722 EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); |
| 723 } |
| 723 | 724 |
| 724 if (function != NULL) { | 725 __ push(eax); |
| 725 __ push(eax); | 726 VisitForAccumulatorValue(function); |
| 726 VisitForAccumulatorValue(function); | 727 __ pop(edx); |
| 727 __ pop(edx); | |
| 728 } else { | |
| 729 __ mov(edx, eax); | |
| 730 __ mov(eax, isolate()->factory()->the_hole_value()); | |
| 731 } | |
| 732 ASSERT(prop->key()->AsLiteral() != NULL && | |
| 733 prop->key()->AsLiteral()->handle()->IsSmi()); | |
| 734 __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle())); | |
| 735 | 728 |
| 736 Handle<Code> ic = is_strict_mode() | 729 ASSERT(prop->key()->AsLiteral() != NULL && |
| 737 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 730 prop->key()->AsLiteral()->handle()->IsSmi()); |
| 738 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 731 __ SafeSet(ecx, Immediate(prop->key()->AsLiteral()->handle())); |
| 739 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); | 732 |
| 740 } | 733 Handle<Code> ic = is_strict_mode() |
| 734 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
| 735 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
| 736 EmitCallIC(ic, RelocInfo::CODE_TARGET, AstNode::kNoNumber); |
| 741 } | 737 } |
| 742 } | 738 } |
| 743 | 739 |
| 744 | 740 |
| 745 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 741 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
| 746 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 742 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); |
| 747 } | 743 } |
| 748 | 744 |
| 749 | 745 |
| 750 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 746 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
| (...skipping 3563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4314 // And return. | 4310 // And return. |
| 4315 __ ret(0); | 4311 __ ret(0); |
| 4316 } | 4312 } |
| 4317 | 4313 |
| 4318 | 4314 |
| 4319 #undef __ | 4315 #undef __ |
| 4320 | 4316 |
| 4321 } } // namespace v8::internal | 4317 } } // namespace v8::internal |
| 4322 | 4318 |
| 4323 #endif // V8_TARGET_ARCH_IA32 | 4319 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |