1 2016-04-17 Filip Pizlo <fpizlo@apple.com>
3 FTL should pin the tag registers at inline caches
4 https://bugs.webkit.org/show_bug.cgi?id=156678
6 Reviewed by Saam Barati.
8 This is a long-overdue fix to our inline caches. Back when we had LLVM, we couldn't rely on the tags
9 being pinned to any registers. So, if the inline caches needed tags, they'd have to materialize them.
11 This removes those materializations. This should reduce the amount of code generated in inline caches
12 and it should make inline caches faster. The effect appears to be small.
14 It may be that after this change, we'll even be able to kill the
15 HaveTagRegisters/DoNotHaveTagRegisters logic.
17 * bytecode/PolymorphicAccess.cpp:
18 (JSC::AccessCase::generateWithGuard):
19 (JSC::AccessCase::generateImpl):
20 * ftl/FTLLowerDFGToB3.cpp:
21 (JSC::FTL::DFG::LowerDFGToB3::compilePutById):
22 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct):
23 (JSC::FTL::DFG::LowerDFGToB3::compileTailCall):
24 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
25 (JSC::FTL::DFG::LowerDFGToB3::compileIn):
26 (JSC::FTL::DFG::LowerDFGToB3::getById):
28 (JSC::readCallTarget):
29 (JSC::linkPolymorphicCall):
30 * jit/ThunkGenerators.cpp:
31 (JSC::virtualThunkFor):
33 2016-04-18 Yusuke Suzuki <utatane.tea@gmail.com>
35 [ES7] yield star should not return if the inner iterator.throw returns { done: true }
36 https://bugs.webkit.org/show_bug.cgi?id=156576
38 Reviewed by Saam Barati.
40 This is slight generator fix in ES7. When calling generator.throw(),
41 the yield-star should call the throw() of the inner generator. At that
42 time, when the result of throw() is { done: true}, the generator should
47 yield * (function * () {
52 // Continue executing.
58 shouldBe(g.throw().value, 42);
61 * builtins/GeneratorPrototype.js:
66 * bytecode/BytecodeIntrinsicRegistry.cpp:
67 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
68 * bytecode/BytecodeIntrinsicRegistry.h:
69 * bytecompiler/BytecodeGenerator.cpp:
70 (JSC::BytecodeGenerator::emitDelegateYield):
71 * runtime/JSGeneratorFunction.h:
72 * tests/stress/generator-yield-star.js:
74 * tests/stress/yield-star-throw-continue.js: Added.
79 2016-04-17 Jeremy Huddleston Sequoia <jeremyhu@apple.com>
81 Fix incorrect assumption that APPLE implies Mac.
82 https://bugs.webkit.org/show_bug.cgi?id=156683
84 Addresses build failure introduced in r199094
86 Reviewed by Alex Christensen.
90 2016-04-17 Benjamin Poulain <bpoulain@apple.com>
92 [JSC] ReduceDoubleToFloat should work accross Phis
93 https://bugs.webkit.org/show_bug.cgi?id=156603
94 <rdar://problem/25736205>
96 Reviewed by Saam Barati and Filip Pizlo.
98 This patch extends B3's ReduceDoubleToFloat phase to work accross
99 Upsilon-Phis. This is important to optimize loops and some crazy cases.
101 In its simplest form, we can have conversion propagated from something
104 Float @2 = DoubleToFloat(@1)
106 When that happens, we just need to propagate that the result only
107 need float precision accross all values coming to this Phi.
110 There are more complicated cases when the value produced is effectively Float
111 but the user of the value does not do DoubleToFloat.
113 Typically, we have something like:
118 @3 = FloatToDouble(@x)
122 @6 = Add(@5, @somethingFloat)
123 @7 = DoubleToFloat(@6)
125 Here with a Phi-Upsilon that is a Double but can be represented
126 as Float without loss of precision.
128 It is valuable to convert such Phis to float if and only if the value
129 is used as float. Otherwise, you may be just adding useless conversions
130 (for example, two double constants that flow into a double Add should not
131 turn into two float constant flowing into a FloatToDouble then Add).
134 ReduceDoubleToFloat do two analysis passes to gather the necessary
135 meta information. Then we have a simplify() phase to actually reduce
136 operation. Finally, the cleanup() pass put the graph into a valid
139 The two analysis passes work by disproving that something is float.
140 -findCandidates() accumulates anything used as Double.
141 -findPhisContainingFloat() accumulates phis that would lose precision
142 by converting the input to float.
144 With this change, Unity3D improves by ~1.5%, box2d-f32 improves
145 by ~2.8% (on Haswell).
147 * b3/B3ReduceDoubleToFloat.cpp:
148 (JSC::B3::reduceDoubleToFloat):
150 (JSC::B3::testCompareTwoFloatToDouble):
151 (JSC::B3::testCompareOneFloatToDouble):
152 (JSC::B3::testCompareFloatToDoubleThroughPhi):
153 (JSC::B3::testDoubleToFloatThroughPhi):
154 (JSC::B3::testDoubleProducerPhiToFloatConversion):
155 (JSC::B3::testDoubleProducerPhiToFloatConversionWithDoubleConsumer):
156 (JSC::B3::testDoubleProducerPhiWithNonFloatConst):
157 (JSC::B3::testStoreDoubleConstantAsFloat):
159 * tests/stress/double-compare-to-float.js: Added.
160 (canSimplifyToFloat):
161 (canSimplifyToFloatWithConstant):
164 * tests/stress/double-to-float.js: Added.
165 (upsilonReferencingItsPhi):
166 (upsilonReferencingItsPhiAllFloat):
167 (upsilonReferencingItsPhiWithoutConversion):
168 (conversionPropagages):
169 (chainedUpsilonBothConvert):
170 (chainedUpsilonFirstConvert):
172 2016-04-17 Yusuke Suzuki <utatane.tea@gmail.com>
174 [ES6] Use @isObject to check Object Type instead of using instanceof
175 https://bugs.webkit.org/show_bug.cgi?id=156676
177 Reviewed by Darin Adler.
179 Use @isObject instead of `instanceof @Object`.
180 The `instanceof` check is not enough to check Object Type.
181 For example, given 2 realms, the object created in one realm does not inherit the Object of another realm.
182 Another example is that the object which does not inherit Object.
183 This object can be easily created by calling `Object.create(null)`.
185 * builtins/RegExpPrototype.js:
188 (GlobalObject::finishCreation):
189 (functionCreateGlobalObject):
190 * tests/stress/regexp-match-in-other-realm-should-work.js: Added.
192 * tests/stress/regexp-match-should-work-with-objects-not-inheriting-object-prototype.js: Added.
196 2016-04-17 Darin Adler <darin@apple.com>
198 Remove more uses of Deprecated::ScriptXXX
199 https://bugs.webkit.org/show_bug.cgi?id=156660
201 Reviewed by Antti Koivisto.
203 * bindings/ScriptFunctionCall.cpp:
204 (Deprecated::ScriptCallArgumentHandler::appendArgument): Deleted
205 unneeded overloads that take a ScriptObject and ScriptValue.
206 * bindings/ScriptFunctionCall.h: Ditto.
208 * bindings/ScriptObject.h: Added operator so this can change
209 itself into a JSObject*. Helps while phasing this class out.
211 * bindings/ScriptValue.h: Export toInspectorValue so it can be
214 * inspector/InjectedScriptManager.cpp:
215 (Inspector::InjectedScriptManager::createInjectedScript): Changed
216 return value from Deprecated::ScriptObject to JSObject*.
217 (Inspector::InjectedScriptManager::injectedScriptFor): Updated for
218 the return value change above.
219 * inspector/InjectedScriptManager.h: Ditto.
221 2016-04-16 Benjamin Poulain <bpoulain@webkit.org>
223 [JSC] DFG should support relational comparisons of Number and Other
224 https://bugs.webkit.org/show_bug.cgi?id=156669
226 Reviewed by Darin Adler.
228 In Sunspider/3d-raytrace, DFG falls back to JSValue in some important
229 relational compare because profiling sees "undefined" from time to time.
231 This case is fairly common outside Sunspider too because of out-of-bounds array access.
232 Unfortunately for us, our fallback for compare is really inefficient.
234 Fortunately, relational comparison with null/undefined/true/false are trival.
235 We can just convert both side to Double. That's what this patch adds.
237 I also extended constant folding for those cases because I noticed
238 a bunch of "undefined" constant going through DoubleRep at runtime.
240 * dfg/DFGAbstractInterpreterInlines.h:
241 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
242 * dfg/DFGFixupPhase.cpp:
243 (JSC::DFG::FixupPhase::fixupNode):
244 * tests/stress/compare-number-and-other.js: Added.
246 (let.operator.of.operators.eval.testPolymorphic):
247 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.eval.testMonomorphic):
248 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.testMonomorphicLeftConstant):
249 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.testMonomorphicRightConstant):
250 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.i.testPolymorphic):
252 2016-04-16 Benjamin Poulain <bpoulain@apple.com>
254 [JSC] FRound/Negate can produce an impure NaN out of a pure NaN
255 https://bugs.webkit.org/show_bug.cgi?id=156528
257 Reviewed by Filip Pizlo.
259 If you fround a double with the bits 0xfff7000000000000
260 you get 0xfffe000000000000. The first is a pure NaN, the second isn't.
262 This is without test because I could not find a way to create a 0xfff7000000000000
263 while convincing DFG that its pure.
264 When we purify NaNs from typed array, we use a specific value of NaN if the input
265 is any NaN, making testing tricky.
267 * bytecode/SpeculatedType.cpp:
268 (JSC::typeOfDoubleNegation):
270 2016-04-16 Konstantin Tokarev <annulen@yandex.ru>
272 JS::DFG::nodeValuePairListDump does not compile with libstdc++ 4.8
273 https://bugs.webkit.org/show_bug.cgi?id=156670
275 Reviewed by Darin Adler.
278 (JSC::DFG::nodeValuePairListDump): Modified to use lambda as comparator.
280 2016-04-16 Konstantin Tokarev <annulen@yandex.ru>
282 [mips] Implemented moveZeroToDouble.
283 https://bugs.webkit.org/show_bug.cgi?id=155429
285 Reviewed by Darin Adler.
287 This function is required to fix compilation after r197687.
289 * assembler/MacroAssemblerMIPS.h:
290 (JSC::MacroAssemblerMIPS::moveZeroToDouble):
292 2016-04-15 Darin Adler <darin@apple.com>
294 Reduce use of Deprecated::ScriptXXX classes
295 https://bugs.webkit.org/show_bug.cgi?id=156632
297 Reviewed by Alex Christensen.
299 * bindings/ScriptFunctionCall.cpp:
300 (Deprecated::ScriptCallArgumentHandler::appendArgument): Deleted version that takes a Deprecated::ScriptValue.
301 (Deprecated::ScriptFunctionCall::call): Changed to return a JSValue.
302 * bindings/ScriptFunctionCall.h: Updated for the above.
304 * bindings/ScriptValue.cpp:
305 (Inspector::jsToInspectorValue): Moved from Deprecated namespace to Inspector namespace. Later, we should
306 move this to another source file in the inspector directory.
307 (Inspector::toInspectorValue): Added.
308 (Deprecated::ScriptValue::toInspectorValue): Updated for change to underlying function.
309 * bindings/ScriptValue.h: Update for the above.
311 * inspector/InjectedScript.cpp:
312 (Inspector::InjectedScript::evaluateOnCallFrame): Changed arguments and return values from
313 Deprecated::ScriptValue to JSC::JSValue.
314 (Inspector::InjectedScript::functionDetails): Ditto.
315 (Inspector::InjectedScript::wrapCallFrames): Ditto.
316 (Inspector::InjectedScript::wrapObject): Ditto.
317 (Inspector::InjectedScript::wrapTable): Ditto.
318 (Inspector::InjectedScript::previewValue): Ditto.
319 (Inspector::InjectedScript::setExceptionValue): Ditto.
320 (Inspector::InjectedScript::findObjectById): Ditto.
321 (Inspector::InjectedScript::inspectObject): Ditto.
322 * inspector/InjectedScript.h: Ditto.
323 * inspector/InjectedScriptBase.cpp:
324 (Inspector::InjectedScriptBase::callFunctionWithEvalEnabled): Ditto.
325 (Inspector::InjectedScriptBase::makeCall): Ditto.
326 * inspector/InjectedScriptBase.h: Ditto.
327 * inspector/InjectedScriptModule.cpp:
328 (Inspector::InjectedScriptModule::ensureInjected): Ditto.
329 * inspector/ScriptDebugListener.h: Ditto.
330 * inspector/ScriptDebugServer.cpp:
331 (Inspector::ScriptDebugServer::evaluateBreakpointAction): Ditto.
332 (Inspector::ScriptDebugServer::dispatchDidPause): Ditto.
333 (Inspector::ScriptDebugServer::dispatchBreakpointActionProbe): Ditto.
334 (Inspector::ScriptDebugServer::exceptionOrCaughtValue): Ditto.
335 * inspector/ScriptDebugServer.h: Ditto.
336 * inspector/agents/InspectorDebuggerAgent.cpp:
337 (Inspector::InspectorDebuggerAgent::buildExceptionPauseReason): Ditto.
338 (Inspector::InspectorDebuggerAgent::didPause): Ditto.
339 (Inspector::InspectorDebuggerAgent::breakpointActionProbe): Ditto.
340 (Inspector::InspectorDebuggerAgent::didContinue): Ditto.
341 (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): Ditto.
342 * inspector/agents/InspectorDebuggerAgent.h: Ditto.
343 * inspector/agents/InspectorHeapAgent.cpp:
344 (Inspector::InspectorHeapAgent::getPreview): Ditto.
345 (Inspector::InspectorHeapAgent::getRemoteObject): Ditto.
347 2016-04-15 Keith Miller <keith_miller@apple.com>
349 Some JIT/DFG operations need NativeCallFrameTracers
350 https://bugs.webkit.org/show_bug.cgi?id=156650
352 Reviewed by Michael Saboff.
354 Some of our operation functions did not have native call frame
355 tracers. This meant that we would crash occasionally on some
356 of our tests when they triggered a GC in one of the functions
357 without a tracer. In particular, this was exemplified by another
358 upcoming patch when calling operationSetFunctionName.
360 This patch does not add tests since this happens consistently in
361 the patch adding delete_by_id to the DFG.
363 * dfg/DFGOperations.cpp:
364 * jit/JITOperations.cpp:
366 2016-04-15 Joseph Pecoraro <pecoraro@apple.com>
368 Web Inspector: sourceMappingURL not used when sourceURL is set
369 https://bugs.webkit.org/show_bug.cgi?id=156021
370 <rdar://problem/25438417>
372 Reviewed by Timothy Hatcher.
374 Clean up Debugger.sourceParsed to separately include:
376 - url ("resource URL", "source url" in JSC APIs)
377 - sourceURL - //# sourceURL directive
379 By always having the resource URL the Web Inspector frontend
380 can better match this Script to a Resource of the same URL,
381 and decide to use the sourceURL if it is available when
384 * inspector/protocol/Debugger.json:
385 * inspector/agents/InspectorDebuggerAgent.cpp:
386 (Inspector::InspectorDebuggerAgent::setBreakpointByUrl):
387 (Inspector::InspectorDebuggerAgent::didParseSource):
388 Send the new sourceParsed parameters.
390 2016-04-14 Joseph Pecoraro <pecoraro@apple.com>
392 Web Inspector: Cleanup inspector/debugger tests
393 https://bugs.webkit.org/show_bug.cgi?id=156619
395 Reviewed by Brian Burg.
397 While cleaning up the tests it exposed the fact that breakpoints
398 were not getting disabled when the inspector closes. This means
399 that opening the inspector, with breakpoints, and closing the
400 inspector, would leave the JSC::Debugger thinking breakpoints
401 are active. The JSC::Debugger should be reset.
403 * inspector/agents/InspectorDebuggerAgent.cpp:
404 (Inspector::InspectorDebuggerAgent::disable):
406 2016-04-14 Geoffrey Garen <ggaren@apple.com>
408 CopiedBlock should be 64kB
410 Reviewed by Benjamin Poulain.
412 Let's try another value.
414 This is 25% faster on kraken-audio-beat-detection on Mac Pro.
416 * heap/CopiedBlock.h:
418 2016-04-15 Zan Dobersek <zdobersek@igalia.com>
420 Tail call optimizations lead to crashes on ARM Thumb + Linux
421 https://bugs.webkit.org/show_bug.cgi?id=150083
423 Reviewed by Csaba Osztrogonác.
425 * assembler/AbstractMacroAssembler.h:
426 (JSC::AbstractMacroAssembler::repatchNearCall): In case of a tail call relink to the
427 data location of the destination, and not the executable address. This is needed for
428 the ARM Thumb2 platform where both the source and destination addresses of a jump relink
429 must not have the bottom bit decorated, as asserted in ARMv7Assembler::relinkJump().
431 (JSC::linkPolymorphicCall): Similarly, when linking a tail call we must link to the
432 address that has a non-decorated bottom bit, as asserted in ARMv7Assembler::linkJumpAbsolute().
434 2016-04-14 Geoffrey Garen <ggaren@apple.com>
436 Unreviewed, rolling out r199567.
438 performance regression on kraken on macbook*
442 "CopiedBlock should be 8kB"
443 https://bugs.webkit.org/show_bug.cgi?id=156610
444 http://trac.webkit.org/changeset/199567
446 2016-04-14 Geoffrey Garen <ggaren@apple.com>
448 CopiedBlock should be 8kB
449 https://bugs.webkit.org/show_bug.cgi?id=156610
451 Reviewed by Michael Saboff.
455 15% faster on kraken-audio-beat-detection
457 5% faster on v8-splay
459 Hopefully, this will be OK on MacBook* bots as well.
461 32kB is the full size of L1 cache on x86. So, allocating and zero-filling
462 a 32kB CopiedBlock would basically flush the L1 cache. We can ameliorate
463 this problem by using smaller blocks -- or, if that doesn't work, we can
464 use larger blocks to amortize the cost.
466 * heap/CopiedBlock.h:
468 2016-04-14 Filip Pizlo <fpizlo@apple.com>
470 PolymorphicAccess should try to generate a stub only once
471 https://bugs.webkit.org/show_bug.cgi?id=156555
473 Reviewed by Geoffrey Garen.
475 This changes the PolymorphicAccess heuristics to reduce the amount of code generation even
476 more than before. We used to always generate a monomorphic stub for the first case we saw.
477 This change disables that. This change also increases the buffering countdown to match the
478 cool-down repatch count. This means that we will allow for ten slow paths for adding cases,
479 then we will generate a stub, and then we will go into cool-down and the repatching slow
480 paths will not even attempt repatching for a while. After we emerge from cool-down - which
481 requires a bunch of slow path calls - we will again wait for ten slow paths to get new
482 cases. Note that it only takes 13 cases to cause the stub to give up on future repatching
483 entirely. Also, most stubs don't ever get to 10 cases. Therefore, for most stubs this change
484 means that each IC will repatch once. If they make it to two repatching, then the likelihood
485 of a third becomes infinitesimal because of all of the rules that come into play at that
486 point (the size limit being 13, the fact that we go into exponential cool-down every time we
487 generate code, and the fact that if we have lots of self cases then we will create a
488 catch-all megamorphic load case).
490 This also undoes a change to the megamorphic optimization that I think was unintentional.
491 As in the change that originally introduced megamorphic loads, we want to do this only if we
492 would otherwise exhaust the max size of the IC. This is because megamorphic loads are pretty
493 expensive and it's best to use them only if we know that the alternative is giving up on
496 This is neutral on JS benchmarks, but looks like it's another speed-up for page loading.
498 * bytecode/PolymorphicAccess.cpp:
499 (JSC::AccessCase::canBeReplacedByMegamorphicLoad):
500 (JSC::AccessCase::canReplace):
501 (JSC::AccessCase::dump):
502 (JSC::PolymorphicAccess::regenerate):
503 * bytecode/StructureStubInfo.cpp:
504 (JSC::StructureStubInfo::StructureStubInfo):
507 2016-04-14 Mark Lam <mark.lam@apple.com>
509 Update treatment of invoking RegExp.prototype methods on RegExp.prototype.
510 https://bugs.webkit.org/show_bug.cgi?id=155922
512 Reviewed by Keith Miller.
514 According to the TC39 committee, when invoking the following RegExp.prototype
515 methods on the RegExp.prototype:
516 1. RegExp.prototype.flags yields ""
517 2. RegExp.prototype.global yields undefined
518 3. RegExp.prototype.ignoreCase yields undefined
519 4. RegExp.prototype.multiline yields undefined
520 5. RegExp.prototype.unicode yields undefined
521 6. RegExp.prototype.source yields "(?:)"
522 7. RegExp.prototype.sticky yields undefined
523 8. RegExp.prototype.toString() yields "/(?:)/"
525 and RegExp.prototype is still NOT an instance of RegExp. The above behavior
526 changes is a special dispensation applicable only to RegExp.prototype. The ES6
527 spec of throwing errors still applies if those methods are applied to anything =
528 else that is not a RegExp object.
530 * runtime/RegExpPrototype.cpp:
531 (JSC::regExpProtoGetterGlobal):
532 (JSC::regExpProtoGetterIgnoreCase):
533 (JSC::regExpProtoGetterMultiline):
534 (JSC::regExpProtoGetterSticky):
535 (JSC::regExpProtoGetterUnicode):
536 (JSC::regExpProtoGetterFlags):
537 (JSC::regExpProtoGetterSource):
538 - Implemented new behavior.
540 * tests/es6/miscellaneous_built-in_prototypes_are_not_instances.js:
542 - Updated to match current kangax test.
544 2016-04-14 Geoffrey Garen <ggaren@apple.com>
546 Some imported ES6 tests are missing __createIterableObject
547 https://bugs.webkit.org/show_bug.cgi?id=156584
549 Reviewed by Keith Miller.
551 These tests were failing because I neglected to include __createIterableObject
552 when I first imported them. Now they pass.
555 * tests/es6/Array_static_methods_Array.from_generic_iterables.js:
557 (iterable.Symbol.iterator):
558 (__createIterableObject):
560 * tests/es6/Array_static_methods_Array.from_instances_of_generic_iterables.js:
562 (iterable.Symbol.iterator):
563 (__createIterableObject):
565 * tests/es6/Array_static_methods_Array.from_iterator_closing.js:
567 (iterable.Symbol.iterator):
568 (__createIterableObject):
569 * tests/es6/Array_static_methods_Array.from_map_function_generic_iterables.js:
571 (iterable.Symbol.iterator):
572 (__createIterableObject):
574 * tests/es6/Array_static_methods_Array.from_map_function_instances_of_iterables.js:
576 (iterable.Symbol.iterator):
577 (__createIterableObject):
579 * tests/es6/Map_iterator_closing.js:
581 (iterable.Symbol.iterator):
582 (__createIterableObject):
583 * tests/es6/Promise_Promise.all_generic_iterables.js:
585 (iterable.Symbol.iterator):
586 (__createIterableObject):
587 (test.asyncTestPassed):
588 * tests/es6/Promise_Promise.race_generic_iterables.js:
590 (iterable.Symbol.iterator):
591 (__createIterableObject):
592 (test.asyncTestPassed):
593 * tests/es6/Set_iterator_closing.js:
595 (iterable.Symbol.iterator):
596 (__createIterableObject):
597 * tests/es6/WeakMap_iterator_closing.js:
599 (iterable.Symbol.iterator):
600 (__createIterableObject):
601 * tests/es6/WeakSet_iterator_closing.js:
603 (iterable.Symbol.iterator):
604 (__createIterableObject):
605 * tests/es6/destructuring_iterator_closing.js:
607 (iterable.Symbol.iterator):
608 (__createIterableObject):
609 * tests/es6/destructuring_with_generic_iterables.js:
611 (iterable.Symbol.iterator):
612 (__createIterableObject):
614 * tests/es6/destructuring_with_instances_of_generic_iterables.js:
616 (iterable.Symbol.iterator):
617 (__createIterableObject):
619 * tests/es6/for..of_loops_iterator_closing_break.js:
621 (iterable.Symbol.iterator):
622 (__createIterableObject):
623 * tests/es6/for..of_loops_iterator_closing_throw.js:
625 (iterable.Symbol.iterator):
626 (__createIterableObject):
627 * tests/es6/for..of_loops_with_generic_iterables.js:
629 (iterable.Symbol.iterator):
630 (__createIterableObject):
632 * tests/es6/for..of_loops_with_instances_of_generic_iterables.js:
634 (iterable.Symbol.iterator):
635 (__createIterableObject):
637 * tests/es6/generators_yield_star_generic_iterables.js:
639 (iterable.Symbol.iterator):
640 (__createIterableObject):
641 * tests/es6/generators_yield_star_iterator_closing_via_throw.js:
643 (iterable.Symbol.iterator):
644 (__createIterableObject):
645 * tests/es6/spread_..._operator_with_generic_iterables_in_arrays.js:
647 (iterable.Symbol.iterator):
648 (__createIterableObject):
650 * tests/es6/spread_..._operator_with_generic_iterables_in_calls.js:
652 (iterable.Symbol.iterator):
653 (__createIterableObject):
655 * tests/es6/spread_..._operator_with_instances_of_iterables_in_arrays.js:
657 (iterable.Symbol.iterator):
658 (__createIterableObject):
660 * tests/es6/spread_..._operator_with_instances_of_iterables_in_calls.js:
662 (iterable.Symbol.iterator):
663 (__createIterableObject):
666 2016-04-13 Alex Christensen <achristensen@webkit.org>
668 CMake MiniBrowser should be an app bundle
669 https://bugs.webkit.org/show_bug.cgi?id=156521
671 Reviewed by Brent Fulgham.
674 Unreviewed build fix. Define __STDC_WANT_LIB_EXT1__ so we can find memset_s.
676 2016-04-13 Joseph Pecoraro <pecoraro@apple.com>
678 JSContext Inspector: Improve Class instances and JSC API Exported Values view in Console / ObjectTree
679 https://bugs.webkit.org/show_bug.cgi?id=156566
680 <rdar://problem/16392365>
682 Reviewed by Timothy Hatcher.
684 * inspector/InjectedScriptSource.js:
685 (InjectedScript.RemoteObject.prototype._appendPropertyPreviews):
686 Treat non-basic object types as not lossless so they can be expanded.
687 Show non-enumerable native getters in Object previews.
689 2016-04-13 Michael Saboff <msaboff@apple.com>
691 Some tests fail with ES6 `u` (Unicode) flag for regular expressions
692 https://bugs.webkit.org/show_bug.cgi?id=151597
694 Reviewed by Geoffrey Garen.
696 Added two new tables to handle the anomolies of \w and \W CharacterClassEscapes
697 when specified in RegExp's with both the unicode and ignoreCase flags. Given the
698 case folding rules described in the standard vie the meta function Canonicalize(),
699 which allow cross ASCII case folding when unicode is specified, the unicode characters
700 \u017f (small sharp s) and \u212a (kelvin symbol) are part of the \w (word) characterClassEscape.
701 This is true because they case fold to 's' and 'k' respectively. Because they case fold
702 to lower case letters, the corresponding letters, 'k', 'K', 's' and 'S', are also matched with
703 \W with the unicode and ignoreCase flags.
705 * create_regex_tables:
706 * yarr/YarrPattern.cpp:
707 (JSC::Yarr::YarrPatternConstructor::atomBuiltInCharacterClass):
708 (JSC::Yarr::YarrPatternConstructor::atomCharacterClassBuiltIn):
709 (JSC::Yarr::YarrPattern::YarrPattern):
710 * yarr/YarrPattern.h:
711 (JSC::Yarr::YarrPattern::wordcharCharacterClass):
712 (JSC::Yarr::YarrPattern::wordUnicodeIgnoreCaseCharCharacterClass):
713 (JSC::Yarr::YarrPattern::nonwordcharCharacterClass):
714 (JSC::Yarr::YarrPattern::nonwordUnicodeIgnoreCaseCharCharacterClass):
716 2016-04-13 Commit Queue <commit-queue@webkit.org>
718 Unreviewed, rolling out r199502 and r199511.
719 https://bugs.webkit.org/show_bug.cgi?id=156557
721 Appears to have in-browser perf regression (Requested by mlam
726 "ES6: Implement String.prototype.split and
727 RegExp.prototype[@@split]."
728 https://bugs.webkit.org/show_bug.cgi?id=156013
729 http://trac.webkit.org/changeset/199502
731 "ES6: Implement RegExp.prototype[@@search]."
732 https://bugs.webkit.org/show_bug.cgi?id=156331
733 http://trac.webkit.org/changeset/199511
735 2016-04-13 Keith Miller <keith_miller@apple.com>
737 isJSArray should use ArrayType rather than the ClassInfo
738 https://bugs.webkit.org/show_bug.cgi?id=156551
740 Reviewed by Filip Pizlo.
742 Using the JSType rather than the ClassInfo should be slightly faster
743 since the type is inline on the cell whereas the ClassInfo is only
749 2016-04-13 Mark Lam <mark.lam@apple.com>
751 ES6: Implement RegExp.prototype[@@search].
752 https://bugs.webkit.org/show_bug.cgi?id=156331
754 Reviewed by Keith Miller.
757 1. Implemented search builtin in RegExpPrototype.js.
758 The native path is now used as a fast path.
759 2. Added DFG support for an IsRegExpObjectIntrinsic (modelled after the
761 3. Renamed @isRegExp to @isRegExpObject to match the new IsRegExpObjectIntrinsic.
762 4. Change the esSpecIsRegExpObject() implementation to check if the object's
763 JSType is RegExpObjectType instead of walking the classinfo chain.
765 * builtins/RegExpPrototype.js:
767 * builtins/StringPrototype.js:
769 - fixed some indentation.
771 * dfg/DFGAbstractInterpreterInlines.h:
772 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
773 * dfg/DFGByteCodeParser.cpp:
774 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
775 * dfg/DFGClobberize.h:
776 (JSC::DFG::clobberize):
779 * dfg/DFGFixupPhase.cpp:
780 (JSC::DFG::FixupPhase::fixupNode):
782 * dfg/DFGPredictionPropagationPhase.cpp:
783 (JSC::DFG::PredictionPropagationPhase::propagate):
784 * dfg/DFGSafeToExecute.h:
785 (JSC::DFG::safeToExecute):
786 * dfg/DFGSpeculativeJIT.cpp:
787 (JSC::DFG::SpeculativeJIT::compileIsArrayConstructor):
788 (JSC::DFG::SpeculativeJIT::compileIsRegExpObject):
789 (JSC::DFG::SpeculativeJIT::compileCallObjectConstructor):
790 * dfg/DFGSpeculativeJIT.h:
791 * dfg/DFGSpeculativeJIT32_64.cpp:
792 (JSC::DFG::SpeculativeJIT::compile):
793 * dfg/DFGSpeculativeJIT64.cpp:
794 (JSC::DFG::SpeculativeJIT::compile):
795 * ftl/FTLCapabilities.cpp:
796 (JSC::FTL::canCompile):
797 * ftl/FTLLowerDFGToB3.cpp:
798 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
799 (JSC::FTL::DFG::LowerDFGToB3::compileIsFunction):
800 (JSC::FTL::DFG::LowerDFGToB3::compileIsRegExpObject):
801 (JSC::FTL::DFG::LowerDFGToB3::compileTypeOf):
802 (JSC::FTL::DFG::LowerDFGToB3::isExoticForTypeof):
803 (JSC::FTL::DFG::LowerDFGToB3::isRegExpObject):
804 (JSC::FTL::DFG::LowerDFGToB3::isType):
805 * runtime/Intrinsic.h:
806 - Added IsRegExpObjectIntrinsic.
808 * runtime/CommonIdentifiers.h:
810 * runtime/ECMAScriptSpecInternalFunctions.cpp:
811 (JSC::esSpecIsConstructor):
812 - Changed to use uncheckedArgument since this is only called from internal code.
813 (JSC::esSpecIsRegExpObject):
814 (JSC::esSpecIsRegExp): Deleted.
815 * runtime/ECMAScriptSpecInternalFunctions.h:
816 - Changed to check the object for a JSType of RegExpObjectType.
818 * runtime/JSGlobalObject.cpp:
819 (JSC::JSGlobalObject::init):
820 - Added split fast path.
822 * runtime/RegExpPrototype.cpp:
823 (JSC::RegExpPrototype::finishCreation):
824 (JSC::regExpProtoFuncSearchFast):
825 (JSC::regExpProtoFuncSearch): Deleted.
826 * runtime/RegExpPrototype.h:
829 * tests/stress/regexp-search.js:
832 2016-04-12 Filip Pizlo <fpizlo@apple.com>
834 PolymorphicAccess::regenerate() shouldn't have to clone non-generated AccessCases
835 https://bugs.webkit.org/show_bug.cgi?id=156493
837 Reviewed by Geoffrey Garen.
839 Cloning AccessCases is only necessary if they hold some artifacts that are used by code that
840 they already generated. So, if the state is not Generated, we don't have to bother with
843 This should speed up PolymorphicAccess regeneration a bit more.
845 * bytecode/PolymorphicAccess.cpp:
846 (JSC::AccessCase::commit):
847 (JSC::PolymorphicAccess::regenerate):
849 2016-04-13 Mark Lam <mark.lam@apple.com>
851 ES6: Implement String.prototype.split and RegExp.prototype[@@split].
852 https://bugs.webkit.org/show_bug.cgi?id=156013
854 Reviewed by Keith Miller.
856 Re-landing r199393 now that the shadow chicken crash has been fixed.
859 * JavaScriptCore.xcodeproj/project.pbxproj:
860 * builtins/GlobalObject.js:
861 (speciesConstructor):
862 * builtins/PromisePrototype.js:
863 - refactored to use the @speciesConstructor internal function.
865 * builtins/RegExpPrototype.js:
866 (advanceStringIndex):
867 - refactored from @advanceStringIndexUnicode() to be match the spec.
868 Benchmarks show that there's no advantage in doing the unicode check outside
869 of the advanceStringIndexUnicode part. So, I simplified the code to match the
870 spec (especially since @@split needs to call advanceStringIndex from more than
873 - Removed an unnecessary call to @Object because it was already proven above.
874 - Changed to use advanceStringIndex instead of advanceStringIndexUnicode.
875 Again, there's no perf regression for this.
877 (hasObservableSideEffectsForRegExpSplit):
879 (advanceStringIndexUnicode): Deleted.
881 * builtins/StringPrototype.js:
883 - Modified to use RegExp.prototype[@@split].
885 * bytecode/BytecodeIntrinsicRegistry.cpp:
886 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
887 (JSC::BytecodeIntrinsicRegistry::lookup):
888 * bytecode/BytecodeIntrinsicRegistry.h:
889 - Added the @@split symbol.
891 * runtime/CommonIdentifiers.h:
892 * runtime/ECMAScriptSpecInternalFunctions.cpp: Added.
893 (JSC::esSpecIsConstructor):
894 (JSC::esSpecIsRegExp):
895 * runtime/ECMAScriptSpecInternalFunctions.h: Added.
897 * runtime/JSGlobalObject.cpp:
898 (JSC::getGetterById):
899 (JSC::JSGlobalObject::init):
901 * runtime/PropertyDescriptor.cpp:
902 (JSC::PropertyDescriptor::setDescriptor):
903 - Removed an assert that is no longer valid.
905 * runtime/RegExpObject.h:
906 - Made advanceStringUnicode() public so that it can be re-used by the regexp split
909 * runtime/RegExpPrototype.cpp:
910 (JSC::RegExpPrototype::finishCreation):
911 (JSC::regExpProtoFuncExec):
912 (JSC::regExpProtoFuncSearch):
913 (JSC::advanceStringIndex):
914 (JSC::regExpProtoFuncSplitFast):
915 * runtime/RegExpPrototype.h:
917 * runtime/StringObject.h:
918 (JSC::jsStringWithReuse):
920 - Hoisted some utility functions from StringPrototype.cpp so that they can be
921 reused by the regexp split fast path.
923 * runtime/StringPrototype.cpp:
924 (JSC::StringPrototype::finishCreation):
925 (JSC::stringProtoFuncSplitFast):
926 (JSC::stringProtoFuncSubstr):
927 (JSC::builtinStringSubstrInternal):
928 (JSC::stringProtoFuncSubstring):
929 (JSC::stringIncludesImpl):
930 (JSC::stringProtoFuncIncludes):
931 (JSC::builtinStringIncludesInternal):
932 (JSC::jsStringWithReuse): Deleted.
933 (JSC::jsSubstring): Deleted.
934 (JSC::stringProtoFuncSplit): Deleted.
935 * runtime/StringPrototype.h:
939 2016-04-13 Mark Lam <mark.lam@apple.com>
941 ShadowChicken::visitChildren() should not visit tailMarkers and throwMarkers.
942 https://bugs.webkit.org/show_bug.cgi?id=156532
944 Reviewed by Saam Barati and Filip Pizlo.
946 ShadowChicken can store tailMarkers and throwMarkers in its log, specifically in
947 the callee field of a log packet. However, ShadowChicken::visitChildren()
948 unconditionally visits the callee field of each packet as if they are real
949 objects. If visitChildren() encounters one of these markers in the log, we get a
952 This crash was observed in the v8-v6/v8-regexp.js stress test running with shadow
953 chicken when r199393 landed. r199393 introduced tail calls to a RegExp split
954 fast path, and the v8-regexp.js test exercised this fast path a lot. Throw in
955 some timely GCs, and we get a crash party.
957 The fix is to have ShadowChicken::visitChildren() filter out the tailMarker and
960 Alternatively, if perf is an issue, we can allocate 2 dedicated objects for
961 these markers so that ShadowChicken can continue to visit them. For now, I'm
962 going with the filter.
964 * interpreter/ShadowChicken.cpp:
965 (JSC::ShadowChicken::visitChildren):
967 2016-04-13 Yusuke Suzuki <utatane.tea@gmail.com>
969 [ES6] Add @@toStringTag to GeneratorFunction
970 https://bugs.webkit.org/show_bug.cgi?id=156499
972 Reviewed by Mark Lam.
974 GeneratorFunction.prototype has @@toStringTag property, "GeneratorFunction".
975 https://tc39.github.io/ecma262/#sec-generatorfunction.prototype-@@tostringtag
977 * runtime/GeneratorFunctionPrototype.cpp:
978 (JSC::GeneratorFunctionPrototype::finishCreation):
980 * tests/es6/well-known_symbols_Symbol.toStringTag_new_built-ins.js: Added.
983 2016-04-13 Alberto Garcia <berto@igalia.com>
985 Fix build in glibc-based BSD systems
986 https://bugs.webkit.org/show_bug.cgi?id=156533
988 Reviewed by Carlos Garcia Campos.
990 Change the order of the #elif conditionals so glibc-based BSD
991 systems (e.g. Debian GNU/kFreeBSD) use the code inside the
994 * heap/MachineStackMarker.cpp:
995 (JSC::MachineThreads::Thread::Registers::stackPointer):
996 (JSC::MachineThreads::Thread::Registers::framePointer):
997 (JSC::MachineThreads::Thread::Registers::instructionPointer):
998 (JSC::MachineThreads::Thread::Registers::llintPC):
1000 2016-04-12 Keith Miller <keith_miller@apple.com>
1002 Unreviewed undo change from ArrayClass to ArrayWithUndecided, which
1003 was not intedend to land with r199397.
1005 * runtime/ArrayPrototype.h:
1006 (JSC::ArrayPrototype::createStructure):
1008 2016-04-12 Mark Lam <mark.lam@apple.com>
1010 Rollout: ES6: Implement String.prototype.split and RegExp.prototype[@@split].
1011 https://bugs.webkit.org/show_bug.cgi?id=156013
1013 Speculative rollout to fix 32-bit shadow-chicken.yaml/tests/v8-v6/v8-regexp.js.shadow-chicken test failure.
1018 * JavaScriptCore.xcodeproj/project.pbxproj:
1019 * builtins/GlobalObject.js:
1021 (speciesConstructor): Deleted.
1022 * builtins/PromisePrototype.js:
1023 * builtins/RegExpPrototype.js:
1024 (advanceStringIndexUnicode):
1026 (advanceStringIndex): Deleted.
1027 (regExpExec): Deleted.
1028 (hasObservableSideEffectsForRegExpSplit): Deleted.
1030 * builtins/StringPrototype.js:
1033 * bytecode/BytecodeIntrinsicRegistry.cpp:
1034 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
1035 (JSC::BytecodeIntrinsicRegistry::lookup):
1036 * bytecode/BytecodeIntrinsicRegistry.h:
1037 * runtime/CommonIdentifiers.h:
1038 * runtime/ECMAScriptSpecInternalFunctions.cpp: Removed.
1039 * runtime/ECMAScriptSpecInternalFunctions.h: Removed.
1040 * runtime/JSGlobalObject.cpp:
1041 (JSC::JSGlobalObject::setGlobalThis):
1042 (JSC::JSGlobalObject::init):
1043 (JSC::getGetterById): Deleted.
1044 * runtime/PropertyDescriptor.cpp:
1045 (JSC::PropertyDescriptor::setDescriptor):
1046 * runtime/RegExpObject.h:
1047 (JSC::RegExpObject::offsetOfLastIndexIsWritable):
1048 * runtime/RegExpPrototype.cpp:
1049 (JSC::RegExpPrototype::finishCreation):
1050 (JSC::regExpProtoFuncExec):
1051 (JSC::regExpProtoFuncSearch):
1052 (JSC::advanceStringIndex): Deleted.
1053 (JSC::regExpProtoFuncSplitFast): Deleted.
1054 * runtime/RegExpPrototype.h:
1055 * runtime/StringObject.h:
1056 (JSC::jsStringWithReuse): Deleted.
1057 (JSC::jsSubstring): Deleted.
1058 * runtime/StringPrototype.cpp:
1059 (JSC::StringPrototype::finishCreation):
1060 (JSC::jsStringWithReuse):
1062 (JSC::substituteBackreferencesSlow):
1063 (JSC::splitStringByOneCharacterImpl):
1064 (JSC::stringProtoFuncSplit):
1065 (JSC::stringProtoFuncSubstr):
1066 (JSC::stringProtoFuncSubstring):
1067 (JSC::stringProtoFuncEndsWith):
1068 (JSC::stringProtoFuncIncludes):
1069 (JSC::stringProtoFuncIterator):
1070 (JSC::stringProtoFuncSplitFast): Deleted.
1071 (JSC::builtinStringSubstrInternal): Deleted.
1072 (JSC::stringIncludesImpl): Deleted.
1073 (JSC::builtinStringIncludesInternal): Deleted.
1074 * runtime/StringPrototype.h:
1077 2016-04-12 Mark Lam <mark.lam@apple.com>
1079 Remove 2 unused JSC options.
1080 https://bugs.webkit.org/show_bug.cgi?id=156526
1082 Reviewed by Benjamin Poulain.
1084 The options JSC_assertICSizing and JSC_dumpFailedICSizing are no longer in use
1085 now that we have B3.
1087 * runtime/Options.h:
1089 2016-04-12 Keith Miller <keith_miller@apple.com>
1091 [ES6] Add support for Symbol.isConcatSpreadable.
1092 https://bugs.webkit.org/show_bug.cgi?id=155351
1094 Reviewed by Saam Barati.
1096 This patch adds support for Symbol.isConcatSpreadable. In order to do so it was necessary to move the
1097 Array.prototype.concat function to JS. A number of different optimizations were needed to make such the move to
1098 a builtin performant. First, four new DFG intrinsics were added.
1100 1) IsArrayObject (I would have called it IsArray but we use the same name for an IndexingType): an intrinsic of
1101 the Array.isArray function.
1102 2) IsJSArray: checks the first child is a JSArray object.
1103 3) IsArrayConstructor: checks the first child is an instance of ArrayConstructor.
1104 4) CallObjectConstructor: an intrinsic of the Object constructor.
1106 IsActualObject, IsJSArray, and CallObjectConstructor can all be converted into constants in the abstract interpreter if
1107 we are able to prove that the first child is an Array or for ToObject an Object.
1109 In order to further improve the perfomance we also now cover more indexing types in our fast path memcpy
1110 code. Before we would only memcpy Arrays if they had the same indexing type and did not have Array storage and
1111 were not undecided. Now the memcpy code covers the following additional two cases: One array is undecided and
1112 the other is a non-array storage and the case where one array is Int32 and the other is contiguous (we map this
1113 into a contiguous array).
1115 This patch also adds a new fast path for concat with more than one array argument by using memcpy to append
1116 values onto the result array. This works roughly the same as the two array fast path using the same methodology
1117 to decide if we can memcpy the other butterfly into the result butterfly.
1119 Two new debugging tools are also added to the jsc cli. One is a version of the print function with a private
1120 name so it can be used for debugging builtins. The other is dumpDataLog, which takes a JSValue and runs our
1121 dataLog function on it.
1123 Finally, this patch add a new constructor to JSValueRegsTemporary that allows it to reuse the the registers of a
1124 JSValueOperand if the operand's use count is one.
1126 * JavaScriptCore.xcodeproj/project.pbxproj:
1127 * builtins/ArrayPrototype.js:
1130 * bytecode/BytecodeIntrinsicRegistry.cpp:
1131 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
1132 * bytecode/BytecodeIntrinsicRegistry.h:
1133 * dfg/DFGAbstractInterpreterInlines.h:
1134 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1135 * dfg/DFGByteCodeParser.cpp:
1136 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
1137 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
1138 * dfg/DFGClobberize.h:
1139 (JSC::DFG::clobberize):
1140 * dfg/DFGDoesGC.cpp:
1142 * dfg/DFGFixupPhase.cpp:
1143 (JSC::DFG::FixupPhase::fixupNode):
1144 * dfg/DFGNodeType.h:
1145 * dfg/DFGOperations.cpp:
1146 * dfg/DFGOperations.h:
1147 * dfg/DFGPredictionPropagationPhase.cpp:
1148 (JSC::DFG::PredictionPropagationPhase::propagate):
1149 * dfg/DFGSafeToExecute.h:
1150 (JSC::DFG::safeToExecute):
1151 * dfg/DFGSpeculativeJIT.cpp:
1152 (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
1153 (JSC::DFG::SpeculativeJIT::compileIsJSArray):
1154 (JSC::DFG::SpeculativeJIT::compileIsArrayObject):
1155 (JSC::DFG::SpeculativeJIT::compileIsArrayConstructor):
1156 (JSC::DFG::SpeculativeJIT::compileCallObjectConstructor):
1157 * dfg/DFGSpeculativeJIT.h:
1158 (JSC::DFG::SpeculativeJIT::callOperation):
1159 * dfg/DFGSpeculativeJIT32_64.cpp:
1160 (JSC::DFG::SpeculativeJIT::compile):
1161 * dfg/DFGSpeculativeJIT64.cpp:
1162 (JSC::DFG::SpeculativeJIT::compile):
1163 * ftl/FTLCapabilities.cpp:
1164 (JSC::FTL::canCompile):
1165 * ftl/FTLLowerDFGToB3.cpp:
1166 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1167 (JSC::FTL::DFG::LowerDFGToB3::compileCallObjectConstructor):
1168 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayObject):
1169 (JSC::FTL::DFG::LowerDFGToB3::compileIsJSArray):
1170 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayConstructor):
1171 (JSC::FTL::DFG::LowerDFGToB3::isArray):
1172 * jit/JITOperations.h:
1174 (GlobalObject::finishCreation):
1175 (functionDataLogValue):
1176 * runtime/ArrayConstructor.cpp:
1177 (JSC::ArrayConstructor::finishCreation):
1178 (JSC::arrayConstructorPrivateFuncIsArrayConstructor):
1179 * runtime/ArrayConstructor.h:
1180 (JSC::isArrayConstructor):
1181 * runtime/ArrayPrototype.cpp:
1182 (JSC::ArrayPrototype::finishCreation):
1183 (JSC::arrayProtoPrivateFuncIsJSArray):
1184 (JSC::moveElements):
1185 (JSC::arrayProtoPrivateFuncConcatMemcpy):
1186 (JSC::arrayProtoPrivateFuncAppendMemcpy):
1187 (JSC::arrayProtoFuncConcat): Deleted.
1188 * runtime/ArrayPrototype.h:
1189 (JSC::ArrayPrototype::createStructure):
1190 * runtime/CommonIdentifiers.h:
1191 * runtime/Intrinsic.h:
1192 * runtime/JSArray.cpp:
1193 (JSC::JSArray::appendMemcpy):
1194 (JSC::JSArray::fastConcatWith): Deleted.
1195 * runtime/JSArray.h:
1196 (JSC::JSArray::createStructure):
1197 (JSC::JSArray::fastConcatType): Deleted.
1198 * runtime/JSArrayInlines.h: Added.
1199 (JSC::JSArray::memCopyWithIndexingType):
1200 (JSC::JSArray::canFastCopy):
1201 * runtime/JSGlobalObject.cpp:
1202 (JSC::JSGlobalObject::init):
1204 * runtime/ObjectConstructor.h:
1205 (JSC::constructObject):
1207 * tests/stress/array-concat-spread-object.js: Added.
1209 * tests/stress/array-concat-spread-proxy-exception-check.js: Added.
1211 * tests/stress/array-concat-spread-proxy.js: Added.
1213 * tests/stress/array-concat-with-slow-indexingtypes.js: Added.
1215 * tests/stress/array-species-config-array-constructor.js:
1217 2016-04-12 Saam barati <sbarati@apple.com>
1219 Lets not iterate over the constant pool twice every time we link a code block
1220 https://bugs.webkit.org/show_bug.cgi?id=156517
1222 Reviewed by Mark Lam.
1224 I introduced a second iteration over the constant pool when I implemented
1225 block scoping. I did this because we must clone all the symbol tables when
1226 we link a CodeBlock. We can just do this cloning when setting the constant
1227 registers for the first time. There is no need to iterate over the constant
1230 * bytecode/CodeBlock.cpp:
1231 (JSC::CodeBlock::finishCreation):
1232 (JSC::CodeBlock::~CodeBlock):
1233 (JSC::CodeBlock::setConstantRegisters):
1234 (JSC::CodeBlock::setAlternative):
1235 * bytecode/CodeBlock.h:
1236 (JSC::CodeBlock::replaceConstant):
1237 (JSC::CodeBlock::setConstantRegisters): Deleted.
1239 2016-04-12 Mark Lam <mark.lam@apple.com>
1241 ES6: Implement String.prototype.split and RegExp.prototype[@@split].
1242 https://bugs.webkit.org/show_bug.cgi?id=156013
1244 Reviewed by Keith Miller.
1247 * JavaScriptCore.xcodeproj/project.pbxproj:
1248 * builtins/GlobalObject.js:
1249 (speciesConstructor):
1250 * builtins/PromisePrototype.js:
1251 - refactored to use the @speciesConstructor internal function.
1253 * builtins/RegExpPrototype.js:
1254 (advanceStringIndex):
1255 - refactored from @advanceStringIndexUnicode() to be match the spec.
1256 Benchmarks show that there's no advantage in doing the unicode check outside
1257 of the advanceStringIndexUnicode part. So, I simplified the code to match the
1258 spec (especially since @@split needs to call advanceStringIndex from more than
1261 - Removed an unnecessary call to @Object because it was already proven above.
1262 - Changed to use advanceStringIndex instead of advanceStringIndexUnicode.
1263 Again, there's no perf regression for this.
1265 (hasObservableSideEffectsForRegExpSplit):
1267 (advanceStringIndexUnicode): Deleted.
1269 * builtins/StringPrototype.js:
1271 - Modified to use RegExp.prototype[@@split].
1273 * bytecode/BytecodeIntrinsicRegistry.cpp:
1274 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
1275 (JSC::BytecodeIntrinsicRegistry::lookup):
1276 * bytecode/BytecodeIntrinsicRegistry.h:
1277 - Added the @@split symbol.
1279 * runtime/CommonIdentifiers.h:
1280 * runtime/ECMAScriptSpecInternalFunctions.cpp: Added.
1281 (JSC::esSpecIsConstructor):
1282 (JSC::esSpecIsRegExp):
1283 * runtime/ECMAScriptSpecInternalFunctions.h: Added.
1285 * runtime/JSGlobalObject.cpp:
1286 (JSC::getGetterById):
1287 (JSC::JSGlobalObject::init):
1289 * runtime/PropertyDescriptor.cpp:
1290 (JSC::PropertyDescriptor::setDescriptor):
1291 - Removed an assert that is no longer valid.
1293 * runtime/RegExpObject.h:
1294 - Made advanceStringUnicode() public so that it can be re-used by the regexp split
1297 * runtime/RegExpPrototype.cpp:
1298 (JSC::RegExpPrototype::finishCreation):
1299 (JSC::regExpProtoFuncExec):
1300 (JSC::regExpProtoFuncSearch):
1301 (JSC::advanceStringIndex):
1302 (JSC::regExpProtoFuncSplitFast):
1303 * runtime/RegExpPrototype.h:
1305 * runtime/StringObject.h:
1306 (JSC::jsStringWithReuse):
1308 - Hoisted some utility functions from StringPrototype.cpp so that they can be
1309 reused by the regexp split fast path.
1311 * runtime/StringPrototype.cpp:
1312 (JSC::StringPrototype::finishCreation):
1313 (JSC::stringProtoFuncSplitFast):
1314 (JSC::stringProtoFuncSubstr):
1315 (JSC::builtinStringSubstrInternal):
1316 (JSC::stringProtoFuncSubstring):
1317 (JSC::stringIncludesImpl):
1318 (JSC::stringProtoFuncIncludes):
1319 (JSC::builtinStringIncludesInternal):
1320 (JSC::jsStringWithReuse): Deleted.
1321 (JSC::jsSubstring): Deleted.
1322 (JSC::stringProtoFuncSplit): Deleted.
1323 * runtime/StringPrototype.h:
1327 2016-04-12 Keith Miller <keith_miller@apple.com>
1329 AbstractValue should use the result type to filter structures
1330 https://bugs.webkit.org/show_bug.cgi?id=156516
1332 Reviewed by Geoffrey Garen.
1334 When filtering an AbstractValue with a SpeculatedType we would not use the merged type when
1335 filtering out the valid structures (despite what the comment directly above said). This
1336 would cause us to crash if our structure-set was Top and the two speculated types were
1337 different kinds of cells.
1339 * dfg/DFGAbstractValue.cpp:
1340 (JSC::DFG::AbstractValue::filter):
1341 * tests/stress/ai-consistency-filter-cells.js: Added.
1343 (attribute.value.get record):
1344 (attribute.attrs.get this):
1346 (let.thisValue.return.serialize):
1347 (let.thisValue.transformFor):
1349 2016-04-12 Filip Pizlo <fpizlo@apple.com>
1351 Unreviewed, remove FIXME for https://bugs.webkit.org/show_bug.cgi?id=156457 and replace it
1352 with a comment that describes what we do now.
1354 * bytecode/PolymorphicAccess.h:
1356 2016-04-12 Saam barati <sbarati@apple.com>
1358 isLocked() assertion broke builds because ConcurrentJITLock isn't always a real lock.
1360 Rubber-stamped by Filip Pizlo.
1362 * bytecode/CodeBlock.cpp:
1363 (JSC::CodeBlock::resultProfileForBytecodeOffset):
1364 (JSC::CodeBlock::ensureResultProfile):
1366 2016-04-11 Filip Pizlo <fpizlo@apple.com>
1368 PolymorphicAccess should buffer AccessCases before regenerating
1369 https://bugs.webkit.org/show_bug.cgi?id=156457
1371 Reviewed by Benjamin Poulain.
1373 Prior to this change, whenever we added an AccessCase to a PolymorphicAccess, we would
1374 regenerate the whole stub. That meant that we'd do O(N^2) work for N access cases.
1376 One way to fix this is to have each AccessCase generate a stub just for itself, which
1377 cascades down to the already-generated cases. But that removes the binary switch
1378 optimization, which makes the IC perform great even when there are many cases.
1380 This change fixes the issue by buffering access cases. When we take slow path and try to add
1381 a new case, the StructureStubInfo will usually just buffer the new case without generating
1382 new code. We simply guarantee that after we buffer a case, we will take at most
1383 Options::repatchBufferingCountdown() slow path calls before generating code for it. That
1384 option is currently 7. Taking 7 more slow paths means that we have 7 more opportunities to
1385 gather more access cases, or to realize that this IC is too crazy to bother with.
1387 This change ensures that the DFG still gets the same kind of profiling. This is because the
1388 buffered AccessCases are still part of PolymorphicAccess and so are still scanned by
1389 GetByIdStatus and PutByIdStatus. The fact that the AccessCases hadn't been generated and so
1390 hadn't executed doesn't change much. Mainly, it increases the likelihood that the DFG will
1391 see an access case that !couldStillSucceed(). The DFG's existing profile parsing logic can
1392 handle this just fine.
1394 There are a bunch of algorithmic changes here. StructureStubInfo now caches the set of
1395 structures that it has seen as a guard to prevent adding lots of redundant cases, in case
1396 we see the same 7 cases after buffering the first one. This cache means we won't wastefully
1397 allocate 7 identical AccessCase instances. PolymorphicAccess is now restructured around
1398 having separate addCase() and regenerate() calls. That means a bit more moving data around.
1399 So far that seems OK for performance, probably since it's O(N) work rather than O(N^2) work.
1400 There is room for improvement for future patches, to be sure.
1402 This is benchmarking as slightly positive or neutral on JS benchmarks. It's meant to reduce
1403 pathologies I saw in page loads.
1405 * bytecode/GetByIdStatus.cpp:
1406 (JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback):
1407 * bytecode/PolymorphicAccess.cpp:
1408 (JSC::PolymorphicAccess::PolymorphicAccess):
1409 (JSC::PolymorphicAccess::~PolymorphicAccess):
1410 (JSC::PolymorphicAccess::addCases):
1411 (JSC::PolymorphicAccess::addCase):
1412 (JSC::PolymorphicAccess::visitWeak):
1413 (JSC::PolymorphicAccess::dump):
1414 (JSC::PolymorphicAccess::commit):
1415 (JSC::PolymorphicAccess::regenerate):
1416 (JSC::PolymorphicAccess::aboutToDie):
1417 (WTF::printInternal):
1418 (JSC::PolymorphicAccess::regenerateWithCases): Deleted.
1419 (JSC::PolymorphicAccess::regenerateWithCase): Deleted.
1420 * bytecode/PolymorphicAccess.h:
1421 (JSC::AccessCase::isGetter):
1422 (JSC::AccessCase::callLinkInfo):
1423 (JSC::AccessGenerationResult::AccessGenerationResult):
1424 (JSC::AccessGenerationResult::madeNoChanges):
1425 (JSC::AccessGenerationResult::gaveUp):
1426 (JSC::AccessGenerationResult::buffered):
1427 (JSC::AccessGenerationResult::generatedNewCode):
1428 (JSC::AccessGenerationResult::generatedFinalCode):
1429 (JSC::AccessGenerationResult::shouldGiveUpNow):
1430 (JSC::AccessGenerationResult::generatedSomeCode):
1431 (JSC::PolymorphicAccess::isEmpty):
1432 (JSC::PolymorphicAccess::size):
1433 (JSC::PolymorphicAccess::at):
1434 * bytecode/PutByIdStatus.cpp:
1435 (JSC::PutByIdStatus::computeForStubInfo):
1436 * bytecode/StructureStubInfo.cpp:
1437 (JSC::StructureStubInfo::StructureStubInfo):
1438 (JSC::StructureStubInfo::addAccessCase):
1439 (JSC::StructureStubInfo::reset):
1440 (JSC::StructureStubInfo::visitWeakReferences):
1441 * bytecode/StructureStubInfo.h:
1442 (JSC::StructureStubInfo::considerCaching):
1443 (JSC::StructureStubInfo::willRepatch): Deleted.
1444 (JSC::StructureStubInfo::willCoolDown): Deleted.
1445 * jit/JITOperations.cpp:
1447 (JSC::tryCacheGetByID):
1448 (JSC::repatchGetByID):
1449 (JSC::tryCachePutByID):
1450 (JSC::repatchPutByID):
1451 (JSC::tryRepatchIn):
1453 * runtime/JSCJSValue.h:
1454 * runtime/JSCJSValueInlines.h:
1455 (JSC::JSValue::putByIndex):
1456 (JSC::JSValue::structureOrNull):
1457 (JSC::JSValue::structureOrUndefined):
1458 * runtime/Options.h:
1460 2016-04-12 Saam barati <sbarati@apple.com>
1462 There is a race with the compiler thread and the main thread with result profiles
1463 https://bugs.webkit.org/show_bug.cgi?id=156503
1465 Reviewed by Filip Pizlo.
1467 The compiler thread should not be asking for a result
1468 profile while the execution thread is creating one.
1469 We must guard against such races with a lock.
1471 * bytecode/CodeBlock.cpp:
1472 (JSC::CodeBlock::resultProfileForBytecodeOffset):
1473 (JSC::CodeBlock::ensureResultProfile):
1474 (JSC::CodeBlock::capabilityLevel):
1475 * bytecode/CodeBlock.h:
1476 (JSC::CodeBlock::couldTakeSlowCase):
1477 (JSC::CodeBlock::numberOfResultProfiles):
1478 (JSC::CodeBlock::specialFastCaseProfileCountForBytecodeOffset):
1479 (JSC::CodeBlock::ensureResultProfile): Deleted.
1481 2016-04-12 Commit Queue <commit-queue@webkit.org>
1483 Unreviewed, rolling out r199339.
1484 https://bugs.webkit.org/show_bug.cgi?id=156505
1486 memset_s is indeed necessary (Requested by alexchristensen_ on
1491 "Build fix after r199299."
1492 https://bugs.webkit.org/show_bug.cgi?id=155508
1493 http://trac.webkit.org/changeset/199339
1495 2016-04-12 Guillaume Emont <guijemont@igalia.com>
1497 MIPS: add MacroAssemblerMIPS::store8(TrustedImm32,ImplicitAddress)
1498 https://bugs.webkit.org/show_bug.cgi?id=156481
1500 This method with this signature is used by r199075, and therefore
1501 WebKit doesn't build on MIPS since then.
1503 Reviewed by Mark Lam.
1505 * assembler/MacroAssemblerMIPS.h:
1506 (JSC::MacroAssemblerMIPS::store8):
1508 2016-04-12 Saam barati <sbarati@apple.com>
1510 We incorrectly parse arrow function expressions
1511 https://bugs.webkit.org/show_bug.cgi?id=156373
1513 Reviewed by Mark Lam.
1515 This patch removes the notion of "isEndOfArrowFunction".
1516 This was a very weird function and it was incorrect.
1517 It checked that the arrow functions with concise body
1518 grammar production "had a valid ending". "had a valid
1519 ending" is in quotes because concise body arrow functions
1520 have a valid ending as long as their body has a valid
1521 assignment expression. I've removed all notion of this
1522 function because it was wrong and was causing us
1523 to throw syntax errors on valid programs.
1526 (JSC::Lexer<T>::nextTokenIsColon):
1527 (JSC::Lexer<T>::lex):
1528 (JSC::Lexer<T>::setTokenPosition): Deleted.
1530 (JSC::Lexer::setIsReparsingFunction):
1531 (JSC::Lexer::isReparsingFunction):
1532 (JSC::Lexer::lineNumber):
1533 * parser/Parser.cpp:
1534 (JSC::Parser<LexerType>::parseInner):
1535 (JSC::Parser<LexerType>::parseArrowFunctionSingleExpressionBodySourceElements):
1536 (JSC::Parser<LexerType>::parseFunctionInfo):
1538 (JSC::Parser::matchIdentifierOrKeyword):
1539 (JSC::Parser::tokenStart):
1540 (JSC::Parser::autoSemiColon):
1541 (JSC::Parser::canRecurse):
1542 (JSC::Parser::isEndOfArrowFunction): Deleted.
1543 (JSC::Parser::setEndOfStatement): Deleted.
1544 * tests/stress/arrowfunction-others.js:
1546 (simpleArrowFunction):
1550 2016-04-12 Yusuke Suzuki <utatane.tea@gmail.com>
1552 [JSC] addStaticGlobals should emit SymbolTableEntry watchpoints to encourage constant folding in DFG
1553 https://bugs.webkit.org/show_bug.cgi?id=155110
1555 Reviewed by Saam Barati.
1557 `addStaticGlobals` does not emit SymbolTableEntry watchpoints for the added entries.
1558 So, all the global variable lookups pointing to these static globals are not converted
1559 into constants in DFGBytecodeGenerator: this fact leaves these lookups as GetGlobalVar.
1560 Such thing avoids constant folding chance and emits CheckCell for @privateFunction inlining.
1561 This operation is pure overhead.
1563 Static globals are not configurable, and they are typically non-writable.
1564 So they are constants in almost all the cases.
1566 This patch initializes watchpoints for these static globals.
1567 These watchpoints allow DFG to convert these nodes into constants in DFG BytecodeParser.
1568 These watchpoints includes many builtin operations and `undefined`.
1570 The microbenchmark, many-foreach-calls shows 5 - 7% improvement since it removes unnecessary CheckCell.
1572 * bytecode/VariableWriteFireDetail.h:
1573 * runtime/JSGlobalObject.cpp:
1574 (JSC::JSGlobalObject::addGlobalVar):
1575 (JSC::JSGlobalObject::addStaticGlobals):
1576 * runtime/JSSymbolTableObject.h:
1577 (JSC::symbolTablePutTouchWatchpointSet):
1578 (JSC::symbolTablePutInvalidateWatchpointSet):
1579 (JSC::symbolTablePut):
1580 (JSC::symbolTablePutWithAttributesTouchWatchpointSet): Deleted.
1581 * runtime/SymbolTable.h:
1582 (JSC::SymbolTableEntry::SymbolTableEntry):
1583 (JSC::SymbolTableEntry::operator=):
1584 (JSC::SymbolTableEntry::swap):
1586 2016-04-12 Alex Christensen <achristensen@webkit.org>
1588 Build fix after r199299.
1589 https://bugs.webkit.org/show_bug.cgi?id=155508
1591 * jit/ExecutableAllocatorFixedVMPool.cpp:
1592 (JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps):
1593 memset_s is not defined. __STDC_WANT_LIB_EXT1__ is not defined anywhere.
1594 Since the return value is unused and set_constraint_handler_s is never called
1595 I'm chaning it to memset.
1597 2016-04-11 Benjamin Poulain <bpoulain@apple.com>
1599 [JSC] B3 can use undefined bits or not defined required bits when spilling
1600 https://bugs.webkit.org/show_bug.cgi?id=156486
1602 Reviewed by Filip Pizlo.
1604 Spilling had issues when replacing arguments in place.
1607 1) If we have a 32bit stackslot, a x86 instruction could still try to load 64bits from it.
1608 2) If we have a 64bit stackslot, Move32 would only set half the bits.
1609 3) We were reducing Move to Move32 even if the top bits are read from the stack slot.
1611 The case 1 appear with something like this:
1613 Op64 %tmp1, %tmp2, %tmp3
1614 When we spill %tmp1, the stack slot is 32bit, Move32 sets 32bits
1615 but Op64 supports addressing for %tmp1. When we substitute %tmp1 in Op64,
1616 we are creating a 64bit read for a 32bit stack slot.
1618 The case 2 is an other common one. If we have:
1628 We have a stack slot of 64bits. When spilling %tmp1 in #1, we are
1629 effectively doing a 32bit store on the stack slot, leaving the top bits undefined.
1631 Case 3 is pretty much the same as 2 but we create the Move32 ourself
1632 because the source is a 32bit with ZDef.
1634 Case (1) is solved by requiring that the stack slot is at least as large as the largest
1635 use/def of that tmp.
1637 Case (2) and (3) are solved by not replacing a Tmp by an Address if the Def
1638 is smaller than the stack slot.
1640 * b3/air/AirIteratedRegisterCoalescing.cpp:
1642 (JSC::B3::testSpillDefSmallerThanUse):
1643 (JSC::B3::testSpillUseLargerThanDef):
1646 2016-04-11 Brian Burg <bburg@apple.com>
1648 Web Inspector: get rid of InspectorBasicValue and InspectorString subclasses
1649 https://bugs.webkit.org/show_bug.cgi?id=156407
1650 <rdar://problem/25627659>
1652 Reviewed by Joseph Pecoraro.
1654 There's no point having these subclasses as they don't save any space.
1655 Add a StringImpl to the union and merge some implementations of writeJSON.
1657 Rename m_data to m_map and explicitly name the union as InspectorValue::m_value.
1658 If the value is a string and the string is not empty or null (i.e., it has a
1659 StringImpl), then we need to ref() and deref() the string as the InspectorValue
1660 is created or destroyed.
1662 Move uses of the subclass to InspectorValue and delete redundant methods.
1663 Now, most InspectorValue methods are non-virtual so they can be templated.
1665 * bindings/ScriptValue.cpp:
1666 (Deprecated::jsToInspectorValue):
1667 * inspector/InjectedScriptBase.cpp:
1668 (Inspector::InjectedScriptBase::makeCall):
1669 Don't used deleted subclasses.
1671 * inspector/InspectorValues.cpp:
1672 (Inspector::InspectorValue::null):
1673 (Inspector::InspectorValue::create):
1674 (Inspector::InspectorValue::asValue):
1675 (Inspector::InspectorValue::asBoolean):
1676 (Inspector::InspectorValue::asDouble):
1677 (Inspector::InspectorValue::asInteger):
1678 (Inspector::InspectorValue::asString):
1679 These only need one implementation now.
1681 (Inspector::InspectorValue::writeJSON):
1682 Still a virtual method since Object and Array need their members.
1684 (Inspector::InspectorObjectBase::InspectorObjectBase):
1685 (Inspector::InspectorBasicValue::asBoolean): Deleted.
1686 (Inspector::InspectorBasicValue::asDouble): Deleted.
1687 (Inspector::InspectorBasicValue::asInteger): Deleted.
1688 (Inspector::InspectorBasicValue::writeJSON): Deleted.
1689 (Inspector::InspectorString::asString): Deleted.
1690 (Inspector::InspectorString::writeJSON): Deleted.
1691 (Inspector::InspectorString::create): Deleted.
1692 (Inspector::InspectorBasicValue::create): Deleted.
1694 * inspector/InspectorValues.h:
1695 (Inspector::InspectorObjectBase::find):
1696 (Inspector::InspectorObjectBase::setBoolean):
1697 (Inspector::InspectorObjectBase::setInteger):
1698 (Inspector::InspectorObjectBase::setDouble):
1699 (Inspector::InspectorObjectBase::setString):
1700 (Inspector::InspectorObjectBase::setValue):
1701 (Inspector::InspectorObjectBase::setObject):
1702 (Inspector::InspectorObjectBase::setArray):
1703 (Inspector::InspectorArrayBase::pushBoolean):
1704 (Inspector::InspectorArrayBase::pushInteger):
1705 (Inspector::InspectorArrayBase::pushDouble):
1706 (Inspector::InspectorArrayBase::pushString):
1707 (Inspector::InspectorArrayBase::pushValue):
1708 (Inspector::InspectorArrayBase::pushObject):
1709 (Inspector::InspectorArrayBase::pushArray):
1710 Use new factory methods.
1712 * replay/EncodedValue.cpp:
1713 (JSC::ScalarEncodingTraits<bool>::encodeValue):
1714 (JSC::ScalarEncodingTraits<double>::encodeValue):
1715 (JSC::ScalarEncodingTraits<float>::encodeValue):
1716 (JSC::ScalarEncodingTraits<int32_t>::encodeValue):
1717 (JSC::ScalarEncodingTraits<int64_t>::encodeValue):
1718 (JSC::ScalarEncodingTraits<uint32_t>::encodeValue):
1719 (JSC::ScalarEncodingTraits<uint64_t>::encodeValue):
1720 * replay/EncodedValue.h:
1721 Use new factory methods.
1723 2016-04-11 Filip Pizlo <fpizlo@apple.com>
1725 It should be possible to edit StructureStubInfo without recompiling the world
1726 https://bugs.webkit.org/show_bug.cgi?id=156470
1728 Reviewed by Keith Miller.
1730 This change makes it less painful to make changes to the IC code. It used to be that any
1731 change to StructureStubInfo caused every JIT-related file to get recompiled. Now only a
1732 smaller set of files - ones that actually peek into StructureStubInfo - will recompile. This
1733 is mainly because CodeBlock.h no longer includes StructureStubInfo.h.
1735 * bytecode/ByValInfo.h:
1736 * bytecode/CodeBlock.cpp:
1737 * bytecode/CodeBlock.h:
1738 * bytecode/GetByIdStatus.cpp:
1739 * bytecode/GetByIdStatus.h:
1740 * bytecode/PutByIdStatus.cpp:
1741 * bytecode/PutByIdStatus.h:
1742 * bytecode/StructureStubInfo.h:
1743 (JSC::getStructureStubInfoCodeOrigin):
1744 * dfg/DFGByteCodeParser.cpp:
1745 * dfg/DFGJITCompiler.cpp:
1746 * dfg/DFGOSRExitCompilerCommon.cpp:
1747 * dfg/DFGSpeculativeJIT.h:
1748 * ftl/FTLLowerDFGToB3.cpp:
1749 * ftl/FTLSlowPathCall.h:
1750 * jit/IntrinsicEmitter.cpp:
1751 * jit/JITInlineCacheGenerator.cpp:
1752 * jit/JITInlineCacheGenerator.h:
1753 * jit/JITOperations.cpp:
1754 * jit/JITPropertyAccess.cpp:
1755 * jit/JITPropertyAccess32_64.cpp:
1757 2016-04-11 Skachkov Oleksandr <gskachkov@gmail.com>
1759 Remove NewArrowFunction from DFG IR
1760 https://bugs.webkit.org/show_bug.cgi?id=156439
1762 Reviewed by Saam Barati.
1764 It seems that NewArrowFunction was left in DFG IR during refactoring by mistake.
1766 * dfg/DFGAbstractInterpreterInlines.h:
1767 * dfg/DFGClobberize.h:
1768 (JSC::DFG::clobberize):
1769 * dfg/DFGClobbersExitState.cpp:
1770 * dfg/DFGDoesGC.cpp:
1771 * dfg/DFGFixupPhase.cpp:
1772 * dfg/DFGMayExit.cpp:
1774 (JSC::DFG::Node::convertToPhantomNewFunction):
1775 * dfg/DFGNodeType.h:
1776 * dfg/DFGObjectAllocationSinkingPhase.cpp:
1777 * dfg/DFGPredictionPropagationPhase.cpp:
1778 * dfg/DFGSafeToExecute.h:
1779 * dfg/DFGSpeculativeJIT.cpp:
1780 (JSC::DFG::SpeculativeJIT::compileNewFunction):
1781 * dfg/DFGSpeculativeJIT32_64.cpp:
1782 * dfg/DFGSpeculativeJIT64.cpp:
1783 * dfg/DFGStoreBarrierInsertionPhase.cpp:
1784 * dfg/DFGStructureRegistrationPhase.cpp:
1785 * ftl/FTLCapabilities.cpp:
1786 * ftl/FTLLowerDFGToB3.cpp:
1787 (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction):
1789 2016-04-05 Oliver Hunt <oliver@apple.com>
1791 Remove compile time define for SEPARATED_HEAP
1792 https://bugs.webkit.org/show_bug.cgi?id=155508
1794 Reviewed by Mark Lam.
1796 Remove the SEPARATED_HEAP compile time flag. The separated
1797 heap is available, but off by default, on x86_64, ARMv7, and
1800 Working through the issues that happened last time essentially
1801 required implementing the ARMv7 path for the separated heap
1802 just so I could find all the ways it was going wrong.
1804 We fixed all the logic by making the branch and jump logic in
1805 the linker and assemblers take two parameters, the location to
1806 write to, and the location we'll actually be writing to. We
1807 need to do this because it's no longer sufficient to compute
1808 jumps relative to region the linker is writing to.
1810 The repatching jump, branch, and call functions only need the
1811 executable address as the patching is performed directly using
1812 performJITMemcpy function which works in terms of the executable
1815 There is no performance impact on jsc-benchmarks with the separate
1816 heap either emabled or disabled.
1818 * Configurations/FeatureDefines.xcconfig:
1819 * assembler/ARM64Assembler.h:
1820 (JSC::ARM64Assembler::linkJump):
1821 (JSC::ARM64Assembler::linkCall):
1822 (JSC::ARM64Assembler::relinkJump):
1823 (JSC::ARM64Assembler::relinkCall):
1824 (JSC::ARM64Assembler::link):
1825 (JSC::ARM64Assembler::linkJumpOrCall):
1826 (JSC::ARM64Assembler::linkCompareAndBranch):
1827 (JSC::ARM64Assembler::linkConditionalBranch):
1828 (JSC::ARM64Assembler::linkTestAndBranch):
1829 (JSC::ARM64Assembler::relinkJumpOrCall):
1830 * assembler/ARMv7Assembler.h:
1831 (JSC::ARMv7Assembler::revertJumpTo_movT3movtcmpT2):
1832 (JSC::ARMv7Assembler::revertJumpTo_movT3):
1833 (JSC::ARMv7Assembler::link):
1834 (JSC::ARMv7Assembler::linkJump):
1835 (JSC::ARMv7Assembler::relinkJump):
1836 (JSC::ARMv7Assembler::repatchCompact):
1837 (JSC::ARMv7Assembler::replaceWithJump):
1838 (JSC::ARMv7Assembler::replaceWithLoad):
1839 (JSC::ARMv7Assembler::replaceWithAddressComputation):
1840 (JSC::ARMv7Assembler::setInt32):
1841 (JSC::ARMv7Assembler::setUInt7ForLoad):
1842 (JSC::ARMv7Assembler::isB):
1843 (JSC::ARMv7Assembler::isBX):
1844 (JSC::ARMv7Assembler::isMOV_imm_T3):
1845 (JSC::ARMv7Assembler::isMOVT):
1846 (JSC::ARMv7Assembler::isNOP_T1):
1847 (JSC::ARMv7Assembler::isNOP_T2):
1848 (JSC::ARMv7Assembler::linkJumpT1):
1849 (JSC::ARMv7Assembler::linkJumpT2):
1850 (JSC::ARMv7Assembler::linkJumpT3):
1851 (JSC::ARMv7Assembler::linkJumpT4):
1852 (JSC::ARMv7Assembler::linkConditionalJumpT4):
1853 (JSC::ARMv7Assembler::linkBX):
1854 (JSC::ARMv7Assembler::linkConditionalBX):
1855 (JSC::ARMv7Assembler::linkJumpAbsolute):
1856 * assembler/LinkBuffer.cpp:
1857 (JSC::LinkBuffer::copyCompactAndLinkCode):
1858 * assembler/MacroAssemblerARM64.h:
1859 (JSC::MacroAssemblerARM64::link):
1860 * assembler/MacroAssemblerARMv7.h:
1861 (JSC::MacroAssemblerARMv7::link):
1862 * jit/ExecutableAllocator.h:
1863 (JSC::performJITMemcpy):
1864 * jit/ExecutableAllocatorFixedVMPool.cpp:
1865 (JSC::FixedVMPoolExecutableAllocator::initializeSeparatedWXHeaps):
1866 (JSC::FixedVMPoolExecutableAllocator::jitWriteThunkGenerator):
1867 (JSC::FixedVMPoolExecutableAllocator::genericWriteToJITRegion):
1868 (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator): Deleted.
1869 * runtime/Options.cpp:
1870 (JSC::recomputeDependentOptions):
1871 * runtime/Options.h:
1873 2016-04-10 Filip Pizlo <fpizlo@apple.com>
1875 Clean up how we reason about the states of AccessCases
1876 https://bugs.webkit.org/show_bug.cgi?id=156454
1878 Reviewed by Mark Lam.
1880 Currently when we add an AccessCase to a PolymorphicAccess stub, we regenerate the stub.
1881 That means that as we grow a stub to have N cases, we will do O(N^2) generation work. I want
1882 to explore buffering AccessCases so that we can do O(N) generation work instead. But to
1883 before I go there, I want to make sure that the statefulness of AccessCase makes sense. So,
1884 I broke it down into three different states and added assertions about the transitions. I
1885 also broke out a separate operation called AccessCase::commit(), which is the work that
1886 cannot be buffered since there cannot be any JS effects between when the AccessCase was
1887 created and when we do the work in commit().
1889 This opens up a fairly obvious path to buffering AccessCases: add them to the list without
1890 regenerating. Then when we do eventually trigger regeneration, those cases will get cloned
1891 and generated automagically. This patch doesn't implement this technique yet, but gives us
1892 an opportunity to independently test the scaffolding necessary to do it.
1894 This is perf-neutral on lots of tests.
1896 * bytecode/PolymorphicAccess.cpp:
1897 (JSC::AccessGenerationResult::dump):
1898 (JSC::AccessCase::clone):
1899 (JSC::AccessCase::commit):
1900 (JSC::AccessCase::guardedByStructureCheck):
1901 (JSC::AccessCase::dump):
1902 (JSC::AccessCase::generateWithGuard):
1903 (JSC::AccessCase::generate):
1904 (JSC::AccessCase::generateImpl):
1905 (JSC::PolymorphicAccess::regenerateWithCases):
1906 (JSC::PolymorphicAccess::regenerate):
1907 (WTF::printInternal):
1908 * bytecode/PolymorphicAccess.h:
1909 (JSC::AccessCase::type):
1910 (JSC::AccessCase::state):
1911 (JSC::AccessCase::offset):
1912 (JSC::AccessCase::viaProxy):
1913 (JSC::AccessCase::callLinkInfo):
1914 * bytecode/StructureStubInfo.cpp:
1915 (JSC::StructureStubInfo::addAccessCase):
1916 * bytecode/Watchpoint.h:
1917 * dfg/DFGOperations.cpp:
1919 (JSC::repatchGetByID):
1920 (JSC::repatchPutByID):
1923 (JSC::VM::dumpRegExpTrace):
1924 (JSC::VM::ensureWatchpointSetForImpureProperty):
1925 (JSC::VM::registerWatchpointForImpureProperty):
1926 (JSC::VM::addImpureProperty):
1929 2016-04-11 Fujii Hironori <Hironori.Fujii@jp.sony.com>
1931 [CMake] Make FOLDER property INHERITED
1932 https://bugs.webkit.org/show_bug.cgi?id=156460
1934 Reviewed by Brent Fulgham.
1937 * shell/CMakeLists.txt:
1938 * shell/PlatformWin.cmake:
1939 Set FOLDER property as a directory property not a target property
1941 2016-04-09 Keith Miller <keith_miller@apple.com>
1943 tryGetById should be supported by the DFG/FTL
1944 https://bugs.webkit.org/show_bug.cgi?id=156378
1946 Reviewed by Filip Pizlo.
1948 This patch adds support for tryGetById in the DFG/FTL. It adds a new DFG node
1949 TryGetById, which acts similarly to the normal GetById DFG node. One key
1950 difference between GetById and TryGetById is that in the LLInt and Baseline
1951 we do not profile the result type. This profiling is unnessary for the current
1952 use case of tryGetById, which is expected to be a strict equality comparision
1953 against a specific object or undefined. In either case other DFG optimizations
1954 will make this equally fast with or without the profiling information.
1956 Additionally, this patch adds new reuse modes for JSValueRegsTemporary that take
1957 an operand and attempt to reuse the registers for that operand if they are free
1958 after the current DFG node.
1960 * bytecode/GetByIdStatus.cpp:
1961 (JSC::GetByIdStatus::computeFromLLInt):
1962 (JSC::GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback):
1963 * dfg/DFGAbstractInterpreterInlines.h:
1964 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1965 * dfg/DFGByteCodeParser.cpp:
1966 (JSC::DFG::ByteCodeParser::handleGetById):
1967 (JSC::DFG::ByteCodeParser::parseBlock):
1968 * dfg/DFGCapabilities.cpp:
1969 (JSC::DFG::capabilityLevel):
1970 * dfg/DFGClobberize.h:
1971 (JSC::DFG::clobberize):
1972 * dfg/DFGDoesGC.cpp:
1974 * dfg/DFGFixupPhase.cpp:
1975 (JSC::DFG::FixupPhase::fixupNode):
1977 (JSC::DFG::Node::hasIdentifier):
1978 * dfg/DFGNodeType.h:
1979 * dfg/DFGPredictionPropagationPhase.cpp:
1980 (JSC::DFG::PredictionPropagationPhase::propagate):
1981 * dfg/DFGSafeToExecute.h:
1982 (JSC::DFG::safeToExecute):
1983 * dfg/DFGSpeculativeJIT.cpp:
1984 (JSC::DFG::SpeculativeJIT::compileTryGetById):
1985 (JSC::DFG::JSValueRegsTemporary::JSValueRegsTemporary):
1986 * dfg/DFGSpeculativeJIT.h:
1987 (JSC::DFG::GPRTemporary::operator=):
1988 * dfg/DFGSpeculativeJIT32_64.cpp:
1989 (JSC::DFG::SpeculativeJIT::cachedGetById):
1990 (JSC::DFG::SpeculativeJIT::compile):
1991 * dfg/DFGSpeculativeJIT64.cpp:
1992 (JSC::DFG::SpeculativeJIT::cachedGetById):
1993 (JSC::DFG::SpeculativeJIT::compile):
1994 * ftl/FTLCapabilities.cpp:
1995 (JSC::FTL::canCompile):
1996 * ftl/FTLLowerDFGToB3.cpp:
1997 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1998 (JSC::FTL::DFG::LowerDFGToB3::compileGetById):
1999 (JSC::FTL::DFG::LowerDFGToB3::getById):
2000 * jit/JITOperations.cpp:
2001 * jit/JITOperations.h:
2002 * tests/stress/try-get-by-id.js:
2003 (tryGetByIdTextStrict):
2005 (let.get createBuiltin):
2007 (getCaller.obj.1.throw.new.Error): Deleted.
2009 2016-04-09 Saam barati <sbarati@apple.com>
2011 Allocation sinking SSA Defs are allowed to have replacements
2012 https://bugs.webkit.org/show_bug.cgi?id=156444
2014 Reviewed by Filip Pizlo.
2016 Consider the following program and the annotations that explain why
2017 the SSA defs we create in allocation sinking can have replacements.
2020 let o1 = {x: 20, y: 50};
2021 let o2 = {y: 40, o1: o1};
2024 // We're Defing a new variable here, call it o3_field.
2025 // o3_field is defing the value that is the result of
2026 // a GetByOffset that gets eliminated through allocation sinking.
2031 // This control flow is here to not allow the phase to consult
2032 // its local SSA mapping (which properly handles replacements)
2033 // for the value of o3_field.
2040 // Here, we ask for the reaching def of o3_field, and assert
2041 // it doesn't have a replacement. It does have a replacement
2042 // though. The original Def was the GetByOffset. We replaced
2043 // that GetByOffset with the value of the o1_y variable.
2044 let value = o3.field;
2045 assert(value === 50);
2048 * dfg/DFGObjectAllocationSinkingPhase.cpp:
2049 * tests/stress/allocation-sinking-defs-may-have-replacements.js: Added.
2054 2016-04-09 Commit Queue <commit-queue@webkit.org>
2056 Unreviewed, rolling out r199242.
2057 https://bugs.webkit.org/show_bug.cgi?id=156442
2059 Caused many many leaks (Requested by ap on #webkit).
2063 "Web Inspector: get rid of InspectorBasicValue and
2064 InspectorString subclasses"
2065 https://bugs.webkit.org/show_bug.cgi?id=156407
2066 http://trac.webkit.org/changeset/199242
2068 2016-04-09 Filip Pizlo <fpizlo@apple.com>
2070 Debug JSC test failure: stress/multi-put-by-offset-reallocation-butterfly-cse.js.ftl-no-cjit-small-pool
2071 https://bugs.webkit.org/show_bug.cgi?id=156406
2073 Reviewed by Saam Barati.
2075 The failure was because the GC ran from within the butterfly allocation call in a put_by_id
2076 transition AccessCase that had to deal with indexing storage. When the GC runs in a call from a stub,
2077 then we need to be extra careful:
2079 1) The GC may reset the IC and delete the stub. So, the stub needs to tell the GC that it might be on
2080 the stack during GC, so that the GC keeps it alive if it's currently running.
2082 2) If the stub uses (dereferences or stores) some object after the call, then we need to ensure that
2083 the stub routine knows about that object independently of the IC.
2085 In the case of put_by_id transitions that use a helper to allocate the butterfly, we have both
2086 issues. A long time ago, we had to deal with (2), and we still had code to handle that case, although
2087 it appears to be dead. This change revives that code and glues it together with PolymorphicAccess.
2089 * bytecode/PolymorphicAccess.cpp:
2090 (JSC::AccessCase::alternateBase):
2091 (JSC::AccessCase::doesCalls):
2092 (JSC::AccessCase::couldStillSucceed):
2093 (JSC::AccessCase::generate):
2094 (JSC::PolymorphicAccess::regenerate):
2095 * bytecode/PolymorphicAccess.h:
2096 (JSC::AccessCase::customSlotBase):
2097 (JSC::AccessCase::isGetter):
2098 (JSC::AccessCase::doesCalls): Deleted.
2099 * jit/GCAwareJITStubRoutine.cpp:
2100 (JSC::GCAwareJITStubRoutine::markRequiredObjectsInternal):
2101 (JSC::MarkingGCAwareJITStubRoutine::MarkingGCAwareJITStubRoutine):
2102 (JSC::MarkingGCAwareJITStubRoutine::~MarkingGCAwareJITStubRoutine):
2103 (JSC::MarkingGCAwareJITStubRoutine::markRequiredObjectsInternal):
2104 (JSC::GCAwareJITStubRoutineWithExceptionHandler::GCAwareJITStubRoutineWithExceptionHandler):
2105 (JSC::createJITStubRoutine):
2106 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::MarkingGCAwareJITStubRoutineWithOneObject): Deleted.
2107 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::~MarkingGCAwareJITStubRoutineWithOneObject): Deleted.
2108 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::markRequiredObjectsInternal): Deleted.
2109 * jit/GCAwareJITStubRoutine.h:
2110 (JSC::createJITStubRoutine):
2112 2016-04-08 Joseph Pecoraro <pecoraro@apple.com>
2114 Web Inspector: XHRs and Web Worker scripts are not searchable
2115 https://bugs.webkit.org/show_bug.cgi?id=154214
2116 <rdar://problem/24643587>
2118 Reviewed by Timothy Hatcher.
2120 * inspector/protocol/Page.json:
2121 Add optional requestId to search results properties and search
2122 parameters for when the frameId and url are not enough. XHR
2123 resources, and "Other" resources will use this.
2125 2016-04-08 Guillaume Emont <guijemont@igalia.com>
2127 MIPS: support Signed cond in branchTest32()
2128 https://bugs.webkit.org/show_bug.cgi?id=156260
2130 This is needed since r197688 makes use of it.
2132 Reviewed by Mark Lam.
2134 * assembler/MacroAssemblerMIPS.h:
2135 (JSC::MacroAssemblerMIPS::branchTest32):
2137 2016-04-08 Alex Christensen <achristensen@webkit.org>
2139 Progress towards running CMake WebKit2 on Mac
2140 https://bugs.webkit.org/show_bug.cgi?id=156426
2142 Reviewed by Tim Horton.
2144 * PlatformMac.cmake:
2146 2016-04-08 Saam barati <sbarati@apple.com>
2148 Debugger may dereference m_currentCallFrame even after the VM has gone idle
2149 https://bugs.webkit.org/show_bug.cgi?id=156413
2151 Reviewed by Mark Lam.
2153 There is a bug where the debugger may dereference its m_currentCallFrame
2154 pointer after that pointer becomes invalid to read from. This happens like so:
2156 We may step over an instruction which causes the end of execution for the
2157 current program. This causes the VM to exit. Then, we perform a GC which
2158 causes us to collect the global object. The global object being collected
2159 causes us to detach the debugger. In detaching, we think we still have a
2160 valid m_currentCallFrame, we dereference it, and crash. The solution is to
2161 make sure we're paused when dereferencing this pointer inside ::detach().
2163 * debugger/Debugger.cpp:
2164 (JSC::Debugger::detach):
2166 2016-04-08 Brian Burg <bburg@apple.com>
2168 Web Inspector: get rid of InspectorBasicValue and InspectorString subclasses
2169 https://bugs.webkit.org/show_bug.cgi?id=156407
2170 <rdar://problem/25627659>
2172 Reviewed by Timothy Hatcher.
2174 There's no point having these subclasses as they don't save any space.
2175 Add m_stringValue to the union and merge some implementations of writeJSON.
2176 Move uses of the subclass to InspectorValue and delete redundant methods.
2177 Now, most InspectorValue methods are non-virtual so they can be templated.
2179 * bindings/ScriptValue.cpp:
2180 (Deprecated::jsToInspectorValue):
2181 * inspector/InjectedScriptBase.cpp:
2182 (Inspector::InjectedScriptBase::makeCall):
2183 Don't used deleted subclasses.
2185 * inspector/InspectorValues.cpp:
2186 (Inspector::InspectorValue::null):
2187 (Inspector::InspectorValue::create):
2188 (Inspector::InspectorValue::asValue):
2189 (Inspector::InspectorValue::asBoolean):
2190 (Inspector::InspectorValue::asDouble):
2191 (Inspector::InspectorValue::asInteger):
2192 (Inspector::InspectorValue::asString):
2193 These only need one implementation now.
2195 (Inspector::InspectorValue::writeJSON):
2196 Still a virtual method since Object and Array need their members.
2198 (Inspector::InspectorObjectBase::InspectorObjectBase):
2199 (Inspector::InspectorBasicValue::asBoolean): Deleted.
2200 (Inspector::InspectorBasicValue::asDouble): Deleted.
2201 (Inspector::InspectorBasicValue::asInteger): Deleted.
2202 (Inspector::InspectorBasicValue::writeJSON): Deleted.
2203 (Inspector::InspectorString::asString): Deleted.
2204 (Inspector::InspectorString::writeJSON): Deleted.
2205 (Inspector::InspectorString::create): Deleted.
2206 (Inspector::InspectorBasicValue::create): Deleted.
2208 * inspector/InspectorValues.h:
2209 (Inspector::InspectorObjectBase::setBoolean):
2210 (Inspector::InspectorObjectBase::setInteger):
2211 (Inspector::InspectorObjectBase::setDouble):
2212 (Inspector::InspectorObjectBase::setString):
2213 (Inspector::InspectorArrayBase::pushBoolean):
2214 (Inspector::InspectorArrayBase::pushInteger):
2215 (Inspector::InspectorArrayBase::pushDouble):
2216 (Inspector::InspectorArrayBase::pushString):
2217 Use new factory methods.
2219 * replay/EncodedValue.cpp:
2220 (JSC::ScalarEncodingTraits<bool>::encodeValue):
2221 (JSC::ScalarEncodingTraits<double>::encodeValue):
2222 (JSC::ScalarEncodingTraits<float>::encodeValue):
2223 (JSC::ScalarEncodingTraits<int32_t>::encodeValue):
2224 (JSC::ScalarEncodingTraits<int64_t>::encodeValue):
2225 (JSC::ScalarEncodingTraits<uint32_t>::encodeValue):
2226 (JSC::ScalarEncodingTraits<uint64_t>::encodeValue):
2227 * replay/EncodedValue.h:
2228 Use new factory methods.
2230 2016-04-08 Filip Pizlo <fpizlo@apple.com>
2232 Add IC support for arguments.length
2233 https://bugs.webkit.org/show_bug.cgi?id=156389
2235 Reviewed by Geoffrey Garen.
2237 This adds support for caching accesses to arguments.length for both DirectArguments and
2238 ScopedArguments. In strict mode, we already cached these accesses since they were just
2241 Amazingly, we also already supported caching of overridden arguments.length in both
2242 DirectArguments and ScopedArguments. This is because when you override, the property gets
2243 materialized as a normal JS property and the structure is changed.
2245 This patch painstakingly preserves our previous caching of overridden length while
2246 introducing caching of non-overridden length (i.e. the common case). In fact, we even cache
2247 the case where it could either be overridden or not, since we just end up with an AccessCase
2248 for each and they cascade to each other.
2250 This is a >3x speed-up on microbenchmarks that do arguments.length in a polymorphic context.
2251 Entirely monomorphic accesses were already handled by the DFG.
2253 * bytecode/PolymorphicAccess.cpp:
2254 (JSC::AccessGenerationState::calculateLiveRegistersForCallAndExceptionHandling):
2255 (JSC::AccessCase::guardedByStructureCheck):
2256 (JSC::AccessCase::generateWithGuard):
2257 (JSC::AccessCase::generate):
2258 (WTF::printInternal):
2259 * bytecode/PolymorphicAccess.h:
2261 * jit/JITOperations.cpp:
2263 (JSC::tryCacheGetByID):
2264 (JSC::tryCachePutByID):
2265 (JSC::tryRepatchIn):
2266 * tests/stress/direct-arguments-override-length-then-access-normal-length.js: Added.
2271 2016-04-08 Benjamin Poulain <bpoulain@apple.com>
2273 UInt32ToNumber should have an Int52 path
2274 https://bugs.webkit.org/show_bug.cgi?id=125704
2276 Reviewed by Filip Pizlo.
2278 When dealing with big numbers, fall back to Int52 instead
2279 of double when possible.
2281 * dfg/DFGAbstractInterpreterInlines.h:
2282 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2283 * dfg/DFGFixupPhase.cpp:
2284 (JSC::DFG::FixupPhase::fixupNode):
2285 * dfg/DFGPredictionPropagationPhase.cpp:
2286 (JSC::DFG::PredictionPropagationPhase::propagate):
2287 * dfg/DFGSpeculativeJIT.cpp:
2288 (JSC::DFG::SpeculativeJIT::compileUInt32ToNumber):
2289 * ftl/FTLLowerDFGToB3.cpp:
2290 (JSC::FTL::DFG::LowerDFGToB3::compileUInt32ToNumber):
2292 2016-04-08 Brian Burg <bburg@apple.com>
2294 Web Inspector: protocol generator should emit an error when 'type' is used instead of '$ref'
2295 https://bugs.webkit.org/show_bug.cgi?id=156275
2296 <rdar://problem/25569331>
2298 Reviewed by Darin Adler.
2300 * inspector/protocol/Heap.json: Fix a mistake that's now caught by the protocol generator.
2302 * inspector/scripts/codegen/models.py:
2303 (TypeReference.__init__): Check here if type_kind is on a whitelist of primitive types.
2304 (TypeReference.referenced_name): Update comment.
2306 Add a new test specifically for the case when the type would otherwise be resolved. Rebaseline.
2308 * inspector/scripts/tests/expected/fail-on-type-reference-as-primitive-type.json-error: Added.
2309 * inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error:
2310 * inspector/scripts/tests/fail-on-type-reference-as-primitive-type.json: Added.
2312 2016-04-07 Joseph Pecoraro <pecoraro@apple.com>
2314 Remove ENABLE(ENABLE_ES6_CLASS_SYNTAX) guards
2315 https://bugs.webkit.org/show_bug.cgi?id=156384
2317 Reviewed by Ryosuke Niwa.
2319 * Configurations/FeatureDefines.xcconfig:
2320 * features.json: Mark as Done.
2321 * parser/Parser.cpp:
2322 (JSC::Parser<LexerType>::parseExportDeclaration):
2323 (JSC::Parser<LexerType>::parseStatementListItem):
2324 (JSC::Parser<LexerType>::parsePrimaryExpression):
2325 (JSC::Parser<LexerType>::parseMemberExpression):
2327 2016-04-07 Filip Pizlo <fpizlo@apple.com>
2329 Implementing caching transition puts that need to reallocate with indexing storage
2330 https://bugs.webkit.org/show_bug.cgi?id=130914
2332 Reviewed by Saam Barati.
2334 This enables the IC's put_by_id path to handle reallocating the out-of-line storage even if
2335 the butterfly has indexing storage. Like the DFG, we do this by calling operations that
2336 reallocate the butterfly. Those use JSObject API and do all of the nasty work for us, like
2337 triggering a barrier.
2339 This does a bunch of refactoring to how PolymorphicAccess makes calls. It's a lot easier to
2340 do it now because the hard work is hidden under AccessGenerationState methods. This means
2341 that custom accessors now share logic with put_by_id transitions.
2343 * bytecode/PolymorphicAccess.cpp:
2344 (JSC::AccessGenerationState::succeed):
2345 (JSC::AccessGenerationState::calculateLiveRegistersForCallAndExceptionHandling):
2346 (JSC::AccessGenerationState::preserveLiveRegistersToStackForCall):
2347 (JSC::AccessGenerationState::originalCallSiteIndex):
2348 (JSC::AccessGenerationState::emitExplicitExceptionHandler):
2349 (JSC::AccessCase::AccessCase):
2350 (JSC::AccessCase::transition):
2351 (JSC::AccessCase::generate):
2352 (JSC::PolymorphicAccess::regenerate):
2353 * bytecode/PolymorphicAccess.h:
2354 (JSC::AccessGenerationState::needsToRestoreRegistersIfException):
2355 (JSC::AccessGenerationState::liveRegistersToPreserveAtExceptionHandlingCallSite):
2356 * dfg/DFGOperations.cpp:
2357 * dfg/DFGOperations.h:
2358 * jit/JITOperations.cpp:
2359 * jit/JITOperations.h:
2361 2016-04-07 Joseph Pecoraro <pecoraro@apple.com>
2363 Remote Inspector: When disallowing remote inspection on a debuggable, a listing is still sent to debuggers
2364 https://bugs.webkit.org/show_bug.cgi?id=156380
2365 <rdar://problem/25323727>
2367 Reviewed by Timothy Hatcher.
2369 * inspector/remote/RemoteInspector.mm:
2370 (Inspector::RemoteInspector::updateTarget):
2371 (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
2372 When a target has been updated and it no longer generates a listing,
2373 we should remove the old listing as that is now stale and should
2374 not be sent. Not generating a listing means this target is no
2375 longer allowed to be debugged.
2377 2016-04-07 Joseph Pecoraro <pecoraro@apple.com>
2379 Web Inspector: Not necessary to validate webinspectord connection on iOS
2380 https://bugs.webkit.org/show_bug.cgi?id=156377
2381 <rdar://problem/25612460>
2383 Reviewed by Simon Fraser.
2385 * inspector/remote/RemoteInspectorXPCConnection.h:
2386 * inspector/remote/RemoteInspectorXPCConnection.mm:
2387 (Inspector::RemoteInspectorXPCConnection::handleEvent):
2389 2016-04-07 Keith Miller <keith_miller@apple.com>
2391 Rename ArrayMode::supportsLength to supportsSelfLength
2392 https://bugs.webkit.org/show_bug.cgi?id=156374
2394 Reviewed by Filip Pizlo.
2396 The name supportsLength is confusing because TypedArray have a
2397 length function however it is on the prototype and not on the
2398 instance. supportsSelfLength makes more sense since we use the
2399 function during fixup to tell if we can intrinsic the length
2400 property lookup on self accesses.
2402 * dfg/DFGArrayMode.h:
2403 (JSC::DFG::ArrayMode::supportsSelfLength):
2404 (JSC::DFG::ArrayMode::supportsLength): Deleted.
2405 * dfg/DFGFixupPhase.cpp:
2406 (JSC::DFG::FixupPhase::attemptToMakeGetArrayLength):
2408 2016-04-07 Joseph Pecoraro <pecoraro@apple.com>
2410 Web Inspector: ProfileView source links are off by 1 line, worse in pretty printed code
2411 https://bugs.webkit.org/show_bug.cgi?id=156371
2413 Reviewed by Timothy Hatcher.
2415 * inspector/protocol/ScriptProfiler.json:
2416 Clarify that these locations are 1-based.
2418 2016-04-07 Jon Davis <jond@apple.com>
2420 Add Web Animations API to Feature Status Page
2421 https://bugs.webkit.org/show_bug.cgi?id=156360
2423 Reviewed by Timothy Hatcher.
2427 2016-04-07 Saam barati <sbarati@apple.com>
2429 Invalid assertion inside DebuggerScope::getOwnPropertySlot
2430 https://bugs.webkit.org/show_bug.cgi?id=156357
2432 Reviewed by Keith Miller.
2434 The Type Profiler might profile JS code that uses DebuggerScope and accesses properties
2435 on it. Therefore, it may have a DebuggerScope object in its log. Objects in the log
2436 are subject to having their getOwnPropertySlot method called. Therefore, the DebuggerScope
2437 might not always be in a valid state when its getOwnPropertySlot method is called.
2438 Therefore, the assertion invalid.
2440 * debugger/DebuggerScope.cpp:
2441 (JSC::DebuggerScope::getOwnPropertySlot):
2443 2016-04-07 Saam barati <sbarati@apple.com>
2445 Initial implementation of annex b.3.3 behavior was incorrect
2446 https://bugs.webkit.org/show_bug.cgi?id=156276
2448 Reviewed by Keith Miller.
2450 I almost got annex B.3.3 correct in my first implementation.
2451 There is a subtlety here I got wrong. We always create a local binding for
2452 a function at the very beginning of execution of a block scope. So we
2453 hoist function declarations to their local binding within a given
2454 block scope. When we actually evaluate the function declaration statement
2455 itself, we must lookup the binding in the current scope, and bind the
2456 value to the binding in the "var" scope. We perform the following
2457 abstract operations when executing a function declaration statement.
2459 f = lookupBindingInCurrentScope("func")
2460 store(varScope, "func", f)
2462 I got this wrong by performing the store to the var binding at the beginning
2463 of the block scope instead of when we evaluate the function declaration statement.
2464 This behavior is observable. For example, a program could change the value
2465 of "func" before the actual function declaration statement executes.
2466 Consider the following two functions:
2469 // func === undefined
2471 // typeof func === "function"
2472 function func() { } // Executing this statement binds the local "func" binding to the implicit "func" var binding.
2473 func = 20 // This sets the local "func" binding to 20.
2475 // typeof func === "function"
2479 // func === undefined
2481 // typeof func === "function"
2482 func = 20 // This sets the local "func" binding to 20.
2483 function func() { } // Executing this statement binds the local "func" binding to the implicit "func" var binding.
2489 * bytecompiler/BytecodeGenerator.cpp:
2490 (JSC::BytecodeGenerator::initializeBlockScopedFunctions):
2491 (JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
2492 * bytecompiler/BytecodeGenerator.h:
2493 (JSC::BytecodeGenerator::emitNodeForLeftHandSide):
2494 * bytecompiler/NodesCodegen.cpp:
2495 (JSC::FuncDeclNode::emitBytecode):
2496 * tests/stress/sloppy-mode-function-hoisting.js:
2501 (test.switch.case.0):
2503 (test.switch.capFoo2):
2507 2016-04-07 Alex Christensen <achristensen@webkit.org>
2509 Build fix after r199170
2513 2016-04-07 Keith Miller <keith_miller@apple.com>
2515 We should support the ability to do a non-effectful getById
2516 https://bugs.webkit.org/show_bug.cgi?id=156116
2518 Reviewed by Benjamin Poulain.
2520 Currently, there is no way in JS to do a non-effectful getById. A non-effectful getById is
2521 useful because it enables us to take different code paths based on values that we would
2522 otherwise not be able to have knowledge of. This patch adds this new feature called
2523 try_get_by_id that will attempt to do as much of a get_by_id as possible without performing
2524 an effectful behavior. Thus, try_get_by_id will return the value if the slot is a value, the
2525 GetterSetter object if the slot is a normal accessor (not a CustomGetterSetter) and
2526 undefined if the slot is unset. If the slot is proxied or any other cases then the result
2527 is null. In theory, if we ever wanted to check for null we could add a sentinal object to
2528 the global object that indicates we could not get the result.
2530 In order to implement this feature we add a new enum GetByIdKind that indicates what to do
2531 for accessor properties in PolymorphicAccess. If the GetByIdKind is pure then we treat the
2532 get_by_id the same way we would for load and return the value at the appropriate offset.
2533 Additionally, in order to make sure the we can properly compare the GetterSetter object
2534 with === GetterSetters are now JSObjects. This comes at the cost of eight extra bytes on the
2535 GetterSetter object but it vastly simplifies the patch. Additionally, the extra bytes are
2536 likely to have little to no impact on memory usage as normal accessors are generally rare.
2538 * JavaScriptCore.xcodeproj/project.pbxproj:
2539 * builtins/BuiltinExecutableCreator.cpp: Added.
2540 (JSC::createBuiltinExecutable):
2541 * builtins/BuiltinExecutableCreator.h: Copied from Source/JavaScriptCore/builtins/BuiltinExecutables.h.
2542 * builtins/BuiltinExecutables.cpp:
2543 (JSC::BuiltinExecutables::createDefaultConstructor):
2544 (JSC::BuiltinExecutables::createBuiltinExecutable):
2545 (JSC::createBuiltinExecutable):
2546 (JSC::BuiltinExecutables::createExecutable):
2547 (JSC::createExecutableInternal): Deleted.
2548 * builtins/BuiltinExecutables.h:
2549 * bytecode/BytecodeIntrinsicRegistry.h:
2550 * bytecode/BytecodeList.json:
2551 * bytecode/BytecodeUseDef.h:
2552 (JSC::computeUsesForBytecodeOffset):
2553 (JSC::computeDefsForBytecodeOffset):
2554 * bytecode/CodeBlock.cpp:
2555 (JSC::CodeBlock::dumpBytecode):
2556 * bytecode/PolymorphicAccess.cpp:
2557 (JSC::AccessCase::tryGet):
2558 (JSC::AccessCase::generate):
2559 (WTF::printInternal):
2560 * bytecode/PolymorphicAccess.h:
2561 (JSC::AccessCase::isGet): Deleted.
2562 (JSC::AccessCase::isPut): Deleted.
2563 (JSC::AccessCase::isIn): Deleted.
2564 * bytecode/StructureStubInfo.cpp:
2565 (JSC::StructureStubInfo::reset):
2566 * bytecode/StructureStubInfo.h:
2567 * bytecompiler/BytecodeGenerator.cpp:
2568 (JSC::BytecodeGenerator::emitTryGetById):
2569 * bytecompiler/BytecodeGenerator.h:
2570 * bytecompiler/NodesCodegen.cpp:
2571 (JSC::BytecodeIntrinsicNode::emit_intrinsic_tryGetById):
2572 * dfg/DFGSpeculativeJIT32_64.cpp:
2573 (JSC::DFG::SpeculativeJIT::cachedGetById):
2574 * dfg/DFGSpeculativeJIT64.cpp:
2575 (JSC::DFG::SpeculativeJIT::cachedGetById):
2576 * ftl/FTLLowerDFGToB3.cpp:
2577 (JSC::FTL::DFG::LowerDFGToB3::getById):
2579 (JSC::JIT::privateCompileMainPass):
2580 (JSC::JIT::privateCompileSlowCases):
2582 * jit/JITInlineCacheGenerator.cpp:
2583 (JSC::JITGetByIdGenerator::JITGetByIdGenerator):
2584 * jit/JITInlineCacheGenerator.h:
2586 (JSC::JIT::callOperation):
2587 * jit/JITOperations.cpp:
2588 * jit/JITOperations.h:
2589 * jit/JITPropertyAccess.cpp:
2590 (JSC::JIT::emitGetByValWithCachedId):
2591 (JSC::JIT::emit_op_try_get_by_id):
2592 (JSC::JIT::emitSlow_op_try_get_by_id):
2593 (JSC::JIT::emit_op_get_by_id):
2594 * jit/JITPropertyAccess32_64.cpp:
2595 (JSC::JIT::emitGetByValWithCachedId):
2596 (JSC::JIT::emit_op_try_get_by_id):
2597 (JSC::JIT::emitSlow_op_try_get_by_id):
2598 (JSC::JIT::emit_op_get_by_id):
2600 (JSC::repatchByIdSelfAccess):
2601 (JSC::appropriateOptimizingGetByIdFunction):
2602 (JSC::appropriateGenericGetByIdFunction):
2603 (JSC::tryCacheGetByID):
2604 (JSC::repatchGetByID):
2605 (JSC::resetGetByID):
2608 (GlobalObject::finishCreation):
2609 (functionGetGetterSetter):
2610 (functionCreateBuiltin):
2611 * llint/LLIntData.cpp:
2612 (JSC::LLInt::Data::performAssertions):
2613 * llint/LLIntSlowPaths.cpp:
2614 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
2615 * llint/LLIntSlowPaths.h:
2616 * llint/LowLevelInterpreter.asm:
2617 * runtime/GetterSetter.cpp:
2618 * runtime/GetterSetter.h:
2620 * runtime/PropertySlot.cpp:
2621 (JSC::PropertySlot::getPureResult):
2622 * runtime/PropertySlot.h:
2623 * runtime/ProxyObject.cpp:
2624 (JSC::ProxyObject::getOwnPropertySlotCommon):
2625 * tests/stress/try-get-by-id.js: Added.
2627 (getCaller.obj.1.throw.new.Error.let.func):
2628 (getCaller.obj.1.throw.new.Error):
2629 (throw.new.Error.get let):
2631 (throw.new.Error.let.get createBuiltin):
2633 (let.get createBuiltin):
2638 2016-04-07 Filip Pizlo <fpizlo@apple.com>
2640 Rationalize the makeSpaceForCCall stuff
2641 https://bugs.webkit.org/show_bug.cgi?id=156352
2643 Reviewed by Mark Lam.
2645 I want to add more code to PolymorphicAccess that makes C calls, so that I can finally fix
2646 https://bugs.webkit.org/show_bug.cgi?id=130914 (allow transition caches to handle indexing
2649 When trying to understand what it takes to make a C call, I came across code that was making
2650 room on the stack for spilled arguments. This logic was guarded with some complicated
2651 condition. At first, I tried to just refactor the code so that the same ugly condition
2652 wouldn't have to be copy-pasted everywhere that we made C calls. But then I started thinking
2653 about the condition, and realized that it was probably wrong: if the outer PolymorphicAccess
2654 harness decides to reuse a register for the scratchGPR then the top of the stack will store
2655 the old value of scratchGPR, but the condition wouldn't necessarily trigger. So if the call
2656 then overwrote something on the stack, we'd have a bad time.
2658 Making room on the stack for a call is a cheap operation. It's orders of magnitude cheaper
2659 than the rest of the call. Therefore, I think that it's best to just unconditionally make
2662 This patch makes us do just that. I also made the relevant helpers not inline, because I
2663 think that we have too many inline methods in our assemblers. Now it's much easier to make
2664 C calls from PolymorphicAccess because you just call the AssemblyHelper methods for making
2665 space. There are no special conditions or anything like that.
2667 * bytecode/PolymorphicAccess.cpp:
2668 (JSC::AccessCase::generate):
2669 * jit/AssemblyHelpers.cpp:
2670 (JSC::AssemblyHelpers::emitLoadStructure):
2671 (JSC::AssemblyHelpers::makeSpaceOnStackForCCall):
2672 (JSC::AssemblyHelpers::reclaimSpaceOnStackForCCall):
2673 (JSC::emitRandomThunkImpl):
2674 * jit/AssemblyHelpers.h:
2675 (JSC::AssemblyHelpers::makeSpaceOnStackForCCall): Deleted.
2676 (JSC::AssemblyHelpers::reclaimSpaceOnStackForCCall): Deleted.
2678 2016-04-07 Commit Queue <commit-queue@webkit.org>
2680 Unreviewed, rolling out r199128 and r199141.
2681 https://bugs.webkit.org/show_bug.cgi?id=156348
2683 Causes crashes on multiple webpages (Requested by keith_mi_ on
2686 Reverted changesets:
2688 "[ES6] Add support for Symbol.isConcatSpreadable."
2689 https://bugs.webkit.org/show_bug.cgi?id=155351
2690 http://trac.webkit.org/changeset/199128
2692 "Unreviewed, uncomment accidentally commented line in test."
2693 http://trac.webkit.org/changeset/199141
2695 2016-04-07 Filip Pizlo <fpizlo@apple.com>
2697 Rationalize the handling of PutById transitions a bit
2698 https://bugs.webkit.org/show_bug.cgi?id=156330
2700 Reviewed by Mark Lam.
2702 * bytecode/PolymorphicAccess.cpp:
2703 (JSC::AccessCase::generate): Get rid of the specialized slow calls. We can just use the failAndIgnore jump target. We just need to make sure that we don't make observable effects until we're done with all of the fast path checks.
2704 * bytecode/StructureStubInfo.cpp:
2705 (JSC::StructureStubInfo::addAccessCase): MadeNoChanges indicates that we should keep trying to repatch. Currently PutById transitions might trigger the case that addAccessCase() sees null, if the transition involves an indexing header. Doing repatching in that case is probably not good. But, we should just fix this the right way eventually.
2707 2016-04-07 Per Arne Vollan <peavo@outlook.com>
2709 [Win] Fix for JSC stress test failures.
2710 https://bugs.webkit.org/show_bug.cgi?id=156343
2712 Reviewed by Filip Pizlo.
2714 We need to make it clear to MSVC that the method loadPtr(ImplicitAddress address, RegisterID dest)
2715 should be used, and not loadPtr(const void* address, RegisterID dest).
2717 * jit/CCallHelpers.cpp:
2718 (JSC::CCallHelpers::setupShadowChickenPacket):
2720 2016-04-06 Benjamin Poulain <bpoulain@apple.com>
2722 [JSC] UInt32ToNumber should be NodeMustGenerate
2723 https://bugs.webkit.org/show_bug.cgi?id=156329
2725 Reviewed by Filip Pizlo.
2727 It exits on negative numbers on the integer path.
2729 * dfg/DFGFixupPhase.cpp:
2730 (JSC::DFG::FixupPhase::fixupNode):
2731 * dfg/DFGNodeType.h:
2733 2016-04-04 Geoffrey Garen <ggaren@apple.com>
2735 Unreviewed, rolling out r199016.
2736 https://bugs.webkit.org/show_bug.cgi?id=156140
2738 "Perf bots are down, so I can't re-land this right now."
2742 CopiedBlock should be 16kB
2743 https://bugs.webkit.org/show_bug.cgi?id=156168
2744 http://trac.webkit.org/changeset/199016
2746 2016-04-06 Mark Lam <mark.lam@apple.com>
2748 String.prototype.match() should be calling internal function RegExpCreate.
2749 https://bugs.webkit.org/show_bug.cgi?id=156318
2751 Reviewed by Filip Pizlo.
2753 RegExpCreate is not the same as the RegExp constructor. The current implementation
2754 invokes new @RegExp which calls the constructor. This results in failures in
2755 es6/Proxy_internal_get_calls_String.prototype.match.js, and
2756 es6/Proxy_internal_get_calls_String.prototype.search.js due to observable side
2759 This patch fixes this by factoring out the part of the RegExp constructor that
2760 makes the RegExpCreate function, and changing String's match and search to call
2761 RegExpCreate instead in accordance with the ES6 spec.
2763 * builtins/StringPrototype.js:
2766 * runtime/CommonIdentifiers.h:
2767 * runtime/JSGlobalObject.cpp:
2768 (JSC::JSGlobalObject::init):
2769 * runtime/RegExpConstructor.cpp:
2771 (JSC::regExpCreate):
2772 (JSC::constructRegExp):
2773 (JSC::esSpecRegExpCreate):
2774 (JSC::constructWithRegExpConstructor):
2775 * runtime/RegExpConstructor.h:
2778 2016-04-06 Keith Miller <keith_miller@apple.com>
2780 Unreviewed, uncomment accidentally commented line in test.
2782 * tests/stress/array-concat-spread-object.js:
2784 2016-04-06 Filip Pizlo <fpizlo@apple.com>
2786 JSC should have a simple way of gathering IC statistics
2787 https://bugs.webkit.org/show_bug.cgi?id=156317
2789 Reviewed by Benjamin Poulain.
2791 This adds a cheap, runtime-enabled way of gathering statistics about why we take the slow
2792 paths for inline caches. This is complementary to our existing bytecode profiler. Eventually
2793 we may want to combine the two things.
2795 This is not a slow-down on anything because we only do extra work on IC slow paths and if
2796 it's disabled it's just a load-and-branch to skip the stats gathering code.
2799 * JavaScriptCore.xcodeproj/project.pbxproj:
2800 * jit/ICStats.cpp: Added.
2801 * jit/ICStats.h: Added.
2802 * jit/JITOperations.cpp:
2803 * runtime/JSCJSValue.h:
2804 * runtime/JSCJSValueInlines.h:
2805 (JSC::JSValue::inherits):
2806 (JSC::JSValue::classInfoOrNull):
2807 (JSC::JSValue::toThis):
2808 * runtime/Options.h:
2810 2016-04-06 Filip Pizlo <fpizlo@apple.com>
2812 32-bit JSC stress/multi-put-by-offset-multiple-transitions.js failing
2813 https://bugs.webkit.org/show_bug.cgi?id=156292
2815 Reviewed by Benjamin Poulain.
2817 Make sure that we stash the callsite index before calling operationReallocateStorageAndFinishPut.
2819 * bytecode/PolymorphicAccess.cpp:
2820 (JSC::AccessCase::generate):
2822 2016-04-06 Filip Pizlo <fpizlo@apple.com>
2824 JSC test stress/arrowfunction-lexical-bind-superproperty.js failing
2825 https://bugs.webkit.org/show_bug.cgi?id=156309
2827 Reviewed by Saam Barati.
2829 Just be honest about the fact that the ArgumentCount and Callee parts of inline callframe runtime
2830 meta-data can be read at any time.
2832 We only have to say this for the inline callframe forms of ArgumentCount and Callee because we don't
2833 sink any part of the machine prologue. This change just prevents us from sinking the pseudoprologue
2834 of inlined varargs or closure calls.
2836 Shockingly, this is not a regression on anything.
2838 * dfg/DFGClobberize.h:
2839 (JSC::DFG::clobberize):
2841 2016-03-29 Keith Miller <keith_miller@apple.com>
2843 [ES6] Add support for Symbol.isConcatSpreadable.
2844 https://bugs.webkit.org/show_bug.cgi?id=155351
2846 Reviewed by Saam Barati.
2848 This patch adds support for Symbol.isConcatSpreadable. In order to do so it was necessary to move the
2849 Array.prototype.concat function to JS. A number of different optimizations were needed to make such the move to
2850 a builtin performant. First, four new DFG intrinsics were added.
2852 1) IsArrayObject (I would have called it IsArray but we use the same name for an IndexingType): an intrinsic of
2853 the Array.isArray function.
2854 2) IsJSArray: checks the first child is a JSArray object.
2855 3) IsArrayConstructor: checks the first child is an instance of ArrayConstructor.
2856 4) CallObjectConstructor: an intrinsic of the Object constructor.
2858 IsActualObject, IsJSArray, and CallObjectConstructor can all be converted into constants in the abstract interpreter if
2859 we are able to prove that the first child is an Array or for ToObject an Object.
2861 In order to further improve the perfomance we also now cover more indexing types in our fast path memcpy
2862 code. Before we would only memcpy Arrays if they had the same indexing type and did not have Array storage and
2863 were not undecided. Now the memcpy code covers the following additional two cases: One array is undecided and
2864 the other is a non-array storage and the case where one array is Int32 and the other is contiguous (we map this
2865 into a contiguous array).
2867 This patch also adds a new fast path for concat with more than one array argument by using memcpy to append
2868 values onto the result array. This works roughly the same as the two array fast path using the same methodology
2869 to decide if we can memcpy the other butterfly into the result butterfly.
2871 Two new debugging tools are also added to the jsc cli. One is a version of the print function with a private
2872 name so it can be used for debugging builtins. The other is dumpDataLog, which takes a JSValue and runs our
2873 dataLog function on it.
2875 Finally, this patch add a new constructor to JSValueRegsTemporary that allows it to reuse the the registers of a
2876 JSValueOperand if the operand's use count is one.
2878 * JavaScriptCore.xcodeproj/project.pbxproj:
2879 * builtins/ArrayPrototype.js:
2882 * bytecode/BytecodeIntrinsicRegistry.cpp:
2883 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
2884 * bytecode/BytecodeIntrinsicRegistry.h:
2885 * dfg/DFGAbstractInterpreterInlines.h:
2886 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2887 * dfg/DFGByteCodeParser.cpp:
2888 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
2889 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
2890 * dfg/DFGClobberize.h:
2891 (JSC::DFG::clobberize):
2892 * dfg/DFGDoesGC.cpp:
2894 * dfg/DFGFixupPhase.cpp:
2895 (JSC::DFG::FixupPhase::fixupNode):
2896 * dfg/DFGNodeType.h:
2897 * dfg/DFGOperations.cpp:
2898 * dfg/DFGOperations.h:
2899 * dfg/DFGPredictionPropagationPhase.cpp:
2900 (JSC::DFG::PredictionPropagationPhase::propagate):
2901 * dfg/DFGSafeToExecute.h:
2902 (JSC::DFG::safeToExecute):
2903 * dfg/DFGSpeculativeJIT.cpp:
2904 (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
2905 (JSC::DFG::SpeculativeJIT::compileIsJSArray):
2906 (JSC::DFG::SpeculativeJIT::compileIsArrayObject):
2907 (JSC::DFG::SpeculativeJIT::compileIsArrayConstructor):
2908 (JSC::DFG::SpeculativeJIT::compileCallObjectConstructor):
2909 * dfg/DFGSpeculativeJIT.h:
2910 (JSC::DFG::SpeculativeJIT::callOperation):
2911 * dfg/DFGSpeculativeJIT32_64.cpp:
2912 (JSC::DFG::SpeculativeJIT::compile):
2913 * dfg/DFGSpeculativeJIT64.cpp:
2914 (JSC::DFG::SpeculativeJIT::compile):
2915 * ftl/FTLCapabilities.cpp:
2916 (JSC::FTL::canCompile):
2917 * ftl/FTLLowerDFGToB3.cpp:
2918 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
2919 (JSC::FTL::DFG::LowerDFGToB3::compileCallObjectConstructor):
2920 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayObject):
2921 (JSC::FTL::DFG::LowerDFGToB3::compileIsJSArray):
2922 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayConstructor):
2923 (JSC::FTL::DFG::LowerDFGToB3::isArray):
2924 * jit/JITOperations.h:
2926 (WTF::RuntimeArray::createStructure):
2927 (GlobalObject::finishCreation):
2929 (functionDataLogValue):
2930 * runtime/ArrayConstructor.cpp:
2931 (JSC::ArrayConstructor::finishCreation):
2932 (JSC::arrayConstructorPrivateFuncIsArrayConstructor):
2933 * runtime/ArrayConstructor.h:
2934 (JSC::isArrayConstructor):
2935 * runtime/ArrayPrototype.cpp:
2936 (JSC::ArrayPrototype::finishCreation):
2937 (JSC::arrayProtoPrivateFuncIsJSArray):
2938 (JSC::moveElements):
2939 (JSC::arrayProtoPrivateFuncConcatMemcpy):
2940 (JSC::arrayProtoPrivateFuncAppendMemcpy):
2941 (JSC::arrayProtoFuncConcat): Deleted.
2942 * runtime/ArrayPrototype.h:
2943 (JSC::ArrayPrototype::createStructure):
2944 * runtime/CommonIdentifiers.h:
2945 * runtime/Intrinsic.h:
2946 * runtime/JSArray.cpp:
2947 (JSC::JSArray::appendMemcpy):
2948 (JSC::JSArray::fastConcatWith): Deleted.
2949 * runtime/JSArray.h:
2950 (JSC::JSArray::createStructure):
2951 (JSC::JSArray::fastConcatType): Deleted.
2952 * runtime/JSArrayInlines.h: Added.
2953 (JSC::JSArray::memCopyWithIndexingType):
2954 (JSC::JSArray::canFastCopy):
2955 * runtime/JSGlobalObject.cpp:
2956 (JSC::JSGlobalObject::init):
2958 * runtime/ObjectConstructor.h:
2959 (JSC::constructObject):
2961 * tests/stress/array-concat-spread-object.js: Added.
2963 * tests/stress/array-concat-spread-proxy-exception-check.js: Added.
2965 * tests/stress/array-concat-spread-proxy.js: Added.
2967 * tests/stress/array-concat-with-slow-indexingtypes.js: Added.
2969 * tests/stress/array-species-config-array-constructor.js:
2971 2016-04-06 Commit Queue <commit-queue@webkit.org>
2973 Unreviewed, rolling out r199070.
2974 https://bugs.webkit.org/show_bug.cgi?id=156324
2976 "It didn't fix the timeout" (Requested by saamyjoon on
2981 "jsc-layout-tests.yaml/js/script-tests/regress-141098.js
2982 failing on Yosemite Debug after r198989"
2983 https://bugs.webkit.org/show_bug.cgi?id=156187
2984 http://trac.webkit.org/changeset/199070
2986 2016-04-06 Geoffrey Garen <ggaren@apple.com>
2988 Unreviewed, rolling in r199016.
2989 https://bugs.webkit.org/show_bug.cgi?id=156140
2991 It might work this time without regression because 16kB aligned requests
2992 now take the allocation fast path.
2996 CopiedBlock should be 16kB
2997 https://bugs.webkit.org/show_bug.cgi?id=156168
2998 http://trac.webkit.org/changeset/199016
3000 2016-04-06 Mark Lam <mark.lam@apple.com>
3002 Update es6.yaml to expect es6/Proxy_internal_get_calls_RegExp_constructor.js to pass.
3003 https://bugs.webkit.org/show_bug.cgi?id=156314
3005 Reviewed by Saam Barati.
3009 2016-04-06 Commit Queue <commit-queue@webkit.org>
3011 Unreviewed, rolling out r199104.
3012 https://bugs.webkit.org/show_bug.cgi?id=156301
3014 Still breaks internal builds (Requested by keith_miller on
3019 "We should support the ability to do a non-effectful getById"
3020 https://bugs.webkit.org/show_bug.cgi?id=156116
3021 http://trac.webkit.org/changeset/199104
3023 2016-04-06 Keith Miller <keith_miller@apple.com>
3025 RegExp constructor should use Symbol.match and other properties
3026 https://bugs.webkit.org/show_bug.cgi?id=155873
3028 Reviewed by Michael Saboff.
3030 This patch updates the behavior of the RegExp constructor. Now the constructor
3031 should get the Symbol.match property and check if it exists to decide if something
3032 should be constructed like a regexp object.
3034 * runtime/RegExpConstructor.cpp:
3036 (JSC::constructRegExp):
3037 (JSC::constructWithRegExpConstructor):
3038 (JSC::callRegExpConstructor):
3039 * runtime/RegExpConstructor.h:
3040 * tests/stress/regexp-constructor.js: Added.
3042 (throw.new.Error.get let):
3044 (throw.new.Error.get re):
3046 2016-04-06 Keith Miller <keith_miller@apple.com>
3048 We should support the ability to do a non-effectful getById
3049 https://bugs.webkit.org/show_bug.cgi?id=156116
3051 Reviewed by Benjamin Poulain.
3053 Currently, there is no way in JS to do a non-effectful getById. A non-effectful getById is
3054 useful because it enables us to take different code paths based on values that we would
3055 otherwise not be able to have knowledge of. This patch adds this new feature called
3056 try_get_by_id that will attempt to do as much of a get_by_id as possible without performing
3057 an effectful behavior. Thus, try_get_by_id will return the value if the slot is a value, the
3058 GetterSetter object if the slot is a normal accessor (not a CustomGetterSetter) and
3059 undefined if the slot is unset. If the slot is proxied or any other cases then the result
3060 is null. In theory, if we ever wanted to check for null we could add a sentinal object to
3061 the global object that indicates we could not get the result.
3063 In order to implement this feature we add a new enum GetByIdKind that indicates what to do
3064 for accessor properties in PolymorphicAccess. If the GetByIdKind is pure then we treat the
3065 get_by_id the same way we would for load and return the value at the appropriate offset.
3066 Additionally, in order to make sure the we can properly compare the GetterSetter object
3067 with === GetterSetters are now JSObjects. This comes at the cost of eight extra bytes on the
3068 GetterSetter object but it vastly simplifies the patch. Additionally, the extra bytes are
3069 likely to have little to no impact on memory usage as normal accessors are generally rare.
3071 * builtins/BuiltinExecutables.cpp:
3072 (JSC::BuiltinExecutables::createDefaultConstructor):
3073 (JSC::BuiltinExecutables::createBuiltinExecutable):
3074 (JSC::createBuiltinExecutable):
3075 (JSC::BuiltinExecutables::createExecutable):
3076 (JSC::createExecutableInternal): Deleted.
3077 * builtins/BuiltinExecutables.h:
3078 * bytecode/BytecodeIntrinsicRegistry.h:
3079 * bytecode/BytecodeList.json:
3080 * bytecode/BytecodeUseDef.h:
3081 (JSC::computeUsesForBytecodeOffset):
3082 (JSC::computeDefsForBytecodeOffset):
3083 * bytecode/CodeBlock.cpp:
3084 (JSC::CodeBlock::dumpBytecode):
3085 * bytecode/PolymorphicAccess.cpp:
3086 (JSC::AccessCase::tryGet):
3087 (JSC::AccessCase::generate):
3088 (WTF::printInternal):
3089 * bytecode/PolymorphicAccess.h:
3090 (JSC::AccessCase::isGet): Deleted.
3091 (JSC::AccessCase::isPut): Deleted.
3092 (JSC::AccessCase::isIn): Deleted.
3093 * bytecode/StructureStubInfo.cpp:
3094 (JSC::StructureStubInfo::reset):
3095 * bytecode/StructureStubInfo.h:
3096 * bytecompiler/BytecodeGenerator.cpp:
3097 (JSC::BytecodeGenerator::emitTryGetById):
3098 * bytecompiler/BytecodeGenerator.h:
3099 * bytecompiler/NodesCodegen.cpp:
3100 (JSC::BytecodeIntrinsicNode::emit_intrinsic_tryGetById):
3101 * dfg/DFGSpeculativeJIT32_64.cpp:
3102 (JSC::DFG::SpeculativeJIT::cachedGetById):
3103 * dfg/DFGSpeculativeJIT64.cpp:
3104 (JSC::DFG::SpeculativeJIT::cachedGetById):
3105 * ftl/FTLLowerDFGToB3.cpp:
3106 (JSC::FTL::DFG::LowerDFGToB3::getById):
3108 (JSC::JIT::privateCompileMainPass):
3109 (JSC::JIT::privateCompileSlowCases):
3111 * jit/JITInlineCacheGenerator.cpp:
3112 (JSC::JITGetByIdGenerator::JITGetByIdGenerator):
3113 * jit/JITInlineCacheGenerator.h:
3115 (JSC::JIT::callOperation):
3116 * jit/JITOperations.cpp:
3117 * jit/JITOperations.h:
3118 * jit/JITPropertyAccess.cpp:
3119 (JSC::JIT::emitGetByValWithCachedId):
3120 (JSC::JIT::emit_op_try_get_by_id):
3121 (JSC::JIT::emitSlow_op_try_get_by_id):
3122 (JSC::JIT::emit_op_get_by_id):
3123 * jit/JITPropertyAccess32_64.cpp:
3124 (JSC::JIT::emitGetByValWithCachedId):
3125 (JSC::JIT::emit_op_try_get_by_id):
3126 (JSC::JIT::emitSlow_op_try_get_by_id):
3127 (JSC::JIT::emit_op_get_by_id):
3129 (JSC::repatchByIdSelfAccess):
3130 (JSC::appropriateOptimizingGetByIdFunction):
3131 (JSC::appropriateGenericGetByIdFunction):
3132 (JSC::tryCacheGetByID):
3133 (JSC::repatchGetByID):
3134 (JSC::resetGetByID):
3137 (GlobalObject::finishCreation):
3138 (functionGetGetterSetter):
3139 (functionCreateBuiltin):
3140 * llint/LLIntData.cpp:
3141 (JSC::LLInt::Data::performAssertions):
3142 * llint/LLIntSlowPaths.cpp:
3143 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
3144 * llint/LLIntSlowPaths.h:
3145 * llint/LowLevelInterpreter.asm:
3146 * runtime/GetterSetter.cpp:
3147 * runtime/GetterSetter.h:
3149 * runtime/PropertySlot.cpp:
3150 (JSC::PropertySlot::getPureResult):
3151 * runtime/PropertySlot.h:
3152 * runtime/ProxyObject.cpp:
3153 (JSC::ProxyObject::getOwnPropertySlotCommon):
3154 * tests/stress/try-get-by-id.js: Added.
3156 (getCaller.obj.1.throw.new.Error.let.func):
3157 (getCaller.obj.1.throw.new.Error):
3158 (throw.new.Error.get let):
3160 (throw.new.Error.let.get createBuiltin):
3162 (let.get createBuiltin):
3167 2016-04-05 Chris Dumez <cdumez@apple.com>
3169 Add support for [EnabledAtRuntime] operations on DOMWindow
3170 https://bugs.webkit.org/show_bug.cgi?id=156272
3172 Reviewed by Alex Christensen.
3174 Add identifier for 'fetch' so it can be used from the generated
3177 * runtime/CommonIdentifiers.h:
3179 2016-04-05 Alex Christensen <achristensen@webkit.org>
3181 Make CMake-generated binaries on Mac able to run
3182 https://bugs.webkit.org/show_bug.cgi?id=156268
3184 Reviewed by Daniel Bates.
3188 2016-04-05 Filip Pizlo <fpizlo@apple.com>
3190 Improve some other cases of context-sensitive inlining
3191 https://bugs.webkit.org/show_bug.cgi?id=156277
3193 Reviewed by Benjamin Poulain.
3195 This implements some improvements for inlining:
3197 - We no longer do guarded inlining when the profiling doesn't come from a stub. Doing so would have
3198 been risky, and according to benchmarks, it wasn't common enough to matter. I think it's better to
3199 err on the side of not inlining.
3201 - The jneq_ptr pattern for variadic calls no longer breaks the basic block. Not breaking the block
3202 increases the chances of the parser seeing the callee constant. While inlining doesn't require a
3203 callee constant, sometimes it makes a difference. Note that we were previously breaking the block
3204 for no reason at all: if the boundary after jneq_ptr is a jump target from some other jump, then
3205 the parser will automatically break the block for us. There is no reason to add any block breaking
3206 ourselves since we implement jneq_ptr by ignoring the affirmative jump destination and inserting a
3207 check and falling through.
3209 - get_by_id handling now tries to apply some common sense to its status object. In particular, if
3210 the source is a NewObject and there was no interfering operation that could clobber the structure,
3211 then we know which case of a polymorphic GetByIdStatus we would take. This arises in some
3212 constructor patterns.
3214 Long term, we should address all of these cases comprehensively by having a late inliner. The inliner
3215 being part of the bytecode parser means that there is a lot of complexity in the parser and it
3216 prevents us from inlining upon learning new information from static analysis. But for now, I think
3217 it's fine to experiment with one-off hacks, if only to learn what the possibilities are.
3219 This is a 14% speed-up on Octane/raytrace.
3221 * bytecode/CallLinkStatus.cpp:
3222 (JSC::CallLinkStatus::dump):
3223 * bytecode/CallLinkStatus.h:
3224 (JSC::CallLinkStatus::couldTakeSlowPath):
3225 (JSC::CallLinkStatus::setCouldTakeSlowPath):
3226 (JSC::CallLinkStatus::variants):
3227 (JSC::CallLinkStatus::size):
3228 (JSC::CallLinkStatus::at):
3229 * bytecode/GetByIdStatus.cpp:
3230 (JSC::GetByIdStatus::makesCalls):
3231 (JSC::GetByIdStatus::filter):
3232 (JSC::GetByIdStatus::dump):
3233 * bytecode/GetByIdStatus.h:
3234 (JSC::GetByIdStatus::wasSeenInJIT):
3235 * dfg/DFGByteCodeParser.cpp:
3236 (JSC::DFG::ByteCodeParser::handleCall):
3237 (JSC::DFG::ByteCodeParser::refineStatically):
3238 (JSC::DFG::ByteCodeParser::handleVarargsCall):
3239 (JSC::DFG::ByteCodeParser::handleInlining):
3240 (JSC::DFG::ByteCodeParser::handleGetById):
3241 (JSC::DFG::ByteCodeParser::parseBlock):
3242 * runtime/Options.h:
3244 2016-04-05 Saam barati <sbarati@apple.com>
3246 JSC SamplingProfiler: Use a thread + sleep loop instead of WTF::WorkQueue for taking samples
3247 https://bugs.webkit.org/show_bug.cgi?id=154017
3249 Reviewed by Geoffrey Garen.
3251 By moving to an explicitly created seperate thread + sample-then-sleep
3252 loop, we can remove a lot of the crufty code around WorkQueue.
3253 We're also getting sample rates that are much closer to what we're
3254 asking the OS for. When the sampling handler was built off of WorkQueue,
3255 we'd often get sample rates much higher than the 1ms we asked for. On Kraken,
3256 we would average about 1.7ms sample rates, even though we'd ask for a 1ms rate.
3257 Now, on Kraken, we're getting about 1.2ms rates. Because we're getting
3258 higher rates, this patch is a performance regression. It's slower because
3259 we're sampling more frequently.
3261 Before this patch, the sampling profiler had the following overhead:
3266 With this patch, the sampling profiler has the following overhead:
3271 Comparatively, this new patch has the following overhead over the old sampling profiler:
3274 - 13% slower on AsmBench
3276 * inspector/agents/InspectorScriptProfilerAgent.cpp:
3277 (Inspector::InspectorScriptProfilerAgent::trackingComplete):
3278 * runtime/SamplingProfiler.cpp:
3279 (JSC::SamplingProfiler::SamplingProfiler):
3280 (JSC::SamplingProfiler::~SamplingProfiler):
3281 (JSC::SamplingProfiler::createThreadIfNecessary):
3282 (JSC::SamplingProfiler::timerLoop):
3283 (JSC::SamplingProfiler::takeSample):
3284 (JSC::tryGetBytecodeIndex):
3285 (JSC::SamplingProfiler::shutdown):
3286 (JSC::SamplingProfiler::start):
3287 (JSC::SamplingProfiler::pause):
3288 (JSC::SamplingProfiler::noticeCurrentThreadAsJSCExecutionThread):
3289 (JSC::SamplingProfiler::noticeJSLockAcquisition):
3290 (JSC::SamplingProfiler::noticeVMEntry):
3291 (JSC::SamplingProfiler::clearData):
3292 (JSC::SamplingProfiler::stop): Deleted.
3293 (JSC::SamplingProfiler::dispatchIfNecessary): Deleted.
3294 (JSC::SamplingProfiler::dispatchFunction): Deleted.
3295 * runtime/SamplingProfiler.h:
3296 (JSC::SamplingProfiler::setTimingInterval):
3297 (JSC::SamplingProfiler::setStopWatch):
3301 2016-04-05 Commit Queue <commit-queue@webkit.org>
3303 Unreviewed, rolling out r199073.
3304 https://bugs.webkit.org/show_bug.cgi?id=156261
3306 This change broke internal Mac builds (Requested by ryanhaddad
3311 "We should support the ability to do a non-effectful getById"
3312 https://bugs.webkit.org/show_bug.cgi?id=156116
3313 http://trac.webkit.org/changeset/199073
3315 2016-04-05 Youenn Fablet <youenn.fablet@crf.canon.fr>
3317 [Fetch API] Add a runtime flag to fetch API and related constructs
3318 https://bugs.webkit.org/show_bug.cgi?id=156113
3320 Reviewed by Alex Christensen.
3322 Add a fetch API runtime flag based on preferences.
3323 Disable fetch API by default.
3325 * runtime/CommonIdentifiers.h:
3327 2016-04-05 Filip Pizlo <fpizlo@apple.com>
3329 Unreviewed, fix cloop some more.
3331 * runtime/RegExpInlines.h:
3332 (JSC::RegExp::hasCodeFor):
3333 (JSC::RegExp::hasMatchOnlyCodeFor):
3335 2016-04-05 Filip Pizlo <fpizlo@apple.com>
3337 Unreviewed, fix cloop.
3339 * jit/CCallHelpers.cpp:
3341 2016-03-18 Filip Pizlo <fpizlo@apple.com>
3343 JSC should use a shadow stack version of CHICKEN so that debuggers have the option of retrieving tail-deleted frames
3344 https://bugs.webkit.org/show_bug.cgi?id=155598
3346 Reviewed by Saam Barati.
3348 JSC is the first JSVM to have proper tail calls. This means that error.stack and the
3349 debugger will appear to "delete" strict mode stack frames, if the call that this frame made
3350 was in tail position. This is exactly what functional programmers expect - they don't want
3351 the VM to waste resources on tail-deleted frames to ensure that it's legal to loop forever
3352 using tail calls. It's also something that non-functional programmers fear. It's not clear
3353 that tail-deleted frames would actually degrade the debugging experience, but the fear is
3354 real, so it's worthwhile to do something about it.
3356 It turns out that there is at least one tail call implementation that doesn't suffer from
3357 this problem. It implements proper tail calls in the sense that you won't run out of memory
3358 by tail-looping. It also has the power to show you tail-deleted frames in a backtrace, so
3359 long as you haven't yet run out of memory. It's called CHICKEN Scheme, and it's one of my