| 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 5439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5450 LookupResult lookup(isolate()); | 5450 LookupResult lookup(isolate()); |
| 5451 map->LookupDescriptor(NULL, *name, &lookup); | 5451 map->LookupDescriptor(NULL, *name, &lookup); |
| 5452 if (lookup.IsField()) { | 5452 if (lookup.IsField()) { |
| 5453 AddCheckMap(object, map); | 5453 AddCheckMap(object, map); |
| 5454 return BuildLoadNamedField(object, | 5454 return BuildLoadNamedField(object, |
| 5455 HObjectAccess::ForField(map, &lookup, name), | 5455 HObjectAccess::ForField(map, &lookup, name), |
| 5456 ComputeLoadStoreRepresentation(map, &lookup)); | 5456 ComputeLoadStoreRepresentation(map, &lookup)); |
| 5457 } | 5457 } |
| 5458 | 5458 |
| 5459 // Handle a load of a constant known function. | 5459 // Handle a load of a constant known function. |
| 5460 if (lookup.IsConstantFunction()) { | 5460 if (lookup.IsConstant()) { |
| 5461 AddCheckMap(object, map); | 5461 AddCheckMap(object, map); |
| 5462 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map)); | 5462 Handle<Object> constant(lookup.GetConstantFromMap(*map), isolate()); |
| 5463 return new(zone()) HConstant(function); | 5463 return new(zone()) HConstant(constant); |
| 5464 } | 5464 } |
| 5465 | 5465 |
| 5466 // Handle a load from a known field somewhere in the prototype chain. | 5466 // Handle a load from a known field somewhere in the prototype chain. |
| 5467 LookupInPrototypes(map, name, &lookup); | 5467 LookupInPrototypes(map, name, &lookup); |
| 5468 if (lookup.IsField()) { | 5468 if (lookup.IsField()) { |
| 5469 Handle<JSObject> prototype(JSObject::cast(map->prototype())); | 5469 Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
| 5470 Handle<JSObject> holder(lookup.holder()); | 5470 Handle<JSObject> holder(lookup.holder()); |
| 5471 Handle<Map> holder_map(holder->map()); | 5471 Handle<Map> holder_map(holder->map()); |
| 5472 AddCheckMap(object, map); | 5472 AddCheckMap(object, map); |
| 5473 Add<HCheckPrototypeMaps>(prototype, holder, zone(), top_info()); | 5473 Add<HCheckPrototypeMaps>(prototype, holder, zone(), top_info()); |
| 5474 HValue* holder_value = Add<HConstant>(holder); | 5474 HValue* holder_value = Add<HConstant>(holder); |
| 5475 return BuildLoadNamedField(holder_value, | 5475 return BuildLoadNamedField(holder_value, |
| 5476 HObjectAccess::ForField(holder_map, &lookup, name), | 5476 HObjectAccess::ForField(holder_map, &lookup, name), |
| 5477 ComputeLoadStoreRepresentation(map, &lookup)); | 5477 ComputeLoadStoreRepresentation(map, &lookup)); |
| 5478 } | 5478 } |
| 5479 | 5479 |
| 5480 // Handle a load of a constant function somewhere in the prototype chain. | 5480 // Handle a load of a constant function somewhere in the prototype chain. |
| 5481 if (lookup.IsConstantFunction()) { | 5481 if (lookup.IsConstant()) { |
| 5482 Handle<JSObject> prototype(JSObject::cast(map->prototype())); | 5482 Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
| 5483 Handle<JSObject> holder(lookup.holder()); | 5483 Handle<JSObject> holder(lookup.holder()); |
| 5484 Handle<Map> holder_map(holder->map()); | 5484 Handle<Map> holder_map(holder->map()); |
| 5485 AddCheckMap(object, map); | 5485 AddCheckMap(object, map); |
| 5486 Add<HCheckPrototypeMaps>(prototype, holder, zone(), top_info()); | 5486 Add<HCheckPrototypeMaps>(prototype, holder, zone(), top_info()); |
| 5487 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*holder_map)); | 5487 Handle<Object> constant(lookup.GetConstantFromMap(*holder_map), isolate()); |
| 5488 return new(zone()) HConstant(function); | 5488 return new(zone()) HConstant(constant); |
| 5489 } | 5489 } |
| 5490 | 5490 |
| 5491 // No luck, do a generic load. | 5491 // No luck, do a generic load. |
| 5492 return BuildLoadNamedGeneric(object, name, expr); | 5492 return BuildLoadNamedGeneric(object, name, expr); |
| 5493 } | 5493 } |
| 5494 | 5494 |
| 5495 | 5495 |
| 5496 HInstruction* HOptimizedGraphBuilder::BuildLoadKeyedGeneric(HValue* object, | 5496 HInstruction* HOptimizedGraphBuilder::BuildLoadKeyedGeneric(HValue* object, |
| 5497 HValue* key) { | 5497 HValue* key) { |
| 5498 HValue* context = environment()->LookupContext(); | 5498 HValue* context = environment()->LookupContext(); |
| (...skipping 4450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9949 if (ShouldProduceTraceOutput()) { | 9949 if (ShouldProduceTraceOutput()) { |
| 9950 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9950 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 9951 } | 9951 } |
| 9952 | 9952 |
| 9953 #ifdef DEBUG | 9953 #ifdef DEBUG |
| 9954 graph_->Verify(false); // No full verify. | 9954 graph_->Verify(false); // No full verify. |
| 9955 #endif | 9955 #endif |
| 9956 } | 9956 } |
| 9957 | 9957 |
| 9958 } } // namespace v8::internal | 9958 } } // namespace v8::internal |
| OLD | NEW |