OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5334 HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, | 5334 HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, |
5335 Handle<Map> map) { | 5335 Handle<Map> map) { |
5336 BuildCheckHeapObject(object); | 5336 BuildCheckHeapObject(object); |
5337 return Add<HCheckMaps>(object, map, top_info()); | 5337 return Add<HCheckMaps>(object, map, top_info()); |
5338 } | 5338 } |
5339 | 5339 |
5340 | 5340 |
5341 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField( | 5341 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField( |
5342 PropertyAccessInfo* info, | 5342 PropertyAccessInfo* info, |
5343 HValue* checked_object) { | 5343 HValue* checked_object) { |
| 5344 // See if this is a load for an immutable property |
| 5345 if (checked_object->ActualValue()->IsConstant() && |
| 5346 info->lookup()->IsCacheable() && |
| 5347 info->lookup()->IsReadOnly() && info->lookup()->IsDontDelete()) { |
| 5348 Handle<Object> object( |
| 5349 HConstant::cast(checked_object->ActualValue())->handle(isolate())); |
| 5350 |
| 5351 if (object->IsJSObject()) { |
| 5352 LookupResult lookup(isolate()); |
| 5353 Handle<JSObject>::cast(object)->Lookup(*info->name(), &lookup); |
| 5354 Handle<Object> value(lookup.GetLazyValue(), isolate()); |
| 5355 |
| 5356 if (!value->IsTheHole()) { |
| 5357 return New<HConstant>(value); |
| 5358 } |
| 5359 } |
| 5360 } |
| 5361 |
5344 HObjectAccess access = info->access(); | 5362 HObjectAccess access = info->access(); |
5345 if (access.representation().IsDouble()) { | 5363 if (access.representation().IsDouble()) { |
5346 // Load the heap number. | 5364 // Load the heap number. |
5347 checked_object = Add<HLoadNamedField>( | 5365 checked_object = Add<HLoadNamedField>( |
5348 checked_object, static_cast<HValue*>(NULL), | 5366 checked_object, static_cast<HValue*>(NULL), |
5349 access.WithRepresentation(Representation::Tagged())); | 5367 access.WithRepresentation(Representation::Tagged())); |
5350 checked_object->set_type(HType::HeapNumber()); | 5368 checked_object->set_type(HType::HeapNumber()); |
5351 // Load the double value from it. | 5369 // Load the double value from it. |
5352 access = HObjectAccess::ForHeapNumberValue(); | 5370 access = HObjectAccess::ForHeapNumberValue(); |
5353 } | 5371 } |
(...skipping 6170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11524 if (ShouldProduceTraceOutput()) { | 11542 if (ShouldProduceTraceOutput()) { |
11525 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11543 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11526 } | 11544 } |
11527 | 11545 |
11528 #ifdef DEBUG | 11546 #ifdef DEBUG |
11529 graph_->Verify(false); // No full verify. | 11547 graph_->Verify(false); // No full verify. |
11530 #endif | 11548 #endif |
11531 } | 11549 } |
11532 | 11550 |
11533 } } // namespace v8::internal | 11551 } } // namespace v8::internal |
OLD | NEW |