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

Side by Side Diff: src/heap.cc

Issue 11575007: Make embedded maps in optimized code weak. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 months 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
« no previous file with comments | « no previous file | src/lithium.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 map->set_map_no_write_barrier(meta_map()); 2190 map->set_map_no_write_barrier(meta_map());
2191 map->set_instance_type(instance_type); 2191 map->set_instance_type(instance_type);
2192 map->set_visitor_id( 2192 map->set_visitor_id(
2193 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); 2193 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2194 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); 2194 map->set_prototype(null_value(), SKIP_WRITE_BARRIER);
2195 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); 2195 map->set_constructor(null_value(), SKIP_WRITE_BARRIER);
2196 map->set_instance_size(instance_size); 2196 map->set_instance_size(instance_size);
2197 map->set_inobject_properties(0); 2197 map->set_inobject_properties(0);
2198 map->set_pre_allocated_property_fields(0); 2198 map->set_pre_allocated_property_fields(0);
2199 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); 2199 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER);
2200 map->set_dependent_codes(DependentCodes::cast(empty_fixed_array()),
2201 SKIP_WRITE_BARRIER);
2200 map->init_back_pointer(undefined_value()); 2202 map->init_back_pointer(undefined_value());
2201 map->set_unused_property_fields(0); 2203 map->set_unused_property_fields(0);
2202 map->set_instance_descriptors(empty_descriptor_array()); 2204 map->set_instance_descriptors(empty_descriptor_array());
2203 map->set_bit_field(0); 2205 map->set_bit_field(0);
2204 map->set_bit_field2(1 << Map::kIsExtensible); 2206 map->set_bit_field2(1 << Map::kIsExtensible);
2205 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache) | 2207 int bit_field3 = Map::EnumLengthBits::encode(Map::kInvalidEnumCache) |
2206 Map::OwnsDescriptors::encode(true); 2208 Map::OwnsDescriptors::encode(true);
2207 map->set_bit_field3(bit_field3); 2209 map->set_bit_field3(bit_field3);
2208 map->set_elements_kind(elements_kind); 2210 map->set_elements_kind(elements_kind);
2209 2211
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 ASSERT(!InNewSpace(undefined_value())); 2327 ASSERT(!InNewSpace(undefined_value()));
2326 2328
2327 // Allocate the empty descriptor array. 2329 // Allocate the empty descriptor array.
2328 { MaybeObject* maybe_obj = AllocateEmptyFixedArray(); 2330 { MaybeObject* maybe_obj = AllocateEmptyFixedArray();
2329 if (!maybe_obj->ToObject(&obj)) return false; 2331 if (!maybe_obj->ToObject(&obj)) return false;
2330 } 2332 }
2331 set_empty_descriptor_array(DescriptorArray::cast(obj)); 2333 set_empty_descriptor_array(DescriptorArray::cast(obj));
2332 2334
2333 // Fix the instance_descriptors for the existing maps. 2335 // Fix the instance_descriptors for the existing maps.
2334 meta_map()->set_code_cache(empty_fixed_array()); 2336 meta_map()->set_code_cache(empty_fixed_array());
2337 meta_map()->set_dependent_codes(DependentCodes::cast(empty_fixed_array()));
2335 meta_map()->init_back_pointer(undefined_value()); 2338 meta_map()->init_back_pointer(undefined_value());
2336 meta_map()->set_instance_descriptors(empty_descriptor_array()); 2339 meta_map()->set_instance_descriptors(empty_descriptor_array());
2337 2340
2338 fixed_array_map()->set_code_cache(empty_fixed_array()); 2341 fixed_array_map()->set_code_cache(empty_fixed_array());
2342 fixed_array_map()->set_dependent_codes(
2343 DependentCodes::cast(empty_fixed_array()));
2339 fixed_array_map()->init_back_pointer(undefined_value()); 2344 fixed_array_map()->init_back_pointer(undefined_value());
2340 fixed_array_map()->set_instance_descriptors(empty_descriptor_array()); 2345 fixed_array_map()->set_instance_descriptors(empty_descriptor_array());
2341 2346
2342 oddball_map()->set_code_cache(empty_fixed_array()); 2347 oddball_map()->set_code_cache(empty_fixed_array());
2348 oddball_map()->set_dependent_codes(DependentCodes::cast(empty_fixed_array()));
2343 oddball_map()->init_back_pointer(undefined_value()); 2349 oddball_map()->init_back_pointer(undefined_value());
2344 oddball_map()->set_instance_descriptors(empty_descriptor_array()); 2350 oddball_map()->set_instance_descriptors(empty_descriptor_array());
2345 2351
2346 // Fix prototype object for existing maps. 2352 // Fix prototype object for existing maps.
2347 meta_map()->set_prototype(null_value()); 2353 meta_map()->set_prototype(null_value());
2348 meta_map()->set_constructor(null_value()); 2354 meta_map()->set_constructor(null_value());
2349 2355
2350 fixed_array_map()->set_prototype(null_value()); 2356 fixed_array_map()->set_prototype(null_value());
2351 fixed_array_map()->set_constructor(null_value()); 2357 fixed_array_map()->set_constructor(null_value());
2352 2358
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
3781 code->set_flags(flags); 3787 code->set_flags(flags);
3782 if (code->is_call_stub() || code->is_keyed_call_stub()) { 3788 if (code->is_call_stub() || code->is_keyed_call_stub()) {
3783 code->set_check_type(RECEIVER_MAP_CHECK); 3789 code->set_check_type(RECEIVER_MAP_CHECK);
3784 } 3790 }
3785 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); 3791 code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER);
3786 code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value()); 3792 code->InitializeTypeFeedbackInfoNoWriteBarrier(undefined_value());
3787 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); 3793 code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER);
3788 code->set_gc_metadata(Smi::FromInt(0)); 3794 code->set_gc_metadata(Smi::FromInt(0));
3789 code->set_ic_age(global_ic_age_); 3795 code->set_ic_age(global_ic_age_);
3790 code->set_prologue_offset(kPrologueOffsetNotSet); 3796 code->set_prologue_offset(kPrologueOffsetNotSet);
3797 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
3798 code->set_marked_for_deoptimization(false);
3799 }
3791 // Allow self references to created code object by patching the handle to 3800 // Allow self references to created code object by patching the handle to
3792 // point to the newly allocated Code object. 3801 // point to the newly allocated Code object.
3793 if (!self_reference.is_null()) { 3802 if (!self_reference.is_null()) {
3794 *(self_reference.location()) = code; 3803 *(self_reference.location()) = code;
3795 } 3804 }
3796 // Migrate generated code. 3805 // Migrate generated code.
3797 // The generated code can contain Object** values (typically from handles) 3806 // The generated code can contain Object** values (typically from handles)
3798 // that are dereferenced during the copy to point directly to the actual heap 3807 // that are dereferenced during the copy to point directly to the actual heap
3799 // objects. These pointers can include references to the code object itself, 3808 // objects. These pointers can include references to the code object itself,
3800 // through the self_reference parameter. 3809 // through the self_reference parameter.
(...skipping 3707 matching lines...) Expand 10 before | Expand all | Expand 10 after
7508 static_cast<int>(object_sizes_last_time_[index])); 7517 static_cast<int>(object_sizes_last_time_[index]));
7509 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7518 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7510 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7519 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7511 7520
7512 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7521 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7513 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7522 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7514 ClearObjectStats(); 7523 ClearObjectStats();
7515 } 7524 }
7516 7525
7517 } } // namespace v8::internal 7526 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/lithium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698