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 10916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10927 object_offset, elements_offset, elements_size); | 10927 object_offset, elements_offset, elements_size); |
10928 | 10928 |
10929 // Copy in-object properties. | 10929 // Copy in-object properties. |
10930 HValue* object_properties = | 10930 HValue* object_properties = |
10931 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); | 10931 AddInstruction(new(zone) HInnerAllocatedObject(target, object_offset)); |
10932 | 10932 |
10933 Handle<DescriptorArray> descriptors( | 10933 Handle<DescriptorArray> descriptors( |
10934 boilerplate_object->map()->instance_descriptors()); | 10934 boilerplate_object->map()->instance_descriptors()); |
10935 int limit = boilerplate_object->map()->NumberOfOwnDescriptors(); | 10935 int limit = boilerplate_object->map()->NumberOfOwnDescriptors(); |
10936 | 10936 |
| 10937 int copied_fields = 0; |
10937 for (int i = 0; i < limit; i++) { | 10938 for (int i = 0; i < limit; i++) { |
10938 PropertyDetails details = descriptors->GetDetails(i); | 10939 PropertyDetails details = descriptors->GetDetails(i); |
10939 if (details.type() != FIELD) continue; | 10940 if (details.type() != FIELD) continue; |
| 10941 copied_fields++; |
10940 int index = descriptors->GetFieldIndex(i); | 10942 int index = descriptors->GetFieldIndex(i); |
10941 int property_offset = boilerplate_object->GetInObjectPropertyOffset(index); | 10943 int property_offset = boilerplate_object->GetInObjectPropertyOffset(index); |
10942 Handle<Name> name(descriptors->GetKey(i)); | 10944 Handle<Name> name(descriptors->GetKey(i)); |
10943 Handle<Object> value = | 10945 Handle<Object> value = |
10944 Handle<Object>(boilerplate_object->InObjectPropertyAt(index), | 10946 Handle<Object>(boilerplate_object->InObjectPropertyAt(index), |
10945 isolate()); | 10947 isolate()); |
10946 if (value->IsJSObject()) { | 10948 if (value->IsJSObject()) { |
10947 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 10949 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
10948 Handle<JSObject> original_value_object = Handle<JSObject>::cast( | 10950 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
10949 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(index), | 10951 Handle<Object>(original_boilerplate_object->InObjectPropertyAt(index), |
(...skipping 18 matching lines...) Expand all Loading... |
10968 Representation::Double(), HeapNumber::kValueOffset)); | 10970 Representation::Double(), HeapNumber::kValueOffset)); |
10969 value_instruction = double_box; | 10971 value_instruction = double_box; |
10970 *offset += HeapNumber::kSize; | 10972 *offset += HeapNumber::kSize; |
10971 } | 10973 } |
10972 AddInstruction(new(zone) HStoreNamedField( | 10974 AddInstruction(new(zone) HStoreNamedField( |
10973 object_properties, name, value_instruction, true, | 10975 object_properties, name, value_instruction, true, |
10974 Representation::Tagged(), property_offset)); | 10976 Representation::Tagged(), property_offset)); |
10975 } | 10977 } |
10976 } | 10978 } |
10977 | 10979 |
| 10980 int inobject_properties = boilerplate_object->map()->inobject_properties(); |
| 10981 HInstruction* value_instruction = AddInstruction(new(zone) HConstant( |
| 10982 factory->one_pointer_filler_map(), Representation::Tagged())); |
| 10983 for (int i = copied_fields; i < inobject_properties; i++) { |
| 10984 AddInstruction(new(zone) HStoreNamedField( |
| 10985 object_properties, factory->unknown_field_string(), value_instruction, |
| 10986 true, Representation::Tagged(), |
| 10987 boilerplate_object->GetInObjectPropertyOffset(i))); |
| 10988 } |
| 10989 |
10978 // Build Allocation Site Info if desired | 10990 // Build Allocation Site Info if desired |
10979 if (create_allocation_site_info) { | 10991 if (create_allocation_site_info) { |
10980 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate); | 10992 BuildCreateAllocationSiteInfo(target, JSArray::kSize, original_boilerplate); |
10981 } | 10993 } |
10982 | 10994 |
10983 if (object_elements != NULL) { | 10995 if (object_elements != NULL) { |
10984 HInstruction* boilerplate_elements = AddInstruction(new(zone) HConstant( | 10996 HInstruction* boilerplate_elements = AddInstruction(new(zone) HConstant( |
10985 elements, Representation::Tagged())); | 10997 elements, Representation::Tagged())); |
10986 | 10998 |
10987 int elements_length = elements->length(); | 10999 int elements_length = elements->length(); |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12457 } | 12469 } |
12458 } | 12470 } |
12459 | 12471 |
12460 #ifdef DEBUG | 12472 #ifdef DEBUG |
12461 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12473 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
12462 if (allocator_ != NULL) allocator_->Verify(); | 12474 if (allocator_ != NULL) allocator_->Verify(); |
12463 #endif | 12475 #endif |
12464 } | 12476 } |
12465 | 12477 |
12466 } } // namespace v8::internal | 12478 } } // namespace v8::internal |
OLD | NEW |