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 2458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 map->set_instance_type(instance_type); | 2469 map->set_instance_type(instance_type); |
2470 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); | 2470 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); |
2471 map->set_constructor_or_backpointer(null_value(), SKIP_WRITE_BARRIER); | 2471 map->set_constructor_or_backpointer(null_value(), SKIP_WRITE_BARRIER); |
2472 map->set_instance_size(instance_size); | 2472 map->set_instance_size(instance_size); |
2473 map->set_inobject_properties(0); | 2473 map->set_inobject_properties(0); |
2474 map->set_pre_allocated_property_fields(0); | 2474 map->set_pre_allocated_property_fields(0); |
2475 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); | 2475 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); |
2476 map->set_dependent_code(DependentCode::cast(empty_fixed_array()), | 2476 map->set_dependent_code(DependentCode::cast(empty_fixed_array()), |
2477 SKIP_WRITE_BARRIER); | 2477 SKIP_WRITE_BARRIER); |
2478 map->set_weak_cell_cache(Smi::FromInt(0)); | 2478 map->set_weak_cell_cache(Smi::FromInt(0)); |
2479 map->init_transitions(undefined_value()); | 2479 map->set_raw_transitions(Smi::FromInt(0)); |
2480 map->set_unused_property_fields(0); | 2480 map->set_unused_property_fields(0); |
2481 map->set_instance_descriptors(empty_descriptor_array()); | 2481 map->set_instance_descriptors(empty_descriptor_array()); |
2482 if (FLAG_unbox_double_fields) { | 2482 if (FLAG_unbox_double_fields) { |
2483 map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); | 2483 map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); |
2484 } | 2484 } |
2485 // Must be called only after |instance_type|, |instance_size| and | 2485 // Must be called only after |instance_type|, |instance_size| and |
2486 // |layout_descriptor| are set. | 2486 // |layout_descriptor| are set. |
2487 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map)); | 2487 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map)); |
2488 map->set_bit_field(0); | 2488 map->set_bit_field(0); |
2489 map->set_bit_field2(1 << Map::kIsExtensible); | 2489 map->set_bit_field2(1 << Map::kIsExtensible); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 // Allocate the constant pool array. | 2603 // Allocate the constant pool array. |
2604 { | 2604 { |
2605 AllocationResult allocation = AllocateEmptyConstantPoolArray(); | 2605 AllocationResult allocation = AllocateEmptyConstantPoolArray(); |
2606 if (!allocation.To(&obj)) return false; | 2606 if (!allocation.To(&obj)) return false; |
2607 } | 2607 } |
2608 set_empty_constant_pool_array(ConstantPoolArray::cast(obj)); | 2608 set_empty_constant_pool_array(ConstantPoolArray::cast(obj)); |
2609 | 2609 |
2610 // Fix the instance_descriptors for the existing maps. | 2610 // Fix the instance_descriptors for the existing maps. |
2611 meta_map()->set_code_cache(empty_fixed_array()); | 2611 meta_map()->set_code_cache(empty_fixed_array()); |
2612 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); | 2612 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); |
2613 meta_map()->init_transitions(undefined_value()); | 2613 meta_map()->set_raw_transitions(Smi::FromInt(0)); |
2614 meta_map()->set_instance_descriptors(empty_descriptor_array()); | 2614 meta_map()->set_instance_descriptors(empty_descriptor_array()); |
2615 if (FLAG_unbox_double_fields) { | 2615 if (FLAG_unbox_double_fields) { |
2616 meta_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); | 2616 meta_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); |
2617 } | 2617 } |
2618 | 2618 |
2619 fixed_array_map()->set_code_cache(empty_fixed_array()); | 2619 fixed_array_map()->set_code_cache(empty_fixed_array()); |
2620 fixed_array_map()->set_dependent_code( | 2620 fixed_array_map()->set_dependent_code( |
2621 DependentCode::cast(empty_fixed_array())); | 2621 DependentCode::cast(empty_fixed_array())); |
2622 fixed_array_map()->init_transitions(undefined_value()); | 2622 fixed_array_map()->set_raw_transitions(Smi::FromInt(0)); |
2623 fixed_array_map()->set_instance_descriptors(empty_descriptor_array()); | 2623 fixed_array_map()->set_instance_descriptors(empty_descriptor_array()); |
2624 if (FLAG_unbox_double_fields) { | 2624 if (FLAG_unbox_double_fields) { |
2625 fixed_array_map()->set_layout_descriptor( | 2625 fixed_array_map()->set_layout_descriptor( |
2626 LayoutDescriptor::FastPointerLayout()); | 2626 LayoutDescriptor::FastPointerLayout()); |
2627 } | 2627 } |
2628 | 2628 |
2629 undefined_map()->set_code_cache(empty_fixed_array()); | 2629 undefined_map()->set_code_cache(empty_fixed_array()); |
2630 undefined_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); | 2630 undefined_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); |
2631 undefined_map()->init_transitions(undefined_value()); | 2631 undefined_map()->set_raw_transitions(Smi::FromInt(0)); |
2632 undefined_map()->set_instance_descriptors(empty_descriptor_array()); | 2632 undefined_map()->set_instance_descriptors(empty_descriptor_array()); |
2633 if (FLAG_unbox_double_fields) { | 2633 if (FLAG_unbox_double_fields) { |
2634 undefined_map()->set_layout_descriptor( | 2634 undefined_map()->set_layout_descriptor( |
2635 LayoutDescriptor::FastPointerLayout()); | 2635 LayoutDescriptor::FastPointerLayout()); |
2636 } | 2636 } |
2637 | 2637 |
2638 null_map()->set_code_cache(empty_fixed_array()); | 2638 null_map()->set_code_cache(empty_fixed_array()); |
2639 null_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); | 2639 null_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); |
2640 null_map()->init_transitions(undefined_value()); | 2640 null_map()->set_raw_transitions(Smi::FromInt(0)); |
2641 null_map()->set_instance_descriptors(empty_descriptor_array()); | 2641 null_map()->set_instance_descriptors(empty_descriptor_array()); |
2642 if (FLAG_unbox_double_fields) { | 2642 if (FLAG_unbox_double_fields) { |
2643 null_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); | 2643 null_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); |
2644 } | 2644 } |
2645 | 2645 |
2646 constant_pool_array_map()->set_code_cache(empty_fixed_array()); | 2646 constant_pool_array_map()->set_code_cache(empty_fixed_array()); |
2647 constant_pool_array_map()->set_dependent_code( | 2647 constant_pool_array_map()->set_dependent_code( |
2648 DependentCode::cast(empty_fixed_array())); | 2648 DependentCode::cast(empty_fixed_array())); |
2649 constant_pool_array_map()->init_transitions(undefined_value()); | 2649 constant_pool_array_map()->set_raw_transitions(Smi::FromInt(0)); |
2650 constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array()); | 2650 constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array()); |
2651 if (FLAG_unbox_double_fields) { | 2651 if (FLAG_unbox_double_fields) { |
2652 constant_pool_array_map()->set_layout_descriptor( | 2652 constant_pool_array_map()->set_layout_descriptor( |
2653 LayoutDescriptor::FastPointerLayout()); | 2653 LayoutDescriptor::FastPointerLayout()); |
2654 } | 2654 } |
2655 | 2655 |
2656 // Fix prototype object for existing maps. | 2656 // Fix prototype object for existing maps. |
2657 meta_map()->set_prototype(null_value()); | 2657 meta_map()->set_prototype(null_value()); |
2658 meta_map()->set_constructor_or_backpointer(null_value()); | 2658 meta_map()->set_constructor_or_backpointer(null_value()); |
2659 | 2659 |
(...skipping 3867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6527 static_cast<int>(object_sizes_last_time_[index])); | 6527 static_cast<int>(object_sizes_last_time_[index])); |
6528 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6528 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6529 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6529 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6530 | 6530 |
6531 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6531 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6532 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6532 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6533 ClearObjectStats(); | 6533 ClearObjectStats(); |
6534 } | 6534 } |
6535 } | 6535 } |
6536 } // namespace v8::internal | 6536 } // namespace v8::internal |
OLD | NEW |