Changeset 128015 in webkit


Ignore:
Timestamp:
Sep 9, 2012 9:25:23 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Source/JavaScriptCore: Fixed a few llint C++ interpreter bugs.
https://bugs.webkit.org/show_bug.cgi?id=96127.

Patch by Mark Lam <mark.lam@apple.com> on 2012-09-09
Reviewed by Geoffrey Garen.

  • llint/LLIntCLoop.h:

CLoop::execute()'s bootstrapOpcodeId does not need a default
value. There is no case when this function is called without
that parameter being specified.

  • llint/LowLevelInterpreter.asm:

Moved the dispatchAfterCall() call to where it is needed.
For the C_LOOP back-end, it generates unreachable code.

  • llint/LowLevelInterpreter.cpp:

#include <wtf/Assertions.h> because LLIntAssembly.h needs it.

(JSC):

Fixed bug in SIGN_BIT32() macro.
Placate a MSVC warning for t0, and t1 being uninitialized.

(JSC::CLoop::execute):

The bootstrapOpcodeId arg should always be specified.
MSVC doesn't like UNUSED_PARAM() for labels. Switch to using

the new UNUSED_LABEL() macro.

  • offlineasm/cloop.rb:
  • offlineasm/generate_offset_extractor.rb:

Resolved a compiler warning found via MSVC.

Source/WTF: Fixed ASSERT() and ASSERT_AT() macros so that they can be used in
comma expressions. Also, added UNUSED_LABEL().
https://bugs.webkit.org/show_bug.cgi?id=96127.

Patch by Mark Lam <mark.lam@apple.com> on 2012-09-09
Reviewed by Geoffrey Garen.

  • wtf/Assertions.h:
  • wtf/UnusedParam.h: Added UNUSED_LABEL(). Removed an obsolete comment.
Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r128014 r128015  
     12012-09-09  Mark Lam  <mark.lam@apple.com>
     2
     3        Fixed a few llint C++ interpreter bugs.
     4        https://bugs.webkit.org/show_bug.cgi?id=96127.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * llint/LLIntCLoop.h:
     9            CLoop::execute()'s bootstrapOpcodeId does not need a default
     10            value. There is no case when this function is called without
     11            that parameter being specified.
     12        * llint/LowLevelInterpreter.asm:
     13            Moved the dispatchAfterCall() call to where it is needed.
     14            For the C_LOOP back-end, it generates unreachable code.
     15        * llint/LowLevelInterpreter.cpp:
     16            #include <wtf/Assertions.h> because LLIntAssembly.h needs it.
     17        (JSC):
     18            Fixed bug in SIGN_BIT32() macro.
     19            Placate a MSVC warning for t0, and t1 being uninitialized.
     20        (JSC::CLoop::execute):
     21            The bootstrapOpcodeId arg should always be specified.
     22            MSVC doesn't like UNUSED_PARAM() for labels. Switch to using
     23                the new UNUSED_LABEL() macro.
     24        * offlineasm/cloop.rb:
     25        * offlineasm/generate_offset_extractor.rb:
     26            Resolved a compiler warning found via MSVC.
     27
    1282012-09-09  Patrick Gansterer  <paroga@webkit.org>
    229
  • trunk/Source/JavaScriptCore/llint/LLIntCLoop.h

    r127374 r128015  
    4444public:
    4545    static void initialize();
    46     static JSValue execute(CallFrame*, OpcodeID bootstrapOpcodeId = llint_unused, bool isInitializationPass = false);
     46    static JSValue execute(CallFrame*, OpcodeID bootstrapOpcodeId, bool isInitializationPass = false);
    4747
    4848    static void* catchRoutineFor(Instruction* catchPCForInterpreter);
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r127393 r128015  
    178178            else
    179179                call callee
     180                dispatchAfterCall()
    180181            end
    181             dispatchAfterCall()
    182182        end)
    183183end
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp

    r127970 r128015  
    3737#include "LLIntSlowPaths.h"
    3838#include "VMInspector.h"
     39#include <wtf/Assertions.h>
    3940#include <wtf/MathExtras.h>
    4041
     
    9899#define OFFLINE_ASM_LOCAL_LABEL(label)   label:
    99100
     101
     102//============================================================================
     103// Some utilities:
     104//
    100105
    101106namespace JSC {
     
    117122
    118123
     124//============================================================================
     125// The llint C++ interpreter loop:
     126//
     127
    119128JSValue CLoop::execute(CallFrame* callFrame, OpcodeID bootstrapOpcodeId,
    120129                       bool isInitializationPass)
    121130{
    122131    #define CAST reinterpret_cast
    123     #define SIGN_BIT32(x) (x & 0x80000000)
     132    #define SIGN_BIT32(x) ((x) & 0x80000000)
    124133
    125134    // One-time initialization of our address tables. We have to put this code
     
    213222    CLoopDoubleRegister d0, d1;
    214223
     224#if COMPILER(MSVC)
     225    // Keep the compiler happy. We don't really need this, but the compiler
     226    // will complain. This makes the warning go away.
     227    t0.i = 0;
     228    t1.i = 0;
     229#endif
     230
    215231    // Instantiate the pseudo JIT stack frame used by the LLINT C Loop backend:
    216232    JITStackFrame jitStackFrame;
     
    253269    Opcode opcode;
    254270
    255     if (bootstrapOpcodeId != llint_unused)
    256         opcode = LLInt::getOpcode(bootstrapOpcodeId);
     271    opcode = LLInt::getOpcode(bootstrapOpcodeId);
    257272
    258273    #if ENABLE(OPCODE_STATS)
     
    396411
    397412    // Keep the compiler happy so that it doesn't complain about unused
    398     // labels for the LLInt trampoline glue:
     413    // labels for the LLInt trampoline glue. The labels are automatically
     414    // emitted by label macros above, and some of them are referenced by
     415    // the llint generated code. Since we can't tell ahead of time which
     416    // will be referenced and which will be not, we'll just passify the
     417    // compiler on all such labels:
    399418    #define LLINT_OPCODE_ENTRY(__opcode, length) \
    400         UNUSED_PARAM(&&__opcode);
     419        UNUSED_LABEL(__opcode);
    401420        FOR_EACH_LLINT_NATIVE_HELPER(LLINT_OPCODE_ENTRY)
    402421    #undef LLINT_OPCODE_ENTRY
  • trunk/Source/JavaScriptCore/offlineasm/cloop.rb

    r127941 r128015  
    173173        if base.is_a? RegisterID and base.name == "sp"
    174174            offsetValue = "#{offset.value}"
    175             "(assert(#{offsetValue} == offsetof(JITStackFrame, globalData)), &sp->globalData)"
     175            "(ASSERT(#{offsetValue} == offsetof(JITStackFrame, globalData)), &sp->globalData)"
    176176        elsif offset.value == 0
    177177            "#{base.clValue(:int8Ptr)}"
     
    237237        if base.is_a? RegisterID and base.name == "sp"
    238238            offsetValue = "(#{index.clValue(:int32)} << #{scaleShift}) + #{offset.clValue})"
    239             "(assert(#{offsetValue} == offsetof(JITStackFrame, globalData)), &sp->globalData)"
     239            "(ASSERT(#{offsetValue} == offsetof(JITStackFrame, globalData)), &sp->globalData)"
    240240        else
    241241            "#{base.clValue(:int8Ptr)} + (#{index.clValue(:int32)} << #{scaleShift}) + #{offset.clValue}"
  • trunk/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb

    r122650 r128015  
    4343    OFFSET_MAGIC_NUMBERS.each {
    4444        | number |
    45         $output.puts "#{number},"
     45        $output.puts "unsigned(#{number}),"
    4646    }
    4747end
     
    121121        OFFSET_HEADER_MAGIC_NUMBERS.each {
    122122            | number |
    123             $output.puts "#{number},"
     123            $output.puts "unsigned(#{number}),"
    124124        }
    125125
  • trunk/Source/WTF/ChangeLog

    r128014 r128015  
     12012-09-09  Mark Lam  <mark.lam@apple.com>
     2
     3        Fixed ASSERT() and ASSERT_AT() macros so that they can be used in
     4        comma expressions. Also, added UNUSED_LABEL().
     5        https://bugs.webkit.org/show_bug.cgi?id=96127.
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * wtf/Assertions.h:
     10        * wtf/UnusedParam.h: Added UNUSED_LABEL(). Removed an obsolete comment.
     11
    1122012-09-09  Patrick Gansterer  <paroga@webkit.org>
    213
  • trunk/Source/WTF/wtf/Assertions.h

    r127941 r128015  
    169169#ifndef CRASH
    170170#if COMPILER(CLANG)
    171 #define CRASH() do { \
    172     WTFReportBacktrace(); \
    173     WTFInvokeCrashHook(); \
    174     *(int *)(uintptr_t)0xbbadbeef = 0; \
    175     __builtin_trap(); \
    176 } while (0)
    177 #else
    178 #define CRASH() do { \
    179     WTFReportBacktrace(); \
    180     WTFInvokeCrashHook(); \
    181     *(int *)(uintptr_t)0xbbadbeef = 0; \
    182     ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
    183 } while (0)
     171#define CRASH() \
     172    (WTFReportBacktrace(), \
     173     WTFInvokeCrashHook(), \
     174     (*(int *)(uintptr_t)0xbbadbeef = 0), \
     175     __builtin_trap())
     176#else
     177#define CRASH() \
     178    (WTFReportBacktrace(), \
     179     WTFInvokeCrashHook(), \
     180     (*(int *)(uintptr_t)0xbbadbeef = 0), \
     181     ((void(*)())0)() /* More reliable, but doesn't say BBADBEEF */ \
     182    )
    184183#endif
    185184#endif
     
    245244#else
    246245
    247 #define ASSERT(assertion) do \
    248     if (!(assertion)) { \
    249         WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion); \
    250         CRASH(); \
    251     } \
    252 while (0)
    253 
    254 #define ASSERT_AT(assertion, file, line, function) do  \
    255     if (!(assertion)) { \
    256         WTFReportAssertionFailure(file, line, function, #assertion); \
    257         CRASH(); \
    258     } \
    259 while (0)
     246#define ASSERT(assertion) \
     247    (!(assertion) ? \
     248        (WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion), \
     249         CRASH()) : \
     250        (void)0)
     251
     252#define ASSERT_AT(assertion, file, line, function) \
     253    (!(assertion) ? \
     254        (WTFReportAssertionFailure(file, line, function, #assertion), \
     255         CRASH()) :                                                   \
     256        (void)0)
    260257
    261258#define ASSERT_NOT_REACHED() do { \
  • trunk/Source/WTF/wtf/UnusedParam.h

    r111778 r128015  
    2222#define WTF_UnusedParam_h
    2323
    24 /* don't use this for C++, it should only be used in plain C files or
    25    ObjC methods, where leaving off the parameter name is not allowed. */
    26 
    2724#include <wtf/Platform.h>
    2825
     
    3532#endif
    3633
     34/* This is to keep the compiler from complaining when for local labels are
     35   declared but not referenced. For example, this can happen with code that
     36   works with auto-generated code.
     37*/
     38#if COMPILER(MSVC)
     39#define UNUSED_LABEL(label) if (false) goto label
     40#else
     41#define UNUSED_LABEL(label) UNUSED_PARAM(&& label)
     42#endif
     43
    3744#endif /* WTF_UnusedParam_h */
Note: See TracChangeset for help on using the changeset viewer.