Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index d5adca6c97b269bbc572b9b06588c03a254f965c..6096c248970e2e0b0f1950cd8ae238f1b62b7d99 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -5286,16 +5286,14 @@ void HOptimizedGraphBuilder::VisitConditional(Conditional* expr) { |
HOptimizedGraphBuilder::GlobalPropertyAccess |
- HOptimizedGraphBuilder::LookupGlobalProperty( |
- Variable* var, LookupResult* lookup, PropertyAccessType access_type) { |
+HOptimizedGraphBuilder::LookupGlobalProperty(Variable* var, LookupIterator* it, |
+ PropertyAccessType access_type) { |
+ DCHECK_EQ(*var->name(), *it->name()); |
if (var->is_this() || !current_info()->has_global_object()) { |
return kUseGeneric; |
} |
- Handle<GlobalObject> global(current_info()->global_object()); |
- global->Lookup(var->name(), lookup); |
- if (!lookup->IsNormal() || |
- (access_type == STORE && lookup->IsReadOnly()) || |
- lookup->holder() != *global) { |
+ if (!it->HasProperty() || it->property_kind() != LookupIterator::DATA || |
+ (access_type == STORE && it->IsReadOnly())) { |
return kUseGeneric; |
} |
@@ -5340,8 +5338,10 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) { |
return ast_context()->ReturnInstruction(instr, expr->id()); |
} |
- LookupResult lookup(isolate()); |
- GlobalPropertyAccess type = LookupGlobalProperty(variable, &lookup, LOAD); |
+ Handle<GlobalObject> global(current_info()->global_object()); |
+ LookupIterator it(global, variable->name(), |
+ LookupIterator::CHECK_PROPERTY); |
+ GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); |
if (type == kUseCell && |
current_info()->global_object()->IsAccessCheckNeeded()) { |
@@ -5349,8 +5349,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) { |
} |
if (type == kUseCell) { |
- Handle<GlobalObject> global(current_info()->global_object()); |
- Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); |
+ Handle<PropertyCell> cell = it.GetPropertyCell(); |
if (cell->type()->IsConstant()) { |
PropertyCell::AddDependentCompilationInfo(cell, top_info()); |
Handle<Object> constant_object = cell->type()->AsConstant()->Value(); |
@@ -5362,7 +5361,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) { |
return ast_context()->ReturnInstruction(constant, expr->id()); |
} else { |
HLoadGlobalCell* instr = |
- New<HLoadGlobalCell>(cell, lookup.GetPropertyDetails()); |
+ New<HLoadGlobalCell>(cell, it.property_details()); |
return ast_context()->ReturnInstruction(instr, expr->id()); |
} |
} else { |
@@ -6456,11 +6455,11 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( |
Variable* var, |
HValue* value, |
BailoutId ast_id) { |
- LookupResult lookup(isolate()); |
- GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, STORE); |
+ Handle<GlobalObject> global(current_info()->global_object()); |
+ LookupIterator it(global, var->name(), LookupIterator::CHECK_PROPERTY); |
+ GlobalPropertyAccess type = LookupGlobalProperty(var, &it, STORE); |
if (type == kUseCell) { |
- Handle<GlobalObject> global(current_info()->global_object()); |
- Handle<PropertyCell> cell(global->GetPropertyCell(&lookup)); |
+ Handle<PropertyCell> cell = it.GetPropertyCell(); |
if (cell->type()->IsConstant()) { |
Handle<Object> constant = cell->type()->AsConstant()->Value(); |
if (value->IsConstant()) { |
@@ -6485,7 +6484,7 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( |
} |
} |
HInstruction* instr = |
- Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails()); |
+ Add<HStoreGlobalCell>(value, cell, it.property_details()); |
if (instr->HasObservableSideEffects()) { |
Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
} |
@@ -9049,12 +9048,13 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { |
// If there is a global property cell for the name at compile time and |
// access check is not enabled we assume that the function will not change |
// and generate optimized code for calling the function. |
- LookupResult lookup(isolate()); |
- GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, LOAD); |
+ Handle<GlobalObject> global(current_info()->global_object()); |
+ LookupIterator it(global, var->name(), LookupIterator::CHECK_PROPERTY); |
+ GlobalPropertyAccess type = LookupGlobalProperty(var, &it, LOAD); |
if (type == kUseCell && |
!current_info()->global_object()->IsAccessCheckNeeded()) { |
Handle<GlobalObject> global(current_info()->global_object()); |
- known_global_function = expr->ComputeGlobalTarget(global, &lookup); |
+ known_global_function = expr->ComputeGlobalTarget(global, &it); |
} |
if (known_global_function) { |
Add<HCheckValue>(function, expr->target()); |