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

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

Issue 1314953004: [interpreter] Add constant_pool() to BytecodeArray. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_args
Patch Set: Fix test flag. Created 5 years, 3 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/heap/mark-compact.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/heap/heap.h" 5 #include "src/heap/heap.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 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after
2917 #undef ALLOCATE_MAP 2917 #undef ALLOCATE_MAP
2918 } 2918 }
2919 2919
2920 { // Empty arrays 2920 { // Empty arrays
2921 { 2921 {
2922 ByteArray* byte_array; 2922 ByteArray* byte_array;
2923 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false; 2923 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false;
2924 set_empty_byte_array(byte_array); 2924 set_empty_byte_array(byte_array);
2925 2925
2926 BytecodeArray* bytecode_array; 2926 BytecodeArray* bytecode_array;
2927 AllocationResult allocation = AllocateBytecodeArray(0, nullptr, 0, 0); 2927 AllocationResult allocation =
2928 AllocateBytecodeArray(0, nullptr, 0, 0, empty_fixed_array());
2928 if (!allocation.To(&bytecode_array)) { 2929 if (!allocation.To(&bytecode_array)) {
2929 return false; 2930 return false;
2930 } 2931 }
2931 set_empty_bytecode_array(bytecode_array); 2932 set_empty_bytecode_array(bytecode_array);
2932 } 2933 }
2933 2934
2934 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ 2935 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
2935 { \ 2936 { \
2936 FixedTypedArrayBase* obj; \ 2937 FixedTypedArrayBase* obj; \
2937 if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \ 2938 if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3517 3518
3518 result->set_map_no_write_barrier(byte_array_map()); 3519 result->set_map_no_write_barrier(byte_array_map());
3519 ByteArray::cast(result)->set_length(length); 3520 ByteArray::cast(result)->set_length(length);
3520 return result; 3521 return result;
3521 } 3522 }
3522 3523
3523 3524
3524 AllocationResult Heap::AllocateBytecodeArray(int length, 3525 AllocationResult Heap::AllocateBytecodeArray(int length,
3525 const byte* const raw_bytecodes, 3526 const byte* const raw_bytecodes,
3526 int frame_size, 3527 int frame_size,
3527 int parameter_count) { 3528 int parameter_count,
3529 FixedArray* constant_pool) {
3528 if (length < 0 || length > BytecodeArray::kMaxLength) { 3530 if (length < 0 || length > BytecodeArray::kMaxLength) {
3529 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); 3531 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
3530 } 3532 }
3533 // Bytecode array is pretenured, so constant pool array should be to.
3534 DCHECK(!InNewSpace(constant_pool));
3531 3535
3532 int size = BytecodeArray::SizeFor(length); 3536 int size = BytecodeArray::SizeFor(length);
3533 HeapObject* result; 3537 HeapObject* result;
3534 { 3538 {
3535 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); 3539 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
3536 if (!allocation.To(&result)) return allocation; 3540 if (!allocation.To(&result)) return allocation;
3537 } 3541 }
3538 3542
3539 result->set_map_no_write_barrier(bytecode_array_map()); 3543 result->set_map_no_write_barrier(bytecode_array_map());
3540 BytecodeArray* instance = BytecodeArray::cast(result); 3544 BytecodeArray* instance = BytecodeArray::cast(result);
3541 instance->set_length(length); 3545 instance->set_length(length);
3542 instance->set_frame_size(frame_size); 3546 instance->set_frame_size(frame_size);
3543 instance->set_parameter_count(parameter_count); 3547 instance->set_parameter_count(parameter_count);
3548 instance->set_constant_pool(constant_pool);
3544 CopyBytes(instance->GetFirstBytecodeAddress(), raw_bytecodes, length); 3549 CopyBytes(instance->GetFirstBytecodeAddress(), raw_bytecodes, length);
3545 3550
3546 return result; 3551 return result;
3547 } 3552 }
3548 3553
3549 3554
3550 void Heap::CreateFillerObjectAt(Address addr, int size) { 3555 void Heap::CreateFillerObjectAt(Address addr, int size) {
3551 if (size == 0) return; 3556 if (size == 0) return;
3552 HeapObject* filler = HeapObject::FromAddress(addr); 3557 HeapObject* filler = HeapObject::FromAddress(addr);
3553 if (size == kPointerSize) { 3558 if (size == kPointerSize) {
(...skipping 3229 matching lines...) Expand 10 before | Expand all | Expand 10 after
6783 *object_type = "CODE_TYPE"; \ 6788 *object_type = "CODE_TYPE"; \
6784 *object_sub_type = "CODE_AGE/" #name; \ 6789 *object_sub_type = "CODE_AGE/" #name; \
6785 return true; 6790 return true;
6786 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6791 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6787 #undef COMPARE_AND_RETURN_NAME 6792 #undef COMPARE_AND_RETURN_NAME
6788 } 6793 }
6789 return false; 6794 return false;
6790 } 6795 }
6791 } // namespace internal 6796 } // namespace internal
6792 } // namespace v8 6797 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698