Ignore:
Timestamp:
Feb 28, 2019, 12:48:50 PM (6 years ago)
Author:
[email protected]
Message:

cloop.rb shift mask should depend on the word size being shifted.
https://bugs.webkit.org/show_bug.cgi?id=195181
<rdar://problem/48484164>

Reviewed by Yusuke Suzuki.

Previously, we're always masking the shift amount with 0x1f. This is only correct
for 32-bit words. For 64-bit words, the mask should be 0x3f. For pointer sized
shifts, the mask depends on sizeof(uintptr_t).

  • offlineasm/cloop.rb:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/offlineasm/cloop.rb

    r239940 r242215  
    1 # Copyright (C) 2012-2018 Apple Inc. All rights reserved.
     1# Copyright (C) 2012-2019 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
     
    427427        truncationFooter = ""
    428428    end
    429     $asm.putc "#{dst.clLValue(type)} = #{truncationHeader}#{operands[1].clValue(type)} #{operator} (#{operands[0].clValue(:int)} & 0x1f)#{truncationFooter};"
     429    # FIXME: rename :int to :intptr to be match their expected names from C++. Ditto for :uint.
     430    # https://bugs.webkit.org/show_bug.cgi?id=195183
     431    shiftMask = "((sizeof(uintptr_t) == 8) ? 0x3f : 0x1f)" if type == :int || type == :uint
     432    shiftMask = "0x3f" if type == :int64 || type == :uint64
     433    shiftMask = "0x1f" if type == :int32 || type == :uint32
     434    $asm.putc "#{dst.clLValue(type)} = #{truncationHeader}#{operands[1].clValue(type)} #{operator} (#{operands[0].clValue(:int)} & #{shiftMask})#{truncationFooter};"
    430435end
    431436
Note: See TracChangeset for help on using the changeset viewer.