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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 // eval-introduced variables. Eval is used a lot without | 1200 // eval-introduced variables. Eval is used a lot without |
1201 // introducing variables. In those cases, we do not want to | 1201 // introducing variables. In those cases, we do not want to |
1202 // perform a runtime call for all variables in the scope | 1202 // perform a runtime call for all variables in the scope |
1203 // containing the eval. | 1203 // containing the eval. |
1204 if (var->mode() == Variable::DYNAMIC_GLOBAL) { | 1204 if (var->mode() == Variable::DYNAMIC_GLOBAL) { |
1205 EmitLoadGlobalCheckExtensions(var, typeof_state, slow); | 1205 EmitLoadGlobalCheckExtensions(var, typeof_state, slow); |
1206 __ jmp(done); | 1206 __ jmp(done); |
1207 } else if (var->mode() == Variable::DYNAMIC_LOCAL) { | 1207 } else if (var->mode() == Variable::DYNAMIC_LOCAL) { |
1208 Variable* local = var->local_if_not_shadowed(); | 1208 Variable* local = var->local_if_not_shadowed(); |
1209 __ mov(eax, ContextSlotOperandCheckExtensions(local, slow)); | 1209 __ mov(eax, ContextSlotOperandCheckExtensions(local, slow)); |
1210 if (local->mode() == Variable::CONST) { | 1210 if (local->mode() == Variable::CONST || |
| 1211 local->mode() == Variable::LET) { |
1211 __ cmp(eax, isolate()->factory()->the_hole_value()); | 1212 __ cmp(eax, isolate()->factory()->the_hole_value()); |
1212 __ j(not_equal, done); | 1213 __ j(not_equal, done); |
1213 __ mov(eax, isolate()->factory()->undefined_value()); | 1214 if (local->mode() == Variable::CONST) { |
| 1215 __ mov(eax, isolate()->factory()->undefined_value()); |
| 1216 } else { // Variable::LET |
| 1217 __ push(Immediate(var->name())); |
| 1218 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 1219 } |
1214 } | 1220 } |
1215 __ jmp(done); | 1221 __ jmp(done); |
1216 } | 1222 } |
1217 } | 1223 } |
1218 | 1224 |
1219 | 1225 |
1220 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { | 1226 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
1221 // Record position before possible IC call. | 1227 // Record position before possible IC call. |
1222 SetSourcePosition(proxy->position()); | 1228 SetSourcePosition(proxy->position()); |
1223 Variable* var = proxy->var(); | 1229 Variable* var = proxy->var(); |
(...skipping 3119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4343 *context_length = 0; | 4349 *context_length = 0; |
4344 return previous_; | 4350 return previous_; |
4345 } | 4351 } |
4346 | 4352 |
4347 | 4353 |
4348 #undef __ | 4354 #undef __ |
4349 | 4355 |
4350 } } // namespace v8::internal | 4356 } } // namespace v8::internal |
4351 | 4357 |
4352 #endif // V8_TARGET_ARCH_IA32 | 4358 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |