Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: src/heap.cc

Issue 238113003: Use a wrapper for copying object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4772 matching lines...) Expand 10 before | Expand all | Expand 10 after
4783 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 4783 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
4784 } 4784 }
4785 4785
4786 reinterpret_cast<FixedArray*>(obj)->set_map_no_write_barrier( 4786 reinterpret_cast<FixedArray*>(obj)->set_map_no_write_barrier(
4787 fixed_array_map()); 4787 fixed_array_map());
4788 FixedArray::cast(obj)->set_length(length); 4788 FixedArray::cast(obj)->set_length(length);
4789 return obj; 4789 return obj;
4790 } 4790 }
4791 4791
4792 4792
4793 MaybeObject* Heap::AllocateEmptyFixedDoubleArray() {
4794 int size = FixedDoubleArray::SizeFor(0);
4795 Object* result;
4796 { MaybeObject* maybe_result =
4797 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE);
4798 if (!maybe_result->ToObject(&result)) return maybe_result;
4799 }
4800 // Initialize the object.
4801 reinterpret_cast<FixedDoubleArray*>(result)->set_map_no_write_barrier(
4802 fixed_double_array_map());
4803 reinterpret_cast<FixedDoubleArray*>(result)->set_length(0);
4804 return result;
4805 }
4806
4807
4808 MaybeObject* Heap::AllocateUninitializedFixedDoubleArray( 4793 MaybeObject* Heap::AllocateUninitializedFixedDoubleArray(
4809 int length, 4794 int length,
4810 PretenureFlag pretenure) { 4795 PretenureFlag pretenure) {
4811 if (length == 0) return empty_fixed_array(); 4796 if (length == 0) return empty_fixed_array();
4812 4797
4813 Object* elements_object; 4798 Object* elements_object;
4814 MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure); 4799 MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure);
4815 if (!maybe_obj->ToObject(&elements_object)) return maybe_obj; 4800 if (!maybe_obj->ToObject(&elements_object)) return maybe_obj;
4816 FixedDoubleArray* elements = 4801 FixedDoubleArray* elements =
4817 reinterpret_cast<FixedDoubleArray*>(elements_object); 4802 reinterpret_cast<FixedDoubleArray*>(elements_object);
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
7173 static_cast<int>(object_sizes_last_time_[index])); 7158 static_cast<int>(object_sizes_last_time_[index]));
7174 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 7159 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
7175 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7160 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7176 7161
7177 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7162 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7178 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7163 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7179 ClearObjectStats(); 7164 ClearObjectStats();
7180 } 7165 }
7181 7166
7182 } } // namespace v8::internal 7167 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698