Source/JavaScriptCore/ChangeLog

 12014-06-23 peavo@outlook.com <peavo@outlook.com>
 2
 3 [Win64] ASM LLINT is not enabled.
 4 https://bugs.webkit.org/show_bug.cgi?id=130638
 5
 6 This patch adds a new LLINT assembler backend for Win64, and implements it.
 7 It makes adjustments to follow the Win64 ABI spec. where it's found to be needed.
 8 Also, LLINT and JIT is enabled for Win64.
 9
 10 Reviewed by NOBODY (OOPS!).
 11
 12 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: Added JITStubsMSVC64.asm.
 13 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: Ditto.
 14 * JavaScriptCore/JavaScriptCore.vcxproj/jsc/jscCommon.props: Increased stack size to avoid stack overflow in tests.
 15 * JavaScriptCore.vcxproj/LLInt/LLIntAssembly/build-LLIntAssembly.sh: Generate assembler source file for Win64.
 16 * assembler/MacroAssemblerX86_64.h:
 17 (JSC::MacroAssemblerX86_64::call): Follow Win64 ABI spec.
 18 * jit/CCallHelpers.h: Ditto.
 19 * jit/JITStubsMSVC64.asm: Added.
 20 * jit/Repatch.cpp:
 21 (JSC::emitPutTransitionStub): Compile fix.
 22 * jit/ThunkGenerators.cpp:
 23 (JSC::nativeForGenerator): Follow Win64 ABI spec.
 24 * llint/LLIntData.cpp:
 25 (JSC::LLInt::Data::performAssertions): Ditto.
 26 * llint/LLIntOfflineAsmConfig.h: Enable new llint backend for Win64.
 27 * llint/LowLevelInterpreter.asm: Implement new Win64 backend, and follow Win64 ABI spec.
 28 * llint/LowLevelInterpreter64.asm: Ditto.
 29 * offlineasm/asm.rb: Compile fix.
 30 * offlineasm/backends.rb: Add new llint backend for Win64.
 31 * offlineasm/settings.rb: Compile fix.
 32 * offlineasm/x86.rb: Implement new llint Win64 backend.
 33
1342014-06-20 Sam Weinig <sam@webkit.org>
235
336 Remove static tables for bindings that use eager reification
170309

Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

15911591 <UseSafeExceptionHandlers Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</UseSafeExceptionHandlers>
15921592 <UseSafeExceptionHandlers Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</UseSafeExceptionHandlers>
15931593 </MASM>
 1594 <MASM Include="..\jit\JITStubsMSVC64.asm">
 1595 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
 1596 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
 1597 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
 1598 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
 1599 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
 1600 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
 1601 </MASM>
15941602 </ItemGroup>
15951603 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
15961604 <ImportGroup Label="ExtensionTargets">
15971605 <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
15981606 </ImportGroup>
1599 </Project>
 1607</Project>
170309

Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

37143714 </ItemGroup>
37153715 <ItemGroup>
37163716 <MASM Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\LowLevelInterpreterWin.asm" />
 3717 <MASM Include="..\jit\JITStubsMSVC64.asm">
 3718 <Filter>jit</Filter>
 3719 </MASM>
37173720 </ItemGroup>
3718 </Project>
 3721</Project>
170309

Source/JavaScriptCore/JavaScriptCore.vcxproj/LLInt/LLIntAssembly/build-LLIntAssembly.sh

@@cd "${BUILT_PRODUCTS_DIR}/JavaScriptCore
2525
2626printf "END" > LowLevelInterpreterWin.asm
2727
28 # Win32 is using the LLINT x86 backend, and should generate an assembler file.
29 # Win64 is using the LLINT C backend, and should generate a header file.
 28# If you want to enable the LLINT C loop, set OUTPUTFILENAME to "LLIntAssembly.h"
3029
31 if [ "${PLATFORMARCHITECTURE}" == "32" ]; then
32  OUTPUTFILENAME="LowLevelInterpreterWin.asm"
33 else
34  OUTPUTFILENAME="LLIntAssembly.h"
35 fi
 30OUTPUTFILENAME="LowLevelInterpreterWin.asm"
3631
3732/usr/bin/env ruby "${SRCROOT}/offlineasm/asm.rb" "-I." "${SRCROOT}/llint/LowLevelInterpreter.asm" "${BUILT_PRODUCTS_DIR}/LLIntOffsetsExtractor/LLIntOffsetsExtractor${3}.exe" "${OUTPUTFILENAME}" || exit 1
170309

Source/JavaScriptCore/JavaScriptCore.vcxproj/jsc/jscCommon.props

1616 <ModuleDefinitionFile>
1717 </ModuleDefinitionFile>
1818 <SubSystem>Console</SubSystem>
 19 <StackReserveSize>2097152</StackReserveSize>
1920 </Link>
2021 </ItemDefinitionGroup>
2122 <ItemGroup />
170309

Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h

@@public:
153153
154154 Call call()
155155 {
 156#if OS(WINDOWS)
 157 // JIT relies on the CallerFrame (frame pointer) being put on the stack,
 158 // On Win64 we need to manually copy the frame pointer to the stack, since MSVC may not maintain a frame pointer on 64-bit.
 159 // See http://msdn.microsoft.com/en-us/library/9z1stfyw.aspx where it's stated that rbp MAY be used as a frame pointer.
 160 store64(X86Registers::ebp, Address(X86Registers::esp, -16));
 161
 162 // We also need to allocate the shadow space on the stack for the 4 parameter registers.
 163 // Also, we should allocate 16 bytes for the frame pointer, and return address (not populated).
 164 // In addition, we need to allocate 16 bytes for two more parameters, since the call can have up to 6 parameters.
 165 // Note: POKE_ARGUMENT_OFFSET is adjusted accordingly.
 166 sub64(TrustedImm32(8 * sizeof(int64_t)), X86Registers::esp);
 167#endif
156168 DataLabelPtr label = moveWithPatch(TrustedImmPtr(0), scratchRegister);
157169 Call result = Call(m_assembler.call(scratchRegister), Call::Linkable);
 170#if OS(WINDOWS)
 171 add64(TrustedImm32(8 * sizeof(int64_t)), X86Registers::esp);
 172#endif
158173 ASSERT_UNUSED(label, differenceBetween(label, result) == REPTACH_OFFSET_CALL_R11);
159174 return result;
160175 }
170309

Source/JavaScriptCore/jit/CCallHelpers.h

@@public:
779779 setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg1, arg2, arg3);
780780 }
781781
782 #if CPU(MIPS) || (OS(WINDOWS) && CPU(X86_64))
 782#if CPU(MIPS)
783783#define POKE_ARGUMENT_OFFSET 4
 784#elif CPU(X86_64) && OS(WINDOWS)
 785#define POKE_ARGUMENT_OFFSET -4
784786#else
785787#define POKE_ARGUMENT_OFFSET 0
786788#endif
170309

Source/JavaScriptCore/jit/JITStubsMSVC64.asm

 1;/*
 2; Copyright (C) 2014 Apple Inc. All rights reserved.
 3;
 4; Redistribution and use in source and binary forms, with or without
 5; modification, are permitted provided that the following conditions
 6; are met:
 7; 1. Redistributions of source code must retain the above copyright
 8; notice, this list of conditions and the following disclaimer.
 9; 2. Redistributions in binary form must reproduce the above copyright
 10; notice, this list of conditions and the following disclaimer in the
 11; documentation and/or other materials provided with the distribution.
 12;
 13; THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21; OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24;*/
 25
 26EXTERN getHostCallReturnValueWithExecState : near
 27
 28PUBLIC getHostCallReturnValue
 29
 30_TEXT SEGMENT
 31
 32getHostCallReturnValue PROC
 33 mov rcx, rbp
 34 ; Allocate space for all 4 parameter registers, and align stack pointer to 16 bytes boundary by allocating another 8 bytes.
 35 ; The stack alignment is needed to fix a crash in the CRT library on a floating point instruction.
 36 sub rsp, 40
 37 call getHostCallReturnValueWithExecState
 38 add rsp, 40
 39 ret
 40getHostCallReturnValue ENDP
 41
 42_TEXT ENDS
 43
 44END
0

Source/JavaScriptCore/jit/Repatch.cpp

@@static void emitPutTransitionStub(
10821082 ASSERT(oldStructure->typeInfo().type() == structure->typeInfo().type());
10831083 ASSERT(oldStructure->typeInfo().inlineTypeFlags() == structure->typeInfo().inlineTypeFlags());
10841084 ASSERT(oldStructure->indexingType() == structure->indexingType());
1085  stubJit.store32(MacroAssembler::TrustedImm32(reinterpret_cast<uint32_t>(structure->id())), MacroAssembler::Address(baseGPR, JSCell::structureIDOffset()));
 1085#if USE(JSVALUE64)
 1086 uint32_t val = structure->id();
 1087#else
 1088 uint32_t val = reinterpret_cast<uint32_t>(structure->id());
 1089#endif
 1090 stubJit.store32(MacroAssembler::TrustedImm32(val), MacroAssembler::Address(baseGPR, JSCell::structureIDOffset()));
10861091#if USE(JSVALUE64)
10871092 if (isInlineOffset(slot.cachedOffset()))
10881093 stubJit.store64(valueGPR, MacroAssembler::Address(baseGPR, JSObject::offsetOfInlineStorage() + offsetInInlineStorage(slot.cachedOffset()) * sizeof(JSValue)));
170309

Source/JavaScriptCore/jit/ThunkGenerators.cpp

@@static MacroAssemblerCodeRef nativeForGe
315315 // Host function signature: f(ExecState*);
316316 jit.move(JSInterfaceJIT::callFrameRegister, X86Registers::ecx);
317317
318  // Leave space for the callee parameter home addresses and align the stack.
319  jit.subPtr(JSInterfaceJIT::TrustedImm32(4 * sizeof(int64_t) + 16 - sizeof(int64_t)), JSInterfaceJIT::stackPointerRegister);
 318 // Leave space for the callee parameter home addresses.
 319 // At this point the stack is aligned to 16 bytes, but if this changes at some point, we need to emit code to align it.
 320 jit.subPtr(JSInterfaceJIT::TrustedImm32(4 * sizeof(int64_t)), JSInterfaceJIT::stackPointerRegister);
320321
321322 jit.emitGetFromCallFrameHeaderPtr(JSStack::Callee, X86Registers::edx);
322323 jit.loadPtr(JSInterfaceJIT::Address(X86Registers::edx, JSFunction::offsetOfExecutable()), X86Registers::r9);
323324 jit.call(JSInterfaceJIT::Address(X86Registers::r9, executableOffsetToFunction));
324325
325  jit.addPtr(JSInterfaceJIT::TrustedImm32(4 * sizeof(int64_t) + 16 - sizeof(int64_t)), JSInterfaceJIT::stackPointerRegister);
 326 jit.addPtr(JSInterfaceJIT::TrustedImm32(4 * sizeof(int64_t)), JSInterfaceJIT::stackPointerRegister);
326327#endif
327328
328329#elif CPU(ARM64)

@@static MacroAssemblerCodeRef nativeForGe
398399 jit.loadPtr(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister), JSInterfaceJIT::regT0);
399400 jit.push(JSInterfaceJIT::regT0);
400401#else
 402#if OS(WINDOWS)
 403 // Allocate space on stack for the 4 parameter registers.
 404 jit.subPtr(JSInterfaceJIT::TrustedImm32(4 * sizeof(int64_t)), JSInterfaceJIT::stackPointerRegister);
 405#endif
401406 jit.loadPtr(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister), JSInterfaceJIT::argumentGPR0);
402407#endif
403408 jit.move(JSInterfaceJIT::TrustedImmPtr(FunctionPtr(operationVMHandleException).value()), JSInterfaceJIT::regT3);
404409 jit.call(JSInterfaceJIT::regT3);
405410#if CPU(X86) && USE(JSVALUE32_64)
406411 jit.addPtr(JSInterfaceJIT::TrustedImm32(16), JSInterfaceJIT::stackPointerRegister);
 412#elif OS(WINDOWS)
 413 jit.addPtr(JSInterfaceJIT::TrustedImm32(4 * sizeof(int64_t)), JSInterfaceJIT::stackPointerRegister);
407414#endif
408415
409416 jit.jumpToExceptionHandler();
170309

Source/JavaScriptCore/llint/LLIntData.cpp

@@void Data::performAssertions(VM& vm)
123123 ASSERT(ValueUndefined == (TagBitTypeOther | TagBitUndefined));
124124 ASSERT(ValueNull == TagBitTypeOther);
125125#endif
126 #if CPU(X86_64) || CPU(ARM64) || !ENABLE(JIT)
 126#if (CPU(X86_64) && !OS(WINDOWS)) || CPU(ARM64) || !ENABLE(JIT)
127127 ASSERT(!maxFrameExtentForSlowPathCall);
128128#elif CPU(ARM) || CPU(SH4)
129129 ASSERT(maxFrameExtentForSlowPathCall == 24);
130130#elif CPU(X86) || CPU(MIPS)
131131 ASSERT(maxFrameExtentForSlowPathCall == 40);
 132#elif CPU(X86_64) && OS(WINDOWS)
 133 ASSERT(maxFrameExtentForSlowPathCall == 64);
132134#endif
133135 ASSERT(StringType == 5);
134136 ASSERT(ObjectType == 18);
170309

Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h

3939#define OFFLINE_ASM_ARMv7_TRADITIONAL 0
4040#define OFFLINE_ASM_ARM64 0
4141#define OFFLINE_ASM_X86_64 0
 42#define OFFLINE_ASM_X86_64_WIN 0
4243#define OFFLINE_ASM_ARMv7s 0
4344#define OFFLINE_ASM_MIPS 0
4445#define OFFLINE_ASM_SH4 0

8485#define OFFLINE_ASM_ARM 0
8586#endif
8687
87 #if CPU(X86_64)
 88#if CPU(X86_64) && !PLATFORM(WIN)
8889#define OFFLINE_ASM_X86_64 1
8990#else
9091#define OFFLINE_ASM_X86_64 0
9192#endif
9293
 94#if CPU(X86_64) && PLATFORM(WIN)
 95#define OFFLINE_ASM_X86_64_WIN 1
 96#else
 97#define OFFLINE_ASM_X86_64_WIN 0
 98#endif
 99
93100#if CPU(MIPS)
94101#define OFFLINE_ASM_MIPS 1
95102#else
170309

Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

@@macro cCall2(function, arg1, arg2)
5757 move arg1, t4
5858 move arg2, t5
5959 call function
 60 elsif X86_64_WIN
 61 # Note: this implementation is only correct if the return type size is > 8 bytes.
 62 # See macro cCall2Void for an implementation when the return type <= 8 bytes.
 63 # On Win64, when the return type is larger than 8 bytes, we need to allocate space on the stack for the return value.
 64 # On entry rcx (t2), should contain a pointer to this stack space. The other parameters are shifted to the right,
 65 # rdx (t1) should contain the first argument, and r8 (t6) should contain the second argument.
 66 # On return, rax contains a pointer to this stack value, and we then need to copy the 16 byte return value into rax (t0) and rdx (t1)
 67 # since the return value is expected to be split between the two.
 68 # See http://msdn.microsoft.com/en-us/library/7572ztz4.aspx
 69 move arg1, t1
 70 move arg2, t6
 71 subp 48, sp
 72 move sp, t2
 73 addp 32, t2
 74 call function
 75 addp 48, sp
 76 move 8[t0], t1
 77 move [t0], t0
6078 elsif ARM64
6179 move arg1, t0
6280 move arg2, t1

@@end
7189macro cCall2Void(function, arg1, arg2)
7290 if C_LOOP
7391 cloopCallSlowPathVoid function, arg1, arg2
 92 elsif X86_64_WIN
 93 # Note: we cannot use the cCall2 macro for Win64 in this case,
 94 # as the Win64 cCall2 implemenation is only correct when the return type size is > 8 bytes.
 95 # On Win64, rcx and rdx are used for passing the first two parameters.
 96 # We also need to make room on the stack for all four parameter registers.
 97 # See http://msdn.microsoft.com/en-us/library/ms235286.aspx
 98 move arg2, t1
 99 move arg1, t2
 100 subp 32, sp
 101 call function
 102 addp 32, sp
74103 else
75104 cCall2(function, arg1, arg2)
76105 end

@@macro cCall4(function, arg1, arg2, arg3,
85114 move arg3, t1
86115 move arg4, t2
87116 call function
 117 elsif X86_64_WIN
 118 # On Win64, rcx, rdx, r8, and r9 are used for passing the first four parameters.
 119 # We also need to make room on the stack for all four parameter registers.
 120 # See http://msdn.microsoft.com/en-us/library/ms235286.aspx
 121 move arg1, t2
 122 move arg2, t1
 123 move arg3, t6
 124 move arg4, t7
 125 subp 32, sp
 126 call function
 127 addp 32, sp
88128 elsif ARM64
89129 move arg1, t0
90130 move arg2, t1

@@macro doCallToJavaScript(makeCall)
109149 const temp1 = t0
110150 const temp2 = t3
111151 const temp3 = t6
 152 elsif X86_64_WIN
 153 const entry = t2
 154 const vm = t1
 155 const protoCallFrame = t6
 156
 157 const previousCFR = t0
 158 const previousPC = t4
 159 const temp1 = t0
 160 const temp2 = t3
 161 const temp3 = t7
112162 elsif ARM64 or C_LOOP
113163 const entry = a0
114164 const vm = a1

@@macro doCallToJavaScript(makeCall)
126176 if X86_64
127177 loadp 7*8[sp], previousPC
128178 move 6*8[sp], previousCFR
 179 elsif X86_64_WIN
 180 # Win64 pushes two more registers
 181 loadp 9*8[sp], previousPC
 182 move 8*8[sp], previousCFR
129183 elsif ARM64
130184 move cfr, previousCFR
131185 end

@@macro doCallToJavaScript(makeCall)
142196 loadp VM::topCallFrame[vm], temp2
143197 storep temp2, ScopeChain[cfr]
144198 storep 1, CodeBlock[cfr]
145  if X86_64
146  loadp 7*8[sp], previousPC
147  loadp 6*8[sp], previousCFR
148  end
 199
149200 storep previousPC, ReturnPC[cfr]
150201 storep previousCFR, CallerFrame[cfr]
151202

@@macro doCallToJavaScript(makeCall)
238289
239290 checkStackPointerAlignment(temp3, 0xbad0dc04)
240291
241  if X86_64
 292 if X86_64 or X86_64_WIN
242293 pop t5
243294 end
244295 callToJavaScriptEpilogue()

@@macro makeHostFunctionCall(entry, temp)
262313 move entry, temp
263314 if X86_64
264315 move sp, t4
 316 elsif X86_64_WIN
 317 move sp, t2
265318 elsif ARM64 or C_LOOP
266319 move sp, a0
267320 end

@@macro makeHostFunctionCall(entry, temp)
269322 storep cfr, [sp]
270323 storep lr, 8[sp]
271324 cloopCallNative temp
 325 elsif X86_64_WIN
 326 # For a host function call, JIT relies on that the CallerFrame (frame pointer) is put on the stack,
 327 # On Win64 we need to manually copy the frame pointer to the stack, since MSVC may not maintain a frame pointer on 64-bit.
 328 # See http://msdn.microsoft.com/en-us/library/9z1stfyw.aspx where it's stated that rbp MAY be used as a frame pointer.
 329 storep cfr, [sp]
 330
 331 # We need to allocate 32 bytes on the stack for the shadow space.
 332 subp 32, sp
 333 call temp
 334 addp 32, sp
272335 else
273  addp 16, sp
 336 addp 16, sp
274337 call temp
275338 subp 16, sp
276339 end

@@_llint_op_sub:
9571020
9581021_llint_op_div:
9591022 traceExecution()
960  if X86_64
 1023 if X86_64 or X86_64_WIN
9611024 binaryOpCustomStore(
9621025 macro (left, right, slow, index)
9631026 # Assume t3 is scratchable.

@@macro putById(getPropertyStorage)
12961359 storeq scratch, [propertyStorage, t1]
12971360 dispatch(9)
12981361 end)
 1362
 1363 .opPutByIdSlow:
 1364 callSlowPath(_llint_slow_path_put_by_id)
 1365 dispatch(9)
 1366
12991367end
13001368
13011369_llint_op_put_by_id:
13021370 putById(withInlineStorage)
13031371
1304 .opPutByIdSlow:
1305  callSlowPath(_llint_slow_path_put_by_id)
1306  dispatch(9)
1307 
13081372
13091373_llint_op_put_by_id_out_of_line:
13101374 putById(withOutOfLineStorage)

@@macro putByIdTransition(additionalChecks
13181382 loadConstantOrVariableCell(t3, t0, .opPutByIdSlow)
13191383 loadStructureWithScratch(t0, t2, t3)
13201384 bpneq t2, t1, .opPutByIdSlow
1321  additionalChecks(t1, t3, t2)
 1385 additionalChecks(t1, t3, t2, .opPutByIdSlow)
13221386 loadisFromInstruction(3, t2)
13231387 loadisFromInstruction(5, t1)
13241388 getPropertyStorage(

@@macro putByIdTransition(additionalChecks
13331397 storei t1, JSCell::m_structureID[t0]
13341398 dispatch(9)
13351399 end)
 1400
 1401 .opPutByIdSlow:
 1402 callSlowPath(_llint_slow_path_put_by_id)
 1403 dispatch(9)
 1404
13361405end
13371406
1338 macro noAdditionalChecks(oldStructure, scratch, scratch2)
 1407macro noAdditionalChecks(oldStructure, scratch, scratch2, slowPath)
13391408end
13401409
1341 macro structureChainChecks(oldStructure, scratch, scratch2)
 1410macro structureChainChecks(oldStructure, scratch, scratch2, slowPath)
13421411 const protoCell = oldStructure # Reusing the oldStructure register for the proto
13431412 loadpFromInstruction(7, scratch)
13441413 assert(macro (ok) btpnz scratch, ok end)

@@macro structureChainChecks(oldStructure,
13491418 loadq Structure::m_prototype[oldStructure], protoCell
13501419 loadStructureAndClobberFirstArg(protoCell, scratch2)
13511420 move scratch2, oldStructure
1352  bpneq oldStructure, [scratch], .opPutByIdSlow
 1421 bpneq oldStructure, [scratch], slowPath
13531422 addp 8, scratch
13541423 bqneq Structure::m_prototype[oldStructure], ValueNull, .loop
13551424.done:

@@macro nativeCallTrampoline(executableOff
19682037
19692038 functionPrologue()
19702039 storep 0, CodeBlock[cfr]
1971  if X86_64
 2040 if X86_64 or X86_64_WIN
 2041 if X86_64
 2042 const arg1 = t4 # t4 = rdi
 2043 const arg2 = t5 # t5 = rsi
 2044 const temp = t1
 2045 elsif X86_64_WIN
 2046 const arg1 = t2 # t2 = rcx
 2047 const arg2 = t1 # t1 = rdx
 2048 const temp = t0
 2049 end
19722050 loadp ScopeChain[cfr], t0
19732051 andp MarkedBlockMask, t0
19742052 loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t0], t0

@@macro nativeCallTrampoline(executableOff
19762054 loadp CallerFrame[cfr], t0
19772055 loadq ScopeChain[t0], t1
19782056 storeq t1, ScopeChain[cfr]
1979  move cfr, t4 # t4 = rdi
1980  loadp Callee[cfr], t5 # t5 = rsi
1981  loadp JSFunction::m_executable[t5], t1
 2057 move cfr, arg1
 2058 loadp Callee[cfr], arg2
 2059 loadp JSFunction::m_executable[arg2], temp
19822060 checkStackPointerAlignment(t3, 0xdead0001)
1983  call executableOffsetToFunction[t1]
 2061 if X86_64_WIN
 2062 subp 32, sp
 2063 end
 2064 call executableOffsetToFunction[temp]
 2065 if X86_64_WIN
 2066 addp 32, sp
 2067 end
19842068 loadp ScopeChain[cfr], t3
19852069 andp MarkedBlockMask, t3
19862070 loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
170309

Source/JavaScriptCore/llint/LowLevelInterpreter.asm

@@elsif X86 or X86_WIN
8484const maxFrameExtentForSlowPathCall = 40
8585elsif MIPS
8686const maxFrameExtentForSlowPathCall = 40
 87elsif X86_64_WIN
 88const maxFrameExtentForSlowPathCall = 64
8789end
8890
8991# Watchpoint states

@@macro preserveCallerPCAndCFR()
248250 if C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4
249251 push lr
250252 push cfr
251  elsif X86 or X86_WIN or X86_64
 253 elsif X86 or X86_WIN or X86_64 or X86_64_WIN
252254 push cfr
253255 elsif ARM64
254256 pushLRAndFP

@@macro restoreCallerPCAndCFR()
263265 if C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4
264266 pop cfr
265267 pop lr
266  elsif X86 or X86_WIN or X86_64
 268 elsif X86 or X86_WIN or X86_64 or X86_64_WIN
267269 pop cfr
268270 elsif ARM64
269271 popLRAndFP

@@macro preserveReturnAddressAfterCall(des
274276 if C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or ARM64 or MIPS or SH4
275277 # In C_LOOP case, we're only preserving the bytecode vPC.
276278 move lr, destinationRegister
277  elsif X86 or X86_WIN or X86_64
 279 elsif X86 or X86_WIN or X86_64 or X86_64_WIN
278280 pop destinationRegister
279281 else
280282 error

@@macro restoreReturnAddressBeforeReturn(s
285287 if C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or ARM64 or MIPS or SH4
286288 # In C_LOOP case, we're only restoring the bytecode vPC.
287289 move sourceRegister, lr
288  elsif X86 or X86_WIN or X86_64
 290 elsif X86 or X86_WIN or X86_64 or X86_64_WIN
289291 push sourceRegister
290292 else
291293 error

@@macro restoreReturnAddressBeforeReturn(s
293295end
294296
295297macro functionPrologue()
296  if X86 or X86_WIN or X86_64
 298 if X86 or X86_WIN or X86_64 or X86_64_WIN
297299 push cfr
298300 elsif ARM64
299301 pushLRAndFP

@@macro functionPrologue()
305307end
306308
307309macro functionEpilogue()
308  if X86 or X86_WIN or X86_64
 310 if X86 or X86_WIN or X86_64 or X86_64_WIN
309311 pop cfr
310312 elsif ARM64
311313 popLRAndFP

@@macro functionEpilogue()
316318end
317319
318320macro callToJavaScriptPrologue()
319  if X86_64
 321 if X86_64 or X86_64_WIN
320322 push cfr
321323 push t0
322324 elsif X86 or X86_WIN

@@macro callToJavaScriptEpilogue()
371373 end
372374
373375 popCalleeSaves
374  if X86_64
 376 if X86_64 or X86_64_WIN
375377 pop t2
376378 pop cfr
377379 elsif X86 or X86_WIN

@@_sanitizeStackForVMImpl:
656658 const vm = t4
657659 const address = t1
658660 const zeroValue = t0
 661 elsif X86_64_WIN
 662 const vm = t2
 663 const address = t1
 664 const zeroValue = t0
659665 elsif X86 or X86_WIN
660666 const vm = t2
661667 const address = t1

@@_llint_entry:
692698 crash()
693699else
694700macro initPCRelative(pcBase)
695  if X86_64
 701 if X86_64 or X86_64_WIN
696702 call _relativePCBase
697703 _relativePCBase:
698704 pop pcBase

@@macro setEntryAddress(index, label)
725731 leap (label - _relativePCBase)[t1], t0
726732 move index, t2
727733 storep t0, [t4, t2, 8]
 734 elsif X86_64_WIN
 735 leap (label - _relativePCBase)[t1], t0
 736 move index, t4
 737 storep t0, [t2, t4, 8]
728738 elsif X86 or X86_WIN
729739 leap (label - _relativePCBase)[t1], t0
730740 move index, t2
170309

Source/JavaScriptCore/offlineasm/asm.rb

@@class Assembler
262262 @codeOrigin = nil
263263 @commentState = :many
264264 when :many
265  @outp.puts "// #{text}" if $enableCodeOriginComments
 265 @outp.puts $commentPrefix + " #{text}" if $enableCodeOriginComments
266266 else
267267 raise
268268 end
170309

Source/JavaScriptCore/offlineasm/backends.rb

@@BACKENDS =
3535 "X86",
3636 "X86_WIN",
3737 "X86_64",
 38 "X86_64_WIN",
3839 "ARM",
3940 "ARMv7",
4041 "ARMv7_TRADITIONAL",

@@WORKING_BACKENDS =
5455 "X86",
5556 "X86_WIN",
5657 "X86_64",
 58 "X86_64_WIN",
5759 "ARM",
5860 "ARMv7",
5961 "ARMv7_TRADITIONAL",
170309

Source/JavaScriptCore/offlineasm/settings.rb

@@def emitCodeInConfiguration(concreteSett
177177 if !$emitWinAsm
178178 $output.puts cppSettingsTest(concreteSettings)
179179 else
180  $output.puts ".MODEL FLAT, C"
 180 if backend == "X86_WIN"
 181 $output.puts ".MODEL FLAT, C"
 182 end
181183 $output.puts "INCLUDE #{File.basename($output.path)}.sym"
182184 $output.puts "_TEXT SEGMENT"
183185 end
170309

Source/JavaScriptCore/offlineasm/x86.rb

@@def isX64
3232 false
3333 when "X86_64"
3434 true
 35 when "X86_64_WIN"
 36 true
3537 else
3638 raise "bad value for $activeBackend: #{$activeBackend}"
3739 end

@@def useX87
4547 true
4648 when "X86_64"
4749 false
 50 when "X86_64_WIN"
 51 false
4852 else
4953 raise "bad value for $activeBackend: #{$activeBackend}"
5054 end

@@def getSizeString(kind)
100104 when :int
101105 size = "dword"
102106 when :ptr
103  size = "dword"
 107 size = isX64 ? "qword" : "dword"
104108 when :double
105109 size = "qword"
 110 when :quad
 111 size = "qword"
106112 else
107  raise
 113 raise "Invalid kind #{kind}"
108114 end
109115
110116 return size + " " + "ptr" + " ";

@@class SpecialRegister < NoChildren
116122 raise unless isX64
117123 case kind
118124 when :half
119  "%" + @name + "w"
 125 register(@name + "w")
120126 when :int
121  "%" + @name + "d"
 127 register(@name + "d")
122128 when :ptr
123  "%" + @name
 129 register(@name)
124130 when :quad
125  "%" + @name
 131 register(@name)
126132 else
127133 raise
128134 end

@@class RegisterID
284290 raise "Cannot use #{name} in 32-bit X86 at #{codeOriginString}" unless isX64
285291 case kind
286292 when :half
287  "%r8w"
 293 register("r8w")
288294 when :int
289  "%r8d"
 295 register("r8d")
290296 when :ptr
291  "%r8"
 297 register("r8")
292298 when :quad
293  "%r8"
 299 register("r8")
294300 end
295301 when "t7"
296302 raise "Cannot use #{name} in 32-bit X86 at #{codeOriginString}" unless isX64
297303 case kind
298304 when :half
299  "%r9w"
 305 register("r9w")
300306 when :int
301  "%r9d"
 307 register("r9d")
302308 when :ptr
303  "%r9"
 309 register("r9")
304310 when :quad
305  "%r9"
 311 register("r9")
306312 end
307313 when "csr1"
308314 raise "Cannot use #{name} in 32-bit X86 at #{codeOriginString}" unless isX64
309315 case kind
310316 when :half
311  "%r14w"
 317 register("r14w")
312318 when :int
313  "%r14d"
 319 register("r14d")
314320 when :ptr
315  "%r14"
 321 register("r14")
316322 when :quad
317  "%r14"
 323 register("r14")
318324 end
319325 when "csr2"
320326 raise "Cannot use #{name} in 32-bit X86 at #{codeOriginString}" unless isX64
321327 case kind
322328 when :half
323  "%r15w"
 329 register("r15w")
324330 when :int
325  "%r15d"
 331 register("r15d")
326332 when :ptr
327  "%r15"
 333 register("r15")
328334 when :quad
329  "%r15"
 335 register("r15")
330336 end
331337 else
332338 raise "Bad register #{name} for X86 at #{codeOriginString}"

@@class FPRegisterID
343349 raise if useX87
344350 case name
345351 when "ft0", "fa0", "fr"
346  "%xmm0"
 352 register("xmm0")
347353 when "ft1", "fa1"
348  "%xmm1"
 354 register("xmm1")
349355 when "ft2", "fa2"
350  "%xmm2"
 356 register("xmm2")
351357 when "ft3", "fa3"
352  "%xmm3"
 358 register("xmm3")
353359 when "ft4"
354  "%xmm4"
 360 register("xmm4")
355361 when "ft5"
356  "%xmm5"
 362 register("xmm5")
357363 else
358364 raise "Bad register #{name} for X86 at #{codeOriginString}"
359365 end

@@class Sequence
510516
511517 return newList
512518 end
 519 def getModifiedListX86_64_WIN
 520 getModifiedListX86_64
 521 end
513522end
514523
515524class Instruction

@@class Instruction
604613 else
605614 case mode
606615 when :normal
607  $asm.puts "ucomisd #{operands[1].x86Operand(:double)}, #{operands[0].x86Operand(:double)}"
 616 $asm.puts "ucomisd #{orderOperands(operands[1].x86Operand(:double), operands[0].x86Operand(:double))}"
608617 when :reverse
609  $asm.puts "ucomisd #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:double)}"
 618 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}"
610619 else
611620 raise mode.inspect
612621 end

@@class Instruction
848857 lowerX86Common
849858 end
850859
 860 def lowerX86_64_WIN
 861 raise unless $activeBackend == "X86_64_WIN"
 862 lowerX86Common
 863 end
 864
851865 def lowerX86Common
852866 $asm.codeOrigin codeOriginString if $enableCodeOriginComments
853867 $asm.annotation annotation if $enableInstrAnnotations

@@class Instruction
919933 $asm.puts "mov#{x86Suffix(:int)} #{x86Operands(:int, :int)}"
920934 when "loadis"
921935 if isX64
922  $asm.puts "movslq #{x86Operands(:int, :quad)}"
 936 if !isIntelSyntax
 937 $asm.puts "movslq #{x86Operands(:int, :quad)}"
 938 else
 939 $asm.puts "movsxd #{x86Operands(:int, :quad)}"
 940 end
923941 else
924942 $asm.puts "mov#{x86Suffix(:int)} #{x86Operands(:int, :int)}"
925943 end

@@class Instruction
10211039 $asm.puts "fild#{x86Suffix(:ptr)} #{getSizeString(:ptr)}#{offsetRegister(-4, sp.x86Operand(:ptr))}"
10221040 $asm.puts "fstp #{operands[1].x87Operand(1)}"
10231041 else
1024  $asm.puts "cvtsi2sd #{operands[0].x86Operand(:int)}, #{operands[1].x86Operand(:double)}"
 1042 $asm.puts "cvtsi2sd #{orderOperands(operands[0].x86Operand(:int), operands[1].x86Operand(:double))}"
10251043 end
10261044 when "bdeq"
10271045 if useX87
10281046 handleX87Compare(:normal)
10291047 else
1030  $asm.puts "ucomisd #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:double)}"
 1048 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}"
10311049 end
10321050 if operands[0] == operands[1]
10331051 # This is just a jump ordered, which is a jnp.

@@class Instruction
10541072 if useX87
10551073 handleX87Compare(:normal)
10561074 else
1057  $asm.puts "ucomisd #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:double)}"
 1075 $asm.puts "ucomisd #{orderOperands(operands[0].x86Operand(:double), operands[1].x86Operand(:double))}"
10581076 end
10591077 if operands[0] == operands[1]
10601078 # This is just a jump unordered, which is a jp.

@@class Instruction
11301148 }
11311149 when "popCalleeSaves"
11321150 if isX64
1133  $asm.puts "pop %rbx"
1134  $asm.puts "pop %r15"
1135  $asm.puts "pop %r14"
1136  $asm.puts "pop %r13"
1137  $asm.puts "pop %r12"
 1151 if isMSVC
 1152 $asm.puts "pop " + register("rsi")
 1153 $asm.puts "pop " + register("rdi")
 1154 end
 1155 $asm.puts "pop " + register("rbx")
 1156 $asm.puts "pop " + register("r15")
 1157 $asm.puts "pop " + register("r14")
 1158 $asm.puts "pop " + register("r13")
 1159 $asm.puts "pop " + register("r12")
11381160 else
11391161 $asm.puts "pop " + register("ebx")
11401162 $asm.puts "pop " + register("edi")

@@class Instruction
11421164 end
11431165 when "pushCalleeSaves"
11441166 if isX64
1145  $asm.puts "push %r12"
1146  $asm.puts "push %r13"
1147  $asm.puts "push %r14"
1148  $asm.puts "push %r15"
1149  $asm.puts "push %rbx"
 1167 $asm.puts "push " + register("r12")
 1168 $asm.puts "push " + register("r13")
 1169 $asm.puts "push " + register("r14")
 1170 $asm.puts "push " + register("r15")
 1171 $asm.puts "push " + register("rbx")
 1172 if isMSVC
 1173 $asm.puts "push " + register("rdi")
 1174 $asm.puts "push " + register("rsi")
 1175 end
11501176 else
11511177 $asm.puts "push " + register("esi")
11521178 $asm.puts "push " + register("edi")

@@class Instruction
11551181 when "move"
11561182 handleMove
11571183 when "sxi2q"
1158  $asm.puts "movslq #{operands[0].x86Operand(:int)}, #{operands[1].x86Operand(:quad)}"
 1184 if !isIntelSyntax
 1185 $asm.puts "movslq #{operands[0].x86Operand(:int)}, #{operands[1].x86Operand(:quad)}"
 1186 else
 1187 $asm.puts "movsxd #{orderOperands(operands[0].x86Operand(:int), operands[1].x86Operand(:quad))}"
 1188 end
11591189 when "zxi2q"
11601190 $asm.puts "mov#{x86Suffix(:int)} #{orderOperands(operands[0].x86Operand(:int), operands[1].x86Operand(:int))}"
11611191 when "nop"

@@class Instruction
14411471 when "cdqi"
14421472 $asm.puts "cdq"
14431473 when "idivi"
1444  $asm.puts "idivl #{operands[0].x86Operand(:int)}"
 1474 $asm.puts "idiv#{x86Suffix(:int)} #{operands[0].x86Operand(:int)}"
14451475 when "fii2d"
14461476 if useX87
14471477 sp = RegisterID.new(nil, "sp")

@@class Instruction
14791509 $asm.puts "fldl -8(#{sp.x86Operand(:ptr)})"
14801510 $asm.puts "fstp #{operands[1].x87Operand(1)}"
14811511 else
1482  $asm.puts "movq #{operands[0].x86Operand(:quad)}, #{operands[1].x86Operand(:double)}"
 1512 if !isIntelSyntax
 1513 $asm.puts "movq #{operands[0].x86Operand(:quad)}, #{operands[1].x86Operand(:double)}"
 1514 else
 1515 # MASM does not accept register operands with movq.
 1516 # Debugging shows that movd actually moves a qword when using MASM.
 1517 $asm.puts "movd #{operands[1].x86Operand(:double)}, #{operands[0].x86Operand(:quad)}"
 1518 end
14831519 end
14841520 when "fd2q"
14851521 if useX87

@@class Instruction
14921528 end
14931529 $asm.puts "movq -8(#{sp.x86Operand(:ptr)}), #{operands[1].x86Operand(:quad)}"
14941530 else
1495  $asm.puts "movq #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:quad)}"
 1531 if !isIntelSyntax
 1532 $asm.puts "movq #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:quad)}"
 1533 else
 1534 # MASM does not accept register operands with movq.
 1535 # Debugging shows that movd actually moves a qword when using MASM.
 1536 $asm.puts "movd #{operands[1].x86Operand(:quad)}, #{operands[0].x86Operand(:double)}"
 1537 end
14961538 end
14971539 when "bo"
14981540 $asm.puts "jo #{operands[0].asmLabel}"
170309

Source/WTF/ChangeLog

 12014-06-23 peavo@outlook.com <peavo@outlook.com>
 2
 3 [Win64] ASM LLINT is not enabled.
 4 https://bugs.webkit.org/show_bug.cgi?id=130638
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * wtf/Platform.h: Enable LLINT and JIT for Win64.
 9
1102014-06-21 Brady Eidson <beidson@apple.com>
211
312 Gamepad API - Deprecate the existing implementation
170309

Source/WTF/wtf/Platform.h

640640#if !defined(ENABLE_JIT) \
641641 && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)) \
642642 && !CPU(APPLE_ARMV7K) \
643  && !OS(WINCE) \
644  && !(OS(WINDOWS) && CPU(X86_64))
 643 && !OS(WINCE)
645644#define ENABLE_JIT 1
646645#endif
647646
170309