1 2016-05-03 Filip Pizlo <fpizlo@apple.com>
3 REGRESSION(r200383): Setting lazily initialized properties across frame boundaries crashes
4 https://bugs.webkit.org/show_bug.cgi?id=157333
6 Reviewed by Benjamin Poulain.
8 I forgot to add logic for lazy properties in putEntry(). It turns out that it's easy to
13 * runtime/PropertySlot.h:
15 2016-05-03 Filip Pizlo <fpizlo@apple.com>
17 References from code to Structures should be stronger than weak
18 https://bugs.webkit.org/show_bug.cgi?id=157324
22 If code refers to a Structure and the Structure dies, then previously we'd kill the code.
23 This makes sense because the Structure could be the only thing left referring to some global
26 But this also causes unnecessary churn. Sometimes there will be a structure that we just
27 haven't really done anything with recently and so it appears dead. The approach we use
28 elsewhere in our type inference is that the type that the code uses is general enough to
29 handle every past execution. Having the GC clear code when some Structure it uses dies means
30 that we forget that the code used that Structure. We'll either assume that the code is more
31 monomorphic than it really is (because after GC we patch in some other structure but not the
32 deleted one, so it looks like we only ever saw the new structure), or we'll assume that it's
33 crazier than it really is (because we'll remember that there had been some structure that
34 caused deletion, so we'll assume that deletions might happen in the future, so we'll use a
37 This change introduces a more nuanced policy: if it's cheap to mark a dead Structure then we
38 should mark it just so that all of the code that refers to it remembers that there had been
39 this exact Structure in the past. If the code often goes through different Structures then
40 we already have great mechanisms to realize that the code is nutty (namely, the
41 PolymorphicAccess size limit). But if the code just does this a handful of times then
42 remembering this old Structure is probably net good:
44 - It obeys the "handle all past executions" law.
45 - It preserves the history of the property access, allowing a precise measure of its past
47 - It makes the code ready to run fast if the user decides to use that Structure again.
48 Marking the Structure means it will stay in whatever property transition tables it was in,
49 so if the program does the same thing it did in the past, it will get this old Structure.
51 It looks like this is a progression in gbemu and it makes gbemu perform more
52 deterministically. Also, it seems that this makes JetStream run faster.
54 Over five in-browser runs of JetStream, here's what we see before and after:
58 229.23 +- 8.2523 230.70 +- 12.888
59 232.91 +- 15.638 239.04 +- 13.766
60 234.79 +- 12.760 236.32 +- 15.562
61 236.20 +- 23.125 242.02 +- 3.3865
62 237.22 +- 2.1929 237.23 +- 17.664
66 541.0 +- 135.8 481.7 +- 143.4
67 518.9 +- 15.65 508.1 +- 136.3
68 362.5 +- 0.8884 489.7 +- 101.4
69 470.7 +- 313.3 530.7 +- 11.49
70 418.7 +- 180.6 537.2 +- 6.514
72 Notice that there is plenty of noise before and after, but the noise is now far less severe.
73 After this change I did not see any runs like "470.7 +- 313.3" where the size of the
74 confidence interval (313.3 * 2) is greater than the score (470.7). Also, notice that the
75 least noisy run before the change also got a lower score than we ever observed after the
76 change (36.5 +- 0.8884). The noise, and these occasional very low scores, are due to a
77 pathology where the GC would reset some stubs at an unfortunate time during profiling,
78 causing the optimizing compiler to make many poor decisions. That pathology doesn't exist
81 On the other hand, prior to this change it was possible for gbemu to sometimes run sooooper
82 fast because the GC would cause the profiler to forget gbemu's behavior on the first tick
83 and focus only on its behavior in subsequent ticks. So, in steady state, we'd optimize gbemu
84 for its later behavior rather than a combination of its early behavior and later behavior.
85 We rarely got lucky this way, so it's not fair to view this quirk as a feature.
87 * bytecode/CodeBlock.cpp:
88 (JSC::CodeBlock::propagateTransitions):
89 * bytecode/PolymorphicAccess.cpp:
90 (JSC::AccessCase::visitWeak):
91 (JSC::AccessCase::propagateTransitions):
92 (JSC::AccessCase::generateWithGuard):
93 (JSC::PolymorphicAccess::visitWeak):
94 (JSC::PolymorphicAccess::propagateTransitions):
95 (JSC::PolymorphicAccess::dump):
96 * bytecode/PolymorphicAccess.h:
97 * bytecode/StructureStubInfo.cpp:
98 (JSC::StructureStubInfo::visitWeakReferences):
99 (JSC::StructureStubInfo::propagateTransitions):
100 (JSC::StructureStubInfo::containsPC):
101 * bytecode/StructureStubInfo.h:
102 (JSC::StructureStubInfo::considerCaching):
103 * runtime/Structure.cpp:
104 (JSC::Structure::visitChildren):
105 (JSC::Structure::isCheapDuringGC):
106 (JSC::Structure::markIfCheap):
107 (JSC::Structure::prototypeChainMayInterceptStoreTo):
108 * runtime/Structure.h:
110 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
112 Web Inspector: Simplify console.clear
113 https://bugs.webkit.org/show_bug.cgi?id=157316
115 Reviewed by Timothy Hatcher.
117 * inspector/ScriptArguments.cpp:
118 (Inspector::ScriptArguments::createEmpty):
119 (Inspector::ScriptArguments::ScriptArguments):
120 * inspector/ScriptArguments.h:
121 Provide a way to create an empty list.
123 * runtime/ConsoleClient.cpp:
124 (JSC::ConsoleClient::clear):
125 * runtime/ConsoleClient.h:
126 Drop unnecessary parameter.
128 * runtime/ConsoleObject.cpp:
129 (JSC::consoleProtoFuncClear):
130 No need to parse arguments.
132 2016-05-03 Yusuke Suzuki <utatane.tea@gmail.com>
134 Improve Symbol() to string coercion error message
135 https://bugs.webkit.org/show_bug.cgi?id=157317
137 Reviewed by Geoffrey Garen.
139 Improve error messages related to Symbols.
141 * runtime/JSCJSValue.cpp:
142 (JSC::JSValue::toStringSlowCase):
143 * runtime/Symbol.cpp:
144 (JSC::Symbol::toNumber):
145 * runtime/SymbolConstructor.cpp:
146 (JSC::symbolConstructorKeyFor):
147 * runtime/SymbolPrototype.cpp:
148 (JSC::symbolProtoFuncToString):
149 (JSC::symbolProtoFuncValueOf):
150 * tests/stress/dfg-to-primitive-pass-symbol.js:
151 * tests/stress/floating-point-div-to-mul.js:
153 * tests/stress/string-from-code-point.js:
155 (string_appeared_here.shouldThrow):
156 * tests/stress/symbol-error-messages.js: Added.
158 * tests/stress/symbol-registry.js:
160 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
162 Web Inspector: Give console.time/timeEnd a default label and warnings
163 https://bugs.webkit.org/show_bug.cgi?id=157325
164 <rdar://problem/26073290>
166 Reviewed by Timothy Hatcher.
168 Provide more user friendly console.time/timeEnd. The timer name
169 is now optional, and is "default" if not provided. Also provide
170 warnings when attempting to start an already started timer,
171 or stop a timer that does not exist.
173 * inspector/agents/InspectorConsoleAgent.cpp:
174 (Inspector::InspectorConsoleAgent::startTiming):
175 (Inspector::InspectorConsoleAgent::stopTiming):
176 Warnings for bad cases.
178 * runtime/ConsoleObject.cpp:
179 (JSC::defaultLabelString):
180 (JSC::consoleProtoFuncTime):
181 (JSC::consoleProtoFuncTimeEnd):
182 Optional label becomes "default".
184 2016-05-03 Xan Lopez <xlopez@igalia.com>
186 Fix the ENABLE(WEBASSEMBLY) build
187 https://bugs.webkit.org/show_bug.cgi?id=157312
189 Reviewed by Darin Adler.
191 * runtime/Executable.cpp:
192 (JSC::WebAssemblyExecutable::WebAssemblyExecutable):
193 * wasm/WASMFunctionCompiler.h:
194 (JSC::WASMFunctionCompiler::convertValueToDouble):
196 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
198 Web Inspector: Remove unused parameter of ScriptArguments::getFirstArgumentAsString
199 https://bugs.webkit.org/show_bug.cgi?id=157301
201 Reviewed by Timothy Hatcher.
203 * inspector/ScriptArguments.cpp:
204 (Inspector::ScriptArguments::getFirstArgumentAsString):
205 * inspector/ScriptArguments.h:
206 Remove unused argument and related code.
208 * runtime/ConsoleClient.cpp:
209 (JSC::ConsoleClient::printConsoleMessageWithArguments):
210 Drive by remove unnecessary cast.
212 2016-05-03 Michael Saboff <msaboff@apple.com>
214 Crash: Array.prototype.slice() and .splice() can call fastSlice() after an array is truncated
215 https://bugs.webkit.org/show_bug.cgi?id=157322
217 Reviewed by Filip Pizlo.
219 Check to see if the source array has changed length before calling fastSlice().
220 If it has, take the slow path.
222 * runtime/ArrayPrototype.cpp:
223 (JSC::arrayProtoFuncSlice):
224 (JSC::arrayProtoFuncSplice):
225 * tests/stress/regress-157322.js: New test.
227 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
229 Eliminate PassRefPtr conversion from ConsoleObject
230 https://bugs.webkit.org/show_bug.cgi?id=157300
232 Reviewed by Timothy Hatcher.
234 * runtime/ConsoleObject.cpp:
235 (JSC::consoleLogWithLevel):
236 (JSC::consoleProtoFuncClear):
237 (JSC::consoleProtoFuncDir):
238 (JSC::consoleProtoFuncDirXML):
239 (JSC::consoleProtoFuncTable):
240 (JSC::consoleProtoFuncTrace):
241 (JSC::consoleProtoFuncAssert):
242 (JSC::consoleProtoFuncCount):
243 (JSC::consoleProtoFuncTimeStamp):
244 (JSC::consoleProtoFuncGroup):
245 (JSC::consoleProtoFuncGroupCollapsed):
246 (JSC::consoleProtoFuncGroupEnd):
247 No need to release to a PassRefPtr, we can just move into the RefPtr<>&&.
249 2016-05-01 Filip Pizlo <fpizlo@apple.com>
251 Speed up JSGlobalObject initialization by making some properties lazy
252 https://bugs.webkit.org/show_bug.cgi?id=157045
254 Reviewed by Keith Miller.
256 This makes about half of JSGlobalObject's state lazy. There are three categories of
257 state in JSGlobalObject:
259 1) C++ fields in JSGlobalObject.
260 2) JS object properties in JSGlobalObject's JSObject superclass.
261 3) JS variables in JSGlobalObject's JSSegmentedVariableObject superclass.
263 State held in JS variables cannot yet be made lazy. That's why this patch only goes
266 State in JS object properties can be made lazy if we move it to the static property
267 hashtable. JSGlobalObject already had one of those. This patch makes static property
268 hashtables a lot more powerful, by adding three new kinds of static properties. These
269 new kinds allow us to make almost all of JSGlobalObject's object properties lazy.
271 State in C++ fields can now be made lazy thanks in part to WTF's support for stateless
272 lambdas. You can of course make anything lazy by hand, but there are many C++ fields in
273 JSGlobalObject and we are adding more all the time. We don't want to require that each
274 of these has a getter with an initialization check and a corresponding out-of-line slow
275 path that does the initialization. We want this kind of boilerplate to be handled by
278 The primary abstraction introduced in this patch is LazyProperty<Type>. Currently, this
279 only works where Type is a subclass of JSCell. Such a property holds a pointer to Type.
280 You can use it like you would a WriteBarrier<Type>. It even has set() and get() methods,
281 so it's almost a drop-in replacement.
283 The key to LazyProperty<Type>'s power is that you can do this:
287 LazyProperty<Foo> m_foo;
291 [] (const LazyProperty<Foo>::Initializer<Bar>& init) {
292 init.set(Foo::create(init.vm, init.owner));
295 This initLater() call requires that you pass a stateless lambda (see WTF changelog for
296 the definition). Miraculously, this initLater() call is guaranteed to compile to a store
297 of a pointer constant to m_foo, as in:
302 This magical pointer constant points to a callback that was generated by the template
303 instantiation of initLater(). That callback knows to call your stateless lambda, but
304 also does some other bookkeeping: it makes sure that you indeed initialized the property
305 inside the callback and it manages recursive initializations. It's totally legal to call
306 m_foo.get() inside the initLater() callback. If you do that before you call init.set(),
307 m_foo.get() will return null. This is an excellent escape hatch if we ever find
308 ourselves in a dependency cycle. I added this feature because I already had to create a
311 Note that using LazyProperties from DFG threads is super awkward. It's going to be hard
312 to get this right. The DFG thread cannot initialize those fields, so it has to make sure
313 that it does conservative things. But for some nodes this could mean adding a lot of new
314 logic, like NewTypedArray, which currently is written in such a way that it assumes that
315 we always have the typed array structure. Currently we take a two-fold approach: for
316 typed arrays we don't handle the NewTypedArray intrinsic if the structure isn't
317 initialized, and for everything else we don't make the properties lazy if the DFG needs
318 them. As we optimize this further we might need to teach the DFG to handle more lazy
319 properties. I tried to do this for RegExp but found it to be very confusing. With typed
322 There is also a somewhat more powerful construct called LazyClassStructure. We often
323 need to keep around the structure of some standard JS class, like Date. We also need to
324 make sure that the constructor ends up in the global object's property table. And we
325 often need to keep the original value of the constructor for ourselves. In this case, we
326 want to make sure that the creation of the structure-prototype-constructor constellation
327 is atomic. We don't want code to start looking at the structure if it points to a
328 prototype that doesn't have its "constructor" property set yet, for example.
329 LazyClassStructure solves this by abstracting that whole initialization. You provide the
330 callback that allocates everything, since we are super inconsistent about the way we
331 initialize things, but LazyClassStructure establishes the workflow and helps you not
334 Finally, the new static hashtable attributes allow for all of this to work with the JS
337 PropertyCallback: if you use this attribute, the second column in the table should be
338 the name of a function to call to initialize this property. This is useful for things
339 like the Math property. The Math object turns out to be very expensive to allocate.
340 Delaying its allocation is super easy with the PropertyCallback attribute.
342 CellProperty: with this attribute the second column should be a C++ field name like
343 JSGlobalObject::m_evalErrorConstructor. The static hashtable will grab the offset of
344 this property, and when it needs to be initialized, Lookup will assume you have a
345 LazyProperty<JSCell> and call its get() method. It will initialize the property to
346 whatever get() returned. Note that it's legal to cast a LazyProperty<Anything> to
347 LazyProperty<JSCell> for the purpose of calling get() because the get() method will just
348 call whatever callback function pointer is encoded in the property and it does not need
349 to know anything about what type that callback will instantiate.
351 ClassStructure: with this attribute the second column should be a C++ field name. The
352 static hashtable will initialize the property by treating the field as a
353 LazyClassStructure and it will call get(). LazyClassStructure completely owns the whole
354 initialization workflow, so Lookup assumes that when LazyClassStructure::get() returns,
355 the property in question will already be set. By convention, we have LazyClassStructure
356 initialize the property with a pointer to the constructor, since that's how all of our
357 classes work: "globalObject.Date" points to the DateConstructor.
359 This is a 2x speed-up in JSGlobalObject initialization time in a microbenchmark that
360 calls our C API. This is a 1% speed-up on SunSpider and JSRegress.
362 * API/JSCallbackFunction.cpp:
363 (JSC::JSCallbackFunction::create):
364 * API/ObjCCallbackFunction.h:
365 (JSC::ObjCCallbackFunction::impl):
366 * API/ObjCCallbackFunction.mm:
367 (JSC::ObjCCallbackFunction::ObjCCallbackFunction):
368 (JSC::ObjCCallbackFunction::create):
370 * JavaScriptCore.xcodeproj/project.pbxproj:
372 * dfg/DFGAbstractInterpreterInlines.h:
373 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
374 * dfg/DFGAbstractValue.cpp:
375 (JSC::DFG::AbstractValue::set):
376 * dfg/DFGArrayMode.cpp:
377 (JSC::DFG::ArrayMode::originalArrayStructure):
378 * dfg/DFGByteCodeParser.cpp:
379 (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor):
380 * dfg/DFGSpeculativeJIT.cpp:
381 (JSC::DFG::SpeculativeJIT::compileNewTypedArray):
382 * dfg/DFGSpeculativeJIT32_64.cpp:
383 (JSC::DFG::SpeculativeJIT::compile):
384 * dfg/DFGSpeculativeJIT64.cpp:
385 (JSC::DFG::SpeculativeJIT::compile):
386 * dfg/DFGStructureRegistrationPhase.cpp:
387 (JSC::DFG::StructureRegistrationPhase::run):
388 * ftl/FTLLowerDFGToB3.cpp:
389 (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
390 * runtime/ClonedArguments.cpp:
391 (JSC::ClonedArguments::getOwnPropertySlot):
392 (JSC::ClonedArguments::materializeSpecials):
393 * runtime/CommonSlowPaths.cpp:
394 (JSC::SLOW_PATH_DECL):
395 * runtime/FunctionPrototype.cpp:
396 (JSC::functionProtoFuncToString):
397 * runtime/InternalFunction.cpp:
398 (JSC::InternalFunction::visitChildren):
399 (JSC::InternalFunction::name):
400 (JSC::InternalFunction::calculatedDisplayName):
401 (JSC::InternalFunction::createSubclassStructure):
402 * runtime/InternalFunction.h:
403 * runtime/JSBoundFunction.cpp:
404 (JSC::JSBoundFunction::finishCreation):
405 (JSC::JSBoundFunction::visitChildren):
406 * runtime/JSFunction.cpp:
407 (JSC::JSFunction::getOwnPropertySlot):
408 (JSC::JSFunction::defineOwnProperty):
409 * runtime/JSGenericTypedArrayViewConstructorInlines.h:
410 (JSC::constructGenericTypedArrayView):
411 * runtime/JSGlobalObject.cpp:
412 (JSC::createProxyProperty):
413 (JSC::createJSONProperty):
414 (JSC::createMathProperty):
415 (JSC::JSGlobalObject::init):
416 (JSC::JSGlobalObject::stringPrototypeChainIsSane):
417 (JSC::JSGlobalObject::resetPrototype):
418 (JSC::JSGlobalObject::visitChildren):
419 (JSC::JSGlobalObject::toThis):
420 (JSC::JSGlobalObject::getOwnPropertySlot):
421 (JSC::JSGlobalObject::createThrowTypeError): Deleted.
422 * runtime/JSGlobalObject.h:
423 (JSC::JSGlobalObject::objectConstructor):
424 (JSC::JSGlobalObject::promiseConstructor):
425 (JSC::JSGlobalObject::internalPromiseConstructor):
426 (JSC::JSGlobalObject::evalErrorConstructor):
427 (JSC::JSGlobalObject::rangeErrorConstructor):
428 (JSC::JSGlobalObject::referenceErrorConstructor):
429 (JSC::JSGlobalObject::syntaxErrorConstructor):
430 (JSC::JSGlobalObject::typeErrorConstructor):
431 (JSC::JSGlobalObject::URIErrorConstructor):
432 (JSC::JSGlobalObject::nullGetterFunction):
433 (JSC::JSGlobalObject::nullSetterFunction):
434 (JSC::JSGlobalObject::callFunction):
435 (JSC::JSGlobalObject::applyFunction):
436 (JSC::JSGlobalObject::definePropertyFunction):
437 (JSC::JSGlobalObject::arrayProtoValuesFunction):
438 (JSC::JSGlobalObject::initializePromiseFunction):
439 (JSC::JSGlobalObject::newPromiseCapabilityFunction):
440 (JSC::JSGlobalObject::functionProtoHasInstanceSymbolFunction):
441 (JSC::JSGlobalObject::regExpProtoExecFunction):
442 (JSC::JSGlobalObject::regExpProtoSymbolReplaceFunction):
443 (JSC::JSGlobalObject::regExpProtoGlobalGetter):
444 (JSC::JSGlobalObject::regExpProtoUnicodeGetter):
445 (JSC::JSGlobalObject::throwTypeErrorGetterSetter):
446 (JSC::JSGlobalObject::moduleLoader):
447 (JSC::JSGlobalObject::objectPrototype):
448 (JSC::JSGlobalObject::functionPrototype):
449 (JSC::JSGlobalObject::arrayPrototype):
450 (JSC::JSGlobalObject::booleanPrototype):
451 (JSC::JSGlobalObject::stringPrototype):
452 (JSC::JSGlobalObject::symbolPrototype):
453 (JSC::JSGlobalObject::numberPrototype):
454 (JSC::JSGlobalObject::datePrototype):
455 (JSC::JSGlobalObject::regExpPrototype):
456 (JSC::JSGlobalObject::errorPrototype):
457 (JSC::JSGlobalObject::iteratorPrototype):
458 (JSC::JSGlobalObject::generatorFunctionPrototype):
459 (JSC::JSGlobalObject::generatorPrototype):
460 (JSC::JSGlobalObject::debuggerScopeStructure):
461 (JSC::JSGlobalObject::withScopeStructure):
462 (JSC::JSGlobalObject::strictEvalActivationStructure):
463 (JSC::JSGlobalObject::activationStructure):
464 (JSC::JSGlobalObject::moduleEnvironmentStructure):
465 (JSC::JSGlobalObject::directArgumentsStructure):
466 (JSC::JSGlobalObject::scopedArgumentsStructure):
467 (JSC::JSGlobalObject::clonedArgumentsStructure):
468 (JSC::JSGlobalObject::isOriginalArrayStructure):
469 (JSC::JSGlobalObject::booleanObjectStructure):
470 (JSC::JSGlobalObject::callbackConstructorStructure):
471 (JSC::JSGlobalObject::callbackFunctionStructure):
472 (JSC::JSGlobalObject::callbackObjectStructure):
473 (JSC::JSGlobalObject::propertyNameIteratorStructure):
474 (JSC::JSGlobalObject::objcCallbackFunctionStructure):
475 (JSC::JSGlobalObject::objcWrapperObjectStructure):
476 (JSC::JSGlobalObject::dateStructure):
477 (JSC::JSGlobalObject::nullPrototypeObjectStructure):
478 (JSC::JSGlobalObject::errorStructure):
479 (JSC::JSGlobalObject::calleeStructure):
480 (JSC::JSGlobalObject::functionStructure):
481 (JSC::JSGlobalObject::boundFunctionStructure):
482 (JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
483 (JSC::JSGlobalObject::getterSetterStructure):
484 (JSC::JSGlobalObject::nativeStdFunctionStructure):
485 (JSC::JSGlobalObject::namedFunctionStructure):
486 (JSC::JSGlobalObject::functionNameOffset):
487 (JSC::JSGlobalObject::numberObjectStructure):
488 (JSC::JSGlobalObject::privateNameStructure):
489 (JSC::JSGlobalObject::mapStructure):
490 (JSC::JSGlobalObject::regExpStructure):
491 (JSC::JSGlobalObject::generatorFunctionStructure):
492 (JSC::JSGlobalObject::setStructure):
493 (JSC::JSGlobalObject::stringObjectStructure):
494 (JSC::JSGlobalObject::symbolObjectStructure):
495 (JSC::JSGlobalObject::iteratorResultObjectStructure):
496 (JSC::JSGlobalObject::lazyTypedArrayStructure):
497 (JSC::JSGlobalObject::typedArrayStructure):
498 (JSC::JSGlobalObject::typedArrayStructureConcurrently):
499 (JSC::JSGlobalObject::isOriginalTypedArrayStructure):
500 (JSC::JSGlobalObject::typedArrayConstructor):
501 (JSC::JSGlobalObject::actualPointerFor):
502 (JSC::JSGlobalObject::internalFunctionStructure): Deleted.
503 * runtime/JSNativeStdFunction.cpp:
504 (JSC::JSNativeStdFunction::create):
505 * runtime/JSWithScope.cpp:
506 (JSC::JSWithScope::create):
507 (JSC::JSWithScope::visitChildren):
508 (JSC::JSWithScope::createStructure):
509 (JSC::JSWithScope::JSWithScope):
510 * runtime/JSWithScope.h:
511 (JSC::JSWithScope::object):
512 (JSC::JSWithScope::create): Deleted.
513 (JSC::JSWithScope::createStructure): Deleted.
514 (JSC::JSWithScope::JSWithScope): Deleted.
515 * runtime/LazyClassStructure.cpp: Added.
516 (JSC::LazyClassStructure::Initializer::Initializer):
517 (JSC::LazyClassStructure::Initializer::setPrototype):
518 (JSC::LazyClassStructure::Initializer::setStructure):
519 (JSC::LazyClassStructure::Initializer::setConstructor):
520 (JSC::LazyClassStructure::visit):
521 (JSC::LazyClassStructure::dump):
522 * runtime/LazyClassStructure.h: Added.
523 (JSC::LazyClassStructure::LazyClassStructure):
524 (JSC::LazyClassStructure::get):
525 (JSC::LazyClassStructure::prototype):
526 (JSC::LazyClassStructure::constructor):
527 (JSC::LazyClassStructure::getConcurrently):
528 (JSC::LazyClassStructure::prototypeConcurrently):
529 (JSC::LazyClassStructure::constructorConcurrently):
530 * runtime/LazyClassStructureInlines.h: Added.
531 (JSC::LazyClassStructure::initLater):
532 * runtime/LazyProperty.h: Added.
533 (JSC::LazyProperty::Initializer::Initializer):
534 (JSC::LazyProperty::LazyProperty):
535 (JSC::LazyProperty::get):
536 (JSC::LazyProperty::getConcurrently):
537 * runtime/LazyPropertyInlines.h: Added.
538 (JSC::LazyProperty<ElementType>::Initializer<OwnerType>::set):
539 (JSC::LazyProperty<ElementType>::initLater):
540 (JSC::LazyProperty<ElementType>::setMayBeNull):
541 (JSC::LazyProperty<ElementType>::set):
542 (JSC::LazyProperty<ElementType>::visit):
543 (JSC::LazyProperty<ElementType>::dump):
544 (JSC::LazyProperty<ElementType>::callFunc):
545 * runtime/Lookup.cpp:
546 (JSC::setUpStaticFunctionSlot):
548 (JSC::HashTableValue::function):
549 (JSC::HashTableValue::functionLength):
550 (JSC::HashTableValue::propertyGetter):
551 (JSC::HashTableValue::propertyPutter):
552 (JSC::HashTableValue::accessorGetter):
553 (JSC::HashTableValue::accessorSetter):
554 (JSC::HashTableValue::constantInteger):
555 (JSC::HashTableValue::lexerValue):
556 (JSC::HashTableValue::lazyCellPropertyOffset):
557 (JSC::HashTableValue::lazyClassStructureOffset):
558 (JSC::HashTableValue::lazyPropertyCallback):
559 (JSC::getStaticPropertySlot):
560 (JSC::getStaticValueSlot):
561 (JSC::reifyStaticProperty):
562 * runtime/PropertySlot.h:
563 * runtime/TypedArrayType.h:
565 2016-05-03 Per Arne Vollan <peavo@outlook.com>
567 [Win] Remove Windows XP Compatibility Requirements
568 https://bugs.webkit.org/show_bug.cgi?id=152899
570 Reviewed by Brent Fulgham.
572 Windows XP is not supported anymore, we can remove workarounds.
574 * JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp:
575 (enableTerminationOnHeapCorruption):
577 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
579 Web Inspector: console.assert should do far less work when the assertion is true
580 https://bugs.webkit.org/show_bug.cgi?id=157297
581 <rdar://problem/26056556>
583 Reviewed by Timothy Hatcher.
585 * runtime/ConsoleClient.h:
586 * runtime/ConsoleClient.cpp:
587 (JSC::ConsoleClient::assertion):
588 (JSC::ConsoleClient::assertCondition): Deleted.
589 Rename, now that this will only get called when the assertion failed.
591 * runtime/ConsoleObject.cpp:
592 (JSC::consoleProtoFuncAssert):
593 Avoid doing any work if the assertion succeeded.
595 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
597 Unreviewed follow-up testapi fix after r200355.
599 * runtime/JSGlobalObject.cpp:
600 (JSC::JSGlobalObject::init):
601 Revert back to non-enumerable. This matches our older behavior,
602 we can decide to make this Enumerable later if needed.
604 2016-05-02 Joseph Pecoraro <pecoraro@apple.com>
606 Web Inspector: Reflect.toString() should be [object Object] not [object Reflect]
607 https://bugs.webkit.org/show_bug.cgi?id=157288
609 Reviewed by Darin Adler.
611 * runtime/ReflectObject.cpp:
612 * tests/stress/reflect.js: Added.
614 2016-05-02 Jon Davis <jond@apple.com>
616 Add Resource Timing entry to the Feature Status page.
617 https://bugs.webkit.org/show_bug.cgi?id=157285
619 Reviewed by Timothy Hatcher.
623 2016-05-02 Joseph Pecoraro <pecoraro@apple.com>
625 Make console a namespace object (like Math/JSON), allowing functions to be called unbound
626 https://bugs.webkit.org/show_bug.cgi?id=157286
627 <rdar://problem/26052830>
629 Reviewed by Timothy Hatcher.
631 This changes `console` to be a global namespace object, like `Math` and `JSON`.
632 It just holds a bunch of functions, that can be used on their own, unbound.
633 For example, `[1,2,3].forEach(console.log)` and `var log = console.log; log(1)`
634 used to throw exceptions and now do not.
636 Previously console was an Object/Prototype pair, so functions were on
637 ConsolePrototype (console.__proto__.log) and they needed to be called
638 Console objects as the `this` value. Now, `console` is just a standard
639 object with a bunch of functions. Since there is no console prototype the
640 functions can be passed around and called as expected and they will
641 just do the right thing.
643 For compatability with other browsers, `console` was made enumerable
644 on the global object.
647 * JavaScriptCore.xcodeproj/project.pbxproj:
648 Add new files and remove old files.
650 * runtime/CommonIdentifiers.h:
653 * runtime/ConsoleObject.cpp: Renamed from Source/JavaScriptCore/runtime/ConsolePrototype.cpp.
654 (JSC::ConsoleObject::ConsoleObject):
655 (JSC::ConsoleObject::finishCreation):
656 (JSC::valueToStringWithUndefinedOrNullCheck):
657 (JSC::consoleLogWithLevel):
658 (JSC::consoleProtoFuncDebug):
659 (JSC::consoleProtoFuncError):
660 (JSC::consoleProtoFuncLog):
661 (JSC::consoleProtoFuncInfo):
662 (JSC::consoleProtoFuncWarn):
663 (JSC::consoleProtoFuncClear):
664 (JSC::consoleProtoFuncDir):
665 (JSC::consoleProtoFuncDirXML):
666 (JSC::consoleProtoFuncTable):
667 (JSC::consoleProtoFuncTrace):
668 (JSC::consoleProtoFuncAssert):
669 (JSC::consoleProtoFuncCount):
670 (JSC::consoleProtoFuncProfile):
671 (JSC::consoleProtoFuncProfileEnd):
672 (JSC::consoleProtoFuncTakeHeapSnapshot):
673 (JSC::consoleProtoFuncTime):
674 (JSC::consoleProtoFuncTimeEnd):
675 (JSC::consoleProtoFuncTimeStamp):
676 (JSC::consoleProtoFuncGroup):
677 (JSC::consoleProtoFuncGroupCollapsed):
678 (JSC::consoleProtoFuncGroupEnd):
679 Console functions no longer need to check if the this object is
680 a Console object. They will always just work now.
682 * runtime/MathObject.cpp:
683 * runtime/MathObject.h:
684 * runtime/ConsoleObject.h: Renamed from Source/JavaScriptCore/runtime/ConsolePrototype.h.
685 (JSC::ConsoleObject::create):
686 (JSC::ConsoleObject::createStructure):
687 ConsoleObject is a basic object like MathObject.
689 * runtime/JSConsole.cpp: Removed.
690 * runtime/JSConsole.h: Removed.
691 * runtime/JSGlobalObject.h:
692 * runtime/JSGlobalObject.cpp:
693 (JSC::JSGlobalObject::init):
694 (JSC::JSGlobalObject::visitChildren):
695 Remove JSConsole / ConsolePrototype in favor of the single ConsoleObject.
697 2016-05-02 Per Arne Vollan <peavo@outlook.com>
699 [Win] Clean up annoying compiler warnings
700 https://bugs.webkit.org/show_bug.cgi?id=149813
702 Reviewed by Alex Christensen.
704 * bytecode/PropertyCondition.cpp:
705 (JSC::PropertyCondition::isWatchableWhenValid):
706 * dfg/DFGObjectAllocationSinkingPhase.cpp:
707 * dfg/DFGSpeculativeJIT32_64.cpp:
708 (JSC::DFG::SpeculativeJIT::emitCall):
709 * inspector/InspectorBackendDispatcher.cpp:
710 (Inspector::BackendDispatcher::sendPendingErrors):
711 * jit/JITCall32_64.cpp:
712 (JSC::JIT::compileOpCall):
714 (JSC::Parser<LexerType>::parseAssignmentExpression):
715 * runtime/ClonedArguments.cpp:
716 (JSC::ClonedArguments::createWithInlineFrame):
718 (JSC::addErrorInfoAndGetBytecodeOffset):
719 * runtime/IntlNumberFormat.cpp:
720 (JSC::IntlNumberFormat::initializeNumberFormat):
721 * runtime/JSObject.cpp:
722 (JSC::JSObject::heapSnapshot):
723 (JSC::callToPrimitiveFunction):
724 * runtime/RegExpPrototype.cpp:
726 * runtime/SamplingProfiler.cpp:
727 (JSC::SamplingProfiler::StackFrame::functionStartColumn):
729 2016-05-02 Keith Miller <keith_miller@apple.com>
731 ToThis should be able to be eliminated in Constant Folding
732 https://bugs.webkit.org/show_bug.cgi?id=157213
734 Reviewed by Saam Barati.
736 This patch enables eliminating the ToThis value when we have abstract interpreter
737 indicates the node is not needed. Since there are Objects that override their
738 ToThis behavior we first check if we can eliminate the node by looking at its
739 speculated type. If the function is in strict mode then we can eliminate ToThis as
740 long as the speculated type is not SpecObjectOther since that contains objects
741 that may set OverridesToThis. If the function is not in strict mode then we can
742 eliminate ToThis as long is the speculated type is an object that is not SpecObjectOther.
744 If we can't eliminate with type information we can still eliminate the ToThis node with
745 the proven structure set. When ToThis only sees structures that do not set OverridesToThis
746 it can be eliminated. Additionally, if the function is in strict mode then we can eliminate
747 ToThis as long as all only the object structures don't set OverridesToThis.
749 * dfg/DFGAbstractInterpreterInlines.h:
750 (JSC::DFG::isToThisAnIdentity):
751 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
752 * dfg/DFGConstantFoldingPhase.cpp:
753 (JSC::DFG::ConstantFoldingPhase::foldConstants):
754 * dfg/DFGFixupPhase.cpp:
755 (JSC::DFG::FixupPhase::fixupToThis):
756 * tests/stress/to-this-global-object.js: Added.
761 2016-05-01 Skachkov Oleksandr <gskachkov@gmail.com>
763 Class contructor and methods shouldn't have "arguments" and "caller"
764 https://bugs.webkit.org/show_bug.cgi?id=144238
766 Reviewed by Ryosuke Niwa.
768 Added TypeError that is raised in case of access to properties 'arguments' or 'caller'
769 of constructor or method of class. Actually TypeError already raised for most cases, except
770 case with undeclared constructor e. g.
772 (new A).constructor.caller
773 (new A).constructor.arguments
775 * runtime/JSFunction.cpp:
776 (JSC::getThrowTypeErrorGetterSetter):
777 (JSC::JSFunction::getOwnPropertySlot):
778 * runtime/JSGlobalObject.cpp:
779 (JSC::JSGlobalObject::createThrowTypeErrorArgumentsAndCaller):
780 (JSC::JSGlobalObject::visitChildren):
781 * runtime/JSGlobalObject.h:
782 (JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerGetterSetter):
783 * runtime/JSGlobalObjectFunctions.cpp:
784 (JSC::globalFuncThrowTypeErrorArgumentsAndCaller):
785 * runtime/JSGlobalObjectFunctions.h:
787 2016-05-02 Yoav Weiss <yoav@yoav.ws>
789 Move ResourceTiming behind a runtime flag
790 https://bugs.webkit.org/show_bug.cgi?id=157133
792 Reviewed by Alex Christensen.
794 * runtime/CommonIdentifiers.h: Added PerformanceEntry, PerformanceEntryList and PerformanceResourceTiming as property names.
796 2016-05-02 Yusuke Suzuki <utatane.tea@gmail.com>
798 Assertion failure for bound function with custom prototype and Reflect.construct
799 https://bugs.webkit.org/show_bug.cgi?id=157081
801 Reviewed by Saam Barati.
803 We ensured `newTarget != exec->callee()`. However, it does not mean `newTarget.get("prototype") != exec->callee()->get("prototype")`.
804 When the given `prototype` is the same to `baseStructure->sotredPrototype()`, it is unnecessary to create a new structure from this
807 * bytecode/InternalFunctionAllocationProfile.h:
808 (JSC::InternalFunctionAllocationProfile::createAllocationStructureFromBase):
809 * tests/stress/custom-prototype-may-be-same-to-original-one.js: Added.
813 2016-04-30 Konstantin Tokarev <annulen@yandex.ru>
815 Guard ObjC-specific code in Heap.cpp with USE(FOUNDATION)
816 https://bugs.webkit.org/show_bug.cgi?id=157236
818 Reviewed by Darin Adler.
820 This also fixes build with GCC 4.8 which does not provide
825 2016-04-30 Yusuke Suzuki <utatane.tea@gmail.com>
827 Assertion failure for destructuring assignment with new.target and unary operator
828 https://bugs.webkit.org/show_bug.cgi?id=157149
830 Reviewed by Saam Barati.
832 The caller of parseDefaultValueForDestructuringPattern() should propagate errors.
833 And this patch also cleans up createSavePoint and createSavePointForError; introducing SavePointWithError.
836 (JSC::Parser<LexerType>::parseSourceElements):
837 (JSC::Parser<LexerType>::parseDestructuringPattern):
838 Add propagateErorr() for parseDefaultValueForDestructuringPattern.
840 (JSC::Parser<LexerType>::parseAssignmentExpression):
842 (JSC::Parser::restoreLexerState):
843 (JSC::Parser::internalSaveState):
844 (JSC::Parser::createSavePointForError):
845 (JSC::Parser::createSavePoint):
846 (JSC::Parser::internalRestoreState):
847 (JSC::Parser::restoreSavePointWithError):
848 (JSC::Parser::restoreSavePoint):
849 * tests/stress/default-value-parsing-should-propagate-error.js: Added.
853 2016-04-28 Darin Adler <darin@apple.com>
855 First step in using "enum class" instead of "String" for enumerations in DOM
856 https://bugs.webkit.org/show_bug.cgi?id=157163
858 Reviewed by Chris Dumez.
860 * runtime/JSString.h:
861 (JSC::jsStringWithCache): Deleted unneeded overload for AtomicString.
863 2016-04-29 Benjamin Poulain <bpoulain@apple.com>
865 [JSC][ARMv7S] Arithmetic module results change when tiering up to DFG
866 https://bugs.webkit.org/show_bug.cgi?id=157217
867 rdar://problem/24733432
869 Reviewed by Mark Lam.
871 ARMv7's fmod() returns less accurate results than an integer division.
872 Since we have integer div on ARMv7s, the results start changing when
875 In this patch, I change our fmod slow path to behave like the fast path
878 * dfg/DFGSpeculativeJIT.cpp:
879 (JSC::DFG::SpeculativeJIT::compileArithMod):
880 (JSC::DFG::fmodAsDFGOperation): Deleted.
881 * runtime/CommonSlowPaths.cpp:
882 (JSC::SLOW_PATH_DECL):
883 * runtime/MathCommon.cpp:
884 (JSC::isStrictInt32):
885 * runtime/MathCommon.h:
887 2016-04-29 Joseph Pecoraro <pecoraro@apple.com>
889 Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
890 https://bugs.webkit.org/show_bug.cgi?id=157198
891 <rdar://problem/26011049>
893 Reviewed by Timothy Hatcher.
895 * inspector/InspectorBackendDispatcher.cpp:
896 (Inspector::BackendDispatcher::sendResponse):
897 While auditing the code, add a WTFMove.
899 2016-04-29 Mark Lam <mark.lam@apple.com>
901 Make RegExp.prototype.test spec compliant.
902 https://bugs.webkit.org/show_bug.cgi?id=155862
904 Reviewed by Saam Barati.
906 * builtins/RegExpPrototype.js:
907 (intrinsic.RegExpTestIntrinsic.test):
910 - Delete obsoleted code.
912 * dfg/DFGByteCodeParser.cpp:
913 (JSC::DFG::ByteCodeParser::addToGraph):
914 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
915 - We now have 2 intrinsics for RegExp.prototype.test:
916 RegExpTestIntrinsic and RegExpTestFastIntrinsic.
918 RegExpTestIntrinsic maps to the entry at the top of the builtin ES6
919 RegExp.prototype.test.
920 RegExpTestFastIntrinsic maps to the fast path in the builtin ES6
921 RegExp.prototype.test.
923 Both will end up using the RegExpTest DFG node to implement the fast path
924 of RegExp.prototype.test. RegExpTestIntrinsic will have some additional checks
925 before the RegExpTest node. Those checks are for speculating that it is ok for
926 us to take the fast path.
928 * runtime/CommonIdentifiers.h:
929 * runtime/Intrinsic.h:
931 * runtime/JSGlobalObject.cpp:
932 (JSC::JSGlobalObject::init):
933 - Added the regExpTestFast function.
934 - Also fixed the parameter length on 2 other functions that were erroneous.
936 * runtime/RegExpPrototype.cpp:
937 (JSC::RegExpPrototype::finishCreation):
938 (JSC::regExpProtoFuncTestFast):
939 (JSC::regExpProtoFuncTest): Deleted.
940 * runtime/RegExpPrototype.h:
943 2016-04-29 Benjamin Poulain <benjamin@webkit.org>
945 Extend math-pow-stable-results.js to get more information about the failure
947 * tests/stress/math-pow-stable-results.js:
949 2016-04-29 Yusuke Suzuki <utatane.tea@gmail.com>
951 Assertion failure for exception in "prototype" property getter and Reflect.construct
952 https://bugs.webkit.org/show_bug.cgi?id=157084
954 Reviewed by Mark Lam.
956 InternalFunction::createSubclassStrucuture may throw exceptions because it performs [[Get]] to
957 look up the "prototype" object. The current assertion is invalid.
958 We also found that Object constructor is not aware of new.target. This is filed[1].
960 [1]: https://bugs.webkit.org/show_bug.cgi?id=157196
962 * runtime/InternalFunction.cpp:
963 (JSC::InternalFunction::createSubclassStructure):
964 * tests/stress/create-subclass-structure-may-throw-exception-when-getting-prototype.js: Added.
968 2016-04-29 Commit Queue <commit-queue@webkit.org>
970 Unreviewed, rolling out r200232.
971 https://bugs.webkit.org/show_bug.cgi?id=157189
973 This change broke the Mac CMake build and its LayoutTest is
974 failing and/or flaky on all platforms (Requested by ryanhaddad
979 "Move ResourceTiming behind a runtime flag"
980 https://bugs.webkit.org/show_bug.cgi?id=157133
981 http://trac.webkit.org/changeset/200232
983 2016-04-29 Yusuke Suzuki <utatane.tea@gmail.com>
985 [ES6] RegExp.prototype.@@replace should use @isObject instead of `instanceof` for object guard
986 https://bugs.webkit.org/show_bug.cgi?id=157124
988 Reviewed by Keith Miller.
990 Use @isObject instead of `instanceof @Object`.
991 The `instanceof` check is not enough to check Object Type.
992 This fix itself is the same to r199647, and this patch is for RegExp.prototype.@@replace.
994 * builtins/RegExpPrototype.js:
996 * tests/stress/regexp-replace-in-other-realm-should-work.js: Added.
998 * tests/stress/regexp-replace-should-work-with-objects-not-inheriting-object-prototype.js: Added.
1002 2016-04-29 Yoav Weiss <yoav@yoav.ws>
1004 Move ResourceTiming behind a runtime flag
1005 https://bugs.webkit.org/show_bug.cgi?id=157133
1007 Reviewed by Alex Christensen.
1009 * runtime/CommonIdentifiers.h: Added PerformanceEntry, PerformanceEntryList and PerformanceResourceTiming as property names.
1011 2016-04-28 Joseph Pecoraro <pecoraro@apple.com>
1013 Remove unused bool parameter in CodeCache::getGlobalCodeBlock
1014 https://bugs.webkit.org/show_bug.cgi?id=157156
1016 Reviewed by Mark Lam.
1018 The bool parameter appears to be isArrowFunctionContext, but the method's
1019 contents just get that property from the Executable, so the parameter is
1020 unnecessary and unused.
1022 * runtime/CodeCache.cpp:
1023 (JSC::CodeCache::getGlobalCodeBlock):
1024 (JSC::CodeCache::getProgramCodeBlock):
1025 (JSC::CodeCache::getEvalCodeBlock):
1026 (JSC::CodeCache::getModuleProgramCodeBlock):
1027 * runtime/CodeCache.h:
1028 * runtime/Executable.cpp:
1029 (JSC::EvalExecutable::create):
1030 * runtime/JSGlobalObject.cpp:
1031 (JSC::JSGlobalObject::createEvalCodeBlock):
1032 * runtime/JSGlobalObject.h:
1034 2016-04-28 Caitlin Potter <caitp@igalia.com>
1036 [JSC] re-implement String#padStart and String#padEnd in JavaScript
1037 https://bugs.webkit.org/show_bug.cgi?id=157146
1039 Reviewed by Saam Barati.
1041 * builtins/StringPrototype.js:
1042 (repeatCharactersSlowPath):
1045 * runtime/JSGlobalObject.cpp:
1046 (JSC::JSGlobalObject::init):
1047 * runtime/StringPrototype.cpp:
1048 (JSC::StringPrototype::finishCreation): Deleted.
1049 (JSC::repeatStringPattern): Deleted.
1050 (JSC::padString): Deleted.
1051 (JSC::stringProtoFuncPadEnd): Deleted.
1052 (JSC::stringProtoFuncPadStart): Deleted.
1054 2016-04-28 Joseph Pecoraro <pecoraro@apple.com>
1056 Web Inspector: Tweak auto attach initialization on some platforms
1057 https://bugs.webkit.org/show_bug.cgi?id=157150
1058 <rdar://problem/21222045>
1060 Reviewed by Timothy Hatcher.
1062 * inspector/EventLoop.cpp:
1063 (Inspector::EventLoop::cycle):
1064 * inspector/remote/RemoteInspector.mm:
1065 (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
1067 2016-04-28 Benjamin Poulain <bpoulain@apple.com>
1069 [JSC] Unify Math.pow() accross all tiers
1070 https://bugs.webkit.org/show_bug.cgi?id=157121
1072 Reviewed by Geoffrey Garen.
1074 My previous optimizations of DFG compile time have slowly
1075 regressed Sunspider's math-partial-sums.
1077 What is happenning is baseline used a thunk for Math.pow()
1078 that has a special case for an exponent of -0.5, while
1079 DFG/FTL have other special cases for other exponents.
1080 The faster we get to DFG, the less time we spend in that fast
1083 While looking into this, I discovered some correctness issues. Baseline
1084 optimizes y=-0.5 by turning it into 1/sqrt(). DFG/FTL optimize constant
1085 y=0.5 by turning it into sqrt(). The problem is sqrt() behaves differently
1086 for -0 and -Infinity. With sqrt(), negative numbers are undefined,
1087 and the result is NaN. With pow(), they have a result.
1089 Something else that has bothered me for a while is that Math.pow()
1090 with the same arguments give you different results in LLINT, Baseline,
1091 and DFG/FTL. This seems a bit dangerous for numerical stability.
1093 With this patch, I unify the behaviors for all tiers while keeping
1094 the "special cases".
1096 We have pow() that is super slow, but most callers don't need the
1097 full power. We have:
1098 -pow() with an exponent between 0 and 1000 is a fast path implemented
1099 by multiplication only.
1100 -pow(x, 0.5) is sqrt with special checks for negative values.
1101 -pow(x, -0.5) is sqrt with special checks for negative values.
1103 The C++ implementation handles all those optimizations too. This ensure
1104 you get the same results from LLINT to FTL.
1106 The thunk is eliminated, it was producing incorrect results and only
1107 optimized Sunspider's partial-sums.
1109 DFG gets the optimized integer, 0.5 and -0.5 cases since those are important
1110 for somewhat-hot code. DFG falls back to the C++ code for any non-obvious case.
1112 FTL gets the full C++ implementation inlined in B3. B3 knows how to eliminate
1113 all the dead cases so you get the best if your code is hot enough to reach FTL.
1115 * dfg/DFGFixupPhase.cpp:
1116 (JSC::DFG::FixupPhase::fixupNode): Deleted.
1118 (JSC::DFG::Node::convertToArithSqrt): Deleted.
1119 * dfg/DFGNodeType.h:
1120 * dfg/DFGSpeculativeJIT.cpp:
1121 (JSC::DFG::compileArithPowIntegerFastPath):
1122 (JSC::DFG::SpeculativeJIT::compileArithPow):
1123 * dfg/DFGStrengthReductionPhase.cpp:
1124 (JSC::DFG::StrengthReductionPhase::handleNode):
1125 * ftl/FTLLowerDFGToB3.cpp:
1126 (JSC::FTL::DFG::LowerDFGToB3::compileArithPow):
1127 * jit/ThunkGenerators.cpp:
1128 (JSC::powThunkGenerator): Deleted.
1129 * jit/ThunkGenerators.h:
1130 * runtime/MathCommon.cpp:
1131 (JSC::operationMathPow):
1132 * runtime/MathCommon.h:
1134 (JSC::thunkGeneratorForIntrinsic): Deleted.
1135 * tests/stress/math-pow-stable-results.js: Added.
1136 Getting consistent results when tiering up is new.
1137 This test verify that results always remains the same as LLINT.
1139 * tests/stress/math-pow-with-constants.js:
1140 (testPowUsedAsSqrt):
1141 (powUsedAsOneOverSqrt):
1142 (testPowUsedAsOneOverSqrt):
1144 (testPowUsedAsSquare):
1146 2016-04-28 Mark Lam <mark.lam@apple.com>
1148 DebuggerScope::className() should not assert scope->isValid().
1149 https://bugs.webkit.org/show_bug.cgi?id=157143
1151 Reviewed by Keith Miller.
1153 DebuggerScope::className() should not assert scope->isValid() because the
1154 TypeProfiler logs objects it encounters, and may indirectly call
1155 JSObject::calculatedClassName() on those objects later, thereby calling
1156 DebuggerScope::className() on an invalidated DebuggerScope.
1158 The existing handling in DebuggerScope::className() for an invalidated scope
1159 (that returns a null string) is sufficient.
1161 * debugger/DebuggerScope.cpp:
1162 (JSC::DebuggerScope::className):
1164 2016-04-28 Caitlin Potter <caitp@igalia.com>
1166 [JSC] implement spec changes for String#padStart and String#padEnd
1167 https://bugs.webkit.org/show_bug.cgi?id=157139
1169 Reviewed by Keith Miller.
1171 Previously, if the fill string was the empty string, it was treated as a
1172 single U+0020 SPACE character. Now, if this occurs, the original string
1173 is returned instead.
1175 Change was discussed at TC39 in March [1], and is reflected in new
1176 test262 tests for the feature.
1178 [1] https://github.com/tc39/tc39-notes/blob/master/es7/2016-03/march-29.md#stringprototypepadstartpadend
1180 * runtime/StringPrototype.cpp:
1182 * tests/es6/String.prototype_methods_String.prototype.padEnd.js:
1183 (TestFillerToString):
1184 (TestFillerEmptyString):
1185 * tests/es6/String.prototype_methods_String.prototype.padStart.js:
1186 (TestFillerToString):
1187 (TestFillerEmptyString):
1189 2016-04-28 Skachkov Oleksandr <gskachkov@gmail.com>
1191 Crash for non-static super property call in derived class constructor
1192 https://bugs.webkit.org/show_bug.cgi?id=157089
1194 Reviewed by Darin Adler.
1196 Added tdz check of the 'this' before access to the 'super' for FunctionCallBracketNode,
1197 the same as it was done for FunctionCallDotNode.
1199 * bytecompiler/NodesCodegen.cpp:
1200 (JSC::FunctionCallBracketNode::emitBytecode):
1202 2016-04-27 Mark Lam <mark.lam@apple.com>
1204 The GetterSetter structure needs a globalObject.
1205 https://bugs.webkit.org/show_bug.cgi?id=157120
1207 Reviewed by Filip Pizlo.
1209 In r199170: <http://trac.webkit.org/r199170>, GetterSetter was promoted from
1210 being a JSCell to a JSObject. JSObject methods expect their structure to have a
1211 globalObject. For example, see JSObject::calculatedClassName(). GetterSetter
1212 was previously using a singleton getterSetterStructure owned by the VM. That
1213 singleton getterSetterStructure is not associated with any globalObjects. As a
1214 result, JSObject::calculatedClassName() will run into a null globalObject when it
1215 is called on a GetterSetter object.
1217 This patch removes the VM singleton getterSetterStructure, and instead, creates
1218 a getterSetterStructure for each JSGlobalObject.
1220 * dfg/DFGAbstractInterpreterInlines.h:
1221 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1222 * dfg/DFGStructureRegistrationPhase.cpp:
1223 (JSC::DFG::StructureRegistrationPhase::run):
1224 * runtime/GetterSetter.h:
1225 * runtime/JSGlobalObject.cpp:
1226 (JSC::JSGlobalObject::init):
1227 (JSC::JSGlobalObject::visitChildren):
1228 * runtime/JSGlobalObject.h:
1229 (JSC::JSGlobalObject::functionStructure):
1230 (JSC::JSGlobalObject::boundFunctionStructure):
1231 (JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
1232 (JSC::JSGlobalObject::getterSetterStructure):
1233 (JSC::JSGlobalObject::nativeStdFunctionStructure):
1234 (JSC::JSGlobalObject::namedFunctionStructure):
1235 (JSC::JSGlobalObject::functionNameOffset):
1240 2016-04-27 Keith Miller <keith_miller@apple.com>
1242 Unreviewed, Revert r199397 due to PLT regressions
1244 * JavaScriptCore.xcodeproj/project.pbxproj:
1245 * builtins/ArrayPrototype.js:
1246 (concatSlowPath): Deleted.
1248 * bytecode/BytecodeIntrinsicRegistry.cpp:
1249 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): Deleted.
1250 * bytecode/BytecodeIntrinsicRegistry.h:
1251 * dfg/DFGAbstractInterpreterInlines.h:
1252 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1253 * dfg/DFGByteCodeParser.cpp:
1254 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
1255 (JSC::DFG::ByteCodeParser::handleIntrinsicCall): Deleted.
1256 * dfg/DFGClobberize.h:
1257 (JSC::DFG::clobberize):
1258 * dfg/DFGDoesGC.cpp:
1259 (JSC::DFG::doesGC): Deleted.
1260 * dfg/DFGFixupPhase.cpp:
1261 (JSC::DFG::FixupPhase::fixupNode):
1262 * dfg/DFGNodeType.h:
1263 * dfg/DFGOperations.cpp:
1264 * dfg/DFGOperations.h:
1265 * dfg/DFGPredictionPropagationPhase.cpp:
1266 * dfg/DFGSafeToExecute.h:
1267 (JSC::DFG::safeToExecute): Deleted.
1268 * dfg/DFGSpeculativeJIT.cpp:
1269 (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
1270 (JSC::DFG::SpeculativeJIT::compileIsJSArray): Deleted.
1271 (JSC::DFG::SpeculativeJIT::compileIsArrayObject): Deleted.
1272 (JSC::DFG::SpeculativeJIT::compileIsArrayConstructor): Deleted.
1273 (JSC::DFG::SpeculativeJIT::compileCallObjectConstructor): Deleted.
1274 * dfg/DFGSpeculativeJIT.h:
1275 (JSC::DFG::SpeculativeJIT::callOperation): Deleted.
1276 * dfg/DFGSpeculativeJIT32_64.cpp:
1277 (JSC::DFG::SpeculativeJIT::compile): Deleted.
1278 * dfg/DFGSpeculativeJIT64.cpp:
1279 (JSC::DFG::SpeculativeJIT::compile):
1280 * ftl/FTLCapabilities.cpp:
1281 (JSC::FTL::canCompile): Deleted.
1282 * ftl/FTLLowerDFGToB3.cpp:
1283 (JSC::FTL::DFG::LowerDFGToB3::compileNode): Deleted.
1284 (JSC::FTL::DFG::LowerDFGToB3::compileCallObjectConstructor): Deleted.
1285 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayObject): Deleted.
1286 (JSC::FTL::DFG::LowerDFGToB3::compileIsJSArray): Deleted.
1287 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayConstructor): Deleted.
1288 (JSC::FTL::DFG::LowerDFGToB3::isArray): Deleted.
1289 * jit/JITOperations.h:
1291 (GlobalObject::finishCreation):
1292 (functionDataLogValue): Deleted.
1293 * runtime/ArrayConstructor.cpp:
1294 (JSC::ArrayConstructor::finishCreation):
1295 (JSC::arrayConstructorPrivateFuncIsArrayConstructor):
1296 * runtime/ArrayConstructor.h:
1297 (JSC::isArrayConstructor): Deleted.
1298 * runtime/ArrayPrototype.cpp:
1299 (JSC::ArrayPrototype::finishCreation):
1300 (JSC::arrayProtoFuncConcat):
1301 (JSC::arrayProtoPrivateFuncIsJSArray): Deleted.
1302 (JSC::moveElements): Deleted.
1303 (JSC::arrayProtoPrivateFuncConcatMemcpy): Deleted.
1304 (JSC::arrayProtoPrivateFuncAppendMemcpy): Deleted.
1305 * runtime/ArrayPrototype.h:
1306 * runtime/CommonIdentifiers.h:
1307 * runtime/Intrinsic.h:
1308 * runtime/JSArray.cpp:
1309 (JSC::JSArray::fastConcatWith):
1310 (JSC::JSArray::appendMemcpy): Deleted.
1311 * runtime/JSArray.h:
1312 (JSC::JSArray::fastConcatType):
1313 (JSC::JSArray::createStructure):
1315 * runtime/JSArrayInlines.h: Removed.
1316 (JSC::JSArray::memCopyWithIndexingType): Deleted.
1317 (JSC::JSArray::canFastCopy): Deleted.
1318 * runtime/JSGlobalObject.cpp:
1319 (JSC::JSGlobalObject::init):
1321 * runtime/ObjectConstructor.h:
1322 (JSC::constructObject): Deleted.
1324 * tests/stress/array-concat-spread-object.js: Removed.
1326 * tests/stress/array-concat-spread-proxy-exception-check.js: Removed.
1328 * tests/stress/array-concat-spread-proxy.js: Removed.
1330 * tests/stress/array-concat-with-slow-indexingtypes.js: Removed.
1332 * tests/stress/array-species-config-array-constructor.js:
1334 2016-04-27 Michael Saboff <msaboff@apple.com>
1336 REGRESSION(r200117): Crash in lowerDFGToB3::compileStringReplace()
1337 https://bugs.webkit.org/show_bug.cgi?id=157099
1339 Reviewed by Saam Barati.
1341 Given that the DFGFixupPhase could mark the edge of child2 as StringUse,
1342 we need to lower that edge appropriately.
1344 * ftl/FTLLowerDFGToB3.cpp:
1345 (JSC::FTL::DFG::LowerDFGToB3::compileStringReplace):
1347 2016-04-27 Mark Lam <mark.lam@apple.com>
1349 Address feedback from https://bugs.webkit.org/show_bug.cgi?id=157048#c5.
1350 https://bugs.webkit.org/show_bug.cgi?id=157096
1352 Reviewed by Geoffrey Garen.
1354 1. Check for USE(APPLE_INTERNAL_SDK) instead of __has_include(<mach-o/dyld_priv.h>).
1355 2. Rename webkitFirstSDKVersionWithInitConstructorSupport to
1356 firstSDKVersionWithInitConstructorSupport.
1358 * API/JSWrapperMap.mm:
1359 (supportsInitMethodConstructors):
1361 2016-04-27 Mark Lam <mark.lam@apple.com>
1363 Restrict the availability of some JSC options to local debug builds only.
1364 https://bugs.webkit.org/show_bug.cgi?id=157058
1366 Reviewed by Geoffrey Garen.
1368 1. Each option will be given an availability flag.
1369 2. The functionOverrides and useDollarVM (along with its alias, enableDollarVM)
1370 will have "Restricted" availability.
1371 3. All other options will have “Normal” availability.
1372 4. Any options with "Restricted" availability will only be accessible if function
1373 allowRestrictedOptions() returns true.
1374 5. For now, allowRestrictedOptions() always returns false for release builds, and
1375 true for debug builds.
1377 If an option is "Restricted" and restricted options are not allowed, the VM will
1378 behave semantically as if that option does not exist at all:
1379 1. Option dumps will not show the option.
1380 2. Attempts to set the option will fail as if the option does not exist.
1382 Behind the scene, the option does exist, and is set to its default value
1383 (whatever that may be) once and only once on options initialization.
1385 * runtime/Options.cpp:
1386 (JSC::allowRestrictedOptions):
1388 (JSC::overrideOptionWithHeuristic):
1389 (JSC::Options::initialize):
1390 (JSC::Options::setOptionWithoutAlias):
1391 (JSC::Options::dumpOption):
1392 * runtime/Options.h:
1393 (JSC::Option::type):
1394 (JSC::Option::availability):
1395 (JSC::Option::isOverridden):
1397 2016-04-27 Gavin Barraclough <barraclough@apple.com>
1399 Enable separated heap by default on ios
1400 https://bugs.webkit.org/show_bug.cgi?id=156720
1401 <rdar://problem/25841790>
1403 Unreviewed rollout - caused memory regression.
1405 * runtime/Options.cpp:
1406 (JSC::recomputeDependentOptions):
1408 2016-04-27 Benjamin Poulain <bpoulain@apple.com>
1410 Follow up for r200113 on 32bit
1412 I forgot to do the 32bit counterpart of r200113.
1413 The test fails on the bots.
1415 * dfg/DFGSpeculativeJIT32_64.cpp:
1416 (JSC::DFG::SpeculativeJIT::compile):
1418 2016-04-27 Alberto Garcia <berto@igalia.com>
1420 [GTK] Fails to build randomly when generating LLIntDesiredOffsets.h
1421 https://bugs.webkit.org/show_bug.cgi?id=155427
1423 Reviewed by Carlos Garcia Campos.
1425 If the build directory contains the -I string, the script that
1426 generates LLIntDesiredOffsets.h will confuse it with an option to
1427 declare an include directory.
1429 In order to avoid that we should only use the arguments that start
1430 with -I when extracting the list of include directories, instead
1431 of using the ones that simply contain that string.
1433 * offlineasm/parser.rb:
1435 2016-04-27 Saam barati <sbarati@apple.com>
1437 JSC should have an option to allow global const redeclarations
1438 https://bugs.webkit.org/show_bug.cgi?id=157006
1440 Reviewed by Geoffrey Garen.
1442 This patch implements an option that dictates whether
1443 const redeclarations at the program level will throw.
1444 This option defaults to true but allows users of JSC
1445 to set it to false. This option is per VM. This is needed
1446 for backwards compatibility with our old const implementation.
1449 (GlobalObject::finishCreation):
1450 (functionShadowChickenFunctionsOnStack):
1451 (functionSetGlobalConstRedeclarationShouldNotThrow):
1453 * runtime/Executable.cpp:
1454 (JSC::ProgramExecutable::initializeGlobalProperties):
1455 * runtime/JSGlobalLexicalEnvironment.cpp:
1456 (JSC::JSGlobalLexicalEnvironment::put):
1457 (JSC::JSGlobalLexicalEnvironment::isConstVariable):
1458 * runtime/JSGlobalLexicalEnvironment.h:
1459 (JSC::JSGlobalLexicalEnvironment::isEmpty):
1461 (JSC::VM::setGlobalConstRedeclarationShouldThrow):
1462 (JSC::VM::globalConstRedeclarationShouldThrow):
1463 * tests/stress/global-const-redeclaration-setting: Added.
1464 * tests/stress/global-const-redeclaration-setting-2.js: Added.
1466 * tests/stress/global-const-redeclaration-setting-3.js: Added.
1469 * tests/stress/global-const-redeclaration-setting-4.js: Added.
1472 * tests/stress/global-const-redeclaration-setting-5.js: Added.
1475 * tests/stress/global-const-redeclaration-setting.js: Added.
1477 * tests/stress/global-const-redeclaration-setting/first.js: Added.
1478 * tests/stress/global-const-redeclaration-setting/let.js: Added.
1479 * tests/stress/global-const-redeclaration-setting/second.js: Added.
1480 * tests/stress/global-const-redeclaration-setting/strict.js: Added.
1482 2016-04-26 Michael Saboff <msaboff@apple.com>
1484 [ES] Implement RegExp.prototype.@@replace and use it for String.prototype.replace
1485 https://bugs.webkit.org/show_bug.cgi?id=156562
1487 Reviewed by Filip Pizlo.
1489 Added builtins for String.prototype.replace as well as RegExp.prototype[Symbol.replace].
1491 The String.prototype.replace also has an intrinsic, StringPrototypeReplaceIntrinsic.
1492 This original intrinsic was copied to make StringPrototypeReplaceRegExpIntrinsic.
1493 The difference between the two intrinsics is that StringPrototypeReplaceIntrinsic has
1494 the same checks found in the new builtin hasObservableSideEffectsForStringReplace.
1495 We implement these primordial checks for StringPrototypeReplaceIntrinsic in two places.
1496 First, we do a trial check during ByteCode parsing time to see if the current
1497 RegExp.prototype properties have changed from the original. If they have, we don't
1498 inline the intrinsic. Later, in the fixup phase, we add nodes to the IR to emit the
1501 The new intrinsic StringPrototypeReplaceRegExpIntrinsic is only available via the
1502 private @replaceUsingRegExp, which is called in the String.prototype.replace builtin.
1503 It is only called after hasObservableSideEffectsForStringReplace has been called
1505 Both of these intrinsics are needed, because the JS code containing String.replace() calls
1506 runs initially in the LLint and then the baseline JIT. Even after the function tiers up
1507 to the DFG JIT, the inlining budget may not allow StringPrototypeReplaceIntrinsic to be inlined.
1508 Having StringPrototypeReplaceRegExpIntrinsic allows for the String.prototype.replace builtin to
1509 get reasonable performance before the other intrinsic is inlined or when it can't.
1511 * builtins/RegExpPrototype.js:
1517 * builtins/StringPrototype.js:
1519 (hasObservableSideEffectsForStringReplace):
1520 (intrinsic.StringPrototypeReplaceIntrinsic.replace):
1522 New builtins for String.prototype.replace and RegExp.prototype[Symbol.replace].
1524 * bytecode/BytecodeIntrinsicRegistry.cpp:
1525 * bytecode/BytecodeIntrinsicRegistry.h:
1526 * dfg/DFGAbstractInterpreterInlines.h:
1527 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1528 * dfg/DFGByteCodeParser.cpp:
1529 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
1530 * dfg/DFGClobberize.h:
1531 (JSC::DFG::clobberize):
1532 * dfg/DFGDoesGC.cpp:
1534 * dfg/DFGFixupPhase.cpp:
1535 (JSC::DFG::FixupPhase::fixupNode):
1536 (JSC::DFG::FixupPhase::fixupGetAndSetLocalsInBlock):
1537 (JSC::DFG::FixupPhase::tryAddStringReplacePrimordialChecks):
1538 (JSC::DFG::FixupPhase::checkArray):
1540 (JSC::DFG::Graph::getRegExpPrototypeProperty):
1542 (JSC::DFG::Graph::getRegExpPrototypeProperty):
1544 (JSC::DFG::Node::hasHeapPrediction):
1545 * dfg/DFGNodeType.h:
1546 * dfg/DFGPredictionPropagationPhase.cpp:
1547 * dfg/DFGSafeToExecute.h:
1548 (JSC::DFG::safeToExecute):
1549 * dfg/DFGSpeculativeJIT32_64.cpp:
1550 (JSC::DFG::SpeculativeJIT::compile):
1551 * dfg/DFGSpeculativeJIT64.cpp:
1552 (JSC::DFG::SpeculativeJIT::compile):
1553 * dfg/DFGStrengthReductionPhase.cpp:
1554 (JSC::DFG::StrengthReductionPhase::handleNode):
1555 * ftl/FTLCapabilities.cpp:
1556 (JSC::FTL::canCompile):
1557 * ftl/FTLLowerDFGToB3.cpp:
1558 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1559 * runtime/CommonIdentifiers.h:
1560 * runtime/Intrinsic.h:
1561 * runtime/RegExpPrototype.cpp:
1562 (JSC::RegExpPrototype::finishCreation):
1563 * runtime/StringPrototype.cpp:
1564 (JSC::StringPrototype::finishCreation):
1566 (JSC::stringProtoFuncReplaceUsingRegExp):
1567 (JSC::stringProtoFuncReplaceUsingStringSearch):
1568 (JSC::operationStringProtoFuncReplaceGeneric):
1569 (JSC::stringProtoFuncReplace): Deleted.
1570 Added StringReplaceRegExp intrinsic. Added checks for RegExp profiled arguments to StringReplace
1571 that mirror what is in hasObservableSideEffectsForStringReplace(). If we aren't able to add the
1572 checks, we OSR exit. Add Graph::getPrimordialRegExpPrototypeProperty() as a helper to get the
1573 primordial values from RegExp.prototype.
1575 * runtime/JSGlobalObject.cpp:
1576 (JSC::JSGlobalObject::init): Added @regExpPrototypeSymbolReplace and
1577 @hasObservableSideEffectsForStringReplace here instead og String.prototype so that we reduce the
1578 number of objects we have to traverse.
1580 * tests/es6.yaml: Changed expectations for the various replace related tests to passing.
1582 * tests/stress/regexp-replace-proxy.js:
1584 (let.getProxyNullExec.new.Proxy):
1585 (let.getSetProxyNullExec.new.Proxy):
1586 (get resetTracking):
1587 (let.getSetProxyMatches_comma.new.Proxy):
1588 (set get getSetProxyNullExec):
1589 (let.getSetProxyReplace_phoneNumber.new.Proxy):
1590 (set get getSetProxyMatches_comma):
1591 (let.getSetProxyReplaceUnicode_digit_nonGreedy.new.Proxy):
1592 (set get resetTracking):
1593 * tests/stress/string-replace-proxy.js:
1595 (let.getSetProxyReplace.new.Proxy.replace):
1598 2016-04-26 Mark Lam <mark.lam@apple.com>
1600 Gardening: speculative build fix.
1604 * API/JSWrapperMap.mm:
1606 2016-04-26 Mark Lam <mark.lam@apple.com>
1608 Update the compatibility version check for the ObjC API's InitConstructorSupport to use dyld_get_program_sdk_version().
1609 https://bugs.webkit.org/show_bug.cgi?id=157048
1611 Reviewed by Geoffrey Garen.
1613 * API/JSWrapperMap.mm:
1614 (supportsInitMethodConstructors):
1615 (getJSExportProtocol):
1617 2016-04-26 Benjamin Poulain <bpoulain@apple.com>
1619 [JSC] GetByVal on Undecided use its children before its OSR Exit
1620 https://bugs.webkit.org/show_bug.cgi?id=157046
1622 Reviewed by Mark Lam.
1624 Very silly bug: GetByVal on Undecided uses its children before
1625 the speculationCheck(). If we fail the speculation, we have already
1626 lost how to recover the values.
1628 The existing tests did not catch this because we tier up to B3
1629 before such Exits happen. B3 has explicit liveness and did not suffer
1631 The new test has a smaller warmup to exercise the OSR Exit in DFG
1634 * dfg/DFGSpeculativeJIT64.cpp:
1635 (JSC::DFG::SpeculativeJIT::compile):
1636 * tests/stress/get-by-val-on-undecided-out-of-bounds.js: Added.
1637 (string_appeared_here.opaqueGetByValKnownArray):
1639 2016-04-26 Skachkov Oleksandr <gskachkov@gmail.com>
1641 calling super() a second time in a constructor should throw
1642 https://bugs.webkit.org/show_bug.cgi?id=151113
1644 Reviewed by Saam Barati.
1646 Currently, our implementation checks if 'super()' was called in a constructor more
1647 than once and raises a RuntimeError before the second call. According to the spec
1648 we need to raise an error just after the second super() is finished and before
1649 the new 'this' is assigned https://esdiscuss.org/topic/duplicate-super-call-behaviour.
1650 To implement this behavior this patch adds a new op code, op_is_empty, that is used
1651 to check if 'this' is empty.
1653 * bytecode/BytecodeList.json:
1654 * bytecode/BytecodeUseDef.h:
1655 (JSC::computeUsesForBytecodeOffset):
1656 (JSC::computeDefsForBytecodeOffset):
1657 * bytecode/CodeBlock.cpp:
1658 (JSC::CodeBlock::dumpBytecode):
1659 * bytecompiler/BytecodeGenerator.cpp:
1660 (JSC::BytecodeGenerator::emitIsEmpty):
1661 * bytecompiler/BytecodeGenerator.h:
1662 * bytecompiler/NodesCodegen.cpp:
1663 (JSC::FunctionCallValueNode::emitBytecode):
1664 * dfg/DFGAbstractInterpreterInlines.h:
1665 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1666 * dfg/DFGByteCodeParser.cpp:
1667 (JSC::DFG::ByteCodeParser::parseBlock):
1668 * dfg/DFGCapabilities.cpp:
1669 (JSC::DFG::capabilityLevel):
1670 * dfg/DFGClobberize.h:
1671 (JSC::DFG::clobberize):
1672 * dfg/DFGDoesGC.cpp:
1674 * dfg/DFGFixupPhase.cpp:
1675 (JSC::DFG::FixupPhase::fixupNode):
1676 * dfg/DFGNodeType.h:
1677 * dfg/DFGPredictionPropagationPhase.cpp:
1678 * dfg/DFGSafeToExecute.h:
1679 (JSC::DFG::safeToExecute):
1680 * dfg/DFGSpeculativeJIT32_64.cpp:
1681 (JSC::DFG::SpeculativeJIT::compile):
1682 * dfg/DFGSpeculativeJIT64.cpp:
1683 (JSC::DFG::SpeculativeJIT::compile):
1684 * ftl/FTLCapabilities.cpp:
1685 (JSC::FTL::canCompile):
1686 * ftl/FTLLowerDFGToB3.cpp:
1687 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1688 (JSC::FTL::DFG::LowerDFGToB3::compileIsEmpty):
1690 (JSC::JIT::privateCompileMainPass):
1692 * jit/JITOpcodes.cpp:
1693 (JSC::JIT::emit_op_is_empty):
1694 * jit/JITOpcodes32_64.cpp:
1695 (JSC::JIT::emit_op_is_empty):
1696 * llint/LowLevelInterpreter32_64.asm:
1697 * llint/LowLevelInterpreter64.asm:
1698 * tests/stress/class-syntax-double-constructor.js: Added.
1700 2016-04-26 Mark Lam <mark.lam@apple.com>
1702 Changed jsc options title to be more descriptive.
1703 https://bugs.webkit.org/show_bug.cgi?id=157036
1705 Reviewed by Joseph Pecoraro.
1707 Let the title for --dumpOptions be "Modified JSC runtime options:" since it only
1708 dumps overridden options. The title for --options will remain "All JSC runtime
1709 options:" since it dumps all all options with verbose detail.
1712 (CommandLine::parseArguments):
1714 2016-04-26 Oliver Hunt <oliver@apple.com>
1716 Enable separated heap by default on ios
1717 https://bugs.webkit.org/show_bug.cgi?id=156720
1719 Unreviewed roll-in of this change. There is only one
1720 additional allocation involved in this logic, and that
1721 is a duplicate mapping.
1723 Either our tools are not report real memory usage
1724 or this revision is not responsible for the regression.
1726 * runtime/Options.cpp:
1727 (JSC::recomputeDependentOptions):
1729 2016-04-26 Filip Pizlo <fpizlo@apple.com>
1731 DFG backends shouldn't emit type checks at KnownBlah edges
1732 https://bugs.webkit.org/show_bug.cgi?id=157025
1734 Reviewed by Michael Saboff.
1736 This fixes a crash I found when browsing Bing maps with forceEagerCompilation. I include a
1737 100% repro test case.
1739 The issue is that our code still doesn't fully appreciate the devious implications of
1740 KnownBlah use kinds. Consider KnownCell for example. It means: "trust me, I know that this
1741 value will be a cell". You aren't required to provide a proof when you use KnownCell. Often,
1742 we use it as a result of a path-sensitive proof. The abstract interpreter is not
1743 path-sensitive, so AI will be absolutely sure that the KnownCell use might see a non-cell.
1744 This can lead to debug assertions (which this change removes) and it can lead to the backends
1745 emitting a type check. That type check can be pure evil if the node that has this edge does
1746 not have an exit origin. Such a node would have passed validation because the validater would
1747 have thought that the node cannot exit (after all, according to the IR semantics, there is no
1748 speculation at KnownCell).
1750 This comprehensively fixes the issue by recognizing that Foo(KnownCell:@x) means: I have
1751 already proved that by the time you start executing Foo, @x will already be a cell. I cannot
1752 tell you how I proved this but you can rely on it anyway. AI now takes advantage of this
1753 meaning and will always do filtering of KnownBlah edges regardless of whether the backend
1754 actually emits any type checks for those edges. Since the filtering runs before the backend,
1755 the backend will not emit any checks because it will know that the edge was already checked
1756 (by whatever mechanism we used when we made the edge KnownBlah).
1758 Note that it's good that we found this bug now. The DFG currently does very few
1759 sparse-conditional or path-sensitive optimizations, but it will probably do more in the
1760 future. The bug happens because GetByOffset and friends can achieve path-sensitive proofs via
1761 watchpoints on the inferred type. Normally, AI can follow along with this proof. But in the
1762 example program, and on Bing maps, we would GCSE one GetByOffset with another that had a
1763 weaker proven type. That turned out to be completely sound - between the two GetByOffset's
1764 there was a Branch to null check it. The inferred type of the second GetByOffset ended up
1765 knowing that it cannot be null because null only occurred in some structures but not others.
1766 If we added more sparse-conditional stuff to Branch, then AI would know how to follow along
1767 with the proof but it would also create more situations where we'd have a path-sensitive
1768 proof. So, it's good that we're now getting this right.
1770 * dfg/DFGAbstractInterpreter.h:
1771 (JSC::DFG::AbstractInterpreter::filterEdgeByUse):
1772 * dfg/DFGAbstractInterpreterInlines.h:
1773 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEdges):
1774 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeKnownEdgeTypes):
1775 (JSC::DFG::AbstractInterpreter<AbstractStateType>::verifyEdge):
1776 * dfg/DFGSpeculativeJIT.cpp:
1777 (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
1779 (JSC::DFG::typeFilterFor):
1780 * ftl/FTLLowerDFGToB3.cpp:
1781 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1782 * tests/stress/path-sensitive-known-cell-crash.js: Added.
1786 2016-04-26 Gavin Barraclough <barraclough@apple.com>
1788 Enable separated heap by default on ios
1789 https://bugs.webkit.org/show_bug.cgi?id=156720
1791 Unreviewed rollout - caused memory regression.
1793 * runtime/Options.cpp:
1794 (JSC::recomputeDependentOptions):
1796 2016-04-26 Joseph Pecoraro <pecoraro@apple.com>
1798 Improve jsc --help and making sampling options
1799 https://bugs.webkit.org/show_bug.cgi?id=157015
1801 Reviewed by Saam Barati.
1803 Simplify sampling options to be easier to remember:
1805 * --reportSamplingProfilerData => --sample
1806 * --samplingProfilerTimingInterval => --sampleInterval
1808 Update the --help to mention --sample, and restore the behavior of
1809 --options outputing all possible options so you can discover which
1810 options are available.
1813 (printUsageStatement):
1814 (CommandLine::parseArguments):
1815 Improve help and modify option dumping.
1817 * runtime/Options.h:
1818 * runtime/SamplingProfiler.cpp:
1819 (JSC::SamplingProfiler::SamplingProfiler):
1820 Rename the sampling interval option.
1822 2016-04-26 Commit Queue <commit-queue@webkit.org>
1824 Unreviewed, rolling out r200083.
1825 https://bugs.webkit.org/show_bug.cgi?id=157033
1827 It brokes the debug build (Requested by gskachkov on
1832 "calling super() a second time in a constructor should throw"
1833 https://bugs.webkit.org/show_bug.cgi?id=151113
1834 http://trac.webkit.org/changeset/200083
1836 2016-04-26 Skachkov Oleksandr <gskachkov@gmail.com>
1838 calling super() a second time in a constructor should throw
1839 https://bugs.webkit.org/show_bug.cgi?id=151113
1841 Reviewed by Saam Barati.
1843 Currently, our implementation checks if 'super()' was called in a constructor more
1844 than once and raises a RuntimeError before the second call. According to the spec
1845 we need to raise an error just after the second super() is finished and before
1846 the new 'this' is assigned https://esdiscuss.org/topic/duplicate-super-call-behaviour.
1847 To implement this behavior this patch adds a new op code, op_is_empty, that is used
1848 to check if 'this' is empty.
1850 * bytecode/BytecodeList.json:
1851 * bytecode/BytecodeUseDef.h:
1852 (JSC::computeUsesForBytecodeOffset):
1853 (JSC::computeDefsForBytecodeOffset):
1854 * bytecode/CodeBlock.cpp:
1855 (JSC::CodeBlock::dumpBytecode):
1856 * bytecompiler/BytecodeGenerator.cpp:
1857 (JSC::BytecodeGenerator::emitIsEmpty):
1858 * bytecompiler/BytecodeGenerator.h:
1859 * bytecompiler/NodesCodegen.cpp:
1860 (JSC::FunctionCallValueNode::emitBytecode):
1861 * dfg/DFGAbstractInterpreterInlines.h:
1862 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1863 * dfg/DFGByteCodeParser.cpp:
1864 (JSC::DFG::ByteCodeParser::parseBlock):
1865 * dfg/DFGCapabilities.cpp:
1866 (JSC::DFG::capabilityLevel):
1867 * dfg/DFGClobberize.h:
1868 (JSC::DFG::clobberize):
1869 * dfg/DFGDoesGC.cpp:
1871 * dfg/DFGFixupPhase.cpp:
1872 (JSC::DFG::FixupPhase::fixupNode):
1873 * dfg/DFGNodeType.h:
1874 * dfg/DFGSafeToExecute.h:
1875 (JSC::DFG::safeToExecute):
1876 * dfg/DFGSpeculativeJIT32_64.cpp:
1877 (JSC::DFG::SpeculativeJIT::compile):
1878 * dfg/DFGSpeculativeJIT64.cpp:
1879 (JSC::DFG::SpeculativeJIT::compile):
1880 * ftl/FTLCapabilities.cpp:
1881 (JSC::FTL::canCompile):
1882 * ftl/FTLLowerDFGToB3.cpp:
1883 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1884 (JSC::FTL::DFG::LowerDFGToB3::compileIsEmpty):
1886 (JSC::JIT::privateCompileMainPass):
1888 * jit/JITOpcodes.cpp:
1889 (JSC::JIT::emit_op_is_empty):
1890 * jit/JITOpcodes32_64.cpp:
1891 (JSC::JIT::emit_op_is_empty):
1892 * llint/LowLevelInterpreter32_64.asm:
1893 * llint/LowLevelInterpreter64.asm:
1894 * tests/stress/class-syntax-double-constructor.js: Added.
1896 2016-04-25 Ryosuke Niwa <rniwa@webkit.org>
1898 Remove the build flag for template elements
1899 https://bugs.webkit.org/show_bug.cgi?id=157022
1901 Reviewed by Daniel Bates.
1903 * Configurations/FeatureDefines.xcconfig:
1905 2016-04-25 Benjamin Poulain <bpoulain@apple.com>
1907 [JSC] Constant folding of UInt32ToNumber is incorrect
1908 https://bugs.webkit.org/show_bug.cgi?id=157011
1909 rdar://problem/25769641
1911 Reviewed by Geoffrey Garen.
1913 UInt32ToNumber should return the unsigned 32bit value of
1914 its child. The abstract interpreter fails to do that when handling
1917 None of the tests caught that because the bytecode generator already
1918 fold the operation if given a constant. If the constant is not visible
1919 from the bytecode generator (for example because it comes from an inlined call),
1920 then the abstract interpreter folding was producing invalid results.
1922 * dfg/DFGAbstractInterpreterInlines.h:
1923 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1924 * tests/stress/uint32-to-number-constant-folding.js: Added.
1925 (uint32ToNumberMinusOne):
1926 (uint32ToNumberMinusOnePlusInteger):
1928 (uint32ToNumberOnHiddenMinusOne):
1929 (uint32ToNumberOnHiddenMinusOnePlusInteger):
1930 (inlineLargeNegativeNumber1):
1931 (inlineLargeNegativeNumber2):
1932 (inlineLargeNegativeNumber3):
1933 (uint32ToNumberOnHiddenLargeNegativeNumber1):
1934 (uint32ToNumberOnHiddenLargeNegativeNumber2):
1935 (uint32ToNumberOnHiddenLargeNegativeNumber3):
1937 2016-04-25 Fujii Hironori <Hironori.Fujii@sony.com>
1939 Heap corruption is detected when destructing JSGlobalObject
1940 https://bugs.webkit.org/show_bug.cgi?id=156831
1942 Reviewed by Mark Lam.
1944 WebKit uses CRT static library on Windows. Each copy of the CRT
1945 library has its own heap manager, allocating memory in one CRT
1946 library and passing the pointer across a DLL boundary to be freed
1947 by a different copy of the CRT library is a potential cause for
1950 Potential Errors Passing CRT Objects Across DLL Boundaries
1951 <https://msdn.microsoft.com/en-us/library/ms235460(v=vs.140).aspx>
1953 JSGlobalObject::createRareDataIfNeeded is inlined but
1954 JSGlobalObject::~JSGlobalObject is not. Then, the heap of
1955 allocating JSGlobalObjectRareData is WebKit.dll, but deallocating
1956 JavaScriptCore.dll. Adding WTF_MAKE_FAST_ALLOCATED to
1957 JSGlobalObjectRareData ensures heap consistency of it. WTF::Lock
1958 also needs WTF_MAKE_FAST_ALLOCATED because it is allocated from
1959 the inlined constructor of JSGlobalObjectRareData.
1961 Test: fast/dom/insertedIntoDocument-iframe.html
1963 * runtime/JSGlobalObject.h:
1964 Add WTF_MAKE_FAST_ALLOCATED to JSGlobalObjectRareData.
1966 2016-04-25 Michael Saboff <msaboff@apple.com>
1968 Crash using @tryGetById in DFG
1969 https://bugs.webkit.org/show_bug.cgi?id=156992
1971 Reviewed by Filip Pizlo.
1973 We need to spill live registers when compiling TryGetById in DFG.
1975 * dfg/DFGSpeculativeJIT.cpp:
1976 (JSC::DFG::SpeculativeJIT::compileTryGetById):
1977 * tests/stress/regress-156992.js: New test.
1978 (tryMultipleGetByIds):
1981 2016-04-25 Saam barati <sbarati@apple.com>
1983 We don't have to parse a function's parameters every time if the function is in the source provider cache
1984 https://bugs.webkit.org/show_bug.cgi?id=156943
1986 Reviewed by Filip Pizlo.
1988 This patch makes a few changes to make parsing inner functions
1991 First, we were always parsing an inner function's parameter
1992 list using the templatized TreeBuiler. This means if our parent scope
1993 was building an AST, we ended up building AST nodes for the inner
1994 function's parameter list even though these nodes would go unused.
1995 This patch fixes that to *always* build an inner function's parameter
1996 list using the SyntaxChecker. (Note that this is consistent now with
1997 always building an inner function's body with a SyntaxChecker.)
1999 Second, we were always parsing an inner function's parameter list
2000 even if we had that function saved in the source provider cache.
2001 I've fixed that bug and made it so that we skip over the parsing
2002 of a function's parameter list when it's in the source provider
2003 cache. We could probably enhance this in the future to skip
2004 over the entirety of a function starting at the "function"
2005 keyword or any other start of the function (depending on
2006 the function type: arrow function, method, etc).
2008 This patch also renames a few fields. First, I fixed a typo
2009 from "tocken" => "token" for a few field names. Secondly,
2010 I renamed a field that was called 'bodyStartColumn' to
2011 'parametersStartColumn' because the field really held the
2012 parameter list's start column.
2014 I'm benchmarking this as a 1.5-2% octane/jquery speedup
2017 * parser/ASTBuilder.h:
2018 (JSC::ASTBuilder::createFunctionExpr):
2019 (JSC::ASTBuilder::createMethodDefinition):
2020 (JSC::ASTBuilder::createArrowFunctionExpr):
2021 (JSC::ASTBuilder::createGetterOrSetterProperty):
2022 (JSC::ASTBuilder::createFuncDeclStatement):
2024 (JSC::Lexer<T>::lex):
2026 (JSC::Lexer::currentPosition):
2027 (JSC::Lexer::positionBeforeLastNewline):
2028 (JSC::Lexer::lastTokenLocation):
2029 (JSC::Lexer::setLastLineNumber):
2030 (JSC::Lexer::lastLineNumber):
2031 (JSC::Lexer::prevTerminator):
2032 * parser/Parser.cpp:
2033 (JSC::Parser<LexerType>::parseInner):
2034 (JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
2035 (JSC::Parser<LexerType>::parseFunctionBody):
2036 (JSC::stringForFunctionMode):
2037 (JSC::Parser<LexerType>::parseFunctionParameters):
2038 (JSC::Parser<LexerType>::parseFunctionInfo):
2040 (JSC::Scope::usedVariablesContains):
2041 (JSC::Scope::forEachUsedVariable):
2042 (JSC::Scope::useVariable):
2043 (JSC::Scope::copyCapturedVariablesToVector):
2044 (JSC::Scope::fillParametersForSourceProviderCache):
2045 (JSC::Scope::restoreFromSourceProviderCache):
2046 * parser/ParserFunctionInfo.h:
2047 * parser/SourceProviderCacheItem.h:
2048 (JSC::SourceProviderCacheItem::endFunctionToken):
2049 (JSC::SourceProviderCacheItem::usedVariables):
2050 (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
2052 2016-04-25 Mark Lam <mark.lam@apple.com>
2054 Renaming SpecInt32, SpecInt52, MachineInt to SpecInt32Only, SpecInt52Only, AnyInt.
2055 https://bugs.webkit.org/show_bug.cgi?id=156941
2057 Reviewed by Filip Pizlo.
2059 While looking at https://bugs.webkit.org/show_bug.cgi?id=153431, it was decided
2060 that SpecInt32Only, SpecInt52Only, and AnyInt would be better names for
2061 SpecInt32, SpecInt52, and MachineInt. Let's do a bulk rename.
2063 This is only a renaming patch, and deletion of a piece of unused code. There are
2064 no semantic changes.
2066 * bindings/ScriptValue.cpp:
2067 (Inspector::jsToInspectorValue):
2068 * bytecode/SpeculatedType.cpp:
2069 (JSC::dumpSpeculation):
2070 (JSC::speculationToAbbreviatedString):
2071 (JSC::speculationFromValue):
2072 (JSC::leastUpperBoundOfStrictlyEquivalentSpeculations):
2073 (JSC::typeOfDoubleNegation):
2074 (JSC::typeOfDoubleRounding):
2075 * bytecode/SpeculatedType.h:
2076 (JSC::isInt32Speculation):
2077 (JSC::isInt32OrBooleanSpeculation):
2078 (JSC::isInt32SpeculationForArithmetic):
2079 (JSC::isInt32OrBooleanSpeculationForArithmetic):
2080 (JSC::isInt32OrBooleanSpeculationExpectingDefined):
2081 (JSC::isInt52Speculation):
2082 (JSC::isAnyIntSpeculation):
2083 (JSC::isAnyIntAsDoubleSpeculation):
2084 (JSC::isDoubleRealSpeculation):
2085 (JSC::isMachineIntSpeculation): Deleted.
2086 (JSC::isInt52AsDoubleSpeculation): Deleted.
2087 (JSC::isIntegerSpeculation): Deleted.
2088 * dfg/DFGAbstractInterpreterInlines.h:
2089 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2090 * dfg/DFGAbstractValue.cpp:
2091 (JSC::DFG::AbstractValue::set):
2092 (JSC::DFG::AbstractValue::fixTypeForRepresentation):
2093 (JSC::DFG::AbstractValue::checkConsistency):
2094 (JSC::DFG::AbstractValue::resultType):
2095 * dfg/DFGAbstractValue.h:
2096 (JSC::DFG::AbstractValue::validateType):
2097 * dfg/DFGArgumentsUtilities.cpp:
2098 (JSC::DFG::emitCodeToGetArgumentsArrayLength):
2099 * dfg/DFGByteCodeParser.cpp:
2100 (JSC::DFG::ByteCodeParser::handleInlining):
2101 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
2102 * dfg/DFGFixupPhase.cpp:
2103 (JSC::DFG::FixupPhase::fixupNode):
2104 (JSC::DFG::FixupPhase::fixupToThis):
2105 (JSC::DFG::FixupPhase::observeUseKindOnNode):
2106 (JSC::DFG::FixupPhase::fixIntConvertingEdge):
2107 (JSC::DFG::FixupPhase::fixIntOrBooleanEdge):
2108 (JSC::DFG::FixupPhase::fixDoubleOrBooleanEdge):
2109 (JSC::DFG::FixupPhase::truncateConstantToInt32):
2110 (JSC::DFG::FixupPhase::attemptToMakeIntegerAdd):
2111 (JSC::DFG::FixupPhase::prependGetArrayLength):
2112 (JSC::DFG::FixupPhase::fixupChecksInBlock):
2114 (JSC::DFG::Graph::addShouldSpeculateInt32):
2115 (JSC::DFG::Graph::addShouldSpeculateAnyInt):
2116 (JSC::DFG::Graph::binaryArithShouldSpeculateInt32):
2117 (JSC::DFG::Graph::binaryArithShouldSpeculateAnyInt):
2118 (JSC::DFG::Graph::unaryArithShouldSpeculateInt32):
2119 (JSC::DFG::Graph::unaryArithShouldSpeculateAnyInt):
2120 (JSC::DFG::Graph::addShouldSpeculateMachineInt): Deleted.
2121 (JSC::DFG::Graph::binaryArithShouldSpeculateMachineInt): Deleted.
2122 (JSC::DFG::Graph::unaryArithShouldSpeculateMachineInt): Deleted.
2123 * dfg/DFGInPlaceAbstractState.cpp:
2124 (JSC::DFG::InPlaceAbstractState::initialize):
2125 * dfg/DFGJITCompiler.cpp:
2126 (JSC::DFG::JITCompiler::noticeOSREntry):
2128 (JSC::DFG::Node::convertToIdentityOn):
2130 (JSC::DFG::Node::asNumber):
2131 (JSC::DFG::Node::isAnyIntConstant):
2132 (JSC::DFG::Node::asAnyInt):
2133 (JSC::DFG::Node::isBooleanConstant):
2134 (JSC::DFG::Node::shouldSpeculateInt32OrBooleanExpectingDefined):
2135 (JSC::DFG::Node::shouldSpeculateAnyInt):
2136 (JSC::DFG::Node::shouldSpeculateDouble):
2137 (JSC::DFG::Node::shouldSpeculateNumber):
2138 (JSC::DFG::Node::isMachineIntConstant): Deleted.
2139 (JSC::DFG::Node::asMachineInt): Deleted.
2140 (JSC::DFG::Node::shouldSpeculateMachineInt): Deleted.
2141 * dfg/DFGOSREntry.cpp:
2142 (JSC::DFG::OSREntryData::dumpInContext):
2143 (JSC::DFG::prepareOSREntry):
2144 * dfg/DFGOSREntry.h:
2145 * dfg/DFGPredictionPropagationPhase.cpp:
2146 * dfg/DFGSSALoweringPhase.cpp:
2147 (JSC::DFG::SSALoweringPhase::handleNode):
2148 (JSC::DFG::SSALoweringPhase::lowerBoundsCheck):
2149 * dfg/DFGSafeToExecute.h:
2150 (JSC::DFG::SafeToExecuteEdge::operator()):
2151 * dfg/DFGSpeculativeJIT.cpp:
2152 (JSC::DFG::SpeculativeJIT::silentFill):
2153 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
2154 (JSC::DFG::SpeculativeJIT::compileArithAdd):
2155 (JSC::DFG::SpeculativeJIT::compileArithSub):
2156 (JSC::DFG::SpeculativeJIT::compileArithNegate):
2157 (JSC::DFG::SpeculativeJIT::speculateInt32):
2158 (JSC::DFG::SpeculativeJIT::speculateNumber):
2159 (JSC::DFG::SpeculativeJIT::speculateMisc):
2160 (JSC::DFG::SpeculativeJIT::speculate):
2161 * dfg/DFGSpeculativeJIT.h:
2162 (JSC::DFG::SpeculativeJIT::spill):
2163 (JSC::DFG::SpeculativeJIT::isKnownInteger):
2164 (JSC::DFG::SpeculativeJIT::isKnownCell):
2165 (JSC::DFG::SpeculativeJIT::isKnownNotInteger):
2166 (JSC::DFG::SpeculativeJIT::isKnownNotNumber):
2167 (JSC::DFG::SpeculativeJIT::isKnownNotCell):
2168 (JSC::DFG::SpeculativeJIT::isKnownNotOther):
2169 * dfg/DFGSpeculativeJIT32_64.cpp:
2170 (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal):
2171 (JSC::DFG::SpeculativeJIT::compile):
2172 * dfg/DFGSpeculativeJIT64.cpp:
2173 (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal):
2174 (JSC::DFG::SpeculativeJIT::fillSpeculateInt52):
2175 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
2176 (JSC::DFG::SpeculativeJIT::emitBranch):
2177 (JSC::DFG::SpeculativeJIT::compile):
2178 (JSC::DFG::SpeculativeJIT::blessBoolean):
2179 (JSC::DFG::SpeculativeJIT::convertAnyInt):
2180 (JSC::DFG::SpeculativeJIT::speculateAnyInt):
2181 (JSC::DFG::SpeculativeJIT::speculateDoubleRepAnyInt):
2182 (JSC::DFG::SpeculativeJIT::convertMachineInt): Deleted.
2183 (JSC::DFG::SpeculativeJIT::speculateMachineInt): Deleted.
2184 (JSC::DFG::SpeculativeJIT::speculateDoubleRepMachineInt): Deleted.
2185 * dfg/DFGUseKind.cpp:
2186 (WTF::printInternal):
2188 (JSC::DFG::typeFilterFor):
2189 (JSC::DFG::isNumerical):
2190 (JSC::DFG::isDouble):
2191 * dfg/DFGValidate.cpp:
2192 * dfg/DFGVariableAccessData.cpp:
2193 (JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
2194 (JSC::DFG::VariableAccessData::couldRepresentInt52Impl):
2195 (JSC::DFG::VariableAccessData::flushFormat):
2196 * ftl/FTLCapabilities.cpp:
2197 (JSC::FTL::canCompile):
2198 * ftl/FTLLowerDFGToB3.cpp:
2199 (JSC::FTL::DFG::LowerDFGToB3::compileInt52Constant):
2200 (JSC::FTL::DFG::LowerDFGToB3::compileInt52Rep):
2201 (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub):
2202 (JSC::FTL::DFG::LowerDFGToB3::compileArithNegate):
2203 (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
2204 (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
2205 (JSC::FTL::DFG::LowerDFGToB3::compileArrayPush):
2206 (JSC::FTL::DFG::LowerDFGToB3::lowInt32):
2207 (JSC::FTL::DFG::LowerDFGToB3::strictInt52ToInt32):
2208 (JSC::FTL::DFG::LowerDFGToB3::isInt32):
2209 (JSC::FTL::DFG::LowerDFGToB3::isNotInt32):
2210 (JSC::FTL::DFG::LowerDFGToB3::jsValueToStrictInt52):
2211 (JSC::FTL::DFG::LowerDFGToB3::doubleToStrictInt52):
2212 (JSC::FTL::DFG::LowerDFGToB3::speculate):
2213 (JSC::FTL::DFG::LowerDFGToB3::speculateCellOrOther):
2214 (JSC::FTL::DFG::LowerDFGToB3::speculateAnyInt):
2215 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepReal):
2216 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepAnyInt):
2217 (JSC::FTL::DFG::LowerDFGToB3::speculateMachineInt): Deleted.
2218 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepMachineInt): Deleted.
2219 * jit/JITOpcodes.cpp:
2220 (JSC::JIT::emit_op_profile_type):
2221 * jit/JITOpcodes32_64.cpp:
2222 (JSC::JIT::emit_op_profile_type):
2223 * runtime/JSCJSValue.h:
2224 * runtime/JSCJSValueInlines.h:
2226 (JSC::JSValue::isAnyInt):
2227 (JSC::JSValue::asAnyInt):
2228 (JSC::JSValue::isMachineInt): Deleted.
2229 (JSC::JSValue::asMachineInt): Deleted.
2230 * runtime/RuntimeType.cpp:
2231 (JSC::runtimeTypeForValue):
2232 (JSC::runtimeTypeAsString):
2233 * runtime/RuntimeType.h:
2234 * runtime/TypeSet.cpp:
2235 (JSC::TypeSet::dumpTypes):
2236 (JSC::TypeSet::displayName):
2237 (JSC::TypeSet::inspectorTypeSet):
2238 (JSC::TypeSet::toJSONString):
2240 2016-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
2242 [JSC] Optimize JSON.parse string fast path
2243 https://bugs.webkit.org/show_bug.cgi?id=156953
2245 Reviewed by Mark Lam.
2247 This patch further optimizes the string parsing fast path.
2248 Previously, we generated the WTF::String to hold the ownership of the token's string.
2249 And always copied the token in LiteralParser side.
2250 Instead, we hold the ownership of the token String by the StringBuilder in LiteralParser::Lexer,
2251 and remove the processing in the string parsing fast path.
2252 This patch gives us stable 1 - 2.5% improvement in Kraken json-parse-financial.
2256 json-parse-financial 41.383+-0.248 ^ 40.894+-0.189 ^ definitely 1.0120x faster
2258 * runtime/LiteralParser.cpp:
2259 (JSC::LiteralParser<CharType>::tryJSONPParse):
2260 (JSC::LiteralParser<CharType>::Lexer::lex):
2261 (JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
2262 (JSC::LiteralParser<CharType>::parse):
2263 (JSC::LiteralParser<CharType>::Lexer::lexString): Deleted.
2264 * runtime/LiteralParser.h:
2265 (JSC::LiteralParser::tryLiteralParse):
2266 (JSC::LiteralParser::Lexer::currentToken):
2267 (JSC::LiteralParser::Lexer::LiteralParserTokenPtr::LiteralParserTokenPtr):
2268 (JSC::LiteralParser::Lexer::LiteralParserTokenPtr::operator->):
2270 2016-04-24 Filip Pizlo <fpizlo@apple.com> and Andy VanWagoner <thetalecrafter@gmail.com>
2272 [INTL] Implement String.prototype.localeCompare in ECMA-402
2273 https://bugs.webkit.org/show_bug.cgi?id=147607
2275 Reviewed by Darin Adler.
2277 Part of this change is just rolling 194394 back in.
2279 The other part is making that not a regression on CDjs. Other than the fact that it uses
2280 bound functions, the problem with this new localeCompare implementation is that it uses
2281 the arguments object. It uses it in a way that *seems* like ArgumentsEliminationPhase
2282 ought to handle, but to my surprise it didn't:
2284 - If we have a ForceExit GetByVal on the arguments object, we would previously assume that
2285 it escaped. That's false since we just exit at ForceExit. On the other hand we probably
2286 should be pruning unreachable paths before we get here, but that's a separate issue. I
2287 don't want to play with phase order right now.
2289 - If we have a OutOfBounds GetByVal on the arguments object, then the best that would
2290 previously happen is that we'd compile it into an in-bounds arguments access. That's quite
2291 bad, as Andy's localeCompare illustrates: it uses out-of-bounds access on the arguments
2292 object to detect if an argument was passed. This change introduces an OutOfBounds version
2293 of GetMyArgumentByVal for this purpose.
2295 This change required registering sane chain watchpoints. In the process, I noticed that the
2296 old way of doing it had a race condition: we might register watchpoints for the structure
2297 that had become insane. This change introduces a double-checking idiom that I believe works
2298 because once the structure becomes insane it can't go back to sane and watchpoints
2299 registration already involves executing the hardest possible fences.
2301 * builtins/StringPrototype.js:
2305 * dfg/DFGAbstractInterpreterInlines.h:
2306 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2307 * dfg/DFGArgumentsEliminationPhase.cpp:
2308 * dfg/DFGArrayMode.cpp:
2309 (JSC::DFG::ArrayMode::refine):
2310 * dfg/DFGClobberize.h:
2311 (JSC::DFG::clobberize):
2312 * dfg/DFGConstantFoldingPhase.cpp:
2313 (JSC::DFG::ConstantFoldingPhase::foldConstants):
2314 * dfg/DFGDoesGC.cpp:
2316 * dfg/DFGFixupPhase.cpp:
2317 (JSC::DFG::FixupPhase::fixupNode):
2318 * dfg/DFGNodeType.h:
2319 * dfg/DFGPreciseLocalClobberize.h:
2320 (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
2321 * dfg/DFGPredictionPropagationPhase.cpp:
2322 * dfg/DFGSafeToExecute.h:
2323 (JSC::DFG::safeToExecute):
2324 * dfg/DFGSpeculativeJIT.cpp:
2325 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
2326 * dfg/DFGSpeculativeJIT32_64.cpp:
2327 (JSC::DFG::SpeculativeJIT::compile):
2328 * dfg/DFGSpeculativeJIT64.cpp:
2329 (JSC::DFG::SpeculativeJIT::compile):
2330 * dfg/DFGValidate.cpp:
2331 * ftl/FTLCapabilities.cpp:
2332 (JSC::FTL::canCompile):
2333 * ftl/FTLLowerDFGToB3.cpp:
2334 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
2335 (JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):
2336 (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
2337 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt):
2338 * ftl/FTLTypedPointer.h:
2339 (JSC::FTL::TypedPointer::TypedPointer):
2340 (JSC::FTL::TypedPointer::operator bool):
2341 (JSC::FTL::TypedPointer::heap):
2342 (JSC::FTL::TypedPointer::operator!): Deleted.
2343 * runtime/StringPrototype.cpp:
2344 (JSC::StringPrototype::finishCreation):
2346 2016-04-23 Filip Pizlo <fpizlo@apple.com>
2348 Unreviewed, unbreak cloop.
2351 (JSC::VM::getHostFunction):
2353 2016-04-22 Filip Pizlo <fpizlo@apple.com>
2355 Speed up bound functions a bit
2356 https://bugs.webkit.org/show_bug.cgi?id=156889
2358 Reviewed by Saam Barati.
2360 Bound functions are hard to optimize because JSC doesn't have a good notion of non-JS code
2361 that does JS-ey things like make JS calls. What I mean by "non-JS code" is code that did not
2362 originate from JS source. A bound function does a highly polymorphic call to the target
2363 stored in the JSBoundFunction. Prior to this change, we represented it as native code that
2364 used the generic native->JS call API. That's not cheap.
2366 We could model bound functions using a builtin, but it's not clear that this would be easy
2367 to grok, since so much of the code would have to access special parts of the JSBoundFunction
2368 type. Doing it that way might solve the performance problems but it would mean extra work to
2369 arrange for the builtin to have speedy access to the call target, the bound this, and the
2370 bound arguments. Also, optimizing bound functions that way would mean that bound function
2371 performance would be gated on the performance of a bunch of other things in our system. For
2372 example, we'd want this polymorphic call to be handled like the funnel that it is: if we're
2373 compiling the bound function's outgoing call with no context then we should compile it as
2374 fully polymorphic but we can let it assume basic sanity like that the callee is a real
2375 function; but if we're compiling the call with any amount of calling context then we want to
2376 use normal call IC's.
2378 Since the builtin path wouldn't lead to a simpler patch and since I think that the VM will
2379 benefit in the long run from using custom handling for bound functions, I kept the native
2380 code and just added Intrinsic/thunk support.
2382 This just adds an Intrinsic for bound function calls where the JSBoundFunction targets a
2383 JSFunction instance and has no bound arguments (only bound this). This intrinsic is
2384 currently only implemented as a thunk and not yet recognized by the DFG bytecode parser.
2386 I needed to loosen some restrictions to do this. For one, I was really tired of our bad use
2387 of ENABLE(JIT) conditionals, which made it so that any serious client of Intrinsics would
2388 have to have #ifdefs. Really what should happen is that if the JIT is not enabled then we
2389 just ignore intrinsics. Also, the code was previously assuming that having a native
2390 constructor and knowing the Intrinsic for your native call were mutually exclusive. This
2391 change makes it possible to have a native executable that has a custom function, custom
2392 constructor, and an Intrinsic.
2394 This is a >4x speed-up on bound function calls with no bound arguments.
2396 In the future, we should teach the DFG Intrinsic handling to deal with bound functions and
2397 we should teach the inliner (and ByteCodeParser::handleCall() in general) how to deal with
2398 the function call inside the bound function. That would be super awesome.
2400 * assembler/AbstractMacroAssembler.h:
2401 (JSC::AbstractMacroAssembler::timesPtr):
2402 (JSC::AbstractMacroAssembler::Address::withOffset):
2403 (JSC::AbstractMacroAssembler::BaseIndex::BaseIndex):
2404 (JSC::MacroAssemblerType>::Address::indexedBy):
2405 * jit/AssemblyHelpers.h:
2406 (JSC::AssemblyHelpers::storeCell):
2407 (JSC::AssemblyHelpers::loadCell):
2408 (JSC::AssemblyHelpers::storeValue):
2409 (JSC::AssemblyHelpers::emitSaveCalleeSaves):
2410 (JSC::AssemblyHelpers::emitSaveThenMaterializeTagRegisters):
2411 (JSC::AssemblyHelpers::emitRestoreCalleeSaves):
2412 (JSC::AssemblyHelpers::emitRestoreSavedTagRegisters):
2413 (JSC::AssemblyHelpers::copyCalleeSavesToVMCalleeSavesBuffer):
2414 * jit/JITThunks.cpp:
2415 (JSC::JITThunks::ctiNativeTailCall):
2416 (JSC::JITThunks::ctiNativeTailCallWithoutSavedTags):
2417 (JSC::JITThunks::ctiStub):
2418 (JSC::JITThunks::hostFunctionStub):
2419 (JSC::JITThunks::clearHostFunctionStubs):
2421 * jit/SpecializedThunkJIT.h:
2422 (JSC::SpecializedThunkJIT::callDoubleToDoublePreservingReturn):
2423 (JSC::SpecializedThunkJIT::tagReturnAsInt32):
2424 (JSC::SpecializedThunkJIT::emitSaveThenMaterializeTagRegisters): Deleted.
2425 (JSC::SpecializedThunkJIT::emitRestoreSavedTagRegisters): Deleted.
2426 * jit/ThunkGenerators.cpp:
2427 (JSC::virtualThunkFor):
2428 (JSC::nativeForGenerator):
2429 (JSC::nativeCallGenerator):
2430 (JSC::nativeTailCallGenerator):
2431 (JSC::nativeTailCallWithoutSavedTagsGenerator):
2432 (JSC::nativeConstructGenerator):
2433 (JSC::randomThunkGenerator):
2434 (JSC::boundThisNoArgsFunctionCallGenerator):
2435 * jit/ThunkGenerators.h:
2436 * runtime/Executable.cpp:
2437 (JSC::NativeExecutable::create):
2438 (JSC::NativeExecutable::destroy):
2439 (JSC::NativeExecutable::createStructure):
2440 (JSC::NativeExecutable::finishCreation):
2441 (JSC::NativeExecutable::NativeExecutable):
2442 (JSC::ScriptExecutable::ScriptExecutable):
2443 * runtime/Executable.h:
2444 * runtime/FunctionPrototype.cpp:
2445 (JSC::functionProtoFuncBind):
2446 * runtime/IntlCollatorPrototype.cpp:
2447 (JSC::IntlCollatorPrototypeGetterCompare):
2448 * runtime/Intrinsic.h:
2449 * runtime/JSBoundFunction.cpp:
2450 (JSC::boundThisNoArgsFunctionCall):
2451 (JSC::boundFunctionCall):
2452 (JSC::boundThisNoArgsFunctionConstruct):
2453 (JSC::boundFunctionConstruct):
2454 (JSC::getBoundFunctionStructure):
2455 (JSC::JSBoundFunction::create):
2456 (JSC::JSBoundFunction::customHasInstance):
2457 (JSC::JSBoundFunction::JSBoundFunction):
2458 * runtime/JSBoundFunction.h:
2459 (JSC::JSBoundFunction::targetFunction):
2460 (JSC::JSBoundFunction::boundThis):
2461 (JSC::JSBoundFunction::boundArgs):
2462 (JSC::JSBoundFunction::createStructure):
2463 (JSC::JSBoundFunction::offsetOfTargetFunction):
2464 (JSC::JSBoundFunction::offsetOfBoundThis):
2465 * runtime/JSFunction.cpp:
2466 (JSC::JSFunction::lookUpOrCreateNativeExecutable):
2467 (JSC::JSFunction::create):
2469 (JSC::thunkGeneratorForIntrinsic):
2470 (JSC::VM::getHostFunction):
2472 (JSC::VM::getCTIStub):
2473 (JSC::VM::exceptionOffset):
2475 2016-04-22 Joonghun Park <jh718.park@samsung.com>
2477 [JSC] Fix build break since r199866
2478 https://bugs.webkit.org/show_bug.cgi?id=156892
2480 Reviewed by Darin Adler.
2482 * runtime/MathCommon.cpp: Follow up to r199913. Remove 'include cmath' in cpp file.
2484 2016-04-22 Yusuke Suzuki <utatane.tea@gmail.com>
2486 [JSC] Optimize number parsing and string parsing in LiteralParser
2487 https://bugs.webkit.org/show_bug.cgi?id=156896
2489 Reviewed by Mark Lam.
2491 This patch aim to improve JSON.parse performance. Major 2 optimizations are included.
2493 1. Change `double result` to `int32_t result` in integer parsing case.
2494 We already have the optimized path for integer parsing, when it's digits are less than 10.
2495 At that case, the maximum number is 999999999, and the minimum number is -99999999.
2496 The both are in range of Int32. So We can use int32_t for accumulation instead of double.
2498 2. Add the string parsing fast / slow cases.
2499 We add the fast case for string parsing, which does not include any escape sequences.
2501 Both optimizations improve Kraken json-parse-financial, roughly 3.5 - 4.5%.
2503 json-parse-financial 49.128+-1.589 46.979+-0.912 might be 1.0457x faster
2505 * runtime/LiteralParser.cpp:
2506 (JSC::isJSONWhiteSpace):
2507 (JSC::isSafeStringCharacter):
2508 (JSC::LiteralParser<CharType>::Lexer::lexString):
2509 (JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
2510 (JSC::LiteralParser<CharType>::Lexer::lexNumber):
2511 * runtime/LiteralParser.h:
2513 2016-04-22 Joseph Pecoraro <pecoraro@apple.com>
2515 Web Inspector: Source directives lost when using Function constructor repeatedly
2516 https://bugs.webkit.org/show_bug.cgi?id=156863
2517 <rdar://problem/25861064>
2519 Reviewed by Geoffrey Garen.
2521 Source directives (sourceURL and sourceMappingURL) are normally accessed through
2522 the SourceProvider and normally set when the script is parsed. However, when a
2523 CodeCache lookup skips parsing, the new SourceProvider never gets the directives
2524 (sourceURL/sourceMappingURL). This patch stores the directives on the UnlinkedCodeBlock
2525 and UnlinkedFunctionExecutable when entering the cache, and copies to the new providers
2526 when the cache is used.
2528 * bytecode/UnlinkedCodeBlock.h:
2529 (JSC::UnlinkedCodeBlock::sourceURLDirective):
2530 (JSC::UnlinkedCodeBlock::sourceMappingURLDirective):
2531 (JSC::UnlinkedCodeBlock::setSourceURLDirective):
2532 (JSC::UnlinkedCodeBlock::setSourceMappingURLDirective):
2533 * bytecode/UnlinkedFunctionExecutable.h:
2534 * parser/SourceProvider.h:
2535 * runtime/CodeCache.cpp:
2536 (JSC::CodeCache::getGlobalCodeBlock):
2537 (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
2538 * runtime/CodeCache.h:
2539 Store directives on the unlinked code block / executable when adding
2540 to the cache, so they can be used to update new providers when the
2543 * runtime/JSGlobalObject.cpp:
2544 Add needed header after CodeCache header cleanup.
2546 2016-04-22 Mark Lam <mark.lam@apple.com>
2548 javascript jit bug affecting Google Maps.
2549 https://bugs.webkit.org/show_bug.cgi?id=153431
2551 Reviewed by Filip Pizlo.
2553 The issue was due to the abstract interpreter wrongly marking the type of the
2554 value read from the Uint3Array as SpecInt52, which precludes it from being an
2555 Int32. This proves to be false, and the generated code failed to handle the case
2556 where the read value is actually an Int32.
2558 The fix is to have the abstract interpreter use SpecMachineInt instead of
2561 * bytecode/SpeculatedType.h:
2562 * dfg/DFGAbstractInterpreterInlines.h:
2563 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2565 2016-04-22 Benjamin Poulain <bpoulain@apple.com>
2567 [JSC] PredictionPropagation should not be in the top 5 heaviest phases
2568 https://bugs.webkit.org/show_bug.cgi?id=156891
2570 Reviewed by Mark Lam.
2572 In DFG, PredictionPropagation is often way too high in profiles.
2573 It is a simple phase, it should not be that hot.
2575 Most of the time is spent accessing memory. This patch attempts
2578 First, propagate() is split in processInvariants() and propagates().
2579 The step processInvariants() sets all the types for nodes for which
2580 the type does not depends on other nodes.
2582 Adding processInvariants() lowers two hotspot inside PredictionPropagation:
2583 speculationFromValue() and setPrediction().
2585 Next, to avoid touching all the nodes at every operation, we keep
2586 track of the nodes that actually need propagate().
2587 The vector m_dependentNodes keeps the list of those nodes and propagate()
2588 only need to process them at each phase.
2590 This is a smaller gain because growing m_dependentNodes negates
2593 On 3d-cube, this moves PredictionPropagation from fifth position
2594 to ninth. A lot of the remaining overhead is caused by double-voting
2595 and cannot be fixed by moving stuff around.
2597 * dfg/DFGPredictionPropagationPhase.cpp:
2598 (JSC::DFG::PredictionPropagationPhase::propagateToFixpoint): Deleted.
2599 (JSC::DFG::PredictionPropagationPhase::propagate): Deleted.
2600 (JSC::DFG::PredictionPropagationPhase::propagateForward): Deleted.
2601 (JSC::DFG::PredictionPropagationPhase::propagateBackward): Deleted.
2602 (JSC::DFG::PredictionPropagationPhase::doDoubleVoting): Deleted.
2603 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting): Deleted.
2604 (JSC::DFG::PredictionPropagationPhase::propagateThroughArgumentPositions): Deleted.
2606 2016-04-22 Geoffrey Garen <ggaren@apple.com>
2608 super should be available in object literals
2609 https://bugs.webkit.org/show_bug.cgi?id=156933
2611 Reviewed by Saam Barati.
2613 When we originally implemented classes, super seemed to be a class-only
2614 feature. But the final spec says it's available in object literals too.
2616 * bytecompiler/NodesCodegen.cpp:
2617 (JSC::PropertyListNode::emitBytecode): Having 'super' and being a class
2618 property are no longer synonymous, so we track two separate variables.
2620 (JSC::PropertyListNode::emitPutConstantProperty): Being inside the super
2621 branch no longer guarantees that you're a class property, so we decide
2622 our attributes and our function name dynamically.
2624 * parser/ASTBuilder.h:
2625 (JSC::ASTBuilder::createArrowFunctionExpr):
2626 (JSC::ASTBuilder::createGetterOrSetterProperty):
2627 (JSC::ASTBuilder::createArguments):
2628 (JSC::ASTBuilder::createArgumentsList):
2629 (JSC::ASTBuilder::createProperty):
2630 (JSC::ASTBuilder::createPropertyList): Pass through state to indicate
2631 whether we're a class property, since we can't infer it from 'super'
2634 * parser/NodeConstructors.h:
2635 (JSC::PropertyNode::PropertyNode): See ASTBuilder.h.
2638 (JSC::PropertyNode::expressionName):
2639 (JSC::PropertyNode::name):
2640 (JSC::PropertyNode::type):
2641 (JSC::PropertyNode::needsSuperBinding):
2642 (JSC::PropertyNode::isClassProperty):
2643 (JSC::PropertyNode::putType): See ASTBuilder.h.
2645 * parser/Parser.cpp:
2646 (JSC::Parser<LexerType>::parseFunctionInfo):
2647 (JSC::Parser<LexerType>::parseClass):
2648 (JSC::Parser<LexerType>::parseProperty):
2649 (JSC::Parser<LexerType>::parsePropertyMethod):
2650 (JSC::Parser<LexerType>::parseGetterSetter):
2651 (JSC::Parser<LexerType>::parseMemberExpression): I made these error
2652 messages generic because it is no longer practical to say concise things
2653 about the list of places you can use super.
2657 * parser/SyntaxChecker.h:
2658 (JSC::SyntaxChecker::createArgumentsList):
2659 (JSC::SyntaxChecker::createProperty):
2660 (JSC::SyntaxChecker::appendExportSpecifier):
2661 (JSC::SyntaxChecker::appendConstDecl):
2662 (JSC::SyntaxChecker::createGetterOrSetterProperty): Updated for
2665 * tests/stress/generator-with-super.js:
2667 * tests/stress/modules-syntax-error.js:
2668 * tests/stress/super-in-lexical-scope.js:
2670 (testSyntaxError.test):
2671 * tests/stress/tagged-templates-syntax.js: Updated for error message
2672 changes. See Parser.cpp.
2674 2016-04-22 Filip Pizlo <fpizlo@apple.com>
2676 ASSERT(m_stack.last().isTailDeleted) at ShadowChicken.cpp:127 inspecting the inspector
2677 https://bugs.webkit.org/show_bug.cgi?id=156930
2679 Reviewed by Joseph Pecoraro.
2681 The loop that prunes the stack from the top should preserve the invariant that the top frame
2682 cannot be tail-deleted.
2684 * interpreter/ShadowChicken.cpp:
2685 (JSC::ShadowChicken::update):
2687 2016-04-22 Benjamin Poulain <benjamin@webkit.org>
2689 Attempt to fix the CLoop after r199866
2691 * runtime/MathCommon.h:
2693 2016-04-22 Benjamin Poulain <bpoulain@apple.com>
2695 [JSC] Integer Multiply of a number by itself does not need negative zero support
2696 https://bugs.webkit.org/show_bug.cgi?id=156895
2698 Reviewed by Saam Barati.
2700 You cannot produce negative zero by squaring an integer.
2702 * dfg/DFGFixupPhase.cpp:
2703 (JSC::DFG::FixupPhase::fixupNode):
2704 * dfg/DFGSpeculativeJIT.cpp:
2705 (JSC::DFG::SpeculativeJIT::compileArithMul):
2706 Minor codegen fixes:
2707 -Use the right form of multiply for ARM.
2708 -Use a sign-extended 32bit immediates, that's the one with fast forms
2709 in the MacroAssembler.
2711 2016-04-21 Darin Adler <darin@apple.com>
2713 Follow-on to the build fix.
2715 * runtime/MathCommon.h: Use the C++ std namespace version of the
2718 2016-04-21 Joonghun Park <jh718.park@samsung.com>
2720 [JSC] Fix build break since r199866. Unreviewed.
2721 https://bugs.webkit.org/show_bug.cgi?id=156892
2723 * runtime/MathCommon.h: Add namespace std to isnormal invoking.
2725 2016-04-21 Benjamin Poulain <bpoulain@apple.com>
2727 [JSC] Add primitive String support to compare operators
2728 https://bugs.webkit.org/show_bug.cgi?id=156783
2730 Reviewed by Geoffrey Garen.
2733 We should eventually inline some of the simplest cases.
2735 This is a 2% improvement on Longspider. It is unfortunately neutral
2736 for Sunspider on my machine because most of the comparison are from
2739 * dfg/DFGAbstractInterpreterInlines.h:
2740 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2741 * dfg/DFGClobberize.h:
2742 (JSC::DFG::clobberize):
2743 * dfg/DFGFixupPhase.cpp:
2744 (JSC::DFG::FixupPhase::fixupNode):
2745 * dfg/DFGOperations.cpp:
2746 * dfg/DFGOperations.h:
2747 * dfg/DFGSpeculativeJIT.cpp:
2748 (JSC::DFG::SpeculativeJIT::compare):
2749 (JSC::DFG::SpeculativeJIT::compileStringCompare):
2750 (JSC::DFG::SpeculativeJIT::compileStringIdentCompare):
2751 * dfg/DFGSpeculativeJIT.h:
2752 (JSC::DFG::SpeculativeJIT::callOperation):
2753 * ftl/FTLCapabilities.cpp:
2754 (JSC::FTL::canCompile):
2755 * ftl/FTLLowerDFGToB3.cpp:
2756 (JSC::FTL::DFG::LowerDFGToB3::compileCompareLess):
2757 (JSC::FTL::DFG::LowerDFGToB3::compileCompareLessEq):
2758 (JSC::FTL::DFG::LowerDFGToB3::compileCompareGreater):
2759 (JSC::FTL::DFG::LowerDFGToB3::compileCompareGreaterEq):
2760 (JSC::FTL::DFG::LowerDFGToB3::compare):
2762 (JSC::FTL::Output::callWithoutSideEffects):
2763 * jit/JITOperations.h:
2764 * tests/stress/string-compare.js: Added.
2767 (let.operator.of.operators.eval.compareStringIdent):
2768 (let.operator.of.operators.compareStringString):
2769 (let.operator.of.operators.compareStringIdentString):
2770 (let.operator.of.operators.compareStringStringIdent):
2771 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.eval):
2773 2016-04-21 Benjamin Poulain <bpoulain@webkit.org>
2775 [JSC] Commute FDiv-by-constant into FMul-by-reciprocal when it is safe
2776 https://bugs.webkit.org/show_bug.cgi?id=156871
2778 Reviewed by Filip Pizlo.
2780 FMul is significantly faster than FDiv.
2781 For example, on Haswell, FMul has a latency of 5, a throughput of 1
2782 while FDiv has latency 10-24, throughput 8-18.
2784 Fortunately for us, Sunspider and Kraken have plenty of division
2785 by a simple power of 2 constant. Those are just exponent operations
2786 and can be easily reversed to use FMul instead of FDiv.
2788 LLVM does something similar in InstCombine.
2790 * dfg/DFGStrengthReductionPhase.cpp:
2791 (JSC::DFG::StrengthReductionPhase::handleNode):
2792 * jit/JITDivGenerator.cpp:
2793 (JSC::JITDivGenerator::loadOperand):
2794 (JSC::JITDivGenerator::generateFastPath):
2795 * jit/SnippetOperand.h:
2796 (JSC::SnippetOperand::asConstNumber):
2797 * runtime/MathCommon.h:
2798 (JSC::safeReciprocalForDivByConst):
2799 * tests/stress/floating-point-div-to-mul.js: Added.
2803 (opaqueDivBySafeMaxMinusOne):
2804 (opaqueDivBySafeMax):
2805 (opaqueDivBySafeMaxPlusOne):
2806 (opaqueDivBySafeMin):
2807 (opaqueDivBySafeMinMinusOne):
2809 (i.result.opaqueDivBySafeMin.valueOf):
2811 2016-04-21 Benjamin Poulain <benjamin@webkit.org>
2813 [JSC] Improve the absThunkGenerator() for 64bit
2814 https://bugs.webkit.org/show_bug.cgi?id=156888
2816 Reviewed by Michael Saboff.
2818 A few tests spend a lot of time in this abs() with double argument.
2820 This patch adds custom handling for the JSValue64 representation.
2822 -Do not load the value twice. Unbox the GPR if it is not an Int32.
2823 -Deal with IntMin inline instead of falling back to the C function call.
2824 -Box the values ourself to avoid a duplicate function tail and return.
2826 * jit/ThunkGenerators.cpp:
2827 (JSC::absThunkGenerator):
2829 2016-04-21 Saam barati <sbarati@apple.com>
2831 LLInt CallSiteIndex off by 1
2832 https://bugs.webkit.org/show_bug.cgi?id=156886
2834 Reviewed by Benjamin Poulain.
2836 I think was done for historical reasons but isn't needed anymore.
2838 * llint/LLIntSlowPaths.cpp:
2840 2016-04-21 Keith Miller <keith_miller@apple.com>
2842 FTL should handle exceptions in operationInOptimize
2843 https://bugs.webkit.org/show_bug.cgi?id=156885
2845 Reviewed by Michael Saboff.
2847 For some reasone we didn't handle any exceptions in "in" when we called
2848 operationInOptimize in the FTL.
2850 * bytecode/CodeBlock.cpp:
2851 (JSC::CodeBlock::dumpAssumingJITType):
2852 * ftl/FTLCapabilities.cpp:
2853 (JSC::FTL::canCompile):
2854 * ftl/FTLLowerDFGToB3.cpp:
2855 (JSC::FTL::DFG::LowerDFGToB3::compileIn):
2856 * ftl/FTLPatchpointExceptionHandle.h: Add comments explaining which
2857 function to use for different exception types.
2860 (GlobalObject::finishCreation):
2862 * runtime/Executable.cpp:
2863 (JSC::ScriptExecutable::ScriptExecutable):
2864 * runtime/Executable.h:
2865 (JSC::ScriptExecutable::setNeverFTLOptimize):
2866 (JSC::ScriptExecutable::neverFTLOptimize):
2867 * tests/stress/in-ftl-exception-check.js: Added.
2872 2016-04-21 Filip Pizlo <fpizlo@apple.com>
2874 JSC virtual call thunk shouldn't do a structure->classInfo lookup
2875 https://bugs.webkit.org/show_bug.cgi?id=156874
2877 Reviewed by Keith Miller.
2879 This lookup was unnecessary because we can just test the inlined type field.
2881 But also, this meant that we were exempting JSBoundFunction from the virtual call optimization.
2884 * jit/ThunkGenerators.cpp:
2885 (JSC::virtualThunkFor):
2887 2016-04-21 Joseph Pecoraro <pecoraro@apple.com>
2889 Web Inspector: sourceMappingURL not loaded in generated script
2890 https://bugs.webkit.org/show_bug.cgi?id=156022
2891 <rdar://problem/25438595>
2893 Reviewed by Geoffrey Garen.
2895 * inspector/JSGlobalObjectInspectorController.cpp:
2896 (Inspector::JSGlobalObjectInspectorController::appendAPIBacktrace):
2897 Synthetic CallFrames for native code will not have script identifiers.
2899 * inspector/ScriptCallFrame.cpp:
2900 (Inspector::ScriptCallFrame::ScriptCallFrame):
2901 (Inspector::ScriptCallFrame::isEqual):
2902 (Inspector::ScriptCallFrame::buildInspectorObject):
2903 * inspector/ScriptCallFrame.h:
2904 * inspector/protocol/Console.json:
2905 Include the script identifier in ScriptCallFrame so we can correlate this
2906 to the exactly script, even if there isn't a URL. The Script may have a
2907 sourceURL, so the Web Inspector frontend may decide to show / link to it.
2909 * inspector/ScriptCallStackFactory.cpp:
2910 (Inspector::CreateScriptCallStackFunctor::operator()):
2911 (Inspector::createScriptCallStackFromException):
2912 Include SourceID when we have it.
2914 * interpreter/Interpreter.cpp:
2915 (JSC::GetStackTraceFunctor::operator()):
2916 * interpreter/Interpreter.h:
2917 * interpreter/StackVisitor.cpp:
2918 (JSC::StackVisitor::Frame::sourceID):
2919 * interpreter/StackVisitor.h:
2920 Access the SourceID when we have it.
2922 2016-04-21 Saam barati <sbarati@apple.com>
2924 Lets do less locking of symbol tables in the BytecodeGenerator where we don't have race conditions
2925 https://bugs.webkit.org/show_bug.cgi?id=156821
2927 Reviewed by Filip Pizlo.
2929 The BytecodeGenerator allocates all the SymbolTables that it uses.
2930 This is before any concurrent compiler thread can use that SymbolTable.
2931 This means we don't actually need to lock for any operations of the
2932 SymbolTable. This patch makes this change by removing all locking.
2933 To do this, I've introduced a new constructor for ConcurrentJITLocker
2934 which implies no locking is necessary. You instantiate such a ConcurrentJITLocker like so:
2935 `ConcurrentJITLocker locker(ConcurrentJITLocker::NoLockingNecessary);`
2937 This patch also removes all uses of Strong<SymbolTable> from the bytecode
2938 generator and instead wraps bytecode generation in a DeferGC.
2940 * bytecode/UnlinkedFunctionExecutable.cpp:
2941 (JSC::generateUnlinkedFunctionCodeBlock):
2942 * bytecompiler/BytecodeGenerator.cpp:
2943 (JSC::BytecodeGenerator::BytecodeGenerator):
2944 (JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
2945 (JSC::BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded):
2946 (JSC::BytecodeGenerator::instantiateLexicalVariables):
2947 (JSC::BytecodeGenerator::emitPrefillStackTDZVariables):
2948 (JSC::BytecodeGenerator::pushLexicalScopeInternal):
2949 (JSC::BytecodeGenerator::initializeBlockScopedFunctions):
2950 (JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
2951 (JSC::BytecodeGenerator::popLexicalScopeInternal):
2952 (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration):
2953 (JSC::BytecodeGenerator::variable):
2954 (JSC::BytecodeGenerator::createVariable):
2955 (JSC::BytecodeGenerator::emitResolveScope):
2956 (JSC::BytecodeGenerator::emitPushWithScope):
2957 (JSC::BytecodeGenerator::emitPushFunctionNameScope):
2958 * bytecompiler/BytecodeGenerator.h:
2959 (JSC::BytecodeGenerator::constructorKind):
2960 (JSC::BytecodeGenerator::superBinding):
2961 (JSC::BytecodeGenerator::generate):
2962 * runtime/CodeCache.cpp:
2963 (JSC::CodeCache::getGlobalCodeBlock):
2964 * runtime/ConcurrentJITLock.h:
2965 (JSC::ConcurrentJITLockerBase::ConcurrentJITLockerBase):
2966 (JSC::ConcurrentJITLockerBase::~ConcurrentJITLockerBase):
2967 (JSC::ConcurrentJITLocker::ConcurrentJITLocker):
2969 2016-04-21 Saam barati <sbarati@apple.com>
2971 Remove some unnecessary RefPtrs in the parser
2972 https://bugs.webkit.org/show_bug.cgi?id=156865
2974 Reviewed by Filip Pizlo.
2976 The IdentifierArena or the SourceProviderCacheItem will own these UniquedStringImpls
2977 while we are using them. There is no need for us to reference count them.
2979 This might be a 0.5% speedup on octane code-load.
2981 * parser/Parser.cpp:
2982 (JSC::Parser<LexerType>::parseInner):
2984 (JSC::Scope::setIsLexicalScope):
2985 (JSC::Scope::isLexicalScope):
2986 (JSC::Scope::closedVariableCandidates):
2987 (JSC::Scope::declaredVariables):
2988 (JSC::Scope::lexicalVariables):
2989 (JSC::Scope::finalizeLexicalEnvironment):
2990 (JSC::Scope::computeLexicallyCapturedVariablesAndPurgeCandidates):
2991 (JSC::Scope::collectFreeVariables):
2992 (JSC::Scope::getCapturedVars):
2993 (JSC::Scope::setStrictMode):
2994 (JSC::Scope::isValidStrictMode):
2995 (JSC::Scope::shadowsArguments):
2996 (JSC::Scope::copyCapturedVariablesToVector):
2997 * parser/SourceProviderCacheItem.h:
2998 (JSC::SourceProviderCacheItem::usedVariables):
2999 (JSC::SourceProviderCacheItem::~SourceProviderCacheItem):
3000 (JSC::SourceProviderCacheItem::create):
3001 (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
3002 (JSC::SourceProviderCacheItem::writtenVariables): Deleted.
3004 2016-04-21 Filip Pizlo <fpizlo@apple.com>
3006 PolymorphicAccess adds sizeof(CallerFrameAndPC) rather than subtracting it when calculating stack height
3007 https://bugs.webkit.org/show_bug.cgi?id=156872
3009 Reviewed by Geoffrey Garen.
3011 The code that added sizeof(CallerFrameAndPC) emerged from a bad copy-paste in r189586. That was
3012 the revision that created the PolymorphicAccess class. It moved code for generating a
3013 getter/setter call from Repatch.cpp to PolymorphicAccess.cpp. You can see the code doing a
3016 http://trac.webkit.org/changeset/189586/trunk/Source/JavaScriptCore/jit/Repatch.cpp
3018 This makes the world right again.
3020 * bytecode/PolymorphicAccess.cpp:
3021 (JSC::AccessCase::generateImpl):
3023 2016-04-21 Geoffrey Garen <ggaren@apple.com>
3025 Build warning: CODE_SIGN_ENTITLEMENTS specified without specifying CODE_SIGN_IDENTITY
3026 https://bugs.webkit.org/show_bug.cgi?id=156862
3028 Reviewed by Joseph Pecoraro.
3030 * Configurations/Base.xcconfig: Specify the ad hoc signing identity by
3031 default. See <http://trac.webkit.org/changeset/143544>.
3033 2016-04-21 Andy Estes <aestes@apple.com>
3035 REGRESSION (r199734): WebKit crashes loading numerous websites in iOS Simulator
3036 https://bugs.webkit.org/show_bug.cgi?id=156842
3038 Reviewed by Daniel Bates.
3040 Disable separated heap on iOS Simulator.
3042 * runtime/Options.cpp:
3043 (JSC::recomputeDependentOptions):
3045 2016-04-21 Michael Saboff <msaboff@apple.com>
3047 Align RegExp[@@match] with other @@ methods
3048 https://bugs.webkit.org/show_bug.cgi?id=156832
3050 Reviewed by Mark Lam.
3052 Various changes to align the RegExp[@@match] with [@@search] and [@@split].
3054 Made RegExp.prototype.@exec a hidden property on the global object and
3055 called it @regExpBuiltinExec to match the name it has in the standard.
3056 Changed all places that used the old name to use the new one.
3058 Made the match fast path function, which used to be call @match, to be called
3059 @regExpMatchFast and put it on the global object. Changed it to also handle
3060 expressions both with and without the global flag. Refactored the builtin
3063 Added the builtin function @hasObservableSideEffectsForRegExpMatch() that
3064 checks to see if we can use the fast path of if we need the explicit version.
3066 Put the main RegExp functions @match, @search and @split in alphabetical
3067 order in RegExpPrototype.js. Did the same for @match, @repeat, @search and
3068 @split in StringPrototype.js.
3070 * builtins/RegExpPrototype.js:
3072 (hasObservableSideEffectsForRegExpMatch): New.
3075 (hasObservableSideEffectsForRegExpSplit):
3076 Reordered in the file and updated to use @regExpBuiltinExec.
3078 * builtins/StringPrototype.js:
3084 Reordered functions in the file.
3086 * runtime/CommonIdentifiers.h:
3087 * runtime/JSGlobalObject.cpp:
3088 (JSC::JSGlobalObject::setGlobalThis):
3090 (JSC::getGetterById):
3091 (JSC::JSGlobalObject::init):
3092 * runtime/RegExpPrototype.cpp:
3093 (JSC::RegExpPrototype::finishCreation):
3094 (JSC::regExpProtoFuncExec):
3095 (JSC::regExpProtoFuncMatchFast):
3096 (JSC::regExpProtoFuncMatchPrivate): Deleted.
3097 * runtime/RegExpPrototype.h:
3099 2016-04-20 Geoffrey Garen <ggaren@apple.com>
3101 JavaScriptCore garbage collection is missing an autorelease pool
3102 https://bugs.webkit.org/show_bug.cgi?id=156751
3103 <rdar://problem/25787802>
3105 Reviewed by Mark Lam.
3108 (JSC::Heap::releaseDelayedReleasedObjects): Add an autorelease pool to
3109 catch autoreleases when we call out to arbitrary ObjC code.
3111 We use the C interface here because this is not an ObjC compilation unit.
3113 2016-04-20 Filip Pizlo <fpizlo@apple.com>
3115 DFG del_by_id support forgets to set()
3116 https://bugs.webkit.org/show_bug.cgi?id=156830
3118 Reviewed by Saam Barati.
3120 * dfg/DFGByteCodeParser.cpp:
3121 (JSC::DFG::ByteCodeParser::parseBlock):
3122 * tests/stress/dfg-del-by-id.js: Added.
3124 2016-04-20 Saam barati <sbarati@apple.com>
3126 Improve sampling profiler CLI JSC tool
3127 https://bugs.webkit.org/show_bug.cgi?id=156824
3129 Reviewed by Mark Lam.
3131 This patch enhances the Sampling Profiler CLI tool from the JSC shell
3132 to display the JITType of a particular CodeBlock. Because this happens
3133 once we process a log of stack frames, the data for a particular frame
3134 being in LLInt vs. Baseline could be wrong. For example, we may have taken
3135 a stack trace of a CodeBlock while it was executing in the LLInt, then
3136 it tiers up to the baseline, then we process the log. We will show such CodeBlocks
3137 as being in the baseline JIT. We could be smarter about this in the future if
3138 it turns out to truly be a problem.
3140 This patch also adds a 'samplingProfilerTimingInterval' JSC option to allow
3141 CLI users to control the sleep time between stack traces.
3145 * runtime/Options.h:
3146 * runtime/SamplingProfiler.cpp:
3147 (JSC::SamplingProfiler::SamplingProfiler):
3148 (JSC::SamplingProfiler::processUnverifiedStackTraces):
3149 (JSC::SamplingProfiler::reportTopBytecodes):
3150 * runtime/SamplingProfiler.h:
3151 (JSC::SamplingProfiler::StackFrame::hasExpressionInfo):
3153 2016-04-20 Benjamin Poulain <bpoulain@apple.com>
3155 [JSC] DFG should not generate two jumps when the target of DoubleBranch is the next block
3156 https://bugs.webkit.org/show_bug.cgi?id=156815
3158 Reviewed by Mark Lam.
3160 * dfg/DFGSpeculativeJIT.cpp:
3161 (JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
3163 2016-04-20 Benjamin Poulain <bpoulain@apple.com>
3165 [JSC] Add register reuse for ArithAdd of an Int32 and constant in DFG
3166 https://bugs.webkit.org/show_bug.cgi?id=155164
3168 Reviewed by Mark Lam.
3170 Every "inc" in loop was looking like this:
3175 This patch add register Reuse to that case to remove
3179 (JSC::DFG::SpeculationRecovery::SpeculationRecovery):
3180 (JSC::DFG::SpeculationRecovery::immediate):
3181 * dfg/DFGOSRExitCompiler32_64.cpp:
3182 (JSC::DFG::OSRExitCompiler::compileExit):
3183 * dfg/DFGOSRExitCompiler64.cpp:
3184 (JSC::DFG::OSRExitCompiler::compileExit):
3185 * dfg/DFGSpeculativeJIT.cpp:
3186 (JSC::DFG::SpeculativeJIT::compileArithAdd):
3187 * tests/stress/arith-add-with-constant-overflow.js: Added.
3190 2016-04-20 Saam barati <sbarati@apple.com>
3192 We don't need a manual stack for an RAII object when the machine's stack will do just fine
3193 https://bugs.webkit.org/show_bug.cgi?id=156807
3195 Reviewed by Mark Lam.
3197 We kept around a vector for an RAII object to maintain
3198 the recursive nature of having these RAII objects on
3199 the stack as the parser recursed. Instead, the RAII object
3200 can just have a field with the value it wants to restore
3201 and use the machine's stack.
3203 This is a 1% octane code-load progression.
3205 * parser/SyntaxChecker.h:
3206 (JSC::SyntaxChecker::BinaryExprContext::BinaryExprContext):
3207 (JSC::SyntaxChecker::BinaryExprContext::~BinaryExprContext):
3208 (JSC::SyntaxChecker::UnaryExprContext::UnaryExprContext):
3209 (JSC::SyntaxChecker::UnaryExprContext::~UnaryExprContext):
3210 (JSC::SyntaxChecker::operatorStackPop):
3212 2016-04-20 Michael Saboff <msaboff@apple.com>
3214 REGRESSION(r190289): Spin trying to view/sign in to hbogo.com
3215 https://bugs.webkit.org/show_bug.cgi?id=156765
3217 Reviewed by Saam Barati.
3219 In the op_get_by_val case, we were holding the lock on a profiled CodeBlock
3220 when we call into handleGetById(). Changed to drop the lock before calling
3223 The bug here was that the call to handleGetById() may end up calling in to
3224 getPredictionWithoutOSRExit() for a tail call opcode. As part of that
3225 processing, we walk back up the stack to find the effective caller and when
3226 found, we lock the corresponding CodeBlock to get the predicition.
3227 That CodeBLock may be the same one locked above. There is no need anyway
3228 to hold the CodeBlock lock when calling handleGetById().
3230 Added a new stress test.
3232 * dfg/DFGByteCodeParser.cpp:
3233 (JSC::DFG::ByteCodeParser::parseBlock):
3234 * tests/stress/regress-156765.js: Added.
3239 2016-04-20 Mark Lam <mark.lam@apple.com>
3241 Unindent an unnecessary block in stringProtoFuncSplitFast().
3242 https://bugs.webkit.org/show_bug.cgi?id=156802
3244 Reviewed by Filip Pizlo.
3246 In webkit.org/b/156013, I refactored stringProtoFuncSplit into
3247 stringProtoFuncSplitFast. In that patch, I left an unnecessary block of code in
3248 its original block (with FIXMEs) to keep the diff for that patch minimal. Now
3249 that the patch for webkit.org/b/156013 has landed, I will unindent that block and
3252 * runtime/StringPrototype.cpp:
3253 (JSC::stringProtoFuncSplitFast):
3255 2016-04-20 Brady Eidson <beidson@apple.com>
3257 Modern IDB (Workers): Enable INDEXED_DATABASE_IN_WORKERS compile time flag, but disabled in RuntimeEnabledFeatures.
3258 https://bugs.webkit.org/show_bug.cgi?id=156782
3260 Reviewed by Alex Christensen.
3262 * Configurations/FeatureDefines.xcconfig:
3264 2016-04-20 Saam barati <sbarati@apple.com>
3266 Remove unused m_writtenVariables from the parser and related bits
3267 https://bugs.webkit.org/show_bug.cgi?id=156784
3269 Reviewed by Yusuke Suzuki.
3271 This isn't a octane/codeload speedup even though we're doing less work in
3272 collectFreeVariables. But it's good to get rid of things that are not used.
3275 (JSC::ScopeNode::usesEval):
3276 (JSC::ScopeNode::usesArguments):
3277 (JSC::ScopeNode::usesArrowFunction):
3278 (JSC::ScopeNode::isStrictMode):
3279 (JSC::ScopeNode::setUsesArguments):
3280 (JSC::ScopeNode::usesThis):
3281 (JSC::ScopeNode::modifiesParameter): Deleted.
3282 (JSC::ScopeNode::modifiesArguments): Deleted.
3283 * parser/Parser.cpp:
3284 (JSC::Parser<LexerType>::parseInner):
3285 (JSC::Parser<LexerType>::parseAssignmentExpression):
3287 (JSC::Scope::Scope):
3288 (JSC::Scope::hasDeclaredParameter):
3289 (JSC::Scope::preventAllVariableDeclarations):
3290 (JSC::Scope::collectFreeVariables):
3291 (JSC::Scope::mergeInnerArrowFunctionFeatures):
3292 (JSC::Scope::getSloppyModeHoistedFunctions):
3293 (JSC::Scope::getCapturedVars):
3294 (JSC::Scope::setStrictMode):
3295 (JSC::Scope::strictMode):
3296 (JSC::Scope::fillParametersForSourceProviderCache):
3297 (JSC::Scope::restoreFromSourceProviderCache):
3298 (JSC::Parser::hasDeclaredParameter):
3299 (JSC::Parser::exportName):
3300 (JSC::Scope::declareWrite): Deleted.
3301 (JSC::Parser::declareWrite): Deleted.
3302 * parser/ParserModes.h:
3304 2016-04-19 Saam barati <sbarati@apple.com>
3306 Unreviewed, fix cloop build after r199754.
3311 2016-04-19 Michael Saboff <msaboff@apple.com>
3313 iTunes crashing JavaScriptCore.dll
3314 https://bugs.webkit.org/show_bug.cgi?id=156647
3316 Reviewed by Filip Pizlo.
3318 Given that there there are only 128 FLS indices compared to over a 1000 for TLS,
3319 I eliminated the thread specific m_threadSpecificForThread and instead we look
3320 for the current thread in m_registeredThreads list when we need it.
3321 In most cases there will only be one thread.
3323 Added THREAD_SPECIFIC_CALL to signature of ThreadSpecific remove callbacks
3324 to set the calling convention correctly for Windows 32 bit.
3326 * heap/MachineStackMarker.cpp:
3327 (JSC::ActiveMachineThreadsManager::remove):
3328 (JSC::MachineThreads::MachineThreads):
3329 (JSC::MachineThreads::~MachineThreads):
3330 (JSC::MachineThreads::addCurrentThread):
3331 (JSC::MachineThreads::machineThreadForCurrentThread):
3332 (JSC::MachineThreads::removeThread):
3333 * heap/MachineStackMarker.h:
3335 2016-04-19 Benjamin Poulain <bpoulain@webkit.org>
3337 [JSC] Small cleanup of RegisterAtOffsetList
3338 https://bugs.webkit.org/show_bug.cgi?id=156779
3340 Reviewed by Mark Lam.
3342 I was wondering why RegisterAtOffsetList always cache-miss.
3343 It looks like it is doing more than it needs to.
3345 We do not need to sort the values. The total order of
3346 RegisterAtOffset is: