| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2442 } | 2442 } |
| 2443 reinterpret_cast<Map*>(result)->set_inobject_properties(0); | 2443 reinterpret_cast<Map*>(result)->set_inobject_properties(0); |
| 2444 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); | 2444 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); |
| 2445 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); | 2445 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); |
| 2446 reinterpret_cast<Map*>(result)->set_bit_field(0); | 2446 reinterpret_cast<Map*>(result)->set_bit_field(0); |
| 2447 reinterpret_cast<Map*>(result)->set_bit_field2(0); | 2447 reinterpret_cast<Map*>(result)->set_bit_field2(0); |
| 2448 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | | 2448 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | |
| 2449 Map::OwnsDescriptors::encode(true) | | 2449 Map::OwnsDescriptors::encode(true) | |
| 2450 Map::Counter::encode(Map::kRetainingCounterStart); | 2450 Map::Counter::encode(Map::kRetainingCounterStart); |
| 2451 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3); | 2451 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3); |
| 2452 reinterpret_cast<Map*>(result)->set_weak_cell_cache(Smi::FromInt(0)); |
| 2452 return result; | 2453 return result; |
| 2453 } | 2454 } |
| 2454 | 2455 |
| 2455 | 2456 |
| 2456 AllocationResult Heap::AllocateMap(InstanceType instance_type, | 2457 AllocationResult Heap::AllocateMap(InstanceType instance_type, |
| 2457 int instance_size, | 2458 int instance_size, |
| 2458 ElementsKind elements_kind) { | 2459 ElementsKind elements_kind) { |
| 2459 HeapObject* result; | 2460 HeapObject* result; |
| 2460 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); | 2461 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); |
| 2461 if (!allocation.To(&result)) return allocation; | 2462 if (!allocation.To(&result)) return allocation; |
| 2462 | 2463 |
| 2463 result->set_map_no_write_barrier(meta_map()); | 2464 result->set_map_no_write_barrier(meta_map()); |
| 2464 Map* map = Map::cast(result); | 2465 Map* map = Map::cast(result); |
| 2465 map->set_instance_type(instance_type); | 2466 map->set_instance_type(instance_type); |
| 2466 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); | 2467 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); |
| 2467 map->set_constructor_or_backpointer(null_value(), SKIP_WRITE_BARRIER); | 2468 map->set_constructor_or_backpointer(null_value(), SKIP_WRITE_BARRIER); |
| 2468 map->set_instance_size(instance_size); | 2469 map->set_instance_size(instance_size); |
| 2469 map->set_inobject_properties(0); | 2470 map->set_inobject_properties(0); |
| 2470 map->set_pre_allocated_property_fields(0); | 2471 map->set_pre_allocated_property_fields(0); |
| 2471 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); | 2472 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); |
| 2472 map->set_dependent_code(DependentCode::cast(empty_fixed_array()), | 2473 map->set_dependent_code(DependentCode::cast(empty_fixed_array()), |
| 2473 SKIP_WRITE_BARRIER); | 2474 SKIP_WRITE_BARRIER); |
| 2475 map->set_weak_cell_cache(Smi::FromInt(0)); |
| 2474 map->init_transitions(undefined_value()); | 2476 map->init_transitions(undefined_value()); |
| 2475 map->set_unused_property_fields(0); | 2477 map->set_unused_property_fields(0); |
| 2476 map->set_instance_descriptors(empty_descriptor_array()); | 2478 map->set_instance_descriptors(empty_descriptor_array()); |
| 2477 if (FLAG_unbox_double_fields) { | 2479 if (FLAG_unbox_double_fields) { |
| 2478 map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); | 2480 map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); |
| 2479 } | 2481 } |
| 2480 // Must be called only after |instance_type|, |instance_size| and | 2482 // Must be called only after |instance_type|, |instance_size| and |
| 2481 // |layout_descriptor| are set. | 2483 // |layout_descriptor| are set. |
| 2482 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map)); | 2484 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map)); |
| 2483 map->set_bit_field(0); | 2485 map->set_bit_field(0); |
| (...skipping 4038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6522 static_cast<int>(object_sizes_last_time_[index])); | 6524 static_cast<int>(object_sizes_last_time_[index])); |
| 6523 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6525 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6524 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6526 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6525 | 6527 |
| 6526 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6528 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6527 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6529 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6528 ClearObjectStats(); | 6530 ClearObjectStats(); |
| 6529 } | 6531 } |
| 6530 } | 6532 } |
| 6531 } // namespace v8::internal | 6533 } // namespace v8::internal |
| OLD | NEW |