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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 | 854 |
855 | 855 |
856 void Heap::MoveElements(FixedArray* array, | 856 void Heap::MoveElements(FixedArray* array, |
857 int dst_index, | 857 int dst_index, |
858 int src_index, | 858 int src_index, |
859 int len) { | 859 int len) { |
860 if (len == 0) return; | 860 if (len == 0) return; |
861 | 861 |
862 ASSERT(array->map() != fixed_cow_array_map()); | 862 ASSERT(array->map() != fixed_cow_array_map()); |
863 Object** dst_objects = array->data_start() + dst_index; | 863 Object** dst_objects = array->data_start() + dst_index; |
864 OS::MemMove(dst_objects, | 864 MemMove(dst_objects, array->data_start() + src_index, len * kPointerSize); |
865 array->data_start() + src_index, | |
866 len * kPointerSize); | |
867 if (!InNewSpace(array)) { | 865 if (!InNewSpace(array)) { |
868 for (int i = 0; i < len; i++) { | 866 for (int i = 0; i < len; i++) { |
869 // TODO(hpayer): check store buffer for entries | 867 // TODO(hpayer): check store buffer for entries |
870 if (InNewSpace(dst_objects[i])) { | 868 if (InNewSpace(dst_objects[i])) { |
871 RecordWrite(array->address(), array->OffsetOfElementAt(dst_index + i)); | 869 RecordWrite(array->address(), array->OffsetOfElementAt(dst_index + i)); |
872 } | 870 } |
873 } | 871 } |
874 } | 872 } |
875 incremental_marking()->RecordWrites(array); | 873 incremental_marking()->RecordWrites(array); |
876 } | 874 } |
(...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3781 } | 3779 } |
3782 return result; | 3780 return result; |
3783 } | 3781 } |
3784 | 3782 |
3785 | 3783 |
3786 static inline void WriteOneByteData(Vector<const char> vector, | 3784 static inline void WriteOneByteData(Vector<const char> vector, |
3787 uint8_t* chars, | 3785 uint8_t* chars, |
3788 int len) { | 3786 int len) { |
3789 // Only works for ascii. | 3787 // Only works for ascii. |
3790 ASSERT(vector.length() == len); | 3788 ASSERT(vector.length() == len); |
3791 OS::MemCopy(chars, vector.start(), len); | 3789 MemCopy(chars, vector.start(), len); |
3792 } | 3790 } |
3793 | 3791 |
3794 static inline void WriteTwoByteData(Vector<const char> vector, | 3792 static inline void WriteTwoByteData(Vector<const char> vector, |
3795 uint16_t* chars, | 3793 uint16_t* chars, |
3796 int len) { | 3794 int len) { |
3797 const uint8_t* stream = reinterpret_cast<const uint8_t*>(vector.start()); | 3795 const uint8_t* stream = reinterpret_cast<const uint8_t*>(vector.start()); |
3798 unsigned stream_length = vector.length(); | 3796 unsigned stream_length = vector.length(); |
3799 while (stream_length != 0) { | 3797 while (stream_length != 0) { |
3800 unsigned consumed = 0; | 3798 unsigned consumed = 0; |
3801 uint32_t c = unibrow::Utf8::ValueOf(stream, stream_length, &consumed); | 3799 uint32_t c = unibrow::Utf8::ValueOf(stream, stream_length, &consumed); |
(...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6417 static_cast<int>(object_counts_[index])); \ | 6415 static_cast<int>(object_counts_[index])); \ |
6418 counters->count_of_CODE_AGE_##name()->Decrement( \ | 6416 counters->count_of_CODE_AGE_##name()->Decrement( \ |
6419 static_cast<int>(object_counts_last_time_[index])); \ | 6417 static_cast<int>(object_counts_last_time_[index])); \ |
6420 counters->size_of_CODE_AGE_##name()->Increment( \ | 6418 counters->size_of_CODE_AGE_##name()->Increment( \ |
6421 static_cast<int>(object_sizes_[index])); \ | 6419 static_cast<int>(object_sizes_[index])); \ |
6422 counters->size_of_CODE_AGE_##name()->Decrement( \ | 6420 counters->size_of_CODE_AGE_##name()->Decrement( \ |
6423 static_cast<int>(object_sizes_last_time_[index])); | 6421 static_cast<int>(object_sizes_last_time_[index])); |
6424 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6422 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6425 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6423 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6426 | 6424 |
6427 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6425 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6428 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6426 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6429 ClearObjectStats(); | 6427 ClearObjectStats(); |
6430 } | 6428 } |
6431 | 6429 |
6432 } } // namespace v8::internal | 6430 } } // namespace v8::internal |
OLD | NEW |