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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 | 680 |
681 | 681 |
682 void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy, | 682 void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy, |
683 VariableMode mode, | 683 VariableMode mode, |
684 FunctionLiteral* function, | 684 FunctionLiteral* function, |
685 int* global_count) { | 685 int* global_count) { |
686 // If it was not possible to allocate the variable at compile time, we | 686 // If it was not possible to allocate the variable at compile time, we |
687 // need to "declare" it at runtime to make sure it actually exists in the | 687 // need to "declare" it at runtime to make sure it actually exists in the |
688 // local context. | 688 // local context. |
689 Variable* variable = proxy->var(); | 689 Variable* variable = proxy->var(); |
690 bool binding_needs_init = | 690 bool binding_needs_init = (function == NULL) && |
691 mode == CONST || mode == CONST_HARMONY || mode == LET; | 691 (mode == CONST || mode == CONST_HARMONY || mode == LET); |
692 switch (variable->location()) { | 692 switch (variable->location()) { |
693 case Variable::UNALLOCATED: | 693 case Variable::UNALLOCATED: |
694 ++(*global_count); | 694 ++(*global_count); |
695 break; | 695 break; |
696 | 696 |
697 case Variable::PARAMETER: | 697 case Variable::PARAMETER: |
698 case Variable::LOCAL: | 698 case Variable::LOCAL: |
699 if (function != NULL) { | 699 if (function != NULL) { |
700 Comment cmnt(masm_, "[ Declaration"); | 700 Comment cmnt(masm_, "[ Declaration"); |
701 VisitForAccumulatorValue(function); | 701 VisitForAccumulatorValue(function); |
(...skipping 3552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4254 *context_length = 0; | 4254 *context_length = 0; |
4255 return previous_; | 4255 return previous_; |
4256 } | 4256 } |
4257 | 4257 |
4258 | 4258 |
4259 #undef __ | 4259 #undef __ |
4260 | 4260 |
4261 } } // namespace v8::internal | 4261 } } // namespace v8::internal |
4262 | 4262 |
4263 #endif // V8_TARGET_ARCH_X64 | 4263 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |