OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 // If it was not possible to allocate the variable at compile time, we | 761 // If it was not possible to allocate the variable at compile time, we |
762 // need to "declare" it at runtime to make sure it actually exists in the | 762 // need to "declare" it at runtime to make sure it actually exists in the |
763 // local context. | 763 // local context. |
764 VariableProxy* proxy = declaration->proxy(); | 764 VariableProxy* proxy = declaration->proxy(); |
765 VariableMode mode = declaration->mode(); | 765 VariableMode mode = declaration->mode(); |
766 Variable* variable = proxy->var(); | 766 Variable* variable = proxy->var(); |
767 bool hole_init = mode == LET || mode == CONST; | 767 bool hole_init = mode == LET || mode == CONST; |
768 switch (variable->location()) { | 768 switch (variable->location()) { |
769 case VariableLocation::GLOBAL: | 769 case VariableLocation::GLOBAL: |
770 case VariableLocation::UNALLOCATED: | 770 case VariableLocation::UNALLOCATED: |
| 771 DCHECK(!variable->binding_needs_init()); |
771 globals_->Add(variable->name(), zone()); | 772 globals_->Add(variable->name(), zone()); |
772 globals_->Add(variable->binding_needs_init() | 773 globals_->Add(isolate()->factory()->undefined_value(), zone()); |
773 ? isolate()->factory()->the_hole_value() | |
774 : isolate()->factory()->undefined_value(), | |
775 zone()); | |
776 break; | 774 break; |
777 | 775 |
778 case VariableLocation::PARAMETER: | 776 case VariableLocation::PARAMETER: |
779 case VariableLocation::LOCAL: | 777 case VariableLocation::LOCAL: |
780 if (hole_init) { | 778 if (hole_init) { |
781 Comment cmnt(masm_, "[ VariableDeclaration"); | 779 Comment cmnt(masm_, "[ VariableDeclaration"); |
782 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); | 780 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex); |
783 __ str(r0, StackOperand(variable)); | 781 __ str(r0, StackOperand(variable)); |
784 } | 782 } |
785 break; | 783 break; |
(...skipping 3204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3990 DCHECK(interrupt_address == | 3988 DCHECK(interrupt_address == |
3991 isolate->builtins()->OnStackReplacement()->entry()); | 3989 isolate->builtins()->OnStackReplacement()->entry()); |
3992 return ON_STACK_REPLACEMENT; | 3990 return ON_STACK_REPLACEMENT; |
3993 } | 3991 } |
3994 | 3992 |
3995 | 3993 |
3996 } // namespace internal | 3994 } // namespace internal |
3997 } // namespace v8 | 3995 } // namespace v8 |
3998 | 3996 |
3999 #endif // V8_TARGET_ARCH_ARM | 3997 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |