Commit 0b85c65e authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[assembler] Fix and document emitted debug code

There is a debug check to check that an embedded code object is patched
correctly. This check only makes sense if the code object was indeed
pushed to the stack, otherwise we are checking the type marker.
This CL fixes this check and adds a line of documentation.

R=mstarzinger@chromium.org

Change-Id: I5bc1454232cdbf2e9fef6eb41f7c7a20f31a5250
Reviewed-on: https://chromium-review.googlesource.com/924154
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51370}
parent c5372a50
......@@ -596,10 +596,11 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) {
push(Immediate(StackFrame::TypeToMarker(type)));
if (type == StackFrame::INTERNAL) {
push(Immediate(CodeObject()));
}
if (emit_debug_code()) {
cmp(Operand(esp, 0), Immediate(isolate()->factory()->undefined_value()));
Check(not_equal, AbortReason::kCodeObjectNotProperlyPatched);
// Check at runtime that this code object was patched correctly.
if (emit_debug_code()) {
cmp(Operand(esp, 0), Immediate(isolate()->factory()->undefined_value()));
Check(not_equal, AbortReason::kCodeObjectNotProperlyPatched);
}
}
}
......
......@@ -2470,13 +2470,13 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) {
if (type == StackFrame::INTERNAL) {
Move(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT);
Push(kScratchRegister);
}
if (emit_debug_code()) {
Move(kScratchRegister,
isolate()->factory()->undefined_value(),
RelocInfo::EMBEDDED_OBJECT);
cmpp(Operand(rsp, 0), kScratchRegister);
Check(not_equal, AbortReason::kCodeObjectNotProperlyPatched);
// Check at runtime that this code object was patched correctly.
if (emit_debug_code()) {
Move(kScratchRegister, isolate()->factory()->undefined_value(),
RelocInfo::EMBEDDED_OBJECT);
cmpp(Operand(rsp, 0), kScratchRegister);
Check(not_equal, AbortReason::kCodeObjectNotProperlyPatched);
}
}
}
......
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