1 2017-06-22 Saam Barati <sbarati@apple.com>
3 ValueRep(DoubleRep(@v)) can not simply convert to @v
4 https://bugs.webkit.org/show_bug.cgi?id=173687
5 <rdar://problem/32855563>
11 p: Phi() // int32 and double flows into this phi from various control flow
14 v: ValueRep(DoubleRepUse:@d)
15 a: NewArrayWithSize(Int32:@v)
16 some more nodes here ...
18 Because the flow of ValueRep(DoubleRep(@p)) will not produce an Int32,
19 AI proves that the Int32 check will fail. Constant folding phase removes
20 all nodes after @a and inserts an Unreachable after the NewArrayWithSize node.
22 The IR then looks like this:
24 p: Phi() // int32 and double flows into this phi from various control flow
27 v: ValueRep(DoubleRepUse:@d)
28 a: NewArrayWithSize(Int32:@v)
31 However, there was a strength reduction rule that tries eliminate redundant
32 conversions. It used to convert the program to:
34 p: Phi() // int32 and double flows into this phi from various control flow
37 a: NewArrayWithSize(Int32:@p)
40 However, at runtime, @p will actually be an Int32, so @a will not OSR exit,
41 and we'll crash. This patch removes this strength reduction rule since it
42 does not maintain what would have happened if we executed the program before
45 This rule is also wrong for other types of programs (I'm not sure we'd
46 actually emit this code, but if such IR were generated, we would previously
47 optimize it incorrectly):
53 However, the strength reduction rule would've transformed this into:
57 And this would be wrong because node @c before the transformation would
58 have produced the JSValue jsNumber(1.0).
60 This patch was neutral in the benchmark run I did.
62 * dfg/DFGStrengthReductionPhase.cpp:
63 (JSC::DFG::StrengthReductionPhase::handleNode):
65 2017-06-22 JF Bastien <jfbastien@apple.com>
67 ARM64: doubled executable memory limit from 32MiB to 64MiB
68 https://bugs.webkit.org/show_bug.cgi?id=173734
69 <rdar://problem/32932407>
71 Reviewed by Oliver Hunt.
73 Some WebAssembly programs stress the amount of memory we have
74 available, especially when we consider tiering (BBQ never dies,
75 and is bigger that OMG). Tiering to OMG just piles on more memory,
76 and we're also competing with JavaScript.
78 * jit/ExecutableAllocator.h:
80 2017-06-22 Joseph Pecoraro <pecoraro@apple.com>
82 Web Inspector: Pausing with a deep call stack can be very slow, avoid eagerly generating object previews
83 https://bugs.webkit.org/show_bug.cgi?id=173698
85 Reviewed by Matt Baker.
87 When pausing in a deep call stack the majority of the time spent in JavaScriptCore
88 when preparing Inspector pause information is spent generating object previews for
89 the `thisObject` of each of the call frames. In some cases, this could be more
90 than 95% of the time generating pause information. In the common case, only one of
91 these (the top frame) will ever be seen by users. This change avoids eagerly
92 generating object previews up front and let the frontend request previews if they
95 This introduces the `Runtime.getPreview` protocol command. This can be used to:
97 - Get a preview for a RemoteObject that did not have a preview but could.
98 - Update a preview for a RemoteObject that had a preview.
100 This patch only uses it for the first case, but the second is valid and may be
101 something we want to do in the future.
103 * inspector/protocol/Runtime.json:
104 A new command to get an up to date preview for an object.
106 * inspector/InjectedScript.h:
107 * inspector/InjectedScript.cpp:
108 (Inspector::InjectedScript::getPreview):
109 * inspector/agents/InspectorRuntimeAgent.cpp:
110 (Inspector::InspectorRuntimeAgent::getPreview):
111 * inspector/agents/InspectorRuntimeAgent.h:
112 Plumbing for the new command.
114 * inspector/InjectedScriptSource.js:
115 (InjectedScript.prototype.getPreview):
116 Implementation just uses the existing helper.
118 (InjectedScript.CallFrameProxy):
119 Do not generate a preview for the this object as it may not be shown.
120 Let the frontend request a preview if it wants or needs one.
122 2017-06-22 Joseph Pecoraro <pecoraro@apple.com>
124 Web Inspector: Remove stale "rawScopes" concept that was never available in JSC
125 https://bugs.webkit.org/show_bug.cgi?id=173686
127 Reviewed by Mark Lam.
129 * inspector/InjectedScript.cpp:
130 (Inspector::InjectedScript::functionDetails):
131 * inspector/InjectedScriptSource.js:
132 (InjectedScript.prototype.functionDetails):
133 * inspector/JSInjectedScriptHost.cpp:
134 (Inspector::JSInjectedScriptHost::functionDetails):
136 2017-06-22 Yusuke Suzuki <utatane.tea@gmail.com>
138 [JSC] Object.values should be implemented in C++
139 https://bugs.webkit.org/show_bug.cgi?id=173703
141 Reviewed by Sam Weinig.
143 As the same to Object.assign, Object.values() is also inherently polymorphic.
144 And allocating JSString / Symbol for Identifier and JSArray for Object.keys()
147 In this patch, we implement Object.values() in C++. It can avoid above allocations.
148 Furthermore, by using `slot.isTaintedByOpaqueObject()` information, we can skip
149 non-observable JSObject::get() calls.
151 This improves performance by 2.49x. And also now Object.values() beats
152 Object.keys(object).map(key => object[key]) implementation.
156 object-values 132.1551+-3.7209 ^ 53.1254+-1.6139 ^ definitely 2.4876x faster
157 object-keys-map-values 78.2008+-2.1378 ? 78.9078+-2.2121 ?
159 * builtins/ObjectConstructor.js:
161 * runtime/ObjectConstructor.cpp:
162 (JSC::objectConstructorValues):
164 2017-06-21 Saam Barati <sbarati@apple.com>
166 ArrayPrototype.map builtin declares a var it does not use
167 https://bugs.webkit.org/show_bug.cgi?id=173685
169 Reviewed by Keith Miller.
171 * builtins/ArrayPrototype.js:
174 2017-06-21 Saam Barati <sbarati@apple.com>
176 eval virtual call is incorrect in the baseline JIT
177 https://bugs.webkit.org/show_bug.cgi?id=173587
178 <rdar://problem/32867897>
180 Reviewed by Michael Saboff.
182 When making a virtual call for call_eval, e.g, when the thing
183 we're calling isn't actually eval, we end up calling the caller
184 instead of the callee. This is clearly wrong. The code ends up
185 issuing a load for the Callee in the callers frame instead of
186 the callee we're calling. The fix is simple, we just need to
187 load the real callee. Only the 32-bit baseline JIT had this bug.
189 * jit/JITCall32_64.cpp:
190 (JSC::JIT::compileCallEvalSlowCase):
192 2017-06-21 Joseph Pecoraro <pecoraro@apple.com>
194 Web Inspector: Using "break on all exceptions" when throwing stack overflow hangs inspector
195 https://bugs.webkit.org/show_bug.cgi?id=172432
196 <rdar://problem/29870873>
198 Reviewed by Saam Barati.
200 Avoid pausing on StackOverflow and OutOfMemory errors to avoid a hang.
201 We will proceed to improve debugging of these cases in the follow-up bugs.
203 * debugger/Debugger.cpp:
204 (JSC::Debugger::exception):
205 Ignore pausing on these errors.
207 * runtime/ErrorInstance.h:
208 (JSC::ErrorInstance::setStackOverflowError):
209 (JSC::ErrorInstance::isStackOverflowError):
210 (JSC::ErrorInstance::setOutOfMemoryError):
211 (JSC::ErrorInstance::isOutOfMemoryError):
212 * runtime/ExceptionHelpers.cpp:
213 (JSC::createStackOverflowError):
215 (JSC::createOutOfMemoryError):
216 Mark these kinds of errors.
218 2017-06-21 Saam Barati <sbarati@apple.com>
220 Make it clear that regenerating ICs are holding the CodeBlock's lock by passing the locker as a parameter
221 https://bugs.webkit.org/show_bug.cgi?id=173609
223 Reviewed by Keith Miller.
225 This patch makes many of the IC generating functions require a locker as
226 a parameter. We do this in other places in JSC to indicate that
227 a particular API is only valid while a particular lock is held.
228 This is the case when generating ICs. This patch just makes it
229 explicit in the IC generating interface.
231 * bytecode/PolymorphicAccess.cpp:
232 (JSC::PolymorphicAccess::addCases):
233 (JSC::PolymorphicAccess::addCase):
234 (JSC::PolymorphicAccess::commit):
235 (JSC::PolymorphicAccess::regenerate):
236 * bytecode/PolymorphicAccess.h:
237 * bytecode/StructureStubInfo.cpp:
238 (JSC::StructureStubInfo::addAccessCase):
239 (JSC::StructureStubInfo::initStub): Deleted.
240 * bytecode/StructureStubInfo.h:
242 (JSC::tryCacheGetByID):
243 (JSC::repatchGetByID):
244 (JSC::tryCachePutByID):
245 (JSC::repatchPutByID):
249 2017-06-20 Myles C. Maxfield <mmaxfield@apple.com>
251 Disable font variations on macOS Sierra and iOS 10
252 https://bugs.webkit.org/show_bug.cgi?id=173618
253 <rdar://problem/32879164>
257 * Configurations/FeatureDefines.xcconfig:
259 2017-06-20 Keith Miller <keith_miller@apple.com>
261 Fix leak of ModuleInformations in BBQPlan constructors.
262 https://bugs.webkit.org/show_bug.cgi?id=173577
264 Reviewed by Saam Barati.
266 This patch fixes a leak in the BBQPlan constructiors. Previously,
267 the plans were calling makeRef on the newly constructed objects.
268 This patch fixes the issue and uses adoptRef instead. Additionally,
269 an old, incorrect, attempt to fix the leak is removed.
271 * inspector/remote/cocoa/RemoteInspectorXPCConnection.mm:
272 (Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
273 * jit/JITWorklist.cpp:
274 (JSC::JITWorklist::Thread::Thread):
275 * runtime/PromiseDeferredTimer.cpp:
276 (JSC::PromiseDeferredTimer::addPendingPromise):
279 * wasm/WasmBBQPlan.cpp:
280 (JSC::Wasm::BBQPlan::BBQPlan):
282 (JSC::Wasm::Plan::Plan):
284 2017-06-20 Devin Rousso <drousso@apple.com>
286 Web Inspector: Send context attributes for tracked canvases
287 https://bugs.webkit.org/show_bug.cgi?id=173327
289 Reviewed by Joseph Pecoraro.
291 * inspector/protocol/Canvas.json:
292 Add ContextAttributes object type that is optionally used for WebGL canvases.
294 2017-06-20 Konstantin Tokarev <annulen@yandex.ru>
296 Remove excessive include directives from WTF
297 https://bugs.webkit.org/show_bug.cgi?id=173553
299 Reviewed by Saam Barati.
301 * profiler/ProfilerDatabase.cpp: Added missing include directive.
302 * runtime/SamplingProfiler.cpp: Ditto.
304 2017-06-20 Oleksandr Skachkov <gskachkov@gmail.com>
306 Revert changes in bug#160417 about extending `null` not being a derived class
307 https://bugs.webkit.org/show_bug.cgi?id=169293
309 Reviewed by Saam Barati.
311 Reverted changes in bug#160417 about extending `null` not being a derived class
312 according to changes in spec:
313 https://github.com/tc39/ecma262/commit/c57ef95c45a371f9c9485bb1c3881dbdc04524a2
315 * builtins/BuiltinNames.h:
316 * bytecompiler/BytecodeGenerator.cpp:
317 (JSC::BytecodeGenerator::BytecodeGenerator):
318 (JSC::BytecodeGenerator::emitReturn):
319 * bytecompiler/NodesCodegen.cpp:
320 (JSC::ClassExprNode::emitBytecode):
322 2017-06-20 Saam Barati <sbarati@apple.com>
324 repatchIn needs to lock the CodeBlock's lock
325 https://bugs.webkit.org/show_bug.cgi?id=173573
327 Reviewed by Yusuke Suzuki.
329 CodeBlock::propagateTransitions and CodeBlock::visitWeakly grab the CodeBlock's
330 lock before modifying the StructureStubInfo/PolymorphicAccess. When regenerating
331 an IC, we must hold the CodeBlock's to prevent the executing thread from racing
332 with the marking thread. repatchIn was not grabbing the lock. I haven't been
333 able to get it to crash, but this is needed for the same reasons that get and put IC
334 regeneration grab the lock.
339 2017-06-19 Devin Rousso <drousso@apple.com>
341 Web Inspector: create canvas content view and details sidebar panel
342 https://bugs.webkit.org/show_bug.cgi?id=138941
343 <rdar://problem/19051672>
345 Reviewed by Joseph Pecoraro.
347 * inspector/protocol/Canvas.json:
348 - Add an optional `nodeId` attribute to the `Canvas` type.
349 - Add `requestNode` command for getting the node id of the backing canvas element.
350 - Add `requestContent` command for getting the current image content of the canvas.
352 2017-06-19 Yusuke Suzuki <utatane.tea@gmail.com>
354 Unreviewed, build fix for ARM
356 * assembler/MacroAssemblerARM.h:
357 (JSC::MacroAssemblerARM::internalCompare32):
359 2017-06-13 Yusuke Suzuki <utatane.tea@gmail.com>
361 [DFG] More ArrayIndexOf fixups for various types
362 https://bugs.webkit.org/show_bug.cgi?id=173176
364 Reviewed by Saam Barati.
366 This patch further expands coverage of ArrayIndexOf optimization in DFG and FTL.
368 1. We attempt to fold ArrayIndexOf to constant (-1) if we know that its array
369 never contains the given search value.
371 2. We support Symbol and Other specialization additionally. Especially, Other is
372 useful because null/undefined can be used as a sentinel value.
374 One interesting thing is that Array.prototype.indexOf does not consider holes as
377 var array = [,,,,,,,];
378 array.indexOf(undefined); // => -1
380 This can be trivially achieved in JSC because Empty and Undefined are different values.
382 * dfg/DFGFixupPhase.cpp:
383 (JSC::DFG::FixupPhase::fixupNode):
384 (JSC::DFG::FixupPhase::fixupArrayIndexOf):
385 * dfg/DFGSpeculativeJIT.cpp:
386 (JSC::DFG::SpeculativeJIT::compileArrayIndexOf):
387 (JSC::DFG::SpeculativeJIT::speculateOther):
388 * dfg/DFGSpeculativeJIT.h:
389 * ftl/FTLLowerDFGToB3.cpp:
390 (JSC::FTL::DFG::LowerDFGToB3::compileArrayIndexOf):
392 2017-06-19 Caio Lima <ticaiolima@gmail.com>
394 [ARMv6][DFG] ARM MacroAssembler is always emitting cmn when immediate is 0
395 https://bugs.webkit.org/show_bug.cgi?id=172972
397 Reviewed by Mark Lam.
399 We are changing internalCompare32 implementation in ARM
400 MacroAssembler to emit "cmp" when the "right.value" is 0.
401 It is generating wrong comparison cases, since the
402 semantics of cmn is opposite of cmp[1]. One case that it's breaking is
403 "branch32(MacroAssembler::Above, gpr, TrustedImm32(0))", where ends
404 resulting in following assembly code:
411 However, as cmn is similar to "adds", it will never take the branch
412 when $r0 > 0. In that case, the correct opcode is "cmp". With this
413 patch we will fix current broken tests that uses
414 "branch32(MacroAssembler::Above, gpr, TrustedImm32(0))",
415 such as ForwardVarargs, Spread and GetRestLength.
417 [1] - http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Cihiddid.html
419 * assembler/MacroAssemblerARM.h:
420 (JSC::MacroAssemblerARM::internalCompare32):
422 2017-06-19 Joseph Pecoraro <pecoraro@apple.com>
424 test262: Completion values for control flow do not match the spec
425 https://bugs.webkit.org/show_bug.cgi?id=171265
427 Reviewed by Saam Barati.
429 * bytecompiler/BytecodeGenerator.h:
430 (JSC::BytecodeGenerator::shouldBeConcernedWithCompletionValue):
431 When we care about having proper completion values (global code
432 in programs, modules, and eval) insert undefined results for
433 control flow statements.
435 * bytecompiler/NodesCodegen.cpp:
436 (JSC::SourceElements::emitBytecode):
437 Reduce writing a default `undefined` value to the completion result to
438 only once before the last statement we know will produce a value.
440 (JSC::IfElseNode::emitBytecode):
441 (JSC::WithNode::emitBytecode):
442 (JSC::WhileNode::emitBytecode):
443 (JSC::ForNode::emitBytecode):
444 (JSC::ForInNode::emitBytecode):
445 (JSC::ForOfNode::emitBytecode):
446 (JSC::SwitchNode::emitBytecode):
447 Insert an undefined to handle cases where code may break out of an
448 if/else or with statement (break/continue).
450 (JSC::TryNode::emitBytecode):
451 Same handling for break cases. Also, finally block statement completion
452 values are always ignored for the try statement result.
454 (JSC::ClassDeclNode::emitBytecode):
455 Class declarations, like function declarations, produce an empty result.
458 (JSC::SourceElements::lastStatement):
459 (JSC::SourceElements::hasCompletionValue):
460 (JSC::SourceElements::hasEarlyBreakOrContinue):
461 (JSC::BlockNode::lastStatement):
462 (JSC::BlockNode::singleStatement):
463 (JSC::BlockNode::hasCompletionValue):
464 (JSC::BlockNode::hasEarlyBreakOrContinue):
465 (JSC::ScopeNode::singleStatement):
466 (JSC::ScopeNode::hasCompletionValue):
467 (JSC::ScopeNode::hasEarlyBreakOrContinue):
468 The only non-trivial cases need to loop through their list of statements
469 to determine if this has a completion value or not. Likewise for
470 determining if there is an early break / continue, meaning a break or
471 continue statement with no preceding statement that has a completion value.
474 (JSC::StatementNode::next):
475 (JSC::StatementNode::hasCompletionValue):
476 Helper to check if a statement nodes produces a completion value or not.
478 2017-06-19 Adrian Perez de Castro <aperez@igalia.com>
480 Missing <functional> includes make builds fail with GCC 7.x
481 https://bugs.webkit.org/show_bug.cgi?id=173544
483 Unreviewed gardening.
485 Fix compilation with GCC 7.
487 * API/tests/CompareAndSwapTest.cpp:
488 * runtime/VMEntryScope.h:
490 2017-06-17 Keith Miller <keith_miller@apple.com>
492 ArrayBuffer constructor needs to create subclass structures before its buffer
493 https://bugs.webkit.org/show_bug.cgi?id=173510
495 Reviewed by Yusuke Suzuki.
497 * runtime/JSArrayBufferConstructor.cpp:
498 (JSC::constructArrayBuffer):
500 2017-06-17 Keith Miller <keith_miller@apple.com>
502 ArrayPrototype methods should use JSValue::toLength for non-Arrays.
503 https://bugs.webkit.org/show_bug.cgi?id=173506
505 Reviewed by Ryosuke Niwa.
507 This patch changes the result of unshift if old length +
508 unshift.arguments.length > (2 ** 53) - 1 to be a type error. Also,
509 the getLength function, which was always incorrect to use, has
510 been removed. Additionally, some cases where we were using a
511 constant for (2 ** 53) - 1 have been replaced with
514 * interpreter/Interpreter.cpp:
515 (JSC::sizeOfVarargs):
516 * runtime/ArrayPrototype.cpp:
517 (JSC::arrayProtoFuncToLocaleString):
518 (JSC::arrayProtoFuncPop):
519 (JSC::arrayProtoFuncPush):
520 (JSC::arrayProtoFuncReverse):
521 (JSC::arrayProtoFuncShift):
522 (JSC::arrayProtoFuncSlice):
523 (JSC::arrayProtoFuncSplice):
524 (JSC::arrayProtoFuncUnShift):
525 (JSC::arrayProtoFuncIndexOf):
526 (JSC::arrayProtoFuncLastIndexOf):
527 * runtime/JSArrayInlines.h:
528 (JSC::getLength): Deleted.
529 * runtime/JSCJSValue.cpp:
530 (JSC::JSValue::toLength):
531 * runtime/NumberConstructor.cpp:
532 (JSC::numberConstructorFuncIsSafeInteger):
534 2017-06-16 Matt Baker <mattbaker@apple.com>
536 Web Inspector: Instrument 2D/WebGL canvas contexts in the backend
537 https://bugs.webkit.org/show_bug.cgi?id=172623
538 <rdar://problem/32415986>
540 Reviewed by Devin Rousso and Joseph Pecoraro.
542 This patch adds a basic Canvas protocol. It includes Canvas and related
543 types and events for monitoring the lifetime of canvases in the page.
546 * DerivedSources.make:
547 * inspector/protocol/Canvas.json: Added.
549 * inspector/scripts/codegen/generator.py:
550 (Generator.stylized_name_for_enum_value):
551 Add special handling for Canvas.ContextType protocol enumeration,
552 so that "canvas-2d" and "webgl" map to `Canvas2D` and `WebGL`.
554 2017-06-16 Wenson Hsieh <wenson_hsieh@apple.com>
556 [iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
557 https://bugs.webkit.org/show_bug.cgi?id=173366
558 <rdar://problem/32767014>
560 Reviewed by Tim Horton.
562 Introduce ENABLE_DATA_INTERACTION and ENABLE_DRAG_SUPPORT to FeatureDefines.xcconfig.
564 * Configurations/FeatureDefines.xcconfig:
566 2017-06-16 Yusuke Suzuki <utatane.tea@gmail.com>
568 [JSC] Add fast path for Object.assign
569 https://bugs.webkit.org/show_bug.cgi?id=173416
571 Reviewed by Mark Lam.
573 In Object.assign implementation, we need to ensure that given key is still enumerable own key.
574 This seems duplicate look up. And we want to avoid this. However, we still need to perform this
575 check in the face of Proxy. Proxy can observe that this check is done correctly.
577 In almost all the cases, the above check is duplicate to the subsequent [[Get]] operation.
578 In this patch, we perform this check. But at that time, we investigate `isTaintedByOpaqueObject()`.
579 If it is false, we can say that getOwnPropertySlot is pure. In that case, we can just retrieve the
580 value by calling `slot.getValue()`.
582 This further improves performance of Object.assign.
586 object-assign.es6 363.6706+-6.4381 ^ 324.1769+-6.9624 ^ definitely 1.1218x faster
588 * runtime/ObjectConstructor.cpp:
589 (JSC::objectConstructorAssign):
591 2017-06-16 Michael Saboff <msaboff@apple.com>
593 Intermittent crash running Internal/Tests/InternalJSTests/Regress/radar-24300617.js
594 https://bugs.webkit.org/show_bug.cgi?id=173488
596 Reviewed by Filip Pizlo.
598 ClonedArguments lazily sets its callee and interator properties and it used its own inline
599 code to initialize its butterfly. This means that these lazily set properties can have
600 bogus values in those slots. Instead, let's use the standard BUtterfly:tryCreate() method
601 to create the butterfly as it clears out of line properties.
603 * runtime/ClonedArguments.cpp:
604 (JSC::ClonedArguments::createEmpty):
606 2017-06-16 Mark Lam <mark.lam@apple.com>
608 Interpreter methods for mapping between Opcode and OpcodeID need not be instance methods.
609 https://bugs.webkit.org/show_bug.cgi?id=173491
611 Reviewed by Keith Miller.
613 The implementation are based on static data. There's no need to get the
614 interpreter instance. Hence, we can make these methods static and avoid doing
615 unnecessary work to compute the interpreter this pointer.
617 Also removed the unused isCallBytecode method.
619 * bytecode/BytecodeBasicBlock.cpp:
620 (JSC::BytecodeBasicBlock::computeImpl):
621 * bytecode/BytecodeDumper.cpp:
622 (JSC::BytecodeDumper<Block>::printGetByIdOp):
623 (JSC::BytecodeDumper<Block>::printGetByIdCacheStatus):
624 (JSC::BytecodeDumper<Block>::dumpBytecode):
625 (JSC::BytecodeDumper<Block>::dumpBlock):
626 * bytecode/BytecodeLivenessAnalysis.cpp:
627 (JSC::BytecodeLivenessAnalysis::dumpResults):
628 * bytecode/BytecodeLivenessAnalysisInlines.h:
629 (JSC::BytecodeLivenessPropagation<DerivedAnalysis>::stepOverInstruction):
630 * bytecode/BytecodeRewriter.cpp:
631 (JSC::BytecodeRewriter::adjustJumpTargetsInFragment):
632 * bytecode/CallLinkStatus.cpp:
633 (JSC::CallLinkStatus::computeFromLLInt):
634 * bytecode/CodeBlock.cpp:
635 (JSC::CodeBlock::finishCreation):
636 (JSC::CodeBlock::propagateTransitions):
637 (JSC::CodeBlock::finalizeLLIntInlineCaches):
638 (JSC::CodeBlock::hasOpDebugForLineAndColumn):
639 (JSC::CodeBlock::usesOpcode):
640 (JSC::CodeBlock::valueProfileForBytecodeOffset):
641 (JSC::CodeBlock::arithProfileForPC):
642 (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
643 * bytecode/PreciseJumpTargets.cpp:
644 (JSC::getJumpTargetsForBytecodeOffset):
645 (JSC::computePreciseJumpTargetsInternal):
646 (JSC::findJumpTargetsForBytecodeOffset):
647 * bytecode/PreciseJumpTargetsInlines.h:
648 (JSC::extractStoredJumpTargetsForBytecodeOffset):
649 * bytecode/UnlinkedCodeBlock.cpp:
650 (JSC::UnlinkedCodeBlock::applyModification):
651 * dfg/DFGByteCodeParser.cpp:
652 (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
653 (JSC::DFG::ByteCodeParser::parseBlock):
654 * dfg/DFGCapabilities.cpp:
655 (JSC::DFG::capabilityLevel):
656 * interpreter/Interpreter.cpp:
657 (JSC::Interpreter::Interpreter):
658 (JSC::Interpreter::isOpcode):
660 * interpreter/Interpreter.h:
661 (JSC::Interpreter::getOpcode): Deleted.
662 (JSC::Interpreter::getOpcodeID): Deleted.
663 (JSC::Interpreter::isCallBytecode): Deleted.
664 * interpreter/InterpreterInlines.h:
665 (JSC::Interpreter::getOpcode):
666 (JSC::Interpreter::getOpcodeID):
668 (JSC::JIT::privateCompileMainPass):
669 (JSC::JIT::privateCompileSlowCases):
670 * jit/JITOpcodes.cpp:
671 (JSC::JIT::emitNewFuncCommon):
672 (JSC::JIT::emitNewFuncExprCommon):
673 * jit/JITPropertyAccess.cpp:
674 (JSC::JIT::emitSlow_op_put_by_val):
675 (JSC::JIT::privateCompilePutByVal):
676 * jit/JITPropertyAccess32_64.cpp:
677 (JSC::JIT::emitSlow_op_put_by_val):
678 * llint/LLIntSlowPaths.cpp:
679 (JSC::LLInt::llint_trace_operand):
680 (JSC::LLInt::llint_trace_value):
681 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
682 * profiler/ProfilerBytecodeSequence.cpp:
683 (JSC::Profiler::BytecodeSequence::BytecodeSequence):
685 2017-06-16 Matt Lewis <jlewis3@apple.com>
687 Unreviewed, rolling out r218376.
689 The patch cause multiple Layout Test Crashes.
693 "Web Inspector: Instrument 2D/WebGL canvas contexts in the
695 https://bugs.webkit.org/show_bug.cgi?id=172623
696 http://trac.webkit.org/changeset/218376
698 2017-06-16 Konstantin Tokarev <annulen@yandex.ru>
700 REGRESSION(r166799): LogsPageMessagesToSystemConsoleEnabled corrupts non-ASCII characters
701 https://bugs.webkit.org/show_bug.cgi?id=173470
703 Reviewed by Joseph Pecoraro.
705 ConsoleClient::printConsoleMessageWithArguments() incorrectly uses
706 const char* overload of StringBuilder::append() that assummes Latin1
709 * runtime/ConsoleClient.cpp:
710 (JSC::ConsoleClient::printConsoleMessageWithArguments):
712 2017-06-15 Mark Lam <mark.lam@apple.com>
714 Add a JSRunLoopTimer registry in VM.
715 https://bugs.webkit.org/show_bug.cgi?id=173429
716 <rdar://problem/31287961>
718 Reviewed by Filip Pizlo.
720 This way, we can be sure we've got every JSRunLoopTimer instance covered if we
721 need to change their run loop (e.g. when setting to the WebThread's run loop).
725 (JSC::Heap::setRunLoop): Deleted.
727 (JSC::Heap::runLoop): Deleted.
728 * runtime/JSRunLoopTimer.cpp:
729 (JSC::JSRunLoopTimer::JSRunLoopTimer):
730 (JSC::JSRunLoopTimer::setRunLoop):
731 (JSC::JSRunLoopTimer::~JSRunLoopTimer):
734 (JSC::VM::registerRunLoopTimer):
735 (JSC::VM::unregisterRunLoopTimer):
736 (JSC::VM::setRunLoop):
740 2017-06-15 Joseph Pecoraro <pecoraro@apple.com>
742 [Cocoa] Modernize some internal initializers to use instancetype instead of id
743 https://bugs.webkit.org/show_bug.cgi?id=173112
745 Reviewed by Wenson Hsieh.
747 * API/JSContextInternal.h:
748 * API/JSWrapperMap.h:
749 * API/JSWrapperMap.mm:
750 (-[JSObjCClassInfo initForClass:]):
751 (-[JSWrapperMap initWithGlobalContextRef:]):
753 2017-06-15 Matt Baker <mattbaker@apple.com>
755 Web Inspector: Instrument 2D/WebGL canvas contexts in the backend
756 https://bugs.webkit.org/show_bug.cgi?id=172623
757 <rdar://problem/32415986>
759 Reviewed by Devin Rousso.
761 This patch adds a basic Canvas protocol. It includes Canvas and related
762 types and events for monitoring the lifetime of canvases in the page.
765 * DerivedSources.make:
766 * inspector/protocol/Canvas.json: Added.
768 * inspector/scripts/codegen/generator.py:
769 (Generator.stylized_name_for_enum_value):
770 Add special handling for Canvas.ContextType protocol enumeration,
771 so that "canvas-2d" and "webgl" map to `Canvas2D` and `WebGL`.
773 2017-06-15 Keith Miller <keith_miller@apple.com>
775 Add logging to MachineStackMarker to try to diagnose crashes in the wild
776 https://bugs.webkit.org/show_bug.cgi?id=173427
778 Reviewed by Mark Lam.
780 This patch adds some logging to the MachineStackMarker constructor
781 to help figure out where we are seeing crashes. Since macOS does
782 not support os_log_info my hope is that if we set all the callee
783 save registers before making any calls in the C++ code we can
784 figure out which calls is the source of the crash. We also, set
785 all the caller save registers before returning in case some
786 weirdness is happening in the Heap constructor.
788 This logging should not matter from a performance perspective. We
789 only create MachineStackMarkers when we are creating a new VM,
790 which is already expensive.
792 * heap/MachineStackMarker.cpp:
793 (JSC::MachineThreads::MachineThreads):
795 2017-06-15 Yusuke Suzuki <utatane.tea@gmail.com>
797 [JSC] Implement Object.assign in C++
798 https://bugs.webkit.org/show_bug.cgi?id=173414
800 Reviewed by Saam Barati.
802 Implementing Object.assign in JS is not so good compared to C++ version because,
804 1. JS version allocates JS array for object own keys. And we allocate JSString / Symbol for each key.
805 But basically, they can be handled as UniquedStringImpl in C++. Allocating these cells are wasteful.
807 2. While implementing builtins in JS offers some good type speculation chances, Object.assign is inherently super polymorphic.
808 So JS's type profile doesn't help well.
810 3. We have a chance to introduce various fast path for Object.assign in C++.
812 This patch moves implementation from JS to C++. It achieves the above (1) and (2). (3) is filed in [1].
814 We can see 1.65x improvement in SixSpeed object-assign.es6.
818 object-assign.es6 643.3253+-8.0521 ^ 389.1075+-8.8840 ^ definitely 1.6533x faster
820 [1]: https://bugs.webkit.org/show_bug.cgi?id=173416
822 * builtins/ObjectConstructor.js:
825 * runtime/JSCJSValueInlines.h:
826 (JSC::JSValue::putInline):
828 * runtime/JSCellInlines.h:
829 (JSC::JSCell::putInline):
830 * runtime/JSObject.cpp:
831 (JSC::JSObject::put):
832 * runtime/JSObject.h:
833 * runtime/JSObjectInlines.h:
834 (JSC::JSObject::putInlineForJSObject):
835 (JSC::JSObject::putInline): Deleted.
836 * runtime/ObjectConstructor.cpp:
837 (JSC::objectConstructorAssign):
839 2017-06-14 Dan Bernstein <mitz@apple.com>
841 [Cocoa] Objective-C class whose name begins with an underscore can’t be exported to JavaScript
842 https://bugs.webkit.org/show_bug.cgi?id=168578
844 Reviewed by Geoff Garen.
846 * API/JSWrapperMap.mm:
847 (allocateConstructorForCustomClass): Updated for change to forEachProtocolImplementingProtocol.
848 (-[JSObjCClassInfo allocateConstructorAndPrototype]): Ditto.
849 (-[JSWrapperMap classInfoForClass:]): If the class name begins with an underscore, check if
850 it defines conformance to a JSExport-derived protocol and if so, avoid using the
851 superclass as a substitute as we’d normally do.
853 * API/ObjcRuntimeExtras.h:
854 (forEachProtocolImplementingProtocol): Added a "stop" argument to the block to let callers
857 * API/tests/JSExportTests.mm:
858 (+[JSExportTests classNamePrefixedWithUnderscoreTest]): New test for this.
859 (runJSExportTests): Run new test.
861 2017-06-14 Yusuke Suzuki <utatane.tea@gmail.com>
863 Unreviewed, suppress invalid register alloation validation assertion in 32 bit part 2
864 https://bugs.webkit.org/show_bug.cgi?id=172421
866 * dfg/DFGSpeculativeJIT.cpp:
867 (JSC::DFG::SpeculativeJIT::compileArrayIndexOf):
869 2017-06-14 Claudio Saavedra <csaavedra@igalia.com>
871 REGRESSION: 15 new jsc failures in WPE and GTK+
872 https://bugs.webkit.org/show_bug.cgi?id=173349
874 Reviewed by JF Bastien.
876 Recent changes to generateWasm.py are not accounted for from
877 CMake, which leads to WasmOps.h not being regenerated in partial
878 builds. Make generateWasm.py an additional dependency.
881 2017-06-13 Joseph Pecoraro <pecoraro@apple.com>
883 Debugger has unexpected effect on program correctness
884 https://bugs.webkit.org/show_bug.cgi?id=172683
886 Reviewed by Saam Barati.
888 * inspector/InjectedScriptSource.js:
889 (InjectedScript.RemoteObject.prototype._appendPropertyPreviews):
890 (InjectedScript.RemoteObject.prototype._isPreviewableObjectInternal):
891 (BasicCommandLineAPI):
892 Eliminate for..of use with Arrays from InjectedScriptSource as it can be observable.
893 We still use it for Set / Map iteration which we can eliminate when moving to builtins.
895 2017-06-13 JF Bastien <jfbastien@apple.com>
897 WebAssembly: fix erroneous signature comment
898 https://bugs.webkit.org/show_bug.cgi?id=173334
900 Reviewed by Keith Miller.
902 * wasm/WasmSignature.h:
904 2017-06-13 Michael Saboff <msaboff@apple.com>
906 Refactor AbsenceOfSetter to AbsenceOfSetEffects
907 https://bugs.webkit.org/show_bug.cgi?id=173322
909 Reviewed by Filip Pizlo.
911 * bytecode/ObjectPropertyCondition.h:
912 (JSC::ObjectPropertyCondition::absenceOfSetEffectWithoutBarrier):
913 (JSC::ObjectPropertyCondition::absenceOfSetEffect):
914 (JSC::ObjectPropertyCondition::absenceOfSetterWithoutBarrier): Deleted.
915 (JSC::ObjectPropertyCondition::absenceOfSetter): Deleted.
916 * bytecode/ObjectPropertyConditionSet.cpp:
917 (JSC::generateConditionsForPropertySetterMiss):
918 (JSC::generateConditionsForPropertySetterMissConcurrently):
919 * bytecode/PropertyCondition.cpp:
920 (JSC::PropertyCondition::dumpInContext):
921 (JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint):
922 (JSC::PropertyCondition::isStillValid):
923 (WTF::printInternal):
924 * bytecode/PropertyCondition.h:
925 (JSC::PropertyCondition::absenceOfSetEffectWithoutBarrier):
926 (JSC::PropertyCondition::absenceOfSetEffect):
927 (JSC::PropertyCondition::hasPrototype):
928 (JSC::PropertyCondition::hash):
929 (JSC::PropertyCondition::operator==):
930 (JSC::PropertyCondition::absenceOfSetterWithoutBarrier): Deleted.
931 (JSC::PropertyCondition::absenceOfSetter): Deleted.
933 2017-06-13 JF Bastien <jfbastien@apple.com>
935 WebAssembly: import updated spec tests
936 https://bugs.webkit.org/show_bug.cgi?id=173287
937 <rdar://problem/32725975>
939 Reviewed by Saam Barati.
941 Import spec tests as of 31c641cc15f2aedbec2fa45a5185f68416df578b,
942 with a few modifications so things work.
944 Fix a bunch of bugs found through this process, and punt a few tests (which I
945 marked as blocked by this bug).
949 Fix load / store alignment: r216908 erroneously implemented it as bit alignment
950 instead of byte alignment. It was also missing memory-alignment.js despite it
951 being in the ChangeLog, so add it too. This allows spec-test/align.wast.js to
954 Tables can be imported or in a section. There can be only one, but sections can
955 be empty. An Elements section can exist if there's no Table, as long as it is
958 Memories can be imported or in a section. There can be only one, but sections
959 can be empty. A Data section can exist if there's no Memory, as long as it is
962 Prototypes: stringify without .prototype. in the string.
964 WebAssembly.Table.prototype.grow was plain wrong: it takes a delta parameter,
965 not a final size, and throws a RangeError on failure, not a TypeError.
967 Fix compile / instantiate so the reject the promise if given an argument of the
968 wrong type (instead of failing instantly).
970 Fix async on neuter test.
972 Element section shouldn't affect any Table if any of the elements are out of
973 bounds. We need to process it in two passes.
975 Segment section shouldn't affect any Data if any of the segments are out of
976 bounds. We need to process it in two passes.
978 Empty data segments are valid, but only when there is no memory. Their index
979 still gets validated, and has to be zero.
983 Error messages with context, the test seems overly restrictive but this is
986 compile/instantiate/validate property descriptors.
990 Temporarily disable NaN tests. We need to go back and implement the following
991 semantics: https://github.com/WebAssembly/spec/pull/414 This doesn't matter as
992 much as getting all the other tests passing.
994 Worth noting for NaNs: f64.no_fold_mul_one (also a NaN test) as well as
995 no_fold_promote_demote (an interesting corner case which we get wrong). mul by
996 one is (assert_return (invoke \"f64.no_fold_mul_one\" (i64.const
997 0x7ff4000000000000)) (i64.const 0x7ff8000000000000)) which means converting sNaN
998 to qNaN, and promote/demote is (assert_return (invoke \"no_fold_promote_demote\"
999 (i32.const 0x7fa00000)) (i32.const 0x7fc00000)) which is the same. I'm not sure
1000 why they're not allowed.
1002 * wasm/WasmB3IRGenerator.cpp:
1003 * wasm/WasmFunctionParser.h:
1004 * wasm/WasmModuleParser.cpp:
1005 * wasm/WasmModuleParser.h:
1006 * wasm/WasmParser.h:
1007 (JSC::Wasm::Parser<SuccessType>::consumeUTF8String):
1008 * wasm/generateWasm.py:
1009 (memoryLog2Alignment):
1010 * wasm/js/JSWebAssemblyTable.cpp:
1011 (JSC::JSWebAssemblyTable::grow):
1012 * wasm/js/JSWebAssemblyTable.h:
1013 * wasm/js/WebAssemblyCompileErrorPrototype.cpp:
1014 * wasm/js/WebAssemblyInstancePrototype.cpp:
1015 * wasm/js/WebAssemblyLinkErrorPrototype.cpp:
1016 * wasm/js/WebAssemblyMemoryPrototype.cpp:
1017 * wasm/js/WebAssemblyModulePrototype.cpp:
1018 * wasm/js/WebAssemblyModuleRecord.cpp:
1019 (JSC::WebAssemblyModuleRecord::evaluate):
1020 * wasm/js/WebAssemblyPrototype.cpp:
1021 (JSC::webAssemblyCompileFunc):
1024 (JSC::compileAndInstantiate):
1025 (JSC::webAssemblyInstantiateFunc):
1026 * wasm/js/WebAssemblyRuntimeErrorPrototype.cpp:
1027 * wasm/js/WebAssemblyTablePrototype.cpp:
1028 (JSC::webAssemblyTableProtoFuncGrow):
1030 2017-06-13 Michael Saboff <msaboff@apple.com>
1032 DFG doesn't properly handle a property that is change to read only in a prototype
1033 https://bugs.webkit.org/show_bug.cgi?id=173321
1035 Reviewed by Filip Pizlo.
1037 We need to check for ReadOnly as well as a not being a Setter when checking
1040 * bytecode/PropertyCondition.cpp:
1041 (JSC::PropertyCondition::isStillValidAssumingImpurePropertyWatchpoint):
1043 2017-06-13 Daniel Bates <dabates@apple.com>
1045 Implement W3C Secure Contexts Draft Specification
1046 https://bugs.webkit.org/show_bug.cgi?id=158121
1047 <rdar://problem/26012994>
1049 Reviewed by Brent Fulgham.
1053 Adds isSecureContext to the list of common identifiers as needed to support
1054 toggling its exposure from a runtime enabled feature flag.
1056 * runtime/CommonIdentifiers.h:
1058 2017-06-13 Don Olmstead <don.olmstead@sony.com>
1060 [JSC] Remove redundant includes in config.h
1061 https://bugs.webkit.org/show_bug.cgi?id=173294
1063 Reviewed by Alex Christensen.
1067 2017-06-12 Saam Barati <sbarati@apple.com>
1069 We should not claim that SpecEmpty is filtered out of cell checks on 64 bit platforms
1070 https://bugs.webkit.org/show_bug.cgi?id=172957
1071 <rdar://problem/32602704>
1073 Reviewed by Filip Pizlo.
1075 Consider this program:
1078 n: GetClosureVar(..., |this|) // this will load empty JSValue()
1079 SetLocal(Cell:@n, locFoo) // Cell check succeeds because JSValue() looks like a cell
1084 y: CheckNotEmpty(@x)
1087 If we claim that a cell check filters out the empty value, we will
1088 incorrectly eliminate the CheckNotEmpty node @y. This patch fixes AI,
1089 FTLLowerDFGToB3, and DFGSpeculativeJIT to no longer make this claim.
1091 On 64 bit platforms:
1092 - Cell use kind *now allows* the empty value to pass through.
1093 - CellOrOther use kind *now allows* for the empty value to pass through
1094 - NotCell use kind *no longer allows* the empty value to pass through.
1097 (JSC::isARMv7IDIVSupported):
1104 Make these functions constexpr so we can use them in static variable assignment.
1106 * bytecode/SpeculatedType.h:
1107 * dfg/DFGSpeculativeJIT.cpp:
1108 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
1109 (JSC::DFG::SpeculativeJIT::compileDoubleRep):
1110 (JSC::DFG::SpeculativeJIT::compileLogicalNotStringOrOther):
1111 (JSC::DFG::SpeculativeJIT::emitStringOrOtherBranch):
1112 (JSC::DFG::SpeculativeJIT::speculateCell):
1113 (JSC::DFG::SpeculativeJIT::speculateCellOrOther):
1114 (JSC::DFG::SpeculativeJIT::speculateObjectOrOther):
1115 (JSC::DFG::SpeculativeJIT::speculateString):
1116 (JSC::DFG::SpeculativeJIT::speculateStringOrOther):
1117 (JSC::DFG::SpeculativeJIT::speculateSymbol):
1118 (JSC::DFG::SpeculativeJIT::speculateNotCell):
1119 * dfg/DFGSpeculativeJIT32_64.cpp:
1120 * dfg/DFGSpeculativeJIT64.cpp:
1121 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
1122 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
1123 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
1124 (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
1125 (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
1127 (JSC::DFG::typeFilterFor):
1128 * ftl/FTLLowerDFGToB3.cpp:
1129 (JSC::FTL::DFG::LowerDFGToB3::compileDoubleRep):
1130 (JSC::FTL::DFG::LowerDFGToB3::numberOrNotCellToInt32):
1131 (JSC::FTL::DFG::LowerDFGToB3::compareEqObjectOrOtherToObject):
1132 (JSC::FTL::DFG::LowerDFGToB3::boolify):
1133 (JSC::FTL::DFG::LowerDFGToB3::equalNullOrUndefined):
1134 (JSC::FTL::DFG::LowerDFGToB3::lowCell):
1135 (JSC::FTL::DFG::LowerDFGToB3::lowNotCell):
1136 (JSC::FTL::DFG::LowerDFGToB3::isCellOrMisc):
1137 (JSC::FTL::DFG::LowerDFGToB3::isNotCellOrMisc):
1138 (JSC::FTL::DFG::LowerDFGToB3::isNotCell):
1139 (JSC::FTL::DFG::LowerDFGToB3::isCell):
1140 (JSC::FTL::DFG::LowerDFGToB3::speculateCellOrOther):
1141 (JSC::FTL::DFG::LowerDFGToB3::speculateObjectOrOther):
1142 (JSC::FTL::DFG::LowerDFGToB3::speculateString):
1143 (JSC::FTL::DFG::LowerDFGToB3::speculateStringOrOther):
1144 (JSC::FTL::DFG::LowerDFGToB3::speculateSymbol):
1146 2017-06-12 Yusuke Suzuki <utatane.tea@gmail.com>
1148 Unreviewed, suppress invalid register alloation validation assertion in 32 bit
1149 https://bugs.webkit.org/show_bug.cgi?id=172421
1151 * dfg/DFGSpeculativeJIT.cpp:
1152 (JSC::DFG::SpeculativeJIT::compileArrayIndexOf):
1154 2017-06-12 Oleksandr Skachkov <gskachkov@gmail.com>
1156 We incorrectly allow escaped characters in keyword tokens
1157 https://bugs.webkit.org/show_bug.cgi?id=171310
1159 Reviewed by Yusuke Suzuki.
1161 According spec it is not allow to use escaped characters in
1162 keywords. https://tc39.github.io/ecma262/#sec-reserved-words
1163 Current patch implements this requirements.
1167 (JSC::Lexer<CharacterType>::parseIdentifierSlowCase):
1168 * parser/Parser.cpp:
1169 (JSC::Parser<LexerType>::printUnexpectedTokenText):
1170 * parser/ParserTokens.h:
1172 2017-06-12 Yusuke Suzuki <utatane.tea@gmail.com>
1174 Unreviewed, add branch64(Cond, BaseIndex, RegisterID) for ARM64
1175 https://bugs.webkit.org/show_bug.cgi?id=172421
1177 * assembler/MacroAssemblerARM64.h:
1178 (JSC::MacroAssemblerARM64::branch64):
1179 (JSC::MacroAssemblerARM64::branchPtr):
1181 2017-06-12 Commit Queue <commit-queue@webkit.org>
1183 Unreviewed, rolling out r218093.
1184 https://bugs.webkit.org/show_bug.cgi?id=173259
1186 Break builds (Requested by yusukesuzuki on #webkit).
1190 "Unreviewed, build fix for ARM64"
1191 https://bugs.webkit.org/show_bug.cgi?id=172421
1192 http://trac.webkit.org/changeset/218093
1194 2017-06-12 Yusuke Suzuki <utatane.tea@gmail.com>
1196 Unreviewed, build fix for ARM64
1197 https://bugs.webkit.org/show_bug.cgi?id=172421
1199 * dfg/DFGSpeculativeJIT.cpp:
1200 (JSC::DFG::SpeculativeJIT::compileArrayIndexOf):
1202 2017-06-09 Yusuke Suzuki <utatane.tea@gmail.com>
1204 [DFG] Add ArrayIndexOf intrinsic
1205 https://bugs.webkit.org/show_bug.cgi?id=172421
1207 Reviewed by Saam Barati.
1209 This patch introduces ArrayIndexOfInstrinsic for DFG and FTL optimizations.
1210 We emit array check and go fast path if the array is Array::Int32, Array::Double
1211 or Array::Continugous. In addition, for Array::Int32 and Array::Double case,
1212 we have inlined fast paths.
1214 With updated ARES-6 Babylon,
1217 firstIteration: 45.76 +- 3.87 ms
1218 averageWorstCase: 24.41 +- 2.17 ms
1219 steadyState: 8.01 +- 0.22 ms
1221 firstIteration: 45.64 +- 4.23 ms
1222 averageWorstCase: 23.03 +- 3.34 ms
1223 steadyState: 7.33 +- 0.34 ms
1228 map-set-lookup.es5 734.4701+-10.4383 ^ 102.0968+-2.6357 ^ definitely 7.1939x faster
1229 map-set.es5 41.1396+-1.0558 ^ 33.1916+-0.7986 ^ definitely 1.2395x faster
1230 map-set-object.es5 62.8317+-1.2518 ^ 45.6944+-0.8369 ^ definitely 1.3750x faster
1232 * dfg/DFGAbstractInterpreterInlines.h:
1233 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1234 * dfg/DFGByteCodeParser.cpp:
1235 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
1236 * dfg/DFGClobberize.h:
1237 (JSC::DFG::clobberize):
1238 * dfg/DFGDoesGC.cpp:
1240 * dfg/DFGFixupPhase.cpp:
1241 (JSC::DFG::FixupPhase::fixupNode):
1243 (JSC::DFG::Node::hasArrayMode):
1244 * dfg/DFGNodeType.h:
1245 * dfg/DFGOperations.cpp:
1246 * dfg/DFGOperations.h:
1247 * dfg/DFGPredictionPropagationPhase.cpp:
1248 * dfg/DFGSafeToExecute.h:
1249 (JSC::DFG::safeToExecute):
1250 * dfg/DFGSpeculativeJIT.cpp:
1251 (JSC::DFG::SpeculativeJIT::compileArrayIndexOf):
1252 (JSC::DFG::SpeculativeJIT::speculateObject):
1253 * dfg/DFGSpeculativeJIT.h:
1254 (JSC::DFG::SpeculativeJIT::callOperation):
1255 * dfg/DFGSpeculativeJIT32_64.cpp:
1256 (JSC::DFG::SpeculativeJIT::compile):
1257 * dfg/DFGSpeculativeJIT64.cpp:
1258 (JSC::DFG::SpeculativeJIT::compile):
1259 (JSC::DFG::SpeculativeJIT::speculateInt32):
1260 * ftl/FTLCapabilities.cpp:
1261 (JSC::FTL::canCompile):
1262 * ftl/FTLLowerDFGToB3.cpp:
1263 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1264 (JSC::FTL::DFG::LowerDFGToB3::compileArrayIndexOf):
1265 * jit/JITOperations.h:
1266 * runtime/ArrayPrototype.cpp:
1267 (JSC::ArrayPrototype::finishCreation):
1268 * runtime/Intrinsic.cpp:
1269 (JSC::intrinsicName):
1270 * runtime/Intrinsic.h:
1272 2017-06-11 Keith Miller <keith_miller@apple.com>
1274 TypedArray constructor with string shouldn't throw
1275 https://bugs.webkit.org/show_bug.cgi?id=173181
1277 Reviewed by JF Bastien.
1279 We should be coercing primitive arguments to numbers in the various
1280 TypedArray constructors.
1282 * runtime/JSGenericTypedArrayViewConstructorInlines.h:
1283 (JSC::constructGenericTypedArrayViewWithArguments):
1285 2017-06-11 Yusuke Suzuki <utatane.tea@gmail.com>
1287 [WTF] Make ThreadMessage portable
1288 https://bugs.webkit.org/show_bug.cgi?id=172073
1290 Reviewed by Keith Miller.
1292 * runtime/MachineContext.h:
1293 (JSC::MachineContext::stackPointer):
1294 * tools/CodeProfiling.cpp:
1295 (JSC::profilingTimer):
1297 2017-06-11 Yusuke Suzuki <utatane.tea@gmail.com>
1299 [JSC] Shrink Structure size
1300 https://bugs.webkit.org/show_bug.cgi?id=173239
1302 Reviewed by Mark Lam.
1304 We find that the size of our Structure is slightly enlarged due to paddings.
1305 By changing the order of members, we can reduce the size from 120 to 112.
1306 This is good because 120 and 112 are categorized into different size classes.
1307 For 120, we allocate 128 bytes. And for 112, we allocate 112 bytes.
1308 We now save 16 bytes per Structure for free.
1310 * runtime/ConcurrentJSLock.h:
1311 * runtime/Structure.cpp:
1312 (JSC::Structure::Structure):
1313 * runtime/Structure.h:
1315 2017-06-11 Konstantin Tokarev <annulen@yandex.ru>
1317 Unreviewed, attempt to fix JSC tests on Win after r217771
1320 (currentWorkingDirectory): buffer is not NULL-terminated
1322 2017-06-10 Yusuke Suzuki <utatane.tea@gmail.com>
1324 [WTF] Add RegisteredSymbolImpl
1325 https://bugs.webkit.org/show_bug.cgi?id=173230
1327 Reviewed by Mark Lam.
1329 * runtime/SymbolConstructor.cpp:
1330 (JSC::symbolConstructorKeyFor):
1332 2017-06-10 Dan Bernstein <mitz@apple.com>
1334 Reverted r218056 because it made the IDE reindex constantly.
1336 * Configurations/DebugRelease.xcconfig:
1338 2017-06-10 Dan Bernstein <mitz@apple.com>
1340 [Xcode] With Xcode 9 developer beta, everything rebuilds when switching between command-line and IDE
1341 https://bugs.webkit.org/show_bug.cgi?id=173223
1343 Reviewed by Sam Weinig.
1345 The rebuilds were happening due to a difference in the compiler options that the IDE and
1346 xcodebuild were specifying. Only the IDE was passing the -index-store-path option. To make
1347 xcodebuild pass that option, too, set CLANG_INDEX_STORE_ENABLE to YES if it is unset, and
1348 specify an appropriate path in CLANG_INDEX_STORE_PATH.
1350 * Configurations/DebugRelease.xcconfig:
1352 2017-06-10 Yusuke Suzuki <utatane.tea@gmail.com>
1354 [JSC] Update RegExp.prototype.[@@search]] implementation according to the latest spec
1355 https://bugs.webkit.org/show_bug.cgi?id=173227
1357 Reviewed by Mark Lam.
1359 The latest spec introduces slight change to RegExp.prototype.[@@search].
1360 This patch applies this change. Basically, this change is done in the slow path of
1361 the RegExp.prototype[@@search].
1362 https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
1364 * builtins/RegExpPrototype.js:
1367 2017-06-09 Chris Dumez <cdumez@apple.com>
1369 Update Thread::create() to take in a WTF::Function instead of a std::function
1370 https://bugs.webkit.org/show_bug.cgi?id=173175
1372 Reviewed by Mark Lam.
1374 * API/tests/CompareAndSwapTest.cpp:
1375 (testCompareAndSwap):
1377 2017-06-09 Yusuke Suzuki <utatane.tea@gmail.com>
1379 [DFG] Add verboseDFGOSRExit
1380 https://bugs.webkit.org/show_bug.cgi?id=173156
1382 Reviewed by Saam Barati.
1384 This patch adds verboseDFGOSRExit which is similar to verboseFTLOSRExit.
1386 * dfg/DFGOSRExitCompiler.cpp:
1387 * runtime/Options.h:
1389 2017-06-09 Guillaume Emont <guijemont@igalia.com>
1391 [JSC][MIPS] Add MacroAssemblerMIPS::xor32(Address, RegisterID) implementation
1392 https://bugs.webkit.org/show_bug.cgi?id=173170
1394 Reviewed by Yusuke Suzuki.
1396 MIPS does not build since r217711 because it is missing this
1397 implementation. This patch fixes the build.
1399 * assembler/MacroAssemblerMIPS.h:
1400 (JSC::MacroAssemblerMIPS::xor32):
1402 2017-06-09 Yusuke Suzuki <utatane.tea@gmail.com>
1404 [JSC] FTL does not require dlfcn
1405 https://bugs.webkit.org/show_bug.cgi?id=173143
1407 Reviewed by Darin Adler.
1409 We no longer use LLVM library. Thus, dlfcn.h is not necessary.
1410 Also, ProcessID is not used in FTLLowerDFGToB3.cpp.
1412 * ftl/FTLLowerDFGToB3.cpp:
1414 2017-06-09 Yusuke Suzuki <utatane.tea@gmail.com>
1416 [DFG] Add --verboseDFGFailure
1417 https://bugs.webkit.org/show_bug.cgi?id=173155
1419 Reviewed by Sam Weinig.
1421 Similar to verboseFTLFailure, JSC should have verboseDFGFailure flag to show DFG failures quickly.
1423 * dfg/DFGCapabilities.cpp:
1424 (JSC::DFG::verboseCapabilities):
1425 (JSC::DFG::debugFail):
1426 * runtime/Options.cpp:
1427 (JSC::recomputeDependentOptions):
1428 * runtime/Options.h:
1430 2017-06-09 Yusuke Suzuki <utatane.tea@gmail.com>
1432 [JSC] Drop OS(DARWIN) for VM_TAG_FOR_WEBASSEMBLY_MEMORY
1433 https://bugs.webkit.org/show_bug.cgi?id=173147
1435 Reviewed by JF Bastien.
1437 Because this value becomes -1 in non-Darwin environments.
1438 Thus, we do not need to use OS(DARWIN) here.
1440 * wasm/WasmMemory.cpp:
1442 2017-06-09 Daewoong Jang <daewoong.jang@navercorp.com>
1444 Reduce compiler warnings
1445 https://bugs.webkit.org/show_bug.cgi?id=172078
1447 Reviewed by Yusuke Suzuki.
1449 * runtime/IntlDateTimeFormat.h:
1451 2017-06-08 Joseph Pecoraro <pecoraro@apple.com>
1453 [Cocoa] JSWrapperMap leaks for all JSContexts
1454 https://bugs.webkit.org/show_bug.cgi?id=173110
1455 <rdar://problem/32602198>
1457 Reviewed by Geoffrey Garen.
1460 (-[JSContext ensureWrapperMap]):
1461 Ensure this allocation gets released.
1463 2017-06-08 Filip Pizlo <fpizlo@apple.com>
1465 REGRESSION: js/dom/prototype-chain-caching-with-impure-get-own-property-slot-traps-5.html has a flaky failure
1466 https://bugs.webkit.org/show_bug.cgi?id=161156
1468 Reviewed by Saam Barati.
1470 Since LLInt does not register impure property watchpoints for self property accesses, it
1471 shouldn't try to cache accesses that require a watchpoint.
1473 This manifested as a flaky failure because the test would fire the watchpoint after we had
1474 usually already tiered up. Without concurrent JIT, we would have always tiered up before
1475 getting to the bad case. With concurrent JIT, we would sometimes not tier up by that time. This
1476 also adds a test that deterministically failed in LLInt without this change; it does so by just
1477 running a lot shorter.
1479 * llint/LLIntSlowPaths.cpp:
1480 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
1482 2017-06-08 Keith Miller <keith_miller@apple.com>
1484 WebAssembly: We should only create wrappers for functions that can be exported
1485 https://bugs.webkit.org/show_bug.cgi?id=173088
1487 Reviewed by Saam Barati.
1489 This patch makes it so we only create wrappers for WebAssembly functions that
1490 can actually be exported. It appears to be a ~2.5% speedup on WasmBench compile times.
1492 This patch also removes most of the old testWasmModuleFunctions api from the jsc CLI.
1493 Most of the tests were duplicates of ones in the spec-tests directory. The others I
1494 have converted to use the normal API.
1497 (GlobalObject::finishCreation):
1498 (valueWithTypeOfWasmValue): Deleted.
1500 (callWasmFunction): Deleted.
1501 (functionTestWasmModuleFunctions): Deleted.
1502 * wasm/WasmB3IRGenerator.cpp:
1503 (JSC::Wasm::B3IRGenerator::B3IRGenerator):
1504 (JSC::Wasm::createJSToWasmWrapper):
1505 (JSC::Wasm::parseAndCompile):
1506 * wasm/WasmB3IRGenerator.h:
1507 * wasm/WasmBBQPlan.cpp:
1508 (JSC::Wasm::BBQPlan::prepare):
1509 (JSC::Wasm::BBQPlan::compileFunctions):
1510 (JSC::Wasm::BBQPlan::complete):
1511 * wasm/WasmBBQPlan.h:
1512 * wasm/WasmBBQPlanInlines.h:
1513 (JSC::Wasm::BBQPlan::initializeCallees):
1514 * wasm/WasmCodeBlock.cpp:
1515 (JSC::Wasm::CodeBlock::CodeBlock):
1516 * wasm/WasmCodeBlock.h:
1517 (JSC::Wasm::CodeBlock::jsEntrypointCalleeFromFunctionIndexSpace):
1518 * wasm/WasmFormat.h:
1519 * wasm/WasmOMGPlan.cpp:
1520 (JSC::Wasm::OMGPlan::work):
1522 2017-06-07 JF Bastien <jfbastien@apple.com>
1524 WebAssembly: test imports and exports with 16-bit characters
1525 https://bugs.webkit.org/show_bug.cgi?id=165977
1526 <rdar://problem/29760130>
1528 Reviewed by Saam Barati.
1530 Add the missing UTF-8 conversions. Improve import failure error
1531 messages, otherwise it's hard to figure out which import is wrong.
1533 * wasm/js/JSWebAssemblyInstance.cpp:
1534 (JSC::JSWebAssemblyInstance::create):
1535 * wasm/js/WebAssemblyModuleRecord.cpp:
1536 (JSC::WebAssemblyModuleRecord::finishCreation):
1537 (JSC::WebAssemblyModuleRecord::link):
1539 2017-06-07 Devin Rousso <drousso@apple.com>
1541 Web Inspector: Add ContextMenu item to log WebSocket object to console
1542 https://bugs.webkit.org/show_bug.cgi?id=172878
1544 Reviewed by Joseph Pecoraro.
1546 * inspector/protocol/Network.json:
1547 Add resolveWebSocket command.
1549 2017-06-07 Jon Davis <jond@apple.com>
1551 Update feature status for features Supported In Preview
1552 https://bugs.webkit.org/show_bug.cgi?id=173071
1554 Reviewed by Darin Adler.
1556 Updated Media Capture and Streams, Performance Observer, Resource Timing Level 2,
1557 User Timing Level 2, Web Cryptography API, WebGL 2, WebRTC.
1561 2017-06-07 Saam Barati <sbarati@apple.com>
1563 Assertion failure in com.apple.WebKit.WebContent.Development in com.apple.JavaScriptCore: JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined + 141
1564 https://bugs.webkit.org/show_bug.cgi?id=172673
1565 <rdar://problem/32250144>
1567 Reviewed by Mark Lam.
1569 This patch simply removes this assertion. It's faulty because it
1570 races with the main thread when doing concurrent compilation.
1572 Consider a program with:
1573 - a FrozenValue over an object O and Structure S1. S1 starts off as dfgWatchable() being true.
1576 The DFG IR is like so:
1577 a: JSConstant(O) // FrozenValue {O, S1}
1578 b: CheckStructure(@a, S2)
1580 d: CheckEq(@c, nullConstant)
1583 The AbstractValue for @a will start off as having a finite structure because S1 is dfgWatchable().
1584 When running AI, we'll notice that node @b will OSR exit, so nodes after
1585 @b are unreachable. Later in the compilation, S1 is no longer dfgWatchable().
1586 Now, when running AI, @a will have Top for its structure set. No longer will
1589 The DFG backend asserts that under such a situation, we should have simplified
1590 the CheckEq to false. However, this is a racy thing to assert, since the
1591 transition from dfgWatchable() to !dfgWatchable() can happen right before we
1592 enter the backend. Hence, this assertion is not valid.
1594 (Note, the generated code for the above program will never actually execute.
1595 Since we noticed S1 as dfgWatchable(), we make the compilation dependent on
1596 S1 not transitioning. S1 transitions, so we won't actually run the code that
1599 * dfg/DFGSpeculativeJIT64.cpp:
1600 (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined):
1602 2017-06-07 Yusuke Suzuki <utatane.tea@gmail.com>
1604 [JSC] has_generic_property never accepts non-String
1605 https://bugs.webkit.org/show_bug.cgi?id=173057
1607 Reviewed by Darin Adler.
1609 We never pass non-String value to has_generic_property bytecode.
1611 * runtime/CommonSlowPaths.cpp:
1612 (JSC::SLOW_PATH_DECL):
1614 2017-06-06 Fujii Hironori <Hironori.Fujii@sony.com>
1616 [Win][x86-64] Some callee saved registers aren't preserved
1617 https://bugs.webkit.org/show_bug.cgi?id=171266
1619 Reviewed by Saam Barati.
1621 * jit/RegisterSet.cpp:
1622 (JSC::RegisterSet::calleeSaveRegisters): Added edi and esi for X86_64 Windows.
1624 2017-06-06 Mark Lam <mark.lam@apple.com>
1626 Contiguous storage butterfly length should not exceed MAX_STORAGE_VECTOR_LENGTH.
1627 https://bugs.webkit.org/show_bug.cgi?id=173035
1628 <rdar://problem/32554593>
1630 Reviewed by Geoffrey Garen and Filip Pizlo.
1632 Also added and fixed up some assertions.
1634 * runtime/ArrayConventions.h:
1635 * runtime/JSArray.cpp:
1636 (JSC::JSArray::setLength):
1637 * runtime/JSObject.cpp:
1638 (JSC::JSObject::createInitialIndexedStorage):
1639 (JSC::JSObject::ensureLengthSlow):
1640 (JSC::JSObject::reallocateAndShrinkButterfly):
1641 * runtime/JSObject.h:
1642 (JSC::JSObject::ensureLength):
1643 * runtime/RegExpObject.cpp:
1644 (JSC::collectMatches):
1645 * runtime/RegExpPrototype.cpp:
1646 (JSC::regExpProtoFuncSplitFast):
1648 2017-06-06 Saam Barati <sbarati@apple.com>
1650 Make sure we restore SP when doing calls that could be to JS
1651 https://bugs.webkit.org/show_bug.cgi?id=172946
1652 <rdar://problem/32579026>
1654 Reviewed by JF Bastien.
1656 I was worried that there was a bug where we'd call JS, JS would tail call,
1657 and we'd end up with a bogus SP. However, this bug does not exist since wasm
1658 always calls to JS through a stub, and the stub treats SP as a callee save.
1660 I wrote a test for this, and also made a note that this is the needed ABI.
1662 * wasm/WasmBinding.cpp:
1663 (JSC::Wasm::wasmToJs):
1665 2017-06-06 Keith Miller <keith_miller@apple.com>
1667 OMG tier up checks should be a patchpoint
1668 https://bugs.webkit.org/show_bug.cgi?id=172944
1670 Reviewed by Saam Barati.
1672 Tier up checks in BBQ should be done as a patchpoint rather than individual B3 opcodes.
1673 In order to reduce code generated out of line in each function. We generate a single stub
1674 that pushes all the callee-saves. This looks like a 5-10% compile time speedup.
1676 * wasm/WasmB3IRGenerator.cpp:
1677 (JSC::Wasm::B3IRGenerator::B3IRGenerator):
1678 (JSC::Wasm::B3IRGenerator::emitTierUpCheck):
1679 (JSC::Wasm::B3IRGenerator::addLoop):
1680 * wasm/WasmThunks.cpp:
1681 (JSC::Wasm::triggerOMGTierUpThunkGenerator):
1682 * wasm/WasmThunks.h:
1684 2017-06-06 Darin Adler <darin@apple.com>
1686 Cut down use of WTF_ARRAY_LENGTH
1687 https://bugs.webkit.org/show_bug.cgi?id=172997
1689 Reviewed by Chris Dumez.
1692 (JSC::singleEscape): Use WTF_ARRAY_LENGTH instead of ARRAY_SIZE.
1694 * runtime/NumberPrototype.cpp:
1695 (JSC::toStringWithRadix): Use std::end instead of WTF_ARRAY_LENGTH.
1697 2017-06-06 Konstantin Tokarev <annulen@yandex.ru>
1699 Add missing <functional> includes
1700 https://bugs.webkit.org/show_bug.cgi?id=173017
1702 Patch by Thiago Macieira <thiago.macieira@intel.com>
1703 Reviewed by Yusuke Suzuki.
1705 This patch fixes compilation with GCC 7.
1707 * inspector/InspectorBackendDispatcher.h:
1709 2017-06-06 Filip Pizlo <fpizlo@apple.com>
1711 Unreviewed, fix 32-bit build.
1713 * jit/JITOpcodes.cpp:
1714 (JSC::JIT::emit_op_unreachable):
1716 2017-06-06 Joseph Pecoraro <pecoraro@apple.com>
1718 Unreviewed rollout r217807. Caused a test to crash.
1720 * heap/HeapSnapshotBuilder.cpp:
1721 (JSC::HeapSnapshotBuilder::buildSnapshot):
1722 (JSC::HeapSnapshotBuilder::json):
1724 * heap/HeapSnapshotBuilder.h:
1725 * runtime/JSObject.cpp:
1726 (JSC::JSObject::calculatedClassName):
1728 2017-06-06 Filip Pizlo <fpizlo@apple.com>
1730 index out of bound in bytecodebasicblock
1731 https://bugs.webkit.org/show_bug.cgi?id=172963
1733 Reviewed by Saam Barati and Mark Lam.
1735 We were leaving an unterminated basic block when generating CodeForCall for a class
1736 constructor. This was mostly benign since that unterminated block was not reachable, but it
1737 does cause an ASSERT.
1739 This fixes the issue by appending op_unreachable to that block. I added op_unreachable because
1740 this really is the cleanest and most idiomatic way to solve this problem, so even though it
1741 makes the change bigger it's probabably worth it.
1743 * bytecode/BytecodeDumper.cpp:
1744 (JSC::BytecodeDumper<Block>::dumpBytecode):
1745 * bytecode/BytecodeList.json:
1746 * bytecode/BytecodeUseDef.h:
1747 (JSC::computeUsesForBytecodeOffset):
1748 (JSC::computeDefsForBytecodeOffset):
1749 * bytecode/Opcode.h:
1751 * bytecompiler/BytecodeGenerator.cpp:
1752 (JSC::BytecodeGenerator::generate):
1753 (JSC::BytecodeGenerator::emitUnreachable):
1754 * bytecompiler/BytecodeGenerator.h:
1755 * dfg/DFGByteCodeParser.cpp:
1756 (JSC::DFG::ByteCodeParser::parseBlock):
1757 * dfg/DFGCapabilities.cpp:
1758 (JSC::DFG::capabilityLevel):
1759 * ftl/FTLLowerDFGToB3.cpp:
1760 (JSC::FTL::DFG::LowerDFGToB3::compileUnreachable):
1762 (JSC::JIT::privateCompileMainPass):
1764 * jit/JITOpcodes.cpp:
1765 (JSC::JIT::emit_op_unreachable):
1766 * llint/LowLevelInterpreter.asm:
1767 * runtime/CommonSlowPaths.cpp:
1768 (JSC::SLOW_PATH_DECL):
1769 * runtime/CommonSlowPaths.h:
1771 2017-06-06 Ryan Haddad <ryanhaddad@apple.com>
1773 Unreviewed, rolling out r217812.
1775 This change caused test failures on arm64.
1779 "OMG tier up checks should be a patchpoint"
1780 https://bugs.webkit.org/show_bug.cgi?id=172944
1781 http://trac.webkit.org/changeset/217812
1783 2017-06-06 Carlos Garcia Campos <cgarcia@igalia.com>
1785 [WPE] Enable remote inspector
1786 https://bugs.webkit.org/show_bug.cgi?id=172971
1788 Reviewed by Žan Doberšek.
1790 We can just build the current glib remote inspector, without adding a frontend implementation and using a
1791 WebKitGTK+ browser as frontend for now.
1793 * PlatformWPE.cmake: Add remote inspector files to compilation.
1794 * inspector/remote/glib/RemoteInspectorUtils.cpp:
1795 (Inspector::backendCommands): Load the inspector resources library.
1797 2017-06-06 Carlos Garcia Campos <cgarcia@igalia.com>
1799 [GLIB] Make remote inspector DBus protocol common to all glib based ports
1800 https://bugs.webkit.org/show_bug.cgi?id=172970
1802 Reviewed by Žan Doberšek.
1804 We are currently using "webkitgtk" in the names of DBus interfaces and object paths inside an ifdef with the
1805 idea that other ports could use their own names. However, the protocol is the same, so we could use the same
1806 names and make all glib based ports compatible to each other. This way we could use the GTK+ MiniBrowser to
1807 debug WPE, without having to implement the frontend part in WPE yet.
1809 * inspector/remote/glib/RemoteInspectorGlib.cpp: Use webkit instead of webkitgtk and reomve platform idfeds.
1810 * inspector/remote/glib/RemoteInspectorServer.cpp: Ditto.
1812 2017-06-06 Carlos Garcia Campos <cgarcia@igalia.com>
1814 [GTK] Web Process deadlock when closing the remote inspector frontend
1815 https://bugs.webkit.org/show_bug.cgi?id=172973
1817 Reviewed by Žan Doberšek.
1819 We are taking the remote inspector mutex twice. First close message is received, and receivedCloseMessage()
1820 takes the mutex. Then RemoteConnectionToTarget::close() is called that, when connected, calls
1821 PageDebuggable::disconnect() that ends up calling RemoteInspector::updateTarget() that also takes the remote
1822 inspector mutex. We should release the mutex before calling RemoteConnectionToTarget::close().
1824 * inspector/remote/glib/RemoteInspectorGlib.cpp:
1825 (Inspector::RemoteInspector::receivedCloseMessage):
1827 2017-06-05 Saam Barati <sbarati@apple.com>
1829 Try to fix features.json by adding an ESNext section.
1835 2017-06-05 David Kilzer <ddkilzer@apple.com>
1837 Follow-up: Update JSC's features.json
1838 https://bugs.webkit.org/show_bug.cgi?id=172942
1840 Rubber-stamped by Jon Davis.
1842 * features.json: Change "Supported in preview" to
1843 "Supported" to try to fix <https://webkit.org/status/>.
1845 2017-06-05 Saam Barati <sbarati@apple.com>
1847 We don't properly parse init_expr when the opcode is an unexpected opcode
1848 https://bugs.webkit.org/show_bug.cgi?id=172945
1850 Reviewed by JF Bastien.
1852 The bug is a simple typo. It should use the constant
1853 `true` instead of `false` when invoking the WASM_PARSER_FAIL_IF
1854 macro. This failure is already caught by spec tests that fail
1857 * wasm/WasmModuleParser.cpp:
1859 2017-06-05 Keith Miller <keith_miller@apple.com>
1861 OMG tier up checks should be a patchpoint
1862 https://bugs.webkit.org/show_bug.cgi?id=172944
1864 Reviewed by Saam Barati.
1866 Tier up checks in BBQ should be done as a patchpoint rather than individual B3 opcodes.
1867 In order to reduce code generated out of line in each function. We generate a single stub
1868 that pushes all the callee-saves. This looks like a 5-10% compile time speedup.
1870 * wasm/WasmB3IRGenerator.cpp:
1871 (JSC::Wasm::B3IRGenerator::B3IRGenerator):
1872 (JSC::Wasm::B3IRGenerator::emitTierUpCheck):
1873 (JSC::Wasm::B3IRGenerator::addLoop):
1874 * wasm/WasmThunks.cpp:
1875 (JSC::Wasm::triggerOMGTierUpThunkGenerator):
1876 * wasm/WasmThunks.h:
1878 2017-06-05 Joseph Pecoraro <pecoraro@apple.com>
1880 Remove unused VM members
1881 https://bugs.webkit.org/show_bug.cgi?id=172941
1883 Reviewed by Mark Lam.
1885 * runtime/HashMapImpl.h:
1886 (JSC::HashMapImpl::selectStructure): Deleted.
1891 2017-06-05 Joseph Pecoraro <pecoraro@apple.com>
1893 Web Inspector: Improve ES6 Class instances in Heap Snapshot instances view
1894 https://bugs.webkit.org/show_bug.cgi?id=172848
1895 <rdar://problem/25709212>
1897 Reviewed by Saam Barati.
1899 * heap/HeapSnapshotBuilder.h:
1900 * heap/HeapSnapshotBuilder.cpp:
1901 Update the snapshot version. Change the node's 0 | 1 internal value
1902 to be a 32bit bit flag. This is nice in that it is both compatible
1903 with the previous snapshot version and the same size. We can use more
1904 flags in the future.
1906 (JSC::HeapSnapshotBuilder::json):
1907 In cases where the classInfo gives us "Object" check for a better
1908 class name by checking (o).__proto__.constructor.name. We avoid this
1909 check in cases where (o).hasOwnProperty("constructor") which is the
1910 case for most Foo.prototype objects. Otherwise this would get the
1911 name of the Foo superclass for the Foo.prototype object.
1913 * runtime/JSObject.cpp:
1914 (JSC::JSObject::calculatedClassName):
1915 Handle some possible edge cases that were not handled before. Such
1916 as a JSObject without a GlobalObject, and an object which doesn't
1917 have a default getPrototype. Try to make the code a little clearer.
1919 2017-06-05 Saam Barati <sbarati@apple.com>
1921 Update JSC's features.json
1922 https://bugs.webkit.org/show_bug.cgi?id=172942
1924 Rubber stamped by Mark Lam.
1928 2017-06-04 Konstantin Tokarev <annulen@yandex.ru>
1930 Fix build of Windows-specific code with ICU 59.1
1931 https://bugs.webkit.org/show_bug.cgi?id=172729
1933 Reviewed by Darin Adler.
1935 Fix conversions from WTF::String to wchar_t* and vice versa.
1938 (currentWorkingDirectory):
1939 (fetchModuleFromLocalFileSystem):
1940 * runtime/DateConversion.cpp:
1941 (JSC::formatDateTime):
1943 2017-06-04 Yusuke Suzuki <utatane.tea@gmail.com>
1945 [JSC] Drop unnecessary USE(CF) guard for getenv
1946 https://bugs.webkit.org/show_bug.cgi?id=172903
1948 Reviewed by Sam Weinig.
1950 getenv is not related to USE(CF) and OS(UNIX). It seems that this
1951 ifdef only hits in WinCairo, but WinCairo can use getenv.
1952 Moreover, in VM::VM, we already use getenv without any ifdef guard.
1954 This patch just drops it.
1957 (JSC::enableAssembler):
1959 2017-06-04 Yusuke Suzuki <utatane.tea@gmail.com>
1961 [JSC] Drop OS(DARWIN) for uintptr_t type conflict
1962 https://bugs.webkit.org/show_bug.cgi?id=172904
1964 Reviewed by Sam Weinig.
1966 In non-Darwin environment, uintptr_t may have the same type
1967 to uint64_t. We avoided the compile error by using OS(DARWIN).
1968 But, since it depends on cstdint implementaion rather than OS, it is flaky.
1969 Instead, we just use template parameter IntegralType.
1970 And we describe the type constraint in a SFINAE manner.
1973 (JSC::DFG::OpInfo::OpInfo):
1975 2017-06-03 Csaba Osztrogonác <ossy@webkit.org>
1977 [ARM] Unreviewed buildfix after r217711.
1979 * assembler/MacroAssemblerARM.h:
1980 (JSC::MacroAssemblerARM::xor32):
1982 2017-06-02 Yusuke Suzuki <utatane.tea@gmail.com>
1984 ASSERTION FAILED: "We should only declare a function as a lexically scoped variable in scopes where var declarations aren't allowed. ..." for function redeclaration with async function module export
1985 https://bugs.webkit.org/show_bug.cgi?id=168844
1987 Reviewed by Saam Barati.
1989 As the same to the exported function declaration, we should set statementDepth = 1 for exported async function declaration.
1991 * parser/Parser.cpp:
1992 (JSC::DepthManager::DepthManager):
1993 (JSC::Parser<LexerType>::parseExportDeclaration):
1995 (JSC::Parser::DepthManager::DepthManager): Deleted.
1996 (JSC::Parser::DepthManager::~DepthManager): Deleted.
1998 2017-06-02 Keith Miller <keith_miller@apple.com>
2000 Defer installing mach breakpoint handler until watchdog is actually called
2001 https://bugs.webkit.org/show_bug.cgi?id=172885
2003 Reviewed by Saam Barati.
2005 Eagerly installing the mach breakpoint handler causes issues with Xcode GUI debugging.
2006 This hides the issue, so it won't occur as often.
2008 * runtime/VMTraps.cpp:
2009 (JSC::VMTraps::SignalSender::send):
2010 (JSC::VMTraps::VMTraps): Deleted.
2011 * runtime/VMTraps.h:
2013 2017-06-02 Filip Pizlo <fpizlo@apple.com>
2015 Atomics.load and Atomics.store need to be fully fenced
2016 https://bugs.webkit.org/show_bug.cgi?id=172844
2018 Reviewed by Keith Miller.
2020 Implement fully fenced loads and stores in FTL using AtomicXchgAdd(0, ptr) for the load and
2021 AtomicXchg(value, ptr) for the store.
2023 DFG needed no changes because it implements all atomics using a CAS loop.
2025 AtomicsObject.cpp now uses new Atomic<> API for fully fences loads and stores.
2027 Prior to this change, we used half fences (acquire/release) for atomic loads and stores. This
2028 is not correct according to my current understanding of the SAB memory model, which requires
2029 that atomic operations are SC with respect to everything not just other atomics.
2031 * ftl/FTLLowerDFGToB3.cpp:
2032 (JSC::FTL::DFG::LowerDFGToB3::compileAtomicsReadModifyWrite):
2033 * ftl/FTLOutput.cpp:
2034 (JSC::FTL::Output::atomicWeakCAS):
2036 * runtime/AtomicsObject.cpp:
2038 2017-06-02 Ryan Haddad <ryanhaddad@apple.com>
2040 Unreviewed, attempt to fix the iOS build after r217711.
2042 * assembler/MacroAssemblerARM64.h:
2043 (JSC::MacroAssemblerARM64::xor32):
2044 (JSC::MacroAssemblerARM64::xor64):
2046 2017-06-01 Filip Pizlo <fpizlo@apple.com>
2048 GC should use scrambled free-lists
2049 https://bugs.webkit.org/show_bug.cgi?id=172793
2051 Reviewed by Mark Lam.
2053 Previously, our bump'n'pop allocator would use a conventional linked-list for the free-list.
2054 The linked-list would be threaded through free memory, as is the usual convention.
2056 This scrambles the next pointers of that free-list. It also scrambles the head pointer, because
2057 this leads to a more natural fast-path structure and saves one register on ARM64.
2059 The secret with which pointers are scrambled is per-allocator. Allocators choose a new secret
2060 every time they do a sweep-to-pop.
2062 This doesn't change the behavior of the bump part of bump'n'pop, but it does refactor the code
2063 quite a bit. Previously, there were four copies of the allocator fast path: two in
2064 MarkedAllocatorInlines.h, one in MarkedAllocator.cpp, and one in AssemblyHelpers.h. The JIT one
2065 was obviously different-looking, but the other three were almost identical. This moves all of
2066 that logic into FreeList. There are now just two copies of the allocator: FreeListInlines.h and
2069 This appears to be just as fast as our previously allocator.
2071 * JavaScriptCore.xcodeproj/project.pbxproj:
2072 * heap/FreeList.cpp:
2073 (JSC::FreeList::FreeList):
2074 (JSC::FreeList::~FreeList):
2075 (JSC::FreeList::clear):
2076 (JSC::FreeList::initializeList):
2077 (JSC::FreeList::initializeBump):
2078 (JSC::FreeList::contains):
2079 (JSC::FreeList::dump):
2081 (JSC::FreeList::allocationWillFail):
2082 (JSC::FreeList::originalSize):
2083 (JSC::FreeList::addressOfList):
2084 (JSC::FreeList::offsetOfBlock):
2085 (JSC::FreeList::offsetOfList):
2086 (JSC::FreeList::offsetOfIndex):
2087 (JSC::FreeList::offsetOfPayloadEnd):
2088 (JSC::FreeList::offsetOfRemaining):
2089 (JSC::FreeList::offsetOfOriginalSize):
2090 (JSC::FreeList::FreeList): Deleted.
2091 (JSC::FreeList::list): Deleted.
2092 (JSC::FreeList::bump): Deleted.
2093 (JSC::FreeList::operator==): Deleted.
2094 (JSC::FreeList::operator!=): Deleted.
2095 (JSC::FreeList::operator bool): Deleted.
2096 * heap/FreeListInlines.h: Added.
2097 (JSC::FreeList::addFreeCell):
2098 (JSC::FreeList::allocate):
2099 (JSC::FreeList::forEach):
2100 (JSC::FreeList::toOffset):
2101 (JSC::FreeList::fromOffset):
2102 * heap/IncrementalSweeper.cpp:
2103 (JSC::IncrementalSweeper::sweepNextBlock):
2104 * heap/MarkedAllocator.cpp:
2105 (JSC::MarkedAllocator::MarkedAllocator):
2106 (JSC::MarkedAllocator::didConsumeFreeList):
2107 (JSC::MarkedAllocator::tryAllocateWithoutCollecting):
2108 (JSC::MarkedAllocator::tryAllocateIn):
2109 (JSC::MarkedAllocator::allocateSlowCaseImpl):
2110 (JSC::MarkedAllocator::stopAllocating):
2111 (JSC::MarkedAllocator::prepareForAllocation):
2112 (JSC::MarkedAllocator::resumeAllocating):
2113 (JSC::MarkedAllocator::sweep):
2114 (JSC::MarkedAllocator::setFreeList): Deleted.
2115 * heap/MarkedAllocator.h:
2116 (JSC::MarkedAllocator::freeList):
2117 (JSC::MarkedAllocator::isFreeListedCell): Deleted.
2118 * heap/MarkedAllocatorInlines.h:
2119 (JSC::MarkedAllocator::isFreeListedCell):
2120 (JSC::MarkedAllocator::tryAllocate):
2121 (JSC::MarkedAllocator::allocate):
2122 * heap/MarkedBlock.cpp:
2123 (JSC::MarkedBlock::Handle::stopAllocating):
2124 (JSC::MarkedBlock::Handle::lastChanceToFinalize):
2125 (JSC::MarkedBlock::Handle::resumeAllocating):
2126 (JSC::MarkedBlock::Handle::zap):
2127 (JSC::MarkedBlock::Handle::sweep):
2128 (JSC::MarkedBlock::Handle::isFreeListedCell):
2129 (JSC::MarkedBlock::Handle::forEachFreeCell): Deleted.
2130 * heap/MarkedBlock.h:
2131 * heap/MarkedBlockInlines.h:
2132 (JSC::MarkedBlock::Handle::specializedSweep):
2133 (JSC::MarkedBlock::Handle::finishSweepKnowingSubspace):
2134 (JSC::MarkedBlock::Handle::isFreeListedCell): Deleted.
2135 * heap/Subspace.cpp:
2136 (JSC::Subspace::finishSweep):
2138 * jit/AssemblyHelpers.h:
2139 (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator):
2140 * runtime/JSDestructibleObjectSubspace.cpp:
2141 (JSC::JSDestructibleObjectSubspace::finishSweep):
2142 * runtime/JSDestructibleObjectSubspace.h:
2143 * runtime/JSSegmentedVariableObjectSubspace.cpp:
2144 (JSC::JSSegmentedVariableObjectSubspace::finishSweep):
2145 * runtime/JSSegmentedVariableObjectSubspace.h:
2146 * runtime/JSStringSubspace.cpp:
2147 (JSC::JSStringSubspace::finishSweep):
2148 * runtime/JSStringSubspace.h:
2149 * wasm/js/JSWebAssemblyCodeBlockSubspace.cpp:
2150 (JSC::JSWebAssemblyCodeBlockSubspace::finishSweep):
2151 * wasm/js/JSWebAssemblyCodeBlockSubspace.h:
2153 2017-06-02 Yusuke Suzuki <utatane.tea@gmail.com>
2155 [JSC] Use @globalPrivate for concatSlowPath
2156 https://bugs.webkit.org/show_bug.cgi?id=172802
2158 Reviewed by Darin Adler.
2160 Use @globalPrivate instead of manually putting it to JSGlobalObject.
2162 * builtins/ArrayPrototype.js:
2163 (concatSlowPath): Deleted.
2164 * runtime/JSGlobalObject.cpp:
2165 (JSC::JSGlobalObject::init):
2167 2017-06-01 Andy Estes <aestes@apple.com>
2169 REGRESSION (r217626): ENABLE_APPLE_PAY_SESSION_V3 was disabled by mistake
2170 https://bugs.webkit.org/show_bug.cgi?id=172828
2172 Reviewed by Beth Dakin.
2174 * Configurations/FeatureDefines.xcconfig:
2176 2017-06-01 Keith Miller <keith_miller@apple.com>
2178 Undo rollout in r217638 with bug fix
2179 https://bugs.webkit.org/show_bug.cgi?id=172824
2181 Unreviewed, reland patch with unused set_state code removed.
2183 * API/tests/ExecutionTimeLimitTest.cpp:
2184 (dispatchTermitateCallback):
2185 (testExecutionTimeLimit):
2186 * runtime/JSLock.cpp:
2187 (JSC::JSLock::didAcquireLock):
2188 * runtime/Options.cpp:
2189 (JSC::overrideDefaults):
2190 (JSC::Options::initialize):
2191 * runtime/Options.h:
2192 * runtime/VMTraps.cpp:
2193 (JSC::SignalContext::SignalContext):
2194 (JSC::SignalContext::adjustPCToPointToTrappingInstruction):
2195 (JSC::installSignalHandler):
2196 (JSC::VMTraps::SignalSender::send):
2197 * tools/SigillCrashAnalyzer.cpp:
2198 (JSC::SignalContext::SignalContext):
2199 (JSC::SignalContext::dump):
2200 (JSC::installCrashHandler):
2201 * wasm/WasmBBQPlan.cpp:
2202 (JSC::Wasm::BBQPlan::compileFunctions):
2203 * wasm/WasmFaultSignalHandler.cpp:
2204 (JSC::Wasm::trapHandler):
2205 (JSC::Wasm::enableFastMemory):
2206 * wasm/WasmMachineThreads.cpp:
2207 (JSC::Wasm::resetInstructionCacheOnAllThreads):
2209 2017-06-01 Guillaume Emont <guijemont@igalia.com>
2211 [JSC][MIPS] SamplingProfiler::timerLoop() sleeps for 4000+ seconds
2212 https://bugs.webkit.org/show_bug.cgi?id=172800
2214 Reviewed by Saam Barati.
2216 This fixes a static_cast<uint64_t> by making it a cast to int64_t
2217 instead, which looks like the original intent. This fixes the
2218 sampling-profiler tests in JSTests/stress.
2220 * runtime/SamplingProfiler.cpp:
2221 (JSC::SamplingProfiler::timerLoop):
2223 2017-06-01 Tomas Popela <tpopela@redhat.com>, Mark Lam <mark.lam@apple.com>
2225 RELEASE_ASSERT_NOT_REACHED() in InferredType::kindForFlags() on Big-Endians
2226 https://bugs.webkit.org/show_bug.cgi?id=170945
2228 Reviewed by Mark Lam.
2230 Re-define PutByIdFlags as a int32_t enum explicitly because it is
2231 stored as an int32_t value in UnlinkedInstruction. This prevents
2232 a bug on 64-bit big endian architectures where the word order is
2233 inverted (when we convert the UnlinkedInstruction into a CodeBlock
2234 Instruction), resulting in the PutByIdFlags value not being stored in
2235 the 32-bit word that the rest of the code expects it to be in.
2237 * bytecode/PutByIdFlags.h:
2239 2017-05-31 Yusuke Suzuki <utatane.tea@gmail.com>
2241 [JSC] Implement String.prototype.concat in JS builtins
2242 https://bugs.webkit.org/show_bug.cgi?id=172798
2244 Reviewed by Sam Weinig.
2246 Since we have highly effective + operation for strings,
2247 implementing String.prototype.concat in JS simplifies the
2248 implementation and improves performance by using speculated
2251 Added microbenchmarks show performance improvement.
2253 string-concat-long-convert 1063.2787+-12.9101 ^ 109.0855+-2.8083 ^ definitely 9.7472x faster
2254 string-concat-convert 1111.1366+-12.2363 ^ 99.3402+-1.9874 ^ definitely 11.1852x faster
2255 string-concat 131.7377+-3.8359 ^ 54.3949+-0.9580 ^ definitely 2.4219x faster
2256 string-concat-long 79.4726+-1.9644 ^ 64.6301+-1.4941 ^ definitely 1.2297x faster
2258 * builtins/StringPrototype.js:
2259 (globalPrivate.stringConcatSlowPath):
2261 * runtime/StringPrototype.cpp:
2262 (JSC::StringPrototype::finishCreation):
2263 (JSC::stringProtoFuncConcat): Deleted.
2265 2017-05-31 Mark Lam <mark.lam@apple.com>
2267 Remove overrides of visitChildren() that do not add any functionality.
2268 https://bugs.webkit.org/show_bug.cgi?id=172789
2269 <rdar://problem/32500865>
2271 Reviewed by Andreas Kling.
2273 * bytecode/UnlinkedModuleProgramCodeBlock.cpp:
2274 (JSC::UnlinkedModuleProgramCodeBlock::visitChildren): Deleted.
2275 * bytecode/UnlinkedModuleProgramCodeBlock.h:
2276 * bytecode/UnlinkedProgramCodeBlock.cpp:
2277 (JSC::UnlinkedProgramCodeBlock::visitChildren): Deleted.
2278 * bytecode/UnlinkedProgramCodeBlock.h:
2279 * wasm/js/WebAssemblyFunction.cpp:
2280 (JSC::WebAssemblyFunction::visitChildren): Deleted.
2281 * wasm/js/WebAssemblyFunction.h:
2282 * wasm/js/WebAssemblyInstanceConstructor.cpp:
2283 (JSC::WebAssemblyInstanceConstructor::visitChildren): Deleted.
2284 * wasm/js/WebAssemblyInstanceConstructor.h:
2285 * wasm/js/WebAssemblyMemoryConstructor.cpp:
2286 (JSC::WebAssemblyMemoryConstructor::visitChildren): Deleted.
2287 * wasm/js/WebAssemblyMemoryConstructor.h:
2288 * wasm/js/WebAssemblyModuleConstructor.cpp:
2289 (JSC::WebAssemblyModuleConstructor::visitChildren): Deleted.
2290 * wasm/js/WebAssemblyModuleConstructor.h:
2291 * wasm/js/WebAssemblyTableConstructor.cpp:
2292 (JSC::WebAssemblyTableConstructor::visitChildren): Deleted.
2293 * wasm/js/WebAssemblyTableConstructor.h:
2295 2017-05-31 Commit Queue <commit-queue@webkit.org>
2297 Unreviewed, rolling out r217611 and r217631.
2298 https://bugs.webkit.org/show_bug.cgi?id=172785
2300 "caused wasm-hashset-many.html to become flaky." (Requested by
2301 keith_miller on #webkit).
2303 Reverted changesets:
2305 "Reland r216808, underlying lldb bug has been fixed."
2306 https://bugs.webkit.org/show_bug.cgi?id=172759
2307 http://trac.webkit.org/changeset/217611
2309 "Use dispatch queues for mach exceptions"
2310 https://bugs.webkit.org/show_bug.cgi?id=172775
2311 http://trac.webkit.org/changeset/217631
2313 2017-05-31 Oleksandr Skachkov <gskachkov@gmail.com>
2315 Rolling out: Prevent async methods named 'function'
2316 https://bugs.webkit.org/show_bug.cgi?id=172776
2318 Reviewed by Mark Lam.
2320 Rolling out https://bugs.webkit.org/show_bug.cgi?id=172660 r217578,
2321 https://bugs.webkit.org/show_bug.cgi?id=172598 r217478
2322 PR to spec was closed, so changes need to roll out. See
2323 https://github.com/tc39/ecma262/pull/884#issuecomment-305212494
2325 * parser/Parser.cpp:
2326 (JSC::Parser<LexerType>::parseClass):
2327 (JSC::Parser<LexerType>::parsePropertyMethod):
2329 2017-05-31 Andy Estes <aestes@apple.com>
2331 Rename ENABLE_APPLE_PAY_DELEGATE to ENABLE_APPLE_PAY_SESSION_V3 and bump the supported version number
2332 https://bugs.webkit.org/show_bug.cgi?id=172366
2334 Reviewed by Daniel Bates.
2336 * Configurations/FeatureDefines.xcconfig:
2338 2017-05-31 Keith Miller <keith_miller@apple.com>
2340 Reland r216808, underlying lldb bug has been fixed.
2341 https://bugs.webkit.org/show_bug.cgi?id=172759
2344 Unreviewed, relanding old patch. See: rdar://problem/31183352
2346 * API/tests/ExecutionTimeLimitTest.cpp:
2347 (dispatchTermitateCallback):
2348 (testExecutionTimeLimit):
2349 * runtime/JSLock.cpp:
2350 (JSC::JSLock::didAcquireLock):
2351 * runtime/Options.cpp:
2352 (JSC::overrideDefaults):
2353 (JSC::Options::initialize):
2354 * runtime/Options.h:
2355 * runtime/VMTraps.cpp:
2356 (JSC::SignalContext::SignalContext):
2357 (JSC::SignalContext::adjustPCToPointToTrappingInstruction):
2358 (JSC::installSignalHandler):
2359 (JSC::VMTraps::SignalSender::send):
2360 * tools/SigillCrashAnalyzer.cpp:
2361 (JSC::SignalContext::SignalContext):
2362 (JSC::SignalContext::dump):
2363 (JSC::installCrashHandler):
2364 * wasm/WasmBBQPlan.cpp:
2365 (JSC::Wasm::BBQPlan::compileFunctions):
2366 * wasm/WasmFaultSignalHandler.cpp:
2367 (JSC::Wasm::trapHandler):
2368 (JSC::Wasm::enableFastMemory):
2369 * wasm/WasmMachineThreads.cpp:
2370 (JSC::Wasm::resetInstructionCacheOnAllThreads):
2372 2017-05-31 Keith Miller <keith_miller@apple.com>
2374 Fix leak in PromiseDeferredTimer
2375 https://bugs.webkit.org/show_bug.cgi?id=172755
2377 Reviewed by JF Bastien.
2379 We were not properly freeing the list of dependencies if we were already tracking the promise before.
2380 This is because addPendingPromise takes the list of dependencies as an rvalue-reference. In the case
2381 where we were already tracking the promise we append the provided dependency list to the existing list.
2382 Since we never bound or rvalue-ref to a non-temporary value we never destructed the Vector, leaking its
2385 * runtime/PromiseDeferredTimer.cpp:
2386 (JSC::PromiseDeferredTimer::addPendingPromise):
2388 2017-05-30 Oleksandr Skachkov <gskachkov@gmail.com>
2390 Prevent async methods named 'function' in Object literal
2391 https://bugs.webkit.org/show_bug.cgi?id=172660
2393 Reviewed by Saam Barati.
2395 Prevent async method named 'function' in object.
2396 https://github.com/tc39/ecma262/pull/884
2398 * parser/Parser.cpp:
2399 (JSC::Parser<LexerType>::parsePropertyMethod):
2401 2017-05-30 Oleksandr Skachkov <gskachkov@gmail.com>
2403 ASSERTION FAILED: generator.isConstructor() || generator.derivedContextType() == DerivedContextType::DerivedConstructorContext
2404 https://bugs.webkit.org/show_bug.cgi?id=171274
2406 Reviewed by Saam Barati.
2408 Current patch allow to use async arrow function within constructor,
2409 and allow to access to `this`. Current patch force load 'this' from
2410 virtual scope each time as we access to `this` in async arrow function
2411 within constructor it is neccessary because async function can be
2412 suspended and `superCall` can be called and async function resumed.
2414 * bytecompiler/BytecodeGenerator.cpp:
2415 (JSC::BytecodeGenerator::emitPutGeneratorFields):
2416 (JSC::BytecodeGenerator::ensureThis):
2417 * bytecompiler/BytecodeGenerator.h:
2418 (JSC::BytecodeGenerator::makeFunction):
2420 2017-05-30 Ali Juma <ajuma@chromium.org>
2422 [CredentialManagement] Incorporate IDL updates from latest spec
2423 https://bugs.webkit.org/show_bug.cgi?id=172011
2425 Reviewed by Daniel Bates.
2427 * runtime/CommonIdentifiers.h:
2429 2017-05-30 Alex Christensen <achristensen@webkit.org>
2431 Update libwebrtc configuration
2432 https://bugs.webkit.org/show_bug.cgi?id=172727
2434 Reviewed by Geoffrey Garen.
2436 * Configurations/FeatureDefines.xcconfig:
2438 2017-05-28 Dan Bernstein <mitz@apple.com>
2440 [Xcode] ALWAYS_SEARCH_USER_PATHS is set to YES
2441 https://bugs.webkit.org/show_bug.cgi?id=172691
2443 Reviewed by Tim Horton.
2445 * Configurations/Base.xcconfig: Set ALWAYS_SEARCH_USER_PATHS to NO.
2446 * JavaScriptCore.xcodeproj/project.pbxproj: Added ParseInt.h to the JavaScriptCore target.
2448 2017-05-28 Yusuke Suzuki <utatane.tea@gmail.com>
2450 [JSC] Provide better type information of toLength and tighten bytecode
2451 https://bugs.webkit.org/show_bug.cgi?id=172690
2453 Reviewed by Sam Weinig.
2455 In this patch, we carefully leverage operator + in order to
2459 operator+ emits to_number bytecode. What this bytecode does is the same
2460 to @Number() call. It is more efficient, and it is smaller bytecode
2461 than @Number() call (load global variable @Number, set up arguments, and
2464 2. offer better type prediction data
2466 Now, we have code like
2468 length > 0 ? (length < @MAX_SAFE_INTEGER ? length : @MAX_SAFE_INTEGER) : 0
2470 This is not good because DFG prediction propagation phase predicts as Double
2471 since @MAX_SAFE_INTEGER is double. But actually it rarely becomes Double.
2472 Usually, the result becomes Int32. This patch leverages to_number in a bit
2473 interesting way: to_number has value profiling to offer better type prediction.
2474 This value profiling can offer a chance to change the prediction to Int32 efficiently.
2475 It is a bit tricky. But it is worth doing to speed up our builtin functions,
2476 which should leverage all the JSC's tricky things to be optimized.
2478 Related microbenchmarks show performance improvement.
2482 array-prototype-forEach 50.2348+-2.2331 49.7568+-2.3507
2483 array-prototype-map 51.0574+-1.8166 47.9531+-2.1653 might be 1.0647x faster
2484 array-prototype-some 52.3926+-1.8882 ^ 48.3632+-2.0852 ^ definitely 1.0833x faster
2485 array-prototype-every 52.7394+-2.0712 50.2896+-2.1480 might be 1.0487x faster
2486 array-prototype-reduce 54.9994+-2.3638 51.8716+-2.6253 might be 1.0603x faster
2487 array-prototype-reduceRight 209.7594+-9.2594 ^ 51.5867+-2.5745 ^ definitely 4.0662x faster
2490 * builtins/GlobalOperations.js:
2491 (globalPrivate.toInteger):
2492 (globalPrivate.toLength):
2494 2017-05-28 Sam Weinig <sam@webkit.org>
2496 [WebIDL] @@iterator should only be accessed once when disambiguating a union type
2497 https://bugs.webkit.org/show_bug.cgi?id=172684
2499 Reviewed by Yusuke Suzuki.
2501 * runtime/IteratorOperations.cpp:
2502 (JSC::iteratorMethod):
2503 (JSC::iteratorForIterable):
2504 * runtime/IteratorOperations.h:
2505 (JSC::forEachInIterable):
2506 Add additional iterator helpers to allow union + sequence conversion code
2507 to check for iterability by getting the iterator method, and iterate using
2508 that method later on.
2510 2017-05-28 Yusuke Suzuki <utatane.tea@gmail.com>
2512 Unreviewed, build fix for Windows
2513 https://bugs.webkit.org/show_bug.cgi?id=172413
2515 Optimized jsDynamicCast for JSMap and JSSet will be handled in [1].
2517 [1]: https://bugs.webkit.org/show_bug.cgi?id=172685
2521 (JSC::jsDynamicCast): Deleted.
2525 (JSC::jsDynamicCast): Deleted.
2527 * runtime/MapConstructor.cpp:
2528 (JSC::constructMap):
2529 * runtime/SetConstructor.cpp:
2530 (JSC::constructSet):
2532 2017-05-28 Mark Lam <mark.lam@apple.com>
2534 Implement a faster Interpreter::getOpcodeID().
2535 https://bugs.webkit.org/show_bug.cgi?id=172669
2537 Reviewed by Saam Barati.
2539 We can implement Interpreter::getOpcodeID() without a hash table lookup by always
2540 embedding the OpcodeID in the 32-bit word just before the start of the LLInt
2541 handler code that executes each opcode. getOpcodeID() can therefore just read
2542 the 32-bits before the opcode address to get its OpcodeID.
2544 This is currently only enabled for CPU(X86), CPU(X86_64), CPU(ARM64),
2545 CPU(ARM_THUMB2), and only for OS(DARWIN). It'll probably just work for linux as
2546 well, but I'll let the Linux folks turn that on after they have verified that it
2549 I'll also take this opportunity to clean up how we initialize the opcodeIDTable:
2550 1. we only need to initialize it once per process, not once per VM / interpreter
2552 2. we can initialize it in the Interpreter constructor instead of requiring a
2553 separate call to an initialize() function.
2555 On debug builds, the Interpreter constructor will also verify that getOpcodeID()
2556 is working correctly for each opcode when USE(LLINT_EMBEDDED_OPCODE_ID).
2558 * bytecode/BytecodeList.json:
2559 * generate-bytecode-files:
2560 * interpreter/Interpreter.cpp:
2561 (JSC::Interpreter::Interpreter):
2562 (JSC::Interpreter::opcodeIDTable):
2563 (JSC::Interpreter::initialize): Deleted.
2564 * interpreter/Interpreter.h:
2565 (JSC::Interpreter::getOpcode):
2566 (JSC::Interpreter::getOpcodeID):
2567 * llint/LowLevelInterpreter.cpp:
2571 2017-05-27 Yusuke Suzuki <utatane.tea@gmail.com>
2573 [JSC] Map and Set constructors should have fast path for cloning
2574 https://bugs.webkit.org/show_bug.cgi?id=172413
2576 Reviewed by Saam Barati.
2578 In this patch, we add a fast path for cloning in Set and Map constructors.
2580 In ARES-6 Air, we have code like `new Set(set)` to clone the given set.
2581 At that time, our generic path just iterates the given set object and add
2582 it to the newly created one. It is quite slow because we need to follow
2583 the iterator protocol inside C++ and we need to call set.add() repeatedly
2584 while the given set guarantees the elements are unique.
2586 This patch implements clone() function to JSMap and JSSet. Cloning JSMap
2587 and JSSet are done really fast without invoking any observable JS functions.
2588 To check whether we can use this clone() function in Set and Map constructors,
2589 we set several watchpoints.
2593 1. Set.prototype[Symbol.iterator] is not changed.
2594 2. SetIterator.prototype.next is not changed.
2595 3. Set.prototype.add is not changed.
2596 4. The given Set does not have [Symbol.iterator] function in its instance.
2597 5. The given Set's [[Prototype]] is Set.prototype.
2598 6. Newly created set's [[Prototype]] is Set.prototype.
2600 If the above requirements are met, cloning the given Set is not observable to users.
2601 Thus we can take a fast path.
2603 Currently, we do not integrate this optimization into DFG and FTL.
2604 And we do not optimize other iterables. For example, we can optimize Set
2605 constructor taking Int32 Array. And we should optimize generic iterator cases too.
2606 They are planned as part of a separate bug[1].
2608 This change improves ARES-6 Air by 5.3% in steady state.
2611 Running... Air ( 1 to go)
2612 firstIteration: 76.41 +- 15.60 ms
2613 averageWorstCase: 40.63 +- 7.54 ms
2614 steadyState: 9.13 +- 0.51 ms
2618 Running... Air ( 1 to go)
2619 firstIteration: 75.00 +- 22.54 ms
2620 averageWorstCase: 39.18 +- 8.45 ms
2621 steadyState: 8.67 +- 0.28 ms
2623 [1]: https://bugs.webkit.org/show_bug.cgi?id=172419
2626 * JavaScriptCore.xcodeproj/project.pbxproj:
2627 * runtime/ArrayIteratorAdaptiveWatchpoint.cpp: Removed.
2628 * runtime/HashMapImpl.h:
2629 (JSC::HashMapBucket::extractValue):
2630 (JSC::HashMapImpl::finishCreation):
2631 (JSC::HashMapImpl::add):
2632 (JSC::HashMapImpl::setUpHeadAndTail):
2633 (JSC::HashMapImpl::addNormalizedNonExistingForCloning):
2634 (JSC::HashMapImpl::addNormalizedInternal):
2635 * runtime/InternalFunction.cpp:
2636 (JSC::InternalFunction::createSubclassStructureSlow):
2637 (JSC::InternalFunction::createSubclassStructure): Deleted.
2638 * runtime/InternalFunction.h:
2639 (JSC::InternalFunction::createSubclassStructure):
2640 * runtime/JSGlobalObject.cpp:
2641 (JSC::JSGlobalObject::JSGlobalObject):
2642 (JSC::JSGlobalObject::init):
2643 (JSC::JSGlobalObject::visitChildren):
2644 * runtime/JSGlobalObject.h:
2645 (JSC::JSGlobalObject::mapIteratorProtocolWatchpoint):
2646 (JSC::JSGlobalObject::setIteratorProtocolWatchpoint):
2647 (JSC::JSGlobalObject::mapSetWatchpoint):
2648 (JSC::JSGlobalObject::setAddWatchpoint):
2649 (JSC::JSGlobalObject::mapPrototype):
2650 (JSC::JSGlobalObject::jsSetPrototype):
2651 (JSC::JSGlobalObject::setStructure):
2652 * runtime/JSGlobalObjectInlines.h:
2653 (JSC::JSGlobalObject::isMapPrototypeIteratorProtocolFastAndNonObservable):
2654 (JSC::JSGlobalObject::isSetPrototypeIteratorProtocolFastAndNonObservable):
2655 (JSC::JSGlobalObject::isMapPrototypeSetFastAndNonObservable):
2656 (JSC::JSGlobalObject::isSetPrototypeAddFastAndNonObservable):
2657 * runtime/JSMap.cpp:
2658 (JSC::JSMap::clone):
2659 (JSC::JSMap::canCloneFastAndNonObservable):
2661 (JSC::jsDynamicCast):
2663 (JSC::JSMap::createStructure): Deleted.
2664 (JSC::JSMap::create): Deleted.
2665 (JSC::JSMap::set): Deleted.
2666 (JSC::JSMap::JSMap): Deleted.
2667 * runtime/JSSet.cpp:
2668 (JSC::JSSet::clone):
2669 (JSC::JSSet::canCloneFastAndNonObservable):
2671 (JSC::jsDynamicCast):
2673 (JSC::JSSet::createStructure): Deleted.
2674 (JSC::JSSet::create): Deleted.
2675 (JSC::JSSet::JSSet): Deleted.
2676 * runtime/MapConstructor.cpp:
2677 (JSC::constructMap):
2678 * runtime/ObjectPropertyChangeAdaptiveWatchpoint.h: Renamed from Source/JavaScriptCore/runtime/ArrayIteratorAdaptiveWatchpoint.h.
2679 (JSC::ObjectPropertyChangeAdaptiveWatchpoint::ObjectPropertyChangeAdaptiveWatchpoint):
2680 * runtime/SetConstructor.cpp:
2681 (JSC::constructSet):
2683 2017-05-27 Yusuke Suzuki <utatane.tea@gmail.com>
2685 [DOMJIT] Move DOMJIT patchpoint infrastructure out of domjit
2686 https://bugs.webkit.org/show_bug.cgi?id=172260
2688 Reviewed by Filip Pizlo.
2690 DOMJIT::Patchpoint is now used for generalized CheckSubClass. And it becomes mature enough
2691 to be used as a general-purpose injectable compiler over all the JIT tiers.
2693 We extract DOMJIT::Patchpoint to jit/ and rename it JSC::Snippet.
2696 * JavaScriptCore.xcodeproj/project.pbxproj:
2697 * bytecode/AccessCaseSnippetParams.cpp: Renamed from Source/JavaScriptCore/bytecode/DOMJITAccessCasePatchpointParams.cpp.
2698 (JSC::SlowPathCallGeneratorWithArguments::generateImpl):
2699 (JSC::AccessCaseSnippetParams::emitSlowPathCalls):
2700 * bytecode/AccessCaseSnippetParams.h: Renamed from Source/JavaScriptCore/bytecode/DOMJITAccessCasePatchpointParams.h.
2701 (JSC::AccessCaseSnippetParams::AccessCaseSnippetParams):
2702 * bytecode/GetterSetterAccessCase.cpp:
2703 (JSC::GetterSetterAccessCase::emitDOMJITGetter):
2704 * dfg/DFGAbstractInterpreterInlines.h:
2705 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2706 * dfg/DFGByteCodeParser.cpp:
2707 (JSC::DFG::blessCallDOMGetter):
2708 (JSC::DFG::ByteCodeParser::handleDOMJITGetter):
2709 * dfg/DFGClobberize.h:
2710 (JSC::DFG::clobberize):
2711 * dfg/DFGFixupPhase.cpp:
2712 (JSC::DFG::FixupPhase::fixupNode):
2715 * dfg/DFGSnippetParams.cpp: Renamed from Source/JavaScriptCore/dfg/DFGDOMJITPatchpointParams.cpp.
2716 * dfg/DFGSnippetParams.h: Renamed from Source/JavaScriptCore/dfg/DFGDOMJITPatchpointParams.h.
2717 (JSC::DFG::SnippetParams::SnippetParams):
2718 * dfg/DFGSpeculativeJIT.cpp:
2719 (JSC::DFG::allocateTemporaryRegistersForSnippet):
2720 (JSC::DFG::SpeculativeJIT::compileCallDOMGetter):
2721 (JSC::DFG::SpeculativeJIT::compileCheckSubClass):
2722 (JSC::DFG::allocateTemporaryRegistersForPatchpoint): Deleted.
2723 * domjit/DOMJITCallDOMGetterSnippet.h: Renamed from Source/JavaScriptCore/domjit/DOMJITCallDOMGetterPatchpoint.h.
2724 (JSC::DOMJIT::CallDOMGetterSnippet::create):
2725 * domjit/DOMJITGetterSetter.h:
2726 * domjit/DOMJITSignature.h:
2727 * domjit/DOMJITValue.h: Removed.
2728 * ftl/FTLLowerDFGToB3.cpp:
2729 (JSC::FTL::DFG::LowerDFGToB3::compileCheckSubClass):
2730 (JSC::FTL::DFG::LowerDFGToB3::compileCallDOMGetter):
2731 * ftl/FTLSnippetParams.cpp: Renamed from Source/JavaScriptCore/ftl/FTLDOMJITPatchpointParams.cpp.
2732 * ftl/FTLSnippetParams.h: Renamed from Source/JavaScriptCore/ftl/FTLDOMJITPatchpointParams.h.
2733 (JSC::FTL::SnippetParams::SnippetParams):
2734 * jit/Snippet.h: Renamed from Source/JavaScriptCore/domjit/DOMJITPatchpoint.h.
2735 (JSC::Snippet::create):
2736 (JSC::Snippet::setGenerator):
2737 (JSC::Snippet::generator):
2738 * jit/SnippetParams.h: Renamed from Source/JavaScriptCore/domjit/DOMJITPatchpointParams.h.
2739 (JSC::SnippetParams::~SnippetParams):
2740 (JSC::SnippetParams::Value::Value):
2741 (JSC::SnippetParams::Value::isGPR):
2742 (JSC::SnippetParams::Value::isFPR):
2743 (JSC::SnippetParams::Value::isJSValueRegs):
2744 (JSC::SnippetParams::Value::gpr):
2745 (JSC::SnippetParams::Value::fpr):
2746 (JSC::SnippetParams::Value::jsValueRegs):
2747 (JSC::SnippetParams::Value::reg):
2748 (JSC::SnippetParams::Value::value):
2749 (JSC::SnippetParams::SnippetParams):
2750 * jit/SnippetReg.h: Renamed from Source/JavaScriptCore/domjit/DOMJITReg.h.
2751 (JSC::SnippetReg::SnippetReg):
2752 * jit/SnippetSlowPathCalls.h: Renamed from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
2754 (WTF::DOMJITNode::checkSubClassSnippet):
2755 (WTF::DOMJITFunctionObject::checkSubClassSnippet):
2756 (WTF::DOMJITNode::checkSubClassPatchpoint): Deleted.
2757 (WTF::DOMJITFunctionObject::checkSubClassPatchpoint): Deleted.
2758 * runtime/ClassInfo.h:
2760 2017-05-26 Keith Miller <keith_miller@apple.com>
2762 REEGRESSION(r217459): testapi fails in JSExportTest's wrapperForNSObjectisObject().
2763 https://bugs.webkit.org/show_bug.cgi?id=172654
2765 Reviewed by Mark Lam.
2767 The test's intent is to assert that an exception has not been
2768 thrown (as indicated by the message string), but the test was
2769 erroneously checking for ! the right condition. This is now fixed.
2771 * API/tests/JSExportTests.mm:
2772 (wrapperForNSObjectisObject):
2774 2017-05-26 Joseph Pecoraro <pecoraro@apple.com>
2776 JSContext Inspector: Improve the reliability of automatically pausing in auto-attach
2777 https://bugs.webkit.org/show_bug.cgi?id=172664
2778 <rdar://problem/32362933>
2780 Reviewed by Matt Baker.
2782 Automatically pause on connection was triggering a pause before the
2783 frontend may have initialized. Often during frontend initialization
2784 the frontend may perform an action that clears the pause state requested
2785 by the developer. This change defers the pause until after the frontend
2786 has initialized, right before returning to the application's code.
2788 * inspector/remote/RemoteControllableTarget.h:
2789 * inspector/remote/RemoteInspectionTarget.h:
2790 * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm:
2791 (Inspector::RemoteConnectionToTarget::setup):
2792 * inspector/remote/glib/RemoteConnectionToTargetGlib.cpp:
2793 (Inspector::RemoteConnectionToTarget::setup):
2794 * runtime/JSGlobalObjectDebuggable.cpp:
2795 (JSC::JSGlobalObjectDebuggable::connect):
2796 (JSC::JSGlobalObjectDebuggable::pause): Deleted.
2797 * runtime/JSGlobalObjectDebuggable.h:
2798 Pass an immediatelyPause boolean on to the controller. Remove
2799 the current path that invokes a pause before initialization.
2801 * inspector/JSGlobalObjectInspectorController.h:
2802 * inspector/JSGlobalObjectInspectorController.cpp:
2803 (Inspector::JSGlobalObjectInspectorController::connectFrontend):
2804 (Inspector::JSGlobalObjectInspectorController::disconnectFrontend):
2805 Manage should immediately pause state.
2807 (Inspector::JSGlobalObjectInspectorController::frontendInitialized):
2808 (Inspector::JSGlobalObjectInspectorController::pause): Deleted.
2809 When initialized, trigger a pause if requested.
2811 2017-05-26 Mark Lam <mark.lam@apple.com>
2813 Temporarily commenting out a JSExportTest test until webkit.org/b/172654 is fixed.
2814 https://bugs.webkit.org/show_bug.cgi?id=172655
2816 Reviewed by Saam Barati.
2818 * API/tests/JSExportTests.mm:
2819 (wrapperForNSObjectisObject):
2821 2017-05-26 Mark Lam <mark.lam@apple.com>
2823 REGRESSION(216914): testCFStrings encounters an invalid ExecState callee pointer.
2824 https://bugs.webkit.org/show_bug.cgi?id=172651
2826 Reviewed by Saam Barati.
2828 This is because the assertion utility functions used in testCFStrings() expects
2829 to get the JSGlobalContextRef from the global context variable. However,
2830 testCFStrings() creates its own JSGlobalContextRef but does not set the global
2831 context variable to it.
2833 The fix is to make testCFStrings() initialize the global context variable properly.
2835 * API/tests/testapi.c:
2838 2017-05-26 Yusuke Suzuki <utatane.tea@gmail.com>
2840 Give ModuleProgram the same treatment that we did for ProgramCode in bug#167725
2841 https://bugs.webkit.org/show_bug.cgi?id=167805
2843 Reviewed by Saam Barati.
2845 Since ModuleProgramExecutable is executed only once, we can skip compiling
2846 code unreachable from the current program count. This can skip massive
2847 initialization code.
2849 We already do this for global code in bug#167725. This patch extends it to
2852 * interpreter/Interpreter.cpp:
2853 (JSC::Interpreter::executeModuleProgram):
2854 * interpreter/Interpreter.h:
2856 (JSC::JIT::privateCompileMainPass):
2857 * runtime/JSModuleRecord.cpp:
2858 (JSC::JSModuleRecord::evaluate):
2859 * runtime/JSModuleRecord.h:
2860 (JSC::JSModuleRecord::moduleProgramExecutable): Deleted.
2862 2017-05-26 Oleksandr Skachkov <gskachkov@gmail.com>
2864 Prevent async methods named 'function'
2865 https://bugs.webkit.org/show_bug.cgi?id=172598
2867 Reviewed by Mark Lam.
2869 Prevent async method named 'function' in class.
2870 Link to change in ecma262 specification
2871 https://github.com/tc39/ecma262/pull/884
2873 * parser/Parser.cpp:
2874 (JSC::Parser<LexerType>::parseClass):
2876 2017-05-25 Yusuke Suzuki <utatane.tea@gmail.com>
2878 Unreviewed, build fix for GCC
2880 std::tuple does not have implicit constructor.
2881 Thus, we cannot use implicit construction with initializer brace.
2882 We should specify the name like `GetInst { }`.
2884 * bytecompiler/BytecodeGenerator.h:
2885 (JSC::StructureForInContext::addGetInst):
2887 2017-05-25 Keith Miller <keith_miller@apple.com>
2889 Cleanup tests after r217240
2890 https://bugs.webkit.org/show_bug.cgi?id=172466
2892 Reviewed by Mark Lam.
2894 I forgot to make my test an actual test. Also, remove second call runJSExportTests()
2896 * API/tests/JSExportTests.mm:
2897 (wrapperForNSObjectisObject):
2898 * API/tests/testapi.mm:
2899 (testObjectiveCAPIMain):
2901 2017-05-25 Michael Saboff <msaboff@apple.com>
2903 The default setting of Option::criticalGCMemoryThreshold is too high for iOS
2904 https://bugs.webkit.org/show_bug.cgi?id=172617
2906 Reviewed by Mark Lam.
2908 Reducing criticalGCMemoryThreshold to 0.80 eliminated jetsam on iOS devices
2909 when tested running JetStream.
2911 * runtime/Options.h:
2913 2017-05-25 Saam Barati <sbarati@apple.com>
2915 Our for-in optimization in the bytecode generator does its static analysis incorrectly
2916 https://bugs.webkit.org/show_bug.cgi?id=172532
2917 <rdar://problem/32369452>
2919 Reviewed by Mark Lam.
2921 Our static analysis for when a for-in induction variable
2922 is written to tried to its analysis as we generate
2923 bytecode. This has issues, since it does not account for
2924 the dynamic execution path of the program. Let's consider
2925 a program where our old analysis worked:
2929 o[p]; // We can transform this into a fast get_direct_pname
2931 o[p]; // We cannot transform this since p has been changed.
2935 However, our static analysis did not account for loops, which exist
2936 in JavaScript. e.g, it would incorrectly compile this program as:
2939 for (let i = 0; i < 20; ++i) {
2940 o[p]; // It transforms this to use get_direct_pname even though p will be over-written if we get here from the inner loop back edge!
2942 o[p]; // We correctly do not transform this.
2947 Because of this flaw, I've made the optimization more conservative.
2948 We now optimistically emit code for the optimized access. However,
2949 if a for-in context is *ever* invalidated, before we pop it off
2950 the stack, we rewrite the program's optimized accesses to no longer
2951 be optimized. To do this, each context keeps track of its optimized
2954 This patch also adds a new bytecode, op_nop, which is just a no-op.
2955 It was helpful to add this because reverting get_direct_pname to get_by_val
2956 will leave us with an extra instruction word because get_direct_pname is
2957 has a length of 7 where get_by_val has a length of 6. This leaves us with
2958 an extra slot that we fill with an op_nop.
2960 * bytecode/BytecodeDumper.cpp:
2961 (JSC::BytecodeDumper<Block>::dumpBytecode):
2962 * bytecode/BytecodeList.json:
2963 * bytecode/BytecodeUseDef.h:
2964 (JSC::computeUsesForBytecodeOffset):
2965 (JSC::computeDefsForBytecodeOffset):
2966 * bytecompiler/BytecodeGenerator.cpp:
2967 (JSC::BytecodeGenerator::emitGetByVal):
2968 (JSC::BytecodeGenerator::popIndexedForInScope):
2969 (JSC::BytecodeGenerator::popStructureForInScope):
2970 (JSC::BytecodeGenerator::invalidateForInContextForLocal):
2971 (JSC::StructureForInContext::pop):
2972 (JSC::IndexedForInContext::pop):
2973 * bytecompiler/BytecodeGenerator.h:
2974 (JSC::StructureForInContext::addGetInst):
2975 (JSC::IndexedForInContext::addGetInst):
2976 * dfg/DFGByteCodeParser.cpp:
2977 (JSC::DFG::ByteCodeParser::parseBlock):
2978 * dfg/DFGCapabilities.cpp:
2979 (JSC::DFG::capabilityLevel):
2981 (JSC::JIT::privateCompileMainPass):
2983 * jit/JITOpcodes.cpp:
2984 (JSC::JIT::emit_op_nop):
2985 * llint/LowLevelInterpreter.asm:
2987 2017-05-25 Mark Lam <mark.lam@apple.com>
2989 ObjectToStringAdaptiveInferredPropertyValueWatchpoint should not reinstall itself nor handleFire if it's dying shortly.
2990 https://bugs.webkit.org/show_bug.cgi?id=172548
2991 <rdar://problem/31458393>
2993 Reviewed by Filip Pizlo.
2995 Consider the following scenario:
2997 1. A ObjectToStringAdaptiveInferredPropertyValueWatchpoint O1, watches for
2998 structure transitions, e.g. structure S2 transitioning to structure S3.
2999 In this case, O1 would be installed in S2's watchpoint set.
3000 2. When the structure transition happens, structure S2 will fire watchpoint O1.
3001 3. O1's handler will normally re-install itself in the watchpoint set of the new
3002 "transitioned to" structure S3.
3003 4. "Installation" here requires writing into the StructureRareData SD3 of the new
3004 structure S3. If SD3 does not exist yet, the installation process will trigger
3005 the allocation of StructureRareData SD3.
3006 5. It is possible that the Structure S1, and StructureRareData SD1 that owns the
3007 ObjectToStringAdaptiveInferredPropertyValueWatchpoint O1 is no longer reachable
3008 by the GC, and therefore will be collected soon.
3009 6. The allocation of SD3 in (4) may trigger the sweeping of the StructureRareData
3010 SD1. This, in turn, triggers the deletion of the
3011 ObjectToStringAdaptiveInferredPropertyValueWatchpoint O1.
3013 After O1 is deleted in (6) and SD3 is allocated in (4), execution continues in
3014 AdaptiveInferredPropertyValueWatchpointBase::fire() where O1 gets installed in
3015 structure S3's watchpoint set. This is obviously incorrect because O1 is already
3016 deleted. The result is that badness happens later when S3's watchpoint set fires
3017 its watchpoints and accesses the deleted O1.
3019 The fix is to enhance AdaptiveInferredPropertyValueWatchpointBase::fire() to
3020 check if "this" is still valid before proceeding to re-install itself or to
3021 invoke its handleFire() method.
3023 ObjectToStringAdaptiveInferredPropertyValueWatchpoint (which extends
3024 AdaptiveInferredPropertyValueWatchpointBase) will override its isValid() method,
3025 and return false its owner StructureRareData is no longer reachable by the GC.
3026 This ensures that it won't be deleted while it's installed to any watchpoint set.
3028 Additional considerations and notes:
3029 1. In the above, I talked about the ObjectToStringAdaptiveInferredPropertyValueWatchpoint
3030 being installed in watchpoint sets. What actually happens is that
3031 ObjectToStringAdaptiveInferredPropertyValueWatchpoint has 2 members
3032 (m_structureWatchpoint and m_propertyWatchpoint) which may be installed in
3033 watchpoint sets. The ObjectToStringAdaptiveInferredPropertyValueWatchpoint is
3034 not itself a Watchpoint object.
3036 But for brevity, in the above, I refer to the ObjectToStringAdaptiveInferredPropertyValueWatchpoint
3037 instead of its Watchpoint members. The description of the issue is still
3038 accurate given the life-cycle of the Watchpoint members are embedded in the
3039 enclosing ObjectToStringAdaptiveInferredPropertyValueWatchpoint object, and
3040 hence, they share the same life-cycle.
3042 2. The top of AdaptiveInferredPropertyValueWatchpointBase::fire() removes its
3043 m_structureWatchpoint and m_propertyWatchpoint if they have been added to any
3044 watchpoint sets. This is safe to do even if the owner StructureRareData is no
3045 longer reachable by the GC.
3047 This is because the only way we can get to AdaptiveInferredPropertyValueWatchpointBase::fire()
3048 is if its Watchpoint members are still installed in some watchpoint set that
3049 fired. This means that the AdaptiveInferredPropertyValueWatchpointBase
3050 instance has not been deleted yet, because its destructor will automatically
3051 remove the Watchpoint members from any watchpoint sets.
3053 * bytecode/AdaptiveInferredPropertyValueWatchpointBase.cpp:
3054 (JSC::AdaptiveInferredPropertyValueWatchpointBase::fire):
3055 (JSC::AdaptiveInferredPropertyValueWatchpointBase::isValid):
3056 * bytecode/AdaptiveInferredPropertyValueWatchpointBase.h:
3057 * heap/FreeList.cpp:
3058 (JSC::FreeList::contains):
3061 * heap/HeapCellInlines.h:
3062 (JSC::HeapCell::isLive):
3063 * heap/MarkedAllocator.h:
3064 (JSC::MarkedAllocator::isFreeListedCell):
3065 * heap/MarkedBlock.h:
3066 * heap/MarkedBlockInlines.h:
3067 (JSC::MarkedBlock::Handle::isFreeListedCell):
3068 * runtime/StructureRareData.cpp:
3069 (JSC::ObjectToStringAdaptiveInferredPropertyValueWatchpoint::isValid):
3071 2017-05-23 Saam Barati <sbarati@apple.com>
3073 We should not mmap zero bytes for a memory in Wasm
3074 https://bugs.webkit.org/show_bug.cgi?id=172528
3075 <rdar://problem/32257076>
3077 Reviewed by Mark Lam.
3079 This patch fixes a bug where we would call into mmap with zero bytes
3080 when creating a slow WasmMemory with zero initial page size. This fix
3081 is simple: if we don't have any initial bytes, we just call the constructor
3082 in WasmMemory that's meant to handle this case.
3084 * wasm/WasmMemory.cpp:
3085 (JSC::Wasm::Memory::create):
3087 2017-05-23 Brian Burg <bburg@apple.com>
3089 REGRESSION(r217051): Automation sessions fail to complete bootstrap
3090 https://bugs.webkit.org/show_bug.cgi?id=172513
3091 <rdar://problem/32338354>
3093 Reviewed by Joseph Pecoraro.
3095 The changes to be more strict about typechecking messages were too strict.
3097 * inspector/remote/cocoa/RemoteInspectorCocoa.mm:
3098 (Inspector::RemoteInspector::receivedSetupMessage):
3099 WIRAutomatically is an optional key in the setup message. In the relay, this key gets copied
3100 into an NSDictionary as NSNull if the key isn't present in a forwarded command.
3101 We need to revert NSNull values to nil, since it's valid to call [nil boolValue] but not
3102 [[NSNull null] boolValue]. We also need to allow for nil in the typecheck for this key.
3104 2017-05-23 Myles C. Maxfield <mmaxfield@apple.com>
3106 Remove dead ENABLE(FONT_LOAD_EVENTS) code
3107 https://bugs.webkit.org/show_bug.cgi?id=172517
3109 Rubber-stamped by Simon Fraser.
3111 * Configurations/FeatureDefines.xcconfig:
3113 2017-05-23 Saam Barati <sbarati@apple.com>
3115 CFGSimplificationPhase should not merge a block with itself
3116 https://bugs.webkit.org/show_bug.cgi?id=172508
3117 <rdar://problem/28424006>
3119 Reviewed by Keith Miller.
3121 CFGSimplificationPhase can run into or create IR that ends up with a
3122 block that has a Jump to itself, and no other predecessors. It should
3123 gracefully handle such IR. Before this patch, it would not. The only criteria
3124 for merging 'block' with 'targetBlock' used to be that 'targetBlock.predecessors.size() == 1'.
3125 The code is written in such a way that if we merge a block with itself, we
3126 will infinite loop until we run out of memory.
3128 Merging a block with itself does not make sense for a few reasons. First,
3129 we're joining the contents of two blocks. What is the definition of joining
3130 a block with itself? I suppose we could simply unroll this self loop
3131 one level, but that would not be wise because this self loop is by definition
3132 unreachable unless it's the root block in the graph (which I think is
3133 invalid IR since we'd never generate bytecode that would do this).
3135 This patch employs an easy fix: we can't merge a block with itself.
3137 * dfg/DFGCFGSimplificationPhase.cpp:
3138 (JSC::DFG::CFGSimplificationPhase::canMergeBlocks):
3139 (JSC::DFG::CFGSimplificationPhase::run):
3140 (JSC::DFG::CFGSimplificationPhase::convertToJump):
3141 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
3143 2017-05-22 Brian Burg <bburg@apple.com>
3145 Web Inspector: webkit reload policy should match default behavior
3146 https://bugs.webkit.org/show_bug.cgi?id=171385
3147 <rdar://problem/31871515>
3149 Reviewed by Joseph Pecoraro.
3151 Add a new option to Page.reload that allows the test harness
3152 to reload its test page using the old reload behavior.
3154 The new behavior of revalidating expired cached subresources only
3155 is the current default, since only the test harness needs the old behavior.
3157 * inspector/protocol/Page.json:
3159 2017-05-22 Keith Miller <keith_miller@apple.com>
3161 [Cocoa] An exported Objective C class’s prototype and constructor don't persist across JSContext deallocation
3162 https://bugs.webkit.org/show_bug.cgi?id=167708
3164 Reviewed by Geoffrey Garen.
3166 This patch moves the Objective C wrapper map to the global object. In order to make this work the JSWrapperMap
3167 class no longer holds a reference to the JSContext. Instead, the context must be provided when getting a wrapper.
3169 Also, this patch fixes a "bug" where we would observe changes to the Object property on the global object when
3170 creating a wrapper for NSObject.
3175 (-[JSContext ensureWrapperMap]):
3176 (-[JSContext initWithVirtualMachine:]):
3177 (-[JSContext dealloc]):
3178 (-[JSContext wrapperMap]):
3179 (-[JSContext initWithGlobalContextRef:]):
3180 (-[JSContext wrapperForObjCObject:]):
3181 (-[JSContext wrapperForJSObject:]):
3182 * API/JSWrapperMap.h:
3183 * API/JSWrapperMap.mm:
3184 (-[JSObjCClassInfo initForClass:]):
3185 (-[JSObjCClassInfo allocateConstructorAndPrototypeInContext:]):
3186 (-[JSObjCClassInfo wrapperForObject:inContext:]):
3187 (-[JSObjCClassInfo constructorInContext:]):
3188 (-[JSObjCClassInfo prototypeInContext:]):
3189 (-[JSWrapperMap initWithGlobalContextRef:]):
3190 (-[JSWrapperMap classInfoForClass:]):
3191 (-[JSWrapperMap jsWrapperForObject:inContext:]):
3192 (-[JSWrapperMap objcWrapperForJSValueRef:inContext:]):
3193 (-[JSObjCClassInfo initWithContext:forClass:]): Deleted.
3194 (-[JSObjCClassInfo allocateConstructorAndPrototype]): Deleted.
3195 (-[JSObjCClassInfo wrapperForObject:]): Deleted.
3196 (-[JSObjCClassInfo constructor]): Deleted.
3197 (-[JSObjCClassInfo prototype]): Deleted.
3198 (-[JSWrapperMap initWithContext:]): Deleted.
3199 (-[JSWrapperMap jsWrapperForObject:]): Deleted.
3200 (-[JSWrapperMap objcWrapperForJSValueRef:]): Deleted.
3201 * API/tests/JSExportTests.mm:
3202 (wrapperLifetimeIsTiedToGlobalObject):
3204 * API/tests/testapi.mm:
3205 * runtime/JSGlobalObject.h:
3206 (JSC::JSGlobalObject::wrapperMap):
3207 (JSC::JSGlobalObject::setWrapperMap):
3209 2017-05-22 Filip Pizlo <fpizlo@apple.com>
3211 FTL stack overflow handling should not assume that B3 never selects callee-saves in the prologue
3212 https://bugs.webkit.org/show_bug.cgi?id=172455
3214 Reviewed by Mark Lam.
3216 The FTL needs to run B3's callee-save register restoration before it runs the exception
3217 handler's callee-save register restoration. This exposes B3's callee-save register
3218 algorithm in AssemblyHelpers so that the FTL can call it.
3220 * b3/air/AirGenerate.cpp:
3221 (JSC::B3::Air::generate):
3222 * ftl/FTLLowerDFGToB3.cpp:
3223 (JSC::FTL::DFG::LowerDFGToB3::lower): Fix the bug.
3224 * heap/Subspace.cpp: Added some debugging support.
3225 (JSC::Subspace::allocate):
3226 (JSC::Subspace::tryAllocate):
3227 (JSC::Subspace::didAllocate):
3229 * jit/AssemblyHelpers.h:
3230 (JSC::AssemblyHelpers::addressFor):
3231 (JSC::AssemblyHelpers::emitSave):
3232 (JSC::AssemblyHelpers::emitRestore):
3234 2017-05-20 Yusuke Suzuki <utatane.tea@gmail.com>
3236 [FTL] Support GetByVal with ArrayStorage and SlowPutArrayStorage
3237 https://bugs.webkit.org/show_bug.cgi?id=172216
3239 Reviewed by Saam Barati.
3241 This patch adds GetByVal support for ArrayStorage and SlowPutArrayStorage.
3242 To lower CheckInBounds in FTL, we add a new GetVectorLength op. It only accepts
3243 ArrayStorage and SlowPutArrayStorage, then it produces vector length.
3244 CheckInBounds uses this vector length to perform bound checking for ArrayStorage
3245 and SlowPutArrayStorage.
3247 * dfg/DFGAbstractInterpreterInlines.h:
3248 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
3249 * dfg/DFGArrayMode.cpp:
3250 (JSC::DFG::permitsBoundsCheckLowering):
3251 * dfg/DFGClobberize.h:
3252 (JSC::DFG::clobberize):
3253 * dfg/DFGDoesGC.cpp:
3255 * dfg/DFGFixupPhase.cpp:
3256 (JSC::DFG::FixupPhase::fixupNode):
3257 * dfg/DFGHeapLocation.cpp:
3258 (WTF::printInternal):
3259 * dfg/DFGHeapLocation.h:
3260 * dfg/DFGIntegerRangeOptimizationPhase.cpp:
3262 (JSC::DFG::Node::hasArrayMode):
3263 * dfg/DFGNodeType.h:
3264 * dfg/DFGPredictionPropagationPhase.cpp:
3265 * dfg/DFGSSALoweringPhase.cpp:
3266 (JSC::DFG::SSALoweringPhase::lowerBoundsCheck):
3267 * dfg/DFGSafeToExecute.h:
3268 (JSC::DFG::safeToExecute):
3269 * dfg/DFGSpeculativeJIT32_64.cpp:
3270 (JSC::DFG::SpeculativeJIT::compile):
3271 * dfg/DFGSpeculativeJIT64.cpp:
3272 (JSC::DFG::SpeculativeJIT::compile):
3273 * ftl/FTLAbstractHeapRepository.h:
3274 (JSC::FTL::AbstractHeapRepository::forIndexingType):
3275 (JSC::FTL::AbstractHeapRepository::forArrayType):
3276 * ftl/FTLCapabilities.cpp:
3277 (JSC::FTL::canCompile):
3278 * ftl/FTLLowerDFGToB3.cpp:
3279 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
3280 (JSC::FTL::DFG::LowerDFGToB3::compileGetVectorLength):
3281 (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
3282 * jit/JITPropertyAccess.cpp:
3283 (JSC::JIT::emitArrayStoragePutByVal):
3284 * jit/JITPropertyAccess32_64.cpp:
3285 (JSC::JIT::emitArrayStorageLoad):
3286 (JSC::JIT::emitArrayStoragePutByVal):
3288 2017-05-21 Saam Barati <sbarati@apple.com>
3290 We incorrectly throw a syntax error when declaring a top level for-loop iteration variable the same as a parameter
3291 https://bugs.webkit.org/show_bug.cgi?id=171041
3292 <rdar://problem/32082516>
3294 Reviewed by Yusuke Suzuki.
3296 We were treating a for-loop variable declaration potentially as a top
3297 level statement, e.g, in a program like this:
3300 for (let variable of expr) { }
3303 But we should not be. This had the consequence of making this type of program
3304 throw a syntax error:
3307 for (let arg of expr) { }
3310 even though it should not. The fix is simple, we just need to increment the
3311 statement depth before parsing anything inside the for loop.
3313 * parser/Parser.cpp:
3314 (JSC::Parser<LexerType>::parseForStatement):
3316 2017-05-19 Yusuke Suzuki <utatane.tea@gmail.com>
3318 [JSC] Make get_by_val & string "499" to number 499
3319 https://bugs.webkit.org/show_bug.cgi?id=172225
3321 Reviewed by Saam Barati.
3323 Property subscript will be converted by ToString. So JS code is not aware of
3324 the original type of the subscript value. But our get_by_val can leverage
3325 information if the given subscript is number. Thus, passing number instead of
3326 string can improve the performance of get_by_val in all the tiers.
3328 In this patch, we add BytecodeGenerator::emitNodeForProperty. It attempts to
3329 convert the given value to Int32 index constant if the given value is a string
3330 that can be converted to Int32.
3332 This patch improves SixSpeed map-string.es5 by 9.8x. This accessing form can
3333 appear in some code like accessing the result of JSON.
3335 map-string.es5 1640.6738+-110.9182 ^ 167.4121+-23.8328 ^ definitely 9.8002x faster
3337 * bytecompiler/BytecodeGenerator.h:
3338 (JSC::BytecodeGenerator::emitNodeForProperty):
3339 (JSC::BytecodeGenerator::emitNodeForLeftHandSideForProperty):
3340 * bytecompiler/NodesCodegen.cpp:
3341 (JSC::TaggedTemplateNode::emitBytecode):
3342 (JSC::BracketAccessorNode::emitBytecode):
3343 (JSC::BytecodeIntrinsicNode::emit_intrinsic_putByValDirect):
3344 (JSC::FunctionCallBracketNode::emitBytecode):
3345 (JSC::PostfixNode::emitBracket):
3346 (JSC::PrefixNode::emitBracket):
3347 (JSC::AssignBracketNode::emitBytecode):
3348 (JSC::ReadModifyBracketNode::emitBytecode):
3349 (JSC::ForInNode::emitLoopHeader):
3350 (JSC::ForOfNode::emitBytecode):
3351 (JSC::ObjectPatternNode::bindValue):
3352 (JSC::AssignmentElementNode::bindValue):
3354 2017-05-21 Saam Barati <sbarati@apple.com>
3356 We overwrite the callee save space on the stack when throwing stack overflow from wasm
3357 https://bugs.webkit.org/show_bug.cgi?id=172316
3359 Reviewed by Mark Lam.
3361 When throwing a stack overflow exception, the overflow
3362 thunk would do the following:
3364 populate argument registers
3367 However, the C function is allowed to clobber our spilled
3368 callee saves that live below fp. The reason I did this move is that
3369 when we jump to this code, we've proven that sp is out of bounds on
3370 the stack. So we're not allowed to just use its value or keep growing
3371 the stack from that point. However, this patch revises this approach
3372 to be the same in spirit, but actually correct. We conservatively assume
3373 the B3 function we're coming from could have saved all callee saves.
3374 So we emit code like this now:
3375 add -maxNumCalleeSaveSpace, fp, sp
3376 populate argument registers
3379 This ensures our callee saves will not be overwritten. Note
3380 that fp is still in a valid stack range here, since the thing
3381 calling the wasm code did a stack check. Also note that maxNumCalleeSaveSpace
3382 is less than our redzone size, so it's safe to decrement sp by
3385 The previously added wasm stack overflow test is an instance crash
3386 without this change on arm64. It also appears that this test crashed
3387 on some other x86 devices.
3389 * wasm/WasmThunks.cpp:
3390 (JSC::Wasm::throwStackOverflowFromWasmThunkGenerator):
3392 2017-05-20 Chris Dumez <cdumez@apple.com>
3394 Drop [NoInterfaceObject]