OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 5364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5375 Handle<GlobalObject> global(current_info()->global_object()); | 5375 Handle<GlobalObject> global(current_info()->global_object()); |
5376 | 5376 |
5377 if (FLAG_harmony_scoping) { | 5377 if (FLAG_harmony_scoping) { |
5378 Handle<ScriptContextTable> script_contexts( | 5378 Handle<ScriptContextTable> script_contexts( |
5379 global->native_context()->script_context_table()); | 5379 global->native_context()->script_context_table()); |
5380 ScriptContextTable::LookupResult lookup; | 5380 ScriptContextTable::LookupResult lookup; |
5381 if (ScriptContextTable::Lookup(script_contexts, variable->name(), | 5381 if (ScriptContextTable::Lookup(script_contexts, variable->name(), |
5382 &lookup)) { | 5382 &lookup)) { |
5383 Handle<Context> script_context = ScriptContextTable::GetContext( | 5383 Handle<Context> script_context = ScriptContextTable::GetContext( |
5384 script_contexts, lookup.context_index); | 5384 script_contexts, lookup.context_index); |
| 5385 Handle<Object> current_value = |
| 5386 FixedArray::get(script_context, lookup.context_index); |
| 5387 |
| 5388 // If the values is not the hole, it will stay initialized, |
| 5389 // so no need to generate a check. |
| 5390 if (*current_value == *isolate()->factory()->the_hole_value()) { |
| 5391 return Bailout(kReferenceToUninitializedVariable); |
| 5392 } |
5385 HInstruction* result = New<HLoadNamedField>( | 5393 HInstruction* result = New<HLoadNamedField>( |
5386 Add<HConstant>(script_context), nullptr, | 5394 Add<HConstant>(script_context), nullptr, |
5387 HObjectAccess::ForContextSlot(lookup.slot_index)); | 5395 HObjectAccess::ForContextSlot(lookup.slot_index)); |
5388 return ast_context()->ReturnInstruction(result, expr->id()); | 5396 return ast_context()->ReturnInstruction(result, expr->id()); |
5389 } | 5397 } |
5390 } | 5398 } |
5391 | 5399 |
5392 LookupIterator it(global, variable->name(), | 5400 LookupIterator it(global, variable->name(), |
5393 LookupIterator::OWN_SKIP_INTERCEPTOR); | 5401 LookupIterator::OWN_SKIP_INTERCEPTOR); |
5394 GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); | 5402 GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); |
(...skipping 8093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13488 if (ShouldProduceTraceOutput()) { | 13496 if (ShouldProduceTraceOutput()) { |
13489 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13497 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13490 } | 13498 } |
13491 | 13499 |
13492 #ifdef DEBUG | 13500 #ifdef DEBUG |
13493 graph_->Verify(false); // No full verify. | 13501 graph_->Verify(false); // No full verify. |
13494 #endif | 13502 #endif |
13495 } | 13503 } |
13496 | 13504 |
13497 } } // namespace v8::internal | 13505 } } // namespace v8::internal |
OLD | NEW |