OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); | 1864 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
1865 if (!maybe_obj->ToObject(&obj)) return false; | 1865 if (!maybe_obj->ToObject(&obj)) return false; |
1866 } | 1866 } |
1867 set_fixed_cow_array_map(Map::cast(obj)); | 1867 set_fixed_cow_array_map(Map::cast(obj)); |
1868 ASSERT(fixed_array_map() != fixed_cow_array_map()); | 1868 ASSERT(fixed_array_map() != fixed_cow_array_map()); |
1869 | 1869 |
1870 { MaybeObject* maybe_obj = | 1870 { MaybeObject* maybe_obj = |
1871 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); | 1871 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
1872 if (!maybe_obj->ToObject(&obj)) return false; | 1872 if (!maybe_obj->ToObject(&obj)) return false; |
1873 } | 1873 } |
1874 set_serialized_scope_info_map(Map::cast(obj)); | 1874 set_scope_info_map(Map::cast(obj)); |
1875 | 1875 |
1876 { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); | 1876 { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); |
1877 if (!maybe_obj->ToObject(&obj)) return false; | 1877 if (!maybe_obj->ToObject(&obj)) return false; |
1878 } | 1878 } |
1879 set_heap_number_map(Map::cast(obj)); | 1879 set_heap_number_map(Map::cast(obj)); |
1880 | 1880 |
1881 { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize); | 1881 { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize); |
1882 if (!maybe_obj->ToObject(&obj)) return false; | 1882 if (!maybe_obj->ToObject(&obj)) return false; |
1883 } | 1883 } |
1884 set_foreign_map(Map::cast(obj)); | 1884 set_foreign_map(Map::cast(obj)); |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 | 2639 |
2640 MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) { | 2640 MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) { |
2641 SharedFunctionInfo* share; | 2641 SharedFunctionInfo* share; |
2642 MaybeObject* maybe = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); | 2642 MaybeObject* maybe = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); |
2643 if (!maybe->To<SharedFunctionInfo>(&share)) return maybe; | 2643 if (!maybe->To<SharedFunctionInfo>(&share)) return maybe; |
2644 | 2644 |
2645 // Set pointer fields. | 2645 // Set pointer fields. |
2646 share->set_name(name); | 2646 share->set_name(name); |
2647 Code* illegal = isolate_->builtins()->builtin(Builtins::kIllegal); | 2647 Code* illegal = isolate_->builtins()->builtin(Builtins::kIllegal); |
2648 share->set_code(illegal); | 2648 share->set_code(illegal); |
2649 share->set_scope_info(SerializedScopeInfo::Empty()); | 2649 share->set_scope_info(ScopeInfo::Empty()); |
2650 Code* construct_stub = | 2650 Code* construct_stub = |
2651 isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric); | 2651 isolate_->builtins()->builtin(Builtins::kJSConstructStubGeneric); |
2652 share->set_construct_stub(construct_stub); | 2652 share->set_construct_stub(construct_stub); |
2653 share->set_instance_class_name(Object_symbol()); | 2653 share->set_instance_class_name(Object_symbol()); |
2654 share->set_function_data(undefined_value()); | 2654 share->set_function_data(undefined_value()); |
2655 share->set_script(undefined_value()); | 2655 share->set_script(undefined_value()); |
2656 share->set_debug_info(undefined_value()); | 2656 share->set_debug_info(undefined_value()); |
2657 share->set_inferred_name(empty_string()); | 2657 share->set_inferred_name(empty_string()); |
2658 share->set_initial_map(undefined_value()); | 2658 share->set_initial_map(undefined_value()); |
2659 share->set_this_property_assignments(undefined_value()); | 2659 share->set_this_property_assignments(undefined_value()); |
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4387 context->set_closure(function); | 4387 context->set_closure(function); |
4388 context->set_previous(previous); | 4388 context->set_previous(previous); |
4389 context->set_extension(extension); | 4389 context->set_extension(extension); |
4390 context->set_global(previous->global()); | 4390 context->set_global(previous->global()); |
4391 return context; | 4391 return context; |
4392 } | 4392 } |
4393 | 4393 |
4394 | 4394 |
4395 MaybeObject* Heap::AllocateBlockContext(JSFunction* function, | 4395 MaybeObject* Heap::AllocateBlockContext(JSFunction* function, |
4396 Context* previous, | 4396 Context* previous, |
4397 SerializedScopeInfo* scope_info) { | 4397 ScopeInfo* scope_info) { |
4398 Object* result; | 4398 Object* result; |
4399 { MaybeObject* maybe_result = | 4399 { MaybeObject* maybe_result = |
4400 AllocateFixedArrayWithHoles(scope_info->NumberOfContextSlots()); | 4400 AllocateFixedArrayWithHoles(scope_info->ContextLength()); |
4401 if (!maybe_result->ToObject(&result)) return maybe_result; | 4401 if (!maybe_result->ToObject(&result)) return maybe_result; |
4402 } | 4402 } |
4403 Context* context = reinterpret_cast<Context*>(result); | 4403 Context* context = reinterpret_cast<Context*>(result); |
4404 context->set_map(block_context_map()); | 4404 context->set_map(block_context_map()); |
4405 context->set_closure(function); | 4405 context->set_closure(function); |
4406 context->set_previous(previous); | 4406 context->set_previous(previous); |
4407 context->set_extension(scope_info); | 4407 context->set_extension(scope_info); |
4408 context->set_global(previous->global()); | 4408 context->set_global(previous->global()); |
4409 return context; | 4409 return context; |
4410 } | 4410 } |
4411 | 4411 |
4412 | 4412 |
4413 MaybeObject* Heap::AllocateSerializedScopeInfo(int length) { | 4413 MaybeObject* Heap::AllocateScopeInfo(int length) { |
4414 Object* result; | 4414 Object* result; |
4415 { MaybeObject* maybe_result = AllocateFixedArray(length, TENURED); | 4415 { MaybeObject* maybe_result = AllocateFixedArray(length, TENURED); |
4416 if (!maybe_result->ToObject(&result)) return maybe_result; | 4416 if (!maybe_result->ToObject(&result)) return maybe_result; |
4417 } | 4417 } |
4418 SerializedScopeInfo* scope_info = | 4418 ScopeInfo* scope_info = reinterpret_cast<ScopeInfo*>(result); |
4419 reinterpret_cast<SerializedScopeInfo*>(result); | 4419 scope_info->set_map(scope_info_map()); |
4420 scope_info->set_map(serialized_scope_info_map()); | |
4421 return scope_info; | 4420 return scope_info; |
4422 } | 4421 } |
4423 | 4422 |
4424 | 4423 |
4425 MaybeObject* Heap::AllocateStruct(InstanceType type) { | 4424 MaybeObject* Heap::AllocateStruct(InstanceType type) { |
4426 Map* map; | 4425 Map* map; |
4427 switch (type) { | 4426 switch (type) { |
4428 #define MAKE_CASE(NAME, Name, name) \ | 4427 #define MAKE_CASE(NAME, Name, name) \ |
4429 case NAME##_TYPE: map = name##_map(); break; | 4428 case NAME##_TYPE: map = name##_map(); break; |
4430 STRUCT_LIST(MAKE_CASE) | 4429 STRUCT_LIST(MAKE_CASE) |
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6409 isolate_->heap()->store_buffer()->Compact(); | 6408 isolate_->heap()->store_buffer()->Compact(); |
6410 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6409 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6411 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6410 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6412 next = chunk->next_chunk(); | 6411 next = chunk->next_chunk(); |
6413 isolate_->memory_allocator()->Free(chunk); | 6412 isolate_->memory_allocator()->Free(chunk); |
6414 } | 6413 } |
6415 chunks_queued_for_free_ = NULL; | 6414 chunks_queued_for_free_ = NULL; |
6416 } | 6415 } |
6417 | 6416 |
6418 } } // namespace v8::internal | 6417 } } // namespace v8::internal |
OLD | NEW |