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 4629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4640 } | 4640 } |
4641 } | 4641 } |
4642 if (!maybe_elms->To(&elms)) return maybe_elms; | 4642 if (!maybe_elms->To(&elms)) return maybe_elms; |
4643 | 4643 |
4644 array->set_elements(elms); | 4644 array->set_elements(elms); |
4645 array->set_length(Smi::FromInt(length)); | 4645 array->set_length(Smi::FromInt(length)); |
4646 return array; | 4646 return array; |
4647 } | 4647 } |
4648 | 4648 |
4649 | 4649 |
4650 MaybeObject* Heap::AllocateJSArrayWithElements( | |
4651 FixedArrayBase* elements, | |
4652 ElementsKind elements_kind, | |
4653 int length, | |
4654 PretenureFlag pretenure) { | |
4655 MaybeObject* maybe_array = AllocateJSArray(elements_kind, pretenure); | |
4656 JSArray* array; | |
4657 if (!maybe_array->To(&array)) return maybe_array; | |
4658 | |
4659 array->set_elements(elements); | |
4660 array->set_length(Smi::FromInt(length)); | |
4661 array->ValidateElements(); | |
4662 return array; | |
4663 } | |
4664 | |
4665 | |
4666 MaybeObject* Heap::AllocateJSProxy(Object* handler, Object* prototype) { | 4650 MaybeObject* Heap::AllocateJSProxy(Object* handler, Object* prototype) { |
4667 // Allocate map. | 4651 // Allocate map. |
4668 // TODO(rossberg): Once we optimize proxies, think about a scheme to share | 4652 // TODO(rossberg): Once we optimize proxies, think about a scheme to share |
4669 // maps. Will probably depend on the identity of the handler object, too. | 4653 // maps. Will probably depend on the identity of the handler object, too. |
4670 Map* map; | 4654 Map* map; |
4671 MaybeObject* maybe_map_obj = AllocateMap(JS_PROXY_TYPE, JSProxy::kSize); | 4655 MaybeObject* maybe_map_obj = AllocateMap(JS_PROXY_TYPE, JSProxy::kSize); |
4672 if (!maybe_map_obj->To<Map>(&map)) return maybe_map_obj; | 4656 if (!maybe_map_obj->To<Map>(&map)) return maybe_map_obj; |
4673 map->set_prototype(prototype); | 4657 map->set_prototype(prototype); |
4674 | 4658 |
4675 // Allocate the proxy object. | 4659 // Allocate the proxy object. |
(...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7865 static_cast<int>(object_sizes_last_time_[index])); | 7849 static_cast<int>(object_sizes_last_time_[index])); |
7866 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7850 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
7867 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7851 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7868 | 7852 |
7869 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7853 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7870 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7854 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7871 ClearObjectStats(); | 7855 ClearObjectStats(); |
7872 } | 7856 } |
7873 | 7857 |
7874 } } // namespace v8::internal | 7858 } } // namespace v8::internal |
OLD | NEW |