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