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 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map()); | 2037 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map()); |
2038 reinterpret_cast<Map*>(result)->set_instance_type(instance_type); | 2038 reinterpret_cast<Map*>(result)->set_instance_type(instance_type); |
2039 reinterpret_cast<Map*>(result)->set_instance_size(instance_size); | 2039 reinterpret_cast<Map*>(result)->set_instance_size(instance_size); |
2040 reinterpret_cast<Map*>(result)->set_visitor_id( | 2040 reinterpret_cast<Map*>(result)->set_visitor_id( |
2041 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); | 2041 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); |
2042 reinterpret_cast<Map*>(result)->set_inobject_properties(0); | 2042 reinterpret_cast<Map*>(result)->set_inobject_properties(0); |
2043 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); | 2043 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); |
2044 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); | 2044 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); |
2045 reinterpret_cast<Map*>(result)->set_bit_field(0); | 2045 reinterpret_cast<Map*>(result)->set_bit_field(0); |
2046 reinterpret_cast<Map*>(result)->set_bit_field2(0); | 2046 reinterpret_cast<Map*>(result)->set_bit_field2(0); |
2047 reinterpret_cast<Map*>(result)->set_bit_field3(0); | 2047 reinterpret_cast<Map*>(result)->set_bit_field3( |
| 2048 Map::LastAddedBits::encode(Map::kNoneAdded)); |
2048 return result; | 2049 return result; |
2049 } | 2050 } |
2050 | 2051 |
2051 | 2052 |
2052 MaybeObject* Heap::AllocateMap(InstanceType instance_type, | 2053 MaybeObject* Heap::AllocateMap(InstanceType instance_type, |
2053 int instance_size, | 2054 int instance_size, |
2054 ElementsKind elements_kind) { | 2055 ElementsKind elements_kind) { |
2055 Object* result; | 2056 Object* result; |
2056 { MaybeObject* maybe_result = AllocateRawMap(); | 2057 MaybeObject* maybe_result = AllocateRawMap(); |
2057 if (!maybe_result->ToObject(&result)) return maybe_result; | 2058 if (!maybe_result->To(&result)) return maybe_result; |
2058 } | |
2059 | 2059 |
2060 Map* map = reinterpret_cast<Map*>(result); | 2060 Map* map = reinterpret_cast<Map*>(result); |
2061 map->set_map_no_write_barrier(meta_map()); | 2061 map->set_map_no_write_barrier(meta_map()); |
2062 map->set_instance_type(instance_type); | 2062 map->set_instance_type(instance_type); |
2063 map->set_visitor_id( | 2063 map->set_visitor_id( |
2064 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); | 2064 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); |
2065 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); | 2065 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); |
2066 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); | 2066 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); |
2067 map->set_instance_size(instance_size); | 2067 map->set_instance_size(instance_size); |
2068 map->set_inobject_properties(0); | 2068 map->set_inobject_properties(0); |
2069 map->set_pre_allocated_property_fields(0); | 2069 map->set_pre_allocated_property_fields(0); |
2070 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); | 2070 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); |
2071 map->init_back_pointer(undefined_value()); | 2071 map->init_back_pointer(undefined_value()); |
2072 map->set_unused_property_fields(0); | 2072 map->set_unused_property_fields(0); |
2073 map->set_bit_field(0); | 2073 map->set_bit_field(0); |
2074 map->set_bit_field2(1 << Map::kIsExtensible); | 2074 map->set_bit_field2(1 << Map::kIsExtensible); |
2075 map->set_bit_field3(0); | 2075 map->set_bit_field3(Map::LastAddedBits::encode(Map::kNoneAdded)); |
2076 map->set_elements_kind(elements_kind); | 2076 map->set_elements_kind(elements_kind); |
2077 | 2077 |
2078 // If the map object is aligned fill the padding area with Smi 0 objects. | 2078 // If the map object is aligned fill the padding area with Smi 0 objects. |
2079 if (Map::kPadStart < Map::kSize) { | 2079 if (Map::kPadStart < Map::kSize) { |
2080 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, | 2080 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, |
2081 0, | 2081 0, |
2082 Map::kSize - Map::kPadStart); | 2082 Map::kSize - Map::kPadStart); |
2083 } | 2083 } |
2084 return map; | 2084 return map; |
2085 } | 2085 } |
(...skipping 5132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7218 static_cast<int>(object_sizes_last_time_[index])); | 7218 static_cast<int>(object_sizes_last_time_[index])); |
7219 CODE_KIND_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7219 CODE_KIND_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7220 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7220 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7221 | 7221 |
7222 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7222 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7223 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7223 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7224 ClearObjectStats(); | 7224 ClearObjectStats(); |
7225 } | 7225 } |
7226 | 7226 |
7227 } } // namespace v8::internal | 7227 } } // namespace v8::internal |
OLD | NEW |