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 5325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5336 HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, | 5336 HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, |
5337 Handle<Map> map) { | 5337 Handle<Map> map) { |
5338 BuildCheckHeapObject(object); | 5338 BuildCheckHeapObject(object); |
5339 return Add<HCheckMaps>(object, map, top_info()); | 5339 return Add<HCheckMaps>(object, map, top_info()); |
5340 } | 5340 } |
5341 | 5341 |
5342 | 5342 |
5343 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField( | 5343 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField( |
5344 PropertyAccessInfo* info, | 5344 PropertyAccessInfo* info, |
5345 HValue* checked_object) { | 5345 HValue* checked_object) { |
5346 // See if this is a load for an immutable property | |
5347 if (checked_object->ActualValue()->IsConstant() && | |
5348 info->lookup()->IsCacheable() && | |
5349 info->lookup()->IsReadOnly() && info->lookup()->IsDontDelete()) { | |
5350 Handle<Object> object( | |
5351 HConstant::cast(checked_object->ActualValue())->handle(isolate())); | |
5352 | |
5353 if (object->IsJSObject()) { | |
5354 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.
| |
5355 LookupResult lookup(isolate()); | |
5356 Handle<JSObject>::cast(object)->Lookup(*info->name(), &lookup); | |
5357 value = handle(lookup.GetLazyValue(), isolate()); | |
5358 | |
5359 if (!value->IsTheHole()) { | |
5360 return New<HConstant>(value); | |
5361 } | |
5362 } | |
5363 } | |
5364 | |
5346 HObjectAccess access = info->access(); | 5365 HObjectAccess access = info->access(); |
5347 if (access.representation().IsDouble()) { | 5366 if (access.representation().IsDouble()) { |
5348 // Load the heap number. | 5367 // Load the heap number. |
5349 checked_object = Add<HLoadNamedField>( | 5368 checked_object = Add<HLoadNamedField>( |
5350 checked_object, static_cast<HValue*>(NULL), | 5369 checked_object, static_cast<HValue*>(NULL), |
5351 access.WithRepresentation(Representation::Tagged())); | 5370 access.WithRepresentation(Representation::Tagged())); |
5352 checked_object->set_type(HType::HeapNumber()); | 5371 checked_object->set_type(HType::HeapNumber()); |
5353 // Load the double value from it. | 5372 // Load the double value from it. |
5354 access = HObjectAccess::ForHeapNumberValue(); | 5373 access = HObjectAccess::ForHeapNumberValue(); |
5355 } | 5374 } |
(...skipping 6184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11540 if (ShouldProduceTraceOutput()) { | 11559 if (ShouldProduceTraceOutput()) { |
11541 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11560 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11542 } | 11561 } |
11543 | 11562 |
11544 #ifdef DEBUG | 11563 #ifdef DEBUG |
11545 graph_->Verify(false); // No full verify. | 11564 graph_->Verify(false); // No full verify. |
11546 #endif | 11565 #endif |
11547 } | 11566 } |
11548 | 11567 |
11549 } } // namespace v8::internal | 11568 } } // namespace v8::internal |
OLD | NEW |