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

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 store buffer. 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
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 2900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 #undef ALLOCATE_MAP 2911 #undef ALLOCATE_MAP
2912 } 2912 }
2913 2913
2914 { // Empty arrays 2914 { // Empty arrays
2915 { 2915 {
2916 ByteArray* byte_array; 2916 ByteArray* byte_array;
2917 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false; 2917 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false;
2918 set_empty_byte_array(byte_array); 2918 set_empty_byte_array(byte_array);
2919 2919
2920 BytecodeArray* bytecode_array; 2920 BytecodeArray* bytecode_array;
2921 AllocationResult allocation = AllocateBytecodeArray(0, nullptr, 0, 0); 2921 AllocationResult allocation =
2922 AllocateBytecodeArray(0, nullptr, 0, 0, empty_fixed_array());
2922 if (!allocation.To(&bytecode_array)) { 2923 if (!allocation.To(&bytecode_array)) {
2923 return false; 2924 return false;
2924 } 2925 }
2925 set_empty_bytecode_array(bytecode_array); 2926 set_empty_bytecode_array(bytecode_array);
2926 } 2927 }
2927 2928
2928 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ 2929 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
2929 { \ 2930 { \
2930 FixedTypedArrayBase* obj; \ 2931 FixedTypedArrayBase* obj; \
2931 if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \ 2932 if (!AllocateEmptyFixedTypedArray(kExternal##Type##Array).To(&obj)) \
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3511 3512
3512 result->set_map_no_write_barrier(byte_array_map()); 3513 result->set_map_no_write_barrier(byte_array_map());
3513 ByteArray::cast(result)->set_length(length); 3514 ByteArray::cast(result)->set_length(length);
3514 return result; 3515 return result;
3515 } 3516 }
3516 3517
3517 3518
3518 AllocationResult Heap::AllocateBytecodeArray(int length, 3519 AllocationResult Heap::AllocateBytecodeArray(int length,
3519 const byte* const raw_bytecodes, 3520 const byte* const raw_bytecodes,
3520 int frame_size, 3521 int frame_size,
3521 int parameter_count) { 3522 int parameter_count,
3523 FixedArray* constant_pool) {
3522 if (length < 0 || length > BytecodeArray::kMaxLength) { 3524 if (length < 0 || length > BytecodeArray::kMaxLength) {
3523 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true); 3525 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
3524 } 3526 }
3527 // Bytecode array is pretenured, so constant pool array should be to.
3528 DCHECK(!InNewSpace(constant_pool));
3525 3529
3526 int size = BytecodeArray::SizeFor(length); 3530 int size = BytecodeArray::SizeFor(length);
3527 HeapObject* result; 3531 HeapObject* result;
3528 { 3532 {
3529 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE); 3533 AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
3530 if (!allocation.To(&result)) return allocation; 3534 if (!allocation.To(&result)) return allocation;
3531 } 3535 }
3532 3536
3533 result->set_map_no_write_barrier(bytecode_array_map()); 3537 result->set_map_no_write_barrier(bytecode_array_map());
3534 BytecodeArray* instance = BytecodeArray::cast(result); 3538 BytecodeArray* instance = BytecodeArray::cast(result);
3535 instance->set_length(length); 3539 instance->set_length(length);
3536 instance->set_frame_size(frame_size); 3540 instance->set_frame_size(frame_size);
3537 instance->set_parameter_count(parameter_count); 3541 instance->set_parameter_count(parameter_count);
3542 instance->set_constant_pool(constant_pool);
3538 CopyBytes(instance->GetFirstBytecodeAddress(), raw_bytecodes, length); 3543 CopyBytes(instance->GetFirstBytecodeAddress(), raw_bytecodes, length);
3539 3544
3540 return result; 3545 return result;
3541 } 3546 }
3542 3547
3543 3548
3544 void Heap::CreateFillerObjectAt(Address addr, int size) { 3549 void Heap::CreateFillerObjectAt(Address addr, int size) {
3545 if (size == 0) return; 3550 if (size == 0) return;
3546 HeapObject* filler = HeapObject::FromAddress(addr); 3551 HeapObject* filler = HeapObject::FromAddress(addr);
3547 if (size == kPointerSize) { 3552 if (size == kPointerSize) {
(...skipping 3223 matching lines...) Expand 10 before | Expand all | Expand 10 after
6771 *object_type = "CODE_TYPE"; \ 6776 *object_type = "CODE_TYPE"; \
6772 *object_sub_type = "CODE_AGE/" #name; \ 6777 *object_sub_type = "CODE_AGE/" #name; \
6773 return true; 6778 return true;
6774 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6779 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6775 #undef COMPARE_AND_RETURN_NAME 6780 #undef COMPARE_AND_RETURN_NAME
6776 } 6781 }
6777 return false; 6782 return false;
6778 } 6783 }
6779 } // namespace internal 6784 } // namespace internal
6780 } // namespace v8 6785 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | test/cctest/test-heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698