| OLD | NEW |
| 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 4403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4414 // JSFunctions should be allocated using AllocateFunction to be | 4414 // JSFunctions should be allocated using AllocateFunction to be |
| 4415 // properly initialized. | 4415 // properly initialized. |
| 4416 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); | 4416 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
| 4417 | 4417 |
| 4418 // Both types of global objects should be allocated using | 4418 // Both types of global objects should be allocated using |
| 4419 // AllocateGlobalObject to be properly initialized. | 4419 // AllocateGlobalObject to be properly initialized. |
| 4420 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); | 4420 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
| 4421 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); | 4421 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
| 4422 | 4422 |
| 4423 // Allocate the backing storage for the properties. | 4423 // Allocate the backing storage for the properties. |
| 4424 int prop_size = map->InitialPropertiesLength(); | 4424 int prop_size = |
| 4425 map->pre_allocated_property_fields() + |
| 4426 map->unused_property_fields() - |
| 4427 map->inobject_properties(); |
| 4425 ASSERT(prop_size >= 0); | 4428 ASSERT(prop_size >= 0); |
| 4426 Object* properties; | 4429 Object* properties; |
| 4427 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size, pretenure); | 4430 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size, pretenure); |
| 4428 if (!maybe_properties->ToObject(&properties)) return maybe_properties; | 4431 if (!maybe_properties->ToObject(&properties)) return maybe_properties; |
| 4429 } | 4432 } |
| 4430 | 4433 |
| 4431 // Allocate the JSObject. | 4434 // Allocate the JSObject. |
| 4432 AllocationSpace space = | 4435 AllocationSpace space = |
| 4433 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE; | 4436 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE; |
| 4434 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; | 4437 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4451 // JSFunctions should be allocated using AllocateFunction to be | 4454 // JSFunctions should be allocated using AllocateFunction to be |
| 4452 // properly initialized. | 4455 // properly initialized. |
| 4453 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); | 4456 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
| 4454 | 4457 |
| 4455 // Both types of global objects should be allocated using | 4458 // Both types of global objects should be allocated using |
| 4456 // AllocateGlobalObject to be properly initialized. | 4459 // AllocateGlobalObject to be properly initialized. |
| 4457 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); | 4460 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
| 4458 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); | 4461 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
| 4459 | 4462 |
| 4460 // Allocate the backing storage for the properties. | 4463 // Allocate the backing storage for the properties. |
| 4461 int prop_size = map->InitialPropertiesLength(); | 4464 int prop_size = |
| 4465 map->pre_allocated_property_fields() + |
| 4466 map->unused_property_fields() - |
| 4467 map->inobject_properties(); |
| 4462 ASSERT(prop_size >= 0); | 4468 ASSERT(prop_size >= 0); |
| 4463 Object* properties; | 4469 Object* properties; |
| 4464 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); | 4470 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); |
| 4465 if (!maybe_properties->ToObject(&properties)) return maybe_properties; | 4471 if (!maybe_properties->ToObject(&properties)) return maybe_properties; |
| 4466 } | 4472 } |
| 4467 | 4473 |
| 4468 // Allocate the JSObject. | 4474 // Allocate the JSObject. |
| 4469 AllocationSpace space = NEW_SPACE; | 4475 AllocationSpace space = NEW_SPACE; |
| 4470 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; | 4476 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; |
| 4471 Object* obj; | 4477 Object* obj; |
| (...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6638 // generation size. | 6644 // generation size. |
| 6639 if (max_executable_size_ > max_old_generation_size_) { | 6645 if (max_executable_size_ > max_old_generation_size_) { |
| 6640 max_executable_size_ = max_old_generation_size_; | 6646 max_executable_size_ = max_old_generation_size_; |
| 6641 } | 6647 } |
| 6642 | 6648 |
| 6643 // The new space size must be a power of two to support single-bit testing | 6649 // The new space size must be a power of two to support single-bit testing |
| 6644 // for containment. | 6650 // for containment. |
| 6645 max_semispace_size_ = RoundUpToPowerOf2(max_semispace_size_); | 6651 max_semispace_size_ = RoundUpToPowerOf2(max_semispace_size_); |
| 6646 reserved_semispace_size_ = RoundUpToPowerOf2(reserved_semispace_size_); | 6652 reserved_semispace_size_ = RoundUpToPowerOf2(reserved_semispace_size_); |
| 6647 initial_semispace_size_ = Min(initial_semispace_size_, max_semispace_size_); | 6653 initial_semispace_size_ = Min(initial_semispace_size_, max_semispace_size_); |
| 6648 external_allocation_limit_ = 16 * max_semispace_size_; | 6654 |
| 6655 // The external allocation limit should be below 256 MB on all architectures |
| 6656 // to avoid unnecessary low memory notifications, as that is the threshold |
| 6657 // for some embedders. |
| 6658 external_allocation_limit_ = 12 * max_semispace_size_; |
| 6659 ASSERT(external_allocation_limit_ <= 256 * MB); |
| 6649 | 6660 |
| 6650 // The old generation is paged and needs at least one page for each space. | 6661 // The old generation is paged and needs at least one page for each space. |
| 6651 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; | 6662 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; |
| 6652 max_old_generation_size_ = Max(static_cast<intptr_t>(paged_space_count * | 6663 max_old_generation_size_ = Max(static_cast<intptr_t>(paged_space_count * |
| 6653 Page::kPageSize), | 6664 Page::kPageSize), |
| 6654 RoundUp(max_old_generation_size_, | 6665 RoundUp(max_old_generation_size_, |
| 6655 Page::kPageSize)); | 6666 Page::kPageSize)); |
| 6656 | 6667 |
| 6657 configured_ = true; | 6668 configured_ = true; |
| 6658 return true; | 6669 return true; |
| (...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8097 if (FLAG_parallel_recompilation) { | 8108 if (FLAG_parallel_recompilation) { |
| 8098 heap_->relocation_mutex_->Lock(); | 8109 heap_->relocation_mutex_->Lock(); |
| 8099 #ifdef DEBUG | 8110 #ifdef DEBUG |
| 8100 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8111 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 8101 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8112 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 8102 #endif // DEBUG | 8113 #endif // DEBUG |
| 8103 } | 8114 } |
| 8104 } | 8115 } |
| 8105 | 8116 |
| 8106 } } // namespace v8::internal | 8117 } } // namespace v8::internal |
| OLD | NEW |