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

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: Fix imprecision in diagram . Created 4 years, 6 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 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 if (has_unwinding_info) {
1436 body_size =
1437 RoundUp(body_size, kInt64Size) + desc.unwinding_info_size + kInt64Size;
rmcilroy 2016/06/24 09:45:26 What's the extra kInt64Size here for? Is that the
Stefano Sanfilippo 2016/06/24 10:36:37 Done.
rmcilroy 2016/06/24 12:55:25 There are multiple kInt64Size here so the comment
Stefano Sanfilippo 2016/06/24 13:17:28 Done.
1438 }
1439 int obj_size = Code::SizeFor(RoundUp(body_size, kObjectAlignment));
1432 1440
1433 Handle<Code> code = NewCodeRaw(obj_size, immovable); 1441 Handle<Code> code = NewCodeRaw(obj_size, immovable);
1434 DCHECK(!isolate()->heap()->memory_allocator()->code_range()->valid() || 1442 DCHECK(!isolate()->heap()->memory_allocator()->code_range()->valid() ||
1435 isolate()->heap()->memory_allocator()->code_range()->contains( 1443 isolate()->heap()->memory_allocator()->code_range()->contains(
1436 code->address()) || 1444 code->address()) ||
1437 obj_size <= isolate()->heap()->code_space()->AreaSize()); 1445 obj_size <= isolate()->heap()->code_space()->AreaSize());
1438 1446
1439 // The code object has not been fully initialized yet. We rely on the 1447 // The code object has not been fully initialized yet. We rely on the
1440 // fact that no allocation will happen from this point on. 1448 // fact that no allocation will happen from this point on.
1441 DisallowHeapAllocation no_gc; 1449 DisallowHeapAllocation no_gc;
1442 code->set_gc_metadata(Smi::FromInt(0)); 1450 code->set_gc_metadata(Smi::FromInt(0));
1443 code->set_ic_age(isolate()->heap()->global_ic_age()); 1451 code->set_ic_age(isolate()->heap()->global_ic_age());
1444 code->set_instruction_size(desc.instr_size); 1452 code->set_instruction_size(desc.instr_size);
1445 code->set_relocation_info(*reloc_info); 1453 code->set_relocation_info(*reloc_info);
1446 code->set_flags(flags); 1454 code->set_flags(flags);
1455 code->set_has_unwinding_info(has_unwinding_info);
1447 code->set_raw_kind_specific_flags1(0); 1456 code->set_raw_kind_specific_flags1(0);
1448 code->set_raw_kind_specific_flags2(0); 1457 code->set_raw_kind_specific_flags2(0);
1449 code->set_is_crankshafted(crankshafted); 1458 code->set_is_crankshafted(crankshafted);
1450 code->set_deoptimization_data(*empty_fixed_array(), SKIP_WRITE_BARRIER); 1459 code->set_deoptimization_data(*empty_fixed_array(), SKIP_WRITE_BARRIER);
1451 code->set_raw_type_feedback_info(Smi::FromInt(0)); 1460 code->set_raw_type_feedback_info(Smi::FromInt(0));
1452 code->set_next_code_link(*undefined_value()); 1461 code->set_next_code_link(*undefined_value());
1453 code->set_handler_table(*empty_fixed_array(), SKIP_WRITE_BARRIER); 1462 code->set_handler_table(*empty_fixed_array(), SKIP_WRITE_BARRIER);
1454 code->set_prologue_offset(prologue_offset); 1463 code->set_prologue_offset(prologue_offset);
1455 code->set_constant_pool_offset(desc.instr_size - desc.constant_pool_size); 1464 code->set_constant_pool_offset(desc.instr_size - desc.constant_pool_size);
1456 1465
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 } 2401 }
2393 2402
2394 2403
2395 Handle<Object> Factory::ToBoolean(bool value) { 2404 Handle<Object> Factory::ToBoolean(bool value) {
2396 return value ? true_value() : false_value(); 2405 return value ? true_value() : false_value();
2397 } 2406 }
2398 2407
2399 2408
2400 } // namespace internal 2409 } // namespace internal
2401 } // namespace v8 2410 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698