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 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map()); | 2045 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map()); |
2046 reinterpret_cast<Map*>(result)->set_instance_type(instance_type); | 2046 reinterpret_cast<Map*>(result)->set_instance_type(instance_type); |
2047 reinterpret_cast<Map*>(result)->set_instance_size(instance_size); | 2047 reinterpret_cast<Map*>(result)->set_instance_size(instance_size); |
2048 reinterpret_cast<Map*>(result)->set_visitor_id( | 2048 reinterpret_cast<Map*>(result)->set_visitor_id( |
2049 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); | 2049 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); |
2050 reinterpret_cast<Map*>(result)->set_inobject_properties(0); | 2050 reinterpret_cast<Map*>(result)->set_inobject_properties(0); |
2051 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); | 2051 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); |
2052 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); | 2052 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); |
2053 reinterpret_cast<Map*>(result)->set_bit_field(0); | 2053 reinterpret_cast<Map*>(result)->set_bit_field(0); |
2054 reinterpret_cast<Map*>(result)->set_bit_field2(0); | 2054 reinterpret_cast<Map*>(result)->set_bit_field2(0); |
2055 reinterpret_cast<Map*>(result)->set_bit_field3(0); | 2055 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache) | |
| 2056 Map::OwnsDescriptors::encode(true); |
| 2057 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3); |
2056 return result; | 2058 return result; |
2057 } | 2059 } |
2058 | 2060 |
2059 | 2061 |
2060 MaybeObject* Heap::AllocateMap(InstanceType instance_type, | 2062 MaybeObject* Heap::AllocateMap(InstanceType instance_type, |
2061 int instance_size, | 2063 int instance_size, |
2062 ElementsKind elements_kind) { | 2064 ElementsKind elements_kind) { |
2063 Object* result; | 2065 Object* result; |
2064 MaybeObject* maybe_result = AllocateRawMap(); | 2066 MaybeObject* maybe_result = AllocateRawMap(); |
2065 if (!maybe_result->To(&result)) return maybe_result; | 2067 if (!maybe_result->To(&result)) return maybe_result; |
2066 | 2068 |
2067 Map* map = reinterpret_cast<Map*>(result); | 2069 Map* map = reinterpret_cast<Map*>(result); |
2068 map->set_map_no_write_barrier(meta_map()); | 2070 map->set_map_no_write_barrier(meta_map()); |
2069 map->set_instance_type(instance_type); | 2071 map->set_instance_type(instance_type); |
2070 map->set_visitor_id( | 2072 map->set_visitor_id( |
2071 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); | 2073 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); |
2072 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); | 2074 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); |
2073 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); | 2075 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); |
2074 map->set_instance_size(instance_size); | 2076 map->set_instance_size(instance_size); |
2075 map->set_inobject_properties(0); | 2077 map->set_inobject_properties(0); |
2076 map->set_pre_allocated_property_fields(0); | 2078 map->set_pre_allocated_property_fields(0); |
2077 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); | 2079 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); |
2078 map->init_back_pointer(undefined_value()); | 2080 map->init_back_pointer(undefined_value()); |
2079 map->set_unused_property_fields(0); | 2081 map->set_unused_property_fields(0); |
2080 map->set_bit_field(0); | 2082 map->set_bit_field(0); |
2081 map->set_bit_field2(1 << Map::kIsExtensible); | 2083 map->set_bit_field2(1 << Map::kIsExtensible); |
2082 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache); | 2084 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache) | |
| 2085 Map::OwnsDescriptors::encode(true); |
2083 map->set_bit_field3(bit_field3); | 2086 map->set_bit_field3(bit_field3); |
2084 map->set_elements_kind(elements_kind); | 2087 map->set_elements_kind(elements_kind); |
2085 | 2088 |
2086 // If the map object is aligned fill the padding area with Smi 0 objects. | 2089 // If the map object is aligned fill the padding area with Smi 0 objects. |
2087 if (Map::kPadStart < Map::kSize) { | 2090 if (Map::kPadStart < Map::kSize) { |
2088 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, | 2091 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, |
2089 0, | 2092 0, |
2090 Map::kSize - Map::kPadStart); | 2093 Map::kSize - Map::kPadStart); |
2091 } | 2094 } |
2092 return map; | 2095 return map; |
(...skipping 5023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7116 } | 7119 } |
7117 } | 7120 } |
7118 | 7121 |
7119 | 7122 |
7120 void KeyedLookupCache::Clear() { | 7123 void KeyedLookupCache::Clear() { |
7121 for (int index = 0; index < kLength; index++) keys_[index].map = NULL; | 7124 for (int index = 0; index < kLength; index++) keys_[index].map = NULL; |
7122 } | 7125 } |
7123 | 7126 |
7124 | 7127 |
7125 void DescriptorLookupCache::Clear() { | 7128 void DescriptorLookupCache::Clear() { |
7126 for (int index = 0; index < kLength; index++) keys_[index].array = NULL; | 7129 for (int index = 0; index < kLength; index++) keys_[index].source = NULL; |
7127 } | 7130 } |
7128 | 7131 |
7129 | 7132 |
7130 #ifdef DEBUG | 7133 #ifdef DEBUG |
7131 void Heap::GarbageCollectionGreedyCheck() { | 7134 void Heap::GarbageCollectionGreedyCheck() { |
7132 ASSERT(FLAG_gc_greedy); | 7135 ASSERT(FLAG_gc_greedy); |
7133 if (isolate_->bootstrapper()->IsActive()) return; | 7136 if (isolate_->bootstrapper()->IsActive()) return; |
7134 if (disallow_allocation_failure()) return; | 7137 if (disallow_allocation_failure()) return; |
7135 CollectGarbage(NEW_SPACE); | 7138 CollectGarbage(NEW_SPACE); |
7136 } | 7139 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7315 static_cast<int>(object_sizes_last_time_[index])); | 7318 static_cast<int>(object_sizes_last_time_[index])); |
7316 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7319 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7317 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7320 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7318 | 7321 |
7319 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7322 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7320 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7323 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7321 ClearObjectStats(); | 7324 ClearObjectStats(); |
7322 } | 7325 } |
7323 | 7326 |
7324 } } // namespace v8::internal | 7327 } } // namespace v8::internal |
OLD | NEW |