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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 // eval-introduced variables. Eval is used a lot without | 1177 // eval-introduced variables. Eval is used a lot without |
1178 // introducing variables. In those cases, we do not want to | 1178 // introducing variables. In those cases, we do not want to |
1179 // perform a runtime call for all variables in the scope | 1179 // perform a runtime call for all variables in the scope |
1180 // containing the eval. | 1180 // containing the eval. |
1181 if (var->mode() == Variable::DYNAMIC_GLOBAL) { | 1181 if (var->mode() == Variable::DYNAMIC_GLOBAL) { |
1182 EmitLoadGlobalCheckExtensions(var, typeof_state, slow); | 1182 EmitLoadGlobalCheckExtensions(var, typeof_state, slow); |
1183 __ jmp(done); | 1183 __ jmp(done); |
1184 } else if (var->mode() == Variable::DYNAMIC_LOCAL) { | 1184 } else if (var->mode() == Variable::DYNAMIC_LOCAL) { |
1185 Variable* local = var->local_if_not_shadowed(); | 1185 Variable* local = var->local_if_not_shadowed(); |
1186 __ movq(rax, ContextSlotOperandCheckExtensions(local, slow)); | 1186 __ movq(rax, ContextSlotOperandCheckExtensions(local, slow)); |
1187 if (local->mode() == Variable::CONST) { | 1187 if (local->mode() == Variable::CONST || |
| 1188 local->mode() == Variable::LET) { |
1188 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); | 1189 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); |
1189 __ j(not_equal, done); | 1190 __ j(not_equal, done); |
1190 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 1191 if (local->mode() == Variable::CONST) { |
| 1192 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
| 1193 } else { // Variable::LET |
| 1194 __ Push(var->name()); |
| 1195 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 1196 } |
1191 } | 1197 } |
1192 __ jmp(done); | 1198 __ jmp(done); |
1193 } | 1199 } |
1194 } | 1200 } |
1195 | 1201 |
1196 | 1202 |
1197 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { | 1203 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
1198 // Record position before possible IC call. | 1204 // Record position before possible IC call. |
1199 SetSourcePosition(proxy->position()); | 1205 SetSourcePosition(proxy->position()); |
1200 Variable* var = proxy->var(); | 1206 Variable* var = proxy->var(); |
(...skipping 2995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4196 *context_length = 0; | 4202 *context_length = 0; |
4197 return previous_; | 4203 return previous_; |
4198 } | 4204 } |
4199 | 4205 |
4200 | 4206 |
4201 #undef __ | 4207 #undef __ |
4202 | 4208 |
4203 } } // namespace v8::internal | 4209 } } // namespace v8::internal |
4204 | 4210 |
4205 #endif // V8_TARGET_ARCH_X64 | 4211 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |