| 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 4011 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4022                              true)  // Needs smi and map check. |  4022                              true)  // Needs smi and map check. | 
|  4023       : BuildStoreNamedGeneric(object, name, value); |  4023       : BuildStoreNamedGeneric(object, name, value); | 
|  4024 } |  4024 } | 
|  4025  |  4025  | 
|  4026  |  4026  | 
|  4027 void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr, |  4027 void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr, | 
|  4028                                                     HValue* object, |  4028                                                     HValue* object, | 
|  4029                                                     SmallMapList* types, |  4029                                                     SmallMapList* types, | 
|  4030                                                     Handle<String> name) { |  4030                                                     Handle<String> name) { | 
|  4031   int count = 0; |  4031   int count = 0; | 
|  4032   int previous_field_index = 0; |  4032   int previous_field_offset = 0; | 
 |  4033   bool previous_field_is_in_object = false; | 
|  4033   bool is_monomorphic_field = true; |  4034   bool is_monomorphic_field = true; | 
|  4034   Handle<Map> map; |  4035   Handle<Map> map; | 
|  4035   LookupResult lookup(isolate()); |  4036   LookupResult lookup(isolate()); | 
|  4036   for (int i = 0; i < types->length() && count < kMaxLoadPolymorphism; ++i) { |  4037   for (int i = 0; i < types->length() && count < kMaxLoadPolymorphism; ++i) { | 
|  4037     map = types->at(i); |  4038     map = types->at(i); | 
|  4038     if (ComputeLoadStoreField(map, name, &lookup, false)) { |  4039     if (ComputeLoadStoreField(map, name, &lookup, false)) { | 
|  4039       int index = ComputeLoadStoreFieldIndex(map, name, &lookup); |  4040       int index = ComputeLoadStoreFieldIndex(map, name, &lookup); | 
 |  4041       bool is_in_object = index < 0; | 
 |  4042       int offset = index * kPointerSize; | 
 |  4043       if (index < 0) { | 
 |  4044         // Negative property indices are in-object properties, indexed | 
 |  4045         // from the end of the fixed part of the object. | 
 |  4046         offset += map->instance_size(); | 
 |  4047       } else { | 
 |  4048         offset += FixedArray::kHeaderSize; | 
 |  4049       } | 
|  4040       if (count == 0) { |  4050       if (count == 0) { | 
|  4041         previous_field_index = index; |  4051         previous_field_offset = offset; | 
 |  4052         previous_field_is_in_object = is_in_object; | 
|  4042       } else if (is_monomorphic_field) { |  4053       } else if (is_monomorphic_field) { | 
|  4043         is_monomorphic_field = (index == previous_field_index); |  4054         is_monomorphic_field = (offset == previous_field_offset) && | 
 |  4055                                (is_in_object == previous_field_is_in_object); | 
|  4044       } |  4056       } | 
|  4045       ++count; |  4057       ++count; | 
|  4046     } |  4058     } | 
|  4047   } |  4059   } | 
|  4048  |  4060  | 
|  4049   // Use monomorphic load if property lookup results in the same field index |  4061   // Use monomorphic load if property lookup results in the same field index | 
|  4050   // for all maps.  Requires special map check on the set of all handled maps. |  4062   // for all maps.  Requires special map check on the set of all handled maps. | 
|  4051   HInstruction* instr; |  4063   HInstruction* instr; | 
|  4052   if (count == types->length() && is_monomorphic_field) { |  4064   if (count == types->length() && is_monomorphic_field) { | 
|  4053     AddInstruction(new(zone()) HCheckMaps(object, types)); |  4065     AddInstruction(new(zone()) HCheckMaps(object, types)); | 
| (...skipping 4143 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  8197     } |  8209     } | 
|  8198   } |  8210   } | 
|  8199  |  8211  | 
|  8200 #ifdef DEBUG |  8212 #ifdef DEBUG | 
|  8201   if (graph_ != NULL) graph_->Verify(false);  // No full verify. |  8213   if (graph_ != NULL) graph_->Verify(false);  // No full verify. | 
|  8202   if (allocator_ != NULL) allocator_->Verify(); |  8214   if (allocator_ != NULL) allocator_->Verify(); | 
|  8203 #endif |  8215 #endif | 
|  8204 } |  8216 } | 
|  8205  |  8217  | 
|  8206 } }  // namespace v8::internal |  8218 } }  // namespace v8::internal | 
| OLD | NEW |