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