Commit 28e0e97d authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[builtins] Don't emit debug infos in release builds

Debug infos for embedded builtins (associating a file and line number
with certain code ranges) should only be emitted in debug modes.

This CL disables source position emission in Torque in release builds,
and adds checks that the external filename / source position lists are
empty in release builds.

Bug: v8:9910
Change-Id: Ic69683a2324c3b334150ee2b7da9972fbee56483
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1879903Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64576}
parent 65079f10
...@@ -40,6 +40,10 @@ void EmbeddedFileWriter::WriteBuiltin(PlatformEmbeddedFileWriterBase* w, ...@@ -40,6 +40,10 @@ void EmbeddedFileWriter::WriteBuiltin(PlatformEmbeddedFileWriterBase* w,
v8::internal::SourcePositionTableIterator positions( v8::internal::SourcePositionTableIterator positions(
vpos, SourcePositionTableIterator::kExternalOnly); vpos, SourcePositionTableIterator::kExternalOnly);
#ifndef DEBUG
CHECK(positions.done()); // Release builds must not contain debug infos.
#endif
const uint8_t* data = reinterpret_cast<const uint8_t*>( const uint8_t* data = reinterpret_cast<const uint8_t*>(
blob->InstructionStartOfBuiltin(builtin_id)); blob->InstructionStartOfBuiltin(builtin_id));
uint32_t size = blob->PaddedInstructionSizeOfBuiltin(builtin_id); uint32_t size = blob->PaddedInstructionSizeOfBuiltin(builtin_id);
......
...@@ -121,6 +121,11 @@ class EmbeddedFileWriter : public EmbeddedFileWriterInterface { ...@@ -121,6 +121,11 @@ class EmbeddedFileWriter : public EmbeddedFileWriterInterface {
} }
void WriteExternalFilenames(PlatformEmbeddedFileWriterBase* w) const { void WriteExternalFilenames(PlatformEmbeddedFileWriterBase* w) const {
#ifndef DEBUG
// Release builds must not contain debug infos.
CHECK_EQ(external_filenames_by_index_.size(), 0);
#endif
w->Comment( w->Comment(
"Source positions in the embedded blob refer to filenames by id."); "Source positions in the embedded blob refer to filenames by id.");
w->Comment("Assembly directives here map the id to a filename."); w->Comment("Assembly directives here map the id to a filename.");
......
...@@ -68,7 +68,10 @@ void CSAGenerator::EmitSourcePosition(SourcePosition pos, bool always_emit) { ...@@ -68,7 +68,10 @@ void CSAGenerator::EmitSourcePosition(SourcePosition pos, bool always_emit) {
void CSAGenerator::EmitInstruction(const Instruction& instruction, void CSAGenerator::EmitInstruction(const Instruction& instruction,
Stack<std::string>* stack) { Stack<std::string>* stack) {
#ifdef DEBUG
EmitSourcePosition(instruction->pos); EmitSourcePosition(instruction->pos);
#endif
switch (instruction.kind()) { switch (instruction.kind()) {
#define ENUM_ITEM(T) \ #define ENUM_ITEM(T) \
case InstructionKind::k##T: \ case InstructionKind::k##T: \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment