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

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

Issue 1703453002: [interpreter, debugger] support debug breaks via bytecode array copy (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 10 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/ia32/builtins-ia32.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/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 3340 matching lines...) Expand 10 before | Expand all | Expand 10 after
3351 3351
3352 // Relocate the copy. 3352 // Relocate the copy.
3353 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); 3353 DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment));
3354 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || 3354 DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() ||
3355 isolate_->code_range()->contains(code->address()) || 3355 isolate_->code_range()->contains(code->address()) ||
3356 obj_size <= code_space()->AreaSize()); 3356 obj_size <= code_space()->AreaSize());
3357 new_code->Relocate(new_addr - old_addr); 3357 new_code->Relocate(new_addr - old_addr);
3358 return new_code; 3358 return new_code;
3359 } 3359 }
3360 3360
3361 AllocationResult Heap::CopyBytecodeArray(BytecodeArray* bytecode_array) {
3362 int size = BytecodeArray::SizeFor(bytecode_array->length());
3363 HeapObject* result = nullptr;
3364 {
3365 AllocationResult allocation = AllocateRaw(size, OLD_SPACE);
3366 if (!allocation.To(&result)) return allocation;
3367 }
3368
3369 result->set_map_no_write_barrier(bytecode_array_map());
3370 BytecodeArray* copy = BytecodeArray::cast(result);
3371 copy->set_length(bytecode_array->length());
3372 copy->set_frame_size(bytecode_array->frame_size());
3373 copy->set_parameter_count(bytecode_array->parameter_count());
3374 copy->set_constant_pool(bytecode_array->constant_pool());
3375 copy->set_handler_table(bytecode_array->handler_table());
3376 copy->set_source_position_table(bytecode_array->source_position_table());
3377 bytecode_array->CopyBytecodesTo(copy);
3378 return copy;
3379 }
3361 3380
3362 AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { 3381 AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) {
3363 // Allocate ByteArray before the Code object, so that we do not risk 3382 // Allocate ByteArray before the Code object, so that we do not risk
3364 // leaving uninitialized Code object (and breaking the heap). 3383 // leaving uninitialized Code object (and breaking the heap).
3365 ByteArray* reloc_info_array = nullptr; 3384 ByteArray* reloc_info_array = nullptr;
3366 { 3385 {
3367 AllocationResult allocation = 3386 AllocationResult allocation =
3368 AllocateByteArray(reloc_info.length(), TENURED); 3387 AllocateByteArray(reloc_info.length(), TENURED);
3369 if (!allocation.To(&reloc_info_array)) return allocation; 3388 if (!allocation.To(&reloc_info_array)) return allocation;
3370 } 3389 }
(...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after
6302 } 6321 }
6303 6322
6304 6323
6305 // static 6324 // static
6306 int Heap::GetStaticVisitorIdForMap(Map* map) { 6325 int Heap::GetStaticVisitorIdForMap(Map* map) {
6307 return StaticVisitorBase::GetVisitorId(map); 6326 return StaticVisitorBase::GetVisitorId(map);
6308 } 6327 }
6309 6328
6310 } // namespace internal 6329 } // namespace internal
6311 } // namespace v8 6330 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698