Revert "[Torque] Add source positions for Torque files"
This reverts commit 0a24e67a7f
.
Reason for revert: Broke Linux 64 UBSan build with unaligned read in the snapshot. Will investigate...
Original change's description:
> [Torque] Add source positions for Torque files
>
> To improve the Torque debugging experience, we can add source positions
> for each line. This information is carried through the generated
> CSA code (in <output directory>/gen/torque-generated/*.cc) and
> embedded as SourcePositions in the Code object.
>
> At snapshot time, these SourcePositions are stripped from the Code
> object and turned into platform-appropriate line number debug
> information.
>
> At this time on Linux, you'll need to build with "is_clang=false"
> in order to use GCC, because crucial steps are missing in Clang's
> ability to convey the information into the binary successfully.
>
> This CL also introduces a flag to control the existing source
> information in CSA code. --enable-source-at-csa-bind is now set
> to false by default because it's a bit confusing to "hop" between
> source lines in .TQ files and in .CC files. I expect to continue
> making adjustments there, as I want to provide helpful
> debugging aids at the CSA level as well as the Torque level.
> The current configuration prioritizes Torque.
>
> A detailed guide on usage to follow (also on v8.dev).
>
> Bug: v8:8418
> Change-Id: Ib4226877ce4cae451bb4d0c546927e89f4e66b58
> Reviewed-on: https://chromium-review.googlesource.com/c/1475473
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Commit-Queue: Michael Stanton <mvstanton@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#59636}
TBR=mvstanton@chromium.org,tebbi@chromium.org
Change-Id: I4ccf94dfdb8b2ba238a60db9ecc8e3ceebef2699
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:8418
Reviewed-on: https://chromium-review.googlesource.com/c/1475757
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59637}
This commit is contained in:
parent
0a24e67a7f
commit
9542fd8fa0
@ -1762,9 +1762,7 @@ void CodeAssemblerLabel::Bind(AssemblerDebugInfo debug_info) {
|
||||
<< "\n# previous: " << *label_->block();
|
||||
FATAL("%s", str.str().c_str());
|
||||
}
|
||||
if (FLAG_enable_source_at_csa_bind) {
|
||||
state_->raw_assembler_->SetSourcePosition(debug_info.file, debug_info.line);
|
||||
}
|
||||
state_->raw_assembler_->SetSourcePosition(debug_info.file, debug_info.line);
|
||||
state_->raw_assembler_->Bind(label_, debug_info);
|
||||
UpdateVariablesAfterBind();
|
||||
}
|
||||
|
@ -850,10 +850,6 @@ DEFINE_STRING(mcpu, "auto", "enable optimization for specific cpu")
|
||||
DEFINE_BOOL(partial_constant_pool, true,
|
||||
"enable use of partial constant pools (X64 only)")
|
||||
|
||||
// Controlling source positions for Torque/CSA code.
|
||||
DEFINE_BOOL(enable_source_at_csa_bind, false,
|
||||
"Include source information in the binary at CSA bind locations.")
|
||||
|
||||
// Deprecated ARM flags (replaced by arm_arch).
|
||||
DEFINE_MAYBE_BOOL(enable_armv7, "deprecated (use --arm_arch instead)")
|
||||
DEFINE_MAYBE_BOOL(enable_vfp3, "deprecated (use --arm_arch instead)")
|
||||
|
@ -54,20 +54,8 @@ Stack<std::string> CSAGenerator::EmitBlock(const Block* block) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
void CSAGenerator::EmitSourcePosition(SourcePosition pos, bool always_emit) {
|
||||
const std::string& file = SourceFileMap::GetSource(pos.source);
|
||||
if (always_emit || !previous_position_.CompareIgnoreColumn(pos)) {
|
||||
// Lines in Torque SourcePositions are zero-based, while the
|
||||
// CodeStubAssembler and downwind systems are one-based.
|
||||
out_ << " ca_.SetSourcePosition(\"" << file << "\", " << (pos.line + 1)
|
||||
<< ");\n";
|
||||
previous_position_ = pos;
|
||||
}
|
||||
}
|
||||
|
||||
void CSAGenerator::EmitInstruction(const Instruction& instruction,
|
||||
Stack<std::string>* stack) {
|
||||
EmitSourcePosition(instruction->pos);
|
||||
switch (instruction.kind()) {
|
||||
#define ENUM_ITEM(T) \
|
||||
case InstructionKind::k##T: \
|
||||
|
@ -18,10 +18,7 @@ class CSAGenerator {
|
||||
public:
|
||||
CSAGenerator(const ControlFlowGraph& cfg, std::ostream& out,
|
||||
base::Optional<Builtin::Kind> linkage = base::nullopt)
|
||||
: cfg_(cfg),
|
||||
out_(out),
|
||||
linkage_(linkage),
|
||||
previous_position_(SourcePosition::Invalid()) {}
|
||||
: cfg_(cfg), out_(out), linkage_(linkage) {}
|
||||
base::Optional<Stack<std::string>> EmitGraph(Stack<std::string> parameters);
|
||||
|
||||
static constexpr const char* ARGUMENTS_VARIABLE_STRING = "arguments";
|
||||
@ -34,9 +31,6 @@ class CSAGenerator {
|
||||
std::ostream& out_;
|
||||
size_t fresh_id_ = 0;
|
||||
base::Optional<Builtin::Kind> linkage_;
|
||||
SourcePosition previous_position_;
|
||||
|
||||
void EmitSourcePosition(SourcePosition pos, bool always_emit = false);
|
||||
|
||||
std::string PreCallableExceptionPreparation(
|
||||
base::Optional<Block*> catch_block);
|
||||
|
@ -14,10 +14,6 @@ namespace internal {
|
||||
namespace torque {
|
||||
|
||||
class SourceId {
|
||||
public:
|
||||
static SourceId Invalid() { return SourceId(-1); }
|
||||
int operator==(const SourceId& s) const { return id_ == s.id_; }
|
||||
|
||||
private:
|
||||
explicit SourceId(int id) : id_(id) {}
|
||||
int id_;
|
||||
@ -28,17 +24,6 @@ struct SourcePosition {
|
||||
SourceId source;
|
||||
int line;
|
||||
int column;
|
||||
static SourcePosition Invalid() {
|
||||
SourcePosition pos{SourceId::Invalid(), -1, -1};
|
||||
return pos;
|
||||
}
|
||||
int operator==(const SourcePosition& pos) const {
|
||||
return line == pos.line && column == pos.column && source == pos.source;
|
||||
}
|
||||
int operator!=(const SourcePosition& pos) const { return !(*this == pos); }
|
||||
bool CompareIgnoreColumn(const SourcePosition& pos) const {
|
||||
return line == pos.line && source == pos.source;
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_CONTEXTUAL_VARIABLE(CurrentSourceFile, SourceId);
|
||||
|
Loading…
Reference in New Issue
Block a user