OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 6012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6023 } | 6023 } |
6024 | 6024 |
6025 // Handle a load of a constant known function. | 6025 // Handle a load of a constant known function. |
6026 if (lookup.IsConstantFunction()) { | 6026 if (lookup.IsConstantFunction()) { |
6027 AddInstruction(new(zone()) HCheckNonSmi(object)); | 6027 AddInstruction(new(zone()) HCheckNonSmi(object)); |
6028 AddInstruction(HCheckMaps::NewWithTransitions(object, map, zone())); | 6028 AddInstruction(HCheckMaps::NewWithTransitions(object, map, zone())); |
6029 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map)); | 6029 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map)); |
6030 return new(zone()) HConstant(function, Representation::Tagged()); | 6030 return new(zone()) HConstant(function, Representation::Tagged()); |
6031 } | 6031 } |
6032 | 6032 |
| 6033 // Handle a load from a known field somewhere in the protoype chain. |
| 6034 LookupInPrototypes(map, name, &lookup); |
| 6035 if (lookup.IsField()) { |
| 6036 Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
| 6037 Handle<JSObject> holder(lookup.holder()); |
| 6038 Handle<Map> holder_map(holder->map()); |
| 6039 AddInstruction(new(zone()) HCheckNonSmi(object)); |
| 6040 AddInstruction(HCheckMaps::NewWithTransitions(object, map, zone())); |
| 6041 HInstruction* holder_value = |
| 6042 AddInstruction(new(zone()) HCheckPrototypeMaps(prototype, holder)); |
| 6043 return BuildLoadNamedField(holder_value, holder_map, &lookup, false); |
| 6044 } |
| 6045 |
6033 // No luck, do a generic load. | 6046 // No luck, do a generic load. |
6034 return BuildLoadNamedGeneric(object, name, expr); | 6047 return BuildLoadNamedGeneric(object, name, expr); |
6035 } | 6048 } |
6036 | 6049 |
6037 | 6050 |
6038 HInstruction* HGraphBuilder::BuildLoadKeyedGeneric(HValue* object, | 6051 HInstruction* HGraphBuilder::BuildLoadKeyedGeneric(HValue* object, |
6039 HValue* key) { | 6052 HValue* key) { |
6040 HValue* context = environment()->LookupContext(); | 6053 HValue* context = environment()->LookupContext(); |
6041 return new(zone()) HLoadKeyedGeneric(context, object, key); | 6054 return new(zone()) HLoadKeyedGeneric(context, object, key); |
6042 } | 6055 } |
(...skipping 3930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9973 } | 9986 } |
9974 } | 9987 } |
9975 | 9988 |
9976 #ifdef DEBUG | 9989 #ifdef DEBUG |
9977 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9990 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9978 if (allocator_ != NULL) allocator_->Verify(); | 9991 if (allocator_ != NULL) allocator_->Verify(); |
9979 #endif | 9992 #endif |
9980 } | 9993 } |
9981 | 9994 |
9982 } } // namespace v8::internal | 9995 } } // namespace v8::internal |
OLD | NEW |