Title: [267535] trunk/Source/_javascript_Core
- Revision
- 267535
- Author
- [email protected]
- Date
- 2020-09-24 09:16:59 -0700 (Thu, 24 Sep 2020)
Log Message
[MIPS] Broken build after r267371
https://bugs.webkit.org/show_bug.cgi?id=216893
Patch by Angelos Oikonomopoulos <[email protected]> on 2020-09-24
Reviewed by Adrian Perez de Castro.
This addresses two issues.
First, the fix in https://bugs.webkit.org/show_bug.cgi?id=216772 was not
getting exercised, because the LabelReference offset was always zero.
The reason the offset was zero is that LabelReference.mapChildren would discard
the offset when generating a new LabelReference to wrap the Label returned by
the code block it yielded to.
The reason this was only an issue on MIPS is because only MIPS was using the
result of calls to LabelReference.mapChildren (in its lowering phase,
assignRegistersToTemporaries -> replaceTemporariesWithRegisters ->
mapChildren). Other archs, e.g. X86_64 only call mapChildren in earlier phases
(specifically, subsequent to a call to isASTErroneous), in which the new
LabelReferences returned by mapChildren are later discarded. Even though ARM
32/64 contains indirect calls to mapChildren, those are made after the
arm{,64}LowerLabelReferences transformation which doesn't leave any
LabelReference nodes around for .mapChildren to be called on.
So this is not an issue for architectures other than MIPS because
(a) AddImmediates.fold correctly constructs a LabelReference with an offset by
calling LabelReference.plusOffset and
(b) they don't call (and therefore don't use the result of)
LabelReference.mapChildren in their lowering code.
Second, the code we generate needs to look up the /label/ in the GOT, not the
computed address. After the lookup, we simply need to add the offset.
* offlineasm/ast.rb:
* offlineasm/mips.rb:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (267534 => 267535)
--- trunk/Source/_javascript_Core/ChangeLog 2020-09-24 16:14:55 UTC (rev 267534)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-09-24 16:16:59 UTC (rev 267535)
@@ -1,3 +1,41 @@
+2020-09-24 Angelos Oikonomopoulos <[email protected]>
+
+ [MIPS] Broken build after r267371
+ https://bugs.webkit.org/show_bug.cgi?id=216893
+
+ Reviewed by Adrian Perez de Castro.
+
+ This addresses two issues.
+
+ First, the fix in https://bugs.webkit.org/show_bug.cgi?id=216772 was not
+ getting exercised, because the LabelReference offset was always zero.
+
+ The reason the offset was zero is that LabelReference.mapChildren would discard
+ the offset when generating a new LabelReference to wrap the Label returned by
+ the code block it yielded to.
+
+ The reason this was only an issue on MIPS is because only MIPS was using the
+ result of calls to LabelReference.mapChildren (in its lowering phase,
+ assignRegistersToTemporaries -> replaceTemporariesWithRegisters ->
+ mapChildren). Other archs, e.g. X86_64 only call mapChildren in earlier phases
+ (specifically, subsequent to a call to isASTErroneous), in which the new
+ LabelReferences returned by mapChildren are later discarded. Even though ARM
+ 32/64 contains indirect calls to mapChildren, those are made after the
+ arm{,64}LowerLabelReferences transformation which doesn't leave any
+ LabelReference nodes around for .mapChildren to be called on.
+
+ So this is not an issue for architectures other than MIPS because
+ (a) AddImmediates.fold correctly constructs a LabelReference with an offset by
+ calling LabelReference.plusOffset and
+ (b) they don't call (and therefore don't use the result of)
+ LabelReference.mapChildren in their lowering code.
+
+ Second, the code we generate needs to look up the /label/ in the GOT, not the
+ computed address. After the lookup, we simply need to add the offset.
+
+ * offlineasm/ast.rb:
+ * offlineasm/mips.rb:
+
2020-09-24 Ross Kirsling <[email protected]>
%TypedArray%.prototype.fill must only evaluate its argument once
Modified: trunk/Source/_javascript_Core/offlineasm/ast.rb (267534 => 267535)
--- trunk/Source/_javascript_Core/offlineasm/ast.rb 2020-09-24 16:14:55 UTC (rev 267534)
+++ trunk/Source/_javascript_Core/offlineasm/ast.rb 2020-09-24 16:16:59 UTC (rev 267535)
@@ -1163,7 +1163,9 @@
end
def mapChildren
- LabelReference.new(codeOrigin, (yield @label))
+ result = LabelReference.new(codeOrigin, (yield @label))
+ result.offset = @offset
+ result
end
def name
Modified: trunk/Source/_javascript_Core/offlineasm/mips.rb (267534 => 267535)
--- trunk/Source/_javascript_Core/offlineasm/mips.rb 2020-09-24 16:14:55 UTC (rev 267534)
+++ trunk/Source/_javascript_Core/offlineasm/mips.rb 2020-09-24 16:16:59 UTC (rev 267535)
@@ -1050,12 +1050,9 @@
when "leai", "leap"
if operands[0].is_a? LabelReference
labelRef = operands[0]
+ $asm.puts "lw #{operands[1].mipsOperand}, %got(#{labelRef.asmLabel})($gp)"
if labelRef.offset > 0
- $asm.puts "li #{operands[1].mipsOperand}, #{labelRef.asmLabel}"
$asm.puts "addu #{operands[1].mipsOperand}, #{operands[1].mipsOperand}, #{labelRef.offset}"
- $asm.puts "lw #{operands[1].mipsOperand}, %got(#{operands[1].mipsOperand})($gp)"
- else
- $asm.puts "lw #{operands[1].mipsOperand}, %got(#{labelRef.asmLabel})($gp)"
end
else
operands[0].mipsEmitLea(operands[1])
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes