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 6271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6282 return BuildLoadNamedField(object, map, &lookup); | 6282 return BuildLoadNamedField(object, map, &lookup); |
6283 } | 6283 } |
6284 | 6284 |
6285 // Handle a load of a constant known function. | 6285 // Handle a load of a constant known function. |
6286 if (lookup.IsConstantFunction()) { | 6286 if (lookup.IsConstantFunction()) { |
6287 AddCheckMapsWithTransitions(object, map); | 6287 AddCheckMapsWithTransitions(object, map); |
6288 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map)); | 6288 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map)); |
6289 return new(zone()) HConstant(function, Representation::Tagged()); | 6289 return new(zone()) HConstant(function, Representation::Tagged()); |
6290 } | 6290 } |
6291 | 6291 |
6292 // Handle a load from a known field somewhere in the protoype chain. | 6292 // Handle a load from a known field somewhere in the prototype chain. |
6293 LookupInPrototypes(map, name, &lookup); | 6293 LookupInPrototypes(map, name, &lookup); |
6294 if (lookup.IsField()) { | 6294 if (lookup.IsField()) { |
6295 Handle<JSObject> prototype(JSObject::cast(map->prototype())); | 6295 Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
6296 Handle<JSObject> holder(lookup.holder()); | 6296 Handle<JSObject> holder(lookup.holder()); |
6297 Handle<Map> holder_map(holder->map()); | 6297 Handle<Map> holder_map(holder->map()); |
6298 AddCheckMapsWithTransitions(object, map); | 6298 AddCheckMapsWithTransitions(object, map); |
6299 HInstruction* holder_value = | 6299 HInstruction* holder_value = |
6300 AddInstruction(new(zone()) HCheckPrototypeMaps(prototype, holder)); | 6300 AddInstruction(new(zone()) HCheckPrototypeMaps(prototype, holder)); |
6301 return BuildLoadNamedField(holder_value, holder_map, &lookup); | 6301 return BuildLoadNamedField(holder_value, holder_map, &lookup); |
6302 } | 6302 } |
6303 | 6303 |
| 6304 // Handle a load of a constant function somewhere in the prototype chain. |
| 6305 if (lookup.IsConstantFunction()) { |
| 6306 Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
| 6307 Handle<JSObject> holder(lookup.holder()); |
| 6308 Handle<Map> holder_map(holder->map()); |
| 6309 AddCheckMapsWithTransitions(object, map); |
| 6310 AddInstruction(new(zone()) HCheckPrototypeMaps(prototype, holder)); |
| 6311 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*holder_map)); |
| 6312 return new(zone()) HConstant(function, Representation::Tagged()); |
| 6313 } |
| 6314 |
6304 // No luck, do a generic load. | 6315 // No luck, do a generic load. |
6305 return BuildLoadNamedGeneric(object, name, expr); | 6316 return BuildLoadNamedGeneric(object, name, expr); |
6306 } | 6317 } |
6307 | 6318 |
6308 | 6319 |
6309 HInstruction* HOptimizedGraphBuilder::BuildLoadKeyedGeneric(HValue* object, | 6320 HInstruction* HOptimizedGraphBuilder::BuildLoadKeyedGeneric(HValue* object, |
6310 HValue* key) { | 6321 HValue* key) { |
6311 HValue* context = environment()->LookupContext(); | 6322 HValue* context = environment()->LookupContext(); |
6312 return new(zone()) HLoadKeyedGeneric(context, object, key); | 6323 return new(zone()) HLoadKeyedGeneric(context, object, key); |
6313 } | 6324 } |
(...skipping 3973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10287 } | 10298 } |
10288 } | 10299 } |
10289 | 10300 |
10290 #ifdef DEBUG | 10301 #ifdef DEBUG |
10291 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10302 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
10292 if (allocator_ != NULL) allocator_->Verify(); | 10303 if (allocator_ != NULL) allocator_->Verify(); |
10293 #endif | 10304 #endif |
10294 } | 10305 } |
10295 | 10306 |
10296 } } // namespace v8::internal | 10307 } } // namespace v8::internal |
OLD | NEW |