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

Side by Side Diff: src/heap/heap.cc

Issue 1128433006: Make sure fixed typed array is always double aligned for doubles (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/globals.h ('k') | src/hydrogen.cc » ('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 // 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 AllocationResult allocation = AllocateMap(EXTERNAL_ONE_BYTE_STRING_TYPE, 2704 AllocationResult allocation = AllocateMap(EXTERNAL_ONE_BYTE_STRING_TYPE,
2705 ExternalOneByteString::kSize); 2705 ExternalOneByteString::kSize);
2706 if (!allocation.To(&obj)) return false; 2706 if (!allocation.To(&obj)) return false;
2707 set_native_source_string_map(Map::cast(obj)); 2707 set_native_source_string_map(Map::cast(obj));
2708 } 2708 }
2709 2709
2710 ALLOCATE_VARSIZE_MAP(FIXED_DOUBLE_ARRAY_TYPE, fixed_double_array) 2710 ALLOCATE_VARSIZE_MAP(FIXED_DOUBLE_ARRAY_TYPE, fixed_double_array)
2711 ALLOCATE_VARSIZE_MAP(BYTE_ARRAY_TYPE, byte_array) 2711 ALLOCATE_VARSIZE_MAP(BYTE_ARRAY_TYPE, byte_array)
2712 ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space) 2712 ALLOCATE_VARSIZE_MAP(FREE_SPACE_TYPE, free_space)
2713 2713
2714 #define ALLOCATE_EXTERNAL_ARRAY_MAP(Type, type, TYPE, ctype, size) \ 2714 #define ALLOCATE_EXTERNAL_ARRAY_MAP(Type, type, TYPE, ctype, size) \
2715 ALLOCATE_MAP(EXTERNAL_##TYPE##_ARRAY_TYPE, ExternalArray::kAlignedSize, \ 2715 ALLOCATE_MAP(EXTERNAL_##TYPE##_ARRAY_TYPE, ExternalArray::kSize, \
2716 external_##type##_array) 2716 external_##type##_array)
2717 2717
2718 TYPED_ARRAYS(ALLOCATE_EXTERNAL_ARRAY_MAP) 2718 TYPED_ARRAYS(ALLOCATE_EXTERNAL_ARRAY_MAP)
2719 #undef ALLOCATE_EXTERNAL_ARRAY_MAP 2719 #undef ALLOCATE_EXTERNAL_ARRAY_MAP
2720 2720
2721 #define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \ 2721 #define ALLOCATE_FIXED_TYPED_ARRAY_MAP(Type, type, TYPE, ctype, size) \
2722 ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array) 2722 ALLOCATE_VARSIZE_MAP(FIXED_##TYPE##_ARRAY_TYPE, fixed_##type##_array)
2723 2723
2724 TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP) 2724 TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP)
2725 #undef ALLOCATE_FIXED_TYPED_ARRAY_MAP 2725 #undef ALLOCATE_FIXED_TYPED_ARRAY_MAP
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
3609 if (profiler->is_tracking_allocations()) { 3609 if (profiler->is_tracking_allocations()) {
3610 profiler->UpdateObjectSizeEvent(object->address(), object->Size()); 3610 profiler->UpdateObjectSizeEvent(object->address(), object->Size());
3611 } 3611 }
3612 } 3612 }
3613 3613
3614 3614
3615 AllocationResult Heap::AllocateExternalArray(int length, 3615 AllocationResult Heap::AllocateExternalArray(int length,
3616 ExternalArrayType array_type, 3616 ExternalArrayType array_type,
3617 void* external_pointer, 3617 void* external_pointer,
3618 PretenureFlag pretenure) { 3618 PretenureFlag pretenure) {
3619 int size = ExternalArray::kAlignedSize; 3619 int size = ExternalArray::kSize;
3620 AllocationSpace space = SelectSpace(size, pretenure); 3620 AllocationSpace space = SelectSpace(size, pretenure);
3621 HeapObject* result; 3621 HeapObject* result;
3622 { 3622 {
3623 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE); 3623 AllocationResult allocation = AllocateRaw(size, space, OLD_SPACE);
3624 if (!allocation.To(&result)) return allocation; 3624 if (!allocation.To(&result)) return allocation;
3625 } 3625 }
3626 3626
3627 result->set_map_no_write_barrier(MapForExternalArrayType(array_type)); 3627 result->set_map_no_write_barrier(MapForExternalArrayType(array_type));
3628 ExternalArray::cast(result)->set_length(length); 3628 ExternalArray::cast(result)->set_length(length);
3629 ExternalArray::cast(result)->set_external_pointer(external_pointer); 3629 ExternalArray::cast(result)->set_external_pointer(external_pointer);
(...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after
6434 static_cast<int>(object_sizes_last_time_[index])); 6434 static_cast<int>(object_sizes_last_time_[index]));
6435 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6435 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6436 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6436 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6437 6437
6438 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6438 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6439 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6439 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6440 ClearObjectStats(); 6440 ClearObjectStats();
6441 } 6441 }
6442 } 6442 }
6443 } // namespace v8::internal 6443 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698