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

Side by Side Diff: src/factory.cc

Issue 1993653003: Initial support for emitting unwinding information in perf jitdump. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Enable with --perf-prof-unwinding-info. Created 4 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/eh-frame.cc ('k') | src/flag-definitions.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 1419
1420 Handle<Code> Factory::NewCode(const CodeDesc& desc, 1420 Handle<Code> Factory::NewCode(const CodeDesc& desc,
1421 Code::Flags flags, 1421 Code::Flags flags,
1422 Handle<Object> self_ref, 1422 Handle<Object> self_ref,
1423 bool immovable, 1423 bool immovable,
1424 bool crankshafted, 1424 bool crankshafted,
1425 int prologue_offset, 1425 int prologue_offset,
1426 bool is_debug) { 1426 bool is_debug) {
1427 Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED); 1427 Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED);
1428 1428
1429 bool has_unwinding_info = desc.unwinding_info != nullptr;
1430 DCHECK((has_unwinding_info && desc.unwinding_info_size > 0) ||
1431 (!has_unwinding_info && desc.unwinding_info_size == 0));
1432
1429 // Compute size. 1433 // Compute size.
1430 int body_size = RoundUp(desc.instr_size, kObjectAlignment); 1434 int body_size = desc.instr_size;
1431 int obj_size = Code::SizeFor(body_size); 1435 int unwinding_info_size_field_size = kInt64Size;
1436 if (has_unwinding_info) {
1437 body_size = RoundUp(body_size, kInt64Size) + desc.unwinding_info_size +
1438 unwinding_info_size_field_size;
1439 }
1440 int obj_size = Code::SizeFor(RoundUp(body_size, kObjectAlignment));
1432 1441
1433 Handle<Code> code = NewCodeRaw(obj_size, immovable); 1442 Handle<Code> code = NewCodeRaw(obj_size, immovable);
1434 DCHECK(!isolate()->heap()->memory_allocator()->code_range()->valid() || 1443 DCHECK(!isolate()->heap()->memory_allocator()->code_range()->valid() ||
1435 isolate()->heap()->memory_allocator()->code_range()->contains( 1444 isolate()->heap()->memory_allocator()->code_range()->contains(
1436 code->address()) || 1445 code->address()) ||
1437 obj_size <= isolate()->heap()->code_space()->AreaSize()); 1446 obj_size <= isolate()->heap()->code_space()->AreaSize());
1438 1447
1439 // The code object has not been fully initialized yet. We rely on the 1448 // The code object has not been fully initialized yet. We rely on the
1440 // fact that no allocation will happen from this point on. 1449 // fact that no allocation will happen from this point on.
1441 DisallowHeapAllocation no_gc; 1450 DisallowHeapAllocation no_gc;
1442 code->set_gc_metadata(Smi::FromInt(0)); 1451 code->set_gc_metadata(Smi::FromInt(0));
1443 code->set_ic_age(isolate()->heap()->global_ic_age()); 1452 code->set_ic_age(isolate()->heap()->global_ic_age());
1444 code->set_instruction_size(desc.instr_size); 1453 code->set_instruction_size(desc.instr_size);
1445 code->set_relocation_info(*reloc_info); 1454 code->set_relocation_info(*reloc_info);
1446 code->set_flags(flags); 1455 code->set_flags(flags);
1456 code->set_has_unwinding_info(has_unwinding_info);
1447 code->set_raw_kind_specific_flags1(0); 1457 code->set_raw_kind_specific_flags1(0);
1448 code->set_raw_kind_specific_flags2(0); 1458 code->set_raw_kind_specific_flags2(0);
1449 code->set_is_crankshafted(crankshafted); 1459 code->set_is_crankshafted(crankshafted);
1450 code->set_deoptimization_data(*empty_fixed_array(), SKIP_WRITE_BARRIER); 1460 code->set_deoptimization_data(*empty_fixed_array(), SKIP_WRITE_BARRIER);
1451 code->set_raw_type_feedback_info(Smi::FromInt(0)); 1461 code->set_raw_type_feedback_info(Smi::FromInt(0));
1452 code->set_next_code_link(*undefined_value()); 1462 code->set_next_code_link(*undefined_value());
1453 code->set_handler_table(*empty_fixed_array(), SKIP_WRITE_BARRIER); 1463 code->set_handler_table(*empty_fixed_array(), SKIP_WRITE_BARRIER);
1454 code->set_prologue_offset(prologue_offset); 1464 code->set_prologue_offset(prologue_offset);
1455 code->set_constant_pool_offset(desc.instr_size - desc.constant_pool_size); 1465 code->set_constant_pool_offset(desc.instr_size - desc.constant_pool_size);
1456 1466
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 } 2402 }
2393 2403
2394 2404
2395 Handle<Object> Factory::ToBoolean(bool value) { 2405 Handle<Object> Factory::ToBoolean(bool value) {
2396 return value ? true_value() : false_value(); 2406 return value ? true_value() : false_value();
2397 } 2407 }
2398 2408
2399 2409
2400 } // namespace internal 2410 } // namespace internal
2401 } // namespace v8 2411 } // namespace v8
OLDNEW
« no previous file with comments | « src/eh-frame.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698