1 2019-08-15 Alexey Shvayka <shvaikalesh@gmail.com>
3 DateConversion::formatDateTime incorrectly formats negative years
4 https://bugs.webkit.org/show_bug.cgi?id=199964
6 Reviewed by Ross Kirsling.
8 Currently, year is always padded to max length of 4, including the minus sign "-".
9 With this change, only absolute value of year is padded to max length of 4 and
10 preceded by minus sign "-" if the year is negative.
11 (steps 6-10 of https://tc39.es/ecma262/#sec-datestring)
13 * runtime/DateConversion.cpp:
16 2019-08-15 Mark Lam <mark.lam@apple.com>
18 More missing exception checks in String.prototype.
19 https://bugs.webkit.org/show_bug.cgi?id=200762
20 <rdar://problem/54333896>
22 Reviewed by Michael Saboff.
24 * runtime/StringPrototype.cpp:
25 (JSC::replaceUsingRegExpSearch):
26 (JSC::operationStringProtoFuncReplaceRegExpString):
27 (JSC::stringProtoFuncLastIndexOf):
28 (JSC::stringProtoFuncToLowerCase):
29 (JSC::stringProtoFuncToUpperCase):
31 2019-08-15 Joseph Pecoraro <pecoraro@apple.com>
33 for-await-of has bad error message if used in non-async function
34 https://bugs.webkit.org/show_bug.cgi?id=200758
36 Reviewed by Ross Kirsling.
39 (JSC::Parser<LexerType>::parseForStatement):
40 Improve error message.
42 2019-08-14 Yusuke Suzuki <ysuzuki@apple.com>
44 [JSC] Air does not appropriately propagate ConstFloatValue to stackmap
45 https://bugs.webkit.org/show_bug.cgi?id=200759
47 Reviewed by Saam Barati.
49 In B3MoveConstant phase, we convert ConstFloatValue and ConstDoubleValue to memory access to the table
50 to avoid large immediates *except for* stackmap argument case. This is because materializing constant doubles
51 and floats as memory-access before passing it to stackmap is wasteful: the stackmap may not use it actually, or
52 stackmap can do better job if it knows the parameter is constant.
54 Based on the above operation, B3LowerToAir phase strongly assumes that all ConstFloatValue and ConstDoubleValue
55 are removed except for the case used for parameter of stackmap. With r192377, B3LowerToAir catch this case, and
56 propagate constant double value as ValueRep in stackmap. While B3LowerToAir does this correctly for ConstDoubleValue,
57 we missed adding this support for ConstFloatValue.
59 This patch adds r192377's support for ConstFloatValue to propagate ConstFloatValue correctly to the stackmap.
60 This issue starts appearing since Wasm BBQ-B3 OSR starts putting ConstFloatValue to OSR-tier-up patchpoint.
62 * b3/B3LowerToAir.cpp:
64 (JSC::B3::ValueKey::ValueKey):
65 (JSC::B3::ValueKey::floatValue const):
67 (JSC::B3::ValueRep::constantFloat):
68 (JSC::B3::ValueRep::floatValue const):
73 (testPatchpointManyWarmAnyImms):
74 (testPatchpointManyColdAnyImms):
75 (testPatchpointManyImms): Deleted.
77 2019-08-14 Keith Rollin <krollin@apple.com>
79 Remove support for macOS < 10.13
80 https://bugs.webkit.org/show_bug.cgi?id=200694
81 <rdar://problem/54278851>
83 Reviewed by Youenn Fablet.
85 Update conditionals that reference __MAC_OS_X_VERSION_MIN_REQUIRED and
86 __MAC_OS_X_VERSION_MAX_ALLOWED, assuming that they both have values >=
87 101300. This means that expressions like
88 "__MAC_OS_X_VERSION_MIN_REQUIRED < 101300" are always False and
89 "__MAC_OS_X_VERSION_MIN_REQUIRED >= 101300" are always True.
91 * API/WebKitAvailability.h:
93 2019-08-14 Mark Lam <mark.lam@apple.com>
95 ProxyObject should not be allow to access its target's private properties.
96 https://bugs.webkit.org/show_bug.cgi?id=200739
97 <rdar://problem/53972768>
99 Reviewed by Yusuke Suzuki.
101 * runtime/ProxyObject.cpp:
102 (JSC::performProxyGet):
103 (JSC::ProxyObject::performInternalMethodGetOwnProperty):
104 (JSC::ProxyObject::performHasProperty):
105 (JSC::ProxyObject::performPut):
106 (JSC::ProxyObject::performDelete):
107 (JSC::ProxyObject::performDefineOwnProperty):
109 2019-08-14 Mark Lam <mark.lam@apple.com>
111 Missing exception check in string compare.
112 https://bugs.webkit.org/show_bug.cgi?id=200743
113 <rdar://problem/53975356>
115 Reviewed by Michael Saboff.
117 * runtime/JSString.cpp:
118 (JSC::JSString::equalSlowCase const):
120 2019-08-14 Yusuke Suzuki <ysuzuki@apple.com>
122 Unreviewed, build fix for MacroAssemblerARM64E change
123 https://bugs.webkit.org/show_bug.cgi?id=200703
125 * assembler/MacroAssemblerARM64E.h:
126 (JSC::MacroAssemblerARM64E::farJump):
128 2019-08-14 Yusuke Suzuki <ysuzuki@apple.com>
130 [JSC] Less contended MetaAllocator
131 https://bugs.webkit.org/show_bug.cgi?id=200278
133 Reviewed by Mark Lam.
135 The profiler result of JetStream2/bomb-workers shows that we are having contention under MetaAllocator::currentStatistics.
136 This function is called in ExecutableAllocator::memoryPressureMultiplier, and it is called from ExecutableCounter's threshold
137 calculation. But MetaAllocator::currentStatistics takes a global lock inside MetaAllocator and causes contention. However,
138 we do not need to have a lock actually: clients of MetaAllocator::currentStatistics typically use bytesReserved and bytesAllocated
139 information. However, since our executable allocator is fixed-sized, bytesReserved is always the fixed size. So just reading bytesAllocated
142 This patch attempts to reduce the contention by the following two things.
144 1. Read bytesAllocated racily instead of calling MetaAllocator::currentStatistics. Then ExecutableCounter does not need to take a lock.
145 2. page lifetime management APIs of MetaAllocator should take a second `count` parameter to batch the system calls.
147 * jit/ExecutableAllocator.cpp:
148 (JSC::ExecutableAllocator::underMemoryPressure):
149 (JSC::ExecutableAllocator::memoryPressureMultiplier):
150 (JSC::ExecutableAllocator::allocate):
151 (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator): Deleted.
152 (JSC::FixedVMPoolExecutableAllocator::memoryStart): Deleted.
153 (JSC::FixedVMPoolExecutableAllocator::memoryEnd): Deleted.
154 (JSC::FixedVMPoolExecutableAllocator::isJITPC): Deleted.
155 (JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps): Deleted.
156 (JSC::FixedVMPoolExecutableAllocator::jitWriteThunkGenerator): Deleted.
157 (JSC::FixedVMPoolExecutableAllocator::genericWriteToJITRegion): Deleted.
159 2019-08-14 Yusuke Suzuki <ysuzuki@apple.com>
161 [JSC] Make PAC jump and return more explicit
162 https://bugs.webkit.org/show_bug.cgi?id=200703
164 Reviewed by Mark Lam.
166 This patch refactors our macro assembler, mainly related to PAC.
168 1. Make far-jump explicit by renaming `jump` to `farJump`.
169 2. Remove unused makeTailRecursiveCall and tailRecursiveCall.
170 3. Do not make `ARM64EAssembler::ret` as `retab`. MacroAssemblerARM64E should call `retab` explicitly instead.
172 * assembler/ARM64EAssembler.h:
173 (JSC::ARM64EAssembler::ret): Deleted.
174 * assembler/MacroAssembler.h:
175 * assembler/MacroAssemblerARM64.h:
176 (JSC::MacroAssemblerARM64::farJump):
177 (JSC::MacroAssemblerARM64::makeTailRecursiveCall): Deleted.
178 (JSC::MacroAssemblerARM64::tailRecursiveCall): Deleted.
179 * assembler/MacroAssemblerARM64E.h:
180 (JSC::MacroAssemblerARM64E::farJump):
181 (JSC::MacroAssemblerARM64E::ret):
182 * assembler/MacroAssemblerARMv7.h:
183 (JSC::MacroAssemblerARMv7::farJump):
184 (JSC::MacroAssemblerARMv7::relativeTableJump):
185 (JSC::MacroAssemblerARMv7::tailRecursiveCall): Deleted.
186 (JSC::MacroAssemblerARMv7::makeTailRecursiveCall): Deleted.
187 * assembler/MacroAssemblerMIPS.h:
188 (JSC::MacroAssemblerMIPS::farJump):
189 (JSC::MacroAssemblerMIPS::tailRecursiveCall): Deleted.
190 (JSC::MacroAssemblerMIPS::makeTailRecursiveCall): Deleted.
191 * assembler/MacroAssemblerX86.h:
192 (JSC::MacroAssemblerX86::farJump):
193 (JSC::MacroAssemblerX86::jump): Deleted.
194 (JSC::MacroAssemblerX86::tailRecursiveCall): Deleted.
195 (JSC::MacroAssemblerX86::makeTailRecursiveCall): Deleted.
196 * assembler/MacroAssemblerX86Common.h:
197 (JSC::MacroAssemblerX86Common::farJump):
198 * assembler/MacroAssemblerX86_64.h:
199 (JSC::MacroAssemblerX86_64::farJump):
200 (JSC::MacroAssemblerX86_64::jump): Deleted.
201 (JSC::MacroAssemblerX86_64::tailRecursiveCall): Deleted.
202 (JSC::MacroAssemblerX86_64::makeTailRecursiveCall): Deleted.
203 * b3/B3LowerMacros.cpp:
206 * dfg/DFGOSRExitCompilerCommon.cpp:
207 (JSC::DFG::adjustAndJumpToTarget):
208 * dfg/DFGSpeculativeJIT.cpp:
209 (JSC::DFG::SpeculativeJIT::emitSwitchIntJump):
210 (JSC::DFG::SpeculativeJIT::emitSwitchImm):
211 (JSC::DFG::SpeculativeJIT::emitSwitchStringOnString):
212 * dfg/DFGSpeculativeJIT64.cpp:
213 (JSC::DFG::SpeculativeJIT::compile):
215 (JSC::DFG::osrExitGenerationThunkGenerator):
216 (JSC::DFG::osrEntryThunkGenerator):
217 * jit/CCallHelpers.h:
218 (JSC::CCallHelpers::jumpToExceptionHandler):
220 (JSC::JIT::emitEnterOptimizationCheck):
221 * jit/JITOpcodes.cpp:
222 (JSC::JIT::emit_op_catch):
223 (JSC::JIT::emit_op_switch_imm):
224 (JSC::JIT::emit_op_switch_char):
225 (JSC::JIT::emit_op_switch_string):
226 (JSC::JIT::emitSlow_op_loop_hint):
227 * jit/JITOpcodes32_64.cpp:
228 (JSC::JIT::emit_op_catch):
229 (JSC::JIT::emit_op_switch_imm):
230 (JSC::JIT::emit_op_switch_char):
231 (JSC::JIT::emit_op_switch_string):
232 * jit/ThunkGenerators.cpp:
234 (JSC::virtualThunkFor):
235 * llint/LLIntThunks.cpp:
236 (JSC::LLInt::generateThunkWithJumpTo):
237 * wasm/WasmBinding.cpp:
238 (JSC::Wasm::wasmToWasm):
239 * wasm/WasmThunks.cpp:
240 (JSC::Wasm::throwExceptionFromWasmThunkGenerator):
241 * wasm/js/WasmToJS.cpp:
242 (JSC::Wasm::emitThrowWasmToJSException):
244 (JSC::Yarr::YarrGenerator::loadFromFrameAndJump):
246 2019-08-14 Joseph Pecoraro <pecoraro@apple.com>
248 Web Inspector: Remove bad semicolon in generation of ObjC methods
249 https://bugs.webkit.org/show_bug.cgi?id=200655
251 Reviewed by Devin Rousso.
253 * inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py:
254 (ObjCFrontendDispatcherImplementationGenerator._generate_event_dispatcher_implementations):
255 Do not include a semicolon in the method implementation.
257 * inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result:
258 * inspector/scripts/tests/generic/expected/enum-values.json-result:
259 * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result:
260 * inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result:
261 * inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result:
264 2019-08-13 Saam Barati <sbarati@apple.com>
266 Add a way to opt out of kern TCSM for layout tests
267 https://bugs.webkit.org/show_bug.cgi?id=200649
268 <rdar://problem/51304923>
270 Reviewed by Alexey Proskuryakov.
273 (JSC::isKernTCSMAvailable):
276 2019-08-13 Sam Weinig <weinig@apple.com>
278 Rename StringBuilder::append(UChar32) to StringBuilder::appendCharacter(UChar32) to avoid accidental change in behavior when replacing append with flexibleAppend
279 https://bugs.webkit.org/show_bug.cgi?id=200675
281 Reviewed by Darin Adler.
284 (JSC::Yarr::Parser::tryConsumeGroupName):
285 (JSC::Yarr::Parser::tryConsumeUnicodePropertyExpression):
286 Update for rename from StringBuilder::append(UChar32) to StringBuilder::appendCharacter(UChar32).
288 2019-08-13 Mark Lam <mark.lam@apple.com>
290 Add phase, block, and node numbers to left margin of DFG graph dumps.
291 https://bugs.webkit.org/show_bug.cgi?id=200693
293 Reviewed by Saam Barati.
295 When scrolling through the DFG graph dumps, it's easy to get lost as to which phase
296 or block one is looking at, especially if the blocks are long. This patch adds
297 node index, block number, and phase number on the left margin of the dumps.
300 53: %Bd:Function = 0x1079fd960:[Function, {}, NonArray, Proto:0x1079d8000, Leaf]
301 53: %Bf:Function = 0x1079b0700:[Function, {name:100, prototype:101, length:102, stackTraceLimit:103}, NonArray, Proto:0x1079d8000, Leaf]
302 53: %Bj:Function = 0x1079fd5e0:[Function, {name:100, length:101, toString:102, apply:103, call:104, bind:105, Symbol.hasInstance:106, caller:107, arguments:108, constructor:109}, NonArray, Proto:0x1079c0000, Leaf]
303 53: %CV:JSGlobalLexicalEnvironment = 0x1079fd6c0:[JSGlobalLexicalEnvironment, {}, NonArray, Leaf]
305 53: Phase liveness analysis changed the IR.
307 54: Beginning DFG phase OSR availability analysis.
308 54: Before OSR availability analysis:
310 54: DFG for foo#DXMNag:[0x1079a4850->0x1079a4130->0x1079c7600, DFGFunctionCall, 204 (NeverInline)]:
311 54: Fixpoint state: FixpointConverged; Form: SSA; Unification state: GloballyUnified; Ref count state: ExactRefCount
312 54: Argument formats for entrypoint index: 0 : FlushedJSValue, FlushedCell, FlushedJSValue
314 0 54: Block #0 (bc#0): (OSR target)
315 0 54: Execution count: 1.000000
318 0 54: Dominated by: #0
320 0 54: Dominance Frontier:
321 0 54: Iterated Dominance Frontier:
322 0 54: Backwards dominates by: #root #0
323 0 54: Backwards dominates: #0
324 0 54: Control equivalent to: #0
325 0 54: States: StructuresAreWatched
328 0 0 54: 53:< 1:-> JSConstant(JS|UseAsOther, Other, Null, bc#0, ExitValid)
329 1 0 54: 64:< 2:-> JSConstant(JS|UseAsOther, NonBoolInt32, Int32: 10, bc#0, ExitValid)
330 2 0 54: 3:< 5:-> JSConstant(JS|PureInt, Other, Undefined, bc#0, ExitValid)
331 3 0 54: 32:< 1:-> JSConstant(JS|UseAsOther, Bool, False, bc#0, ExitValid)
332 4 0 54: 19:< 2:-> JSConstant(JS|UseAsOther, OtherObj, Weak:Object: 0x1079d4000 with butterfly 0x0 (Structure %CV:JSGlobalLexicalEnvironment), StructureID: 31423, bc#0, ExitValid)
334 The numbers in the left margin before the ':' are node index (i.e. the index of the
335 node in the block, not to be confused with node->index() which is the node ID), block
336 number, and phase number respectively. Now, we can scroll thru the dumps quickly
337 and tell at a glance when we've scrolled passed the end of a phase, or block.
338 These sets of numbers can also serve as a positional marker that we can search for
339 to return to a node in the dump after scrolling away.
341 Currently, these numbers are only added to the DFG part. The FTL (from lowering
342 to B3 onwards) does not have this feature yet.
344 * dfg/DFGDesiredWatchpoints.cpp:
345 (JSC::DFG::DesiredWatchpoints::dumpInContext const):
346 * dfg/DFGDesiredWatchpoints.h:
348 (JSC::DFG::Graph::dumpCodeOrigin):
349 (JSC::DFG::Graph::dump):
350 (JSC::DFG::Graph::dumpBlockHeader):
351 (JSC::DFG::Prefix::dump const):
353 (JSC::DFG::Prefix::Prefix):
354 (JSC::DFG::Prefix::clearBlockIndex):
355 (JSC::DFG::Prefix::clearNodeIndex):
356 (JSC::DFG::Prefix::enable):
357 (JSC::DFG::Prefix::disable):
358 (JSC::DFG::Graph::prefix):
359 (JSC::DFG::Graph::nextPhase):
361 (JSC::DFG::Phase::beginPhase):
363 (JSC::DFG::runAndLog):
365 (JSC::DFG::Plan::compileInThreadImpl):
366 * dfg/DFGValueRepReductionPhase.cpp:
367 (JSC::DFG::ValueRepReductionPhase::convertValueRepsToDouble):
369 2019-08-13 Michael Saboff <msaboff@apple.com>
371 REGRESSION (r248533): JSC Command - Need to initializeMainThread() before processing config file
372 https://bugs.webkit.org/show_bug.cgi?id=200677
374 Reviewed by Mark Lam.
376 We need to initialize the main thread before calling processConfigFile() since it uses RefCounted objects
377 which have "is main thread" ASSERTS.
382 2019-08-13 Devin Rousso <drousso@apple.com>
384 Web Inspector: Styles: show @supports CSS groupings
385 https://bugs.webkit.org/show_bug.cgi?id=200419
386 <rdar://problem/53971948>
388 Reviewed by Joseph Pecoraro.
390 * inspector/protocol/CSS.json:
391 Rename `CSSMedia` to `Grouping` and remove the `sourceLine` value, as it was never populated
392 and wasn't used by Web Inspector.
394 * inspector/scripts/codegen/objc_generator_templates.py:
395 * inspector/scripts/codegen/generate_objc_header.py:
396 (ObjCHeaderGenerator.generate_output):
397 Add support for including files at the end of <WebInspector/RWIProtocol.h> for compatibility
398 statements so that changes to the Web Inspector protocol don't break other clients.
400 2019-08-13 Joseph Pecoraro <pecoraro@apple.com>
402 JSContext Inspector: Basic CommandLineAPI doesn't work
403 https://bugs.webkit.org/show_bug.cgi?id=200659
404 <rdar://problem/54245476>
406 Reviewed by Brian Burg.
408 * inspector/InjectedScriptSource.js:
409 (BasicCommandLineAPI):
410 Use `method` directly since it already has been setup nicely and doesn't
411 need to be bound. Technically this allows someone to add properties to
412 the CommandLineAPI methods in basic mode (`dir.property = 1`) but that
415 2019-08-12 Sam Weinig <weinig@apple.com>
417 Replace multiparameter overloads of append() in StringBuilder as a first step toward standardizinging on the flexibleAppend() implementation
418 https://bugs.webkit.org/show_bug.cgi?id=200614
420 Reviewed by Darin Adler.
422 Renames StringBuilder::append(const LChar*, unsigned), StringBuilder::append(const UChar*, unsigned) and
423 StringBuilder::append(const char*, unsigned) to StringBuilder::appendCharacters(...).
425 Renames StringBuilder::append(const String& string, unsigned offset, unsigned length) to
426 StringBuilder::appendSubstring(...).
428 * dfg/DFGStrengthReductionPhase.cpp:
429 (JSC::DFG::StrengthReductionPhase::handleNode):
430 * runtime/ConfigFile.cpp:
431 (JSC::ConfigFile::parse):
432 * runtime/LiteralParser.cpp:
433 (JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
434 * tools/FunctionOverrides.cpp:
438 2019-08-12 Adrian Perez de Castro <aperez@igalia.com>
440 [WPE][GTK] Fix building without unified sources
441 https://bugs.webkit.org/show_bug.cgi?id=200641
443 Reviewed by Žan Doberšek.
445 * b3/B3PatchpointSpecial.cpp: Add missing inclusion of the B3ProcedureInlines.h header.
446 * heap/SlotVisitor.cpp: Add missing inclusion of the BlockDirectoryInlines.h header.
448 2019-08-12 Yusuke Suzuki <ysuzuki@apple.com>
450 [WTF][JSC] Make JSC and WTF aggressively-fast-malloced
451 https://bugs.webkit.org/show_bug.cgi?id=200611
453 Reviewed by Saam Barati.
455 This patch aggressively puts many classes into FastMalloc. In JSC side, we grep `std::make_unique` etc. to find potentially system-malloc-allocated classes.
456 After this patch, all the JSC related allocations in JetStream2 cli is done from bmalloc. In the future, it would be nice that we add `WTF::makeUnique<T>` helper
457 function and throw a compile error if `T` is not FastMalloc annotated[1].
459 Putting WebKit classes in FastMalloc has many benefits.
461 1. Simply, it is fast.
462 2. vmmap can tell the amount of memory used for WebKit.
463 3. bmalloc can isolate WebKit memory allocation from the rest of the world. This is useful since we can know more about what component is corrupting the memory
464 from the memory corruption crash.
466 [1]: https://bugs.webkit.org/show_bug.cgi?id=200620
468 * API/ObjCCallbackFunction.mm:
469 * assembler/AbstractMacroAssembler.h:
470 * b3/B3PhiChildren.h:
471 * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h:
472 * b3/air/AirDisassembler.h:
473 * bytecode/AccessCaseSnippetParams.h:
474 * bytecode/CallVariant.h:
475 * bytecode/DeferredSourceDump.h:
476 * bytecode/ExecutionCounter.h:
477 * bytecode/GetByIdStatus.h:
478 * bytecode/GetByIdVariant.h:
479 * bytecode/InByIdStatus.h:
480 * bytecode/InByIdVariant.h:
481 * bytecode/InstanceOfStatus.h:
482 * bytecode/InstanceOfVariant.h:
483 * bytecode/PutByIdStatus.h:
484 * bytecode/PutByIdVariant.h:
485 * bytecode/ValueProfile.h:
486 * dfg/DFGAbstractInterpreter.h:
487 * dfg/DFGByteCodeParser.cpp:
488 (JSC::DFG::ByteCodeParser::newVariableAccessData):
489 * dfg/DFGFlowIndexing.h:
491 * dfg/DFGLiveCatchVariablePreservationPhase.cpp:
492 (JSC::DFG::LiveCatchVariablePreservationPhase::newVariableAccessData):
493 * dfg/DFGMaximalFlushInsertionPhase.cpp:
494 (JSC::DFG::MaximalFlushInsertionPhase::newVariableAccessData):
496 * dfg/DFGSpeculativeJIT.h:
497 * dfg/DFGVariableAccessData.h:
498 * disassembler/ARM64/A64DOpcode.h:
499 * inspector/remote/socket/RemoteInspectorMessageParser.h:
500 * inspector/remote/socket/RemoteInspectorSocket.h:
501 * inspector/remote/socket/RemoteInspectorSocketEndpoint.h:
502 * jit/PCToCodeOriginMap.h:
503 * runtime/BasicBlockLocation.h:
504 * runtime/DoublePredictionFuzzerAgent.h:
505 * runtime/JSRunLoopTimer.h:
506 * runtime/PromiseDeferredTimer.h:
507 (JSC::PromiseDeferredTimer::create): PromiseDeferredTimer should be allocated as `Ref<>` instead of `std::unique_ptr` since it is inheriting ThreadSafeRefCounted<>.
508 Holding such a class with std::unique_ptr could lead to potentially dangerous operations (like, someone holds it with Ref<> while it is deleted by std::unique_ptr<>).
509 * runtime/RandomizingFuzzerAgent.h:
510 * runtime/SymbolTable.h:
514 * tools/JSDollarVM.cpp:
515 * tools/SigillCrashAnalyzer.cpp:
517 * wasm/WasmMemory.cpp:
518 * wasm/WasmSignature.h:
521 2019-08-12 Chris Dumez <cdumez@apple.com>
523 Add threading assertions to RefCounted
524 https://bugs.webkit.org/show_bug.cgi?id=200507
526 Reviewed by Ryosuke Niwa.
529 (JSC::DFG::Plan::Plan):
530 Disable threading assertions for DFG::Plan::m_inlineCallFrames while the JSC team
533 2019-08-12 Chris Dumez <cdumez@apple.com>
535 Unreviewed, rolling out r248525.
537 Revert new threading assertions while I work on fixing the
542 "Add threading assertions to RefCounted"
543 https://bugs.webkit.org/show_bug.cgi?id=200507
544 https://trac.webkit.org/changeset/248525
546 2019-08-11 Chris Dumez <cdumez@apple.com>
548 Add threading assertions to RefCounted
549 https://bugs.webkit.org/show_bug.cgi?id=200507
551 Reviewed by Ryosuke Niwa.
554 (JSC::DFG::Plan::Plan):
555 Disable threading assertions for DFG::Plan::m_inlineCallFrames while the JSC team
558 2019-08-09 Yusuke Suzuki <ysuzuki@apple.com>
560 Universal XSS in JSObject::putInlineSlow and JSValue::putToPrimitive
561 https://bugs.webkit.org/show_bug.cgi?id=199864
563 Reviewed by Saam Barati.
565 Our JSObject::put implementation is not correct in term of the spec. Our [[Put]] implementation is something like this.
567 JSObject::put(object):
568 if (can-do-fast-path(object))
569 return fast-path(object);
572 object-put-check-and-setter-calls(object); // (1)
573 object = object->prototype;
574 } while (is-object(object));
575 return do-put(object);
577 Since JSObject::put is registered in the methodTable, the derived classes can override it. Some of classes are adding
578 extra checks to this put.
580 Derived::put(object):
581 if (do-extra-check(object))
583 return JSObject::put(object)
585 The problem is that Derived::put is only called when the |this| object is the Derived class. When traversing [[Prototype]] in
586 JSObject::put, at (1), we do not perform the extra checks added in Derived::put even if `object` is Derived one. This means that
589 Currently, JSObject::put and WebCore checking mechanism are broken. JSObject::put should call getOwnPropertySlot at (1) to
590 perform the additional checks. This behavior is matching against the spec. However, currently, our JSObject::getOwnPropertySlot
591 does not propagate setter information. This is required to cache cacheable [[Put]] at (1) for CustomValue, CustomAccessor, and
592 Accessors. We also need to reconsider how to integrate static property setters to this mechanism. So, basically, this involves
593 large refactoring to renew our JSObject::put and JSObject::getOwnPropertySlot.
595 To work-around for now, we add a new TypeInfo flag, HasPutPropertySecurityCheck . And adding this flag to DOM objects
596 that implements the addition checks. We also add doPutPropertySecurityCheck method hook to perform the check in JSObject.
597 When we found this flag at (1), we perform doPutPropertySecurityCheck to properly perform the checks.
599 Since our JSObject::put code is old and it does not match against the spec now, we should refactor it largely. This is tracked separately in [1].
601 [1]: https://bugs.webkit.org/show_bug.cgi?id=200562
603 * runtime/ClassInfo.h:
604 * runtime/JSCJSValue.cpp:
605 (JSC::JSValue::putToPrimitive):
606 * runtime/JSCell.cpp:
607 (JSC::JSCell::doPutPropertySecurityCheck):
609 * runtime/JSObject.cpp:
610 (JSC::JSObject::putInlineSlow):
611 (JSC::JSObject::getOwnPropertyDescriptor):
612 * runtime/JSObject.h:
613 (JSC::JSObject::doPutPropertySecurityCheck):
614 * runtime/JSTypeInfo.h:
615 (JSC::TypeInfo::hasPutPropertySecurityCheck const):
617 2019-08-08 Per Arne Vollan <pvollan@apple.com>
619 [Win] Fix internal build
620 https://bugs.webkit.org/show_bug.cgi?id=200519
622 Reviewed by Alex Christensen.
624 The script 'generate-js-builtins.py' cannot be found when building WebCore. Copy the JavaScriptCore Scripts
625 folder after building JSC.
627 * JavaScriptCore.vcxproj/JavaScriptCore.proj:
629 2019-08-08 Devin Rousso <drousso@apple.com>
631 Web Inspector: Page: don't allow the domain to be disabled
632 https://bugs.webkit.org/show_bug.cgi?id=200109
634 Reviewed by Brian Burg.
636 The `PageAgent` is relied on by many of the other agents, so much so that it doesn't make
637 sense to support the ability to "disable" (as well as "enable") the agent.
639 When the first frontend connects, we should treat the `PageAgent` as active and available.
641 * inspector/protocol/Page.json:
642 Remove `enable`/`disable`.
644 2019-08-08 Michael Saboff <msaboff@apple.com>
646 OpenSource MemoryFootprint API for JSC command line tool
647 https://bugs.webkit.org/show_bug.cgi?id=200541
649 Reviewed by Saam Barati.
651 Use wtf/spi/darwin/ProcessMemoryFootprint.h instead of WebKitAdditions/MemoryFootprint.h
652 for process memory stats.
655 (MemoryFootprint::MemoryFootprint):
657 2019-08-08 Devin Rousso <drousso@apple.com>
659 Web Inspector: rename `queryObjects` to `queryInstances` for clarity
660 https://bugs.webkit.org/show_bug.cgi?id=200520
662 Reviewed by Brian Burg.
664 * inspector/InjectedScriptSource.js:
665 (queryInstances): Added.
667 * inspector/JSInjectedScriptHost.h:
668 * inspector/JSInjectedScriptHost.cpp:
669 (Inspector::JSInjectedScriptHost::queryInstances): Added.
670 (Inspector::JSInjectedScriptHost::queryObjects): Deleted.
671 * inspector/JSInjectedScriptHostPrototype.cpp:
672 (Inspector::JSInjectedScriptHostPrototype::finishCreation):
673 (Inspector::jsInjectedScriptHostPrototypeFunctionQueryInstances): Added.
674 (Inspector::jsInjectedScriptHostPrototypeFunctionQueryObjects): Deleted.
676 2019-08-08 Ross Kirsling <ross.kirsling@sony.com>
678 [JSC] Add "jump if (not) undefined or null" bytecode ops
679 https://bugs.webkit.org/show_bug.cgi?id=200480
681 Reviewed by Saam Barati.
683 This patch introduces fused jumps for op_is_undefined_or_null, which ignores "masquerade as undefined" behavior.
685 This lets us fix a edge-case bug in RequireObjectCoercible (where `({ length } = document.all)` was a TypeError)
686 and moreover provides a very useful optimization for the new ?. and ?? operators, which have semantics centered
687 around op_jundefined_or_null and op_jnundefined_or_null, respectively.
689 * bytecode/BytecodeList.rb:
690 * bytecode/BytecodeUseDef.h:
691 (JSC::computeUsesForBytecodeOffset):
692 (JSC::computeDefsForBytecodeOffset):
695 * bytecode/PreciseJumpTargetsInlines.h:
696 * bytecompiler/BytecodeGenerator.cpp:
697 (JSC::Label::setLocation):
698 (JSC::BytecodeGenerator::emitJumpIfTrue):
699 (JSC::BytecodeGenerator::emitJumpIfFalse):
700 (JSC::BytecodeGenerator::emitRequireObjectCoercible):
701 * dfg/DFGByteCodeParser.cpp:
702 (JSC::DFG::ByteCodeParser::parseBlock):
703 * dfg/DFGCapabilities.cpp:
704 (JSC::DFG::capabilityLevel):
706 (JSC::JIT::privateCompileMainPass):
708 * jit/JITOpcodes.cpp:
709 (JSC::JIT::emit_op_jundefined_or_null): Added.
710 (JSC::JIT::emit_op_jnundefined_or_null): Added.
711 * jit/JITOpcodes32_64.cpp:
712 (JSC::JIT::emit_op_jundefined_or_null): Added.
713 (JSC::JIT::emit_op_jnundefined_or_null): Added.
714 * llint/LowLevelInterpreter32_64.asm:
715 * llint/LowLevelInterpreter64.asm:
717 2019-08-07 Devin Rousso <drousso@apple.com>
719 Rebase inspector generator tests.
721 Rubber-stamped by Brian Burg.
723 * inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result:
724 * inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result:
725 * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
726 * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result:
727 * inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result:
728 * inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result:
729 * inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result:
730 * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result:
731 * inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result:
732 * inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result:
734 2019-08-07 Caio Lima <ticaiolima@gmail.com>
736 High number of cache miss on localTimeOffset
737 https://bugs.webkit.org/show_bug.cgi?id=200444
739 Reviewed by Darin Adler.
741 This patch is separating the `LocalTimeOffsetCache` for each
742 `WTF::TimeType` to avoid constant cache miss on pathological cases
743 where `gregorianDateTimeToMS` and `msToGregorianDateTime` are
744 intercaleted with `inputTimeType == WTF::LocalTime`. Such case
745 happens during execution of Facebook Messenger
746 (https://www.messenger.com).
748 * runtime/JSDateMath.cpp:
749 (JSC::localTimeOffset):
750 (JSC::gregorianDateTimeToMS):
752 (JSC::VM::resetDateCache):
754 (JSC::LocalTimeOffsetCache::LocalTimeOffsetCache):
755 (JSC::LocalTimeOffsetCache::reset):
757 2019-08-06 Yusuke Suzuki <ysuzuki@apple.com>
759 [JSC] sampling-profiler can see garbage Wasm::Callee* pointer which is HashTable deleted / empty values
760 https://bugs.webkit.org/show_bug.cgi?id=200494
762 Reviewed by Saam Barati.
764 The sampling-profiler can see a garbage pointer which is like Wasm::Callee*. This can be filtered by HashSet<Callee*>.
765 But this is safe only when the garbage pointer is not deleted / empty values. We saw occasional crash with JetStream2/tsf-wasm.
766 This patch filters out these values with `HashSet<Callee*>::isValidValue`.
768 * wasm/WasmCalleeRegistry.h:
769 (JSC::Wasm::CalleeRegistry::isValidCallee):
771 2019-08-06 Commit Queue <commit-queue@webkit.org>
773 Unreviewed, rolling out r248289.
774 https://bugs.webkit.org/show_bug.cgi?id=200488
776 Broke internal builds (Requested by drousso on #webkit).
780 "Web Inspector: Styles: show @supports CSS groupings"
781 https://bugs.webkit.org/show_bug.cgi?id=200419
782 https://trac.webkit.org/changeset/248289
784 2019-08-06 Devin Rousso <drousso@apple.com>
786 Web Inspector: allow comments in protocol JSON
787 https://bugs.webkit.org/show_bug.cgi?id=200104
789 Reviewed by Brian Burg.
791 * inspector/scripts/generate-inspector-protocol-bindings.py:
792 (generate_from_specification.load_specification):
794 * inspector/scripts/tests/generic/should-strip-comments.json: Added.
795 * inspector/scripts/tests/generic/expected/should-strip-comments.json-result: Added.
797 2019-08-06 Per Arne Vollan <pvollan@apple.com>
799 [Win] Fix AppleWin build
800 https://bugs.webkit.org/show_bug.cgi?id=200455
802 Reviewed by Alex Christensen.
805 * shell/CMakeLists.txt:
807 2019-08-05 Devin Rousso <drousso@apple.com>
809 Web Inspector: Styles: show @supports CSS groupings
810 https://bugs.webkit.org/show_bug.cgi?id=200419
812 Reviewed by Joseph Pecoraro.
814 * inspector/protocol/CSS.json:
815 Rename `CSSMedia` to `Grouping` and remove the `sourceLine` value, as it was never populated
816 and wasn't used by Web Inspector.
818 2019-08-05 Devin Rousso <drousso@apple.com>
820 Can't use $0, $1 etc when inspecting Google Docs pages because the content uses these for function names
821 https://bugs.webkit.org/show_bug.cgi?id=195834
823 Reviewed by Joseph Pecoraro.
825 Allow the user to alias saved results by providing a different prefix (e.g. "$") from within
826 Web Inspector. When changing the alias, all existing saved results will update to be
827 reference-able from the new alias.
829 * inspector/protocol/Runtime.json:
830 Add `setSavedResultAlias` command.
832 * inspector/agents/InspectorRuntimeAgent.h:
833 * inspector/agents/InspectorRuntimeAgent.cpp:
834 (Inspector::InspectorRuntimeAgent::setSavedResultAlias): Added.
836 * inspector/InjectedScriptHost.h:
837 (Inspector::InjectedScriptHost::setSavedResultAlias): Added.
838 (Inspector::InjectedScriptHost::savedResultAlias const): Added.
839 * inspector/JSInjectedScriptHost.h:
840 * inspector/JSInjectedScriptHost.cpp:
841 (Inspector::JSInjectedScriptHost::savedResultAlias const): Added.
842 * inspector/JSInjectedScriptHostPrototype.cpp:
843 (Inspector::JSInjectedScriptHostPrototype::finishCreation):
844 (Inspector::jsInjectedScriptHostPrototypeAttributeSavedResultAlias): Added.
845 Store the saved result alias on the `InjectedScriptHost` since it is a shared object among
846 all `InjectedScript`.
848 * inspector/InjectedScriptSource.js:
849 (BasicCommandLineAPI):
851 2019-08-05 Devin Rousso <drousso@apple.com>
853 Web Inspector: Timelines: disable related agents when the tab is closed
854 https://bugs.webkit.org/show_bug.cgi?id=200118
856 Reviewed by Joseph Pecoraro.
858 Rework how `enable`/`disable` is used for timeline-related agents so that events are not sent
859 and data isn't kept alive when the Timelines tab isn't enabled.
861 * inspector/protocol/Timeline.json:
862 Add `enable`/`disable` commands.
864 * inspector/agents/InspectorHeapAgent.cpp:
865 (Inspector::InspectorHeapAgent::willDestroyFrontendAndBackend):
866 (Inspector::InspectorHeapAgent::enable):
867 (Inspector::InspectorHeapAgent::disable):
869 2019-08-05 Devin Rousso <drousso@apple.com>
871 Web Inspector: rename "Stylesheet" to "Style Sheet" to match spec text
872 https://bugs.webkit.org/show_bug.cgi?id=200422
874 Reviewed by Joseph Pecoraro.
876 * inspector/protocol/Page.json:
878 2019-08-05 Michael Saboff <msaboff@apple.com>
880 JSC: assertion failure in SpeculativeJIT::compileGetByValOnIntTypedArray
881 https://bugs.webkit.org/show_bug.cgi?id=199997
883 Reviewed by Saam Barati.
885 No need to ASSERT(node->arrayMode().alreadyChecked(...)) in SpeculativeJIT::compileGetByValOnIntTypedArray()
886 and compileGetByValOnFloatTypedArray() as the abstract interpreter is conservative and can insert a
887 CheckStructureOrEmpty which will fail the ASSERT as it checks for the SpecType of the array
888 and not for SpecEmpty. If we added a check for the SpecEmpty in the ASSERT, there are cases where
891 * dfg/DFGSpeculativeJIT.cpp:
892 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
893 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
895 2019-08-03 Devin Rousso <drousso@apple.com>
897 Web Inspector: DOM: add a special breakpoint for "All Events"
898 https://bugs.webkit.org/show_bug.cgi?id=200285
900 Reviewed by Joseph Pecoraro.
902 Similar to the existing "All Requests" breakpoint, there should be a way to set a breakpoint
903 that would pause for any DOM event, regardless of the event's name. This is useful for
904 situations where the event name isn't known, or where one simply wants to pause on the next
905 entry to the event loop.
907 Along these lines, make the "requestAnimationFrame", "setTimeout", and "setInterval"
908 event breakpoints into special breakpoints that can be added/removed via the create
909 breakpoint context menu. This simplifies the process for setting these breakpoints, and also
910 makes them more discoverable (most people wouldn't consider them to be "events").
912 * inspector/protocol/Debugger.json:
913 - Rename the `EventListener` pause reason to `Listener`.
914 - Split the `Timer` pause reason into `Interval` and `Timeout`.
916 * inspector/protocol/DOMDebugger.json:
917 - Split the `timer` type into `interval` and `timeout`.
918 - Make `eventName` optional for `addEventBreakpoint`/`removeEventBreakpoint`. When omitted,
919 the corresponding breakpoint that is added/removed is treated as a global breakpoint that
920 applies to all events of that type (e.g. a global `listener` breakpoint would pause for
921 any event that is fired).
923 2019-08-02 Keith Miller <keith_miller@apple.com>
925 Address comments on r248178
926 https://bugs.webkit.org/show_bug.cgi?id=200411
928 Reviewed by Saam Barati.
932 (JSC::B3::Procedure::tuples const):
937 2019-08-02 Mark Lam <mark.lam@apple.com>
939 [ARM64E] Harden the diversity of the DOMJIT::Signature::unsafeFunction pointer.
940 https://bugs.webkit.org/show_bug.cgi?id=200292
941 <rdar://problem/53706881>
943 Reviewed by Geoffrey Garen.
945 Previously, DOMJIT::Signature::functionWithoutTypeCheck was signed as a C function
946 pointer. We can do better by signing it like a vtbl function pointer.
948 No new tests needed. The DOMJIT mechanism is covered by existing tests.
950 I also manually confirmed that DOMJIT::Signature::functionWithoutTypeCheck is signed
951 exactly as expected by reading its bits out of memory (not letting Clang have a
952 chance to resign it into a C function pointer) and comparing it against manually
953 signed bits with the expected diversifier.
955 * assembler/MacroAssemblerCodeRef.h:
956 (JSC::CFunctionPtr::CFunctionPtr):
957 (JSC::CFunctionPtr::get const):
958 (JSC::CFunctionPtr::address const):
959 (JSC::CFunctionPtr::operator bool const):
960 (JSC::CFunctionPtr::operator! const):
961 (JSC::CFunctionPtr::operator== const):
962 (JSC::CFunctionPtr::operator!= const):
964 - Introduce a CFunctionPtr abstraction that is used to hold pointers to C functions.
965 It can instantiated in 4 ways:
967 1. The default constructor.
968 2. A constructor that takes a nullptr_t.
970 These 2 forms will instantiate a CFunctionPtr with a nullptr.
972 3. A constructor that takes the name of a function.
973 4. A constructor that takes a function pointer.
975 Form 3 already knows that we're initializing with a real function, and
976 that Clang will give it to use signed as a C function pointer. So, it
977 doesn't do any assertions. This form is useful for initializing CFunctionPtrs
978 embedded in const data structures.
980 Form 4 is an explicit constructor that takes an arbitrary function
981 pointer, but does not know if that pointer is already signed as a C function
982 pointer. Hence, this form will do a RELEASE_ASSERT that the given function
983 pointer is actually signed as a C function pointer.
985 Once instantiated, we are guaranteed that a C function pointer is either null
986 or contains a signed C function pointer.
988 * domjit/DOMJITSignature.h:
989 (JSC::DOMJIT::Signature::Signature):
990 - Sign functionWithoutTypeCheck as WTF_VTBL_FUNCPTR_PTRAUTH(DOMJITFunctionPtrTag).
992 * dfg/DFGSpeculativeJIT.cpp:
993 (JSC::DFG::SpeculativeJIT::compileCallDOM):
994 * ftl/FTLLowerDFGToB3.cpp:
995 (JSC::FTL::DFG::LowerDFGToB3::compileCallDOM):
996 - Use the new CFunctionPtr to document that the retrieved signature->functionWithoutTypeCheck
997 is signed as a C function pointer.
999 * runtime/ClassInfo.h:
1000 - Update MethodTable to sign its function pointers using the new WTF_VTBL_FUNCPTR_PTRAUTH_STR
1001 to be consistent. No longer need to roll its own PTRAUTH macro.
1003 * runtime/JSCPtrTag.h:
1004 - Add DOMJITFunctionPtrTag.
1006 * tools/JSDollarVM.cpp:
1007 - Update to work with the new DOMJIT::Signature constructor.
1009 2019-08-02 Yusuke Suzuki <ysuzuki@apple.com>
1011 [JSC] Support WebAssembly in SamplingProfiler
1012 https://bugs.webkit.org/show_bug.cgi?id=200329
1014 Reviewed by Saam Barati.
1016 The sampling profiler support is critical to investigate what is actually time-consuming. This patch adds the sampling profiler support for Wasm functions
1017 to list up hot Wasm functions with compilation mode (BBQ or OMG). This allows us to investigate the hot functions in JetStream2 wasm tests.
1019 In order to retrieve wasm function information from the sampling profiler safely, we need to know whether the given Wasm CalleeBits is valid in the call frame.
1020 To achieve this, we start collecting valid Wasm::Callee pointers in a global hash set. Previously, each Wasm::Callee registered its code region to a hash set
1021 for wasm fault signal handler to know whether the faulted program-counter is in wasm region. We reuse and change this mechanism. Instead of registering code region,
1022 we register Wasm::Callee* to a hash set. The sampling profiler reuses this hash set to determine whether the given bits is a valid Wasm::Callee.
1024 The sampling profiler retrieves the information safely from valid Wasm::Callee* pointer. It is possible that this Wasm::Callee is about to be dead: ref-count is 0,
1025 now in the middle of the destructor of Wasm::Callee. Even in that case, fields of Wasm::Callee are still valid and can be accessed since destroying these fields happens
1026 after we unregister Wasm::Callee from the global hash set.
1028 We retrieve Wasm::IndexOrName and Wasm::CompilationMode. Copying them does not involve any allocations, locking etc. So we can safely copy them while some of threads are suspended.
1030 This patch also fixes the issue that we never called `unregisterCode` while every Wasm::Calllee registers its code region through `registerCode`.
1033 * JavaScriptCore.xcodeproj/project.pbxproj:
1035 * runtime/InitializeThreading.cpp:
1036 (JSC::initializeThreading):
1037 * runtime/SamplingProfiler.cpp:
1038 (JSC::FrameWalker::FrameWalker):
1039 (JSC::FrameWalker::recordJSFrame):
1040 (JSC::CFrameWalker::CFrameWalker):
1041 (JSC::SamplingProfiler::takeSample):
1042 (JSC::SamplingProfiler::processUnverifiedStackTraces):
1043 (JSC::SamplingProfiler::StackFrame::displayName):
1044 (JSC::SamplingProfiler::StackFrame::displayNameForJSONTests):
1045 (JSC::SamplingProfiler::StackFrame::functionStartLine):
1046 (JSC::SamplingProfiler::StackFrame::functionStartColumn):
1047 (JSC::SamplingProfiler::StackFrame::sourceID):
1048 (JSC::SamplingProfiler::StackFrame::url):
1049 (JSC::SamplingProfiler::reportTopBytecodes):
1050 (WTF::printInternal):
1051 * runtime/SamplingProfiler.h:
1052 * tools/JSDollarVM.cpp:
1053 (JSC::functionIsWasmSupported):
1054 (JSC::JSDollarVM::finishCreation):
1055 * wasm/WasmB3IRGenerator.h:
1056 * wasm/WasmBBQPlan.cpp:
1057 (JSC::Wasm::BBQPlan::complete):
1058 * wasm/WasmBBQPlanInlines.h:
1059 (JSC::Wasm::BBQPlan::initializeCallees):
1060 * wasm/WasmCallee.cpp:
1061 (JSC::Wasm::Callee::Callee):
1062 (JSC::Wasm::Callee::~Callee):
1063 * wasm/WasmCallee.h:
1064 (JSC::Wasm::Callee::create): Deleted.
1065 (JSC::Wasm::Callee::entrypoint const): Deleted.
1066 (JSC::Wasm::Callee::calleeSaveRegisters): Deleted.
1067 (JSC::Wasm::Callee::indexOrName const): Deleted.
1068 * wasm/WasmCalleeRegistry.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h.
1069 (JSC::Wasm::CalleeRegistry::initialize):
1070 (JSC::Wasm::CalleeRegistry::singleton):
1071 * wasm/WasmCalleeRegistry.h: Copied from Source/JavaScriptCore/wasm/WasmCallee.cpp.
1072 (JSC::Wasm::CalleeRegistry::getLock):
1073 (JSC::Wasm::CalleeRegistry::registerCallee):
1074 (JSC::Wasm::CalleeRegistry::unregisterCallee):
1075 (JSC::Wasm::CalleeRegistry::isValidCallee):
1076 * wasm/WasmCompilationMode.cpp: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h.
1077 (JSC::Wasm::makeString):
1078 * wasm/WasmCompilationMode.h: Copied from Source/JavaScriptCore/wasm/WasmFaultSignalHandler.h.
1079 * wasm/WasmFaultSignalHandler.cpp:
1080 (JSC::Wasm::trapHandler):
1081 (JSC::Wasm::enableFastMemory):
1082 (JSC::Wasm::registerCode): Deleted.
1083 (JSC::Wasm::unregisterCode): Deleted.
1084 * wasm/WasmFaultSignalHandler.h:
1085 * wasm/WasmIndexOrName.h:
1086 * wasm/WasmOMGPlan.cpp:
1087 (JSC::Wasm::OMGPlan::work):
1089 2019-08-02 Yusuke Suzuki <ysuzuki@apple.com>
1091 [JSC] LazyJSValue should be robust for empty JSValue
1092 https://bugs.webkit.org/show_bug.cgi?id=200388
1094 Reviewed by Saam Barati.
1096 If the Switch DFG node is preceded by ForceOSRExit or something that invalidates the basic block,
1097 it can take a FrozenValue as a child which includes empty value instead of string, number etc.
1098 If this Switch node is kept and we reached to DFGCFGSimplificationPhase, it will use this FrozenValue.
1099 However, LazyJSValue using this FrozenValue strongly assumes that FrozenValue is never holding empty value.
1100 But this assumption is wrong. This patch makes LazyJSValue robust for empty value.
1102 * dfg/DFGLazyJSValue.cpp:
1103 (JSC::DFG::LazyJSValue::tryGetStringImpl const):
1104 (JSC::DFG::LazyJSValue::tryGetString const):
1105 (JSC::DFG::LazyJSValue::strictEqual const):
1106 (JSC::DFG::LazyJSValue::switchLookupValue const):
1108 2019-08-02 Devin Rousso <drousso@apple.com>
1110 Web Inspector: Storage: disable related agents when the tab is closed
1111 https://bugs.webkit.org/show_bug.cgi?id=200117
1113 Reviewed by Joseph Pecoraro.
1115 Rework how `enable`/`disable` is used for storage-related agents so that events are not sent
1116 and data isn't kept alive when the Storage tab isn't enabled.
1118 * inspector/protocol/ApplicationCache.json:
1119 Add `disable` command.
1121 2019-08-01 Keith Miller <keith_miller@apple.com>
1123 B3 should support tuple types
1124 https://bugs.webkit.org/show_bug.cgi?id=200327
1126 Reviewed by Filip Pizlo.
1128 As part of the Wasm multi-value proposal, we need to teach B3 that
1129 patchpoints can return more than one value. This is done by
1130 adding a new B3::Type called Tuple. Unlike, other B3 types Tuple
1131 is actually an encoded index into a numeric B3::Type vector on the
1132 procedure. This lets us distinguish any two tuples from each
1133 other, moreover, it's possible to get the vector of types with
1134 just the B3::Tuple type and the procedure.
1136 Since most B3 operations only expect to see a single numeric child
1137 there is a new Opcode, Extract, that takes yields the some, fixed,
1138 entry from a tuple value. Extract would be the only other change
1139 needed to make tuples work in B3 except that some optimizations
1140 expect to be able to take any non-Void value and stick it into a
1141 Variable of the same type. This means both Get/Set from a variable
1142 have to support Tuples as well. For simplicity and consistency,
1143 the ability to accept tuples is also applied to Phi and Upsilon.
1145 In order to lower a Tuple, B3Lowering needs to have a Tmp for each
1146 nested type in a Tuple. While we could reuse the existing
1147 IndexedTables to hold the extra information we need to lower
1148 Tuples, we instead use a two new HashTables for Value->Tmp(s) and
1149 Phi->Tmp(s). It's expected that Tuples will be sufficiently
1150 uncommon the overhead of tracking everything together would be
1151 prohibitive. On the other hand, we don't worry about this for
1152 Variables because we don't expect those to make it to lowering.
1154 * JavaScriptCore.xcodeproj/project.pbxproj:
1157 (JSC::B3::bankForType):
1158 * b3/B3CheckValue.cpp:
1159 (JSC::B3::CheckValue::CheckValue):
1160 * b3/B3ExtractValue.cpp: Copied from Source/JavaScriptCore/b3/B3ProcedureInlines.h.
1161 (JSC::B3::ExtractValue::~ExtractValue):
1162 (JSC::B3::ExtractValue::dumpMeta const):
1163 * b3/B3ExtractValue.h: Copied from Source/JavaScriptCore/b3/B3FixSSA.h.
1165 * b3/B3LowerMacros.cpp:
1166 * b3/B3LowerMacrosAfterOptimizations.cpp:
1167 * b3/B3LowerToAir.cpp:
1168 * b3/B3NativeTraits.h:
1170 (JSC::B3::invertedCompare):
1171 (WTF::printInternal):
1173 (JSC::B3::opcodeForConstant):
1174 * b3/B3PatchpointSpecial.cpp:
1175 (JSC::B3::PatchpointSpecial::forEachArg):
1176 (JSC::B3::PatchpointSpecial::isValid):
1177 (JSC::B3::PatchpointSpecial::admitsStack):
1178 (JSC::B3::PatchpointSpecial::generate):
1179 * b3/B3PatchpointValue.cpp:
1180 (JSC::B3::PatchpointValue::dumpMeta const):
1181 (JSC::B3::PatchpointValue::PatchpointValue):
1182 * b3/B3PatchpointValue.h:
1183 * b3/B3Procedure.cpp:
1184 (JSC::B3::Procedure::addTuple):
1185 (JSC::B3::Procedure::isValidTuple const):
1186 (JSC::B3::Procedure::tupleForType const):
1187 (JSC::B3::Procedure::addIntConstant):
1188 (JSC::B3::Procedure::addConstant):
1190 (JSC::B3::Procedure::returnCount const):
1191 * b3/B3ProcedureInlines.h:
1192 (JSC::B3::Procedure::extractFromTuple const):
1193 * b3/B3ReduceStrength.cpp:
1194 * b3/B3StackmapSpecial.cpp:
1195 (JSC::B3::StackmapSpecial::isValidImpl):
1196 (JSC::B3::StackmapSpecial::isArgValidForType):
1197 (JSC::B3::StackmapSpecial::isArgValidForRep):
1198 (JSC::B3::StackmapSpecial::isArgValidForValue): Deleted.
1199 * b3/B3StackmapSpecial.h:
1200 * b3/B3StackmapValue.h:
1202 (WTF::printInternal):
1204 (JSC::B3::Type::Type):
1205 (JSC::B3::Type::tupleFromIndex):
1206 (JSC::B3::Type::kind const):
1207 (JSC::B3::Type::tupleIndex const):
1208 (JSC::B3::Type::hash const):
1209 (JSC::B3::Type::operator== const):
1210 (JSC::B3::Type::operator!= const):
1211 (JSC::B3::Type::isInt const):
1212 (JSC::B3::Type::isFloat const):
1213 (JSC::B3::Type::isNumeric const):
1214 (JSC::B3::Type::isTuple const):
1215 (JSC::B3::sizeofType):
1216 (JSC::B3::isInt): Deleted.
1217 (JSC::B3::isFloat): Deleted.
1219 (JSC::B3::TypeMap::at):
1220 * b3/B3Validate.cpp:
1222 (JSC::B3::Value::isRounded const):
1223 (JSC::B3::Value::effects const):
1224 (JSC::B3::Value::typeFor):
1226 * b3/B3ValueInlines.h:
1227 * b3/B3ValueKey.cpp:
1228 (JSC::B3::ValueKey::intConstant):
1230 (JSC::B3::ValueKey::hash const):
1233 (JSC::B3::widthForType):
1234 * b3/air/AirArg.cpp:
1235 (JSC::B3::Air::Arg::canRepresent const):
1237 * b3/air/AirCCallingConvention.cpp:
1238 (JSC::B3::Air::cCallResult):
1239 * b3/air/AirLowerMacros.cpp:
1240 (JSC::B3::Air::lowerMacros):
1242 (populateWithInterestingValues):
1246 (testStorePartial8BitRegisterOnX86):
1248 (testPatchpointWithRegisterResult):
1249 (testPatchpointWithStackArgumentResult):
1250 (testPatchpointWithAnyResult):
1252 (testPatchpointDoubleRegs):
1253 (testSomeEarlyRegister):
1255 (testShuffleDoesntTrashCalleeSaves):
1256 (testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead):
1257 (testSimpleTuplePair):
1258 (testSimpleTuplePairUnused):
1259 (testSimpleTuplePairStack):
1260 (tailDupedTuplePair):
1261 (tuplePairVariableLoop):
1267 * ftl/FTLAbbreviatedTypes.h:
1268 * ftl/FTLLowerDFGToB3.cpp:
1269 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct):
1270 (JSC::FTL::DFG::LowerDFGToB3::compileDirectCallOrConstruct):
1271 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
1272 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
1273 (JSC::FTL::DFG::LowerDFGToB3::compileCallEval):
1274 (JSC::FTL::DFG::LowerDFGToB3::compileCPUIntrinsic):
1275 (JSC::FTL::DFG::LowerDFGToB3::compileInstanceOf):
1276 (JSC::FTL::DFG::LowerDFGToB3::compileCallDOMGetter):
1277 (JSC::FTL::DFG::LowerDFGToB3::emitBinarySnippet):
1278 (JSC::FTL::DFG::LowerDFGToB3::emitBinaryBitOpSnippet):
1279 (JSC::FTL::DFG::LowerDFGToB3::emitRightShiftSnippet):
1280 (JSC::FTL::DFG::LowerDFGToB3::allocateHeapCell):
1281 * wasm/WasmAirIRGenerator.cpp:
1282 (JSC::Wasm::AirIRGenerator::emitPatchpoint):
1283 * wasm/WasmB3IRGenerator.cpp:
1284 (JSC::Wasm::B3IRGenerator::B3IRGenerator):
1285 * wasm/WasmCallingConvention.h:
1286 (JSC::Wasm::CallingConvention::marshallArgument const):
1287 (JSC::Wasm::CallingConvention::setupFrameInPrologue const):
1288 (JSC::Wasm::CallingConvention::setupCall const):
1289 (JSC::Wasm::CallingConventionAir::setupCall const):
1291 2019-08-02 Yusuke Suzuki <ysuzuki@apple.com>
1293 [JSC] Use "destroy" function directly for JSWebAssemblyCodeBlock and WebAssemblyFunction
1294 https://bugs.webkit.org/show_bug.cgi?id=200385
1296 Reviewed by Mark Lam.
1298 These CellTypes are not using classInfo stored in the cells, so we can just call JSWebAssemblyCodeBlock::destroy
1299 and WebAssemblyFunction::destroy directly.
1301 * wasm/js/JSWebAssemblyCodeBlockHeapCellType.cpp:
1302 (JSC::JSWebAssemblyCodeBlockDestroyFunc::operator() const):
1303 * wasm/js/WebAssemblyFunctionHeapCellType.cpp:
1304 (JSC::WebAssemblyFunctionDestroyFunc::operator() const):
1306 2019-08-02 Mark Lam <mark.lam@apple.com>
1308 Gardening: build fix.
1309 https://bugs.webkit.org/show_bug.cgi?id=200149
1310 <rdar://problem/53570112>
1314 * assembler/CPU.cpp:
1315 (JSC::hwPhysicalCPUMax):
1317 2019-08-01 Yusuke Suzuki <ysuzuki@apple.com>
1319 GetterSetter type confusion during DFG compilation
1320 https://bugs.webkit.org/show_bug.cgi?id=199903
1322 Reviewed by Mark Lam.
1324 In AI, we are strongly assuming that GetGetter's child constant value should be GetterSetter if it exists.
1325 However, this can be wrong since nobody ensures that. AI assumed so because the control-flow and preceding
1326 CheckStructure ensures that. But this preceding check can be eliminated if the node becomes (at runtime) unreachable.
1328 Let's consider the following graph.
1330 129:<!0:-> PutByOffset(KnownCell:@115, KnownCell:@115, Check:Untyped:@124, MustGen, id5{length}, 0, W:NamedProperties(5), ClobbersExit, bc#154, ExitValid)
1331 130:<!0:-> PutStructure(KnownCell:@115, MustGen, %C8:Object -> %C3:Object, ID:7726, R:JSObject_butterfly, W:JSCell_indexingType,JSCell_structureID,JSCell_typeInfoFlags,JSCell_typeInfoType, ClobbersExit, bc#154, ExitInvalid)
1333 158:<!0:-> GetLocal(Check:Untyped:@197, JS|MustGen|UseAsOther, Final, loc7(R<Final>/FlushedCell), R:Stack(-8), bc#187, ExitValid) predicting Final
1334 210:< 1:-> DoubleRep(Check:NotCell:@158, Double|PureInt, BytecodeDouble, Exits, bc#187, ExitValid)
1336 162:<!0:-> CheckStructure(Cell:@158, MustGen, [%Ad:Object], R:JSCell_structureID, Exits, bc#192, ExitValid)
1337 163:< 1:-> GetGetterSetterByOffset(KnownCell:@158, KnownCell:@158, JS|UseAsOther, OtherCell, id5{length}, 0, R:NamedProperties(5), Exits, bc#192, ExitValid)
1338 164:< 1:-> GetGetter(KnownCell:@163, JS|UseAsOther, Function, R:GetterSetter_getter, Exits, bc#192, ExitValid)
1340 At @163 and @164, AI proves that @158's AbstractValue is None because @210's edge filters out Cells @158 is a cell. But we do not invalidate graph status as "Invalid" even if edge filters out all possible value.
1341 This is because the result of edge can be None in a valid program. For example, we can put a dependency edge between a consuming node and a producing node, where the producing node is just like a check and it
1342 does not produce a value actually. So, @163 and @164 are not invalidated. This is totally fine in our compiler pipeline right now.
1344 But after that, global CSE phase found that @115 and @158 are same and @129 dominates @158. As a result, we can replace GetGetter child's @163 with @124. Since CheckStructure is already removed (and now, at runtime,
1345 @163 and @164 are never executed), we do not have any structure guarantee on @158 and the result of @163. This means that @163's CSE result can be non-GetterSetter value.
1347 124:< 2:-> JSConstant(JS|UseAsOther, Final, Weak:Object: 0x1199e82a0 with butterfly 0x0 (Structure %B4:Object), StructureID: 49116, bc#0, ExitValid)
1349 126:< 2:-> GetGetter(KnownCell:Kill:@124, JS|UseAsOther, Function, R:GetterSetter_getter, Exits, bc#192, ExitValid)
1351 AI filters out @124's non-cell values. But @126 can get non-GetterSetter cell at AI phase. But our AI code is like the following.
1354 JSValue base = forNode(node->child1()).m_value;
1356 GetterSetter* getterSetter = jsCast<GetterSetter*>(base);
1359 Then, jsCast casts the above object with GetterSetter accidentally.
1361 In general, DFG AI can get a proven constant value, which could not be shown at runtime. This happens if the processing node is unreachable at runtime while the graph is not invalid yet, because preceding edge
1362 filters already filter out all the possible execution. DFG AI already considered about this possibility, and it attempts to fold a node into a constant only when the constant input matches against the expected one.
1363 But several DFG nodes are not handling this correctly: GetGetter, GetSetter, and SkipScope.
1365 In this patch, we use `jsDynamicCast` to ensure that the constant input matches against the expected (foldable) one, and fold it only when the expectation is met.
1366 We also remove DFG::Node::castConstant and its use. We should not rely on the constant folded value based on graph's control-flow.
1368 * dfg/DFGAbstractInterpreterInlines.h:
1369 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1371 (JSC::DFG::Node::castConstant): Deleted.
1372 * ftl/FTLLowerDFGToB3.cpp:
1373 (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation):
1375 2019-08-01 Mark Lam <mark.lam@apple.com>
1377 Add crash diagnostics for debugging unexpected zapped cells.
1378 https://bugs.webkit.org/show_bug.cgi?id=200149
1379 <rdar://problem/53570112>
1381 Reviewed by Yusuke Suzuki.
1383 Add a check for zapped cells in SlotVisitor::appendToMarkStack() and
1384 SlotVisitor::visitChildren(). If a zapped cell is detected, we will crash with
1385 some diagnostic info.
1387 To facilitate this, we've made the following changes:
1388 1. Changed FreeCell to preserve the 1st 8 bytes. This is fine to do because all
1389 cells are at least 16 bytes long.
1390 2. Changed HeapCell::zap() to only zap the structureID. Leave the rest of the
1391 cell header info intact (including the cell JSType).
1392 3. Changed HeapCell::zap() to record the reason for zapping the cell. We stash
1393 the reason immediately after the first 8 bytes. This is the same location as
1394 FreeCell::scrambledNext. However, since a cell is not expected to be zapped
1395 and on the free list at the same time, it is also fine to do this.
1396 4. Added a few utility functions to MarkedBlock for checking if a cell points
1398 5. Added VMInspector and JSDollarVM utilities to dump in-use subspace hashes.
1399 6. Added some comments to document the hashes of known subspaces.
1400 7. Added Options::dumpZappedCellCrashData() to make this check conditional.
1401 We use this option to disable this check for slower machines so that their
1402 PLT5 performance is not impacted.
1404 * assembler/CPU.cpp:
1405 (JSC::hwL3CacheSize):
1406 (JSC::hwPhysicalCPUMax):
1408 (JSC::hwL3CacheSize):
1409 (JSC::hwPhysicalCPUMax):
1411 (JSC::FreeCell::offsetOfScrambledNext):
1413 (JSC::HeapCell::zap):
1414 (JSC::HeapCell::isZapped const):
1415 * heap/MarkedBlock.cpp:
1416 (JSC::MarkedBlock::Handle::stopAllocating):
1417 * heap/MarkedBlock.h:
1418 (JSC::MarkedBlock::Handle::start const):
1419 (JSC::MarkedBlock::Handle::end const):
1420 (JSC::MarkedBlock::Handle::contains const):
1421 * heap/MarkedBlockInlines.h:
1422 (JSC::MarkedBlock::Handle::specializedSweep):
1423 * heap/MarkedSpace.h:
1424 (JSC::MarkedSpace::forEachSubspace):
1425 * heap/SlotVisitor.cpp:
1426 (JSC::SlotVisitor::appendToMarkStack):
1427 (JSC::SlotVisitor::visitChildren):
1428 (JSC::SlotVisitor::reportZappedCellAndCrash):
1429 * heap/SlotVisitor.h:
1430 * jit/AssemblyHelpers.cpp:
1431 (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator):
1432 * runtime/Options.cpp:
1433 (JSC::Options::initialize):
1434 * runtime/Options.h:
1437 * tools/JSDollarVM.cpp:
1438 (JSC::functionDumpSubspaceHashes):
1439 (JSC::JSDollarVM::finishCreation):
1440 * tools/VMInspector.cpp:
1441 (JSC::VMInspector::dumpSubspaceHashes):
1442 * tools/VMInspector.h:
1444 2019-08-01 Keith Miller <keith_miller@apple.com>
1446 Fix bug in testMulImm32SignExtend
1447 https://bugs.webkit.org/show_bug.cgi?id=200358
1449 Reviewed by Mark Lam.
1451 Also, have it run in more configurations.
1454 (testMulImm32SignExtend):
1458 2019-07-31 Mark Lam <mark.lam@apple.com>
1460 Rename DOMJIT safe/unsafeFunction to functionWithTypeChecks and functionWithoutTypeChecks.
1461 https://bugs.webkit.org/show_bug.cgi?id=200323
1463 Reviewed by Yusuke Suzuki.
1465 The DOMJIT has a notion of a safeFunction and an unsafeFunction. The safeFunction
1466 is effectively the same as the unsafeFunction with added type check. The DFG/FTL
1467 will emit code to call the unsafeFunction if it has already emitted the needed
1468 type check or proven that it isn't needed. Otherwise, the DFG/FTL will emit
1469 code to call the safeFunction (which does its own type check) instead.
1471 This patch renames these functions to better describe their difference.
1473 * dfg/DFGSpeculativeJIT.cpp:
1474 (JSC::DFG::SpeculativeJIT::compileCallDOM):
1475 * domjit/DOMJITSignature.h:
1476 (JSC::DOMJIT::Signature::Signature):
1477 * ftl/FTLLowerDFGToB3.cpp:
1478 (JSC::FTL::DFG::LowerDFGToB3::compileCallDOM):
1479 * tools/JSDollarVM.cpp:
1480 (JSC::DOMJITFunctionObject::functionWithTypeCheck):
1481 (JSC::DOMJITFunctionObject::functionWithoutTypeCheck):
1482 (JSC::DOMJITFunctionObject::finishCreation):
1483 (JSC::DOMJITCheckSubClassObject::functionWithTypeCheck):
1484 (JSC::DOMJITCheckSubClassObject::functionWithoutTypeCheck):
1485 (JSC::DOMJITCheckSubClassObject::finishCreation):
1486 (JSC::DOMJITFunctionObject::safeFunction): Deleted.
1487 (JSC::DOMJITFunctionObject::unsafeFunction): Deleted.
1488 (JSC::DOMJITCheckSubClassObject::safeFunction): Deleted.
1489 (JSC::DOMJITCheckSubClassObject::unsafeFunction): Deleted.
1491 2019-07-31 Alex Christensen <achristensen@webkit.org>
1493 Begin organizing b3 tests
1494 https://bugs.webkit.org/show_bug.cgi?id=200330
1496 Reviewed by Keith Miller.
1502 (negativeZero): Deleted.
1504 (testBitXorTreeArgs):
1505 (testBitXorTreeArgsEven):
1506 (testBitXorTreeArgImm):
1507 (testBitAndTreeArg32):
1508 (testBitOrTreeArg32):
1510 (testBitAndSameArg):
1516 (testBitAndBitAndArgImmImm):
1517 (testBitAndImmBitAndArgImm):
1519 (testBitAndSameArg32):
1521 (testBitAndArgImm32):
1522 (testBitAndImmArg32):
1523 (testBitAndBitAndArgImmImm32):
1524 (testBitAndImmBitAndArgImm32):
1525 (testBitAndWithMaskReturnsBooleans):
1526 (testBitAndArgDouble):
1527 (testBitAndArgsDouble):
1528 (testBitAndArgImmDouble):
1529 (testBitAndImmsDouble):
1530 (testBitAndArgFloat):
1531 (testBitAndArgsFloat):
1532 (testBitAndArgImmFloat):
1533 (testBitAndImmsFloat):
1534 (testBitAndArgsFloatWithUselessDoubleConversion):
1537 (testBitOrAndAndArgs):
1538 (testBitOrAndSameArgs):
1544 (testBitOrBitOrArgImmImm):
1545 (testBitOrImmBitOrArgImm):
1547 (testBitOrSameArg32):
1549 (testBitOrArgImm32):
1550 (testBitOrImmArg32):
1579 2019-07-31 Devin Rousso <drousso@apple.com>
1581 Web Inspector: Debugger: support emulateUserGesture parameter in Debugger.evaluateOnCallFrame
1582 https://bugs.webkit.org/show_bug.cgi?id=200272
1584 Reviewed by Joseph Pecoraro.
1586 When paused, evaluating in the console should still respect the "Emulate User Gesture" checkbox.
1588 * inspector/protocol/Debugger.json:
1589 * inspector/agents/InspectorDebuggerAgent.h:
1590 * inspector/agents/InspectorDebuggerAgent.cpp:
1591 (Inspector::InspectorDebuggerAgent::evaluateOnCallFrame):
1593 2019-07-31 Alex Christensen <achristensen@webkit.org>
1595 Split testb3 into multiple files
1596 https://bugs.webkit.org/show_bug.cgi?id=200326
1598 Reviewed by Keith Miller.
1600 * JavaScriptCore.xcodeproj/project.pbxproj:
1601 * b3/testb3.cpp: Removed.
1602 * b3/testb3.h: Added.
1603 (hiddenTruthBecauseNoReturnIsStupid):
1609 (lowerToAirForTesting):
1611 (checkUsesInstruction):
1612 (checkDoesNotUseInstruction):
1613 (populateWithInterestingValues):
1614 (floatingPointOperands):
1621 * b3/testb3_1.cpp: Added.
1627 (testRotRWithImmShift):
1628 (testRotLWithImmShift):
1629 (testComputeDivisionMagic):
1632 (dllLauncherEntryPoint):
1633 * b3/testb3_2.cpp: Added.
1637 (testLoadWithOffsetImpl):
1638 (testLoadOffsetImm9Max):
1639 (testLoadOffsetImm9MaxPlusOne):
1640 (testLoadOffsetImm9MaxPlusTwo):
1641 (testLoadOffsetImm9Min):
1642 (testLoadOffsetImm9MinMinusOne):
1643 (testLoadOffsetScaledUnsignedImm12Max):
1644 (testLoadOffsetScaledUnsignedOverImm12Max):
1645 (testBitXorTreeArgs):
1646 (testBitXorTreeArgsEven):
1647 (testBitXorTreeArgImm):
1650 (testBitAndTreeArg32):
1651 (testBitOrTreeArg32):
1653 (testReturnConst64):
1669 (testAddArgZeroImmZDef):
1672 (testAddArgsDouble):
1673 (testAddArgImmDouble):
1674 (testAddImmArgDouble):
1675 (testAddImmsDouble):
1678 (testAddFPRArgsFloat):
1679 (testAddArgImmFloat):
1680 (testAddImmArgFloat):
1682 (testAddArgFloatWithUselessDoubleConversion):
1683 (testAddArgsFloatWithUselessDoubleConversion):
1684 (testAddArgsFloatWithEffectfulDoubleConversion):
1685 (testAddMulMulArgs):
1695 (testMulArgs32SignExtend):
1696 (testMulImm32SignExtend):
1698 (testMulAddArgsLeft):
1699 (testMulAddArgsRight):
1700 (testMulAddArgsLeft32):
1701 (testMulAddArgsRight32):
1702 (testMulSubArgsLeft):
1703 (testMulSubArgsRight):
1704 (testMulSubArgsLeft32):
1705 (testMulSubArgsRight32):
1709 (testMulArgsDouble):
1710 (testMulArgImmDouble):
1711 (testMulImmArgDouble):
1712 (testMulImmsDouble):
1715 (testMulArgImmFloat):
1716 (testMulImmArgFloat):
1718 (testMulArgFloatWithUselessDoubleConversion):
1719 (testMulArgsFloatWithUselessDoubleConversion):
1720 (testMulArgsFloatWithEffectfulDoubleConversion):
1722 (testDivArgsDouble):
1723 (testDivArgImmDouble):
1724 (testDivImmArgDouble):
1725 (testDivImmsDouble):
1728 (testDivArgImmFloat):
1729 (testDivImmArgFloat):
1732 (testModArgsDouble):
1733 (testModArgImmDouble):
1734 (testModImmArgDouble):
1735 (testModImmsDouble):
1738 (testModArgImmFloat):
1739 (testModImmArgFloat):
1741 (testDivArgFloatWithUselessDoubleConversion):
1742 (testDivArgsFloatWithUselessDoubleConversion):
1743 (testDivArgsFloatWithEffectfulDoubleConversion):
1744 (testUDivArgsInt32):
1745 (testUDivArgsInt64):
1746 (testUModArgsInt32):
1747 (testUModArgsInt64):
1753 (testNegValueSubOne):
1770 (testNegValueSubOne32):
1772 (testSubMulMulArgs):
1774 (testSubArgsDouble):
1775 (testSubArgImmDouble):
1776 (testSubImmArgDouble):
1777 (testSubImmsDouble):
1780 (testSubArgImmFloat):
1781 (testSubImmArgFloat):
1783 (testSubArgFloatWithUselessDoubleConversion):
1784 (testSubArgsFloatWithUselessDoubleConversion):
1785 (testSubArgsFloatWithEffectfulDoubleConversion):
1786 (testTernarySubInstructionSelection):
1789 (testNegFloatWithUselessDoubleConversion):
1791 (testBitAndSameArg):
1797 (testBitAndBitAndArgImmImm):
1798 (testBitAndImmBitAndArgImm):
1800 (testBitAndSameArg32):
1802 (testBitAndArgImm32):
1803 (testBitAndImmArg32):
1804 (testBitAndBitAndArgImmImm32):
1805 (testBitAndImmBitAndArgImm32):
1806 (testBitAndWithMaskReturnsBooleans):
1808 (testBitAndArgDouble):
1809 (testBitAndArgsDouble):
1810 (testBitAndArgImmDouble):
1811 (testBitAndImmsDouble):
1813 (testBitAndArgFloat):
1814 (testBitAndArgsFloat):
1815 (testBitAndArgImmFloat):
1816 (testBitAndImmsFloat):
1817 (testBitAndArgsFloatWithUselessDoubleConversion):
1820 (testBitOrAndAndArgs):
1821 (testBitOrAndSameArgs):
1827 (testBitOrBitOrArgImmImm):
1828 (testBitOrImmBitOrArgImm):
1830 (testBitOrSameArg32):
1832 (testBitOrArgImm32):
1833 (testBitOrImmArg32):
1834 * b3/testb3_3.cpp: Added.
1835 (testBitOrBitOrArgImmImm32):
1836 (testBitOrImmBitOrArgImm32):
1838 (testBitOrArgDouble):
1839 (testBitOrArgsDouble):
1840 (testBitOrArgImmDouble):
1841 (testBitOrImmsDouble):
1843 (testBitOrArgFloat):
1844 (testBitOrArgsFloat):
1845 (testBitOrArgImmFloat):
1846 (testBitOrImmsFloat):
1847 (testBitOrArgsFloatWithUselessDoubleConversion):
1849 (testBitXorSameArg):
1850 (testBitXorAndAndArgs):
1851 (testBitXorAndSameArgs):
1855 (testBitXorBitXorArgImmImm):
1856 (testBitXorImmBitXorArgImm):
1858 (testBitXorSameArg32):
1860 (testBitXorArgImm32):
1861 (testBitXorImmArg32):
1862 (testBitXorBitXorArgImmImm32):
1863 (testBitXorImmBitXorArgImm32):
1870 (testNotOnBooleanAndBranch32):
1871 (testBitNotOnBooleanAndBranch32):
1875 (testShlSShrArgImm):
1880 (testShlZShrArgImm32):
1905 (testAbsBitwiseCastArg):
1906 (testBitwiseCastAbsBitwiseCastArg):
1907 (testAbsArgWithUselessDoubleConversion):
1908 (testAbsArgWithEffectfulDoubleConversion):
1916 (testCeilArgWithUselessDoubleConversion):
1917 (testCeilArgWithEffectfulDoubleConversion):
1921 (testFloorFloorArg):
1925 (testFloorArgWithUselessDoubleConversion):
1926 (testFloorArgWithEffectfulDoubleConversion):
1931 (testSqrtArgWithUselessDoubleConversion):
1932 (testSqrtArgWithEffectfulDoubleConversion):
1933 (testCompareTwoFloatToDouble):
1934 (testCompareOneFloatToDouble):
1935 (testCompareFloatToDoubleThroughPhi):
1936 (testDoubleToFloatThroughPhi):
1937 (testReduceFloatToDoubleValidates):
1938 (testDoubleProducerPhiToFloatConversion):
1939 (testDoubleProducerPhiToFloatConversionWithDoubleConsumer):
1940 (testDoubleProducerPhiWithNonFloatConst):
1941 (testDoubleArgToInt64BitwiseCast):
1942 (testDoubleImmToInt64BitwiseCast):
1943 (testTwoBitwiseCastOnDouble):
1944 (testBitwiseCastOnDoubleInMemory):
1945 (testBitwiseCastOnDoubleInMemoryIndexed):
1946 (testInt64BArgToDoubleBitwiseCast):
1947 (testInt64BImmToDoubleBitwiseCast):
1948 (testTwoBitwiseCastOnInt64):
1949 (testBitwiseCastOnInt64InMemory):
1950 (testBitwiseCastOnInt64InMemoryIndexed):
1951 (testFloatImmToInt32BitwiseCast):
1952 (testBitwiseCastOnFloatInMemory):
1953 (testInt32BArgToFloatBitwiseCast):
1954 (testInt32BImmToFloatBitwiseCast):
1955 (testTwoBitwiseCastOnInt32):
1956 (testBitwiseCastOnInt32InMemory):
1957 (testConvertDoubleToFloatArg):
1958 (testConvertDoubleToFloatImm):
1959 (testConvertDoubleToFloatMem):
1960 (testConvertFloatToDoubleArg):
1961 (testConvertFloatToDoubleImm):
1962 (testConvertFloatToDoubleMem):
1963 (testConvertDoubleToFloatToDoubleToFloat):
1964 (testLoadFloatConvertDoubleConvertFloatStoreFloat):
1979 (testIToDReducedToIToF64Arg):
1980 (testIToDReducedToIToF32Arg):
1982 (testStoreConstant):
1983 (testStoreConstantPtr):
1986 (testStorePartial8BitRegisterOnX86):
1994 (testStoreAddLoad32):
1995 * b3/testb3_4.cpp: Added.
1996 (testStoreRelAddLoadAcq32):
1997 (testStoreAddLoadImm32):
1998 (testStoreAddLoad8):
1999 (testStoreRelAddLoadAcq8):
2000 (testStoreRelAddFenceLoadAcq8):
2001 (testStoreAddLoadImm8):
2002 (testStoreAddLoad16):
2003 (testStoreRelAddLoadAcq16):
2004 (testStoreAddLoadImm16):
2005 (testStoreAddLoad64):
2006 (testStoreRelAddLoadAcq64):
2007 (testStoreAddLoadImm64):
2008 (testStoreAddLoad32Index):
2009 (testStoreAddLoadImm32Index):
2010 (testStoreAddLoad8Index):
2011 (testStoreAddLoadImm8Index):
2012 (testStoreAddLoad16Index):
2013 (testStoreAddLoadImm16Index):
2014 (testStoreAddLoad64Index):
2015 (testStoreAddLoadImm64Index):
2017 (testStoreAddLoadInterference):
2018 (testStoreAddAndLoad):
2019 (testStoreNegLoad32):
2020 (testStoreNegLoadPtr):
2021 (testAdd1Uncommuted):
2023 (testLoadOffsetNotConstant):
2024 (testLoadOffsetUsingAdd):
2025 (testLoadOffsetUsingAddInterference):
2026 (testLoadOffsetUsingAddNotConstant):
2027 (testLoadAddrShift):
2029 (testOverrideFramePointer):
2031 (testLoadFromFramePointer):
2032 (testStoreLoadStackSlot):
2034 (testStoreDoubleConstantAsFloat):
2037 (testInt32ToDoublePartialRegisterStall):
2038 (testInt32ToDoublePartialRegisterWithoutStall):
2042 (testBranchNotEqual):
2043 (testBranchNotEqualCommute):
2044 (testBranchNotEqualNotEqual):
2046 (testBranchEqualEqual):
2047 (testBranchEqualCommute):
2048 (testBranchEqualEqual1):
2049 (testBranchEqualOrUnorderedArgs):
2050 (testBranchNotEqualAndOrderedArgs):
2051 (testBranchEqualOrUnorderedDoubleArgImm):
2052 (testBranchEqualOrUnorderedFloatArgImm):
2053 (testBranchEqualOrUnorderedDoubleImms):
2054 (testBranchEqualOrUnorderedFloatImms):
2055 (testBranchEqualOrUnorderedFloatWithUselessDoubleConversion):
2058 (testBranchNotEqualFoldPtr):
2059 (testBranchEqualFoldPtr):
2060 (testBranchLoadPtr):
2064 (testBranchLoad16S):
2065 (testBranchLoad16Z):
2066 (testBranch8WithLoad8ZIndex):
2068 (testBranchBitTest32TmpImm):
2069 (testBranchBitTest32AddrImm):
2070 (testBranchBitTest32TmpTmp):
2071 (testBranchBitTest64TmpTmp):
2072 (testBranchBitTest64AddrTmp):
2073 (testBranchBitTestNegation):
2074 (testBranchBitTestNegation2):
2075 (testSimplePatchpoint):
2076 (testSimplePatchpointWithoutOuputClobbersGPArgs):
2077 (testSimplePatchpointWithOuputClobbersGPArgs):
2078 (testSimplePatchpointWithoutOuputClobbersFPArgs):
2079 (testSimplePatchpointWithOuputClobbersFPArgs):
2080 (testPatchpointWithEarlyClobber):
2081 (testPatchpointCallArg):
2082 (testPatchpointFixedRegister):
2083 (testPatchpointAny):
2084 (testPatchpointGPScratch):
2085 (testPatchpointFPScratch):
2086 (testPatchpointLotsOfLateAnys):
2087 (testPatchpointAnyImm):
2088 * b3/testb3_5.cpp: Added.
2089 (testPatchpointManyImms):
2090 (testPatchpointWithRegisterResult):
2091 (testPatchpointWithStackArgumentResult):
2092 (testPatchpointWithAnyResult):
2096 (testCheckLessThan):
2097 (testCheckMegaCombo):
2098 (testCheckTrickyMegaCombo):
2099 (testCheckTwoMegaCombos):
2100 (testCheckTwoNonRedundantMegaCombos):
2102 (testCheckAddImmCommute):
2103 (testCheckAddImmSomeRegister):
2107 (testCheckAddFoldFail):
2108 (testCheckAddArgumentAliasing64):
2109 (testCheckAddArgumentAliasing32):
2110 (testCheckAddSelfOverflow64):
2111 (testCheckAddSelfOverflow32):
2113 (testCheckSubBadImm):
2118 (testCheckSubFoldFail):
2122 (testCheckMulMemory):
2126 (testCheckMulFoldFail):
2127 (testCheckMulArgumentAliasing64):
2128 (testCheckMulArgumentAliasing32):
2129 (testCheckMul64SShr):
2130 (genericTestCompare):
2140 (testCallSimplePure):
2141 (functionWithHellaArguments):
2142 (testCallFunctionWithHellaArguments):
2143 (functionWithHellaArguments2):
2144 (testCallFunctionWithHellaArguments2):
2145 (functionWithHellaArguments3):
2146 (testCallFunctionWithHellaArguments3):
2149 (simpleFunctionDouble):
2150 (testCallSimpleDouble):
2151 (simpleFunctionFloat):
2152 (testCallSimpleFloat):
2153 (functionWithHellaDoubleArguments):
2154 (testCallFunctionWithHellaDoubleArguments):
2155 (functionWithHellaFloatArguments):
2156 (testCallFunctionWithHellaFloatArguments):
2157 (testLinearScanWithCalleeOnStack):
2159 (testChillDivTwice):
2170 (testChillModArg32):
2171 (testChillModArgs32):
2172 (testChillModImms32):
2173 (testLoopWithMultipleHeaderEdges):
2175 (testSwitchSameCaseAsDefault):
2176 (testSwitchChillDiv):
2177 (testSwitchTargettingSameBlock):
2178 (testSwitchTargettingSameBlockFoldPathConstant):
2199 * b3/testb3_6.cpp: Added.
2203 (testSelectCompareDouble):
2204 (testSelectCompareFloat):
2205 (testSelectCompareFloatToDouble):
2207 (testSelectDoubleTest):
2208 (testSelectDoubleCompareDouble):
2209 (testSelectDoubleCompareFloat):
2210 (testSelectFloatCompareFloat):
2211 (testSelectDoubleCompareDoubleWithAliasing):
2212 (testSelectFloatCompareFloatWithAliasing):
2216 (testCheckSelectCheckSelect):
2217 (testCheckSelectAndCSE):
2219 (testPowDoubleByIntegerLoop):
2224 (testBranch64Equal):
2225 (testBranch64EqualImm):
2226 (testBranch64EqualMem):
2227 (testBranch64EqualMemImm):
2229 (testStore16Load16Z):
2232 (testTrivialInfiniteLoop):
2233 (testFoldPathEqual):
2236 (testURShiftSelf32):
2239 (testURShiftSelf64):
2240 (testPatchpointDoubleRegs):
2241 (testSpillDefSmallerThanUse):
2242 (testSpillUseLargerThanDef):
2246 (testReduceStrengthCheckBottomUseInAnotherBlock):
2247 (testResetReachabilityDanglingReference):
2248 (testEntrySwitchSimple):
2249 (testEntrySwitchNoEntrySwitch):
2250 (testEntrySwitchWithCommonPaths):
2251 (testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint):
2252 (testEntrySwitchLoop):
2253 (testSomeEarlyRegister):
2254 (testBranchBitAndImmFusion):
2255 (testTerminalPatchpointThatNeedsToBeSpilled):
2256 (testTerminalPatchpointThatNeedsToBeSpilled2):
2257 (testPatchpointTerminalReturnValue):
2262 (testTrappingStore):
2263 (testTrappingLoadAddStore):
2264 (testTrappingLoadDCE):
2265 (testTrappingStoreElimination):
2266 (testMoveConstants):
2267 (testPCOriginMapDoesntInsertNops):
2268 * b3/testb3_7.cpp: Added.
2270 (testX86LeaAddAddShlLeft):
2271 (testX86LeaAddAddShlRight):
2273 (testX86LeaAddShlRight):
2274 (testX86LeaAddShlLeftScale1):
2275 (testX86LeaAddShlLeftScale2):
2276 (testX86LeaAddShlLeftScale4):
2277 (testX86LeaAddShlLeftScale8):
2281 (testReduceStrengthReassociation):
2282 (testLoadBaseIndexShift2):
2283 (testLoadBaseIndexShift32):
2284 (testOptimizeMaterialization):
2286 (makeArrayForLoops):
2287 (generateLoopNotBackwardsDominant):
2291 (testLICMPureSideExits):
2292 (testLICMPureWritesPinned):
2293 (testLICMPureWrites):
2294 (testLICMReadsLocalState):
2295 (testLICMReadsPinned):
2297 (testLICMPureNotBackwardsDominant):
2298 (testLICMPureFoiledByChild):
2299 (testLICMPureNotBackwardsDominantFoiledByChild):
2300 (testLICMExitsSideways):
2301 (testLICMWritesLocalState):
2304 (testLICMWritesPinned):
2305 (testLICMControlDependent):
2306 (testLICMControlDependentNotBackwardsDominant):
2307 (testLICMControlDependentSideExits):
2308 (testLICMReadsPinnedWritesPinned):
2309 (testLICMReadsWritesDifferentHeaps):
2310 (testLICMReadsWritesOverlappingHeaps):
2311 (testLICMDefaultCall):
2314 (testWasmBoundsCheck):
2324 (testDoubleLiteralComparison):
2325 (testFloatEqualOrUnorderedFolding):
2326 (testFloatEqualOrUnorderedFoldingNaN):
2327 (testFloatEqualOrUnorderedDontFold):
2329 (testShuffleDoesntTrashCalleeSaves):
2330 (testDemotePatchpointTerminal):
2331 (testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead):
2332 (testInfiniteLoopDoesntCauseBadHoisting):
2333 * b3/testb3_8.cpp: Added.
2334 (testAtomicWeakCAS):
2335 (testAtomicStrongCAS):
2341 2019-07-30 Yusuke Suzuki <ysuzuki@apple.com>
2343 [JSC] Emit write barrier after storing instead of before storing
2344 https://bugs.webkit.org/show_bug.cgi?id=200193
2346 Reviewed by Saam Barati.
2348 I reviewed tricky GC-related code including visitChildren and manual writeBarrier, and I found that we have several problems with write-barriers.
2350 1. Some write-barriers are emitted before stores happen
2352 Some code like LazyProperty emits write-barrier before we store the value. This is wrong since JSC has concurrent collector. Let's consider the situation like this.
2354 1. Cell "A" is not marked yet
2355 2. Write-barrier is emitted onto "A"
2356 3. Concurrent collector scans "A"
2357 4. Store to "A"'s field happens
2358 5. (4)'s field is not rescaned
2360 We should emit write-barrier after stores. This patch places write-barriers after stores happen.
2362 2. Should emit write-barrier after the stored fields are reachable from the owner.
2364 We have code that is logically the same to the following.
2367 auto data = std::make_unique<XXX>();
2368 data->m_field.set(vm, owner, value);
2370 storeStoreBarrier();
2371 owner->m_data = WTFMove(data);
2374 This is not correct. When write-barrier is emitted, the owner cannot reach to the field that is stored.
2375 The actual example is AccessCase. We are emitting write-barriers with owner when creating AccessCase, but this is not
2376 effective until this AccessCase is chained to StructureStubInfo, which is reachable from CodeBlock.
2378 I don't think this is actually an issue because currently AccessCase generation is guarded by CodeBlock->m_lock. And CodeBlock::visitChildren takes this lock.
2379 But emitting a write-barrier at the right place is still better. This patch places write-barriers when StructureStubInfo::addAccessCase is called.
2381 Speculative GC fix, it was hard to reproduce the crash since we need to control concurrent collector and main thread's scheduling in an instruction-level.
2383 * bytecode/BytecodeList.rb:
2384 * bytecode/CodeBlock.cpp:
2385 (JSC::CodeBlock::finishCreation):
2386 * bytecode/StructureStubInfo.cpp:
2387 (JSC::StructureStubInfo::addAccessCase):
2388 * bytecode/StructureStubInfo.h:
2389 (JSC::StructureStubInfo::considerCaching):
2391 (JSC::DFG::Plan::finalizeWithoutNotifyingCallback):
2392 * jit/JITOperations.cpp:
2393 * llint/LLIntSlowPaths.cpp:
2394 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
2395 (JSC::LLInt::setupGetByIdPrototypeCache):
2396 * runtime/CommonSlowPaths.cpp:
2397 (JSC::SLOW_PATH_DECL):
2398 * runtime/LazyPropertyInlines.h:
2399 (JSC::ElementType>::setMayBeNull):
2400 * runtime/RegExpCachedResult.h:
2401 (JSC::RegExpCachedResult::record):
2403 2019-07-30 Yusuke Suzuki <ysuzuki@apple.com>
2405 [JSC] Make StructureChain less-tricky by using Auxiliary Buffer
2406 https://bugs.webkit.org/show_bug.cgi?id=200192
2408 Reviewed by Saam Barati.
2410 StructureChain has a bit tricky write barrier / mutator fence to use UniqueArray for its underlying storage.
2411 But, since the size of StructureChain is fixed at initialization, we should allocate an underlying storage from auxiliary memory and
2412 set it in its constructor instead of finishCreation. We can store values in the finishCreation so that we do not need to have
2413 a hacky write-barrier and mutator fence. Furthermore, we can make StructureChain non-destructible.
2415 This patch leverages auxiliary buffer for the implementation of StructureChain. And it also adds a test that stresses StructureChain creation.
2417 * runtime/StructureChain.cpp:
2418 (JSC::StructureChain::StructureChain):
2419 (JSC::StructureChain::create):
2420 (JSC::StructureChain::finishCreation):
2421 (JSC::StructureChain::visitChildren):
2422 (JSC::StructureChain::destroy): Deleted.
2423 * runtime/StructureChain.h:
2425 2019-07-29 Yusuke Suzuki <ysuzuki@apple.com>
2427 [JSC] Increment bytecode age only when SlotVisitor is first-visit
2428 https://bugs.webkit.org/show_bug.cgi?id=200196
2430 Reviewed by Robin Morisset.
2432 WriteBarrier can cause multiple visits for the same UnlinkedCodeBlock. But this does not mean that we are having multiple cycles of GC.
2433 We should increment the age of the UnlinkedCodeBlock only when the SlotVisitor is saying that this is the first visit.
2435 In practice,this almost never happens. Multiple visits can happen only when the marked UnlinkedCodeBlock gets a write-barrier. But, mutation
2436 of UnlinkedCodeBlock is rare or none after it is initialized. I ran all the JSTests and I cannot find any tests that get re-visiting of UnlinkedCodeBlock.
2437 This patch extends JSTests/stress/reparsing-unlinked-codeblock.js to ensure that UnlinkedCodeBlockJettisoning feature is working after this change.
2439 * bytecode/UnlinkedCodeBlock.cpp:
2440 (JSC::UnlinkedCodeBlock::visitChildren):
2441 * heap/SlotVisitor.h:
2442 (JSC::SlotVisitor::isFirstVisit const):
2443 * parser/Parser.cpp:
2446 (JSC::parseFunctionForFunctionConstructor):
2447 * runtime/Options.h:
2448 * tools/JSDollarVM.cpp:
2449 (JSC::functionParseCount):
2450 (JSC::JSDollarVM::finishCreation):
2452 2019-07-28 Commit Queue <commit-queue@webkit.org>
2454 Unreviewed, rolling out r247886.
2455 https://bugs.webkit.org/show_bug.cgi?id=200214
2457 "Causes PLT5 regression on some machines" (Requested by mlam|a
2462 "Add crash diagnostics for debugging unexpected zapped cells."
2463 https://bugs.webkit.org/show_bug.cgi?id=200149
2464 https://trac.webkit.org/changeset/247886
2466 2019-07-27 Justin Michaud <justin_michaud@apple.com>
2468 [X86] Emit BT instruction for shift + mask in B3
2469 https://bugs.webkit.org/show_bug.cgi?id=199891
2471 Reviewed by Keith Miller.
2473 - Add a new BranchTestBit air opcode, matching the intel bt instruction
2474 - Select this instruction for the following patterns:
2479 - 15% perf progression on the nonconstant microbenchmark, neutral otherwise.
2480 - Note: we cannot fuse loads when we have bitBase=Load, bitOffset=Tmp, since the X86 instruction has
2481 different behaviour in this mode. It will read past the current dword/qword instead of wrapping around.
2483 * assembler/MacroAssemblerX86Common.h:
2484 (JSC::MacroAssemblerX86Common::branchTestBit32):
2485 * assembler/MacroAssemblerX86_64.h:
2486 (JSC::MacroAssemblerX86_64::branchTestBit64):
2487 * assembler/X86Assembler.h:
2488 (JSC::X86Assembler::bt_ir):
2489 (JSC::X86Assembler::bt_im):
2490 (JSC::X86Assembler::btw_ir):
2491 (JSC::X86Assembler::btw_im):
2492 * assembler/testmasm.cpp:
2493 (JSC::int64Operands):
2494 (JSC::testBranchTestBit32RegReg):
2495 (JSC::testBranchTestBit32RegImm):
2496 (JSC::testBranchTestBit32AddrImm):
2497 (JSC::testBranchTestBit64RegReg):
2498 (JSC::testBranchTestBit64RegImm):
2499 (JSC::testBranchTestBit64AddrImm):
2501 * b3/B3LowerToAir.cpp:
2502 * b3/air/AirOpcode.opcodes:
2504 (JSC::B3::testBranchBitTest32TmpImm):
2505 (JSC::B3::testBranchBitTest32AddrImm):
2506 (JSC::B3::testBranchBitTest32TmpTmp):
2507 (JSC::B3::testBranchBitTest64TmpTmp):
2508 (JSC::B3::testBranchBitTest64AddrTmp):
2511 2019-07-26 Yusuke Suzuki <ysuzuki@apple.com>
2513 [JSC] Potential GC fix for JSPropertyNameEnumerator
2514 https://bugs.webkit.org/show_bug.cgi?id=200151
2516 Reviewed by Mark Lam.
2518 We have been seeing some JSPropertyNameEnumerator::visitChildren crashes for a long time. The crash frequency itself is not high, but it has existed for a long time.
2519 The crash happens when visiting m_propertyNames. It is also possible that this crash is caused by random corruption somewhere, but JSPropertyNameEnumerator
2520 has some tricky (and potentially dangerous) implementations anyway.
2522 1. JSPropertyNameEnumerator have Vector<WriteBarrier<JSString>> and it is extended in finishCreation with a lock.
2523 We should use Auxiliary memory for this use case. And we should set this memory in the constructor so that
2524 we do not extend it in finishCreation, and we do not need a lock.
2525 2. JSPropertyNameEnumerator gets StructureID before allocating JSPropertyNameEnumerator. This is potentially dangerous because the conservative scan
2526 cannot find the Structure* since we could only have StructureID. Since allocation code happens after StructureID is retrieved, it is possible that
2527 the allocation causes GC and Structure* is collected.
2529 In this patch, we align JSPropertyNameEnumerator implementation to the modern one to avoid using Vector<WriteBarrier<JSString>>. And we can make JSPropertyNameEnumerator
2530 a non-destructible cell. Since JSCell's destructor is one of the cause of various issues, we should avoid it if we can.
2532 No behavior change. This patch adds a test stressing JSPropertyNameEnumerator.
2534 * dfg/DFGOperations.cpp:
2535 * runtime/CommonSlowPaths.cpp:
2536 (JSC::SLOW_PATH_DECL):
2537 * runtime/JSPropertyNameEnumerator.cpp:
2538 (JSC::JSPropertyNameEnumerator::create):
2539 (JSC::JSPropertyNameEnumerator::JSPropertyNameEnumerator):
2540 (JSC::JSPropertyNameEnumerator::finishCreation):
2541 (JSC::JSPropertyNameEnumerator::visitChildren):
2542 (JSC::JSPropertyNameEnumerator::destroy): Deleted.
2543 * runtime/JSPropertyNameEnumerator.h:
2545 (JSC::VM::emptyPropertyNameEnumeratorSlow):
2547 (JSC::VM::emptyPropertyNameEnumerator):
2549 2019-07-26 Mark Lam <mark.lam@apple.com>
2551 Add crash diagnostics for debugging unexpected zapped cells.
2552 https://bugs.webkit.org/show_bug.cgi?id=200149
2553 <rdar://problem/53570112>
2555 Reviewed by Yusuke Suzuki, Saam Barati, and Michael Saboff.
2557 Add a check for zapped cells in SlotVisitor::appendToMarkStack() and
2558 SlotVisitor::visitChildren(). If a zapped cell is detected, we will crash with
2559 some diagnostic info.
2561 To facilitate this, we've made the following changes:
2562 1. Changed FreeCell to preserve the 1st 8 bytes. This is fine to do because all
2563 cells are at least 16 bytes long.
2564 2. Changed HeapCell::zap() to only zap the structureID. Leave the rest of the
2565 cell header info intact (including the cell JSType).
2566 3. Changed HeapCell::zap() to record the reason for zapping the cell. We stash
2567 the reason immediately after the first 8 bytes. This is the same location as
2568 FreeCell::scrambledNext. However, since a cell is not expected to be zapped
2569 and on the free list at the same time, it is also fine to do this.
2570 4. Added a few utility functions to MarkedBlock for checking if a cell points
2572 5. Added VMInspector and JSDollarVM utilities to dump in-use subspace hashes.
2573 6. Added some comments to document the hashes of known subspaces.
2576 (JSC::FreeCell::offsetOfScrambledNext):
2578 (JSC::HeapCell::zap):
2579 (JSC::HeapCell::isZapped const):
2580 * heap/MarkedBlock.cpp:
2581 (JSC::MarkedBlock::Handle::stopAllocating):
2582 * heap/MarkedBlock.h:
2583 (JSC::MarkedBlock::Handle::start const):
2584 (JSC::MarkedBlock::Handle::end const):
2585 (JSC::MarkedBlock::Handle::contains const):
2586 * heap/MarkedBlockInlines.h:
2587 (JSC::MarkedBlock::Handle::specializedSweep):
2588 * heap/MarkedSpace.h:
2589 (JSC::MarkedSpace::forEachSubspace):
2590 * heap/SlotVisitor.cpp:
2591 (JSC::SlotVisitor::appendToMarkStack):
2592 (JSC::SlotVisitor::visitChildren):
2593 (JSC::SlotVisitor::reportZappedCellAndCrash):
2594 * heap/SlotVisitor.h:
2595 * jit/AssemblyHelpers.cpp:
2596 (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator):
2599 * tools/JSDollarVM.cpp:
2600 (JSC::functionDumpSubspaceHashes):
2601 (JSC::JSDollarVM::finishCreation):
2602 * tools/VMInspector.cpp:
2603 (JSC::VMInspector::dumpSubspaceHashes):
2604 * tools/VMInspector.h:
2606 2019-07-25 Yusuke Suzuki <ysuzuki@apple.com>
2608 [JSC] Use unalignedLoad for JSRopeString fiber accesses
2609 https://bugs.webkit.org/show_bug.cgi?id=200148
2611 Reviewed by Mark Lam.
2613 JSRopeString always have some subsequent bytes that can be accessible because MarkedBlock has Footer.
2614 We use WTF::unalignedLoad to get fibers. And it will be converted to one load CPU instruction.
2616 * heap/MarkedBlock.h:
2617 * runtime/JSString.h:
2619 2019-07-25 Ross Kirsling <ross.kirsling@sony.com>
2621 Legacy numeric literals should not permit separators or BigInt
2622 https://bugs.webkit.org/show_bug.cgi?id=199984
2624 Reviewed by Keith Miller.
2627 (JSC::Lexer<T>::parseOctal):
2628 (JSC::Lexer<T>::parseDecimal):
2630 2019-07-25 Yusuke Suzuki <ysuzuki@apple.com>
2632 Unreviewed, build fix due to C++17's std::invoke_result_t
2633 https://bugs.webkit.org/show_bug.cgi?id=200139
2635 Use std::result_of for now until all the supported environments implement it.
2637 * heap/IsoSubspace.h:
2639 2019-07-25 Yusuke Suzuki <ysuzuki@apple.com>
2641 [JSC] Ensure PackedCellPtr only takes non-large-allocation pointers
2642 https://bugs.webkit.org/show_bug.cgi?id=200139
2644 Reviewed by Mark Lam.
2646 PackedCellPtr will compact a pointer by leveraging the fact that JSCell pointers are 16byte aligned.
2647 But this fact only holds when the JSCell is not large allocation. Currently, we are using PackedCellPtr
2648 only for the cell types which meets the above requirement. But we would like to ensure that statically.
2650 In this patch, we add additional static/runtime assertions to ensure this invariant. We accept a cell
2651 type of either (1) it is "final" annotated and sizeof(T) is <= MarkedSpace::largeCutoff or (2) it
2652 is allocated from IsoSubspace.
2654 This patch does not change any behaviors. It just adds extra static/runtime assertions.
2656 * bytecode/CodeBlock.h:
2657 (JSC::CodeBlock::subspaceFor):
2658 * bytecode/CodeBlockJettisoningWatchpoint.h:
2659 * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h:
2660 * dfg/DFGAdaptiveStructureWatchpoint.h:
2661 * heap/IsoSubspace.h:
2662 * heap/PackedCellPtr.h:
2663 (JSC::PackedCellPtr::PackedCellPtr):
2664 * runtime/FunctionRareData.h:
2665 (JSC::FunctionRareData::createAllocationProfileClearingWatchpoint):
2666 * runtime/ObjectToStringAdaptiveStructureWatchpoint.h:
2668 2019-07-25 Yusuke Suzuki <ysuzuki@apple.com>
2670 [JSC] Make visitChildren implementation more idiomatic
2671 https://bugs.webkit.org/show_bug.cgi?id=200121
2673 Reviewed by Mark Lam.
2675 This patch makes visitChildren implementations more idiomatic: cast, assert, and calling Base::visitChildren.
2676 While this does not find interesting issues, it is still nice to have consistent implementations.
2677 StructureChain::visitChildren missed Base::visitChildren, but it does not have much effect since StructureChain
2680 * bytecode/ExecutableToCodeBlockEdge.cpp:
2681 (JSC::ExecutableToCodeBlockEdge::visitChildren):
2682 * runtime/AbstractModuleRecord.cpp:
2683 (JSC::AbstractModuleRecord::visitChildren):
2684 * runtime/FunctionRareData.cpp:
2685 (JSC::FunctionRareData::visitChildren):
2686 * runtime/JSArrayBufferView.cpp:
2687 (JSC::JSArrayBufferView::visitChildren):
2688 * runtime/JSGenericTypedArrayViewInlines.h:
2689 (JSC::JSGenericTypedArrayView<Adaptor>::visitChildren):
2690 * runtime/JSImmutableButterfly.cpp:
2691 (JSC::JSImmutableButterfly::visitChildren):
2692 * runtime/JSModuleEnvironment.cpp:
2693 (JSC::JSModuleEnvironment::visitChildren):
2694 * runtime/JSModuleRecord.cpp:
2695 (JSC::JSModuleRecord::visitChildren):
2696 * runtime/JSPropertyNameEnumerator.cpp:
2697 (JSC::JSPropertyNameEnumerator::visitChildren):
2698 * runtime/JSString.cpp:
2699 (JSC::JSString::visitChildren):
2700 * runtime/SparseArrayValueMap.cpp:
2701 (JSC::SparseArrayValueMap::visitChildren):
2702 * runtime/StructureChain.cpp:
2703 (JSC::StructureChain::visitChildren):
2704 * runtime/SymbolTable.cpp:
2705 (JSC::SymbolTable::visitChildren):
2706 * tools/JSDollarVM.cpp:
2707 (JSC::Root::visitChildren):
2708 (JSC::ImpureGetter::visitChildren):
2709 * wasm/js/WebAssemblyModuleRecord.cpp:
2710 (JSC::WebAssemblyModuleRecord::visitChildren):
2712 2019-07-25 Ross Kirsling <ross.kirsling@sony.com>
2714 [ESNext] Implement nullish coalescing
2715 https://bugs.webkit.org/show_bug.cgi?id=200072
2717 Reviewed by Darin Adler.
2719 Implement the nullish coalescing proposal, which has now reached Stage 3 at TC39.
2721 This introduces a ?? operator which:
2722 - acts like || but checks for nullishness instead of truthiness
2723 - has a precedence lower than || (or any other binary operator)
2724 - must be disambiguated with parentheses when combined with || or &&
2726 * bytecompiler/NodesCodegen.cpp:
2727 (JSC::CoalesceNode::emitBytecode): Added.
2728 Bytecode must use OpIsUndefinedOrNull and not OpNeqNull because of document.all.
2730 * parser/ASTBuilder.h:
2731 (JSC::ASTBuilder::makeBinaryNode):
2733 (JSC::Lexer<T>::lexWithoutClearingLineTerminator):
2734 * parser/NodeConstructors.h:
2735 (JSC::CoalesceNode::CoalesceNode): Added.
2737 Introduce new token and AST node.
2739 * parser/Parser.cpp:
2740 (JSC::Parser<LexerType>::parseBinaryExpression):
2741 Implement early error.
2743 * parser/ParserTokens.h:
2744 Since this patch needs to shift the value of every binary operator token anyway,
2745 let's only bother to increment their LSBs when we actually have a precedence conflict.
2747 * parser/ResultType.h:
2748 (JSC::ResultType::definitelyIsNull const): Added.
2749 (JSC::ResultType::mightBeUndefinedOrNull const): Added.
2750 (JSC::ResultType::forCoalesce): Added.
2751 We can do better than forLogicalOp here; let's be as accurate as possible.
2753 * runtime/Options.h:
2754 Add runtime feature flag.
2756 2019-07-24 Alexey Shvayka <shvaikalesh@gmail.com>
2758 Three checks are missing in Proxy internal methods
2759 https://bugs.webkit.org/show_bug.cgi?id=198630
2761 Reviewed by Darin Adler.
2763 Add three missing checks in Proxy internal methods.
2764 These checks are necessary to maintain the invariants of the essential internal methods.
2765 (https://github.com/tc39/ecma262/pull/666)
2767 1. [[GetOwnProperty]] shouldn't return non-configurable and non-writable descriptor when the target's property is writable.
2768 2. [[Delete]] should return `false` when the target has property and is not extensible.
2769 3. [[DefineOwnProperty]] should return `true` for a non-writable input descriptor when the target's property is non-configurable and writable.
2771 Shipping in SpiderMonkey since https://hg.mozilla.org/integration/autoland/rev/3a06bc818bc4 (version 69)
2772 Shipping in V8 since https://chromium.googlesource.com/v8/v8.git/+/e846ad9fa5109428be50b1989314e0e4e7267919
2774 * runtime/ProxyObject.cpp:
2775 (JSC::ProxyObject::performInternalMethodGetOwnProperty): Add writability check.
2776 (JSC::ProxyObject::performDelete): Add extensibility check.
2777 (JSC::ProxyObject::performDefineOwnProperty): Add writability check.
2779 2019-07-24 Mark Lam <mark.lam@apple.com>
2781 Remove some unused code.
2782 https://bugs.webkit.org/show_bug.cgi?id=200101
2784 Reviewed by Yusuke Suzuki.
2786 * heap/MarkedBlock.cpp:
2787 (JSC::MarkedBlock::Handle::zap): Deleted.
2788 * heap/MarkedBlock.h:
2789 * heap/SlotVisitor.cpp:
2790 (JSC::SlotVisitor::appendToMutatorMarkStack): Deleted.
2791 * heap/SlotVisitor.h:
2793 2019-07-24 Mark Lam <mark.lam@apple.com>
2795 performJITMemcpy should be PACed with a non-zero diversifier when passed and called via a pointer.
2796 https://bugs.webkit.org/show_bug.cgi?id=200100
2797 <rdar://problem/53474939>
2799 Reviewed by Yusuke Suzuki.
2801 * assembler/ARM64Assembler.h:
2802 (JSC::ARM64Assembler::CopyFunction::CopyFunction):
2803 (JSC::ARM64Assembler::CopyFunction::operator()):
2804 - I choose to use ptrauth_auth_function() here instead of retagCodePtr() because
2805 retagCodePtr() would auth, assert, and re-pac the pointer. This is needed in
2806 general because retagCodePtr() doesn't know that you will consume the pointer
2807 immediately (and therefore crash imminently if a failed auth is encountered).
2808 Since we know here that we will call with the auth'ed pointer immediately, we
2809 can skip the assert.
2811 This also has the benefit of letting Clang do a peephole optimization to emit
2812 a blrab instruction with the intended diversifier, instead of emitting multiple
2813 instructions to auth the pointer into a C function, and then using a blraaz to
2814 do a C function call.
2816 (JSC::ARM64Assembler::linkJumpOrCall):
2817 (JSC::ARM64Assembler::linkCompareAndBranch):
2818 (JSC::ARM64Assembler::linkConditionalBranch):
2819 (JSC::ARM64Assembler::linkTestAndBranch):
2820 * assembler/LinkBuffer.cpp:
2821 (JSC::LinkBuffer::copyCompactAndLinkCode):
2822 * runtime/JSCPtrTag.h:
2824 2019-07-24 Devin Rousso <drousso@apple.com>
2826 Web Inspector: print the target of `console.screenshot` last so the target is the closest item to the image
2827 https://bugs.webkit.org/show_bug.cgi?id=199308
2829 Reviewed by Joseph Pecoraro.
2831 * inspector/ConsoleMessage.h:
2832 (Inspector::ConsoleMessage::arguments const):
2834 * inspector/ScriptArguments.h:
2835 * inspector/ScriptArguments.cpp:
2836 (Inspector::ScriptArguments::getFirstArgumentAsString const): Added.
2837 (Inspector::ScriptArguments::getFirstArgumentAsString): Deleted.
2839 2019-07-23 Justin Michaud <justin_michaud@apple.com>
2841 Sometimes we miss removable CheckInBounds
2842 https://bugs.webkit.org/show_bug.cgi?id=200018
2844 Reviewed by Saam Barati.
2846 We failed to remove the CheckInBounds bounds because we did not see that the index was nonnegative. This is because we do not see the relationship between the two
2847 separate zero constants that appear in the IR for the given test case. This patch re-adds the hack to de-duplicate m_zero that was removed in
2848 <https://trac.webkit.org/changeset/241228/webkit>.
2850 * dfg/DFGIntegerRangeOptimizationPhase.cpp:
2852 2019-07-22 Yusuke Suzuki <ysuzuki@apple.com>
2854 [bmalloc] Each IsoPage gets 1MB VA because VMHeap::tryAllocateLargeChunk rounds up
2855 https://bugs.webkit.org/show_bug.cgi?id=200024
2857 Reviewed by Saam Barati.
2859 Discussed and we decided to use this VM tag for IsoHeap instead of CLoop stack.
2861 * interpreter/CLoopStack.cpp:
2862 (JSC::CLoopStack::CLoopStack):
2864 2019-07-22 Saam Barati <sbarati@apple.com>
2866 Turn off Wasm fast memory on iOS
2867 https://bugs.webkit.org/show_bug.cgi?id=200016
2868 <rdar://problem/53417726>
2870 Reviewed by Yusuke Suzuki.
2872 We turned them on when we disabled Gigacage on iOS. However, we re-enabled
2873 Gigacage on iOS, but forgot to turn wasm fast memories back off.
2875 * runtime/Options.h:
2877 2019-07-22 Ross Kirsling <ross.kirsling@sony.com>
2879 Unreviewed non-unified build fix.
2881 * runtime/CachedTypes.h:
2883 2019-07-20 Yusuke Suzuki <ysuzuki@apple.com>
2885 [JSC] Make DFG Local CSE and AI conservative for huge basic block
2886 https://bugs.webkit.org/show_bug.cgi?id=199929
2887 <rdar://problem/49309924>
2889 Reviewed by Filip Pizlo.
2891 In CNN page, the main thread hangs several seconds. On less-powerful devices (like iPhone7), it hangs for ~11 seconds. This is not an acceptable behavior.
2892 The reason of this is that the DFG compiler takes too long time in the compilation for a particular function. It takes 8765 ms even in powerful x64 machine!
2893 DFG compiler is concurrent one. However, when GC requires all the peripheral threads to be stopped, the main thread needs to wait for the DFG compiler's stop.
2894 DFG compiler stops at GC safepoints, and they are inserted between DFG phases. So, if some of DFG phases take very long time, the main thread is blocked during that.
2895 As a result, the main thread is blocked due to this pathological compilation.
2897 By measuring the time taken in each DFG phase, we found that our AI and CSE phase have a problem having quadratic complexity for # of DFG nodes in a basic block.
2898 In this patch, we add a threshold for # of DFG nodes in a basic block. If a basic block exceeds this threshold, we use conservative but O(1) algorithm for AI and Local CSE phase.
2899 We did not add this threshold for Global CSE since FTL has another bytecode cost threshold which prevents us from compiling the large functions. But on the other hand,
2900 DFG should compile them because DFG is intended to be a fast compiler even for a bit larger CodeBlock.
2902 We first attempted to reduce the threshold for DFG compilation. We are using 100000 bytecode cost for DFG compilation and it is very large. However, we found that bytecode cost
2903 is not the problem in CNN page. The problematic function has 67904 cost, and it takes 8765 ms in x64 machine. However, JetStream2/octane-zlib has 61949 function and it only takes
2904 ~400 ms. This difference comes from the # of DFG nodes in a basic block. The problematic function has 43297 DFG nodes in one basic block and it makes AI and Local CSE super time-consuming.
2905 Rather than relying on the bytecode cost which a bit indirectly related to this pathological compile-time, we should look into # of DFG nodes in a basic block which is more directly
2906 related to this problem. And we also found that 61949's Octane-zlib function is very critical for performance. This fact makes a bit hard to pick a right threshold: 67904 causes the problem,
2907 and 61949 must be compiled. This is why this patch is introducing conservative analysis instead of adjusting the threshold for DFG.
2909 This patch has two changes.
2911 1. DFG AI has structure transition tracking which has quadratic complexity
2913 Structure transition tracking takes very long time since its complexity is O(N^2) where N is # of DFG nodes in a basic block.
2914 CNN has very pathological script and it shows 43297 DFG nodes. We should reduce the complexity of this algorithm.
2915 For now, we just say "structures are clobbered" if # of DFG nodes in a basic block exceeds the threshold (20000).
2916 We could improve the current algorithm from O(N^2) to O(2N) without being conservative, and I'm tracking this in [1].
2918 2. DFG Local CSE has quadratic complexity
2920 Local CSE's clobbering iterates all the impure heap values to remove the clobbered one. Since # of impure heap values tend to be proportional to # of DFG nodes we visited,
2921 each CSE for a basic block gets O(N^2) complexity. To avoid this, we introduce HugeMap. This has the same interface to LargeMap and SmallMap in CSE, but its clobbering
2922 implementation just clears the map completely. We can further make this O(N) without introducing conservative behavior by using epochs. For now, we do not see such a huge basic block in
2923 JetStream2 and Speedometer2 so I'll track it in a separate bug[2].
2925 This patch reduces the compilation time from ~11 seconds to ~200 ms.
2927 [1]: https://bugs.webkit.org/show_bug.cgi?id=199959
2928 [2]: https://bugs.webkit.org/show_bug.cgi?id=200014
2930 * dfg/DFGAbstractInterpreterInlines.h:
2931 (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransition):
2932 (JSC::DFG::AbstractInterpreter<AbstractStateType>::observeTransitions):
2933 * dfg/DFGCSEPhase.cpp:
2934 * runtime/Options.h:
2936 2019-07-22 Zhifei Fang <zhifei_fang@apple.com>
2938 Need to skip test cache directory data vault for non internal build
2939 https://bugs.webkit.org/show_bug.cgi?id=199951
2941 Reviewed by Alexey Proskuryakov.
2943 * API/tests/testapi.mm:
2944 (testBytecodeCacheValidation): "Cache directory `/private/tmp` is not a data vault" this error message will only be created for internal build see JSScript.mm:97
2946 2019-07-17 Antoine Quint <graouts@apple.com>
2948 Disable Pointer Events prior to watchOS 6
2949 https://bugs.webkit.org/show_bug.cgi?id=199890
2950 <rdar://problem/53206113>
2952 Reviewed by Dean Jackson.
2954 * Configurations/FeatureDefines.xcconfig:
2956 2019-07-17 Keith Miller <keith_miller@apple.com>
2958 Force useLLInt to true on arm64_32
2959 https://bugs.webkit.org/show_bug.cgi?id=199882
2960 <rdar://problem/53207586>
2962 Reviewed by Yusuke Suzuki.
2964 Some jsc tests set useLLInt=false but on arm64_32 we don't support the JIT.
2965 This causes the option coherency checker to get angry. We should force
2966 useLLInt=true on arm64_32 unless useJIT=true.
2968 * runtime/Options.cpp:
2969 (JSC::recomputeDependentOptions):
2971 2019-07-17 Christopher Reid <chris.reid@sony.com>
2973 Bytecode cache should use FileSystem
2974 https://bugs.webkit.org/show_bug.cgi?id=199759
2976 Reviewed by Yusuke Suzuki.
2978 Update bytecode cache to use platform generic FileSystem calls.
2983 * runtime/CachePayload.cpp:
2984 * runtime/CachePayload.h:
2985 * runtime/CachedBytecode.h:
2986 * runtime/CachedTypes.cpp:
2987 * runtime/CachedTypes.h:
2988 * runtime/CodeCache.cpp:
2989 * runtime/CodeCache.h:
2990 * runtime/Completion.cpp:
2991 * runtime/Completion.h:
2993 2019-07-17 Mark Lam <mark.lam@apple.com>
2995 ArgumentsEliminationPhase should insert KillStack nodes before PutStack nodes that it adds.
2996 https://bugs.webkit.org/show_bug.cgi?id=199821
2997 <rdar://problem/52452328>
2999 Reviewed by Filip Pizlo.
3001 Excluding the ArgumentsEliminationPhase, PutStack nodes are converted from SetLocal
3002 nodes in the SSAConversionPhase. SetLocal nodes are always preceded by MovHint nodes,
3003 and the SSAConversionPhase always inserts a KillStack node before a MovHint node.
3004 Hence, a PutStack node is always preceded by a KillStack node.
3006 However, the ArgumentsEliminationPhase can convert LoadVarargs nodes into a series
3007 of one or more PutStacks nodes, and it prepends MovHint nodes before the PutStack
3008 nodes. However, it neglects to prepend KillStack nodes as well. Since the
3009 ArgumentsEliminationPhase runs after the SSAConversionPhase, the PutStack nodes
3010 added during ArgumentsElimination will not be preceded by KillStack nodes.
3012 This patch fixes this by inserting a KillStack in the ArgumentsEliminationPhase
3013 before it inserts a MovHint and a PutStack node.
3015 Consider this test case which can manifest the above issue as a crash:
3017 function inlinee(value) {
3019 let tmp = value + 1;
3022 function reflect() {
3023 return inlinee.apply(undefined, arguments);
3026 function test(arr) {
3027 let object = inlinee.apply(undefined, arr); // Uses a lot of SetArgumentMaybe nodes.
3028 reflect(); // Calls with a LoadVararg, which gets converted into a PutStack of a constant.
3031 In this test case, we have a scenario where a SetArgumentMaybe's stack
3032 slot is reused as the stack slot for a PutStack later. Here, the PutStack will
3033 put a constant undefined value. Coincidentally, the SetArgumentMaybe may also
3034 initialize that stack slot to a constant undefined value. Note that by the time
3035 the PutStack executes, the SetArgumentMaybe's stack slot is dead. The liveness of
3036 these 2 values are distinct.
3038 However, because we were missing a KillStack before the PutStack, OSR availability
3039 analysis gets misled into thinking that the PutStack constant value is still in the
3040 stack slot because the value left there by the SetArgumentMaybe hasn't been killed
3041 off yet. As a result, OSR exit code will attempt to recover the PutStack's undefined
3042 constant by loading from the stack slot instead of materializing it. Since
3043 SetArgumentMaybe may not actually initialize the stack slot, we get a crash in OSR
3044 exit when we try to recover the PutStack constant value from the stack slot, and
3045 end up using what ever junk value we read from there.
3047 Fixing the ArgumentsEliminationPhase to insert KillStack before the PutStack
3048 removes this conflation of the PutStack's constant value with the SetArgumentMaybe's
3049 constant value in the same stack slot. And, OSR availability analysis will no
3050 longer be misled to load the PutStack's constant value from the stack, but will
3051 materialize the constant instead.
3053 * dfg/DFGArgumentsEliminationPhase.cpp:
3055 2019-07-17 Commit Queue <commit-queue@webkit.org>
3057 Unreviewed, rolling out r247505.
3058 https://bugs.webkit.org/show_bug.cgi?id=199871
3060 "Caused failed ASSERT in stress test" (Requested by creid on
3065 "Bytecode cache should use FileSystem"
3066 https://bugs.webkit.org/show_bug.cgi?id=199759
3067 https://trac.webkit.org/changeset/247505
3069 2019-07-16 Christopher Reid <chris.reid@sony.com>
3071 Bytecode cache should use FileSystem
3072 https://bugs.webkit.org/show_bug.cgi?id=199759
3074 Reviewed by Yusuke Suzuki.
3076 Update bytecode cache to use platform generic FileSystem calls.
3081 * runtime/CachePayload.cpp:
3082 * runtime/CachePayload.h:
3083 * runtime/CachedBytecode.h:
3084 * runtime/CachedTypes.cpp:
3085 * runtime/CachedTypes.h:
3086 * runtime/CodeCache.cpp:
3087 * runtime/CodeCache.h:
3088 * runtime/Completion.cpp:
3089 * runtime/Completion.h:
3091 2019-07-16 Joonghun Park <pjh0718@gmail.com>
3093 [GTK] Fix a build warning in JavaScriptCore/API/tests/testapi.c
3094 https://bugs.webkit.org/show_bug.cgi?id=199824
3096 Reviewed by Alex Christensen.
3098 * API/tests/testapi.c:
3101 2019-07-15 Keith Miller <keith_miller@apple.com>
3103 JSGlobalObject type macros should support feature flags and WeakRef should have one
3104 https://bugs.webkit.org/show_bug.cgi?id=199601
3106 Reviewed by Mark Lam.
3108 This patch refactors the various builtin type macros to have a
3109 parameter, which is the feature flag enabling it. Since most
3110 builtin types are enabled by default this patch adds a new global
3111 bool typeExposedByDefault for clarity. Note, because static hash
3112 tables have no concept of feature flags we can't use feature flags
3113 with lazy properties. This is probably not a big deal as features
3114 that are off by default won't be allocated anywhere we care about
3115 memory usage anyway.
3117 * runtime/CommonIdentifiers.h:
3118 * runtime/JSGlobalObject.cpp:
3119 (JSC::JSGlobalObject::init):
3120 (JSC::JSGlobalObject::visitChildren):
3121 * runtime/JSGlobalObject.h:
3122 (JSC::JSGlobalObject::stringObjectStructure const):
3123 (JSC::JSGlobalObject::bigIntObjectStructure const): Deleted.
3124 * runtime/Options.h:
3125 * wasm/js/JSWebAssembly.cpp:
3127 2019-07-15 Keith Miller <keith_miller@apple.com>
3129 A Possible Issue of Object.create method
3130 https://bugs.webkit.org/show_bug.cgi?id=199744
3132 Reviewed by Yusuke Suzuki.
3134 We should call toObject on the properties argument if it was not undefined.
3135 See: https://tc39.es/ecma262/#sec-object.create
3137 * runtime/ObjectConstructor.cpp:
3138 (JSC::objectConstructorCreate):
3140 2019-07-15 Saagar Jha <saagarjha@apple.com>
3142 Keyword lookup can use memcmp to get around unaligned load undefined behavior
3143 https://bugs.webkit.org/show_bug.cgi?id=199650
3145 Reviewed by Yusuke Suzuki.
3147 Replace KeywordLookup's hand-rolled "memcmp" with the standard version, which reduces the need to deal with
3148 endianness and unaligned loads.
3150 * KeywordLookupGenerator.py:
3151 (Trie.printSubTreeAsC): Use memcmp instead of macros to test for matches.
3152 (Trie.printAsC): Unspecialize Lexer::parseKeyword as templating over the character type reduces the amount of
3153 code we need to generate and moves this task out of the Python script and into the C++ compiler.
3155 2019-07-15 Yusuke Suzuki <ysuzuki@apple.com>
3157 [JSC] Improve wasm wpt test results by fixing miscellaneous issues
3158 https://bugs.webkit.org/show_bug.cgi?id=199783
3160 Reviewed by Mark Lam.
3162 This patch fixes miscellaneous issues in our Wasm JS API implementation to improve WPT score.
3163 I picked trivial ones in this patch to make this easily reviewable.
3165 1. Remove WebAssemblyPrototype. It does not exist in the spec. Merging WebAssemblyPrototype into JSWebAssembly.
3166 2. Fix various attributes. It does not match to the usual JSC builtin's convention. But this change
3167 is correct because they are changed to be matched against WebIDL definition, and WebAssembly implementation
3168 follows WebIDL. In the future, we could move WebCore WebIDL things into WTF layer and even use (or leverage
3169 some of utility functions) in our WebAssembly JS API implementation.
3170 3. Fix how we interpret "present" in WebAssembly spec. This does not mean [[HasProperty]] result. It follows to
3171 WebIDL spec, and it means that [[Get]] result is not undefined.
3172 4. Add argument count check to Module.customSections, which is required because the method is defined in WebIDL.
3173 5. Fix toNonWrappingUint32 to match it to WebIDL's conversion rule.
3176 * DerivedSources-input.xcfilelist:
3177 * DerivedSources-output.xcfilelist:
3178 * DerivedSources.make:
3179 * JavaScriptCore.xcodeproj/project.pbxproj:
3181 * builtins/WebAssembly.js: Renamed from Source/JavaScriptCore/builtins/WebAssemblyPrototype.js.
3183 * runtime/JSGlobalObject.cpp:
3184 (JSC::JSGlobalObject::init):
3185 * runtime/JSModuleLoader.cpp:
3186 (JSC::moduleLoaderParseModule):
3187 * wasm/js/JSWebAssembly.cpp:
3188 (JSC::JSWebAssembly::create):
3189 (JSC::JSWebAssembly::finishCreation):
3191 (JSC::webAssemblyModuleValidateAsyncInternal):
3192 (JSC::webAssemblyCompileFunc):
3194 (JSC::JSWebAssembly::webAssemblyModuleValidateAsync):
3196 (JSC::compileAndInstantiate):
3197 (JSC::JSWebAssembly::instantiate):
3198 (JSC::webAssemblyModuleInstantinateAsyncInternal):
3199 (JSC::JSWebAssembly::webAssemblyModuleInstantinateAsync):
3200 (JSC::webAssemblyInstantiateFunc):
3201 (JSC::webAssemblyValidateFunc):
3202 (JSC::webAssemblyCompileStreamingInternal):
3203 (JSC::webAssemblyInstantiateStreamingInternal):
3204 * wasm/js/JSWebAssembly.h:
3205 * wasm/js/JSWebAssemblyHelpers.h:
3206 (JSC::toNonWrappingUint32):
3207 * wasm/js/WebAssemblyCompileErrorConstructor.cpp:
3208 (JSC::WebAssemblyCompileErrorConstructor::finishCreation):
3209 * wasm/js/WebAssemblyInstanceConstructor.cpp:
3210 (JSC::WebAssemblyInstanceConstructor::finishCreation):
3211 * wasm/js/WebAssemblyInstancePrototype.cpp:
3212 * wasm/js/WebAssemblyLinkErrorConstructor.cpp:
3213 (JSC::WebAssemblyLinkErrorConstructor::finishCreation):
3214 * wasm/js/WebAssemblyMemoryConstructor.cpp:
3215 (JSC::constructJSWebAssemblyMemory):
3216 (JSC::WebAssemblyMemoryConstructor::finishCreation):
3217 * wasm/js/WebAssemblyMemoryPrototype.cpp:
3218 * wasm/js/WebAssemblyModuleConstructor.cpp:
3219 (JSC::webAssemblyModuleCustomSections):
3220 (JSC::WebAssemblyModuleConstructor::finishCreation):
3221 * wasm/js/WebAssemblyPrototype.cpp: Removed.
3222 * wasm/js/WebAssemblyPrototype.h: Removed.
3223 * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
3224 (JSC::WebAssemblyRuntimeErrorConstructor::finishCreation):
3225 * wasm/js/WebAssemblyTableConstructor.cpp:
3226 (JSC::constructJSWebAssemblyTable):
3227 (JSC::WebAssemblyTableConstructor::finishCreation):
3228 * wasm/js/WebAssemblyTablePrototype.cpp:
3230 2019-07-15 Michael Catanzaro <mcatanzaro@igalia.com>
3232 Unreviewed, rolling out r247440.
3238 "[JSC] Improve wasm wpt test results by fixing miscellaneous
3240 https://bugs.webkit.org/show_bug.cgi?id=199783
3241 https://trac.webkit.org/changeset/247440
3243 2019-07-15 Yusuke Suzuki <ysuzuki@apple.com>
3245 [JSC] Improve wasm wpt test results by fixing miscellaneous issues
3246 https://bugs.webkit.org/show_bug.cgi?id=199783
3248 Reviewed by Mark Lam.
3250 This patch fixes miscellaneous issues in our Wasm JS API implementation to improve WPT score.
3251 I picked trivial ones in this patch to make this easily reviewable.
3253 1. Remove WebAssemblyPrototype. It does not exist in the spec. Merging WebAssemblyPrototype into JSWebAssembly.
3254 2. Fix various attributes. It does not match to the usual JSC builtin's convention. But this change
3255 is correct because they are changed to be matched against WebIDL definition, and WebAssembly implementation
3256 follows WebIDL. In the future, we could move WebCore WebIDL things into WTF layer and even use (or leverage
3257 some of utility functions) in our WebAssembly JS API implementation.
3258 3. Fix how we interpret "present" in WebAssembly spec. This does not mean [[HasProperty]] result. It follows to
3259 WebIDL spec, and it means that [[Get]] result is not undefined.
3260 4. Add argument count check to Module.customSections, which is required because the method is defined in WebIDL.
3261 5. Fix toNonWrappingUint32 to match it to WebIDL's conversion rule.
3264 * DerivedSources-input.xcfilelist:
3265 * DerivedSources-output.xcfilelist:
3266 * DerivedSources.make:
3267 * JavaScriptCore.xcodeproj/project.pbxproj:
3269 * builtins/WebAssembly.js: Renamed from Source/JavaScriptCore/builtins/WebAssemblyPrototype.js.
3271 * runtime/JSGlobalObject.cpp:
3272 (JSC::JSGlobalObject::init):
3273 * runtime/JSModuleLoader.cpp:
3274 (JSC::moduleLoaderParseModule):
3275 * wasm/js/JSWebAssembly.cpp:
3276 (JSC::JSWebAssembly::create):
3277 (JSC::JSWebAssembly::finishCreation):
3279 (JSC::webAssemblyModuleValidateAsyncInternal):
3280 (JSC::webAssemblyCompileFunc):
3282 (JSC::JSWebAssembly::webAssemblyModuleValidateAsync):
3284 (JSC::compileAndInstantiate):
3285 (JSC::JSWebAssembly::instantiate):
3286 (JSC::webAssemblyModuleInstantinateAsyncInternal):
3287 (JSC::JSWebAssembly::webAssemblyModuleInstantinateAsync):
3288 (JSC::webAssemblyInstantiateFunc):
3289 (JSC::webAssemblyValidateFunc):
3290 (JSC::webAssemblyCompileStreamingInternal):
3291 (JSC::webAssemblyInstantiateStreamingInternal):
3292 * wasm/js/JSWebAssembly.h:
3293 * wasm/js/JSWebAssemblyHelpers.h:
3294 (JSC::toNonWrappingUint32):
3295 * wasm/js/WebAssemblyCompileErrorConstructor.cpp:
3296 (JSC::WebAssemblyCompileErrorConstructor::finishCreation):
3297 * wasm/js/WebAssemblyInstanceConstructor.cpp:
3298 (JSC::WebAssemblyInstanceConstructor::finishCreation):
3299 * wasm/js/WebAssemblyInstancePrototype.cpp:
3300 * wasm/js/WebAssemblyLinkErrorConstructor.cpp:
3301 (JSC::WebAssemblyLinkErrorConstructor::finishCreation):
3302 * wasm/js/WebAssemblyMemoryConstructor.cpp:
3303 (JSC::constructJSWebAssemblyMemory):
3304 (JSC::WebAssemblyMemoryConstructor::finishCreation):
3305 * wasm/js/WebAssemblyMemoryPrototype.cpp:
3306 * wasm/js/WebAssemblyModuleConstructor.cpp:
3307 (JSC::webAssemblyModuleCustomSections):
3308 (JSC::WebAssemblyModuleConstructor::finishCreation):
3309 * wasm/js/WebAssemblyPrototype.cpp: Removed.
3310 * wasm/js/WebAssemblyPrototype.h: Removed.
3311 * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp:
3312 (JSC::WebAssemblyRuntimeErrorConstructor::finishCreation):
3313 * wasm/js/WebAssemblyTableConstructor.cpp:
3314 (JSC::constructJSWebAssemblyTable):
3315 (JSC::WebAssemblyTableConstructor::finishCreation):
3316 * wasm/js/WebAssemblyTablePrototype.cpp:
3318 2019-07-15 Youenn Fablet <youenn@apple.com>
3320 Enable a debug WebRTC mode without any encryption
3321 https://bugs.webkit.org/show_bug.cgi?id=199177
3322 <rdar://problem/52074986>
3324 Reviewed by Eric Carlson.
3326 * inspector/protocol/Page.json:
3328 2019-07-15 Ryan Haddad <ryanhaddad@apple.com>
3330 Unreviewed, attempt to fix production builds after r247403.
3332 * JavaScriptCore.xcodeproj/project.pbxproj:
3334 2019-07-15 Tadeu Zagallo <tzagallo@apple.com>
3336 Concurrent GC should not rely on current phase to determine if it's safe to steal conn
3337 https://bugs.webkit.org/show_bug.cgi?id=199786
3338 <rdar://problem/52505197>
3340 Reviewed by Saam Barati.
3342 In r246507, we fixed a race condition in the concurrent GC where the mutator might steal
3343 the conn from the collector thread while it transitions from the End phase to NotRunning.
3344 However, that fix was not sufficient. In the case that the mutator steals the conn, and the
3345 execution interleaves long enough for the mutator to progress to a different collection phase,
3346 the collector will resume in a phase other than NotRunning, and hence the check added to
3347 NotRunning will not suffice. To fix that, we add a new variable to track whether the collector
3348 thread is running (m_collectorThreadIsRunning) and use it to determine whether it's safe to
3349 steal the conn, rather than relying on m_currentPhase.