| 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 4494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4505 // Initialize the JSObject. | 4505 // Initialize the JSObject. |
| 4506 InitializeJSObjectFromMap(JSObject::cast(obj), | 4506 InitializeJSObjectFromMap(JSObject::cast(obj), |
| 4507 FixedArray::cast(properties), | 4507 FixedArray::cast(properties), |
| 4508 map); | 4508 map); |
| 4509 ASSERT(JSObject::cast(obj)->HasFastElements() || | 4509 ASSERT(JSObject::cast(obj)->HasFastElements() || |
| 4510 JSObject::cast(obj)->HasExternalArrayElements()); | 4510 JSObject::cast(obj)->HasExternalArrayElements()); |
| 4511 return obj; | 4511 return obj; |
| 4512 } | 4512 } |
| 4513 | 4513 |
| 4514 | 4514 |
| 4515 MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite(Map* map, | 4515 MaybeObject* Heap::AllocateJSObjectFromMapForDeoptimizer( |
| 4516 Handle<AllocationSite> allocation_site) { | 4516 Map* map, PretenureFlag pretenure) { |
| 4517 // JSFunctions should be allocated using AllocateFunction to be | 4517 // JSFunctions should be allocated using AllocateFunction to be |
| 4518 // properly initialized. | 4518 // properly initialized. |
| 4519 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); | 4519 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
| 4520 |
| 4521 // Both types of global objects should be allocated using |
| 4522 // AllocateGlobalObject to be properly initialized. |
| 4523 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
| 4524 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
| 4525 |
| 4526 // Allocate the JSObject. |
| 4527 AllocationSpace space = |
| 4528 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE; |
| 4529 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; |
| 4530 Object* obj; |
| 4531 MaybeObject* maybe_obj = Allocate(map, space); |
| 4532 if (!maybe_obj->To(&obj)) return maybe_obj; |
| 4533 |
| 4534 // Initialize the JSObject. |
| 4535 InitializeJSObjectFromMap(JSObject::cast(obj), |
| 4536 empty_fixed_array(), |
| 4537 map); |
| 4538 ASSERT(JSObject::cast(obj)->HasFastElements() || |
| 4539 JSObject::cast(obj)->HasExternalArrayElements()); |
| 4540 return obj; |
| 4541 } |
| 4542 |
| 4543 |
| 4544 MaybeObject* Heap::AllocateJSObjectFromMapWithAllocationSite( |
| 4545 Map* map, Handle<AllocationSite> allocation_site) { |
| 4546 // JSFunctions should be allocated using AllocateFunction to be |
| 4547 // properly initialized. |
| 4548 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
| 4520 | 4549 |
| 4521 // Both types of global objects should be allocated using | 4550 // Both types of global objects should be allocated using |
| 4522 // AllocateGlobalObject to be properly initialized. | 4551 // AllocateGlobalObject to be properly initialized. |
| 4523 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); | 4552 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
| 4524 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); | 4553 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
| 4525 | 4554 |
| 4526 // Allocate the backing storage for the properties. | 4555 // Allocate the backing storage for the properties. |
| 4527 int prop_size = map->InitialPropertiesLength(); | 4556 int prop_size = map->InitialPropertiesLength(); |
| 4528 ASSERT(prop_size >= 0); | 4557 ASSERT(prop_size >= 0); |
| 4529 Object* properties; | 4558 Object* properties; |
| (...skipping 3501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8031 if (FLAG_parallel_recompilation) { | 8060 if (FLAG_parallel_recompilation) { |
| 8032 heap_->relocation_mutex_->Lock(); | 8061 heap_->relocation_mutex_->Lock(); |
| 8033 #ifdef DEBUG | 8062 #ifdef DEBUG |
| 8034 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8063 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 8035 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8064 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 8036 #endif // DEBUG | 8065 #endif // DEBUG |
| 8037 } | 8066 } |
| 8038 } | 8067 } |
| 8039 | 8068 |
| 8040 } } // namespace v8::internal | 8069 } } // namespace v8::internal |
| OLD | NEW |