Changeset 242215 in webkit


Ignore:
Timestamp:
Feb 28, 2019 12:48:50 PM (5 years ago)
Author:
mark.lam@apple.com
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:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r242196 r242215  
     12019-02-28  Mark Lam  <mark.lam@apple.com>
     2
     3        cloop.rb shift mask should depend on the word size being shifted.
     4        https://bugs.webkit.org/show_bug.cgi?id=195181
     5        <rdar://problem/48484164>
     6
     7        Reviewed by Yusuke Suzuki.
     8
     9        Previously, we're always masking the shift amount with 0x1f.  This is only correct
     10        for 32-bit words.  For 64-bit words, the mask should be 0x3f.  For pointer sized
     11        shifts, the mask depends on sizeof(uintptr_t).
     12
     13        * offlineasm/cloop.rb:
     14
    1152019-02-28  Justin Fan  <justin_fan@apple.com>
    216
  • 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.