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 5358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5369 // Handle known global constants like 'undefined' specially to avoid a | 5369 // Handle known global constants like 'undefined' specially to avoid a |
5370 // load from a global cell for them. | 5370 // load from a global cell for them. |
5371 Handle<Object> constant_value = | 5371 Handle<Object> constant_value = |
5372 isolate()->factory()->GlobalConstantFor(variable->name()); | 5372 isolate()->factory()->GlobalConstantFor(variable->name()); |
5373 if (!constant_value.is_null()) { | 5373 if (!constant_value.is_null()) { |
5374 HConstant* instr = New<HConstant>(constant_value); | 5374 HConstant* instr = New<HConstant>(constant_value); |
5375 return ast_context()->ReturnInstruction(instr, expr->id()); | 5375 return ast_context()->ReturnInstruction(instr, expr->id()); |
5376 } | 5376 } |
5377 | 5377 |
5378 Handle<GlobalObject> global(current_info()->global_object()); | 5378 Handle<GlobalObject> global(current_info()->global_object()); |
| 5379 |
| 5380 Handle<GlobalContextTable> global_contexts( |
| 5381 global->native_context()->global_context_table()); |
| 5382 GlobalContextTable::LookupResult lookup; |
| 5383 if (GlobalContextTable::Lookup(global_contexts, variable->name(), |
| 5384 &lookup)) { |
| 5385 Handle<Context> global_context = GlobalContextTable::GetContext( |
| 5386 global_contexts, lookup.context_index); |
| 5387 HInstruction* result = New<HLoadNamedField>( |
| 5388 Add<HConstant>(global_context), static_cast<HValue*>(NULL), |
| 5389 HObjectAccess::ForContextSlot(lookup.slot_index)); |
| 5390 return ast_context()->ReturnInstruction(result, expr->id()); |
| 5391 } |
| 5392 |
5379 LookupIterator it(global, variable->name(), | 5393 LookupIterator it(global, variable->name(), |
5380 LookupIterator::OWN_SKIP_INTERCEPTOR); | 5394 LookupIterator::OWN_SKIP_INTERCEPTOR); |
5381 GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); | 5395 GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); |
5382 | 5396 |
5383 if (type == kUseCell) { | 5397 if (type == kUseCell) { |
5384 Handle<PropertyCell> cell = it.GetPropertyCell(); | 5398 Handle<PropertyCell> cell = it.GetPropertyCell(); |
5385 if (cell->type()->IsConstant()) { | 5399 if (cell->type()->IsConstant()) { |
5386 PropertyCell::AddDependentCompilationInfo(cell, top_info()); | 5400 PropertyCell::AddDependentCompilationInfo(cell, top_info()); |
5387 Handle<Object> constant_object = cell->type()->AsConstant()->Value(); | 5401 Handle<Object> constant_object = cell->type()->AsConstant()->Value(); |
5388 if (constant_object->IsConsString()) { | 5402 if (constant_object->IsConsString()) { |
(...skipping 7283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12672 if (ShouldProduceTraceOutput()) { | 12686 if (ShouldProduceTraceOutput()) { |
12673 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12687 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12674 } | 12688 } |
12675 | 12689 |
12676 #ifdef DEBUG | 12690 #ifdef DEBUG |
12677 graph_->Verify(false); // No full verify. | 12691 graph_->Verify(false); // No full verify. |
12678 #endif | 12692 #endif |
12679 } | 12693 } |
12680 | 12694 |
12681 } } // namespace v8::internal | 12695 } } // namespace v8::internal |
OLD | NEW |