c7ebc5814f
This is a reland of 35269f77f8
Switches on an expression that unconditionally throws would have all their
case statements dead, causing a DCHECK error in the SwitchBuilder. This
fixes up the DCHECK to allow dead labels.
Original change's description:
> [ignition] Skip binding dead labels
>
> BytecodeLabels for forward jumps may create a dead basic block if their
> corresponding jump was elided (due to it dead code elimination). We can
> avoid generating such dead basic blocks by skipping the label bind when
> no corresponding jump has been observed. This works because all jumps
> except JumpLoop are forward jumps, so we only have to special case one
> Bind for loop headers to bind unconditionally.
>
> Since Binds are now conditional on a jump existing, we can no longer rely
> on using Bind to get the current offset (e.g. at the beginning of a try
> block). Instead, we now expose the current offset in the bytecode array
> writer. Conveniently, this means that we can be a bit smarter about basic
> blocks around these statements.
>
> As a drive-by, remove the unused Bind(target,label) function.
>
> Bug: chromium:934166
> Change-Id: I532aa452fb083560d07b90da99caca0b1d082aa3
> Reviewed-on: https://chromium-review.googlesource.com/c/1488763
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#59942}
TBR=rmcilroy@chromium.org
Bug: chromium:934166
Change-Id: If6eab4162106717ce64a2dc477000c6a76354cb4
Reviewed-on: https://chromium-review.googlesource.com/c/1494535
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59948}
86 lines
2.0 KiB
Plaintext
86 lines
2.0 KiB
Plaintext
#
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
#
|
|
|
|
---
|
|
wrap: yes
|
|
|
|
---
|
|
snippet: "
|
|
try { return 1; } catch(e) { return 2; }
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 23
|
|
bytecodes: [
|
|
/* 30 E> */ B(StackCheck),
|
|
B(Mov), R(context), R(0),
|
|
/* 40 S> */ B(LdaSmi), I8(1),
|
|
/* 49 S> */ B(Return),
|
|
B(Star), R(1),
|
|
B(CreateCatchContext), R(1), U8(0),
|
|
B(Star), R(0),
|
|
B(LdaTheHole),
|
|
B(SetPendingMessage),
|
|
B(Ldar), R(0),
|
|
B(PushContext), R(1),
|
|
/* 63 S> */ B(LdaSmi), I8(2),
|
|
/* 72 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
SCOPE_INFO_TYPE,
|
|
]
|
|
handlers: [
|
|
[4, 7, 7],
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a;
|
|
try { a = 1 } catch(e1) {};
|
|
try { a = 2 } catch(e2) { a = 3 }
|
|
"
|
|
frame size: 3
|
|
parameter count: 1
|
|
bytecode array length: 55
|
|
bytecodes: [
|
|
/* 30 E> */ B(StackCheck),
|
|
B(Mov), R(context), R(1),
|
|
/* 47 S> */ B(LdaSmi), I8(1),
|
|
B(Star), R(0),
|
|
B(Jump), U8(17),
|
|
B(Star), R(2),
|
|
/* 49 E> */ B(CreateCatchContext), R(2), U8(0),
|
|
B(Star), R(1),
|
|
B(LdaTheHole),
|
|
B(SetPendingMessage),
|
|
B(Ldar), R(1),
|
|
B(PushContext), R(2),
|
|
B(PopContext), R(2),
|
|
B(Mov), R(context), R(1),
|
|
/* 75 S> */ B(LdaSmi), I8(2),
|
|
B(Star), R(0),
|
|
B(Jump), U8(21),
|
|
B(Star), R(2),
|
|
/* 77 E> */ B(CreateCatchContext), R(2), U8(1),
|
|
B(Star), R(1),
|
|
B(LdaTheHole),
|
|
B(SetPendingMessage),
|
|
B(Ldar), R(1),
|
|
B(PushContext), R(2),
|
|
/* 95 S> */ B(LdaSmi), I8(3),
|
|
B(Star), R(0),
|
|
B(PopContext), R(2),
|
|
B(LdaUndefined),
|
|
/* 103 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
SCOPE_INFO_TYPE,
|
|
SCOPE_INFO_TYPE,
|
|
]
|
|
handlers: [
|
|
[4, 8, 10],
|
|
[28, 32, 34],
|
|
]
|
|
|