1 2019-02-19 Truitt Savell <tsavell@apple.com>
3 Unreviewed, rolling out r241784.
5 Broke all OpenSource builds.
9 "Web Inspector: Improve ES6 Class instances in Heap Snapshot
11 https://bugs.webkit.org/show_bug.cgi?id=172848
12 https://trac.webkit.org/changeset/241784
14 2019-02-19 Joseph Pecoraro <pecoraro@apple.com>
16 Web Inspector: Improve ES6 Class instances in Heap Snapshot instances view
17 https://bugs.webkit.org/show_bug.cgi?id=172848
18 <rdar://problem/25709212>
22 * heap/HeapSnapshotBuilder.h:
23 * heap/HeapSnapshotBuilder.cpp:
24 Update the snapshot version. Change the node's 0 | 1 internal value
25 to be a 32bit bit flag. This is nice in that it is both compatible
26 with the previous snapshot version and the same size. We can use more
29 (JSC::HeapSnapshotBuilder::json):
30 In cases where the classInfo gives us "Object" check for a better
31 class name by checking (o).__proto__.constructor.name. We avoid this
32 check in cases where (o).hasOwnProperty("constructor") which is the
33 case for most Foo.prototype objects. Otherwise this would get the
34 name of the Foo superclass for the Foo.prototype object.
36 * runtime/JSObject.cpp:
37 (JSC::JSObject::calculatedClassName):
38 Handle some possible edge cases that were not handled before, such as
39 a JSObject without a GlobalObject or an object which doesn't
40 have a default getPrototype. Try to make the code a little clearer.
42 2019-02-19 Robin Morisset <rmorisset@apple.com>
44 B3-O2 incorrectly optimizes this subtest
45 https://bugs.webkit.org/show_bug.cgi?id=194625
47 Reviewed by Saam Barati.
49 Trivial fix. Instead of doing
50 if (!cond) foo else bar => if (cond) bar else foo
51 B3LowerToAir was doing
52 if (x^C) foo else bar => if (cond) bar else foo whenever C&1, even if C was for example 3.
54 * b3/B3LowerToAir.cpp:
56 (JSC::B3::testBitNotOnBooleanAndBranch32):
57 (JSC::B3::testNotOnBooleanAndBranch32): Added.
59 2019-02-19 Robin Morisset <rmorisset@apple.com>
61 CachedCall should not consider it UNLIKELY that it will not stack overflow
62 https://bugs.webkit.org/show_bug.cgi?id=194831
66 * interpreter/CachedCall.h:
67 (JSC::CachedCall::CachedCall):
69 2019-02-19 Mark Lam <mark.lam@apple.com>
71 Fix DFG doesGC() for TryGetById and ProfileType nodes.
72 https://bugs.webkit.org/show_bug.cgi?id=194821
73 <rdar://problem/48206690>
75 Reviewed by Saam Barati.
77 Fix doesGC() for the following nodes:
80 calls operationProcessTypeProfilerLogDFG(), which can calculatedClassName(),
81 which can call JSString::tryGetValue(), which can resolve a rope.
84 calls operationTryGetByIdOptimize(), which can startWatchingPropertyForReplacements()
85 on a structure, which can allocate StructureRareData.
90 2019-02-18 Yusuke Suzuki <ysuzuki@apple.com>
92 [JSC] Introduce JSNonDestructibleProxy for JavaScriptCore.framework's GlobalThis
93 https://bugs.webkit.org/show_bug.cgi?id=194799
95 Reviewed by Saam Barati.
97 JSProxy is destructible one because we have JSWindowProxy which has ref counted object.
98 However, JavaScriptCore.framework's JSProxy for GlobalThis does not need to be destructible.
99 This is important since we need to separate Heap subspaces between destructible and non-destructible objects.
100 If we can put more and more objects in non-destructible status, we can get rid of low-usage MarkedBlock.
101 This patch adds JSNonDestructibleProxy, which is not destructible JSProxy. While it inherits JSDestructibleObject,
102 we can make the subclass still non-destructible thanks to Subspace mechanism. This drops one more low-usage MarkedBlock.
105 * JavaScriptCore.xcodeproj/project.pbxproj:
107 * runtime/JSGlobalObject.cpp:
108 (JSC::JSGlobalObject::resetPrototype):
109 (JSC::JSGlobalObject::finishCreation):
110 * runtime/JSNonDestructibleProxy.cpp: Added.
111 * runtime/JSNonDestructibleProxy.h: Added.
112 (JSC::JSNonDestructibleProxy::subspaceFor):
113 (JSC::JSNonDestructibleProxy::create):
114 (JSC::JSNonDestructibleProxy::createStructure):
115 (JSC::JSNonDestructibleProxy::JSNonDestructibleProxy):
117 (JSC::JSProxy::JSProxy):
119 2019-02-19 Robin Morisset <rmorisset@apple.com>
121 B3ReduceStrength::simplifyCFG() could do a lot more on each iteration
122 https://bugs.webkit.org/show_bug.cgi?id=194475
124 Reviewed by Saam Barati.
126 B3ReduceStrength::simplifyCFG() does three optimizations (which I will call A, B and C):
127 - A makes any terminal that points to a block that is empty except for a jump point to that jump's target instead.
128 - B transforms any branch or switch that points to a single block into a jump
129 - C finds blocks ending with jumps, whose successor has a single predecessor, and inline that successor block in place of the jump
131 It currently is limited in the following way:
132 - A and C can only fire once per block per iteration
133 - B can create jumps that would trigger A, but they may not be seen until the next iteration
135 Both problems are mitigated by going through the blocks in post-order, so that when a block is optimized most of its successors have already been optimized.
136 In a sense it is the symmetric of the peephole optimizer that goes in pre-order so that when an instruction is optimized most of its children have already been optimized.
138 On JetStream2 it reduces the average number of iterations from 3.35 to 3.24.
140 * b3/B3ReduceStrength.cpp:
142 2019-02-19 Tadeu Zagallo <tzagallo@apple.com>
144 Move bytecode cache-related filesystem code out of CodeCache
145 https://bugs.webkit.org/show_bug.cgi?id=194675
147 Reviewed by Saam Barati.
149 The code is only used for the bytecode-cache tests, so it should live in
150 jsc.cpp rather than in the CodeCache. The logic now lives in ShellSourceProvider,
151 which overrides the a virtual method in SourceProvider, `cacheBytecode`,
152 in order to write the cache to disk.
155 (ShellSourceProvider::create):
156 (ShellSourceProvider::~ShellSourceProvider):
157 (ShellSourceProvider::cachePath const):
158 (ShellSourceProvider::loadBytecode):
159 (ShellSourceProvider::ShellSourceProvider):
161 (GlobalObject::moduleLoaderFetch):
162 (functionDollarEvalScript):
164 * parser/SourceProvider.h:
165 (JSC::SourceProvider::cacheBytecode const):
166 * runtime/CodeCache.cpp:
167 (JSC::writeCodeBlock):
168 * runtime/CodeCache.h:
169 (JSC::CodeCacheMap::fetchFromDiskImpl):
171 2019-02-18 Dominik Infuehr <dinfuehr@igalia.com>
173 [ARM] Fix crash with sampling profiler
174 https://bugs.webkit.org/show_bug.cgi?id=194772
176 Reviewed by Mark Lam.
178 sampling-profiler-richards.js was crashing with an enabled sampling profiler. add32
179 did not update the stack pointer in a single instruction. The src register was first
180 moved into the stack pointer, the immediate imm was added in a subsequent instruction.
182 This was problematic when a signal handler was invoked before applying the immediate,
183 when the stack pointer is still set to the temporary value. Avoid this by calculating src+imm in
184 a temporary register and then move it in one go into the stack pointer.
186 * assembler/MacroAssemblerARMv7.h:
187 (JSC::MacroAssemblerARMv7::add32):
189 2019-02-18 Mark Lam <mark.lam@apple.com>
191 Fix DFG doesGC() for CompareEq/Less/LessEq/Greater/GreaterEq and CompareStrictEq nodes.
192 https://bugs.webkit.org/show_bug.cgi?id=194800
193 <rdar://problem/48183773>
195 Reviewed by Yusuke Suzuki.
197 Fix doesGC() for the following nodes:
205 Only return false (i.e. does not GC) for child node use kinds that have
206 been vetted to not do anything that can GC. For all other use kinds
207 (including StringUse and BigIntUse), we return true (i.e. does GC).
212 2019-02-16 Darin Adler <darin@apple.com>
214 Continue reducing use of String::format, now focusing on hex: "%p", "%x", etc.
215 https://bugs.webkit.org/show_bug.cgi?id=194752
217 Reviewed by Daniel Bates.
219 * heap/HeapSnapshotBuilder.cpp:
220 (JSC::HeapSnapshotBuilder::json): Added back the "0x" that was removed when changing
221 this file to use appendUnsignedAsHex instead of "%p". The intent at that time was to
222 keep behavior the same, so let's do that.
225 (JSC::Lexer<T>::invalidCharacterMessage const): Use makeString and hex instead of
226 String::format and "%04x".
228 2019-02-18 Yusuke Suzuki <ysuzuki@apple.com>
230 [JSC] Add LazyClassStructure::getInitializedOnMainThread
231 https://bugs.webkit.org/show_bug.cgi?id=194784
232 <rdar://problem/48154820>
234 Reviewed by Mark Lam.
236 LazyClassStructure::get and LazyProperty::get functions do not allow compiler threads to call them. But for booleanPrototype, numberPrototype and symbolPrototype cases,
237 we would like to call them from compiler threads. We eagerly initialize them if VM::canUseJIT() is true, so that compiler threads can safely call LazyClassStructure::get
238 and LazyProperty::get for booleanPrototype, numberPrototype and symbolPrototype. But still assertion hits because the assertion requires that these functions need to be
239 called in non compiler threads. Calling `getConcurrently()` is not possible since symbolPrototype() function is called from both the main thread and compiler threads,
240 and we would like to lazily initialize SymbolPrototype object if it is called from the main thread, which can happen with non-JIT configuration.
242 This patch adds `getInitializedOnMainThread()`. Compiler threads can call it only when we know that the value is already initialized on the main thread. The main thread
243 can call it at anytime and this function lazily initializes the value. This is useful to make some of prototypes lazy with non-JIT configuration: With non-JIT configuration,
244 this function is always called from the main thread and it initializes the value lazily. Non-JIT configuration does not care about compiler threads since they do not exist.
245 With JIT configuration, we eagerly initialize them in JSGlobalObject::init so that `getInitializedOnMainThread()` always succeeds.
247 Basically, `getInitializedOnMainThread()` is `get` with different assertion location: While `get` always crashes if it is called from compiler threads, `getInitializedOnMainThread()`
248 crashes only when actual initialization happens on compiler threads. We do not merge them since `get` is still useful to find accidental initialization from compiler threads.
250 * runtime/JSGlobalObject.h:
251 (JSC::JSGlobalObject::booleanPrototype const):
252 (JSC::JSGlobalObject::numberPrototype const):
253 (JSC::JSGlobalObject::symbolPrototype const):
254 * runtime/LazyClassStructure.h:
255 (JSC::LazyClassStructure::getInitializedOnMainThread const):
256 (JSC::LazyClassStructure::prototypeInitializedOnMainThread const):
257 (JSC::LazyClassStructure::constructorInitializedOnMainThread const):
258 * runtime/LazyProperty.h:
259 (JSC::LazyProperty::get const):
260 (JSC::LazyProperty::getInitializedOnMainThread const):
262 2019-02-18 Joseph Pecoraro <pecoraro@apple.com>
264 Web Inspector: Better categorize CPU usage per-thread / worker
265 https://bugs.webkit.org/show_bug.cgi?id=194564
267 Reviewed by Devin Rousso.
269 * inspector/protocol/CPUProfiler.json:
270 Add additional properties per-Event, and new per-Thread object info.
272 2019-02-18 Tadeu Zagallo <tzagallo@apple.com>
274 Bytecode cache should a have a boot-specific validation
275 https://bugs.webkit.org/show_bug.cgi?id=194769
276 <rdar://problem/48149509>
278 Reviewed by Keith Miller.
280 Add the boot UUID to the cached bytecode to enforce that it is not reused
283 * runtime/CachedTypes.cpp:
284 (JSC::Encoder::malloc):
285 (JSC::GenericCacheEntry::GenericCacheEntry):
286 (JSC::GenericCacheEntry::tag const):
287 (JSC::CacheEntry::CacheEntry):
288 (JSC::CacheEntry::decode const):
289 (JSC::GenericCacheEntry::decode const):
290 (JSC::encodeCodeBlock):
292 2019-02-18 Eric Carlson <eric.carlson@apple.com>
294 Add MSE logging configuration
295 https://bugs.webkit.org/show_bug.cgi?id=194719
296 <rdar://problem/48122151>
298 Reviewed by Joseph Pecoraro.
300 * inspector/ConsoleMessage.cpp:
301 (Inspector::messageSourceValue):
302 * inspector/protocol/Console.json:
303 * inspector/scripts/codegen/generator.py:
304 * runtime/ConsoleTypes.h:
306 2019-02-18 Tadeu Zagallo <tzagallo@apple.com>
308 Add version number to cached bytecode
309 https://bugs.webkit.org/show_bug.cgi?id=194768
310 <rdar://problem/48147968>
312 Reviewed by Saam Barati.
314 Add a version number to the bytecode cache that should be unique per build.
317 * DerivedSources-output.xcfilelist:
318 * DerivedSources.make:
319 * runtime/CachedTypes.cpp:
320 (JSC::Encoder::malloc):
321 (JSC::GenericCacheEntry::GenericCacheEntry):
322 (JSC::CacheEntry::CacheEntry):
323 (JSC::CacheEntry::encode):
324 (JSC::CacheEntry::decode const):
325 (JSC::GenericCacheEntry::decode const):
326 (JSC::decodeCodeBlockImpl):
327 * runtime/CodeCache.h:
328 (JSC::CodeCacheMap::fetchFromDiskImpl):
330 2019-02-17 Saam Barati <sbarati@apple.com>
332 WasmB3IRGenerator models some effects incorrectly
333 https://bugs.webkit.org/show_bug.cgi?id=194038
335 Reviewed by Keith Miller.
337 * wasm/WasmB3IRGenerator.cpp:
338 (JSC::Wasm::B3IRGenerator::restoreWasmContextInstance):
339 (JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState):
340 These two functions were using global state instead of the
341 arguments passed into the function.
343 (JSC::Wasm::B3IRGenerator::addOp<F64ConvertUI64>):
344 (JSC::Wasm::B3IRGenerator::addOp<OpType::F32ConvertUI64>):
345 (JSC::Wasm::B3IRGenerator::addOp<OpType::I64TruncUF64>):
346 (JSC::Wasm::B3IRGenerator::addOp<OpType::I64TruncUF32>):
347 Any patchpoint that allows scratch register usage must
348 also say that it clobbers the scratch registers.
350 2019-02-17 Saam Barati <sbarati@apple.com>
352 Deadlock when adding a Structure property transition and then doing incremental marking
353 https://bugs.webkit.org/show_bug.cgi?id=194767
355 Reviewed by Mark Lam.
357 This can happen in the following scenario:
359 You have a Structure S. S is on the mark stack. Then:
361 2. S adds a new property transition
362 3. We find out we need to do some incremental marking
364 5. visitChildren on S will try to grab its lock
365 6. We are now in a deadlock
368 (JSC::Heap::performIncrement):
369 * runtime/Structure.cpp:
370 (JSC::Structure::addNewPropertyTransition):
372 2019-02-17 David Kilzer <ddkilzer@apple.com>
374 Unreviewed, rolling out r241620.
376 "Causes use-after-free crashes running layout tests with ASan and GuardMalloc."
377 (Requested by ddkilzer on #webkit.)
381 "[WTF] Add environment variable helpers"
382 https://bugs.webkit.org/show_bug.cgi?id=192405
383 https://trac.webkit.org/changeset/241620
385 2019-02-17 Commit Queue <commit-queue@webkit.org>
387 Unreviewed, rolling out r241612.
388 https://bugs.webkit.org/show_bug.cgi?id=194762
390 "It regressed JetStream2 parsing tests by ~40%" (Requested by
391 saamyjoon on #webkit).
395 "Move bytecode cache-related filesystem code out of CodeCache"
396 https://bugs.webkit.org/show_bug.cgi?id=194675
397 https://trac.webkit.org/changeset/241612
399 2019-02-16 Yusuke Suzuki <ysuzuki@apple.com>
401 [JSC] JSWrapperObject should not be destructible
402 https://bugs.webkit.org/show_bug.cgi?id=194743
404 Reviewed by Saam Barati.
406 JSWrapperObject should be just a wrapper object for JSValue, thus, it should not be a JSDestructibleObject.
407 Currently it is destructible object because DateInstance uses it. This patch changes Base of DateInstance from
408 JSWrapperObject to JSDestructibleObject, and makes JSWrapperObject non-destructible.
410 * runtime/BigIntObject.cpp:
411 (JSC::BigIntObject::BigIntObject):
412 * runtime/BooleanConstructor.cpp:
413 (JSC::BooleanConstructor::finishCreation):
414 * runtime/BooleanObject.cpp:
415 (JSC::BooleanObject::BooleanObject):
416 * runtime/BooleanObject.h:
417 * runtime/DateInstance.cpp:
418 (JSC::DateInstance::DateInstance):
419 (JSC::DateInstance::finishCreation):
420 * runtime/DateInstance.h:
421 * runtime/DatePrototype.cpp:
422 (JSC::dateProtoFuncGetTime):
423 (JSC::dateProtoFuncSetTime):
424 (JSC::setNewValueFromTimeArgs):
425 (JSC::setNewValueFromDateArgs):
426 (JSC::dateProtoFuncSetYear):
427 * runtime/JSCPoison.h:
428 * runtime/JSWrapperObject.h:
429 (JSC::JSWrapperObject::JSWrapperObject):
430 * runtime/NumberObject.cpp:
431 (JSC::NumberObject::NumberObject):
432 * runtime/NumberObject.h:
433 * runtime/StringConstructor.cpp:
434 (JSC::StringConstructor::finishCreation):
435 * runtime/StringObject.cpp:
436 (JSC::StringObject::StringObject):
437 * runtime/StringObject.h:
438 (JSC::StringObject::internalValue const):
439 * runtime/SymbolObject.cpp:
440 (JSC::SymbolObject::SymbolObject):
441 * runtime/SymbolObject.h:
443 2019-02-16 Yusuke Suzuki <ysuzuki@apple.com>
445 [JSC] Shrink UnlinkedFunctionExecutable
446 https://bugs.webkit.org/show_bug.cgi?id=194733
448 Reviewed by Mark Lam.
450 UnlinkedFunctionExecutable has sourceURLDirective and sourceMappingURLDirective. These
451 directives can be found in the comment of non typical function's source code (Program,
452 Eval code, and Global function from function constructor etc.), and tricky thing is that
453 SourceProvider's directives are updated by Parser. The reason why we have these fields in
454 UnlinkedFunctionExecutable is that we need to update the SourceProvider's directives even
455 if we skip parsing by using CodeCache. These fields are effective only if (1)
456 UnlinkedFunctionExecutable is for non typical function things, and (2) it has sourceURLDirective
457 or sourceMappingURLDirective. This is rare enough to purge them to a separated
458 UnlinkedFunctionExecutable::RareData to make UnlinkedFunctionExecutable small.
459 sizeof(UnlinkedFunctionExecutable) is very important since it is super frequently allocated
460 cell. Furthermore, the current JSC allocates two MarkedBlocks for UnlinkedFunctionExecutable
461 in JSGlobalObject initialization, but the usage of the second MarkedBlock is quite low (8%).
462 If we can reduce the size of UnlinkedFunctionExecutable, we can make them one MarkedBlock.
463 Since UnlinkedFunctionExecutable is allocated from IsoSubspace, we do not need to fit it to
466 This patch adds RareData to UnlinkedFunctionExecutable and move some rare datas into RareData.
467 And kill one MarkedBlock allocation in JSC initialization phase.
469 * bytecode/UnlinkedFunctionExecutable.cpp:
470 (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
471 (JSC::UnlinkedFunctionExecutable::ensureRareDataSlow):
472 * bytecode/UnlinkedFunctionExecutable.h:
473 * debugger/DebuggerLocation.cpp:
474 (JSC::DebuggerLocation::DebuggerLocation):
475 * inspector/ScriptDebugServer.cpp:
476 (Inspector::ScriptDebugServer::dispatchDidParseSource):
478 (JSC::Lexer::sourceURLDirective const):
479 (JSC::Lexer::sourceMappingURLDirective const):
480 (JSC::Lexer::sourceURL const): Deleted.
481 (JSC::Lexer::sourceMappingURL const): Deleted.
483 (JSC::Parser<LexerType>::parse):
484 * parser/SourceProvider.h:
485 (JSC::SourceProvider::sourceURLDirective const):
486 (JSC::SourceProvider::sourceMappingURLDirective const):
487 (JSC::SourceProvider::setSourceURLDirective):
488 (JSC::SourceProvider::setSourceMappingURLDirective):
489 (JSC::SourceProvider::sourceURL const): Deleted. We rename it from sourceURL to sourceURLDirective
490 since it is the correct name.
491 (JSC::SourceProvider::sourceMappingURL const): Deleted. We rename it from sourceMappingURL to
492 sourceMappingURLDirective since it is the correct name.
493 * runtime/CachedTypes.cpp:
494 (JSC::CachedSourceProviderShape::encode):
495 (JSC::CachedFunctionExecutableRareData::encode):
496 (JSC::CachedFunctionExecutableRareData::decode const): CachedFunctionExecutable did not have
497 sourceMappingURL to sourceMappingURLDirective. So this patch keeps the same logic.
498 (JSC::CachedFunctionExecutable::rareData const):
499 (JSC::CachedFunctionExecutable::encode):
500 (JSC::CachedFunctionExecutable::decode const):
501 (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
502 * runtime/CodeCache.cpp:
503 (JSC::CodeCache::getUnlinkedGlobalCodeBlock):
504 (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable):
505 * runtime/CodeCache.h:
506 (JSC::generateUnlinkedCodeBlockImpl):
507 * runtime/FunctionExecutable.h:
508 * runtime/SamplingProfiler.cpp:
509 (JSC::SamplingProfiler::StackFrame::url):
511 2019-02-15 Yusuke Suzuki <ysuzuki@apple.com>
513 [JSC] Remove unused global private variables
514 https://bugs.webkit.org/show_bug.cgi?id=194741
516 Reviewed by Joseph Pecoraro.
518 There are some private functions and constants that are no longer referenced from builtin JS code.
519 This patch cleans up them.
521 * builtins/BuiltinNames.h:
522 * builtins/ObjectConstructor.js:
524 * runtime/JSGlobalObject.cpp:
525 (JSC::JSGlobalObject::init):
527 2019-02-15 Yusuke Suzuki <ysuzuki@apple.com>
529 [JSC] Lazily create empty RegExp
530 https://bugs.webkit.org/show_bug.cgi?id=194735
532 Reviewed by Keith Miller.
534 Some scripts do not have any RegExp. In that case, allocating MarkedBlock for RegExp is costly.
535 Previously, there was always one RegExp, "empty RegExp". This patch lazily creates it and drop
538 * runtime/JSGlobalObject.cpp:
539 (JSC::JSGlobalObject::init):
540 * runtime/RegExpCache.cpp:
541 (JSC::RegExpCache::ensureEmptyRegExpSlow):
542 (JSC::RegExpCache::initialize): Deleted.
543 * runtime/RegExpCache.h:
544 (JSC::RegExpCache::ensureEmptyRegExp):
545 (JSC::RegExpCache::emptyRegExp const): Deleted.
546 * runtime/RegExpCachedResult.cpp:
547 (JSC::RegExpCachedResult::lastResult):
548 * runtime/RegExpCachedResult.h:
552 2019-02-15 Yusuke Suzuki <ysuzuki@apple.com>
554 [JSC] Make builtin objects more lazily initialized under non-JIT mode
555 https://bugs.webkit.org/show_bug.cgi?id=194727
557 Reviewed by Saam Barati.
559 Boolean, Symbol, and Number constructors and prototypes are initialized eagerly, but this is largely
560 because concurrent compiler can touch NumberPrototype etc. when traversing object's prototypes. This
561 means that eager initialization is not necessary under non-JIT mode. While we can investigate all the
562 accesses to these prototypes from the concurrent compiler threads, this "lazily initialize under non-JIT"
563 is safe and beneficial to non-JIT mode. This patch lazily initializes them under non-JIT mode, and
564 drop some @Number references to avoid eager initialization. This removes some object allocations and 1
565 MarkedBlock allocation just for Symbols.
567 * runtime/JSGlobalObject.cpp:
568 (JSC::JSGlobalObject::init):
569 (JSC::JSGlobalObject::visitChildren):
570 * runtime/JSGlobalObject.h:
571 (JSC::JSGlobalObject::numberToStringWatchpoint):
572 (JSC::JSGlobalObject::booleanPrototype const):
573 (JSC::JSGlobalObject::numberPrototype const):
574 (JSC::JSGlobalObject::symbolPrototype const):
575 (JSC::JSGlobalObject::booleanObjectStructure const):
576 (JSC::JSGlobalObject::symbolObjectStructure const):
577 (JSC::JSGlobalObject::numberObjectStructure const):
578 (JSC::JSGlobalObject::stringObjectStructure const):
580 2019-02-15 Michael Saboff <msaboff@apple.com>
582 RELEASE_ASSERT at com.apple.JavaScriptCore: JSC::jsSubstringOfResolved
583 https://bugs.webkit.org/show_bug.cgi?id=194558
585 Reviewed by Saam Barati.
587 Added an in bounds check before the read of the next character for Unicode regular expressions
588 for pattern generation that didn't already have such checks.
591 (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce):
592 (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed):
593 (JSC::Yarr::YarrGenerator::generateCharacterClassOnce):
594 (JSC::Yarr::YarrGenerator::generateCharacterClassFixed):
596 2019-02-15 Dean Jackson <dino@apple.com>
598 Allow emulation of user gestures from Web Inspector console
599 https://bugs.webkit.org/show_bug.cgi?id=194725
600 <rdar://problem/48126604>
602 Reviewed by Joseph Pecoraro and Devin Rousso.
604 * inspector/agents/InspectorRuntimeAgent.cpp: Add a new optional parameter, emulateUserGesture,
605 to the evaluate function, and mark the function as override so that PageRuntimeAgent
606 can change the behaviour.
607 (Inspector::InspectorRuntimeAgent::evaluate):
608 * inspector/agents/InspectorRuntimeAgent.h:
609 * inspector/protocol/Runtime.json:
611 2019-02-15 Yusuke Suzuki <ysuzuki@apple.com>
613 [JSC] Do not initialize Wasm related data if Wasm is not enabled
614 https://bugs.webkit.org/show_bug.cgi?id=194728
616 Reviewed by Mark Lam.
618 Under non-JIT mode, these data structures are unnecessary. Should not allocate extra memory for that.
620 * runtime/InitializeThreading.cpp:
621 (JSC::initializeThreading):
622 * runtime/JSLock.cpp:
623 (JSC::JSLock::didAcquireLock):
625 2019-02-15 Ross Kirsling <ross.kirsling@sony.com>
627 [WTF] Add environment variable helpers
628 https://bugs.webkit.org/show_bug.cgi?id=192405
630 Reviewed by Michael Catanzaro.
632 * inspector/remote/glib/RemoteInspectorGlib.cpp:
633 (Inspector::RemoteInspector::RemoteInspector):
634 (Inspector::RemoteInspector::start):
636 (startTimeoutThreadIfNeeded):
637 * runtime/Options.cpp:
638 (JSC::overrideOptionWithHeuristic):
639 (JSC::Options::overrideAliasedOptionWithHeuristic):
640 (JSC::Options::initialize):
642 (JSC::enableAssembler):
644 * tools/CodeProfiling.cpp:
645 (JSC::CodeProfiling::notifyAllocator):
646 Utilize WTF::Environment where possible.
648 2019-02-15 Mark Lam <mark.lam@apple.com>
650 SamplingProfiler::stackTracesAsJSON() should escape strings.
651 https://bugs.webkit.org/show_bug.cgi?id=194649
652 <rdar://problem/48072386>
654 Reviewed by Saam Barati.
656 Ditto for TypeSet::toJSONString() and TypeSet::toJSONString().
658 * runtime/SamplingProfiler.cpp:
659 (JSC::SamplingProfiler::stackTracesAsJSON):
660 * runtime/TypeSet.cpp:
661 (JSC::TypeSet::toJSONString const):
662 (JSC::StructureShape::toJSONString const):
664 2019-02-15 Robin Morisset <rmorisset@apple.com>
666 CodeBlock::jettison should clear related watchpoints
667 https://bugs.webkit.org/show_bug.cgi?id=194544
669 Reviewed by Mark Lam.
671 * bytecode/CodeBlock.cpp:
672 (JSC::CodeBlock::jettison):
673 * dfg/DFGCommonData.h:
674 (JSC::DFG::CommonData::clearWatchpoints): Added.
675 * dfg/CommonData.cpp:
676 (JSC::DFG::CommonData::clearWatchpoints): Added.
678 2019-02-15 Tadeu Zagallo <tzagallo@apple.com>
680 Move bytecode cache-related filesystem code out of CodeCache
681 https://bugs.webkit.org/show_bug.cgi?id=194675
683 Reviewed by Saam Barati.
685 That code is only used for the bytecode-cache tests, so it should live in
686 jsc.cpp rather than in the CodeCache.
689 (CliSourceProvider::create):
690 (CliSourceProvider::~CliSourceProvider):
691 (CliSourceProvider::cachePath const):
692 (CliSourceProvider::loadBytecode):
693 (CliSourceProvider::CliSourceProvider):
695 (GlobalObject::moduleLoaderFetch):
696 (functionDollarEvalScript):
698 * parser/SourceProvider.h:
699 (JSC::SourceProvider::cacheBytecode const):
700 * runtime/CodeCache.cpp:
701 (JSC::writeCodeBlock):
702 * runtime/CodeCache.h:
703 (JSC::CodeCacheMap::fetchFromDiskImpl):
705 2019-02-15 Yusuke Suzuki <ysuzuki@apple.com>
707 [JSC] DFG, FTL, and Wasm worklist creation should be fenced
708 https://bugs.webkit.org/show_bug.cgi?id=194714
710 Reviewed by Mark Lam.
712 Let's consider about the following extreme case.
714 1. VM (A) is created.
715 2. Another VM (B) is created on a different thread.
716 3. (A) is being destroyed. It calls DFG::existingWorklistForIndexOrNull in a destructor.
717 4. At the same time, (B) starts using DFG Worklist and it is instantiated in call_once.
718 5. But (A) reads the pointer directly through DFG::existingWorklistForIndexOrNull.
719 6. (A) sees the half-baked worklist, which may be in the middle of creation.
721 This patch puts store-store fence just before putting a pointer to a global variable.
722 This fence is executed only three times at most, for DFG, FTL, and Wasm worklist initializations.
724 * dfg/DFGWorklist.cpp:
725 (JSC::DFG::ensureGlobalDFGWorklist):
726 (JSC::DFG::ensureGlobalFTLWorklist):
727 * wasm/WasmWorklist.cpp:
728 (JSC::Wasm::ensureWorklist):
730 2019-02-15 Commit Queue <commit-queue@webkit.org>
732 Unreviewed, rolling out r241559 and r241566.
733 https://bugs.webkit.org/show_bug.cgi?id=194710
735 Causes layout test crashes under GuardMalloc (Requested by
736 ryanhaddad on #webkit).
740 "[WTF] Add environment variable helpers"
741 https://bugs.webkit.org/show_bug.cgi?id=192405
742 https://trac.webkit.org/changeset/241559
744 "Unreviewed build fix for WinCairo Debug after r241559."
745 https://trac.webkit.org/changeset/241566
747 2019-02-15 Yusuke Suzuki <ysuzuki@apple.com>
749 [JSC] Do not even allocate JIT worklists in non-JIT mode
750 https://bugs.webkit.org/show_bug.cgi?id=194693
752 Reviewed by Mark Lam.
754 Heap always allocates JIT worklists for Baseline, DFG, and FTL. While they do not have actual threads, Worklist itself already allocates some memory.
755 And we do not perform any GC operations that are only meaningful in JIT environment.
757 1. We add VM::canUseJIT() check in Heap's ensureXXXWorklist things to prevent them from being allocated.
758 2. We remove DFG marking constraint in non-JIT mode.
759 3. We do not gather conservative roots from scratch buffers under the non-JIT mode (BTW, # of scratch buffers are always zero in non-JIT mode)
760 4. We do not visit JITStubRoutineSet.
761 5. Align JITWorklist function names to the other worklists.
763 * dfg/DFGOSRExitPreparation.cpp:
764 (JSC::DFG::prepareCodeOriginForOSRExit):
766 * dfg/DFGWorklist.cpp:
767 (JSC::DFG::markCodeBlocks): Deleted.
770 (JSC::Heap::completeAllJITPlans):
771 (JSC::Heap::iterateExecutingAndCompilingCodeBlocks):
772 (JSC::Heap::gatherScratchBufferRoots):
773 (JSC::Heap::removeDeadCompilerWorklistEntries):
774 (JSC::Heap::stopThePeriphery):
775 (JSC::Heap::suspendCompilerThreads):
776 (JSC::Heap::resumeCompilerThreads):
777 (JSC::Heap::addCoreConstraints):
778 * jit/JITWorklist.cpp:
779 (JSC::JITWorklist::existingGlobalWorklistOrNull):
780 (JSC::JITWorklist::ensureGlobalWorklist):
781 (JSC::JITWorklist::instance): Deleted.
783 * llint/LLIntSlowPaths.cpp:
784 (JSC::LLInt::jitCompileAndSetHeuristics):
787 (JSC::VM::gatherScratchBufferRoots):
788 (JSC::VM::gatherConservativeRoots): Deleted.
791 2019-02-15 Saam barati <sbarati@apple.com>
793 [WebAssembly] Write a new register allocator for Air O0 and make BBQ use it
794 https://bugs.webkit.org/show_bug.cgi?id=194036
796 Reviewed by Yusuke Suzuki.
798 This patch adds a new Air-O0 backend. Air-O0 runs fewer passes and doesn't
799 use linear scan for register allocation. Instead of linear scan, Air-O0 does
800 mostly block-local register allocation, and it does this as it's emitting
801 code directly. The register allocator uses liveness analysis to reduce
802 the number of spills. Doing register allocation as we're emitting code
803 allows us to skip editing the IR to insert spills, which saves a non trivial
804 amount of compile time. For stack allocation, we give each Tmp its own slot.
805 This is less than ideal. We probably want to do some trivial live range analysis
806 in the future. The reason this isn't a deal breaker for Wasm is that this patch
807 makes it so that we reuse Tmps as we're generating Air IR in the AirIRGenerator.
808 Because Wasm is a stack machine, we trivially know when we kill a stack value (its last use).
810 This patch is another 25% Wasm startup time speedup. It seems to be worth
811 another 1% on JetStream2.
813 * JavaScriptCore.xcodeproj/project.pbxproj:
815 * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp: Added.
816 (JSC::B3::Air::GenerateAndAllocateRegisters::GenerateAndAllocateRegisters):
817 (JSC::B3::Air::GenerateAndAllocateRegisters::buildLiveRanges):
818 (JSC::B3::Air::GenerateAndAllocateRegisters::insertBlocksForFlushAfterTerminalPatchpoints):
819 (JSC::B3::Air::callFrameAddr):
820 (JSC::B3::Air::GenerateAndAllocateRegisters::flush):
821 (JSC::B3::Air::GenerateAndAllocateRegisters::spill):
822 (JSC::B3::Air::GenerateAndAllocateRegisters::alloc):
823 (JSC::B3::Air::GenerateAndAllocateRegisters::freeDeadTmpsIfNeeded):
824 (JSC::B3::Air::GenerateAndAllocateRegisters::assignTmp):
825 (JSC::B3::Air::GenerateAndAllocateRegisters::isDisallowedRegister):
826 (JSC::B3::Air::GenerateAndAllocateRegisters::prepareForGeneration):
827 (JSC::B3::Air::GenerateAndAllocateRegisters::generate):
828 * b3/air/AirAllocateRegistersAndStackAndGenerateCode.h: Added.
829 * b3/air/AirCode.cpp:
831 * b3/air/AirGenerate.cpp:
832 (JSC::B3::Air::prepareForGeneration):
833 (JSC::B3::Air::generateWithAlreadyAllocatedRegisters):
834 (JSC::B3::Air::generate):
835 * b3/air/AirHandleCalleeSaves.cpp:
836 (JSC::B3::Air::handleCalleeSaves):
837 * b3/air/AirHandleCalleeSaves.h:
838 * b3/air/AirTmpMap.h:
840 * wasm/WasmAirIRGenerator.cpp:
841 (JSC::Wasm::AirIRGenerator::didKill):
842 (JSC::Wasm::AirIRGenerator::newTmp):
843 (JSC::Wasm::AirIRGenerator::AirIRGenerator):
844 (JSC::Wasm::parseAndCompileAir):
845 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncUF64>):
846 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncUF32>):
847 * wasm/WasmAirIRGenerator.h:
848 * wasm/WasmB3IRGenerator.cpp:
849 (JSC::Wasm::B3IRGenerator::didKill):
850 * wasm/WasmBBQPlan.cpp:
851 (JSC::Wasm::BBQPlan::compileFunctions):
852 * wasm/WasmFunctionParser.h:
853 (JSC::Wasm::FunctionParser<Context>::parseBody):
854 (JSC::Wasm::FunctionParser<Context>::parseExpression):
855 * wasm/WasmValidate.cpp:
856 (JSC::Wasm::Validate::didKill):
858 2019-02-14 Saam barati <sbarati@apple.com>
860 lowerStackArgs should lower Lea32/64 on ARM64 to Add
861 https://bugs.webkit.org/show_bug.cgi?id=194656
863 Reviewed by Yusuke Suzuki.
865 On arm64, Lea is just implemented as an add. However, Air treats it as an
866 address with a given width. Because of this width, we were incorrectly
867 computing whether or not this immediate could fit into the instruction itself
868 or it needed to be explicitly put into a register. This patch makes
869 AirLowerStackArgs lower Lea to Add on arm64.
871 * b3/air/AirLowerStackArgs.cpp:
872 (JSC::B3::Air::lowerStackArgs):
873 * b3/air/AirOpcode.opcodes:
874 * b3/air/testair.cpp:
876 2019-02-14 Saam Barati <sbarati@apple.com>
878 Cache the results of BytecodeGenerator::getVariablesUnderTDZ
879 https://bugs.webkit.org/show_bug.cgi?id=194583
880 <rdar://problem/48028140>
882 Reviewed by Yusuke Suzuki.
884 This patch makes it so that getVariablesUnderTDZ caches a result of
885 CompactVariableMap::Handle. getVariablesUnderTDZ is costly when
886 it's called in an environment where there are a lot of variables.
887 This patch makes it so we cache its results. This is profitable when
888 getVariablesUnderTDZ is called repeatedly with the same environment
889 state. This is common since we call this every time we encounter a
890 function definition/expression node.
892 * builtins/BuiltinExecutables.cpp:
893 (JSC::BuiltinExecutables::createExecutable):
894 * bytecode/UnlinkedFunctionExecutable.cpp:
895 (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
896 * bytecode/UnlinkedFunctionExecutable.h:
897 * bytecompiler/BytecodeGenerator.cpp:
898 (JSC::BytecodeGenerator::popLexicalScopeInternal):
899 (JSC::BytecodeGenerator::liftTDZCheckIfPossible):
900 (JSC::BytecodeGenerator::pushTDZVariables):
901 (JSC::BytecodeGenerator::getVariablesUnderTDZ):
902 (JSC::BytecodeGenerator::restoreTDZStack):
903 * bytecompiler/BytecodeGenerator.h:
904 (JSC::BytecodeGenerator::makeFunction):
905 * parser/VariableEnvironment.cpp:
906 (JSC::CompactVariableMap::Handle::Handle):
907 (JSC::CompactVariableMap::Handle::operator=):
908 * parser/VariableEnvironment.h:
909 (JSC::CompactVariableMap::Handle::operator bool const):
910 * runtime/CodeCache.cpp:
911 (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable):
913 2019-02-14 Yusuke Suzuki <ysuzuki@apple.com>
915 [JSC] Non-JIT entrypoints should share NativeJITCode per entrypoint type
916 https://bugs.webkit.org/show_bug.cgi?id=194659
918 Reviewed by Mark Lam.
920 Non-JIT entrypoints create NativeJITCode every time it is called. But it is meaningless since these entry point code are identical.
921 We should create one per entrypoint type (for function, we should have CodeForCall and CodeForConstruct) and continue to use them.
922 And we use NativeJITCode instead of DirectJITCode if it does not have difference between usual entrypoint and arity check entrypoint.
925 * dfg/DFGJITFinalizer.cpp:
926 (JSC::DFG::JITFinalizer::finalize):
927 (JSC::DFG::JITFinalizer::finalizeFunction):
929 (JSC::DirectJITCode::initializeCodeRefForDFG):
930 (JSC::DirectJITCode::initializeCodeRef): Deleted.
931 (JSC::NativeJITCode::initializeCodeRef): Deleted.
933 * llint/LLIntEntrypoint.cpp:
934 (JSC::LLInt::setFunctionEntrypoint):
935 (JSC::LLInt::setEvalEntrypoint):
936 (JSC::LLInt::setProgramEntrypoint):
937 (JSC::LLInt::setModuleProgramEntrypoint): Retagged is removed since the tag is the same.
939 2019-02-14 Ross Kirsling <ross.kirsling@sony.com>
941 [WTF] Add environment variable helpers
942 https://bugs.webkit.org/show_bug.cgi?id=192405
944 Reviewed by Michael Catanzaro.
946 * inspector/remote/glib/RemoteInspectorGlib.cpp:
947 (Inspector::RemoteInspector::RemoteInspector):
948 (Inspector::RemoteInspector::start):
950 (startTimeoutThreadIfNeeded):
951 * runtime/Options.cpp:
952 (JSC::overrideOptionWithHeuristic):
953 (JSC::Options::overrideAliasedOptionWithHeuristic):
954 (JSC::Options::initialize):
956 (JSC::enableAssembler):
958 * tools/CodeProfiling.cpp:
959 (JSC::CodeProfiling::notifyAllocator):
960 Utilize WTF::Environment where possible.
962 2019-02-14 Yusuke Suzuki <ysuzuki@apple.com>
964 [JSC] Should have default NativeJITCode
965 https://bugs.webkit.org/show_bug.cgi?id=194634
967 Reviewed by Mark Lam.
969 In JSC_useJIT=false mode, we always create identical NativeJITCode for call and construct when we create NativeExecutable.
970 This is meaningless since we do not modify NativeJITCode after the creation. This patch adds singleton used as a default one.
971 Since NativeJITCode (& JITCode) is ThreadSafeRefCounted, we can just share it in a whole process level. This removes 446 NativeJITCode
972 allocations, which takes 14KB.
975 (JSC::jitCodeForCallTrampoline):
976 (JSC::jitCodeForConstructTrampoline):
977 (JSC::VM::getHostFunction):
979 2019-02-14 Tadeu Zagallo <tzagallo@apple.com>
981 generateUnlinkedCodeBlockForFunctions shouldn't need to create a FunctionExecutable just to get its source code
982 https://bugs.webkit.org/show_bug.cgi?id=194576
984 Reviewed by Saam Barati.
986 Extract a new function, `linkedSourceCode` from UnlinkedFunctionExecutable::link
987 and use it in `generateUnlinkedCodeBlockForFunctions` instead.
989 * bytecode/UnlinkedFunctionExecutable.cpp:
990 (JSC::UnlinkedFunctionExecutable::linkedSourceCode const):
991 (JSC::UnlinkedFunctionExecutable::link):
992 * bytecode/UnlinkedFunctionExecutable.h:
993 * runtime/CodeCache.cpp:
994 (JSC::generateUnlinkedCodeBlockForFunctions):
996 2019-02-14 Tadeu Zagallo <tzagallo@apple.com>
998 CachedBitVector's size must be converted from bits to bytes
999 https://bugs.webkit.org/show_bug.cgi?id=194441
1001 Reviewed by Saam Barati.
1003 CachedBitVector used its size in bits for memcpy. That didn't cause any
1004 issues when encoding, since the size in bits was also used in the allocation,
1005 but would overflow the actual BitVector buffer when decoding.
1007 * runtime/CachedTypes.cpp:
1008 (JSC::CachedBitVector::encode):
1009 (JSC::CachedBitVector::decode const):
1011 2019-02-13 Brian Burg <bburg@apple.com>
1013 Web Inspector: don't include accessibility role in DOM.Node object payloads
1014 https://bugs.webkit.org/show_bug.cgi?id=194623
1015 <rdar://problem/36384037>
1017 Reviewed by Devin Rousso.
1019 Remove property of DOM.Node that is no longer being sent.
1021 * inspector/protocol/DOM.json:
1023 2019-02-13 Keith Miller <keith_miller@apple.com> and Yusuke Suzuki <ysuzuki@apple.com>
1025 We should only make rope strings when concatenating strings long enough.
1026 https://bugs.webkit.org/show_bug.cgi?id=194465
1028 Reviewed by Mark Lam.
1030 This patch stops us from allocating a rope string if the resulting
1031 rope would be smaller than the size of the JSRopeString object we
1032 would need to allocate.
1034 This patch also adds paths so that we don't unnecessarily allocate
1035 JSString cells for primitives we are going to concatenate with a
1038 The important change from the previous one is that we do not apply
1039 the above rule to JSRopeStrings generated by JSStrings. If we convert
1040 it to JSString, comparison of memory consumption becomes the following,
1041 because JSRopeString does not have StringImpl until it is resolved.
1043 sizeof(JSRopeString) v.s. sizeof(JSString) + sizeof(StringImpl) + content
1045 Since sizeof(JSString) + sizeof(StringImpl) is larger than sizeof(JSRopeString),
1046 resolving eagerly increases memory footprint. The point is that we need to
1047 account newly created JSString and JSRopeString from the operands. This is the
1048 reason why this patch adds different thresholds for each jsString functions.
1050 This patch also avoids concatenation for ropes conservatively. Many ropes are
1051 temporary cells. So we do not resolve eagerly if one of operands is already a
1054 In CLI execution, this change is performance neutral in JetStream2 (run 6 times, 1 for warming up and average in latter 5.).
1057 After: 160.72340000000003
1059 * dfg/DFGOperations.cpp:
1060 * runtime/CommonSlowPaths.cpp:
1061 (JSC::SLOW_PATH_DECL):
1062 * runtime/JSString.h:
1063 (JSC::JSString::isRope const):
1064 * runtime/Operations.cpp:
1065 (JSC::jsAddSlowCase):
1066 * runtime/Operations.h:
1068 (JSC::jsAddNonNumber):
1071 2019-02-13 Saam Barati <sbarati@apple.com>
1073 AirIRGenerator::addSwitch switch patchpoint needs to model clobbering the scratch register
1074 https://bugs.webkit.org/show_bug.cgi?id=194610
1076 Reviewed by Michael Saboff.
1078 BinarySwitch might use the scratch register. We must model the
1079 effects of that properly. This is already caught by our br-table
1082 * wasm/WasmAirIRGenerator.cpp:
1083 (JSC::Wasm::AirIRGenerator::addSwitch):
1085 2019-02-13 Mark Lam <mark.lam@apple.com>
1087 Create a randomized free list for new StructureIDs on StructureIDTable resize.
1088 https://bugs.webkit.org/show_bug.cgi?id=194566
1089 <rdar://problem/47975502>
1091 Reviewed by Michael Saboff.
1093 Also isolate 32-bit implementation of StructureIDTable out more so the 64-bit
1094 implementation is a little easier to read.
1096 This patch appears to be perf neutral on JetStream2 (as run from the command line).
1098 * runtime/StructureIDTable.cpp:
1099 (JSC::StructureIDTable::StructureIDTable):
1100 (JSC::StructureIDTable::makeFreeListFromRange):
1101 (JSC::StructureIDTable::resize):
1102 (JSC::StructureIDTable::allocateID):
1103 (JSC::StructureIDTable::deallocateID):
1104 * runtime/StructureIDTable.h:
1105 (JSC::StructureIDTable::get):
1106 (JSC::StructureIDTable::deallocateID):
1107 (JSC::StructureIDTable::allocateID):
1108 (JSC::StructureIDTable::flushOldTables):
1110 2019-02-13 Tadeu Zagallo <tzagallo@apple.com>
1112 VariableLengthObject::allocate<T> should initialize objects
1113 https://bugs.webkit.org/show_bug.cgi?id=194534
1115 Reviewed by Michael Saboff.
1117 `buffer()` should not be called for empty VariableLengthObjects, but
1118 these cases were not being caught due to the objects not being properly
1119 initialized. Fix it so that allocate calls the constructor and fix the
1122 * runtime/CachedTypes.cpp:
1123 (JSC::CachedObject::operator new):
1124 (JSC::VariableLengthObject::allocate):
1125 (JSC::CachedVector::encode):
1126 (JSC::CachedVector::decode const):
1127 (JSC::CachedUniquedStringImpl::decode const):
1128 (JSC::CachedBitVector::encode):
1129 (JSC::CachedBitVector::decode const):
1130 (JSC::CachedArray::encode):
1131 (JSC::CachedArray::decode const):
1132 (JSC::CachedImmutableButterfly::CachedImmutableButterfly):
1133 (JSC::CachedBigInt::decode const):
1135 2019-02-13 Tadeu Zagallo <tzagallo@apple.com>
1137 CodeBlocks read from disk should not be re-written
1138 https://bugs.webkit.org/show_bug.cgi?id=194535
1140 Reviewed by Michael Saboff.
1142 Keep track of which CodeBlocks have been read from disk or have already
1143 been serialized in CodeCache.
1145 * runtime/CodeCache.cpp:
1146 (JSC::CodeCache::write):
1147 * runtime/CodeCache.h:
1148 (JSC::SourceCodeValue::SourceCodeValue):
1149 (JSC::CodeCacheMap::fetchFromDiskImpl):
1151 2019-02-13 Tadeu Zagallo <tzagallo@apple.com>
1153 SourceCode should be copied when generating bytecode for functions
1154 https://bugs.webkit.org/show_bug.cgi?id=194536
1156 Reviewed by Saam Barati.
1158 The FunctionExecutable might be collected while generating the bytecode
1159 for nested functions, in which case the SourceCode reference would no
1162 * runtime/CodeCache.cpp:
1163 (JSC::generateUnlinkedCodeBlockForFunctions):
1165 2019-02-12 Saam barati <sbarati@apple.com>
1167 JSScript needs to retain its cache path NSURL*
1168 https://bugs.webkit.org/show_bug.cgi?id=194577
1170 Reviewed by Tim Horton.
1173 (+[JSScript scriptFromASCIIFile:inVirtualMachine:withCodeSigning:andBytecodeCache:]):
1174 (-[JSScript dealloc]):
1176 2019-02-12 Robin Morisset <rmorisset@apple.com>
1178 Make B3Value::returnsBool() more precise
1179 https://bugs.webkit.org/show_bug.cgi?id=194457
1181 Reviewed by Saam Barati.
1183 It is currently used repeatedly in B3ReduceStrength, as well as once in B3LowerToAir.
1184 It has a needlessly complex rule for BitAnd, and has no rule for other easy cases such as BitOr or Select.
1185 No new tests added as this should be indirectly tested by the already existing tests.
1188 (JSC::B3::Value::returnsBool const):
1190 2019-02-12 Michael Catanzaro <mcatanzaro@igalia.com>
1192 Unreviewed, fix -Wimplicit-fallthrough warning after r241140
1193 https://bugs.webkit.org/show_bug.cgi?id=194399
1194 <rdar://problem/47889777>
1196 * dfg/DFGDoesGC.cpp:
1199 2019-02-12 Michael Catanzaro <mcatanzaro@igalia.com>
1201 [WPE][GTK] Unsafe g_unsetenv() use in WebProcessPool::platformInitialize
1202 https://bugs.webkit.org/show_bug.cgi?id=194370
1204 Reviewed by Darin Adler.
1206 Change a couple WTFLogAlways to use g_warning, for good measure. Of course this isn't
1207 necessary, but it will make errors more visible.
1209 * inspector/remote/glib/RemoteInspectorGlib.cpp:
1210 (Inspector::RemoteInspector::start):
1211 (Inspector::dbusConnectionCallAsyncReadyCallback):
1212 * inspector/remote/glib/RemoteInspectorServer.cpp:
1213 (Inspector::RemoteInspectorServer::start):
1215 2019-02-12 Andy Estes <aestes@apple.com>
1217 [iOSMac] Enable Parental Controls Content Filtering
1218 https://bugs.webkit.org/show_bug.cgi?id=194521
1221 Reviewed by Tim Horton.
1223 * Configurations/FeatureDefines.xcconfig:
1225 2019-02-11 Mark Lam <mark.lam@apple.com>
1227 Randomize insertion of deallocated StructureIDs into the StructureIDTable's free list.
1228 https://bugs.webkit.org/show_bug.cgi?id=194512
1229 <rdar://problem/47975465>
1231 Reviewed by Yusuke Suzuki.
1233 * runtime/StructureIDTable.cpp:
1234 (JSC::StructureIDTable::StructureIDTable):
1235 (JSC::StructureIDTable::allocateID):
1236 (JSC::StructureIDTable::deallocateID):
1237 * runtime/StructureIDTable.h:
1239 2019-02-10 Mark Lam <mark.lam@apple.com>
1241 Remove the RELEASE_ASSERT check for duplicate cases in the BinarySwitch constructor.
1242 https://bugs.webkit.org/show_bug.cgi?id=194493
1243 <rdar://problem/36380852>
1245 Reviewed by Yusuke Suzuki.
1247 Having duplicate cases in the BinarySwitch is not a correctness issue. It is
1248 however not good for performance and memory usage. As such, a debug ASSERT will
1249 do. We'll also do an audit of the clients of BinarySwitch to see if it's
1250 possible to be instantiated with duplicate cases in
1251 https://bugs.webkit.org/show_bug.cgi?id=194492 later.
1253 Also added some value dumps to the RELEASE_ASSERT to help debug the issue when we
1254 see duplicate cases.
1256 * jit/BinarySwitch.cpp:
1257 (JSC::BinarySwitch::BinarySwitch):
1259 2019-02-10 Darin Adler <darin@apple.com>
1261 Switch uses of StringBuilder with String::format for hex numbers to use HexNumber.h instead
1262 https://bugs.webkit.org/show_bug.cgi?id=194485
1264 Reviewed by Daniel Bates.
1266 * heap/HeapSnapshotBuilder.cpp:
1267 (JSC::HeapSnapshotBuilder::json): Use appendUnsignedAsHex along with
1268 reinterpret_cast<uintptr_t> to replace uses of String::format with "%p".
1270 * runtime/JSGlobalObjectFunctions.cpp:
1271 (JSC::encode): Removed some unneeded casts in StringBuilder code,
1272 including one in a call to appendByteAsHex.
1273 (JSC::globalFuncEscape): Ditto.
1275 2019-02-10 Commit Queue <commit-queue@webkit.org>
1277 Unreviewed, rolling out r241230.
1278 https://bugs.webkit.org/show_bug.cgi?id=194488
1280 "It regressed JetStream2 by ~6%" (Requested by saamyjoon on
1285 "We should only make rope strings when concatenating strings
1287 https://bugs.webkit.org/show_bug.cgi?id=194465
1288 https://trac.webkit.org/changeset/241230
1290 2019-02-10 Saam barati <sbarati@apple.com>
1292 BBQ-Air: Emit better code for switch
1293 https://bugs.webkit.org/show_bug.cgi?id=194053
1295 Reviewed by Yusuke Suzuki.
1297 Instead of emitting a linear set of jumps for Switch, this patch
1298 makes the BBQ-Air backend emit a binary switch.
1300 * wasm/WasmAirIRGenerator.cpp:
1301 (JSC::Wasm::AirIRGenerator::addSwitch):
1303 2019-02-09 Yusuke Suzuki <ysuzuki@apple.com>
1305 Unreviewed, Lexer should use isLatin1 implementation in WTF
1306 https://bugs.webkit.org/show_bug.cgi?id=194466
1308 Follow-up after r241233 pointed by Darin.
1311 (JSC::isLatin1): Deleted.
1313 2019-02-09 Darin Adler <darin@apple.com>
1315 Eliminate unnecessary String temporaries by using StringConcatenateNumbers
1316 https://bugs.webkit.org/show_bug.cgi?id=194021
1318 Reviewed by Geoffrey Garen.
1320 * inspector/agents/InspectorConsoleAgent.cpp:
1321 (Inspector::InspectorConsoleAgent::count): Remove String::number and let
1322 makeString do the conversion without allocating/destroying a String.
1323 * inspector/agents/InspectorDebuggerAgent.cpp:
1324 (Inspector::objectGroupForBreakpointAction): Ditto.
1325 (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): Ditto.
1326 (Inspector::InspectorDebuggerAgent::setBreakpoint): Ditto.
1327 * runtime/JSGenericTypedArrayViewInlines.h:
1328 (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty): Ditto.
1329 * runtime/NumberPrototype.cpp:
1330 (JSC::numberProtoFuncToFixed): Use String::numberToStringFixedWidth instead
1331 of calling numberToFixedWidthString to do the same thing.
1332 (JSC::numberProtoFuncToPrecision): Use String::number instead of calling
1333 numberToFixedPrecisionString to do the same thing.
1334 * runtime/SamplingProfiler.cpp:
1335 (JSC::SamplingProfiler::reportTopFunctions): Ditto.
1337 2019-02-09 Yusuke Suzuki <ysuzuki@apple.com>
1339 Unreviewed, rolling in r241237 again
1340 https://bugs.webkit.org/show_bug.cgi?id=194469
1342 * runtime/JSString.h:
1345 2019-02-09 Commit Queue <commit-queue@webkit.org>
1347 Unreviewed, rolling out r241237.
1348 https://bugs.webkit.org/show_bug.cgi?id=194474
1350 Shows significant memory increase in WSL (Requested by
1351 yusukesuzuki on #webkit).
1355 "[WTF] Use BufferInternal StringImpl if substring StringImpl
1357 https://bugs.webkit.org/show_bug.cgi?id=194469
1358 https://trac.webkit.org/changeset/241237
1360 2019-02-08 Yusuke Suzuki <ysuzuki@apple.com>
1362 [WTF] Use BufferInternal StringImpl if substring StringImpl takes more memory
1363 https://bugs.webkit.org/show_bug.cgi?id=194469
1365 Reviewed by Geoffrey Garen.
1367 * runtime/JSString.h:
1370 2019-02-08 Yusuke Suzuki <ysuzuki@apple.com>
1372 [JSC] CachedTypes should use jsString instead of JSString::create
1373 https://bugs.webkit.org/show_bug.cgi?id=194471
1375 Reviewed by Mark Lam.
1377 Use jsString() here because JSString::create is a bit low-level API and it requires some invariant like "length is not zero".
1379 * runtime/CachedTypes.cpp:
1380 (JSC::CachedJSValue::decode const):
1382 2019-02-08 Yusuke Suzuki <ysuzuki@apple.com>
1384 [JSC] Increase StructureIDTable initial capacity
1385 https://bugs.webkit.org/show_bug.cgi?id=194468
1387 Reviewed by Mark Lam.
1389 Currently, # of structures just after initializing JSGlobalObject (precisely, initializing GlobalObject in
1390 JSC shell), 281, already exceeds the current initial value 256. We should increase the capacity since
1391 unnecessary resizing requires more operations, keeps old StructureID array until GC happens, and makes
1392 more memory dirty. We also remove some structures that are no longer used.
1394 * runtime/JSGlobalObject.h:
1395 (JSC::JSGlobalObject::callbackObjectStructure const):
1396 (JSC::JSGlobalObject::propertyNameIteratorStructure const): Deleted.
1397 * runtime/StructureIDTable.h:
1400 2019-02-08 Yusuke Suzuki <ysuzuki@apple.com>
1402 [JSC] String.fromCharCode's slow path always generates 16bit string
1403 https://bugs.webkit.org/show_bug.cgi?id=194466
1405 Reviewed by Keith Miller.
1407 String.fromCharCode(a1) has a fast path and the most frequently used. And String.fromCharCode(a1, a2, ...)
1408 goes to the slow path. However, in the slow path, we always create 16bit string. 16bit string takes 2x memory,
1409 and even worse, taints ropes 16bit if 16bit string is included in the given rope. We find that acorn-wtb
1410 creates very large strings multiple times with String.fromCharCode, and String.fromCharCode always produces
1411 16bit string. However, only few strings are actually 16bit strings. This patch attempts to make 8bit string
1412 as much as possible.
1414 It improves non JIT acorn-wtb's peak and current memory footprint by 6% and 3% respectively.
1416 * runtime/StringConstructor.cpp:
1417 (JSC::stringFromCharCode):
1419 2019-02-08 Keith Miller <keith_miller@apple.com>
1421 We should only make rope strings when concatenating strings long enough.
1422 https://bugs.webkit.org/show_bug.cgi?id=194465
1424 Reviewed by Saam Barati.
1426 This patch stops us from allocating a rope string if the resulting
1427 rope would be smaller than the size of the JSRopeString object we
1428 would need to allocate.
1430 This patch also adds paths so that we don't unnecessarily allocate
1431 JSString cells for primitives we are going to concatenate with a
1434 * dfg/DFGOperations.cpp:
1435 * runtime/CommonSlowPaths.cpp:
1436 (JSC::SLOW_PATH_DECL):
1437 * runtime/JSString.h:
1438 * runtime/Operations.cpp:
1439 (JSC::jsAddSlowCase):
1440 * runtime/Operations.h:
1444 2019-02-08 Saam barati <sbarati@apple.com>
1446 Nodes that rely on being dominated by CheckInBounds should have a child edge to it
1447 https://bugs.webkit.org/show_bug.cgi?id=194334
1448 <rdar://problem/47844327>
1450 Reviewed by Mark Lam.
1452 * dfg/DFGAbstractInterpreterInlines.h:
1453 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1454 * dfg/DFGArgumentsEliminationPhase.cpp:
1455 * dfg/DFGByteCodeParser.cpp:
1456 (JSC::DFG::ByteCodeParser::parseBlock):
1457 * dfg/DFGClobberize.h:
1458 (JSC::DFG::clobberize):
1459 * dfg/DFGConstantFoldingPhase.cpp:
1460 (JSC::DFG::ConstantFoldingPhase::foldConstants):
1461 * dfg/DFGFixupPhase.cpp:
1462 (JSC::DFG::FixupPhase::fixupNode):
1463 (JSC::DFG::FixupPhase::convertToHasIndexedProperty):
1464 * dfg/DFGIntegerCheckCombiningPhase.cpp:
1465 (JSC::DFG::IntegerCheckCombiningPhase::handleBlock):
1466 * dfg/DFGIntegerRangeOptimizationPhase.cpp:
1467 * dfg/DFGNodeType.h:
1468 * dfg/DFGSSALoweringPhase.cpp:
1469 (JSC::DFG::SSALoweringPhase::lowerBoundsCheck):
1470 * dfg/DFGSpeculativeJIT.cpp:
1471 (JSC::DFG::SpeculativeJIT::compileHasIndexedProperty):
1472 * ftl/FTLLowerDFGToB3.cpp:
1473 (JSC::FTL::DFG::LowerDFGToB3::compileCheckInBounds):
1474 (JSC::FTL::DFG::LowerDFGToB3::compileHasIndexedProperty):
1476 2019-02-08 Yusuke Suzuki <ysuzuki@apple.com>
1478 [JSC] Shrink sizeof(CodeBlock) more
1479 https://bugs.webkit.org/show_bug.cgi?id=194419
1481 Reviewed by Mark Lam.
1483 This patch further shrinks the size of CodeBlock, from 352 to 296 (304).
1485 1. CodeBlock copies so many data from ScriptExecutable even if ScriptExecutable
1486 has the same information. These data is not touched in CodeBlock::~CodeBlock,
1487 so we can just use the data in ScriptExecutable instead of holding it in CodeBlock.
1489 2. We remove m_instructions pointer since the ownership is managed by UnlinkedCodeBlock.
1490 And we do not touch it in CodeBlock::~CodeBlock.
1492 3. We move m_calleeSaveRegisters from CodeBlock to CodeBlock::JITData. For baseline and LLInt
1493 cases, this patch offers RegisterAtOffsetList::llintBaselineCalleeSaveRegisters() which returns
1494 singleton to `const RegisterAtOffsetList*` usable for LLInt and Baseline JIT CodeBlocks.
1496 4. Move m_catchProfiles to RareData and materialize only when op_catch's slow path is called.
1498 5. Drop ownerScriptExecutable. ownerExecutable() returns ScriptExecutable*.
1500 * bytecode/CodeBlock.cpp:
1501 (JSC::CodeBlock::hash const):
1502 (JSC::CodeBlock::sourceCodeForTools const):
1503 (JSC::CodeBlock::dumpAssumingJITType const):
1504 (JSC::CodeBlock::dumpSource):
1505 (JSC::CodeBlock::CodeBlock):
1506 (JSC::CodeBlock::finishCreation):
1507 (JSC::CodeBlock::propagateTransitions):
1508 (JSC::CodeBlock::finalizeLLIntInlineCaches):
1509 (JSC::CodeBlock::setCalleeSaveRegisters):
1510 (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset):
1511 (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow):
1512 (JSC::CodeBlock::lineNumberForBytecodeOffset):
1513 (JSC::CodeBlock::expressionRangeForBytecodeOffset const):
1514 (JSC::CodeBlock::hasOpDebugForLineAndColumn):
1515 (JSC::CodeBlock::newReplacement):
1516 (JSC::CodeBlock::replacement):
1517 (JSC::CodeBlock::computeCapabilityLevel):
1518 (JSC::CodeBlock::jettison):
1519 (JSC::CodeBlock::calleeSaveRegisters const):
1520 (JSC::CodeBlock::calleeSaveSpaceAsVirtualRegisters):
1521 (JSC::CodeBlock::updateOSRExitCounterAndCheckIfNeedToReoptimize):
1522 (JSC::CodeBlock::getArrayProfile):
1523 (JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
1524 (JSC::CodeBlock::notifyLexicalBindingUpdate):
1525 (JSC::CodeBlock::tryGetValueProfileForBytecodeOffset):
1526 (JSC::CodeBlock::validate):
1527 (JSC::CodeBlock::outOfLineJumpTarget):
1528 (JSC::CodeBlock::arithProfileForBytecodeOffset):
1529 (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
1530 * bytecode/CodeBlock.h:
1531 (JSC::CodeBlock::specializationKind const):
1532 (JSC::CodeBlock::isStrictMode const):
1533 (JSC::CodeBlock::isConstructor const):
1534 (JSC::CodeBlock::codeType const):
1535 (JSC::CodeBlock::isKnownNotImmediate):
1536 (JSC::CodeBlock::instructions const):
1537 (JSC::CodeBlock::ownerExecutable const):
1538 (JSC::CodeBlock::thisRegister const):
1539 (JSC::CodeBlock::source const):
1540 (JSC::CodeBlock::sourceOffset const):
1541 (JSC::CodeBlock::firstLineColumnOffset const):
1542 (JSC::CodeBlock::createRareDataIfNecessary):
1543 (JSC::CodeBlock::ownerScriptExecutable const): Deleted.
1544 (JSC::CodeBlock::setThisRegister): Deleted.
1545 (JSC::CodeBlock::calleeSaveRegisters const): Deleted.
1546 * bytecode/EvalCodeBlock.h:
1547 * bytecode/FunctionCodeBlock.h:
1548 * bytecode/GlobalCodeBlock.h:
1549 (JSC::GlobalCodeBlock::GlobalCodeBlock):
1550 * bytecode/ModuleProgramCodeBlock.h:
1551 * bytecode/ProgramCodeBlock.h:
1552 * debugger/Debugger.cpp:
1553 (JSC::Debugger::toggleBreakpoint):
1554 * debugger/DebuggerCallFrame.cpp:
1555 (JSC::DebuggerCallFrame::sourceID const):
1556 (JSC::DebuggerCallFrame::sourceIDForCallFrame):
1557 * debugger/DebuggerScope.cpp:
1558 (JSC::DebuggerScope::location const):
1559 * dfg/DFGByteCodeParser.cpp:
1560 (JSC::DFG::ByteCodeParser::InlineStackEntry::executable):
1561 (JSC::DFG::ByteCodeParser::inliningCost):
1562 (JSC::DFG::ByteCodeParser::parseCodeBlock):
1563 * dfg/DFGCapabilities.cpp:
1564 (JSC::DFG::isSupportedForInlining):
1565 (JSC::DFG::mightCompileEval):
1566 (JSC::DFG::mightCompileProgram):
1567 (JSC::DFG::mightCompileFunctionForCall):
1568 (JSC::DFG::mightCompileFunctionForConstruct):
1569 (JSC::DFG::canUseOSRExitFuzzing):
1571 (JSC::DFG::Graph::executableFor):
1572 * dfg/DFGJITCompiler.cpp:
1573 (JSC::DFG::JITCompiler::compileFunction):
1574 * dfg/DFGOSREntry.cpp:
1575 (JSC::DFG::prepareOSREntry):
1576 * dfg/DFGOSRExit.cpp:
1577 (JSC::DFG::restoreCalleeSavesFor):
1578 (JSC::DFG::saveCalleeSavesFor):
1579 (JSC::DFG::saveOrCopyCalleeSavesFor):
1580 * dfg/DFGOSRExitCompilerCommon.cpp:
1581 (JSC::DFG::handleExitCounts):
1582 * dfg/DFGOperations.cpp:
1583 * dfg/DFGToFTLDeferredCompilationCallback.cpp:
1584 (JSC::DFG::ToFTLDeferredCompilationCallback::compilationDidComplete):
1585 * ftl/FTLCapabilities.cpp:
1586 (JSC::FTL::canCompile):
1589 * ftl/FTLOSRExitCompiler.cpp:
1590 (JSC::FTL::compileStub):
1591 * interpreter/CallFrame.cpp:
1592 (JSC::CallFrame::callerSourceOrigin):
1593 * interpreter/Interpreter.cpp:
1595 (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const):
1596 * interpreter/StackVisitor.cpp:
1597 (JSC::StackVisitor::Frame::calleeSaveRegisters):
1598 (JSC::StackVisitor::Frame::sourceURL const):
1599 (JSC::StackVisitor::Frame::sourceID):
1600 (JSC::StackVisitor::Frame::computeLineAndColumn const):
1601 * interpreter/StackVisitor.h:
1602 * jit/AssemblyHelpers.h:
1603 (JSC::AssemblyHelpers::emitSaveCalleeSavesFor):
1604 (JSC::AssemblyHelpers::emitSaveOrCopyCalleeSavesFor):
1605 (JSC::AssemblyHelpers::emitRestoreCalleeSavesFor):
1606 * jit/CallFrameShuffleData.cpp:
1607 (JSC::CallFrameShuffleData::setupCalleeSaveRegisters):
1609 (JSC::JIT::compileWithoutLinking):
1610 * jit/JITToDFGDeferredCompilationCallback.cpp:
1611 (JSC::JITToDFGDeferredCompilationCallback::compilationDidComplete):
1612 * jit/JITWorklist.cpp:
1613 (JSC::JITWorklist::Plan::finalize):
1614 (JSC::JITWorklist::compileNow):
1615 * jit/RegisterAtOffsetList.cpp:
1616 (JSC::RegisterAtOffsetList::llintBaselineCalleeSaveRegisters):
1617 * jit/RegisterAtOffsetList.h:
1618 (JSC::RegisterAtOffsetList::at const):
1619 * runtime/ErrorInstance.cpp:
1620 (JSC::appendSourceToError):
1621 * runtime/ScriptExecutable.cpp:
1622 (JSC::ScriptExecutable::newCodeBlockFor):
1623 * runtime/StackFrame.cpp:
1624 (JSC::StackFrame::sourceID const):
1625 (JSC::StackFrame::sourceURL const):
1626 (JSC::StackFrame::computeLineAndColumn const):
1628 2019-02-08 Robin Morisset <rmorisset@apple.com>
1630 B3LowerMacros wrongly sets m_changed to true in the case of AtomicWeakCAS on x86
1631 https://bugs.webkit.org/show_bug.cgi?id=194460
1633 Reviewed by Mark Lam.
1635 Trivial fix, should already be covered by testAtomicWeakCAS in testb3.cpp.
1637 * b3/B3LowerMacros.cpp:
1639 2019-02-08 Mark Lam <mark.lam@apple.com>
1641 Use maxSingleCharacterString in comparisons instead of literal constants.
1642 https://bugs.webkit.org/show_bug.cgi?id=194452
1644 Reviewed by Yusuke Suzuki.
1646 This way, if we ever change maxSingleCharacterString, it won't break all this code
1647 that relies on it being 0xff implicitly.
1649 * dfg/DFGSpeculativeJIT.cpp:
1650 (JSC::DFG::SpeculativeJIT::compileStringSlice):
1651 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
1652 * ftl/FTLLowerDFGToB3.cpp:
1653 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt):
1654 (JSC::FTL::DFG::LowerDFGToB3::compileStringSlice):
1655 * jit/ThunkGenerators.cpp:
1656 (JSC::stringGetByValGenerator):
1657 (JSC::charToString):
1659 2019-02-08 Mark Lam <mark.lam@apple.com>
1661 Fix DFG's doesGC() for CheckTierUp*, GetByVal, PutByVal*, and StringCharAt nodes.
1662 https://bugs.webkit.org/show_bug.cgi?id=194446
1663 <rdar://problem/47926792>
1665 Reviewed by Saam Barati.
1667 Fix doesGC() for the following nodes:
1669 CheckTierUpAtReturn:
1670 Calls triggerTierUpNow(), which calls triggerFTLReplacementCompile(),
1671 which calls Worklist::completeAllReadyPlansForVM(), which uses DeferGC.
1674 Calls triggerTierUpNowInLoop(), which calls tierUpCommon(), which calls
1675 Worklist::completeAllReadyPlansForVM(), which uses DeferGC.
1677 CheckTierUpAndOSREnter:
1678 Calls triggerOSREntryNow(), which calls tierUpCommon(), which calls
1679 Worklist::completeAllReadyPlansForVM(), which uses DeferGC.
1682 case Array::String calls operationSingleCharacterString(), which calls
1683 jsSingleCharacterString(), which can allocate a string.
1688 For the DFG only, the integer TypeArrays calls compilePutByValForIntTypedArray(),
1689 which may call slow paths operationPutByValDirectStrict(), operationPutByValDirectNonStrict(),
1690 operationPutByValStrict(), or operationPutByValNonStrict(). All of these
1691 slow paths call putByValInternal(), which may create exception objects, or
1692 call the generic JSValue::put() which may execute arbitrary code.
1695 Can call operationSingleCharacterString(), which calls jsSingleCharacterString(),
1696 which can allocate a string.
1698 Also fix DFG::SpeculativeJIT::compileGetByValOnString() and FTL's compileStringCharAt()
1699 to use the maxSingleCharacterString constant instead of a literal constant.
1701 * dfg/DFGDoesGC.cpp:
1703 * dfg/DFGSpeculativeJIT.cpp:
1704 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
1705 * dfg/DFGSpeculativeJIT64.cpp:
1706 (JSC::DFG::SpeculativeJIT::compile):
1707 * ftl/FTLLowerDFGToB3.cpp:
1708 (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
1709 (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
1710 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt):
1712 2019-02-08 Yusuke Suzuki <ysuzuki@apple.com>
1714 [JSC] SourceProviderCacheItem should be small
1715 https://bugs.webkit.org/show_bug.cgi?id=194432
1717 Reviewed by Saam Barati.
1719 Some JetStream2 tests stress the JS parser. At that time, so many SourceProviderCacheItems are created.
1720 While they are removed when full-GC happens, it significantly increases the peak memory usage.
1721 This patch reduces the size of SourceProviderCacheItem from 56 to 32.
1723 * parser/Parser.cpp:
1724 (JSC::Parser<LexerType>::parseFunctionInfo):
1725 * parser/ParserModes.h:
1726 * parser/ParserTokens.h:
1727 * parser/SourceProviderCacheItem.h:
1728 (JSC::SourceProviderCacheItem::endFunctionToken const):
1729 (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
1731 2019-02-07 Robin Morisset <rmorisset@apple.com>
1733 Fix Abs(Neg(x)) -> Abs(x) optimization in B3ReduceStrength
1734 https://bugs.webkit.org/show_bug.cgi?id=194420
1736 Reviewed by Saam Barati.
1738 In https://bugs.webkit.org/show_bug.cgi?id=194250, I added an optimization: Abs(Neg(x)) -> Abs(x).
1739 But I introduced two bugs, one is that I actually implemented Abs(Neg(x)) -> x, and the other is that the test is looking at Abs(Abs(x)) instead (both were stupid copy-paste mistakes).
1740 This trivial patch fixes both.
1742 * b3/B3ReduceStrength.cpp:
1744 (JSC::B3::testAbsNegArg):
1746 2019-02-07 Keith Miller <keith_miller@apple.com>
1748 Better error messages for module loader SPI
1749 https://bugs.webkit.org/show_bug.cgi?id=194421
1751 Reviewed by Saam Barati.
1753 * API/JSAPIGlobalObject.mm:
1754 (JSC::JSAPIGlobalObject::moduleLoaderImportModule):
1756 2019-02-07 Mark Lam <mark.lam@apple.com>
1758 Fix more doesGC() for CheckTraps, GetMapBucket, and Switch nodes.
1759 https://bugs.webkit.org/show_bug.cgi?id=194399
1760 <rdar://problem/47889777>
1762 Reviewed by Yusuke Suzuki.
1764 Fix doesGC() for the following nodes:
1767 We normally will not emit this node because Options::usePollingTraps() is
1768 false by default. However, as it is implemented now, CheckTraps can GC
1769 because it can allocate a TerminatedExecutionException. If we make the
1770 TerminatedExecutionException a singleton allocated at initialization time,
1771 doesGC() can return false for CheckTraps.
1772 https://bugs.webkit.org/show_bug.cgi?id=194323
1775 Can call operationJSMapFindBucket() or operationJSSetFindBucket(),
1776 which calls HashMapImpl::findBucket(), which calls jsMapHash(), which
1780 If switchData kind is SwitchChar, can call operationResolveRope() .
1781 If switchData kind is SwitchString and the child use kind is not StringIdentUse,
1782 can call operationSwitchString() which resolves ropes.
1787 TailCallForwardVarargs:
1790 These are terminal nodes. It shouldn't really matter what doesGC() returns
1791 for them, but following our conservative practice, unless we have a good
1792 reason for doesGC() to return false, we should just return true.
1794 * dfg/DFGDoesGC.cpp:
1797 2019-02-07 Robin Morisset <rmorisset@apple.com>
1799 B3ReduceStrength: missing peephole optimizations for Neg and Sub
1800 https://bugs.webkit.org/show_bug.cgi?id=194250
1802 Reviewed by Saam Barati.
1804 Adds the following optimizations for integers:
1806 Already covered by the test testSubArg
1807 - Sub(x1, Neg(x2)) => Add (x1, x2)
1808 Added test: testSubNeg
1809 - Neg(Sub(x1, x2)) => Sub(x2, x1)
1810 Added test: testNegSub
1811 - Add(Neg(x1), x2) => Sub(x2, x1)
1812 Added test: testAddNeg1
1813 - Add(x1, Neg(x2)) => Sub(x1, x2)
1814 Added test: testAddNeg2
1815 Adds the following optimization for floating point values:
1816 - Abs(Neg(x)) => Abs(x)
1817 Added test: testAbsNegArg
1818 Adds the following optimization:
1820 Also did some trivial refactoring, using m_value->isInteger() everywhere instead of isInt(m_value->type()), and using replaceWithNew<Value> instead of replaceWithNewValue(m_proc.add<Value(..))
1822 * b3/B3ReduceStrength.cpp:
1824 (JSC::B3::testAddNeg1):
1825 (JSC::B3::testAddNeg2):
1826 (JSC::B3::testSubNeg):
1827 (JSC::B3::testNegSub):
1828 (JSC::B3::testAbsAbsArg):
1829 (JSC::B3::testAbsNegArg):
1832 2019-02-06 Yusuke Suzuki <ysuzuki@apple.com>
1834 [JSC] Use BufferInternal single character StringImpl for SmallStrings
1835 https://bugs.webkit.org/show_bug.cgi?id=194374
1837 Reviewed by Geoffrey Garen.
1839 Currently, we first create a large StringImpl, and create bunch of substrings with length = 1.
1840 But pointer is larger than single character. BufferInternal StringImpl with single character
1841 is more memory efficient.
1843 * runtime/SmallStrings.cpp:
1844 (JSC::SmallStringsStorage::SmallStringsStorage):
1845 (JSC::SmallStrings::SmallStrings):
1846 * runtime/SmallStrings.h:
1848 2019-02-06 Yusuke Suzuki <ysuzuki@apple.com>
1850 [JSC] InitializeEntrypointArguments should produce SpecCellCheck if FlushFormat is FlushedCell
1851 https://bugs.webkit.org/show_bug.cgi?id=194369
1852 <rdar://problem/47813087>
1854 Reviewed by Saam Barati.
1856 InitializeEntrypointArguments says SpecCell if the FlushFormat is FlushedCell. But this actually has
1857 JSEmpty if it is TDZ. This incorrectly proved type information removes necessary CheckNotEmpty in
1858 constant folding phase.
1860 * dfg/DFGAbstractInterpreterInlines.h:
1861 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1863 2019-02-06 Devin Rousso <drousso@apple.com>
1865 Web Inspector: DOM: don't send the entire function string with each event listener
1866 https://bugs.webkit.org/show_bug.cgi?id=194293
1867 <rdar://problem/47822809>
1869 Reviewed by Joseph Pecoraro.
1871 * inspector/protocol/DOM.json:
1873 * runtime/JSFunction.h:
1874 Export `calculatedDisplayName`.
1876 2019-02-06 Yusuke Suzuki <ysuzuki@apple.com>
1878 [JSC] PrivateName to PublicName hash table is wasteful
1879 https://bugs.webkit.org/show_bug.cgi?id=194277
1881 Reviewed by Michael Saboff.
1883 PrivateNames account for a lot of memory in the initial JSC footprint. BuiltinNames have Identifier fields corresponding to these PrivateNames
1884 which makes the sizeof(BuiltinNames) about 6KB. It also maintains hash tables for "PublicName to PrivateName" and "PrivateName to PublicName",
1885 each of which takes 16KB memory. While "PublicName to PrivateName" functionality is used in builtin JS (parsing "@xxx" and get a private
1886 name for "xxx"), "PrivateName to PublicName" is rarely used. Holding 16KB hash table for rarely used feature is costly.
1888 In this patch, we add some rules to remove "PrivateName to PublicName" hash table.
1890 1. PrivateName's content should be the same to PublicName.
1891 2. If PrivateName is not actually a private name (we introduced hacky mapping like "@iteratorSymbol" => Symbol.iterator),
1892 the public name should be easily crafted from the given PrivateName.
1894 We modify the content of private names to ensure (1). And for (2), we can meet this requirement by ensuring that the "@xxxSymbol"
1895 is converted to "Symbol.xxx". (1) and (2) allow us to convert a private name to a public name without a large hash table.
1897 We also remove unused identifiers in CommonIdentifiers. And we also move some of them to WebCore's WebCoreBuiltinNames if it is only used in
1900 * builtins/BuiltinNames.cpp:
1901 (JSC::BuiltinNames::BuiltinNames):
1902 * builtins/BuiltinNames.h:
1903 (JSC::BuiltinNames::lookUpPrivateName const):
1904 (JSC::BuiltinNames::getPublicName const):
1905 (JSC::BuiltinNames::checkPublicToPrivateMapConsistency):
1906 (JSC::BuiltinNames::appendExternalName):
1907 (JSC::BuiltinNames::lookUpPublicName const): Deleted.
1908 * builtins/BuiltinUtils.h:
1909 * bytecode/BytecodeDumper.cpp:
1910 (JSC::BytecodeDumper<Block>::dumpIdentifiers):
1911 * bytecompiler/NodesCodegen.cpp:
1912 (JSC::BytecodeIntrinsicNode::emit_intrinsic_getByIdDirectPrivate):
1913 (JSC::BytecodeIntrinsicNode::emit_intrinsic_putByIdDirectPrivate):
1915 (JSC::Lexer<LChar>::parseIdentifier):
1916 (JSC::Lexer<UChar>::parseIdentifier):
1917 * parser/Parser.cpp:
1918 (JSC::Parser<LexerType>::createGeneratorParameters):
1919 (JSC::Parser<LexerType>::parseFunctionDeclaration):
1920 (JSC::Parser<LexerType>::parseAsyncFunctionDeclaration):
1921 (JSC::Parser<LexerType>::parseClassDeclaration):
1922 (JSC::Parser<LexerType>::parseExportDeclaration):
1923 (JSC::Parser<LexerType>::parseMemberExpression):
1924 * parser/ParserArena.h:
1925 (JSC::IdentifierArena::makeIdentifier):
1926 * runtime/CachedTypes.cpp:
1927 (JSC::CachedUniquedStringImpl::encode):
1928 (JSC::CachedUniquedStringImpl::decode const):
1929 * runtime/CommonIdentifiers.cpp:
1930 (JSC::CommonIdentifiers::CommonIdentifiers):
1931 (JSC::CommonIdentifiers::lookUpPrivateName const):
1932 (JSC::CommonIdentifiers::getPublicName const):
1933 (JSC::CommonIdentifiers::lookUpPublicName const): Deleted.
1934 * runtime/CommonIdentifiers.h:
1935 * runtime/ExceptionHelpers.cpp:
1936 (JSC::createUndefinedVariableError):
1937 * runtime/Identifier.cpp:
1938 (JSC::Identifier::dump const):
1939 * runtime/Identifier.h:
1940 * runtime/IdentifierInlines.h:
1941 (JSC::Identifier::fromUid):
1942 * runtime/JSTypedArrayViewPrototype.cpp:
1943 (JSC::JSTypedArrayViewPrototype::finishCreation):
1944 * tools/JSDollarVM.cpp:
1945 (JSC::functionGetPrivateProperty):
1947 2019-02-06 Keith Rollin <krollin@apple.com>
1949 Really enable the automatic checking and regenerations of .xcfilelists during builds
1950 https://bugs.webkit.org/show_bug.cgi?id=194357
1951 <rdar://problem/47861231>
1953 Reviewed by Chris Dumez.
1955 Bug 194124 was supposed to enable the automatic checking and
1956 regenerating of .xcfilelist files during the build. While related
1957 changes were included in that patch, the change to actually enable the
1958 operation somehow was omitted. This patch actually enables the
1959 operation. The check-xcfilelist.sh scripts now check
1960 WK_DISABLE_CHECK_XCFILELISTS, and if it's "1", opts-out the developer
1963 * Scripts/check-xcfilelists.sh:
1965 2019-02-06 Yusuke Suzuki <ysuzuki@apple.com>
1967 [JSC] Unify indirectEvalExecutableSpace and directEvalExecutableSpace
1968 https://bugs.webkit.org/show_bug.cgi?id=194339
1970 Reviewed by Michael Saboff.
1972 DirectEvalExecutable and IndirectEvalExecutable have completely same memory layout.
1973 They have even the same structure. This patch unifies the subspaces for them.
1975 * runtime/DirectEvalExecutable.h:
1976 * runtime/EvalExecutable.h:
1977 (JSC::EvalExecutable::subspaceFor):
1978 * runtime/IndirectEvalExecutable.h:
1981 (JSC::VM::forEachScriptExecutableSpace):
1983 2019-02-06 Yusuke Suzuki <ysuzuki@apple.com>
1985 [JSC] NativeExecutable should be smaller
1986 https://bugs.webkit.org/show_bug.cgi?id=194331
1988 Reviewed by Michael Saboff.
1990 NativeExecutable takes 88 bytes now. Since our GC rounds the size with 16, it actually takes 96 bytes in IsoSubspaces.
1991 Since a lot of NativeExecutable are allocated, we already has two MarkedBlocks even just after JSGlobalObject initialization.
1992 This patch makes sizeof(NativeExecutable) 64 bytes, which is 32 bytes smaller than 96 bytes. Now our JSGlobalObject initialization
1993 only takes one MarkedBlock for NativeExecutable.
1995 To make NativeExecutable smaller,
1997 1. m_numParametersForCall and m_numParametersForConstruct in ExecutableBase are only meaningful in ScriptExecutable subclasses. Since
1998 they are not touched from JIT, we can remove them from ExecutableBase and move them to ScriptExecutable.
2000 2. DOMJIT::Signature* is rarely used. Rather than having it in NativeExecutable, we should put it in NativeJITCode. Since NativeExecutable
2001 always has JITCode, we can safely query the value from NativeExecutable. This patch creates NativeDOMJITCode, which is a subclass of
2002 NativeJITCode, and instantiated only when DOMJIT::Signature* is given.
2004 3. Move Intrinsic to a member of ScriptExecutable or JITCode. Since JITCode has some paddings to put things, we can leverage this to put
2005 Intrinsic for NativeExecutable.
2007 We also move "clearCode" code from ExecutableBase to ScriptExecutable since it is only valid for ScriptExecutable subclasses.
2010 * JavaScriptCore.xcodeproj/project.pbxproj:
2011 * bytecode/CallVariant.h:
2012 * interpreter/Interpreter.cpp:
2014 (JSC::DirectJITCode::DirectJITCode):
2015 (JSC::NativeJITCode::NativeJITCode):
2016 (JSC::NativeDOMJITCode::NativeDOMJITCode):
2018 (JSC::JITCode::signature const):
2019 (JSC::JITCode::intrinsic):
2020 * jit/JITOperations.cpp:
2021 * jit/JITThunks.cpp:
2022 (JSC::JITThunks::hostFunctionStub):
2024 * llint/LLIntSlowPaths.cpp:
2025 * runtime/ExecutableBase.cpp:
2026 (JSC::ExecutableBase::dump const):
2027 (JSC::ExecutableBase::hashFor const):
2028 (JSC::ExecutableBase::hasClearableCode const): Deleted.
2029 (JSC::ExecutableBase::clearCode): Deleted.
2030 * runtime/ExecutableBase.h:
2031 (JSC::ExecutableBase::ExecutableBase):
2032 (JSC::ExecutableBase::isModuleProgramExecutable):
2033 (JSC::ExecutableBase::isHostFunction const):
2034 (JSC::ExecutableBase::generatedJITCodeForCall const):
2035 (JSC::ExecutableBase::generatedJITCodeForConstruct const):
2036 (JSC::ExecutableBase::generatedJITCodeFor const):
2037 (JSC::ExecutableBase::generatedJITCodeForCall): Deleted.
2038 (JSC::ExecutableBase::generatedJITCodeForConstruct): Deleted.
2039 (JSC::ExecutableBase::generatedJITCodeFor): Deleted.
2040 (JSC::ExecutableBase::offsetOfNumParametersFor): Deleted.
2041 (JSC::ExecutableBase::hasJITCodeForCall const): Deleted.
2042 (JSC::ExecutableBase::hasJITCodeForConstruct const): Deleted.
2043 (JSC::ExecutableBase::intrinsic const): Deleted.
2044 * runtime/ExecutableBaseInlines.h: Added.
2045 (JSC::ExecutableBase::intrinsic const):
2046 (JSC::ExecutableBase::hasJITCodeForCall const):
2047 (JSC::ExecutableBase::hasJITCodeForConstruct const):
2048 * runtime/JSBoundFunction.cpp:
2049 * runtime/JSType.cpp:
2050 (WTF::printInternal):
2052 * runtime/NativeExecutable.cpp:
2053 (JSC::NativeExecutable::create):
2054 (JSC::NativeExecutable::createStructure):
2055 (JSC::NativeExecutable::NativeExecutable):
2056 (JSC::NativeExecutable::signatureFor const):
2057 (JSC::NativeExecutable::intrinsic const):
2058 * runtime/NativeExecutable.h:
2059 * runtime/ScriptExecutable.cpp:
2060 (JSC::ScriptExecutable::ScriptExecutable):
2061 (JSC::ScriptExecutable::clearCode):
2062 (JSC::ScriptExecutable::installCode):
2063 (JSC::ScriptExecutable::hasClearableCode const):
2064 * runtime/ScriptExecutable.h:
2065 (JSC::ScriptExecutable::intrinsic const):
2066 (JSC::ScriptExecutable::hasJITCodeForCall const):
2067 (JSC::ScriptExecutable::hasJITCodeForConstruct const):
2069 (JSC::VM::getHostFunction):
2071 2019-02-06 Pablo Saavedra <psaavedra@igalia.com>
2073 Build failure after r240431
2074 https://bugs.webkit.org/show_bug.cgi?id=194330
2076 Reviewed by Žan Doberšek.
2078 * API/glib/JSCOptions.cpp:
2080 2019-02-05 Mark Lam <mark.lam@apple.com>
2082 Fix DFG's doesGC() for a few more nodes.
2083 https://bugs.webkit.org/show_bug.cgi?id=194307
2084 <rdar://problem/47832956>
2086 Reviewed by Yusuke Suzuki.
2088 Fix doesGC() for the following nodes:
2090 NumberToStringWithValidRadixConstant:
2091 Calls operationInt32ToStringWithValidRadix(), which calls int32ToString(),
2092 which can allocate a string.
2093 Calls operationInt52ToStringWithValidRadix(), which calls int52ToString(),
2094 which can allocate a string.
2095 Calls operationDoubleToStringWithValidRadix(), which calls numberToString(),
2096 which can allocate a string.
2098 RegExpExecNonGlobalOrSticky: calls createRegExpMatchesArray() which allocates
2099 memory for all kinds of objects.
2100 RegExpMatchFast: calls operationRegExpMatchFastString(), which calls
2101 RegExpObject::execInline() and RegExpObject::matchGlobal(). Both of
2102 these allocates memory for the match result.
2103 RegExpMatchFastGlobal: calls operationRegExpMatchFastGlobalString(), which
2104 calls RegExpObject's collectMatches(), which allocates an array amongst
2108 If the uint32 code to convert is greater than maxSingleCharacterString,
2109 we'll call operationStringFromCharCode(), which calls jsSingleCharacterString(),
2110 which allocates a new string if the code is greater than maxSingleCharacterString.
2112 Also fix SpeculativeJIT::compileFromCharCode() and FTL's compileStringFromCharCode()
2113 to use maxSingleCharacterString instead of a literal constant.
2115 * dfg/DFGDoesGC.cpp:
2117 * dfg/DFGSpeculativeJIT.cpp:
2118 (JSC::DFG::SpeculativeJIT::compileFromCharCode):
2119 * ftl/FTLLowerDFGToB3.cpp:
2120 (JSC::FTL::DFG::LowerDFGToB3::compileStringFromCharCode):
2122 2019-02-05 Keith Rollin <krollin@apple.com>
2124 Enable the automatic checking and regenerations of .xcfilelists during builds
2125 https://bugs.webkit.org/show_bug.cgi?id=194124
2126 <rdar://problem/47721277>
2128 Reviewed by Tim Horton.
2130 Bug 193790 add a facility for checking -- during build time -- that
2131 any needed .xcfilelist files are up-to-date and for updating them if
2132 they are not. This facility was initially opt-in by setting
2133 WK_ENABLE_CHECK_XCFILELISTS until other pieces were in place and until
2134 the process seemed robust. Its now time to enable this facility and
2135 make it opt-out. If there is a need to disable this facility, set and
2136 export WK_DISABLE_CHECK_XCFILELISTS=1 in your environment before
2137 running `make` or `build-webkit`, or before running Xcode from the
2140 Additionally, remove the step that generates a list of source files
2141 going into the UnifiedSources build step. It's only necessarily to
2142 specify Sources.txt and SourcesCocoa.txt as inputs.
2144 * JavaScriptCore.xcodeproj/project.pbxproj:
2145 * UnifiedSources-input.xcfilelist: Removed.
2147 2019-02-05 Keith Rollin <krollin@apple.com>
2149 Update .xcfilelist files
2150 https://bugs.webkit.org/show_bug.cgi?id=194121
2151 <rdar://problem/47720863>
2153 Reviewed by Tim Horton.
2155 Preparatory to enabling the facility for automatically updating the
2156 .xcfilelist files, check in a freshly-updated set so that not everyone
2157 runs up against having to regenerate them themselves.
2159 * DerivedSources-input.xcfilelist:
2160 * DerivedSources-output.xcfilelist:
2162 2019-02-05 Andy VanWagoner <andy@vanwagoner.family>
2164 [INTL] improve efficiency of Intl.NumberFormat formatToParts
2165 https://bugs.webkit.org/show_bug.cgi?id=185557
2167 Reviewed by Mark Lam.
2169 Since field nesting depth is minimal, this algorithm should be effectively O(n),
2170 where n is the number of characters in the formatted string.
2171 It may be less memory efficient than the previous impl, since the intermediate Vector
2172 is the length of the string, instead of the count of the fields.
2174 * runtime/IntlNumberFormat.cpp:
2175 (JSC::IntlNumberFormat::formatToParts):
2176 * runtime/IntlNumberFormat.h:
2178 2019-02-05 Mark Lam <mark.lam@apple.com>
2180 Move DFG nodes that clobberize() says will write(Heap) to the doesGC() list that returns true.
2181 https://bugs.webkit.org/show_bug.cgi?id=194298
2182 <rdar://problem/47827555>
2184 Reviewed by Saam Barati.
2186 We do this for 3 reasons:
2187 1. It's clearer when reading doesGC()'s code that these nodes will return true.
2188 2. If things change in the future where clobberize() no longer reports these nodes
2189 as write(Heap), each node should be vetted first to make sure that it can never
2190 GC before being moved back to the doesGC() list that returns false.
2191 3. This reduces the list of nodes that we need to audit to make sure doesGC() is
2192 correct in its claims about the nodes' GCing possibility.
2194 The list of nodes moved are:
2203 ConstructForwardVarargs
2206 DefineAccessorProperty
2211 DirectTailCallInlinedCaller
2222 HasStructureProperty
2228 NumberToStringWithRadix
2246 ResolveScopeForHoistingFuncDeclInEval
2248 TailCallForwardVarargsInlinedCaller
2249 TailCallInlinedCaller
2250 TailCallVarargsInlinedCaller
2255 * dfg/DFGDoesGC.cpp:
2258 2019-02-05 Yusuke Suzuki <ysuzuki@apple.com>
2260 [JSC] Shrink sizeof(UnlinkedCodeBlock)
2261 https://bugs.webkit.org/show_bug.cgi?id=194281
2263 Reviewed by Michael Saboff.
2265 This patch first attempts to reduce the size of UnlinkedCodeBlock in a relatively simpler way. Reordering members, remove unused member, and
2266 move rarely used members to RareData. This changes sizeof(UnlinkedCodeBlock) from 312 to 256.
2268 Still we have several chances to reduce sizeof(UnlinkedCodeBlock). Making more Vectors to RefCountedArrays can be done with some restructuring
2269 of generatorification phase. It would be possible to remove m_sourceURLDirective and m_sourceMappingURLDirective from UnlinkedCodeBlock since
2270 they should be in SourceProvider and that should be enough. These changes require some intrusive modifications and we make them as a future work.
2272 * bytecode/CodeBlock.cpp:
2273 (JSC::CodeBlock::finishCreation):
2274 * bytecode/CodeBlock.h:
2275 (JSC::CodeBlock::bitVectors const): Deleted.
2276 * bytecode/CodeType.h:
2277 * bytecode/UnlinkedCodeBlock.cpp:
2278 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
2279 (JSC::UnlinkedCodeBlock::shrinkToFit):
2280 * bytecode/UnlinkedCodeBlock.h:
2281 (JSC::UnlinkedCodeBlock::bitVector):
2282 (JSC::UnlinkedCodeBlock::addBitVector):
2283 (JSC::UnlinkedCodeBlock::addSetConstant):
2284 (JSC::UnlinkedCodeBlock::constantRegisters):
2285 (JSC::UnlinkedCodeBlock::numberOfConstantIdentifierSets const):
2286 (JSC::UnlinkedCodeBlock::constantIdentifierSets):
2287 (JSC::UnlinkedCodeBlock::codeType const):
2288 (JSC::UnlinkedCodeBlock::didOptimize const):
2289 (JSC::UnlinkedCodeBlock::setDidOptimize):
2290 (JSC::UnlinkedCodeBlock::usesGlobalObject const): Deleted.
2291 (JSC::UnlinkedCodeBlock::setGlobalObjectRegister): Deleted.
2292 (JSC::UnlinkedCodeBlock::globalObjectRegister const): Deleted.
2293 (JSC::UnlinkedCodeBlock::bitVectors const): Deleted.
2294 * bytecompiler/BytecodeGenerator.cpp:
2295 (JSC::BytecodeGenerator::emitLoad):
2296 (JSC::BytecodeGenerator::emitLoadGlobalObject): Deleted.
2297 * bytecompiler/BytecodeGenerator.h:
2298 * runtime/CachedTypes.cpp:
2299 (JSC::CachedCodeBlockRareData::encode):
2300 (JSC::CachedCodeBlockRareData::decode const):
2301 (JSC::CachedCodeBlock::scopeRegister const):
2302 (JSC::CachedCodeBlock::codeType const):
2303 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
2304 (JSC::CachedCodeBlock<CodeBlockType>::decode const):
2305 (JSC::CachedCodeBlock<CodeBlockType>::encode):
2306 (JSC::CachedCodeBlock::globalObjectRegister const): Deleted.
2308 2019-02-04 Yusuke Suzuki <ysuzuki@apple.com>
2310 Unreviewed, add missing exception checks after r240637
2311 https://bugs.webkit.org/show_bug.cgi?id=193546
2313 * tools/JSDollarVM.cpp:
2314 (JSC::functionShadowChickenFunctionsOnStack):
2316 2019-02-04 Yusuke Suzuki <ysuzuki@apple.com>
2318 [JSC] Shrink size of VM by lazily allocating IsoSubspaces for non-common types
2319 https://bugs.webkit.org/show_bug.cgi?id=193993
2321 Reviewed by Keith Miller.
2323 JSC::VM has a lot of IsoSubspaces, and each takes 504B. This unnecessarily makes VM so large.
2324 And some of them are rarely used. We should allocate it lazily.
2326 In this patch, we make some `IsoSubspaces` `std::unique_ptr<IsoSubspace>`. And we add ensureXXXSpace
2327 functions which allocate IsoSubspaces lazily. This function is used by subspaceFor<> in each class.
2328 And we also add subspaceForConcurrently<> function, which is called from concurrent JIT tiers. This
2329 returns nullptr if the subspace is not allocated yet. JSCell::subspaceFor now takes second template
2330 parameter which tells the function whether subspaceFor is concurrently done. If the IsoSubspace is
2331 lazily created, we may return nullptr for the concurrent access. We ensure the space's initialization
2332 by using WTF::storeStoreFence when lazily allocating it.
2334 In GC's constraint solving, we may touch these lazily allocated spaces. At that time, we check the
2335 existence of the space before touching this. This is not racy because the main thread is stopped when
2336 the constraint solving is working.
2338 This changes sizeof(VM) from 64736 to 56472.
2340 Another interesting thing is that we removed `PreventCollectionScope preventCollectionScope(heap);` in
2341 `Subspace::initialize`. This is really dangerous API since it easily causes dead-lock between the
2342 collector and the mutator if IsoSubspace is dynamically created. We do want to make IsoSubspaces
2343 dynamically-created ones since the requirement of the pre-allocation poses a scalability problem
2344 of IsoSubspace adoption because IsoSubspace is large. Registered Subspace is only touched in the
2345 EndPhase, and the peripheries should be stopped when running EndPhase. Thus, as long as the main thread
2346 can run this IsoSubspace code, the collector is never EndPhase. So this is safe.
2348 * API/JSCallbackFunction.h:
2349 * API/ObjCCallbackFunction.h:
2350 (JSC::ObjCCallbackFunction::subspaceFor):
2351 * API/glib/JSCCallbackFunction.h:
2353 * JavaScriptCore.xcodeproj/project.pbxproj:
2354 * bytecode/CodeBlock.cpp:
2355 (JSC::CodeBlock::visitChildren):
2356 (JSC::CodeBlock::finalizeUnconditionally):
2357 * bytecode/CodeBlock.h:
2358 * bytecode/EvalCodeBlock.h:
2359 * bytecode/ExecutableToCodeBlockEdge.h:
2360 * bytecode/FunctionCodeBlock.h:
2361 * bytecode/ModuleProgramCodeBlock.h:
2362 * bytecode/ProgramCodeBlock.h:
2363 * bytecode/UnlinkedFunctionExecutable.cpp:
2364 (JSC::UnlinkedFunctionExecutable::unlinkedCodeBlockFor):
2365 * bytecode/UnlinkedFunctionExecutable.h:
2366 * dfg/DFGSpeculativeJIT.cpp:
2367 (JSC::DFG::SpeculativeJIT::emitAllocateRawObject):
2368 (JSC::DFG::SpeculativeJIT::compileMakeRope):
2369 (JSC::DFG::SpeculativeJIT::compileNewObject):
2370 * ftl/FTLLowerDFGToB3.cpp:
2371 (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope):
2372 (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject):
2373 (JSC::FTL::DFG::LowerDFGToB3::allocateObject):
2374 (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedObject):
2375 (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedCell):
2377 (JSC::Heap::finalizeUnconditionalFinalizers):
2378 (JSC::Heap::deleteAllCodeBlocks):
2379 (JSC::Heap::deleteAllUnlinkedCodeBlocks):
2380 (JSC::Heap::addCoreConstraints):
2381 * heap/Subspace.cpp:
2382 (JSC::Subspace::initialize):
2383 * jit/AssemblyHelpers.h:
2384 (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize):
2385 (JSC::AssemblyHelpers::emitAllocateVariableSizedCell):
2386 * jit/JITOpcodes.cpp:
2387 (JSC::JIT::emit_op_new_object):
2388 * jit/JITOpcodes32_64.cpp:
2389 (JSC::JIT::emit_op_new_object):
2390 * runtime/DirectArguments.h:
2391 * runtime/DirectEvalExecutable.h:
2392 * runtime/ErrorInstance.h:
2393 (JSC::ErrorInstance::subspaceFor):
2394 * runtime/ExecutableBase.h:
2395 * runtime/FunctionExecutable.h:
2396 * runtime/IndirectEvalExecutable.h:
2397 * runtime/InferredValue.cpp:
2398 (JSC::InferredValue::visitChildren):
2399 * runtime/InferredValue.h:
2400 * runtime/InferredValueInlines.h:
2401 (JSC::InferredValue::finalizeUnconditionally):
2402 * runtime/InternalFunction.h:
2403 * runtime/JSAsyncFunction.h:
2404 * runtime/JSAsyncGeneratorFunction.h:
2405 * runtime/JSBoundFunction.h:
2408 (JSC::subspaceForConcurrently):
2409 * runtime/JSCellInlines.h:
2410 (JSC::allocatorForNonVirtualConcurrently):
2411 * runtime/JSCustomGetterSetterFunction.h:
2412 * runtime/JSDestructibleObject.h:
2413 * runtime/JSFunction.h:
2414 * runtime/JSGeneratorFunction.h:
2415 * runtime/JSImmutableButterfly.h:
2416 * runtime/JSLexicalEnvironment.h:
2417 (JSC::JSLexicalEnvironment::subspaceFor):
2418 * runtime/JSNativeStdFunction.h:
2419 * runtime/JSSegmentedVariableObject.h:
2420 * runtime/JSString.h:
2421 * runtime/ModuleProgramExecutable.h:
2422 * runtime/NativeExecutable.h:
2423 * runtime/ProgramExecutable.h:
2424 * runtime/PropertyMapHashTable.h:
2425 * runtime/ProxyRevoke.h:
2426 * runtime/ScopedArguments.h:
2427 * runtime/ScriptExecutable.cpp:
2428 (JSC::ScriptExecutable::clearCode):
2429 (JSC::ScriptExecutable::installCode):
2430 * runtime/Structure.h:
2431 * runtime/StructureRareData.h:
2432 * runtime/SubspaceAccess.h: Copied from Source/JavaScriptCore/runtime/InferredValueInlines.h.
2436 (JSC::VM::SpaceAndSet::SpaceAndSet):
2437 (JSC::VM::SpaceAndSet::setFor):
2438 (JSC::VM::forEachScriptExecutableSpace):
2439 (JSC::VM::SpaceAndFinalizerSet::SpaceAndFinalizerSet): Deleted.
2440 (JSC::VM::SpaceAndFinalizerSet::finalizerSetFor): Deleted.
2441 (JSC::VM::ScriptExecutableSpaceAndSet::ScriptExecutableSpaceAndSet): Deleted.
2442 (JSC::VM::ScriptExecutableSpaceAndSet::clearableCodeSetFor): Deleted.
2443 (JSC::VM::UnlinkedFunctionExecutableSpaceAndSet::UnlinkedFunctionExecutableSpaceAndSet): Deleted.
2444 (JSC::VM::UnlinkedFunctionExecutableSpaceAndSet::clearableCodeSetFor): Deleted.
2445 * runtime/WeakMapImpl.h:
2446 (JSC::WeakMapImpl::subspaceFor):
2447 * wasm/js/JSWebAssemblyCodeBlock.h:
2448 * wasm/js/JSWebAssemblyMemory.h:
2449 * wasm/js/WebAssemblyFunction.h:
2450 * wasm/js/WebAssemblyWrapperFunction.h:
2452 2019-02-04 Keith Miller <keith_miller@apple.com>
2454 Change llint operand macros to inline functions
2455 https://bugs.webkit.org/show_bug.cgi?id=194248
2457 Reviewed by Mark Lam.
2459 * llint/LLIntSlowPaths.cpp:
2460 (JSC::LLInt::getNonConstantOperand):
2461 (JSC::LLInt::getOperand):
2462 (JSC::LLInt::llint_trace_value):
2463 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
2464 (JSC::LLInt::getByVal):
2465 (JSC::LLInt::genericCall):
2466 (JSC::LLInt::varargsSetup):
2467 (JSC::LLInt::commonCallEval):
2469 2019-02-04 Robin Morisset <rmorisset@apple.com>
2471 when lowering AssertNotEmpty, create the value before creating the patchpoint
2472 https://bugs.webkit.org/show_bug.cgi?id=194231
2474 Reviewed by Saam Barati.
2476 This is a very simple change: we should never generate B3 IR where an instruction depends on a value that comes later in the instruction stream.
2477 AssertNotEmpty was generating some such IR, it probably slipped through until now because it is a rather rare and tricky instruction to generate.
2479 * ftl/FTLLowerDFGToB3.cpp:
2480 (JSC::FTL::DFG::LowerDFGToB3::compileAssertNotEmpty):
2482 2019-02-04 Yusuke Suzuki <ysuzuki@apple.com>
2484 [JSC] ExecutableToCodeBlockEdge should be smaller
2485 https://bugs.webkit.org/show_bug.cgi?id=194244
2487 Reviewed by Michael Saboff.
2489 ExecutableToCodeBlockEdge is allocated so many times. However its memory layout is not efficient.
2490 sizeof(ExecutableToCodeBlockEdge) is 24bytes, but it discards 7bytes due to one bool m_isActive flag.
2491 Because our size classes are rounded by 16bytes, ExecutableToCodeBlockEdge takes 32bytes. So, half of
2492 it is wasted. We should fit it into 16bytes so that we can efficiently allocate it.
2494 In this patch, we leverages TypeInfoMayBePrototype bit in JSTypeInfo. It is a bit special TypeInfo bit
2495 since this is per-cell bit. We rename this to TypeInfoPerCellBit, and use it as a `m_isActive` mark in
2496 ExecutableToCodeBlockEdge. In JSObject subclasses, we use it as MayBePrototype flag.
2498 Since this flag is not changed in CAS style, we must not change this in concurrent threads. This is OK
2499 for ExecutableToCodeBlockEdge's m_isActive flag since this is touched on the main thread (ScriptExecutable::installCode
2500 does not touch it if it is called in non-main threads).
2502 * bytecode/ExecutableToCodeBlockEdge.cpp:
2503 (JSC::ExecutableToCodeBlockEdge::finishCreation):
2504 (JSC::ExecutableToCodeBlockEdge::visitChildren):
2505 (JSC::ExecutableToCodeBlockEdge::activate):
2506 (JSC::ExecutableToCodeBlockEdge::deactivate):
2507 (JSC::ExecutableToCodeBlockEdge::isActive const):
2508 * bytecode/ExecutableToCodeBlockEdge.h:
2510 * runtime/JSCellInlines.h:
2511 (JSC::JSCell::perCellBit const):
2512 (JSC::JSCell::setPerCellBit):
2513 (JSC::JSCell::mayBePrototype const): Deleted.
2514 (JSC::JSCell::didBecomePrototype): Deleted.
2515 * runtime/JSObject.cpp:
2516 (JSC::JSObject::setPrototypeDirect):
2517 * runtime/JSObject.h:
2518 * runtime/JSObjectInlines.h:
2519 (JSC::JSObject::mayBePrototype const):
2520 (JSC::JSObject::didBecomePrototype):
2521 * runtime/JSTypeInfo.h:
2522 (JSC::TypeInfo::perCellBit):
2523 (JSC::TypeInfo::mergeInlineTypeFlags):
2524 (JSC::TypeInfo::mayBePrototype): Deleted.
2526 2019-02-04 Yusuke Suzuki <ysuzuki@apple.com>
2528 [JSC] Shrink size of FunctionExecutable
2529 https://bugs.webkit.org/show_bug.cgi?id=194191
2531 Reviewed by Michael Saboff.
2533 This patch reduces the size of FunctionExecutable. Since it is allocated in IsoSubspace, reducing the size directly
2534 improves the allocation efficiency.
2536 1. ScriptExecutable (base class of FunctionExecutable) has several members, but it is meaningful only in FunctionExecutable.
2537 We remove this from ScriptExecutable, and move it to FunctionExecutable.
2539 2. FunctionExecutable has several data which are rarely used. One for FunctionOverrides functionality, which is typically
2540 used for JSC debugging purpose, and another is TypeSet and offsets for type profiler. We move them to RareData and reduce
2541 the size of FunctionExecutable in the common case.
2543 This patch changes the size of FunctionExecutable from 176 to 144.
2545 * bytecode/CodeBlock.cpp:
2546 (JSC::CodeBlock::dumpSource):
2547 (JSC::CodeBlock::finishCreation):
2549 (JSC::DFG::Node::OpInfoWrapper::as const):
2550 * interpreter/StackVisitor.cpp:
2551 (JSC::StackVisitor::Frame::computeLineAndColumn const):
2552 * runtime/ExecutableBase.h:
2553 * runtime/FunctionExecutable.cpp:
2554 (JSC::FunctionExecutable::FunctionExecutable):
2555 (JSC::FunctionExecutable::ensureRareDataSlow):
2556 * runtime/FunctionExecutable.h:
2557 * runtime/Intrinsic.h:
2558 * runtime/ModuleProgramExecutable.cpp:
2559 (JSC::ModuleProgramExecutable::ModuleProgramExecutable):
2560 * runtime/ProgramExecutable.cpp:
2561 (JSC::ProgramExecutable::ProgramExecutable):
2562 * runtime/ScriptExecutable.cpp:
2563 (JSC::ScriptExecutable::ScriptExecutable):
2564 (JSC::ScriptExecutable::overrideLineNumber const):
2565 (JSC::ScriptExecutable::typeProfilingStartOffset const):
2566 (JSC::ScriptExecutable::typeProfilingEndOffset const):
2567 * runtime/ScriptExecutable.h:
2568 (JSC::ScriptExecutable::firstLine const):
2569 (JSC::ScriptExecutable::setOverrideLineNumber): Deleted.
2570 (JSC::ScriptExecutable::hasOverrideLineNumber const): Deleted.
2571 (JSC::ScriptExecutable::overrideLineNumber const): Deleted.
2572 (JSC::ScriptExecutable::typeProfilingStartOffset const): Deleted.
2573 (JSC::ScriptExecutable::typeProfilingEndOffset const): Deleted.
2574 * runtime/StackFrame.cpp:
2575 (JSC::StackFrame::computeLineAndColumn const):
2576 * tools/JSDollarVM.cpp:
2577 (JSC::functionReturnTypeFor):
2579 2019-02-04 Mark Lam <mark.lam@apple.com>
2581 DFG's doesGC() is incorrect about the SameValue node's behavior.
2582 https://bugs.webkit.org/show_bug.cgi?id=194211
2583 <rdar://problem/47608913>
2585 Reviewed by Saam Barati.
2587 Only the DoubleRepUse case is guaranteed to not GC. The other case may GC because
2588 it calls operationSameValue() which may allocate memory for resolving ropes.
2590 * dfg/DFGDoesGC.cpp:
2593 2019-02-03 Yusuke Suzuki <ysuzuki@apple.com>
2595 [JSC] UnlinkedMetadataTable assumes that MetadataTable is destroyed before it is destructed, but order of destruction of JS heap cells are not guaranteed
2596 https://bugs.webkit.org/show_bug.cgi?id=194031
2598 Reviewed by Saam Barati.
2600 UnlinkedMetadataTable assumes that MetadataTable linked against this UnlinkedMetadataTable is already destroyed when UnlinkedMetadataTable is destroyed.
2601 This means that UnlinkedCodeBlock is destroyed after all the linked CodeBlocks are destroyed. But this assumption is not valid since GC's finalizer
2602 sweeps objects without considering the dependencies among swept objects. UnlinkedMetadataTable can be destroyed even before linked MetadataTable is
2603 destroyed if UnlinkedCodeBlock is destroyed before linked CodeBlock is destroyed.
2605 To make the above assumption valid, we make UnlinkedMetadataTable RefCounted object, and make MetadataTable hold the strong ref to UnlinkedMetadataTable.
2606 This ensures that UnlinkedMetadataTable is destroyed after all the linked MetadataTables are destroyed.
2608 * bytecode/MetadataTable.cpp:
2609 (JSC::MetadataTable::MetadataTable):
2610 (JSC::MetadataTable::~MetadataTable):
2611 * bytecode/UnlinkedCodeBlock.cpp:
2612 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
2613 (JSC::UnlinkedCodeBlock::visitChildren):
2614 (JSC::UnlinkedCodeBlock::estimatedSize):
2615 (JSC::UnlinkedCodeBlock::setInstructions):
2616 * bytecode/UnlinkedCodeBlock.h:
2617 (JSC::UnlinkedCodeBlock::metadata):
2618 (JSC::UnlinkedCodeBlock::metadataSizeInBytes):
2619 * bytecode/UnlinkedMetadataTable.h:
2620 (JSC::UnlinkedMetadataTable::create):
2621 * bytecode/UnlinkedMetadataTableInlines.h:
2622 (JSC::UnlinkedMetadataTable::UnlinkedMetadataTable):
2623 * runtime/CachedTypes.cpp:
2624 (JSC::CachedMetadataTable::decode const):
2625 (JSC::CachedCodeBlock::metadata const):
2626 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
2627 (JSC::CachedCodeBlock<CodeBlockType>::decode const):
2628 (JSC::CachedCodeBlock<CodeBlockType>::encode):
2630 2019-02-01 Yusuke Suzuki <ysuzuki@apple.com>
2632 [JSC] Decouple JIT related data from CodeBlock
2633 https://bugs.webkit.org/show_bug.cgi?id=194187
2635 Reviewed by Saam Barati.
2637 CodeBlock holds bunch of data which is only used after JIT starts compiling it.
2638 We have three types of data in CodeBlock.
2640 1. The data which is always used. CodeBlock needs to hold it.
2641 2. The data which is touched even in LLInt, but it is only meaningful in JIT tiers. The example is profiling.
2642 3. The data which is used after the JIT compiler starts running for the given CodeBlock.
2644 This patch decouples (3) from CodeBlock as CodeBlock::JITData. Even if we have bunch of CodeBlocks, only small
2645 number of them gets JIT compilation. Always allocating (3) data enlarges the size of CodeBlock, leading to the
2646 memory waste. Potentially we can decouple (2) in another data structure, but we first do (3) since (3) is beneficial
2647 in both non-JIT and *JIT* modes.
2649 JITData is created only when JIT compiler wants to use it. So it can be concurrently created and used, so it is guarded
2650 by the lock of CodeBlock.
2652 The size of CodeBlock is reduced from 512 to 352.
2654 This patch improves memory footprint and gets 1.1% improvement in RAMification.
2656 Footprint geomean: 36696503 (34.997 MB)
2657 Peak Footprint geomean: 38595988 (36.808 MB)
2658 Score: 37634263 (35.891 MB)
2660 Footprint geomean: 37172768 (35.451 MB)
2661 Peak Footprint geomean: 38978288 (37.173 MB)
2662 Score: 38064824 (36.301 MB)
2664 * bytecode/CodeBlock.cpp:
2665 (JSC::CodeBlock::~CodeBlock):
2666 (JSC::CodeBlock::propagateTransitions):
2667 (JSC::CodeBlock::ensureJITDataSlow):
2668 (JSC::CodeBlock::finalizeBaselineJITInlineCaches):
2669 (JSC::CodeBlock::getICStatusMap):
2670 (JSC::CodeBlock::addStubInfo):
2671 (JSC::CodeBlock::addJITAddIC):
2672 (JSC::CodeBlock::addJITMulIC):
2673 (JSC::CodeBlock::addJITSubIC):
2674 (JSC::CodeBlock::addJITNegIC):
2675 (JSC::CodeBlock::findStubInfo):
2676 (JSC::CodeBlock::addByValInfo):
2677 (JSC::CodeBlock::addCallLinkInfo):
2678 (JSC::CodeBlock::getCallLinkInfoForBytecodeIndex):
2679 (JSC::CodeBlock::addRareCaseProfile):
2680 (JSC::CodeBlock::rareCaseProfileForBytecodeOffset):
2681 (JSC::CodeBlock::rareCaseProfileCountForBytecodeOffset):
2682 (JSC::CodeBlock::resetJITData):
2683 (JSC::CodeBlock::stronglyVisitStrongReferences):
2684 (JSC::CodeBlock::shrinkToFit):
2685 (JSC::CodeBlock::linkIncomingCall):
2686 (JSC::CodeBlock::linkIncomingPolymorphicCall):
2687 (JSC::CodeBlock::unlinkIncomingCalls):
2688 (JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
2689 (JSC::CodeBlock::dumpValueProfiles):
2690 (JSC::CodeBlock::setPCToCodeOriginMap):
2691 (JSC::CodeBlock::findPC):
2692 (JSC::CodeBlock::dumpMathICStats):
2693 * bytecode/CodeBlock.h:
2694 (JSC::CodeBlock::ensureJITData):
2695 (JSC::CodeBlock::setJITCodeMap):
2696 (JSC::CodeBlock::jitCodeMap):
2697 (JSC::CodeBlock::likelyToTakeSlowCase):
2698 (JSC::CodeBlock::couldTakeSlowCase):
2699 (JSC::CodeBlock::lazyOperandValueProfiles):
2700 (JSC::CodeBlock::stubInfoBegin): Deleted.
2701 (JSC::CodeBlock::stubInfoEnd): Deleted.
2702 (JSC::CodeBlock::callLinkInfosBegin): Deleted.
2703 (JSC::CodeBlock::callLinkInfosEnd): Deleted.
2704 (JSC::CodeBlock::jitCodeMap const): Deleted.
2705 (JSC::CodeBlock::numberOfRareCaseProfiles): Deleted.
2706 * bytecode/MethodOfGettingAValueProfile.cpp:
2707 (JSC::MethodOfGettingAValueProfile::emitReportValue const):
2708 (JSC::MethodOfGettingAValueProfile::reportValue):
2709 * dfg/DFGByteCodeParser.cpp:
2710 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
2712 * jit/JITOperations.cpp:
2713 (JSC::tryGetByValOptimize):
2714 * jit/JITPropertyAccess.cpp:
2715 (JSC::JIT::privateCompileGetByVal):
2716 (JSC::JIT::privateCompilePutByVal):
2718 2018-12-16 Darin Adler <darin@apple.com>
2720 Convert additional String::format clients to alternative approaches
2721 https://bugs.webkit.org/show_bug.cgi?id=192746
2723 Reviewed by Alexey Proskuryakov.
2725 * inspector/agents/InspectorConsoleAgent.cpp:
2726 (Inspector::InspectorConsoleAgent::stopTiming): Use makeString
2727 and FormattedNumber::fixedWidth.
2729 2019-02-01 Yusuke Suzuki <ysuzuki@apple.com>
2731 [JSC] Remove some of IsoSubspaces for JSFunction subclasses
2732 https://bugs.webkit.org/show_bug.cgi?id=194177
2734 Reviewed by Saam Barati.
2736 JSGeneratorFunction, JSAsyncFunction, and JSAsyncGeneratorFunction do not add any fields / classInfo methods.
2737 We can share the IsoSubspace for JSFunction.
2739 * runtime/JSAsyncFunction.h:
2740 * runtime/JSAsyncGeneratorFunction.h:
2741 * runtime/JSGeneratorFunction.h:
2746 2019-02-01 Mark Lam <mark.lam@apple.com>
2748 Remove invalid assertion in DFG's compileDoubleRep().
2749 https://bugs.webkit.org/show_bug.cgi?id=194130
2750 <rdar://problem/47699474>
2752 Reviewed by Saam Barati.
2754 * dfg/DFGSpeculativeJIT.cpp:
2755 (JSC::DFG::SpeculativeJIT::compileDoubleRep):
2757 2019-02-01 Yusuke Suzuki <ysuzuki@apple.com>
2759 [JSC] Unify CodeBlock IsoSubspaces
2760 https://bugs.webkit.org/show_bug.cgi?id=194167
2762 Reviewed by Saam Barati.
2764 When we move CodeBlock into its IsoSubspace, we create IsoSubspaces for each subclass of CodeBlock.
2765 But this is not necessary since,
2767 1. They do not override the classInfo methods.
2768 2. sizeof(ProgramCodeBlock etc.) == sizeof(CodeBlock) since subclasses adds no additional fields.
2770 Creating IsoSubspace for each subclass is costly in terms of memory. Especially, IsoSubspace for
2771 ProgramCodeBlock is. We typically create only one ProgramCodeBlock, and it means the rest of the
2772 MarkedBlock (16KB - sizeof(footer) - sizeof(ProgramCodeBlock)) is just wasted.
2774 This patch unifies these IsoSubspaces into one.
2776 * bytecode/CodeBlock.cpp:
2777 (JSC::CodeBlock::destroy):
2778 * bytecode/CodeBlock.h:
2779 * bytecode/EvalCodeBlock.cpp:
2780 (JSC::EvalCodeBlock::destroy): Deleted.
2781 * bytecode/EvalCodeBlock.h: We drop some utility functions in EvalCodeBlock and use UnlinkedEvalCodeBlock's one directly.
2782 * bytecode/FunctionCodeBlock.cpp:
2783 (JSC::FunctionCodeBlock::destroy): Deleted.
2784 * bytecode/FunctionCodeBlock.h:
2785 * bytecode/GlobalCodeBlock.h:
2786 * bytecode/ModuleProgramCodeBlock.cpp:
2787 (JSC::ModuleProgramCodeBlock::destroy): Deleted.
2788 * bytecode/ModuleProgramCodeBlock.h:
2789 * bytecode/ProgramCodeBlock.cpp:
2790 (JSC::ProgramCodeBlock::destroy): Deleted.
2791 * bytecode/ProgramCodeBlock.h:
2792 * interpreter/Interpreter.cpp:
2793 (JSC::Interpreter::execute):
2797 (JSC::VM::forEachCodeBlockSpace):
2799 2019-02-01 Yusuke Suzuki <ysuzuki@apple.com>
2801 Unreviewed, follow-up after r240859
2802 https://bugs.webkit.org/show_bug.cgi?id=194145
2804 Replace OOB HeapCellType with cellHeapCellType since they are completely the same.
2805 And rename cellDangerousBitsSpace back to cellSpace.
2807 * runtime/JSCellInlines.h:
2808 (JSC::JSCell::subspaceFor):
2813 2019-02-01 Yusuke Suzuki <ysuzuki@apple.com>
2815 [JSC] Remove cellJSValueOOBSpace
2816 https://bugs.webkit.org/show_bug.cgi?id=194145
2818 Reviewed by Mark Lam.
2820 * runtime/JSObject.h:
2821 (JSC::JSObject::subspaceFor): Deleted.
2826 2019-01-31 Mark Lam <mark.lam@apple.com>
2828 Remove poisoning from CodeBlock and LLInt code.
2829 https://bugs.webkit.org/show_bug.cgi?id=194113
2831 Reviewed by Yusuke Suzuki.
2833 * bytecode/CodeBlock.cpp:
2834 (JSC::CodeBlock::CodeBlock):
2835 (JSC::CodeBlock::~CodeBlock):
2836 (JSC::CodeBlock::setConstantRegisters):
2837 (JSC::CodeBlock::propagateTransitions):
2838 (JSC::CodeBlock::finalizeLLIntInlineCaches):
2839 (JSC::CodeBlock::jettison):
2840 (JSC::CodeBlock::predictedMachineCodeSize):
2841 * bytecode/CodeBlock.h:
2842 (JSC::CodeBlock::vm const):
2843 (JSC::CodeBlock::addConstant):
2844 (JSC::CodeBlock::heap const):
2845 (JSC::CodeBlock::replaceConstant):
2846 * llint/LLIntOfflineAsmConfig.h:
2847 * llint/LLIntSlowPaths.cpp:
2848 (JSC::LLInt::handleHostCall):
2849 (JSC::LLInt::setUpCall):
2850 * llint/LowLevelInterpreter.asm:
2851 * llint/LowLevelInterpreter32_64.asm:
2852 * llint/LowLevelInterpreter64.asm:
2854 2019-01-31 Yusuke Suzuki <ysuzuki@apple.com>
2856 [JSC] Remove finalizer in AsyncFromSyncIteratorPrototype
2857 https://bugs.webkit.org/show_bug.cgi?id=194107
2859 Reviewed by Saam Barati.
2861 AsyncFromSyncIteratorPrototype uses the finalizer, but it is not necessary since it does not hold any objects which require destruction.
2862 We drop this finalizer. And we also make methods of AsyncFromSyncIteratorPrototype lazily allocated.
2865 * DerivedSources.make:
2866 * JavaScriptCore.xcodeproj/project.pbxproj:
2867 * runtime/AsyncFromSyncIteratorPrototype.cpp:
2868 (JSC::AsyncFromSyncIteratorPrototype::AsyncFromSyncIteratorPrototype):
2869 (JSC::AsyncFromSyncIteratorPrototype::finishCreation):
2870 (JSC::AsyncFromSyncIteratorPrototype::create):
2871 * runtime/AsyncFromSyncIteratorPrototype.h:
2873 2019-01-31 Tadeu Zagallo <tzagallo@apple.com>
2875 Fix `runJITThreadLimitTests` in testapi
2876 https://bugs.webkit.org/show_bug.cgi?id=194064
2877 <rdar://problem/46139147>
2879 Reviewed by Mark Lam.
2881 Fix typo where `targetNumberOfThreads` was not being used.
2883 * API/tests/testapi.mm:
2884 (runJITThreadLimitTests):
2886 2019-01-31 Tadeu Zagallo <tzagallo@apple.com>
2888 testapi fails RELEASE_ASSERT(codeBlock) in fetchFromDisk() of CodeCache.h
2889 https://bugs.webkit.org/show_bug.cgi?id=194112
2891 Reviewed by Mark Lam.
2893 `testBytecodeCache` does not populate the bytecode cache for the global
2894 CodeBlock, so it should only enable `forceDiskCache` after its execution.
2896 * API/tests/testapi.mm:
2897 (testBytecodeCache):
2899 2019-01-31 Yusuke Suzuki <ysuzuki@apple.com>
2901 Unreviewed, follow-up after r240796
2903 Initialize WriteBarrier<InferredValue> in the constructor. Otherwise, GC can see the broken one
2904 when allocating InferredValue in FunctionExecutable::finishCreation.
2906 * runtime/FunctionExecutable.cpp:
2907 (JSC::FunctionExecutable::FunctionExecutable):
2908 (JSC::FunctionExecutable::finishCreation):
2910 2019-01-31 Yusuke Suzuki <ysuzuki@apple.com>
2912 [JSC] Do not use InferredValue in non-JIT configuration
2913 https://bugs.webkit.org/show_bug.cgi?id=194084
2915 Reviewed by Saam Barati.
2917 InferredValue is not meaningful if our VM is non-JIT configuration. InferredValue is used to watch the instantiation of the FunctionExecutable's
2918 JSFunction and SymbolTable's JSScope to explore the chance of folding them into constants in DFG and FTL. If it is instantiated only once, we can
2919 put a watchpoint and fold it into this constant. But if JIT is disabled, we do not need to care it.
2920 Even in non-JIT configuration, we still use InferredValue for FunctionExecutable to determine whether the given FunctionExecutable is preferable
2921 target for poly proto. If JSFunction for the FunctionExecutable is used as a constructor and instantiated more than once, poly proto Structure
2922 seems appropriate for objects created by this JSFunction. But at that time, only thing we would like to know is that whether JSFunction for this
2923 FunctionExecutable is instantiated multiple times. This does not require the full feature of InferredValue, WatchpointState is enough.
2924 To summarize, since nobody uses InferredValue feature in non-JIT configuration, we should not create it.
2926 * bytecode/ObjectAllocationProfileInlines.h:
2927 (JSC::ObjectAllocationProfile::initializeProfile):
2928 * runtime/FunctionExecutable.cpp:
2929 (JSC::FunctionExecutable::finishCreation):
2930 (JSC::FunctionExecutable::visitChildren):
2931 * runtime/FunctionExecutable.h:
2932 * runtime/InferredValue.cpp:
2933 (JSC::InferredValue::create):
2934 * runtime/JSAsyncFunction.cpp:
2935 (JSC::JSAsyncFunction::create):
2936 * runtime/JSAsyncGeneratorFunction.cpp:
2937 (JSC::JSAsyncGeneratorFunction::create):
2938 * runtime/JSFunction.cpp:
2939 (JSC::JSFunction::create):
2940 * runtime/JSFunctionInlines.h:
2941 (JSC::JSFunction::createWithInvalidatedReallocationWatchpoint):
2942 * runtime/JSGeneratorFunction.cpp:
2943 (JSC::JSGeneratorFunction::create):
2944 * runtime/JSSymbolTableObject.h:
2945 (JSC::JSSymbolTableObject::setSymbolTable):
2946 * runtime/SymbolTable.cpp:
2947 (JSC::SymbolTable::finishCreation):
2951 2019-01-31 Fujii Hironori <Hironori.Fujii@sony.com>
2953 [CMake][JSC] Changing ud_opcode.py should trigger invoking ud_opcode.py
2954 https://bugs.webkit.org/show_bug.cgi?id=194085
2956 Reviewed by Yusuke Suzuki.
2958 r240730 changed ud_itab.py and caused incremental build failures
2961 * CMakeLists.txt: Added ud_itab.py and optable.xml to UDIS_GEN_DEP.
2963 2019-01-30 Yusuke Suzuki <ysuzuki@apple.com>
2965 [JSC] Symbol should be in destructibleCellSpace
2966 https://bugs.webkit.org/show_bug.cgi?id=194082
2968 Reviewed by Saam Barati.
2970 Because Symbol's member was not poisoned, we changed the subspace for Symbol from destructibleCellSpace
2971 to cellJSValueOOBSpace. But the problem is cellJSValueOOBSpace is a space for cells which are not
2972 destructible. As a result, Symbol::destroy is never called, and SymbolImpl is leaked. This patch makes
2973 Symbol's space destructibleCellSpace to appropriately call the destructor.
2977 2019-01-30 Michael Catanzaro <mcatanzaro@igalia.com>
2979 Unreviewed, rolling out r240755.
2981 This was not correct
2985 "Unreviewed, fix GCC build after r240730"
2986 https://bugs.webkit.org/show_bug.cgi?id=194041
2987 https://trac.webkit.org/changeset/240755
2989 2019-01-30 Michael Catanzaro <mcatanzaro@igalia.com>
2991 Unreviewed, fix GCC build after r240730
2992 https://bugs.webkit.org/show_bug.cgi?id=194041
2993 <rdar://problem/47680981>
2995 * disassembler/udis86/ud_itab.py:
2996 (UdItabGenerator.genOpcodeTablesLookupIndex):
2998 2019-01-30 Tadeu Zagallo <tzagallo@apple.com>
3000 testapi's `testBytecodeCache` does not need to run the code twice
3001 https://bugs.webkit.org/show_bug.cgi?id=194046
3003 Reviewed by Mark Lam.
3005 Since we populate the cache eagerly (unlike the stress tests) we don't
3006 need to run the code twice.
3008 * API/tests/testapi.mm:
3009 (testBytecodeCache):
3011 2019-01-30 Saam barati <sbarati@apple.com>
3013 [WebAssembly] Change BBQ to generate Air IR
3014 https://bugs.webkit.org/show_bug.cgi?id=191802
3015 <rdar://problem/47651718>
3017 Reviewed by Keith Miller.
3019 This patch adds a new Wasm compiler for the BBQ tier. Instead
3020 of compiling using B3-01, we now generate Air code directly.
3021 The goal of doing this was to speed up compile times for Wasm
3024 This patch provides us with a 20-30% compile time speedup. However, I
3025 have ideas on how to improve compile times even further. For example,
3026 we should probably implement a faster running register allocator:
3027 https://bugs.webkit.org/show_bug.cgi?id=194036
3029 We can also improve on the code we generate.
3030 We should emit better code for Switch: https://bugs.webkit.org/show_bug.cgi?id=194053
3031 And we should do better instruction selection in various
3032 areas: https://bugs.webkit.org/show_bug.cgi?id=193999
3034 * JavaScriptCore.xcodeproj/project.pbxproj:
3036 * b3/B3LowerToAir.cpp:
3037 * b3/B3StackmapSpecial.h:
3038 * b3/air/AirCode.cpp:
3039 (JSC::B3::Air::Code::emitDefaultPrologue):
3042 (JSC::B3::Air::Tmp::Tmp):
3043 * runtime/Options.h:
3044 * wasm/WasmAirIRGenerator.cpp: Added.
3045 (JSC::Wasm::ConstrainedTmp::ConstrainedTmp):
3046 (JSC::Wasm::TypedTmp::TypedTmp):
3047 (JSC::Wasm::TypedTmp::operator== const):
3048 (JSC::Wasm::TypedTmp::operator!= const):
3049 (JSC::Wasm::TypedTmp::operator bool const):
3050 (JSC::Wasm::TypedTmp::operator Tmp const):
3051 (JSC::Wasm::TypedTmp::operator Arg const):
3052 (JSC::Wasm::TypedTmp::tmp const):
3053 (JSC::Wasm::TypedTmp::type const):
3054 (JSC::Wasm::AirIRGenerator::ControlData::ControlData):
3055 (JSC::Wasm::AirIRGenerator::ControlData::dump const):
3056 (JSC::Wasm::AirIRGenerator::ControlData::type const):
3057 (JSC::Wasm::AirIRGenerator::ControlData::signature const):
3058 (JSC::Wasm::AirIRGenerator::ControlData::hasNonVoidSignature const):
3059 (JSC::Wasm::AirIRGenerator::ControlData::targetBlockForBranch):
3060 (JSC::Wasm::AirIRGenerator::ControlData::convertIfToBlock):
3061 (JSC::Wasm::AirIRGenerator::ControlData::resultForBranch const):
3062 (JSC::Wasm::AirIRGenerator::emptyExpression):
3063 (JSC::Wasm::AirIRGenerator::fail const):
3064 (JSC::Wasm::AirIRGenerator::setParser):
3065 (JSC::Wasm::AirIRGenerator::toTmpVector):
3066 (JSC::Wasm::AirIRGenerator::validateInst):
3067 (JSC::Wasm::AirIRGenerator::extractArg):
3068 (JSC::Wasm::AirIRGenerator::append):
3069 (JSC::Wasm::AirIRGenerator::appendEffectful):
3070 (JSC::Wasm::AirIRGenerator::newTmp):
3071 (JSC::Wasm::AirIRGenerator::g32):
3072 (JSC::Wasm::AirIRGenerator::g64):
3073 (JSC::Wasm::AirIRGenerator::f32):
3074 (JSC::Wasm::AirIRGenerator::f64):
3075 (JSC::Wasm::AirIRGenerator::tmpForType):
3076 (JSC::Wasm::AirIRGenerator::addPatchpoint):
3077 (JSC::Wasm::AirIRGenerator::emitPatchpoint):
3078 (JSC::Wasm::AirIRGenerator::emitCheck):
3079 (JSC::Wasm::AirIRGenerator::emitCCall):
3080 (JSC::Wasm::AirIRGenerator::moveOpForValueType):
3081 (JSC::Wasm::AirIRGenerator::instanceValue):
3082 (JSC::Wasm::AirIRGenerator::fixupPointerPlusOffset):
3083 (JSC::Wasm::AirIRGenerator::restoreWasmContextInstance):
3084 (JSC::Wasm::AirIRGenerator::AirIRGenerator):
3085 (JSC::Wasm::AirIRGenerator::restoreWebAssemblyGlobalState):
3086 (JSC::Wasm::AirIRGenerator::emitThrowException):
3087 (JSC::Wasm::AirIRGenerator::addLocal):
3088 (JSC::Wasm::AirIRGenerator::addConstant):
3089 (JSC::Wasm::AirIRGenerator::addArguments):
3090 (JSC::Wasm::AirIRGenerator::getLocal):
3091 (JSC::Wasm::AirIRGenerator::addUnreachable):
3092 (JSC::Wasm::AirIRGenerator::addGrowMemory):
3093 (JSC::Wasm::AirIRGenerator::addCurrentMemory):
3094 (JSC::Wasm::AirIRGenerator::setLocal):
3095 (JSC::Wasm::AirIRGenerator::getGlobal):
3096 (JSC::Wasm::AirIRGenerator::setGlobal):
3097 (JSC::Wasm::AirIRGenerator::emitCheckAndPreparePointer):
3098 (JSC::Wasm::sizeOfLoadOp):
3099 (JSC::Wasm::AirIRGenerator::emitLoadOp):
3100 (JSC::Wasm::AirIRGenerator::load):
3101 (JSC::Wasm::sizeOfStoreOp):
3102 (JSC::Wasm::AirIRGenerator::emitStoreOp):
3103 (JSC::Wasm::AirIRGenerator::store):
3104 (JSC::Wasm::AirIRGenerator::addSelect):
3105 (JSC::Wasm::AirIRGenerator::emitTierUpCheck):
3106 (JSC::Wasm::AirIRGenerator::addLoop):
3107 (JSC::Wasm::AirIRGenerator::addTopLevel):
3108 (JSC::Wasm::AirIRGenerator::addBlock):
3109 (JSC::Wasm::AirIRGenerator::addIf):
3110 (JSC::Wasm::AirIRGenerator::addElse):
3111 (JSC::Wasm::AirIRGenerator::addElseToUnreachable):
3112 (JSC::Wasm::AirIRGenerator::addReturn):
3113 (JSC::Wasm::AirIRGenerator::addBranch):
3114 (JSC::Wasm::AirIRGenerator::addSwitch):
3115 (JSC::Wasm::AirIRGenerator::endBlock):
3116 (JSC::Wasm::AirIRGenerator::addEndToUnreachable):
3117 (JSC::Wasm::AirIRGenerator::addCall):
3118 (JSC::Wasm::AirIRGenerator::addCallIndirect):
3119 (JSC::Wasm::AirIRGenerator::unify):
3120 (JSC::Wasm::AirIRGenerator::unifyValuesWithBlock):
3121 (JSC::Wasm::AirIRGenerator::dump):
3122 (JSC::Wasm::AirIRGenerator::origin):
3123 (JSC::Wasm::parseAndCompileAir):
3124 (JSC::Wasm::AirIRGenerator::emitChecksForModOrDiv):
3125 (JSC::Wasm::AirIRGenerator::emitModOrDiv):
3126 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32DivS>):
3127 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32RemS>):
3128 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32DivU>):
3129 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32RemU>):
3130 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64DivS>):
3131 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64RemS>):
3132 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64DivU>):
3133 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64RemU>):
3134 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Ctz>):
3135 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Ctz>):
3136 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Popcnt>):
3137 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Popcnt>):
3138 (JSC::Wasm::AirIRGenerator::addOp<F64ConvertUI64>):
3139 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertUI64>):
3140 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Nearest>):
3141 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Nearest>):
3142 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Trunc>):
3143 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Trunc>):
3144 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32TruncSF64>):
3145 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32TruncSF32>):
3146 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32TruncUF64>):
3147 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32TruncUF32>):
3148 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncSF64>):
3149 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncUF64>):
3150 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncSF32>):
3151 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64TruncUF32>):
3152 (JSC::Wasm::AirIRGenerator::addShift):
3153 (JSC::Wasm::AirIRGenerator::addIntegerSub):
3154 (JSC::Wasm::AirIRGenerator::addFloatingPointAbs):
3155 (JSC::Wasm::AirIRGenerator::addFloatingPointBinOp):
3156 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Ceil>):
3157 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Mul>):
3158 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Sub>):
3159 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Le>):
3160 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32DemoteF64>):
3161 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Min>):
3162 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Ne>):
3163 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Lt>):
3164 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Max>):
3165 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Mul>):
3166 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Div>):
3167 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Clz>):
3168 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Copysign>):
3169 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64ConvertUI32>):
3170 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ReinterpretI32>):
3171 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64And>):
3172 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Ne>):
3173 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Gt>):
3174 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Sqrt>):
3175 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Ge>):
3176 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64GtS>):
3177 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64GtU>):
3178 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Eqz>):
3179 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Div>):
3180 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Add>):
3181 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Or>):
3182 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32LeU>):
3183 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32LeS>):
3184 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Ne>):
3185 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Clz>):
3186 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Neg>):
3187 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32And>):
3188 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32LtU>):
3189 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Rotr>):
3190 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Abs>):
3191 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32LtS>):
3192 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Eq>):
3193 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Copysign>):
3194 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertSI64>):
3195 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Rotl>):
3196 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Lt>):
3197 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64ConvertSI32>):
3198 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Eq>):
3199 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Le>):
3200 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Ge>):
3201 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32ShrU>):
3202 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertUI32>):
3203 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32ShrS>):
3204 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32GeU>):
3205 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Ceil>):
3206 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32GeS>):
3207 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Shl>):
3208 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Floor>):
3209 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Xor>):
3210 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Abs>):
3211 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Min>):
3212 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Mul>):
3213 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Sub>):
3214 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32ReinterpretF32>):
3215 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Add>):
3216 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Sub>):
3217 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Or>):
3218 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64LtU>):
3219 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64LtS>):
3220 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64ConvertSI64>):
3221 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Xor>):
3222 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64GeU>):
3223 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Mul>):
3224 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Sub>):
3225 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64PromoteF32>):
3226 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Add>):
3227 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64GeS>):
3228 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ExtendUI32>):
3229 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Ne>):
3230 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64ReinterpretI64>):
3231 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Eq>):
3232 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Eq>):
3233 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Floor>):
3234 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertSI32>):
3235 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Eqz>):
3236 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ReinterpretF64>):
3237 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ShrS>):
3238 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ShrU>):
3239 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Sqrt>):
3240 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Shl>):
3241 (JSC::Wasm::AirIRGenerator::addOp<OpType::F32Gt>):
3242 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32WrapI64>):
3243 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Rotl>):
3244 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32Rotr>):
3245 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32GtU>):
3246 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64ExtendSI32>):
3247 (JSC::Wasm::AirIRGenerator::addOp<OpType::I32GtS>):
3248 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Neg>):
3249 (JSC::Wasm::AirIRGenerator::addOp<OpType::F64Max>):
3250 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64LeU>):
3251 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64LeS>):
3252 (JSC::Wasm::AirIRGenerator::addOp<OpType::I64Add>):
3253 * wasm/WasmAirIRGenerator.h: Added.
3254 * wasm/WasmB3IRGenerator.cpp:
3255 (JSC::Wasm::B3IRGenerator::emptyExpression):
3256 * wasm/WasmBBQPlan.cpp:
3257 (JSC::Wasm::BBQPlan::compileFunctions):
3258 * wasm/WasmCallingConvention.cpp:
3259 (JSC::Wasm::jscCallingConventionAir):
3260 (JSC::Wasm::wasmCallingConventionAir):
3261 * wasm/WasmCallingConvention.h:
3262 (JSC::Wasm::CallingConvention::CallingConvention):
3263 (JSC::Wasm::CallingConvention::marshallArgumentImpl const):
3264 (JSC::Wasm::CallingConvention::marshallArgument const):
3265 (JSC::Wasm::CallingConventionAir::CallingConventionAir):
3266 (JSC::Wasm::CallingConventionAir::prologueScratch const):
3267 (JSC::Wasm::CallingConventionAir::marshallArgumentImpl const):
3268 (JSC::Wasm::CallingConventionAir::marshallArgument const):
3269 (JSC::Wasm::CallingConventionAir::headerSizeInBytes):
3270 (JSC::Wasm::CallingConventionAir::loadArguments const):
3271 (JSC::Wasm::CallingConventionAir::setupCall const):
3272 (JSC::Wasm::nextJSCOffset):
3273 * wasm/WasmFunctionParser.h:
3274 (JSC::Wasm::FunctionParser<Context>::parseExpression):
3275 * wasm/WasmValidate.cpp:
3276 (JSC::Wasm::Validate::emptyExpression):
3278 2019-01-30 Robin Morisset <rmorisset@apple.com>
3280 Object.keys can now lead to a PhantomNewArrayBuffer, OSR exit from the FTL should know how to materialize a NewArrayBuffer in that case
3281 https://bugs.webkit.org/show_bug.cgi?id=194050
3282 <rdar://problem/47595592>
3284 Following https://bugs.webkit.org/show_bug.cgi?id=190047, PhantomNewArrayBuffer is no longer guaranteed to originate from a NewArrayBuffer in the baseline jit.
3285 It can now come from Object.keys, which is a function call. We must teach the FTL how to OSR exit in that case.
3287 Reviewed by Yusuke Suzuki.
3289 * ftl/FTLOperations.cpp:
3290 (JSC::FTL::operationMaterializeObjectInOSR):
3292 2019-01-30 Tadeu Zagallo <tzagallo@apple.com>
3294 Remove assertion that CachedSymbolTables should have no RareData
3295 https://bugs.webkit.org/show_bug.cgi?id=194037
3297 Reviewed by Mark Lam.
3299 It turns out that we don't need to cache the SymbolTableRareData and
3300 we should not assert that it's empty.
3302 * runtime/CachedTypes.cpp:
3303 (JSC::CachedSymbolTable::encode):
3305 2019-01-30 Tadeu Zagallo <tzagallo@apple.com>
3307 CachedBytecode's move constructor should not call `freeDataIfOwned`
3308 https://bugs.webkit.org/show_bug.cgi?id=194045
3310 Reviewed by Mark Lam.
3312 That might result in freeing a garbage value
3314 * parser/SourceProvider.h:
3315 (JSC::CachedBytecode::CachedBytecode):
3317 2019-01-30 Keith Miller <keith_miller@apple.com>
3319 mul32 should convert powers of 2 to an lshift
3320 https://bugs.webkit.org/show_bug.cgi?id=193957
3322 Reviewed by Yusuke Suzuki.
3324 * assembler/MacroAssembler.h:
3325 (JSC::MacroAssembler::mul32):
3326 * assembler/testmasm.cpp:
3327 (JSC::int32Operands):
3328 (JSC::testMul32WithImmediates):
3331 2019-01-30 Yusuke Suzuki <ysuzuki@apple.com>
3333 [JSC] Make disassembler data structures constant read-only data
3334 https://bugs.webkit.org/show_bug.cgi?id=194041
3336 Reviewed by Mark Lam.
3338 Bunch of disassembler data structures are not marked "const", which prevents the loader to put them in read-only region.
3339 This patch makes them "const".
3341 * disassembler/ARM64/A64DOpcode.cpp:
3342 * disassembler/udis86/ud_itab.py:
3343 (UdItabGenerator.genOpcodeTablesLookupIndex):
3344 (UdItabGenerator.genInsnTable):
3345 (UdItabGenerator.genMnemonicsList):
3347 * disassembler/udis86/udis86_decode.h:
3348 * disassembler/udis86/udis86_syn.c:
3349 * disassembler/udis86/udis86_syn.h:
3350 * disassembler/udis86/udis86_types.h:
3352 2019-01-30 Yusuke Suzuki <ysuzuki@apple.com>
3354 Unreviewed, update the builtin test results
3355 https://bugs.webkit.org/show_bug.cgi?id=194015