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 5309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5320 | 5320 |
5321 if (FLAG_harmony_scoping) { | 5321 if (FLAG_harmony_scoping) { |
5322 Handle<ScriptContextTable> script_contexts( | 5322 Handle<ScriptContextTable> script_contexts( |
5323 global->native_context()->script_context_table()); | 5323 global->native_context()->script_context_table()); |
5324 ScriptContextTable::LookupResult lookup; | 5324 ScriptContextTable::LookupResult lookup; |
5325 if (ScriptContextTable::Lookup(script_contexts, variable->name(), | 5325 if (ScriptContextTable::Lookup(script_contexts, variable->name(), |
5326 &lookup)) { | 5326 &lookup)) { |
5327 Handle<Context> script_context = ScriptContextTable::GetContext( | 5327 Handle<Context> script_context = ScriptContextTable::GetContext( |
5328 script_contexts, lookup.context_index); | 5328 script_contexts, lookup.context_index); |
5329 Handle<Object> current_value = | 5329 Handle<Object> current_value = |
5330 FixedArray::get(script_context, lookup.context_index); | 5330 FixedArray::get(script_context, lookup.slot_index); |
5331 | 5331 |
5332 // If the values is not the hole, it will stay initialized, | 5332 // If the values is not the hole, it will stay initialized, |
5333 // so no need to generate a check. | 5333 // so no need to generate a check. |
5334 if (*current_value == *isolate()->factory()->the_hole_value()) { | 5334 if (*current_value == *isolate()->factory()->the_hole_value()) { |
5335 return Bailout(kReferenceToUninitializedVariable); | 5335 return Bailout(kReferenceToUninitializedVariable); |
5336 } | 5336 } |
5337 HInstruction* result = New<HLoadNamedField>( | 5337 HInstruction* result = New<HLoadNamedField>( |
5338 Add<HConstant>(script_context), nullptr, | 5338 Add<HConstant>(script_context), nullptr, |
5339 HObjectAccess::ForContextSlot(lookup.slot_index)); | 5339 HObjectAccess::ForContextSlot(lookup.slot_index)); |
5340 return ast_context()->ReturnInstruction(result, expr->id()); | 5340 return ast_context()->ReturnInstruction(result, expr->id()); |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6481 if (FLAG_harmony_scoping) { | 6481 if (FLAG_harmony_scoping) { |
6482 Handle<ScriptContextTable> script_contexts( | 6482 Handle<ScriptContextTable> script_contexts( |
6483 global->native_context()->script_context_table()); | 6483 global->native_context()->script_context_table()); |
6484 ScriptContextTable::LookupResult lookup; | 6484 ScriptContextTable::LookupResult lookup; |
6485 if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) { | 6485 if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) { |
6486 if (lookup.mode == CONST) { | 6486 if (lookup.mode == CONST) { |
6487 return Bailout(kNonInitializerAssignmentToConst); | 6487 return Bailout(kNonInitializerAssignmentToConst); |
6488 } | 6488 } |
6489 Handle<Context> script_context = | 6489 Handle<Context> script_context = |
6490 ScriptContextTable::GetContext(script_contexts, lookup.context_index); | 6490 ScriptContextTable::GetContext(script_contexts, lookup.context_index); |
| 6491 |
| 6492 Handle<Object> current_value = |
| 6493 FixedArray::get(script_context, lookup.slot_index); |
| 6494 |
| 6495 // If the values is not the hole, it will stay initialized, |
| 6496 // so no need to generate a check. |
| 6497 if (*current_value == *isolate()->factory()->the_hole_value()) { |
| 6498 return Bailout(kReferenceToUninitializedVariable); |
| 6499 } |
| 6500 |
6491 HStoreNamedField* instr = Add<HStoreNamedField>( | 6501 HStoreNamedField* instr = Add<HStoreNamedField>( |
6492 Add<HConstant>(script_context), | 6502 Add<HConstant>(script_context), |
6493 HObjectAccess::ForContextSlot(lookup.slot_index), value); | 6503 HObjectAccess::ForContextSlot(lookup.slot_index), value); |
6494 USE(instr); | 6504 USE(instr); |
6495 DCHECK(instr->HasObservableSideEffects()); | 6505 DCHECK(instr->HasObservableSideEffects()); |
6496 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6506 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
6497 return; | 6507 return; |
6498 } | 6508 } |
6499 } | 6509 } |
6500 | 6510 |
(...skipping 6877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13378 if (ShouldProduceTraceOutput()) { | 13388 if (ShouldProduceTraceOutput()) { |
13379 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13389 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13380 } | 13390 } |
13381 | 13391 |
13382 #ifdef DEBUG | 13392 #ifdef DEBUG |
13383 graph_->Verify(false); // No full verify. | 13393 graph_->Verify(false); // No full verify. |
13384 #endif | 13394 #endif |
13385 } | 13395 } |
13386 | 13396 |
13387 } } // namespace v8::internal | 13397 } } // namespace v8::internal |
OLD | NEW |