Ignore:
Timestamp:
Oct 11, 2018, 7:51:45 PM (7 years ago)
Author:
[email protected]
Message:

[JSC] Remove gcc warnings on mips and armv7
https://bugs.webkit.org/show_bug.cgi?id=188598

Reviewed by Mark Lam.

Source/bmalloc:

Add bitwise_cast (from WTF) and use it instead of reinterpret_cast in
a couple places where reinterpret_cast triggers a warning about
alignment even though we know that alignment is correct.

  • bmalloc/Algorithm.h:

(bmalloc::bitwise_cast): Copied from WTF/wtf/StdLibextras.h

  • bmalloc/IsoDirectoryPageInlines.h:

(bmalloc::IsoDirectoryPage<Config>::pageFor):

  • bmalloc/IsoPageInlines.h:

(bmalloc::IsoPage<Config>::startAllocating):

Source/JavaScriptCore:

Fix many gcc/clang warnings that are false positives, mostly alignment
issues.

  • assembler/MacroAssemblerPrinter.cpp:

(JSC::Printer::printMemory):
Use bitwise_cast instead of reinterpret_cast.

  • assembler/testmasm.cpp:

(JSC::floatOperands):
marked as potentially unused as it is not used on all platforms.
(JSC::testProbeModifiesStackValues):
modifiedFlags is not used on mips, so don't declare it.

  • bytecode/CodeBlock.h:

Make ScriptExecutable::prepareForExecution() return an
std::optional<Exception*> instead of a JSObject*.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::executeProgram):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeModuleProgram):
Update calling code for the prototype change of
ScriptExecutable::prepareForExecution().

  • jit/JITOperations.cpp: Same as for Interpreter.cpp.
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::setUpCall): Same as for Interpreter.cpp.

  • runtime/JSBigInt.cpp:

(JSC::JSBigInt::dataStorage):
Use bitwise_cast instead of reinterpret_cast.

  • runtime/ScriptExecutable.cpp:
  • runtime/ScriptExecutable.h:

Make ScriptExecutable::prepareForExecution() return an
std::optional<Exception*> instead of a JSObject*.

  • tools/JSDollarVM.cpp:

(JSC::codeBlockFromArg): Use bitwise_cast instead of reinterpret_cast.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp

    r236805 r237063  
    132132    }
    133133
     134    // assuming memory is not malformed, it originally pointed to a value
     135    // of the size with which we use it below, so the bitwise_casts should
     136    // be safe, including regarding alignment.
    134137    if (memory.dumpStyle == Memory::SingleWordDump) {
    135138        if (memory.numBytes == sizeof(int8_t)) {
     
    139142        }
    140143        if (memory.numBytes == sizeof(int16_t)) {
    141             auto p = reinterpret_cast<int16_t*>(ptr);
     144            auto p = bitwise_cast<int16_t*>(ptr);
    142145            out.printf("%p:<0x%04x %d>", p, *p, *p);
    143146            return;
    144147        }
    145148        if (memory.numBytes == sizeof(int32_t)) {
    146             auto p = reinterpret_cast<int32_t*>(ptr);
     149            auto p = bitwise_cast<int32_t*>(ptr);
    147150            out.printf("%p:<0x%08x %d>", p, *p, *p);
    148151            return;
    149152        }
    150153        if (memory.numBytes == sizeof(int64_t)) {
    151             auto p = reinterpret_cast<int64_t*>(ptr);
     154            auto p = bitwise_cast<int64_t*>(ptr);
    152155            out.printf("%p:<0x%016" PRIx64 " %" PRId64 ">", p, *p, *p);
    153156            return;
Note: See TracChangeset for help on using the changeset viewer.