| 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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 bool Heap::CreateInitialMaps() { | 2375 bool Heap::CreateInitialMaps() { |
| 2376 HeapObject* obj; | 2376 HeapObject* obj; |
| 2377 { AllocationResult allocation = AllocatePartialMap(MAP_TYPE, Map::kSize); | 2377 { AllocationResult allocation = AllocatePartialMap(MAP_TYPE, Map::kSize); |
| 2378 if (!allocation.To(&obj)) return false; | 2378 if (!allocation.To(&obj)) return false; |
| 2379 } | 2379 } |
| 2380 // Map::cast cannot be used due to uninitialized map field. | 2380 // Map::cast cannot be used due to uninitialized map field. |
| 2381 Map* new_meta_map = reinterpret_cast<Map*>(obj); | 2381 Map* new_meta_map = reinterpret_cast<Map*>(obj); |
| 2382 set_meta_map(new_meta_map); | 2382 set_meta_map(new_meta_map); |
| 2383 new_meta_map->set_map(new_meta_map); | 2383 new_meta_map->set_map(new_meta_map); |
| 2384 | 2384 |
| 2385 { // Partial map allocation | 2385 { // Partial map allocation |
| 2386 #define ALLOCATE_PARTIAL_MAP(instance_type, size, field_name) \ | 2386 #define ALLOCATE_PARTIAL_MAP(instance_type, size, field_name) \ |
| 2387 { Map* map; \ | 2387 { Map* map; \ |
| 2388 if (!AllocatePartialMap((instance_type), (size)).To(&map)) return false; \ | 2388 if (!AllocatePartialMap((instance_type), (size)).To(&map)) return false; \ |
| 2389 set_##field_name##_map(map); \ | 2389 set_##field_name##_map(map); \ |
| 2390 } | 2390 } |
| 2391 | 2391 |
| 2392 ALLOCATE_PARTIAL_MAP(FIXED_ARRAY_TYPE, kVariableSizeSentinel, fixed_array); | 2392 ALLOCATE_PARTIAL_MAP(FIXED_ARRAY_TYPE, kVariableSizeSentinel, fixed_array); |
| 2393 ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, undefined); | 2393 ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, undefined); |
| 2394 ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, null); | 2394 ALLOCATE_PARTIAL_MAP(ODDBALL_TYPE, Oddball::kSize, null); |
| 2395 ALLOCATE_PARTIAL_MAP(CONSTANT_POOL_ARRAY_TYPE, kVariableSizeSentinel, | 2395 ALLOCATE_PARTIAL_MAP(CONSTANT_POOL_ARRAY_TYPE, kVariableSizeSentinel, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 | 2469 |
| 2470 undefined_map()->set_prototype(null_value()); | 2470 undefined_map()->set_prototype(null_value()); |
| 2471 undefined_map()->set_constructor(null_value()); | 2471 undefined_map()->set_constructor(null_value()); |
| 2472 | 2472 |
| 2473 null_map()->set_prototype(null_value()); | 2473 null_map()->set_prototype(null_value()); |
| 2474 null_map()->set_constructor(null_value()); | 2474 null_map()->set_constructor(null_value()); |
| 2475 | 2475 |
| 2476 constant_pool_array_map()->set_prototype(null_value()); | 2476 constant_pool_array_map()->set_prototype(null_value()); |
| 2477 constant_pool_array_map()->set_constructor(null_value()); | 2477 constant_pool_array_map()->set_constructor(null_value()); |
| 2478 | 2478 |
| 2479 { // Map allocation | 2479 { // Map allocation |
| 2480 #define ALLOCATE_MAP(instance_type, size, field_name) \ | 2480 #define ALLOCATE_MAP(instance_type, size, field_name) \ |
| 2481 { Map* map; \ | 2481 { Map* map; \ |
| 2482 if (!AllocateMap((instance_type), size).To(&map)) return false; \ | 2482 if (!AllocateMap((instance_type), size).To(&map)) return false; \ |
| 2483 set_##field_name##_map(map); \ | 2483 set_##field_name##_map(map); \ |
| 2484 } | 2484 } |
| 2485 | 2485 |
| 2486 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ | 2486 #define ALLOCATE_VARSIZE_MAP(instance_type, field_name) \ |
| 2487 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) | 2487 ALLOCATE_MAP(instance_type, kVariableSizeSentinel, field_name) |
| 2488 | 2488 |
| 2489 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) | 2489 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, fixed_cow_array) |
| (...skipping 3946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6436 static_cast<int>(object_sizes_last_time_[index])); | 6436 static_cast<int>(object_sizes_last_time_[index])); |
| 6437 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6437 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6438 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6438 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6439 | 6439 |
| 6440 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6440 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6441 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6441 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6442 ClearObjectStats(); | 6442 ClearObjectStats(); |
| 6443 } | 6443 } |
| 6444 | 6444 |
| 6445 } } // namespace v8::internal | 6445 } } // namespace v8::internal |
| OLD | NEW |