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

Side by Side Diff: src/heap.cc

Issue 391693002: 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, 5 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
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/once.h" 9 #include "src/base/once.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, 2331 AllocationResult Heap::AllocatePartialMap(InstanceType instance_type,
2332 int instance_size) { 2332 int instance_size) {
2333 Object* result; 2333 Object* result;
2334 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); 2334 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE);
2335 if (!allocation.To(&result)) return allocation; 2335 if (!allocation.To(&result)) return allocation;
2336 2336
2337 // Map::cast cannot be used due to uninitialized map field. 2337 // Map::cast cannot be used due to uninitialized map field.
2338 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map()); 2338 reinterpret_cast<Map*>(result)->set_map(raw_unchecked_meta_map());
2339 reinterpret_cast<Map*>(result)->set_instance_type(instance_type); 2339 reinterpret_cast<Map*>(result)->set_instance_type(instance_type);
2340 reinterpret_cast<Map*>(result)->set_instance_size(instance_size); 2340 reinterpret_cast<Map*>(result)->set_instance_size(instance_size);
2341 // All initial maps have only tagged fields.
Toon Verwaest 2014/07/29 15:02:08 // Initialize to only containing tagged fields.
Igor Sheludko 2014/10/30 14:23:43 Done.
2341 reinterpret_cast<Map*>(result)->set_visitor_id( 2342 reinterpret_cast<Map*>(result)->set_visitor_id(
2342 StaticVisitorBase::GetVisitorId(instance_type, instance_size)); 2343 StaticVisitorBase::GetVisitorId(instance_type, instance_size, false));
2344 if (FLAG_unbox_double_fields) {
2345 reinterpret_cast<Map*>(result)
2346 ->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2347 }
2343 reinterpret_cast<Map*>(result)->set_inobject_properties(0); 2348 reinterpret_cast<Map*>(result)->set_inobject_properties(0);
2344 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0); 2349 reinterpret_cast<Map*>(result)->set_pre_allocated_property_fields(0);
2345 reinterpret_cast<Map*>(result)->set_unused_property_fields(0); 2350 reinterpret_cast<Map*>(result)->set_unused_property_fields(0);
2346 reinterpret_cast<Map*>(result)->set_bit_field(0); 2351 reinterpret_cast<Map*>(result)->set_bit_field(0);
2347 reinterpret_cast<Map*>(result)->set_bit_field2(0); 2352 reinterpret_cast<Map*>(result)->set_bit_field2(0);
2348 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | 2353 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) |
2349 Map::OwnsDescriptors::encode(true); 2354 Map::OwnsDescriptors::encode(true);
2350 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3); 2355 reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3);
2351 return result; 2356 return result;
2352 } 2357 }
2353 2358
2354 2359
2355 AllocationResult Heap::AllocateMap(InstanceType instance_type, 2360 AllocationResult Heap::AllocateMap(InstanceType instance_type,
2356 int instance_size, 2361 int instance_size,
2357 ElementsKind elements_kind) { 2362 ElementsKind elements_kind) {
2358 HeapObject* result; 2363 HeapObject* result;
2359 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE); 2364 AllocationResult allocation = AllocateRaw(Map::kSize, MAP_SPACE, MAP_SPACE);
2360 if (!allocation.To(&result)) return allocation; 2365 if (!allocation.To(&result)) return allocation;
2361 2366
2362 result->set_map_no_write_barrier(meta_map()); 2367 result->set_map_no_write_barrier(meta_map());
2363 Map* map = Map::cast(result); 2368 Map* map = Map::cast(result);
2364 map->set_instance_type(instance_type); 2369 map->set_instance_type(instance_type);
2365 map->set_visitor_id(
2366 StaticVisitorBase::GetVisitorId(instance_type, instance_size));
2367 map->set_prototype(null_value(), SKIP_WRITE_BARRIER); 2370 map->set_prototype(null_value(), SKIP_WRITE_BARRIER);
2368 map->set_constructor(null_value(), SKIP_WRITE_BARRIER); 2371 map->set_constructor(null_value(), SKIP_WRITE_BARRIER);
2369 map->set_instance_size(instance_size); 2372 map->set_instance_size(instance_size);
2370 map->set_inobject_properties(0); 2373 map->set_inobject_properties(0);
2371 map->set_pre_allocated_property_fields(0); 2374 map->set_pre_allocated_property_fields(0);
2372 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); 2375 map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER);
2373 map->set_dependent_code(DependentCode::cast(empty_fixed_array()), 2376 map->set_dependent_code(DependentCode::cast(empty_fixed_array()),
2374 SKIP_WRITE_BARRIER); 2377 SKIP_WRITE_BARRIER);
2375 map->init_back_pointer(undefined_value()); 2378 map->init_back_pointer(undefined_value());
2376 map->set_unused_property_fields(0); 2379 map->set_unused_property_fields(0);
2377 map->set_instance_descriptors(empty_descriptor_array()); 2380 map->set_instance_descriptors(empty_descriptor_array());
2381 if (FLAG_unbox_double_fields) {
2382 map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2383 }
2384 // Must be called only after |instance_type|, |instance_size| and
2385 // |layout_descriptor| are set.
2386 map->set_visitor_id(StaticVisitorBase::GetVisitorId(map));
2378 map->set_bit_field(0); 2387 map->set_bit_field(0);
2379 map->set_bit_field2(1 << Map::kIsExtensible); 2388 map->set_bit_field2(1 << Map::kIsExtensible);
2380 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) | 2389 int bit_field3 = Map::EnumLengthBits::encode(kInvalidEnumCacheSentinel) |
2381 Map::OwnsDescriptors::encode(true); 2390 Map::OwnsDescriptors::encode(true);
2382 map->set_bit_field3(bit_field3); 2391 map->set_bit_field3(bit_field3);
2383 map->set_elements_kind(elements_kind); 2392 map->set_elements_kind(elements_kind);
2384 2393
2385 return map; 2394 return map;
2386 } 2395 }
2387 2396
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 { AllocationResult allocation = AllocateEmptyConstantPoolArray(); 2493 { AllocationResult allocation = AllocateEmptyConstantPoolArray();
2485 if (!allocation.To(&obj)) return false; 2494 if (!allocation.To(&obj)) return false;
2486 } 2495 }
2487 set_empty_constant_pool_array(ConstantPoolArray::cast(obj)); 2496 set_empty_constant_pool_array(ConstantPoolArray::cast(obj));
2488 2497
2489 // Fix the instance_descriptors for the existing maps. 2498 // Fix the instance_descriptors for the existing maps.
2490 meta_map()->set_code_cache(empty_fixed_array()); 2499 meta_map()->set_code_cache(empty_fixed_array());
2491 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2500 meta_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2492 meta_map()->init_back_pointer(undefined_value()); 2501 meta_map()->init_back_pointer(undefined_value());
2493 meta_map()->set_instance_descriptors(empty_descriptor_array()); 2502 meta_map()->set_instance_descriptors(empty_descriptor_array());
2503 if (FLAG_unbox_double_fields) {
2504 meta_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2505 }
2494 2506
2495 fixed_array_map()->set_code_cache(empty_fixed_array()); 2507 fixed_array_map()->set_code_cache(empty_fixed_array());
2496 fixed_array_map()->set_dependent_code( 2508 fixed_array_map()->set_dependent_code(
2497 DependentCode::cast(empty_fixed_array())); 2509 DependentCode::cast(empty_fixed_array()));
2498 fixed_array_map()->init_back_pointer(undefined_value()); 2510 fixed_array_map()->init_back_pointer(undefined_value());
2499 fixed_array_map()->set_instance_descriptors(empty_descriptor_array()); 2511 fixed_array_map()->set_instance_descriptors(empty_descriptor_array());
2512 if (FLAG_unbox_double_fields) {
2513 fixed_array_map()->set_layout_descriptor(
2514 LayoutDescriptor::FastPointerLayout());
2515 }
2500 2516
2501 undefined_map()->set_code_cache(empty_fixed_array()); 2517 undefined_map()->set_code_cache(empty_fixed_array());
2502 undefined_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2518 undefined_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2503 undefined_map()->init_back_pointer(undefined_value()); 2519 undefined_map()->init_back_pointer(undefined_value());
2504 undefined_map()->set_instance_descriptors(empty_descriptor_array()); 2520 undefined_map()->set_instance_descriptors(empty_descriptor_array());
2521 if (FLAG_unbox_double_fields) {
2522 undefined_map()->set_layout_descriptor(
2523 LayoutDescriptor::FastPointerLayout());
2524 }
2505 2525
2506 null_map()->set_code_cache(empty_fixed_array()); 2526 null_map()->set_code_cache(empty_fixed_array());
2507 null_map()->set_dependent_code(DependentCode::cast(empty_fixed_array())); 2527 null_map()->set_dependent_code(DependentCode::cast(empty_fixed_array()));
2508 null_map()->init_back_pointer(undefined_value()); 2528 null_map()->init_back_pointer(undefined_value());
2509 null_map()->set_instance_descriptors(empty_descriptor_array()); 2529 null_map()->set_instance_descriptors(empty_descriptor_array());
2530 if (FLAG_unbox_double_fields) {
2531 null_map()->set_layout_descriptor(LayoutDescriptor::FastPointerLayout());
2532 }
2510 2533
2511 constant_pool_array_map()->set_code_cache(empty_fixed_array()); 2534 constant_pool_array_map()->set_code_cache(empty_fixed_array());
2512 constant_pool_array_map()->set_dependent_code( 2535 constant_pool_array_map()->set_dependent_code(
2513 DependentCode::cast(empty_fixed_array())); 2536 DependentCode::cast(empty_fixed_array()));
2514 constant_pool_array_map()->init_back_pointer(undefined_value()); 2537 constant_pool_array_map()->init_back_pointer(undefined_value());
2515 constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array()); 2538 constant_pool_array_map()->set_instance_descriptors(empty_descriptor_array());
2539 if (FLAG_unbox_double_fields) {
2540 constant_pool_array_map()->set_layout_descriptor(
2541 LayoutDescriptor::FastPointerLayout());
2542 }
2516 2543
2517 // Fix prototype object for existing maps. 2544 // Fix prototype object for existing maps.
2518 meta_map()->set_prototype(null_value()); 2545 meta_map()->set_prototype(null_value());
2519 meta_map()->set_constructor(null_value()); 2546 meta_map()->set_constructor(null_value());
2520 2547
2521 fixed_array_map()->set_prototype(null_value()); 2548 fixed_array_map()->set_prototype(null_value());
2522 fixed_array_map()->set_constructor(null_value()); 2549 fixed_array_map()->set_constructor(null_value());
2523 2550
2524 undefined_map()->set_prototype(null_value()); 2551 undefined_map()->set_prototype(null_value());
2525 undefined_map()->set_constructor(null_value()); 2552 undefined_map()->set_constructor(null_value());
(...skipping 3889 matching lines...) Expand 10 before | Expand all | Expand 10 after
6415 static_cast<int>(object_sizes_last_time_[index])); 6442 static_cast<int>(object_sizes_last_time_[index]));
6416 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6443 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6417 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6444 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6418 6445
6419 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6446 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6420 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6447 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6421 ClearObjectStats(); 6448 ClearObjectStats();
6422 } 6449 }
6423 6450
6424 } } // namespace v8::internal 6451 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/hydrogen.cc » ('j') | src/mark-compact.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698