| Differences between
and this patch
- Source/JavaScriptCore/ChangeLog +35 lines
Lines 1-3 Source/JavaScriptCore/ChangeLog_sec1
1
2013-10-11  Filip Pizlo  <fpizlo@apple.com>
2
3
        FTL OSR exit should perform zero extension on values smaller than 64-bit
4
        https://bugs.webkit.org/show_bug.cgi?id=122688
5
6
        Reviewed by NOBODY (OOPS!).
7
        
8
        In the DFG we usually make the simplistic assumption that a 32-bit value in a 64-bit
9
        register will have zeros on the high bits.  In the few cases where the high bits are
10
        non-zero, the DFG sort of tells us this explicitly.
11
12
        But when working with llvm.webkit.stackmap, it doesn't work that way.  Consider we might
13
        emit LLVM IR like:
14
15
            %2 = trunc i64 %1 to i32
16
            stuff %2
17
            call @llvm.webkit.stackmap(...., %2)
18
19
        LLVM may never actually emit a truncation instruction of any kind.  And that's great - in
20
        many cases it won't be needed, like if %2 is a 32-bit op that ignores the high bits
21
        anyway.  Hence LLVM may tell us that %2 is in the register that still had the value from
22
        before truncation, and that register may have garbage in the high bits.
23
24
        This means that on our end, if we want a 32-bit value and we want that value to be
25
        zero-extended, we should zero-extend it ourselves.  This is pretty easy and should be
26
        cheap, so we should just do it and not make it a requirement that LLVM does it on its
27
        end.
28
        
29
        This makes all tests pass with JSC_ftlOSRExitUsesStackmap=true.
30
31
        * ftl/FTLOSRExitCompiler.cpp:
32
        (JSC::FTL::compileStubWithOSRExitStackmap):
33
        * ftl/FTLValueFormat.cpp:
34
        (JSC::FTL::reboxAccordingToFormat):
35
1
2013-10-11  Darin Adler  <darin@apple.com>
36
2013-10-11  Darin Adler  <darin@apple.com>
2
37
3
        Change most call sites to call ICU directly instead of through WTF::Unicode
38
        Change most call sites to call ICU directly instead of through WTF::Unicode
- Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp -2 / +3 lines
Lines 171-180 static void compileStubWithOSRExitStackm Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp_sec1
171
    exit.m_code = FINALIZE_CODE_IF(
171
    exit.m_code = FINALIZE_CODE_IF(
172
        shouldShowDisassembly(),
172
        shouldShowDisassembly(),
173
        patchBuffer,
173
        patchBuffer,
174
        ("FTL OSR exit #%u (bc#%u, %s) from %s, with operands = %s",
174
        ("FTL OSR exit #%u (bc#%u, %s) from %s, with operands = %s, and record = %s",
175
            exitID, exit.m_codeOrigin.bytecodeIndex,
175
            exitID, exit.m_codeOrigin.bytecodeIndex,
176
            exitKindToString(exit.m_kind), toCString(*codeBlock).data(),
176
            exitKindToString(exit.m_kind), toCString(*codeBlock).data(),
177
            toCString(ignoringContext<DumpContext>(exit.m_values)).data()));
177
            toCString(ignoringContext<DumpContext>(exit.m_values)).data(),
178
            toCString(*record).data()));
178
}
179
}
179
180
180
static void compileStubWithoutOSRExitStackmap(
181
static void compileStubWithoutOSRExitStackmap(
- Source/JavaScriptCore/ftl/FTLValueFormat.cpp +3 lines
Lines 37-47 void reboxAccordingToFormat( Source/JavaScriptCore/ftl/FTLValueFormat.cpp_sec1
37
{
37
{
38
    switch (format) {
38
    switch (format) {
39
    case ValueFormatInt32: {
39
    case ValueFormatInt32: {
40
        jit.zeroExtend32ToPtr(value, value);
40
        jit.or64(GPRInfo::tagTypeNumberRegister, value);
41
        jit.or64(GPRInfo::tagTypeNumberRegister, value);
41
        break;
42
        break;
42
    }
43
    }
43
    
44
    
44
    case ValueFormatUInt32: {
45
    case ValueFormatUInt32: {
46
        jit.zeroExtend32ToPtr(value, value);
45
        jit.moveDoubleTo64(FPRInfo::fpRegT0, scratch2);
47
        jit.moveDoubleTo64(FPRInfo::fpRegT0, scratch2);
46
        jit.boxInt52(value, value, scratch1, FPRInfo::fpRegT0);
48
        jit.boxInt52(value, value, scratch1, FPRInfo::fpRegT0);
47
        jit.move64ToDouble(scratch2, FPRInfo::fpRegT0);
49
        jit.move64ToDouble(scratch2, FPRInfo::fpRegT0);
Lines 64-69 void reboxAccordingToFormat( Source/JavaScriptCore/ftl/FTLValueFormat.cpp_sec2
64
    }
66
    }
65
    
67
    
66
    case ValueFormatBoolean: {
68
    case ValueFormatBoolean: {
69
        jit.zeroExtend32ToPtr(value, value);
67
        jit.or32(MacroAssembler::TrustedImm32(ValueFalse), value);
70
        jit.or32(MacroAssembler::TrustedImm32(ValueFalse), value);
68
        break;
71
        break;
69
    }
72
    }

Return to Bug 122688