Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: src/hydrogen.cc

Issue 696783005: harmony-scoping: Implement LoadIC handler for loads from global contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback + rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/contexts.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (FLAG_harmony_scoping) {
5381 Handle<GlobalContextTable> global_contexts(
5382 global->native_context()->global_context_table());
5383 GlobalContextTable::LookupResult lookup;
5384 if (GlobalContextTable::Lookup(global_contexts, variable->name(),
5385 &lookup)) {
5386 Handle<Context> global_context = GlobalContextTable::GetContext(
5387 global_contexts, lookup.context_index);
5388 HInstruction* result = New<HLoadNamedField>(
5389 Add<HConstant>(global_context), static_cast<HValue*>(NULL),
5390 HObjectAccess::ForContextSlot(lookup.slot_index));
5391 return ast_context()->ReturnInstruction(result, expr->id());
5392 }
5393 }
5394
5379 LookupIterator it(global, variable->name(), 5395 LookupIterator it(global, variable->name(),
5380 LookupIterator::OWN_SKIP_INTERCEPTOR); 5396 LookupIterator::OWN_SKIP_INTERCEPTOR);
5381 GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); 5397 GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD);
5382 5398
5383 if (type == kUseCell) { 5399 if (type == kUseCell) {
5384 Handle<PropertyCell> cell = it.GetPropertyCell(); 5400 Handle<PropertyCell> cell = it.GetPropertyCell();
5385 if (cell->type()->IsConstant()) { 5401 if (cell->type()->IsConstant()) {
5386 PropertyCell::AddDependentCompilationInfo(cell, top_info()); 5402 PropertyCell::AddDependentCompilationInfo(cell, top_info());
5387 Handle<Object> constant_object = cell->type()->AsConstant()->Value(); 5403 Handle<Object> constant_object = cell->type()->AsConstant()->Value();
5388 if (constant_object->IsConsString()) { 5404 if (constant_object->IsConsString()) {
(...skipping 7296 matching lines...) Expand 10 before | Expand all | Expand 10 after
12685 if (ShouldProduceTraceOutput()) { 12701 if (ShouldProduceTraceOutput()) {
12686 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12702 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12687 } 12703 }
12688 12704
12689 #ifdef DEBUG 12705 #ifdef DEBUG
12690 graph_->Verify(false); // No full verify. 12706 graph_->Verify(false); // No full verify.
12691 #endif 12707 #endif
12692 } 12708 }
12693 12709
12694 } } // namespace v8::internal 12710 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698