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

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

Issue 1254873002: [interpreter] A couple of minor tweaks to BytecodeArray. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/heap/heap.h ('k') | src/interpreter/interpreter.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 // 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 3050 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 #undef ALLOCATE_MAP 3061 #undef ALLOCATE_MAP
3062 } 3062 }
3063 3063
3064 { // Empty arrays 3064 { // Empty arrays
3065 { 3065 {
3066 ByteArray* byte_array; 3066 ByteArray* byte_array;
3067 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false; 3067 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false;
3068 set_empty_byte_array(byte_array); 3068 set_empty_byte_array(byte_array);
3069 3069
3070 BytecodeArray* bytecode_array; 3070 BytecodeArray* bytecode_array;
3071 if (!AllocateBytecodeArray(0, nullptr).To(&bytecode_array)) { 3071 AllocationResult allocation =
3072 AllocateBytecodeArray(0, nullptr, kPointerSize);
3073 if (!allocation.To(&bytecode_array)) {
3072 return false; 3074 return false;
3073 } 3075 }
3074 set_empty_bytecode_array(bytecode_array); 3076 set_empty_bytecode_array(bytecode_array);
3075 } 3077 }
3076 3078
3077 #define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \ 3079 #define ALLOCATE_EMPTY_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
3078 { \ 3080 { \
3079 ExternalArray* obj; \ 3081 ExternalArray* obj; \
3080 if (!AllocateEmptyExternalArray(kExternal##Type##Array).To(&obj)) \ 3082 if (!AllocateEmptyExternalArray(kExternal##Type##Array).To(&obj)) \
3081 return false; \ 3083 return false; \
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
3814 if (!allocation.To(&result)) return allocation; 3816 if (!allocation.To(&result)) return allocation;
3815 } 3817 }
3816 3818
3817 result->set_map_no_write_barrier(byte_array_map()); 3819 result->set_map_no_write_barrier(byte_array_map());
3818 ByteArray::cast(result)->set_length(length); 3820 ByteArray::cast(result)->set_length(length);
3819 return result; 3821 return result;
3820 } 3822 }
3821 3823
3822 3824
3823 AllocationResult Heap::AllocateBytecodeArray(int length, 3825 AllocationResult Heap::AllocateBytecodeArray(int length,
3824 const byte* const raw_bytecodes) { 3826 const byte* const raw_bytecodes,
3827 int frame_size) {
3825 if (length < 0 || length > BytecodeArray::kMaxLength) { 3828 if (length < 0 || length > BytecodeArray::kMaxLength) {
3826 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); 3829 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
3827 } 3830 }
3828 3831
3829 int size = BytecodeArray::SizeFor(length); 3832 int size = BytecodeArray::SizeFor(length);
3830 HeapObject* result; 3833 HeapObject* result;
3831 { 3834 {
3832 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); 3835 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
3833 if (!allocation.To(&result)) return allocation; 3836 if (!allocation.To(&result)) return allocation;
3834 } 3837 }
3835 3838
3836 result->set_map_no_write_barrier(bytecode_array_map()); 3839 result->set_map_no_write_barrier(bytecode_array_map());
3837 BytecodeArray* instance = BytecodeArray::cast(result); 3840 BytecodeArray* instance = BytecodeArray::cast(result);
3838 instance->set_length(length); 3841 instance->set_length(length);
3842 instance->set_frame_size(frame_size);
3839 CopyBytes(instance->GetFirstBytecodeAddress(), raw_bytecodes, length); 3843 CopyBytes(instance->GetFirstBytecodeAddress(), raw_bytecodes, length);
3840 3844
3841 return result; 3845 return result;
3842 } 3846 }
3843 3847
3844 3848
3845 void Heap::CreateFillerObjectAt(Address addr, int size) { 3849 void Heap::CreateFillerObjectAt(Address addr, int size) {
3846 if (size == 0) return; 3850 if (size == 0) return;
3847 HeapObject* filler = HeapObject::FromAddress(addr); 3851 HeapObject* filler = HeapObject::FromAddress(addr);
3848 if (size == kPointerSize) { 3852 if (size == kPointerSize) {
(...skipping 3135 matching lines...) Expand 10 before | Expand all | Expand 10 after
6984 *object_type = "CODE_TYPE"; \ 6988 *object_type = "CODE_TYPE"; \
6985 *object_sub_type = "CODE_AGE/" #name; \ 6989 *object_sub_type = "CODE_AGE/" #name; \
6986 return true; 6990 return true;
6987 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6991 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6988 #undef COMPARE_AND_RETURN_NAME 6992 #undef COMPARE_AND_RETURN_NAME
6989 } 6993 }
6990 return false; 6994 return false;
6991 } 6995 }
6992 } // namespace internal 6996 } // namespace internal
6993 } // namespace v8 6997 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698