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

Side by Side Diff: src/heap/heap.cc

Issue 699613004: Revert "In-object double fields unboxing (for 64-bit only)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « src/globals.h ('k') | src/heap/mark-compact.cc » ('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 // 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 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, 2301 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type,
2302 int instance_size) { 2302 int instance_size) {
2303 Object* result; 2303 Object* result;
2304 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); 2304 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE);
2305 if (!allocation.To(&result)) return allocation; 2305 if (!allocation.To(&result)) return allocation;
2306 2306
2307 // Map::cast cannot be used due to uninitialized map field. 2307 // Map::cast cannot be used due to uninitialized map field.
2308 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map()); 2308 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map());
2309 reinterpret_cast<Map*>(result)->set_instance_type(instance_type); 2309 reinterpret_cast<Map*>(result)->set_instance_type(instance_type);
2310 reinterpret_cast<Map*>(result)->set_instance_size(instance_size); 2310 reinterpret_cast<Map*>(result)->set_instance_size(instance_size);
2311 // Initialize to only containing tagged fields.
2312 reinterpret_cast<Map*>(result)->set_visitor_id( 2311 reinterpret_cast<Map*>(result)->set_visitor_id(
2313 StaticVisitorBase::GetVisitorId(instance_type, instance_size, false)); 2312 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2314 if (FLAG_unbox_double_fields) {
2315 reinterpret_cast<Map*>(result)
2316 ->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2317 }
2318 reinterpret_cast<Map*>(result)->set_inobject_properties(0); 2313 reinterpret_cast<Map*>(result)->set_inobject_properties(0);
2319 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); 2314 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0);
2320 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); 2315 reinterpret_cast<Map*>(result)->set_unused_property_fields(0);
2321 reinterpret_cast<Map*>(result)->set_bit_field(0); 2316 reinterpret_cast<Map*>(result)->set_bit_field(0);
2322 reinterpret_cast<Map*>(result)->set_bit_field2(0); 2317 reinterpret_cast<Map*>(result)->set_bit_field2(0);
2323 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | 2318 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) |
2324 Map::OwnsDescriptors::encode(true); 2319 Map::OwnsDescriptors::encode(true);
2325 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3); 2320 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3);
2326 return result; 2321 return result;
2327 } 2322 }
2328 2323
2329 2324
2330 AllocationResult Heap::AllocateMap(InstanceType instance_type, 2325 AllocationResult Heap::AllocateMap(InstanceType instance_type,
2331 int instance_size, 2326 int instance_size,
2332 ElementsKind elements_kind) { 2327 ElementsKind elements_kind) {
2333 HeapObject* result; 2328 HeapObject* result;
2334 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); 2329 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE);
2335 if (!allocation.To(&result)) return allocation; 2330 if (!allocation.To(&result)) return allocation;
2336 2331
2337 result->set_map_no_write_barrier(meta_map()); 2332 result->set_map_no_write_barrier(meta_map());
2338 Map* map = Map::cast(result); 2333 Map* map = Map::cast(result);
2339 map->set_instance_type(instance_type); 2334 map->set_instance_type(instance_type);
2335 map->set_visitor_id(
2336 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2340 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); 2337 map->set_prototype(null_value(), SKIP_WRITE_BARRIER);
2341 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); 2338 map->set_constructor(null_value(), SKIP_WRITE_BARRIER);
2342 map->set_instance_size(instance_size); 2339 map->set_instance_size(instance_size);
2343 map->set_inobject_properties(0); 2340 map->set_inobject_properties(0);
2344 map->set_pre_allocated_property_fields(0); 2341 map->set_pre_allocated_property_fields(0);
2345 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); 2342 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER);
2346 map->set_dependent_code(DependentCode::cast(empty_fixed_array()), 2343 map->set_dependent_code(DependentCode::cast(empty_fixed_array()),
2347 SKIP_WRITE_BARRIER); 2344 SKIP_WRITE_BARRIER);
2348 map->init_back_pointer(undefined_value()); 2345 map->init_back_pointer(undefined_value());
2349 map->set_unused_property_fields(0); 2346 map->set_unused_property_fields(0);
2350 map->set_instance_descriptors(empty_descriptor_array()); 2347 map->set_instance_descriptors(empty_descriptor_array());
2351 if (FLAG_unbox_double_fields) {
2352 map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2353 }
2354 // Must be called only after |instance_type|, |instance_size| and
2355 // |layout_descriptor| are set.
2356 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map));
2357 map->set_bit_field(0); 2348 map->set_bit_field(0);
2358 map->set_bit_field2(1 << Map::kIsExtensible); 2349 map->set_bit_field2(1 << Map::kIsExtensible);
2359 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | 2350 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) |
2360 Map::OwnsDescriptors::encode(true); 2351 Map::OwnsDescriptors::encode(true);
2361 map->set_bit_field3(bit_field3); 2352 map->set_bit_field3(bit_field3);
2362 map->set_elements_kind(elements_kind); 2353 map->set_elements_kind(elements_kind);
2363 2354
2364 return map; 2355 return map;
2365 } 2356 }
2366 2357
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2473 AllocationResult allocation = AllocateEmptyConstantPoolArray(); 2464 AllocationResult allocation = AllocateEmptyConstantPoolArray();
2474 if (!allocation.To(&obj)) return false; 2465 if (!allocation.To(&obj)) return false;
2475 } 2466 }
2476 set_empty_constant_pool_array(ConstantPoolArray::cast(obj)); 2467 set_empty_constant_pool_array(ConstantPoolArray::cast(obj));
2477 2468
2478 // Fix the instance_descriptors for the existing maps. 2469 // Fix the instance_descriptors for the existing maps.
2479 meta_map()->set_code_cache(empty_fixed_array()); 2470 meta_map()->set_code_cache(empty_fixed_array());
2480 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2471 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2481 meta_map()->init_back_pointer(undefined_value()); 2472 meta_map()->init_back_pointer(undefined_value());
2482 meta_map()->set_instance_descriptors(empty_descriptor_array()); 2473 meta_map()->set_instance_descriptors(empty_descriptor_array());
2483 if (FLAG_unbox_double_fields) {
2484 meta_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2485 }
2486 2474
2487 fixed_array_map()->set_code_cache(empty_fixed_array()); 2475 fixed_array_map()->set_code_cache(empty_fixed_array());
2488 fixed_array_map()->set_dependent_code( 2476 fixed_array_map()->set_dependent_code(
2489 DependentCode::cast(empty_fixed_array())); 2477 DependentCode::cast(empty_fixed_array()));
2490 fixed_array_map()->init_back_pointer(undefined_value()); 2478 fixed_array_map()->init_back_pointer(undefined_value());
2491 fixed_array_map()->set_instance_descriptors(empty_descriptor_array()); 2479 fixed_array_map()->set_instance_descriptors(empty_descriptor_array());
2492 if (FLAG_unbox_double_fields) {
2493 fixed_array_map()->set_layout_descriptor(
2494 LayoutDescriptor::FastPointerLayout());
2495 }
2496 2480
2497 undefined_map()->set_code_cache(empty_fixed_array()); 2481 undefined_map()->set_code_cache(empty_fixed_array());
2498 undefined_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2482 undefined_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2499 undefined_map()->init_back_pointer(undefined_value()); 2483 undefined_map()->init_back_pointer(undefined_value());
2500 undefined_map()->set_instance_descriptors(empty_descriptor_array()); 2484 undefined_map()->set_instance_descriptors(empty_descriptor_array());
2501 if (FLAG_unbox_double_fields) {
2502 undefined_map()->set_layout_descriptor(
2503 LayoutDescriptor::FastPointerLayout());
2504 }
2505 2485
2506 null_map()->set_code_cache(empty_fixed_array()); 2486 null_map()->set_code_cache(empty_fixed_array());
2507 null_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2487 null_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2508 null_map()->init_back_pointer(undefined_value()); 2488 null_map()->init_back_pointer(undefined_value());
2509 null_map()->set_instance_descriptors(empty_descriptor_array()); 2489 null_map()->set_instance_descriptors(empty_descriptor_array());
2510 if (FLAG_unbox_double_fields) {
2511 null_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2512 }
2513 2490
2514 constant_pool_array_map()->set_code_cache(empty_fixed_array()); 2491 constant_pool_array_map()->set_code_cache(empty_fixed_array());
2515 constant_pool_array_map()->set_dependent_code( 2492 constant_pool_array_map()->set_dependent_code(
2516 DependentCode::cast(empty_fixed_array())); 2493 DependentCode::cast(empty_fixed_array()));
2517 constant_pool_array_map()->init_back_pointer(undefined_value()); 2494 constant_pool_array_map()->init_back_pointer(undefined_value());
2518 constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array()); 2495 constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array());
2519 if (FLAG_unbox_double_fields) {
2520 constant_pool_array_map()->set_layout_descriptor(
2521 LayoutDescriptor::FastPointerLayout());
2522 }
2523 2496
2524 // Fix prototype object for existing maps. 2497 // Fix prototype object for existing maps.
2525 meta_map()->set_prototype(null_value()); 2498 meta_map()->set_prototype(null_value());
2526 meta_map()->set_constructor(null_value()); 2499 meta_map()->set_constructor(null_value());
2527 2500
2528 fixed_array_map()->set_prototype(null_value()); 2501 fixed_array_map()->set_prototype(null_value());
2529 fixed_array_map()->set_constructor(null_value()); 2502 fixed_array_map()->set_constructor(null_value());
2530 2503
2531 undefined_map()->set_prototype(null_value()); 2504 undefined_map()->set_prototype(null_value());
2532 undefined_map()->set_constructor(null_value()); 2505 undefined_map()->set_constructor(null_value());
(...skipping 3760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6293 static_cast<int>(object_sizes_last_time_[index])); 6266 static_cast<int>(object_sizes_last_time_[index]));
6294 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6267 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6295 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6268 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6296 6269
6297 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6270 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6298 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6271 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6299 ClearObjectStats(); 6272 ClearObjectStats();
6300 } 6273 }
6301 } 6274 }
6302 } // namespace v8::internal 6275 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698