| 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 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2520 if (!maybe_obj->ToObject(&obj)) return false; | 2520 if (!maybe_obj->ToObject(&obj)) return false; |
| 2521 } | 2521 } |
| 2522 set_shared_function_info_map(Map::cast(obj)); | 2522 set_shared_function_info_map(Map::cast(obj)); |
| 2523 | 2523 |
| 2524 { MaybeObject* maybe_obj = AllocateMap(JS_MESSAGE_OBJECT_TYPE, | 2524 { MaybeObject* maybe_obj = AllocateMap(JS_MESSAGE_OBJECT_TYPE, |
| 2525 JSMessageObject::kSize); | 2525 JSMessageObject::kSize); |
| 2526 if (!maybe_obj->ToObject(&obj)) return false; | 2526 if (!maybe_obj->ToObject(&obj)) return false; |
| 2527 } | 2527 } |
| 2528 set_message_object_map(Map::cast(obj)); | 2528 set_message_object_map(Map::cast(obj)); |
| 2529 | 2529 |
| 2530 Map* external_map; | |
| 2531 { MaybeObject* maybe_obj = | |
| 2532 AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize + kPointerSize); | |
| 2533 if (!maybe_obj->To(&external_map)) return false; | |
| 2534 } | |
| 2535 external_map->set_is_extensible(false); | |
| 2536 set_external_map(external_map); | |
| 2537 | |
| 2538 ASSERT(!InNewSpace(empty_fixed_array())); | 2530 ASSERT(!InNewSpace(empty_fixed_array())); |
| 2539 return true; | 2531 return true; |
| 2540 } | 2532 } |
| 2541 | 2533 |
| 2542 | 2534 |
| 2543 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) { | 2535 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) { |
| 2544 // Statically ensure that it is safe to allocate heap numbers in paged | 2536 // Statically ensure that it is safe to allocate heap numbers in paged |
| 2545 // spaces. | 2537 // spaces. |
| 2546 STATIC_ASSERT(HeapNumber::kSize <= Page::kNonCodeObjectAreaSize); | 2538 STATIC_ASSERT(HeapNumber::kSize <= Page::kNonCodeObjectAreaSize); |
| 2547 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; | 2539 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; |
| (...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5130 | 5122 |
| 5131 MaybeObject* Heap::AllocateScopeInfo(int length) { | 5123 MaybeObject* Heap::AllocateScopeInfo(int length) { |
| 5132 FixedArray* scope_info; | 5124 FixedArray* scope_info; |
| 5133 MaybeObject* maybe_scope_info = AllocateFixedArray(length, TENURED); | 5125 MaybeObject* maybe_scope_info = AllocateFixedArray(length, TENURED); |
| 5134 if (!maybe_scope_info->To(&scope_info)) return maybe_scope_info; | 5126 if (!maybe_scope_info->To(&scope_info)) return maybe_scope_info; |
| 5135 scope_info->set_map_no_write_barrier(scope_info_map()); | 5127 scope_info->set_map_no_write_barrier(scope_info_map()); |
| 5136 return scope_info; | 5128 return scope_info; |
| 5137 } | 5129 } |
| 5138 | 5130 |
| 5139 | 5131 |
| 5140 MaybeObject* Heap::AllocateExternal(void* value) { | |
| 5141 Foreign* foreign; | |
| 5142 { MaybeObject* maybe_result = AllocateForeign(static_cast<Address>(value)); | |
| 5143 if (!maybe_result->To(&foreign)) return maybe_result; | |
| 5144 } | |
| 5145 JSObject* external; | |
| 5146 { MaybeObject* maybe_result = AllocateJSObjectFromMap(external_map()); | |
| 5147 if (!maybe_result->To(&external)) return maybe_result; | |
| 5148 } | |
| 5149 external->SetInternalField(0, foreign); | |
| 5150 return external; | |
| 5151 } | |
| 5152 | |
| 5153 | |
| 5154 MaybeObject* Heap::AllocateStruct(InstanceType type) { | 5132 MaybeObject* Heap::AllocateStruct(InstanceType type) { |
| 5155 Map* map; | 5133 Map* map; |
| 5156 switch (type) { | 5134 switch (type) { |
| 5157 #define MAKE_CASE(NAME, Name, name) \ | 5135 #define MAKE_CASE(NAME, Name, name) \ |
| 5158 case NAME##_TYPE: map = name##_map(); break; | 5136 case NAME##_TYPE: map = name##_map(); break; |
| 5159 STRUCT_LIST(MAKE_CASE) | 5137 STRUCT_LIST(MAKE_CASE) |
| 5160 #undef MAKE_CASE | 5138 #undef MAKE_CASE |
| 5161 default: | 5139 default: |
| 5162 UNREACHABLE(); | 5140 UNREACHABLE(); |
| 5163 return Failure::InternalError(); | 5141 return Failure::InternalError(); |
| (...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7413 static_cast<int>(object_sizes_last_time_[index])); | 7391 static_cast<int>(object_sizes_last_time_[index])); |
| 7414 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7392 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7415 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7393 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7416 | 7394 |
| 7417 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7395 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7418 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7396 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7419 ClearObjectStats(); | 7397 ClearObjectStats(); |
| 7420 } | 7398 } |
| 7421 | 7399 |
| 7422 } } // namespace v8::internal | 7400 } } // namespace v8::internal |
| OLD | NEW |