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 | 707 |
708 | 708 |
709 void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy, | 709 void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy, |
710 VariableMode mode, | 710 VariableMode mode, |
711 FunctionLiteral* function, | 711 FunctionLiteral* function, |
712 int* global_count) { | 712 int* global_count) { |
713 // If it was not possible to allocate the variable at compile time, we | 713 // If it was not possible to allocate the variable at compile time, we |
714 // need to "declare" it at runtime to make sure it actually exists in the | 714 // need to "declare" it at runtime to make sure it actually exists in the |
715 // local context. | 715 // local context. |
716 Variable* variable = proxy->var(); | 716 Variable* variable = proxy->var(); |
717 bool binding_needs_init = | 717 bool binding_needs_init = (function == NULL) && |
718 mode == CONST || mode == CONST_HARMONY || mode == LET; | 718 (mode == CONST || mode == CONST_HARMONY || mode == LET); |
719 switch (variable->location()) { | 719 switch (variable->location()) { |
720 case Variable::UNALLOCATED: | 720 case Variable::UNALLOCATED: |
721 ++(*global_count); | 721 ++(*global_count); |
722 break; | 722 break; |
723 | 723 |
724 case Variable::PARAMETER: | 724 case Variable::PARAMETER: |
725 case Variable::LOCAL: | 725 case Variable::LOCAL: |
726 if (function != NULL) { | 726 if (function != NULL) { |
727 Comment cmnt(masm_, "[ Declaration"); | 727 Comment cmnt(masm_, "[ Declaration"); |
728 VisitForAccumulatorValue(function); | 728 VisitForAccumulatorValue(function); |
(...skipping 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4404 *context_length = 0; | 4404 *context_length = 0; |
4405 return previous_; | 4405 return previous_; |
4406 } | 4406 } |
4407 | 4407 |
4408 | 4408 |
4409 #undef __ | 4409 #undef __ |
4410 | 4410 |
4411 } } // namespace v8::internal | 4411 } } // namespace v8::internal |
4412 | 4412 |
4413 #endif // V8_TARGET_ARCH_IA32 | 4413 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |