Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: src/heap.cc

Issue 88043002: Out-of-line constant pool on Arm: Stage 3 - Set Constant Pool Pointer on Function Entry (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add immed check Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 AllocatePartialMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 2639 AllocatePartialMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
2640 if (!maybe_obj->ToObject(&obj)) return false; 2640 if (!maybe_obj->ToObject(&obj)) return false;
2641 } 2641 }
2642 set_fixed_array_map(Map::cast(obj)); 2642 set_fixed_array_map(Map::cast(obj));
2643 2643
2644 { MaybeObject* maybe_obj = AllocatePartialMap(ODDBALL_TYPE, Oddball::kSize); 2644 { MaybeObject* maybe_obj = AllocatePartialMap(ODDBALL_TYPE, Oddball::kSize);
2645 if (!maybe_obj->ToObject(&obj)) return false; 2645 if (!maybe_obj->ToObject(&obj)) return false;
2646 } 2646 }
2647 set_oddball_map(Map::cast(obj)); 2647 set_oddball_map(Map::cast(obj));
2648 2648
2649 { MaybeObject* maybe_obj =
2650 AllocatePartialMap(CONSTANT_POOL_ARRAY_TYPE, kVariableSizeSentinel);
2651 if (!maybe_obj->ToObject(&obj)) return false;
2652 }
2653 set_constant_pool_array_map(Map::cast(obj));
2654
2649 // Allocate the empty array. 2655 // Allocate the empty array.
2650 { MaybeObject* maybe_obj = AllocateEmptyFixedArray(); 2656 { MaybeObject* maybe_obj = AllocateEmptyFixedArray();
2651 if (!maybe_obj->ToObject(&obj)) return false; 2657 if (!maybe_obj->ToObject(&obj)) return false;
2652 } 2658 }
2653 set_empty_fixed_array(FixedArray::cast(obj)); 2659 set_empty_fixed_array(FixedArray::cast(obj));
2654 2660
2655 { MaybeObject* maybe_obj = Allocate(oddball_map(), OLD_POINTER_SPACE); 2661 { MaybeObject* maybe_obj = Allocate(oddball_map(), OLD_POINTER_SPACE);
2656 if (!maybe_obj->ToObject(&obj)) return false; 2662 if (!maybe_obj->ToObject(&obj)) return false;
2657 } 2663 }
2658 set_null_value(Oddball::cast(obj)); 2664 set_null_value(Oddball::cast(obj));
2659 Oddball::cast(obj)->set_kind(Oddball::kNull); 2665 Oddball::cast(obj)->set_kind(Oddball::kNull);
2660 2666
2661 { MaybeObject* maybe_obj = Allocate(oddball_map(), OLD_POINTER_SPACE); 2667 { MaybeObject* maybe_obj = Allocate(oddball_map(), OLD_POINTER_SPACE);
2662 if (!maybe_obj->ToObject(&obj)) return false; 2668 if (!maybe_obj->ToObject(&obj)) return false;
2663 } 2669 }
2664 set_undefined_value(Oddball::cast(obj)); 2670 set_undefined_value(Oddball::cast(obj));
2665 Oddball::cast(obj)->set_kind(Oddball::kUndefined); 2671 Oddball::cast(obj)->set_kind(Oddball::kUndefined);
2666 ASSERT(!InNewSpace(undefined_value())); 2672 ASSERT(!InNewSpace(undefined_value()));
2667 2673
2668 // Allocate the empty descriptor array. 2674 // Allocate the empty descriptor array.
2669 { MaybeObject* maybe_obj = AllocateEmptyFixedArray(); 2675 { MaybeObject* maybe_obj = AllocateEmptyFixedArray();
2670 if (!maybe_obj->ToObject(&obj)) return false; 2676 if (!maybe_obj->ToObject(&obj)) return false;
2671 } 2677 }
2672 set_empty_descriptor_array(DescriptorArray::cast(obj)); 2678 set_empty_descriptor_array(DescriptorArray::cast(obj));
2673 2679
2680 // Allocate the constant pool array.
2681 { MaybeObject* maybe_obj = AllocateEmptyConstantPoolArray();
2682 if (!maybe_obj->ToObject(&obj)) return false;
2683 }
2684 set_empty_constant_pool_array(ConstantPoolArray::cast(obj));
2685
2674 // Fix the instance_descriptors for the existing maps. 2686 // Fix the instance_descriptors for the existing maps.
2675 meta_map()->set_code_cache(empty_fixed_array()); 2687 meta_map()->set_code_cache(empty_fixed_array());
2676 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2688 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2677 meta_map()->init_back_pointer(undefined_value()); 2689 meta_map()->init_back_pointer(undefined_value());
2678 meta_map()->set_instance_descriptors(empty_descriptor_array()); 2690 meta_map()->set_instance_descriptors(empty_descriptor_array());
2679 2691
2680 fixed_array_map()->set_code_cache(empty_fixed_array()); 2692 fixed_array_map()->set_code_cache(empty_fixed_array());
2681 fixed_array_map()->set_dependent_code( 2693 fixed_array_map()->set_dependent_code(
2682 DependentCode::cast(empty_fixed_array())); 2694 DependentCode::cast(empty_fixed_array()));
2683 fixed_array_map()->init_back_pointer(undefined_value()); 2695 fixed_array_map()->init_back_pointer(undefined_value());
2684 fixed_array_map()->set_instance_descriptors(empty_descriptor_array()); 2696 fixed_array_map()->set_instance_descriptors(empty_descriptor_array());
2685 2697
2686 oddball_map()->set_code_cache(empty_fixed_array()); 2698 oddball_map()->set_code_cache(empty_fixed_array());
2687 oddball_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2699 oddball_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2688 oddball_map()->init_back_pointer(undefined_value()); 2700 oddball_map()->init_back_pointer(undefined_value());
2689 oddball_map()->set_instance_descriptors(empty_descriptor_array()); 2701 oddball_map()->set_instance_descriptors(empty_descriptor_array());
2690 2702
2703 constant_pool_array_map()->set_code_cache(empty_fixed_array());
2704 constant_pool_array_map()->set_dependent_code(
2705 DependentCode::cast(empty_fixed_array()));
2706 constant_pool_array_map()->init_back_pointer(undefined_value());
2707 constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array());
2708
2691 // Fix prototype object for existing maps. 2709 // Fix prototype object for existing maps.
2692 meta_map()->set_prototype(null_value()); 2710 meta_map()->set_prototype(null_value());
2693 meta_map()->set_constructor(null_value()); 2711 meta_map()->set_constructor(null_value());
2694 2712
2695 fixed_array_map()->set_prototype(null_value()); 2713 fixed_array_map()->set_prototype(null_value());
2696 fixed_array_map()->set_constructor(null_value()); 2714 fixed_array_map()->set_constructor(null_value());
2697 2715
2698 oddball_map()->set_prototype(null_value()); 2716 oddball_map()->set_prototype(null_value());
2699 oddball_map()->set_constructor(null_value()); 2717 oddball_map()->set_constructor(null_value());
2700 2718
2719 constant_pool_array_map()->set_prototype(null_value());
2720 constant_pool_array_map()->set_constructor(null_value());
2721
2701 { MaybeObject* maybe_obj = 2722 { MaybeObject* maybe_obj =
2702 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 2723 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
2703 if (!maybe_obj->ToObject(&obj)) return false; 2724 if (!maybe_obj->ToObject(&obj)) return false;
2704 } 2725 }
2705 set_fixed_cow_array_map(Map::cast(obj)); 2726 set_fixed_cow_array_map(Map::cast(obj));
2706 ASSERT(fixed_array_map() != fixed_cow_array_map()); 2727 ASSERT(fixed_array_map() != fixed_cow_array_map());
2707 2728
2708 { MaybeObject* maybe_obj = 2729 { MaybeObject* maybe_obj =
2709 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 2730 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
2710 if (!maybe_obj->ToObject(&obj)) return false; 2731 if (!maybe_obj->ToObject(&obj)) return false;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2747 set_undetectable_ascii_string_map(Map::cast(obj)); 2768 set_undetectable_ascii_string_map(Map::cast(obj));
2748 Map::cast(obj)->set_is_undetectable(); 2769 Map::cast(obj)->set_is_undetectable();
2749 2770
2750 { MaybeObject* maybe_obj = 2771 { MaybeObject* maybe_obj =
2751 AllocateMap(FIXED_DOUBLE_ARRAY_TYPE, kVariableSizeSentinel); 2772 AllocateMap(FIXED_DOUBLE_ARRAY_TYPE, kVariableSizeSentinel);
2752 if (!maybe_obj->ToObject(&obj)) return false; 2773 if (!maybe_obj->ToObject(&obj)) return false;
2753 } 2774 }
2754 set_fixed_double_array_map(Map::cast(obj)); 2775 set_fixed_double_array_map(Map::cast(obj));
2755 2776
2756 { MaybeObject* maybe_obj = 2777 { MaybeObject* maybe_obj =
2757 AllocateMap(CONSTANT_POOL_ARRAY_TYPE, kVariableSizeSentinel);
2758 if (!maybe_obj->ToObject(&obj)) return false;
2759 }
2760 set_constant_pool_array_map(Map::cast(obj));
2761
2762 { MaybeObject* maybe_obj =
2763 AllocateMap(BYTE_ARRAY_TYPE, kVariableSizeSentinel); 2778 AllocateMap(BYTE_ARRAY_TYPE, kVariableSizeSentinel);
2764 if (!maybe_obj->ToObject(&obj)) return false; 2779 if (!maybe_obj->ToObject(&obj)) return false;
2765 } 2780 }
2766 set_byte_array_map(Map::cast(obj)); 2781 set_byte_array_map(Map::cast(obj));
2767 2782
2768 { MaybeObject* maybe_obj = 2783 { MaybeObject* maybe_obj =
2769 AllocateMap(FREE_SPACE_TYPE, kVariableSizeSentinel); 2784 AllocateMap(FREE_SPACE_TYPE, kVariableSizeSentinel);
2770 if (!maybe_obj->ToObject(&obj)) return false; 2785 if (!maybe_obj->ToObject(&obj)) return false;
2771 } 2786 }
2772 set_free_space_map(Map::cast(obj)); 2787 set_free_space_map(Map::cast(obj));
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
4265 code->set_is_crankshafted(crankshafted); 4280 code->set_is_crankshafted(crankshafted);
4266 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); 4281 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER);
4267 code->set_raw_type_feedback_info(undefined_value()); 4282 code->set_raw_type_feedback_info(undefined_value());
4268 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); 4283 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER);
4269 code->set_gc_metadata(Smi::FromInt(0)); 4284 code->set_gc_metadata(Smi::FromInt(0));
4270 code->set_ic_age(global_ic_age_); 4285 code->set_ic_age(global_ic_age_);
4271 code->set_prologue_offset(prologue_offset); 4286 code->set_prologue_offset(prologue_offset);
4272 if (code->kind() == Code::OPTIMIZED_FUNCTION) { 4287 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
4273 code->set_marked_for_deoptimization(false); 4288 code->set_marked_for_deoptimization(false);
4274 } 4289 }
4290 code->set_constant_pool(empty_constant_pool_array());
4275 4291
4276 #ifdef ENABLE_DEBUGGER_SUPPORT 4292 #ifdef ENABLE_DEBUGGER_SUPPORT
4277 if (code->kind() == Code::FUNCTION) { 4293 if (code->kind() == Code::FUNCTION) {
4278 code->set_has_debug_break_slots( 4294 code->set_has_debug_break_slots(
4279 isolate_->debugger()->IsDebuggerActive()); 4295 isolate_->debugger()->IsDebuggerActive());
4280 } 4296 }
4281 #endif 4297 #endif
4282 4298
4283 // Allow self references to created code object by patching the handle to 4299 // Allow self references to created code object by patching the handle to
4284 // point to the newly allocated Code object. 4300 // point to the newly allocated Code object.
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
5511 if (!maybe_object->To<HeapObject>(&object)) return maybe_object; 5527 if (!maybe_object->To<HeapObject>(&object)) return maybe_object;
5512 } 5528 }
5513 object = EnsureDoubleAligned(this, object, size); 5529 object = EnsureDoubleAligned(this, object, size);
5514 HeapObject::cast(object)->set_map_no_write_barrier(constant_pool_array_map()); 5530 HeapObject::cast(object)->set_map_no_write_barrier(constant_pool_array_map());
5515 5531
5516 ConstantPoolArray* constant_pool = 5532 ConstantPoolArray* constant_pool =
5517 reinterpret_cast<ConstantPoolArray*>(object); 5533 reinterpret_cast<ConstantPoolArray*>(object);
5518 constant_pool->SetEntryCounts(number_of_int64_entries, 5534 constant_pool->SetEntryCounts(number_of_int64_entries,
5519 number_of_ptr_entries, 5535 number_of_ptr_entries,
5520 number_of_int32_entries); 5536 number_of_int32_entries);
5521 MemsetPointer( 5537 if (number_of_ptr_entries > 0) {
5522 HeapObject::RawField( 5538 MemsetPointer(
5523 constant_pool, 5539 HeapObject::RawField(
5524 constant_pool->OffsetOfElementAt(constant_pool->first_ptr_index())), 5540 constant_pool,
5525 undefined_value(), 5541 constant_pool->OffsetOfElementAt(constant_pool->first_ptr_index())),
5526 number_of_ptr_entries); 5542 undefined_value(),
5543 number_of_ptr_entries);
5544 }
5527 return constant_pool; 5545 return constant_pool;
5528 } 5546 }
5529 5547
5530 5548
5549 MaybeObject* Heap::AllocateEmptyConstantPoolArray() {
5550 int size = ConstantPoolArray::SizeFor(0, 0, 0);
5551 Object* result;
5552 { MaybeObject* maybe_result =
5553 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE);
5554 if (!maybe_result->ToObject(&result)) return maybe_result;
5555 }
5556 HeapObject::cast(result)->set_map_no_write_barrier(constant_pool_array_map());
5557 ConstantPoolArray::cast(result)->SetEntryCounts(0, 0, 0);
5558 return result;
5559 }
5560
5561
5531 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) { 5562 MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
5532 Object* result; 5563 Object* result;
5533 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); 5564 { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure);
5534 if (!maybe_result->ToObject(&result)) return maybe_result; 5565 if (!maybe_result->ToObject(&result)) return maybe_result;
5535 } 5566 }
5536 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier( 5567 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(
5537 hash_table_map()); 5568 hash_table_map());
5538 ASSERT(result->IsHashTable()); 5569 ASSERT(result->IsHashTable());
5539 return result; 5570 return result;
5540 } 5571 }
(...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after
7995 static_cast<int>(object_sizes_last_time_[index])); 8026 static_cast<int>(object_sizes_last_time_[index]));
7996 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 8027 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
7997 #undef ADJUST_LAST_TIME_OBJECT_COUNT 8028 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7998 8029
7999 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 8030 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
8000 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 8031 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
8001 ClearObjectStats(); 8032 ClearObjectStats();
8002 } 8033 }
8003 8034
8004 } } // namespace v8::internal 8035 } } // namespace v8::internal
OLDNEW
« src/frames.h ('K') | « src/heap.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698