PPC/s390: Fix undefined behaviour on CommentOperator
Port 199533558e
Original Commit Message:
The {CommentOperator}, used for implementing the --code-comments flag,
is not UBSan-safe. This CL fixes this and adds a test which uses code
comments.
R=clemensh@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N
Change-Id: Ia7976ec9a726fdeb7d8bfbb99c8a16d473aa0da4
Reviewed-on: https://chromium-review.googlesource.com/1157230
Reviewed-by: Muntasir Mallick <mmallick@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#54828}
This commit is contained in:
parent
f95b263249
commit
cd4b722835
@ -1057,11 +1057,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kArchPrepareTailCall:
|
||||
AssemblePrepareTailCall();
|
||||
break;
|
||||
case kArchComment: {
|
||||
Address comment_string = i.InputExternalReference(0).address();
|
||||
__ RecordComment(reinterpret_cast<const char*>(comment_string));
|
||||
case kArchComment:
|
||||
#ifdef V8_TARGET_ARCH_PPC64
|
||||
__ RecordComment(reinterpret_cast<const char*>(i.InputInt64(0)));
|
||||
#else
|
||||
__ RecordComment(reinterpret_cast<const char*>(i.InputInt32(0)));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case kArchCallCFunction: {
|
||||
int const num_parameters = MiscField::decode(instr->opcode());
|
||||
if (instr->InputAt(0)->IsImmediate()) {
|
||||
|
@ -1348,11 +1348,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
ArchOpcode opcode = ArchOpcodeField::decode(instr->opcode());
|
||||
|
||||
switch (opcode) {
|
||||
case kArchComment: {
|
||||
Address comment_string = i.InputExternalReference(0).address();
|
||||
__ RecordComment(reinterpret_cast<const char*>(comment_string));
|
||||
case kArchComment:
|
||||
#ifdef V8_TARGET_ARCH_S390X
|
||||
__ RecordComment(reinterpret_cast<const char*>(i.InputInt64(0)));
|
||||
#else
|
||||
__ RecordComment(reinterpret_cast<const char*>(i.InputInt32(0)));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case kArchCallCodeObject: {
|
||||
if (HasRegisterInput(instr, 0)) {
|
||||
Register reg = i.InputRegister(0);
|
||||
|
Loading…
Reference in New Issue
Block a user