OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "api.h" | 8 #include "api.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 | 859 |
860 | 860 |
861 void Heap::MoveElements(FixedArray* array, | 861 void Heap::MoveElements(FixedArray* array, |
862 int dst_index, | 862 int dst_index, |
863 int src_index, | 863 int src_index, |
864 int len) { | 864 int len) { |
865 if (len == 0) return; | 865 if (len == 0) return; |
866 | 866 |
867 ASSERT(array->map() != fixed_cow_array_map()); | 867 ASSERT(array->map() != fixed_cow_array_map()); |
868 Object** dst_objects = array->data_start() + dst_index; | 868 Object** dst_objects = array->data_start() + dst_index; |
869 OS::MemMove(dst_objects, | 869 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); |
870 array->data_start() + src_index, | |
871 len * kPointerSize); | |
872 if (!InNewSpace(array)) { | 870 if (!InNewSpace(array)) { |
873 for (int i = 0; i < len; i++) { | 871 for (int i = 0; i < len; i++) { |
874 // TODO(hpayer): check store buffer for entries | 872 // TODO(hpayer): check store buffer for entries |
875 if (InNewSpace(dst_objects[i])) { | 873 if (InNewSpace(dst_objects[i])) { |
876 RecordWrite(array->address(), array->OffsetOfElementAt(dst_index + i)); | 874 RecordWrite(array->address(), array->OffsetOfElementAt(dst_index + i)); |
877 } | 875 } |
878 } | 876 } |
879 } | 877 } |
880 incremental_marking()->RecordWrites(array); | 878 incremental_marking()->RecordWrites(array); |
881 } | 879 } |
(...skipping 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3849 } | 3847 } |
3850 return result; | 3848 return result; |
3851 } | 3849 } |
3852 | 3850 |
3853 | 3851 |
3854 static inline void WriteOneByteData(Vector<const char> vector, | 3852 static inline void WriteOneByteData(Vector<const char> vector, |
3855 uint8_t* chars, | 3853 uint8_t* chars, |
3856 int len) { | 3854 int len) { |
3857 // Only works for ascii. | 3855 // Only works for ascii. |
3858 ASSERT(vector.length() == len); | 3856 ASSERT(vector.length() == len); |
3859 OS::MemCopy(chars, vector.start(), len); | 3857 MemCopy(chars, vector.start(), len); |
3860 } | 3858 } |
3861 | 3859 |
3862 static inline void WriteTwoByteData(Vector<const char> vector, | 3860 static inline void WriteTwoByteData(Vector<const char> vector, |
3863 uint16_t* chars, | 3861 uint16_t* chars, |
3864 int len) { | 3862 int len) { |
3865 const uint8_t* stream = reinterpret_cast<const uint8_t*>(vector.start()); | 3863 const uint8_t* stream = reinterpret_cast<const uint8_t*>(vector.start()); |
3866 unsigned stream_length = vector.length(); | 3864 unsigned stream_length = vector.length(); |
3867 while (stream_length != 0) { | 3865 while (stream_length != 0) { |
3868 unsigned consumed = 0; | 3866 unsigned consumed = 0; |
3869 uint32_t c = unibrow::Utf8::ValueOf(stream, stream_length, &consumed); | 3867 uint32_t c = unibrow::Utf8::ValueOf(stream, stream_length, &consumed); |
(...skipping 2616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6486 static_cast<int>(object_counts_[index])); \ | 6484 static_cast<int>(object_counts_[index])); \ |
6487 counters->count_of_CODE_AGE_##name()->Decrement( \ | 6485 counters->count_of_CODE_AGE_##name()->Decrement( \ |
6488 static_cast<int>(object_counts_last_time_[index])); \ | 6486 static_cast<int>(object_counts_last_time_[index])); \ |
6489 counters->size_of_CODE_AGE_##name()->Increment( \ | 6487 counters->size_of_CODE_AGE_##name()->Increment( \ |
6490 static_cast<int>(object_sizes_[index])); \ | 6488 static_cast<int>(object_sizes_[index])); \ |
6491 counters->size_of_CODE_AGE_##name()->Decrement( \ | 6489 counters->size_of_CODE_AGE_##name()->Decrement( \ |
6492 static_cast<int>(object_sizes_last_time_[index])); | 6490 static_cast<int>(object_sizes_last_time_[index])); |
6493 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6491 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6494 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6492 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6495 | 6493 |
6496 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6494 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6497 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6495 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6498 ClearObjectStats(); | 6496 ClearObjectStats(); |
6499 } | 6497 } |
6500 | 6498 |
6501 } } // namespace v8::internal | 6499 } } // namespace v8::internal |
OLD | NEW |