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