Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 7d2939bc250e68c02e7ba7d072383e8fc86d1202..a780b66cae6fe131dc20157e92ceabf02b7e839f 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -5343,6 +5343,25 @@ HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, |
| HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField( |
| PropertyAccessInfo* info, |
| HValue* checked_object) { |
| + // See if this is a load for an immutable property |
| + if (checked_object->ActualValue()->IsConstant() && |
| + info->lookup()->IsCacheable() && |
| + info->lookup()->IsReadOnly() && info->lookup()->IsDontDelete()) { |
| + Handle<Object> object( |
| + HConstant::cast(checked_object->ActualValue())->handle(isolate())); |
| + |
| + if (object->IsJSObject()) { |
| + Handle<Object> value(isolate()->heap()->the_hole_value(), isolate()); |
|
Toon Verwaest
2014/04/10 11:58:31
Why do you pre-declare value to the hole rather th
p.antonov
2014/04/11 12:09:37
Done.
|
| + LookupResult lookup(isolate()); |
| + Handle<JSObject>::cast(object)->Lookup(*info->name(), &lookup); |
| + value = handle(lookup.GetLazyValue(), isolate()); |
| + |
| + if (!value->IsTheHole()) { |
| + return New<HConstant>(value); |
| + } |
| + } |
| + } |
| + |
| HObjectAccess access = info->access(); |
| if (access.representation().IsDouble()) { |
| // Load the heap number. |