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 6504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6515 | 6515 |
6516 | 6516 |
6517 // Because not every expression has a position and there is not common | 6517 // Because not every expression has a position and there is not common |
6518 // superclass of Assignment and CountOperation, we cannot just pass the | 6518 // superclass of Assignment and CountOperation, we cannot just pass the |
6519 // owning expression instead of position and ast_id separately. | 6519 // owning expression instead of position and ast_id separately. |
6520 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( | 6520 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( |
6521 Variable* var, | 6521 Variable* var, |
6522 HValue* value, | 6522 HValue* value, |
6523 BailoutId ast_id) { | 6523 BailoutId ast_id) { |
6524 Handle<GlobalObject> global(current_info()->global_object()); | 6524 Handle<GlobalObject> global(current_info()->global_object()); |
| 6525 |
| 6526 if (FLAG_harmony_scoping) { |
| 6527 Handle<GlobalContextTable> global_contexts( |
| 6528 global->native_context()->global_context_table()); |
| 6529 GlobalContextTable::LookupResult lookup; |
| 6530 if (GlobalContextTable::Lookup(global_contexts, var->name(), &lookup)) { |
| 6531 Handle<Context> global_context = |
| 6532 GlobalContextTable::GetContext(global_contexts, lookup.context_index); |
| 6533 HStoreNamedField* instr = Add<HStoreNamedField>( |
| 6534 Add<HConstant>(global_context), |
| 6535 HObjectAccess::ForContextSlot(lookup.slot_index), value); |
| 6536 USE(instr); |
| 6537 DCHECK(instr->HasObservableSideEffects()); |
| 6538 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 6539 return; |
| 6540 } |
| 6541 } |
| 6542 |
6525 LookupIterator it(global, var->name(), LookupIterator::OWN_SKIP_INTERCEPTOR); | 6543 LookupIterator it(global, var->name(), LookupIterator::OWN_SKIP_INTERCEPTOR); |
6526 GlobalPropertyAccess type = LookupGlobalProperty(var, &it, STORE); | 6544 GlobalPropertyAccess type = LookupGlobalProperty(var, &it, STORE); |
6527 if (type == kUseCell) { | 6545 if (type == kUseCell) { |
6528 Handle<PropertyCell> cell = it.GetPropertyCell(); | 6546 Handle<PropertyCell> cell = it.GetPropertyCell(); |
6529 if (cell->type()->IsConstant()) { | 6547 if (cell->type()->IsConstant()) { |
6530 Handle<Object> constant = cell->type()->AsConstant()->Value(); | 6548 Handle<Object> constant = cell->type()->AsConstant()->Value(); |
6531 if (value->IsConstant()) { | 6549 if (value->IsConstant()) { |
6532 HConstant* c_value = HConstant::cast(value); | 6550 HConstant* c_value = HConstant::cast(value); |
6533 if (!constant.is_identical_to(c_value->handle(isolate()))) { | 6551 if (!constant.is_identical_to(c_value->handle(isolate()))) { |
6534 Add<HDeoptimize>("Constant global variable assignment", | 6552 Add<HDeoptimize>("Constant global variable assignment", |
(...skipping 6166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12701 if (ShouldProduceTraceOutput()) { | 12719 if (ShouldProduceTraceOutput()) { |
12702 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12720 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12703 } | 12721 } |
12704 | 12722 |
12705 #ifdef DEBUG | 12723 #ifdef DEBUG |
12706 graph_->Verify(false); // No full verify. | 12724 graph_->Verify(false); // No full verify. |
12707 #endif | 12725 #endif |
12708 } | 12726 } |
12709 | 12727 |
12710 } } // namespace v8::internal | 12728 } } // namespace v8::internal |
OLD | NEW |