1 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
3 Web Inspector: Simplify console.clear
4 https://bugs.webkit.org/show_bug.cgi?id=157316
6 Reviewed by Timothy Hatcher.
8 * inspector/ScriptArguments.cpp:
9 (Inspector::ScriptArguments::createEmpty):
10 (Inspector::ScriptArguments::ScriptArguments):
11 * inspector/ScriptArguments.h:
12 Provide a way to create an empty list.
14 * runtime/ConsoleClient.cpp:
15 (JSC::ConsoleClient::clear):
16 * runtime/ConsoleClient.h:
17 Drop unnecessary parameter.
19 * runtime/ConsoleObject.cpp:
20 (JSC::consoleProtoFuncClear):
21 No need to parse arguments.
23 2016-05-03 Yusuke Suzuki <utatane.tea@gmail.com>
25 Improve Symbol() to string coercion error message
26 https://bugs.webkit.org/show_bug.cgi?id=157317
28 Reviewed by Geoffrey Garen.
30 Improve error messages related to Symbols.
32 * runtime/JSCJSValue.cpp:
33 (JSC::JSValue::toStringSlowCase):
35 (JSC::Symbol::toNumber):
36 * runtime/SymbolConstructor.cpp:
37 (JSC::symbolConstructorKeyFor):
38 * runtime/SymbolPrototype.cpp:
39 (JSC::symbolProtoFuncToString):
40 (JSC::symbolProtoFuncValueOf):
41 * tests/stress/dfg-to-primitive-pass-symbol.js:
42 * tests/stress/floating-point-div-to-mul.js:
44 * tests/stress/string-from-code-point.js:
46 (string_appeared_here.shouldThrow):
47 * tests/stress/symbol-error-messages.js: Added.
49 * tests/stress/symbol-registry.js:
51 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
53 Web Inspector: Give console.time/timeEnd a default label and warnings
54 https://bugs.webkit.org/show_bug.cgi?id=157325
55 <rdar://problem/26073290>
57 Reviewed by Timothy Hatcher.
59 Provide more user friendly console.time/timeEnd. The timer name
60 is now optional, and is "default" if not provided. Also provide
61 warnings when attempting to start an already started timer,
62 or stop a timer that does not exist.
64 * inspector/agents/InspectorConsoleAgent.cpp:
65 (Inspector::InspectorConsoleAgent::startTiming):
66 (Inspector::InspectorConsoleAgent::stopTiming):
67 Warnings for bad cases.
69 * runtime/ConsoleObject.cpp:
70 (JSC::defaultLabelString):
71 (JSC::consoleProtoFuncTime):
72 (JSC::consoleProtoFuncTimeEnd):
73 Optional label becomes "default".
75 2016-05-03 Xan Lopez <xlopez@igalia.com>
77 Fix the ENABLE(WEBASSEMBLY) build
78 https://bugs.webkit.org/show_bug.cgi?id=157312
80 Reviewed by Darin Adler.
82 * runtime/Executable.cpp:
83 (JSC::WebAssemblyExecutable::WebAssemblyExecutable):
84 * wasm/WASMFunctionCompiler.h:
85 (JSC::WASMFunctionCompiler::convertValueToDouble):
87 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
89 Web Inspector: Remove unused parameter of ScriptArguments::getFirstArgumentAsString
90 https://bugs.webkit.org/show_bug.cgi?id=157301
92 Reviewed by Timothy Hatcher.
94 * inspector/ScriptArguments.cpp:
95 (Inspector::ScriptArguments::getFirstArgumentAsString):
96 * inspector/ScriptArguments.h:
97 Remove unused argument and related code.
99 * runtime/ConsoleClient.cpp:
100 (JSC::ConsoleClient::printConsoleMessageWithArguments):
101 Drive by remove unnecessary cast.
103 2016-05-03 Michael Saboff <msaboff@apple.com>
105 Crash: Array.prototype.slice() and .splice() can call fastSlice() after an array is truncated
106 https://bugs.webkit.org/show_bug.cgi?id=157322
108 Reviewed by Filip Pizlo.
110 Check to see if the source array has changed length before calling fastSlice().
111 If it has, take the slow path.
113 * runtime/ArrayPrototype.cpp:
114 (JSC::arrayProtoFuncSlice):
115 (JSC::arrayProtoFuncSplice):
116 * tests/stress/regress-157322.js: New test.
118 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
120 Eliminate PassRefPtr conversion from ConsoleObject
121 https://bugs.webkit.org/show_bug.cgi?id=157300
123 Reviewed by Timothy Hatcher.
125 * runtime/ConsoleObject.cpp:
126 (JSC::consoleLogWithLevel):
127 (JSC::consoleProtoFuncClear):
128 (JSC::consoleProtoFuncDir):
129 (JSC::consoleProtoFuncDirXML):
130 (JSC::consoleProtoFuncTable):
131 (JSC::consoleProtoFuncTrace):
132 (JSC::consoleProtoFuncAssert):
133 (JSC::consoleProtoFuncCount):
134 (JSC::consoleProtoFuncTimeStamp):
135 (JSC::consoleProtoFuncGroup):
136 (JSC::consoleProtoFuncGroupCollapsed):
137 (JSC::consoleProtoFuncGroupEnd):
138 No need to release to a PassRefPtr, we can just move into the RefPtr<>&&.
140 2016-05-01 Filip Pizlo <fpizlo@apple.com>
142 Speed up JSGlobalObject initialization by making some properties lazy
143 https://bugs.webkit.org/show_bug.cgi?id=157045
145 Reviewed by Keith Miller.
147 This makes about half of JSGlobalObject's state lazy. There are three categories of
148 state in JSGlobalObject:
150 1) C++ fields in JSGlobalObject.
151 2) JS object properties in JSGlobalObject's JSObject superclass.
152 3) JS variables in JSGlobalObject's JSSegmentedVariableObject superclass.
154 State held in JS variables cannot yet be made lazy. That's why this patch only goes
157 State in JS object properties can be made lazy if we move it to the static property
158 hashtable. JSGlobalObject already had one of those. This patch makes static property
159 hashtables a lot more powerful, by adding three new kinds of static properties. These
160 new kinds allow us to make almost all of JSGlobalObject's object properties lazy.
162 State in C++ fields can now be made lazy thanks in part to WTF's support for stateless
163 lambdas. You can of course make anything lazy by hand, but there are many C++ fields in
164 JSGlobalObject and we are adding more all the time. We don't want to require that each
165 of these has a getter with an initialization check and a corresponding out-of-line slow
166 path that does the initialization. We want this kind of boilerplate to be handled by
169 The primary abstraction introduced in this patch is LazyProperty<Type>. Currently, this
170 only works where Type is a subclass of JSCell. Such a property holds a pointer to Type.
171 You can use it like you would a WriteBarrier<Type>. It even has set() and get() methods,
172 so it's almost a drop-in replacement.
174 The key to LazyProperty<Type>'s power is that you can do this:
178 LazyProperty<Foo> m_foo;
182 [] (const LazyProperty<Foo>::Initializer<Bar>& init) {
183 init.set(Foo::create(init.vm, init.owner));
186 This initLater() call requires that you pass a stateless lambda (see WTF changelog for
187 the definition). Miraculously, this initLater() call is guaranteed to compile to a store
188 of a pointer constant to m_foo, as in:
193 This magical pointer constant points to a callback that was generated by the template
194 instantiation of initLater(). That callback knows to call your stateless lambda, but
195 also does some other bookkeeping: it makes sure that you indeed initialized the property
196 inside the callback and it manages recursive initializations. It's totally legal to call
197 m_foo.get() inside the initLater() callback. If you do that before you call init.set(),
198 m_foo.get() will return null. This is an excellent escape hatch if we ever find
199 ourselves in a dependency cycle. I added this feature because I already had to create a
202 Note that using LazyProperties from DFG threads is super awkward. It's going to be hard
203 to get this right. The DFG thread cannot initialize those fields, so it has to make sure
204 that it does conservative things. But for some nodes this could mean adding a lot of new
205 logic, like NewTypedArray, which currently is written in such a way that it assumes that
206 we always have the typed array structure. Currently we take a two-fold approach: for
207 typed arrays we don't handle the NewTypedArray intrinsic if the structure isn't
208 initialized, and for everything else we don't make the properties lazy if the DFG needs
209 them. As we optimize this further we might need to teach the DFG to handle more lazy
210 properties. I tried to do this for RegExp but found it to be very confusing. With typed
213 There is also a somewhat more powerful construct called LazyClassStructure. We often
214 need to keep around the structure of some standard JS class, like Date. We also need to
215 make sure that the constructor ends up in the global object's property table. And we
216 often need to keep the original value of the constructor for ourselves. In this case, we
217 want to make sure that the creation of the structure-prototype-constructor constellation
218 is atomic. We don't want code to start looking at the structure if it points to a
219 prototype that doesn't have its "constructor" property set yet, for example.
220 LazyClassStructure solves this by abstracting that whole initialization. You provide the
221 callback that allocates everything, since we are super inconsistent about the way we
222 initialize things, but LazyClassStructure establishes the workflow and helps you not
225 Finally, the new static hashtable attributes allow for all of this to work with the JS
228 PropertyCallback: if you use this attribute, the second column in the table should be
229 the name of a function to call to initialize this property. This is useful for things
230 like the Math property. The Math object turns out to be very expensive to allocate.
231 Delaying its allocation is super easy with the PropertyCallback attribute.
233 CellProperty: with this attribute the second column should be a C++ field name like
234 JSGlobalObject::m_evalErrorConstructor. The static hashtable will grab the offset of
235 this property, and when it needs to be initialized, Lookup will assume you have a
236 LazyProperty<JSCell> and call its get() method. It will initialize the property to
237 whatever get() returned. Note that it's legal to cast a LazyProperty<Anything> to
238 LazyProperty<JSCell> for the purpose of calling get() because the get() method will just
239 call whatever callback function pointer is encoded in the property and it does not need
240 to know anything about what type that callback will instantiate.
242 ClassStructure: with this attribute the second column should be a C++ field name. The
243 static hashtable will initialize the property by treating the field as a
244 LazyClassStructure and it will call get(). LazyClassStructure completely owns the whole
245 initialization workflow, so Lookup assumes that when LazyClassStructure::get() returns,
246 the property in question will already be set. By convention, we have LazyClassStructure
247 initialize the property with a pointer to the constructor, since that's how all of our
248 classes work: "globalObject.Date" points to the DateConstructor.
250 This is a 2x speed-up in JSGlobalObject initialization time in a microbenchmark that
251 calls our C API. This is a 1% speed-up on SunSpider and JSRegress.
253 * API/JSCallbackFunction.cpp:
254 (JSC::JSCallbackFunction::create):
255 * API/ObjCCallbackFunction.h:
256 (JSC::ObjCCallbackFunction::impl):
257 * API/ObjCCallbackFunction.mm:
258 (JSC::ObjCCallbackFunction::ObjCCallbackFunction):
259 (JSC::ObjCCallbackFunction::create):
261 * JavaScriptCore.xcodeproj/project.pbxproj:
263 * dfg/DFGAbstractInterpreterInlines.h:
264 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
265 * dfg/DFGAbstractValue.cpp:
266 (JSC::DFG::AbstractValue::set):
267 * dfg/DFGArrayMode.cpp:
268 (JSC::DFG::ArrayMode::originalArrayStructure):
269 * dfg/DFGByteCodeParser.cpp:
270 (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor):
271 * dfg/DFGSpeculativeJIT.cpp:
272 (JSC::DFG::SpeculativeJIT::compileNewTypedArray):
273 * dfg/DFGSpeculativeJIT32_64.cpp:
274 (JSC::DFG::SpeculativeJIT::compile):
275 * dfg/DFGSpeculativeJIT64.cpp:
276 (JSC::DFG::SpeculativeJIT::compile):
277 * dfg/DFGStructureRegistrationPhase.cpp:
278 (JSC::DFG::StructureRegistrationPhase::run):
279 * ftl/FTLLowerDFGToB3.cpp:
280 (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
281 * runtime/ClonedArguments.cpp:
282 (JSC::ClonedArguments::getOwnPropertySlot):
283 (JSC::ClonedArguments::materializeSpecials):
284 * runtime/CommonSlowPaths.cpp:
285 (JSC::SLOW_PATH_DECL):
286 * runtime/FunctionPrototype.cpp:
287 (JSC::functionProtoFuncToString):
288 * runtime/InternalFunction.cpp:
289 (JSC::InternalFunction::visitChildren):
290 (JSC::InternalFunction::name):
291 (JSC::InternalFunction::calculatedDisplayName):
292 (JSC::InternalFunction::createSubclassStructure):
293 * runtime/InternalFunction.h:
294 * runtime/JSBoundFunction.cpp:
295 (JSC::JSBoundFunction::finishCreation):
296 (JSC::JSBoundFunction::visitChildren):
297 * runtime/JSFunction.cpp:
298 (JSC::JSFunction::getOwnPropertySlot):
299 (JSC::JSFunction::defineOwnProperty):
300 * runtime/JSGenericTypedArrayViewConstructorInlines.h:
301 (JSC::constructGenericTypedArrayView):
302 * runtime/JSGlobalObject.cpp:
303 (JSC::createProxyProperty):
304 (JSC::createJSONProperty):
305 (JSC::createMathProperty):
306 (JSC::JSGlobalObject::init):
307 (JSC::JSGlobalObject::stringPrototypeChainIsSane):
308 (JSC::JSGlobalObject::resetPrototype):
309 (JSC::JSGlobalObject::visitChildren):
310 (JSC::JSGlobalObject::toThis):
311 (JSC::JSGlobalObject::getOwnPropertySlot):
312 (JSC::JSGlobalObject::createThrowTypeError): Deleted.
313 * runtime/JSGlobalObject.h:
314 (JSC::JSGlobalObject::objectConstructor):
315 (JSC::JSGlobalObject::promiseConstructor):
316 (JSC::JSGlobalObject::internalPromiseConstructor):
317 (JSC::JSGlobalObject::evalErrorConstructor):
318 (JSC::JSGlobalObject::rangeErrorConstructor):
319 (JSC::JSGlobalObject::referenceErrorConstructor):
320 (JSC::JSGlobalObject::syntaxErrorConstructor):
321 (JSC::JSGlobalObject::typeErrorConstructor):
322 (JSC::JSGlobalObject::URIErrorConstructor):
323 (JSC::JSGlobalObject::nullGetterFunction):
324 (JSC::JSGlobalObject::nullSetterFunction):
325 (JSC::JSGlobalObject::callFunction):
326 (JSC::JSGlobalObject::applyFunction):
327 (JSC::JSGlobalObject::definePropertyFunction):
328 (JSC::JSGlobalObject::arrayProtoValuesFunction):
329 (JSC::JSGlobalObject::initializePromiseFunction):
330 (JSC::JSGlobalObject::newPromiseCapabilityFunction):
331 (JSC::JSGlobalObject::functionProtoHasInstanceSymbolFunction):
332 (JSC::JSGlobalObject::regExpProtoExecFunction):
333 (JSC::JSGlobalObject::regExpProtoSymbolReplaceFunction):
334 (JSC::JSGlobalObject::regExpProtoGlobalGetter):
335 (JSC::JSGlobalObject::regExpProtoUnicodeGetter):
336 (JSC::JSGlobalObject::throwTypeErrorGetterSetter):
337 (JSC::JSGlobalObject::moduleLoader):
338 (JSC::JSGlobalObject::objectPrototype):
339 (JSC::JSGlobalObject::functionPrototype):
340 (JSC::JSGlobalObject::arrayPrototype):
341 (JSC::JSGlobalObject::booleanPrototype):
342 (JSC::JSGlobalObject::stringPrototype):
343 (JSC::JSGlobalObject::symbolPrototype):
344 (JSC::JSGlobalObject::numberPrototype):
345 (JSC::JSGlobalObject::datePrototype):
346 (JSC::JSGlobalObject::regExpPrototype):
347 (JSC::JSGlobalObject::errorPrototype):
348 (JSC::JSGlobalObject::iteratorPrototype):
349 (JSC::JSGlobalObject::generatorFunctionPrototype):
350 (JSC::JSGlobalObject::generatorPrototype):
351 (JSC::JSGlobalObject::debuggerScopeStructure):
352 (JSC::JSGlobalObject::withScopeStructure):
353 (JSC::JSGlobalObject::strictEvalActivationStructure):
354 (JSC::JSGlobalObject::activationStructure):
355 (JSC::JSGlobalObject::moduleEnvironmentStructure):
356 (JSC::JSGlobalObject::directArgumentsStructure):
357 (JSC::JSGlobalObject::scopedArgumentsStructure):
358 (JSC::JSGlobalObject::clonedArgumentsStructure):
359 (JSC::JSGlobalObject::isOriginalArrayStructure):
360 (JSC::JSGlobalObject::booleanObjectStructure):
361 (JSC::JSGlobalObject::callbackConstructorStructure):
362 (JSC::JSGlobalObject::callbackFunctionStructure):
363 (JSC::JSGlobalObject::callbackObjectStructure):
364 (JSC::JSGlobalObject::propertyNameIteratorStructure):
365 (JSC::JSGlobalObject::objcCallbackFunctionStructure):
366 (JSC::JSGlobalObject::objcWrapperObjectStructure):
367 (JSC::JSGlobalObject::dateStructure):
368 (JSC::JSGlobalObject::nullPrototypeObjectStructure):
369 (JSC::JSGlobalObject::errorStructure):
370 (JSC::JSGlobalObject::calleeStructure):
371 (JSC::JSGlobalObject::functionStructure):
372 (JSC::JSGlobalObject::boundFunctionStructure):
373 (JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
374 (JSC::JSGlobalObject::getterSetterStructure):
375 (JSC::JSGlobalObject::nativeStdFunctionStructure):
376 (JSC::JSGlobalObject::namedFunctionStructure):
377 (JSC::JSGlobalObject::functionNameOffset):
378 (JSC::JSGlobalObject::numberObjectStructure):
379 (JSC::JSGlobalObject::privateNameStructure):
380 (JSC::JSGlobalObject::mapStructure):
381 (JSC::JSGlobalObject::regExpStructure):
382 (JSC::JSGlobalObject::generatorFunctionStructure):
383 (JSC::JSGlobalObject::setStructure):
384 (JSC::JSGlobalObject::stringObjectStructure):
385 (JSC::JSGlobalObject::symbolObjectStructure):
386 (JSC::JSGlobalObject::iteratorResultObjectStructure):
387 (JSC::JSGlobalObject::lazyTypedArrayStructure):
388 (JSC::JSGlobalObject::typedArrayStructure):
389 (JSC::JSGlobalObject::typedArrayStructureConcurrently):
390 (JSC::JSGlobalObject::isOriginalTypedArrayStructure):
391 (JSC::JSGlobalObject::typedArrayConstructor):
392 (JSC::JSGlobalObject::actualPointerFor):
393 (JSC::JSGlobalObject::internalFunctionStructure): Deleted.
394 * runtime/JSNativeStdFunction.cpp:
395 (JSC::JSNativeStdFunction::create):
396 * runtime/JSWithScope.cpp:
397 (JSC::JSWithScope::create):
398 (JSC::JSWithScope::visitChildren):
399 (JSC::JSWithScope::createStructure):
400 (JSC::JSWithScope::JSWithScope):
401 * runtime/JSWithScope.h:
402 (JSC::JSWithScope::object):
403 (JSC::JSWithScope::create): Deleted.
404 (JSC::JSWithScope::createStructure): Deleted.
405 (JSC::JSWithScope::JSWithScope): Deleted.
406 * runtime/LazyClassStructure.cpp: Added.
407 (JSC::LazyClassStructure::Initializer::Initializer):
408 (JSC::LazyClassStructure::Initializer::setPrototype):
409 (JSC::LazyClassStructure::Initializer::setStructure):
410 (JSC::LazyClassStructure::Initializer::setConstructor):
411 (JSC::LazyClassStructure::visit):
412 (JSC::LazyClassStructure::dump):
413 * runtime/LazyClassStructure.h: Added.
414 (JSC::LazyClassStructure::LazyClassStructure):
415 (JSC::LazyClassStructure::get):
416 (JSC::LazyClassStructure::prototype):
417 (JSC::LazyClassStructure::constructor):
418 (JSC::LazyClassStructure::getConcurrently):
419 (JSC::LazyClassStructure::prototypeConcurrently):
420 (JSC::LazyClassStructure::constructorConcurrently):
421 * runtime/LazyClassStructureInlines.h: Added.
422 (JSC::LazyClassStructure::initLater):
423 * runtime/LazyProperty.h: Added.
424 (JSC::LazyProperty::Initializer::Initializer):
425 (JSC::LazyProperty::LazyProperty):
426 (JSC::LazyProperty::get):
427 (JSC::LazyProperty::getConcurrently):
428 * runtime/LazyPropertyInlines.h: Added.
429 (JSC::LazyProperty<ElementType>::Initializer<OwnerType>::set):
430 (JSC::LazyProperty<ElementType>::initLater):
431 (JSC::LazyProperty<ElementType>::setMayBeNull):
432 (JSC::LazyProperty<ElementType>::set):
433 (JSC::LazyProperty<ElementType>::visit):
434 (JSC::LazyProperty<ElementType>::dump):
435 (JSC::LazyProperty<ElementType>::callFunc):
436 * runtime/Lookup.cpp:
437 (JSC::setUpStaticFunctionSlot):
439 (JSC::HashTableValue::function):
440 (JSC::HashTableValue::functionLength):
441 (JSC::HashTableValue::propertyGetter):
442 (JSC::HashTableValue::propertyPutter):
443 (JSC::HashTableValue::accessorGetter):
444 (JSC::HashTableValue::accessorSetter):
445 (JSC::HashTableValue::constantInteger):
446 (JSC::HashTableValue::lexerValue):
447 (JSC::HashTableValue::lazyCellPropertyOffset):
448 (JSC::HashTableValue::lazyClassStructureOffset):
449 (JSC::HashTableValue::lazyPropertyCallback):
450 (JSC::getStaticPropertySlot):
451 (JSC::getStaticValueSlot):
452 (JSC::reifyStaticProperty):
453 * runtime/PropertySlot.h:
454 * runtime/TypedArrayType.h:
456 2016-05-03 Per Arne Vollan <peavo@outlook.com>
458 [Win] Remove Windows XP Compatibility Requirements
459 https://bugs.webkit.org/show_bug.cgi?id=152899
461 Reviewed by Brent Fulgham.
463 Windows XP is not supported anymore, we can remove workarounds.
465 * JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp:
466 (enableTerminationOnHeapCorruption):
468 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
470 Web Inspector: console.assert should do far less work when the assertion is true
471 https://bugs.webkit.org/show_bug.cgi?id=157297
472 <rdar://problem/26056556>
474 Reviewed by Timothy Hatcher.
476 * runtime/ConsoleClient.h:
477 * runtime/ConsoleClient.cpp:
478 (JSC::ConsoleClient::assertion):
479 (JSC::ConsoleClient::assertCondition): Deleted.
480 Rename, now that this will only get called when the assertion failed.
482 * runtime/ConsoleObject.cpp:
483 (JSC::consoleProtoFuncAssert):
484 Avoid doing any work if the assertion succeeded.
486 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
488 Unreviewed follow-up testapi fix after r200355.
490 * runtime/JSGlobalObject.cpp:
491 (JSC::JSGlobalObject::init):
492 Revert back to non-enumerable. This matches our older behavior,
493 we can decide to make this Enumerable later if needed.
495 2016-05-02 Joseph Pecoraro <pecoraro@apple.com>
497 Web Inspector: Reflect.toString() should be [object Object] not [object Reflect]
498 https://bugs.webkit.org/show_bug.cgi?id=157288
500 Reviewed by Darin Adler.
502 * runtime/ReflectObject.cpp:
503 * tests/stress/reflect.js: Added.
505 2016-05-02 Jon Davis <jond@apple.com>
507 Add Resource Timing entry to the Feature Status page.
508 https://bugs.webkit.org/show_bug.cgi?id=157285
510 Reviewed by Timothy Hatcher.
514 2016-05-02 Joseph Pecoraro <pecoraro@apple.com>
516 Make console a namespace object (like Math/JSON), allowing functions to be called unbound
517 https://bugs.webkit.org/show_bug.cgi?id=157286
518 <rdar://problem/26052830>
520 Reviewed by Timothy Hatcher.
522 This changes `console` to be a global namespace object, like `Math` and `JSON`.
523 It just holds a bunch of functions, that can be used on their own, unbound.
524 For example, `[1,2,3].forEach(console.log)` and `var log = console.log; log(1)`
525 used to throw exceptions and now do not.
527 Previously console was an Object/Prototype pair, so functions were on
528 ConsolePrototype (console.__proto__.log) and they needed to be called
529 Console objects as the `this` value. Now, `console` is just a standard
530 object with a bunch of functions. Since there is no console prototype the
531 functions can be passed around and called as expected and they will
532 just do the right thing.
534 For compatability with other browsers, `console` was made enumerable
535 on the global object.
538 * JavaScriptCore.xcodeproj/project.pbxproj:
539 Add new files and remove old files.
541 * runtime/CommonIdentifiers.h:
544 * runtime/ConsoleObject.cpp: Renamed from Source/JavaScriptCore/runtime/ConsolePrototype.cpp.
545 (JSC::ConsoleObject::ConsoleObject):
546 (JSC::ConsoleObject::finishCreation):
547 (JSC::valueToStringWithUndefinedOrNullCheck):
548 (JSC::consoleLogWithLevel):
549 (JSC::consoleProtoFuncDebug):
550 (JSC::consoleProtoFuncError):
551 (JSC::consoleProtoFuncLog):
552 (JSC::consoleProtoFuncInfo):
553 (JSC::consoleProtoFuncWarn):
554 (JSC::consoleProtoFuncClear):
555 (JSC::consoleProtoFuncDir):
556 (JSC::consoleProtoFuncDirXML):
557 (JSC::consoleProtoFuncTable):
558 (JSC::consoleProtoFuncTrace):
559 (JSC::consoleProtoFuncAssert):
560 (JSC::consoleProtoFuncCount):
561 (JSC::consoleProtoFuncProfile):
562 (JSC::consoleProtoFuncProfileEnd):
563 (JSC::consoleProtoFuncTakeHeapSnapshot):
564 (JSC::consoleProtoFuncTime):
565 (JSC::consoleProtoFuncTimeEnd):
566 (JSC::consoleProtoFuncTimeStamp):
567 (JSC::consoleProtoFuncGroup):
568 (JSC::consoleProtoFuncGroupCollapsed):
569 (JSC::consoleProtoFuncGroupEnd):
570 Console functions no longer need to check if the this object is
571 a Console object. They will always just work now.
573 * runtime/MathObject.cpp:
574 * runtime/MathObject.h:
575 * runtime/ConsoleObject.h: Renamed from Source/JavaScriptCore/runtime/ConsolePrototype.h.
576 (JSC::ConsoleObject::create):
577 (JSC::ConsoleObject::createStructure):
578 ConsoleObject is a basic object like MathObject.
580 * runtime/JSConsole.cpp: Removed.
581 * runtime/JSConsole.h: Removed.
582 * runtime/JSGlobalObject.h:
583 * runtime/JSGlobalObject.cpp:
584 (JSC::JSGlobalObject::init):
585 (JSC::JSGlobalObject::visitChildren):
586 Remove JSConsole / ConsolePrototype in favor of the single ConsoleObject.
588 2016-05-02 Per Arne Vollan <peavo@outlook.com>
590 [Win] Clean up annoying compiler warnings
591 https://bugs.webkit.org/show_bug.cgi?id=149813
593 Reviewed by Alex Christensen.
595 * bytecode/PropertyCondition.cpp:
596 (JSC::PropertyCondition::isWatchableWhenValid):
597 * dfg/DFGObjectAllocationSinkingPhase.cpp:
598 * dfg/DFGSpeculativeJIT32_64.cpp:
599 (JSC::DFG::SpeculativeJIT::emitCall):
600 * inspector/InspectorBackendDispatcher.cpp:
601 (Inspector::BackendDispatcher::sendPendingErrors):
602 * jit/JITCall32_64.cpp:
603 (JSC::JIT::compileOpCall):
605 (JSC::Parser<LexerType>::parseAssignmentExpression):
606 * runtime/ClonedArguments.cpp:
607 (JSC::ClonedArguments::createWithInlineFrame):
609 (JSC::addErrorInfoAndGetBytecodeOffset):
610 * runtime/IntlNumberFormat.cpp:
611 (JSC::IntlNumberFormat::initializeNumberFormat):
612 * runtime/JSObject.cpp:
613 (JSC::JSObject::heapSnapshot):
614 (JSC::callToPrimitiveFunction):
615 * runtime/RegExpPrototype.cpp:
617 * runtime/SamplingProfiler.cpp:
618 (JSC::SamplingProfiler::StackFrame::functionStartColumn):
620 2016-05-02 Keith Miller <keith_miller@apple.com>
622 ToThis should be able to be eliminated in Constant Folding
623 https://bugs.webkit.org/show_bug.cgi?id=157213
625 Reviewed by Saam Barati.
627 This patch enables eliminating the ToThis value when we have abstract interpreter
628 indicates the node is not needed. Since there are Objects that override their
629 ToThis behavior we first check if we can eliminate the node by looking at its
630 speculated type. If the function is in strict mode then we can eliminate ToThis as
631 long as the speculated type is not SpecObjectOther since that contains objects
632 that may set OverridesToThis. If the function is not in strict mode then we can
633 eliminate ToThis as long is the speculated type is an object that is not SpecObjectOther.
635 If we can't eliminate with type information we can still eliminate the ToThis node with
636 the proven structure set. When ToThis only sees structures that do not set OverridesToThis
637 it can be eliminated. Additionally, if the function is in strict mode then we can eliminate
638 ToThis as long as all only the object structures don't set OverridesToThis.
640 * dfg/DFGAbstractInterpreterInlines.h:
641 (JSC::DFG::isToThisAnIdentity):
642 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
643 * dfg/DFGConstantFoldingPhase.cpp:
644 (JSC::DFG::ConstantFoldingPhase::foldConstants):
645 * dfg/DFGFixupPhase.cpp:
646 (JSC::DFG::FixupPhase::fixupToThis):
647 * tests/stress/to-this-global-object.js: Added.
652 2016-05-01 Skachkov Oleksandr <gskachkov@gmail.com>
654 Class contructor and methods shouldn't have "arguments" and "caller"
655 https://bugs.webkit.org/show_bug.cgi?id=144238
657 Reviewed by Ryosuke Niwa.
659 Added TypeError that is raised in case of access to properties 'arguments' or 'caller'
660 of constructor or method of class. Actually TypeError already raised for most cases, except
661 case with undeclared constructor e. g.
663 (new A).constructor.caller
664 (new A).constructor.arguments
666 * runtime/JSFunction.cpp:
667 (JSC::getThrowTypeErrorGetterSetter):
668 (JSC::JSFunction::getOwnPropertySlot):
669 * runtime/JSGlobalObject.cpp:
670 (JSC::JSGlobalObject::createThrowTypeErrorArgumentsAndCaller):
671 (JSC::JSGlobalObject::visitChildren):
672 * runtime/JSGlobalObject.h:
673 (JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerGetterSetter):
674 * runtime/JSGlobalObjectFunctions.cpp:
675 (JSC::globalFuncThrowTypeErrorArgumentsAndCaller):
676 * runtime/JSGlobalObjectFunctions.h:
678 2016-05-02 Yoav Weiss <yoav@yoav.ws>
680 Move ResourceTiming behind a runtime flag
681 https://bugs.webkit.org/show_bug.cgi?id=157133
683 Reviewed by Alex Christensen.
685 * runtime/CommonIdentifiers.h: Added PerformanceEntry, PerformanceEntryList and PerformanceResourceTiming as property names.
687 2016-05-02 Yusuke Suzuki <utatane.tea@gmail.com>
689 Assertion failure for bound function with custom prototype and Reflect.construct
690 https://bugs.webkit.org/show_bug.cgi?id=157081
692 Reviewed by Saam Barati.
694 We ensured `newTarget != exec->callee()`. However, it does not mean `newTarget.get("prototype") != exec->callee()->get("prototype")`.
695 When the given `prototype` is the same to `baseStructure->sotredPrototype()`, it is unnecessary to create a new structure from this
698 * bytecode/InternalFunctionAllocationProfile.h:
699 (JSC::InternalFunctionAllocationProfile::createAllocationStructureFromBase):
700 * tests/stress/custom-prototype-may-be-same-to-original-one.js: Added.
704 2016-04-30 Konstantin Tokarev <annulen@yandex.ru>
706 Guard ObjC-specific code in Heap.cpp with USE(FOUNDATION)
707 https://bugs.webkit.org/show_bug.cgi?id=157236
709 Reviewed by Darin Adler.
711 This also fixes build with GCC 4.8 which does not provide
716 2016-04-30 Yusuke Suzuki <utatane.tea@gmail.com>
718 Assertion failure for destructuring assignment with new.target and unary operator
719 https://bugs.webkit.org/show_bug.cgi?id=157149
721 Reviewed by Saam Barati.
723 The caller of parseDefaultValueForDestructuringPattern() should propagate errors.
724 And this patch also cleans up createSavePoint and createSavePointForError; introducing SavePointWithError.
727 (JSC::Parser<LexerType>::parseSourceElements):
728 (JSC::Parser<LexerType>::parseDestructuringPattern):
729 Add propagateErorr() for parseDefaultValueForDestructuringPattern.
731 (JSC::Parser<LexerType>::parseAssignmentExpression):
733 (JSC::Parser::restoreLexerState):
734 (JSC::Parser::internalSaveState):
735 (JSC::Parser::createSavePointForError):
736 (JSC::Parser::createSavePoint):
737 (JSC::Parser::internalRestoreState):
738 (JSC::Parser::restoreSavePointWithError):
739 (JSC::Parser::restoreSavePoint):
740 * tests/stress/default-value-parsing-should-propagate-error.js: Added.
744 2016-04-28 Darin Adler <darin@apple.com>
746 First step in using "enum class" instead of "String" for enumerations in DOM
747 https://bugs.webkit.org/show_bug.cgi?id=157163
749 Reviewed by Chris Dumez.
751 * runtime/JSString.h:
752 (JSC::jsStringWithCache): Deleted unneeded overload for AtomicString.
754 2016-04-29 Benjamin Poulain <bpoulain@apple.com>
756 [JSC][ARMv7S] Arithmetic module results change when tiering up to DFG
757 https://bugs.webkit.org/show_bug.cgi?id=157217
758 rdar://problem/24733432
760 Reviewed by Mark Lam.
762 ARMv7's fmod() returns less accurate results than an integer division.
763 Since we have integer div on ARMv7s, the results start changing when
766 In this patch, I change our fmod slow path to behave like the fast path
769 * dfg/DFGSpeculativeJIT.cpp:
770 (JSC::DFG::SpeculativeJIT::compileArithMod):
771 (JSC::DFG::fmodAsDFGOperation): Deleted.
772 * runtime/CommonSlowPaths.cpp:
773 (JSC::SLOW_PATH_DECL):
774 * runtime/MathCommon.cpp:
775 (JSC::isStrictInt32):
776 * runtime/MathCommon.h:
778 2016-04-29 Joseph Pecoraro <pecoraro@apple.com>
780 Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
781 https://bugs.webkit.org/show_bug.cgi?id=157198
782 <rdar://problem/26011049>
784 Reviewed by Timothy Hatcher.
786 * inspector/InspectorBackendDispatcher.cpp:
787 (Inspector::BackendDispatcher::sendResponse):
788 While auditing the code, add a WTFMove.
790 2016-04-29 Mark Lam <mark.lam@apple.com>
792 Make RegExp.prototype.test spec compliant.
793 https://bugs.webkit.org/show_bug.cgi?id=155862
795 Reviewed by Saam Barati.
797 * builtins/RegExpPrototype.js:
798 (intrinsic.RegExpTestIntrinsic.test):
801 - Delete obsoleted code.
803 * dfg/DFGByteCodeParser.cpp:
804 (JSC::DFG::ByteCodeParser::addToGraph):
805 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
806 - We now have 2 intrinsics for RegExp.prototype.test:
807 RegExpTestIntrinsic and RegExpTestFastIntrinsic.
809 RegExpTestIntrinsic maps to the entry at the top of the builtin ES6
810 RegExp.prototype.test.
811 RegExpTestFastIntrinsic maps to the fast path in the builtin ES6
812 RegExp.prototype.test.
814 Both will end up using the RegExpTest DFG node to implement the fast path
815 of RegExp.prototype.test. RegExpTestIntrinsic will have some additional checks
816 before the RegExpTest node. Those checks are for speculating that it is ok for
817 us to take the fast path.
819 * runtime/CommonIdentifiers.h:
820 * runtime/Intrinsic.h:
822 * runtime/JSGlobalObject.cpp:
823 (JSC::JSGlobalObject::init):
824 - Added the regExpTestFast function.
825 - Also fixed the parameter length on 2 other functions that were erroneous.
827 * runtime/RegExpPrototype.cpp:
828 (JSC::RegExpPrototype::finishCreation):
829 (JSC::regExpProtoFuncTestFast):
830 (JSC::regExpProtoFuncTest): Deleted.
831 * runtime/RegExpPrototype.h:
834 2016-04-29 Benjamin Poulain <benjamin@webkit.org>
836 Extend math-pow-stable-results.js to get more information about the failure
838 * tests/stress/math-pow-stable-results.js:
840 2016-04-29 Yusuke Suzuki <utatane.tea@gmail.com>
842 Assertion failure for exception in "prototype" property getter and Reflect.construct
843 https://bugs.webkit.org/show_bug.cgi?id=157084
845 Reviewed by Mark Lam.
847 InternalFunction::createSubclassStrucuture may throw exceptions because it performs [[Get]] to
848 look up the "prototype" object. The current assertion is invalid.
849 We also found that Object constructor is not aware of new.target. This is filed[1].
851 [1]: https://bugs.webkit.org/show_bug.cgi?id=157196
853 * runtime/InternalFunction.cpp:
854 (JSC::InternalFunction::createSubclassStructure):
855 * tests/stress/create-subclass-structure-may-throw-exception-when-getting-prototype.js: Added.
859 2016-04-29 Commit Queue <commit-queue@webkit.org>
861 Unreviewed, rolling out r200232.
862 https://bugs.webkit.org/show_bug.cgi?id=157189
864 This change broke the Mac CMake build and its LayoutTest is
865 failing and/or flaky on all platforms (Requested by ryanhaddad
870 "Move ResourceTiming behind a runtime flag"
871 https://bugs.webkit.org/show_bug.cgi?id=157133
872 http://trac.webkit.org/changeset/200232
874 2016-04-29 Yusuke Suzuki <utatane.tea@gmail.com>
876 [ES6] RegExp.prototype.@@replace should use @isObject instead of `instanceof` for object guard
877 https://bugs.webkit.org/show_bug.cgi?id=157124
879 Reviewed by Keith Miller.
881 Use @isObject instead of `instanceof @Object`.
882 The `instanceof` check is not enough to check Object Type.
883 This fix itself is the same to r199647, and this patch is for RegExp.prototype.@@replace.
885 * builtins/RegExpPrototype.js:
887 * tests/stress/regexp-replace-in-other-realm-should-work.js: Added.
889 * tests/stress/regexp-replace-should-work-with-objects-not-inheriting-object-prototype.js: Added.
893 2016-04-29 Yoav Weiss <yoav@yoav.ws>
895 Move ResourceTiming behind a runtime flag
896 https://bugs.webkit.org/show_bug.cgi?id=157133
898 Reviewed by Alex Christensen.
900 * runtime/CommonIdentifiers.h: Added PerformanceEntry, PerformanceEntryList and PerformanceResourceTiming as property names.
902 2016-04-28 Joseph Pecoraro <pecoraro@apple.com>
904 Remove unused bool parameter in CodeCache::getGlobalCodeBlock
905 https://bugs.webkit.org/show_bug.cgi?id=157156
907 Reviewed by Mark Lam.
909 The bool parameter appears to be isArrowFunctionContext, but the method's
910 contents just get that property from the Executable, so the parameter is
911 unnecessary and unused.
913 * runtime/CodeCache.cpp:
914 (JSC::CodeCache::getGlobalCodeBlock):
915 (JSC::CodeCache::getProgramCodeBlock):
916 (JSC::CodeCache::getEvalCodeBlock):
917 (JSC::CodeCache::getModuleProgramCodeBlock):
918 * runtime/CodeCache.h:
919 * runtime/Executable.cpp:
920 (JSC::EvalExecutable::create):
921 * runtime/JSGlobalObject.cpp:
922 (JSC::JSGlobalObject::createEvalCodeBlock):
923 * runtime/JSGlobalObject.h:
925 2016-04-28 Caitlin Potter <caitp@igalia.com>
927 [JSC] re-implement String#padStart and String#padEnd in JavaScript
928 https://bugs.webkit.org/show_bug.cgi?id=157146
930 Reviewed by Saam Barati.
932 * builtins/StringPrototype.js:
933 (repeatCharactersSlowPath):
936 * runtime/JSGlobalObject.cpp:
937 (JSC::JSGlobalObject::init):
938 * runtime/StringPrototype.cpp:
939 (JSC::StringPrototype::finishCreation): Deleted.
940 (JSC::repeatStringPattern): Deleted.
941 (JSC::padString): Deleted.
942 (JSC::stringProtoFuncPadEnd): Deleted.
943 (JSC::stringProtoFuncPadStart): Deleted.
945 2016-04-28 Joseph Pecoraro <pecoraro@apple.com>
947 Web Inspector: Tweak auto attach initialization on some platforms
948 https://bugs.webkit.org/show_bug.cgi?id=157150
949 <rdar://problem/21222045>
951 Reviewed by Timothy Hatcher.
953 * inspector/EventLoop.cpp:
954 (Inspector::EventLoop::cycle):
955 * inspector/remote/RemoteInspector.mm:
956 (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
958 2016-04-28 Benjamin Poulain <bpoulain@apple.com>
960 [JSC] Unify Math.pow() accross all tiers
961 https://bugs.webkit.org/show_bug.cgi?id=157121
963 Reviewed by Geoffrey Garen.
965 My previous optimizations of DFG compile time have slowly
966 regressed Sunspider's math-partial-sums.
968 What is happenning is baseline used a thunk for Math.pow()
969 that has a special case for an exponent of -0.5, while
970 DFG/FTL have other special cases for other exponents.
971 The faster we get to DFG, the less time we spend in that fast
974 While looking into this, I discovered some correctness issues. Baseline
975 optimizes y=-0.5 by turning it into 1/sqrt(). DFG/FTL optimize constant
976 y=0.5 by turning it into sqrt(). The problem is sqrt() behaves differently
977 for -0 and -Infinity. With sqrt(), negative numbers are undefined,
978 and the result is NaN. With pow(), they have a result.
980 Something else that has bothered me for a while is that Math.pow()
981 with the same arguments give you different results in LLINT, Baseline,
982 and DFG/FTL. This seems a bit dangerous for numerical stability.
984 With this patch, I unify the behaviors for all tiers while keeping
987 We have pow() that is super slow, but most callers don't need the
989 -pow() with an exponent between 0 and 1000 is a fast path implemented
990 by multiplication only.
991 -pow(x, 0.5) is sqrt with special checks for negative values.
992 -pow(x, -0.5) is sqrt with special checks for negative values.
994 The C++ implementation handles all those optimizations too. This ensure
995 you get the same results from LLINT to FTL.
997 The thunk is eliminated, it was producing incorrect results and only
998 optimized Sunspider's partial-sums.
1000 DFG gets the optimized integer, 0.5 and -0.5 cases since those are important
1001 for somewhat-hot code. DFG falls back to the C++ code for any non-obvious case.
1003 FTL gets the full C++ implementation inlined in B3. B3 knows how to eliminate
1004 all the dead cases so you get the best if your code is hot enough to reach FTL.
1006 * dfg/DFGFixupPhase.cpp:
1007 (JSC::DFG::FixupPhase::fixupNode): Deleted.
1009 (JSC::DFG::Node::convertToArithSqrt): Deleted.
1010 * dfg/DFGNodeType.h:
1011 * dfg/DFGSpeculativeJIT.cpp:
1012 (JSC::DFG::compileArithPowIntegerFastPath):
1013 (JSC::DFG::SpeculativeJIT::compileArithPow):
1014 * dfg/DFGStrengthReductionPhase.cpp:
1015 (JSC::DFG::StrengthReductionPhase::handleNode):
1016 * ftl/FTLLowerDFGToB3.cpp:
1017 (JSC::FTL::DFG::LowerDFGToB3::compileArithPow):
1018 * jit/ThunkGenerators.cpp:
1019 (JSC::powThunkGenerator): Deleted.
1020 * jit/ThunkGenerators.h:
1021 * runtime/MathCommon.cpp:
1022 (JSC::operationMathPow):
1023 * runtime/MathCommon.h:
1025 (JSC::thunkGeneratorForIntrinsic): Deleted.
1026 * tests/stress/math-pow-stable-results.js: Added.
1027 Getting consistent results when tiering up is new.
1028 This test verify that results always remains the same as LLINT.
1030 * tests/stress/math-pow-with-constants.js:
1031 (testPowUsedAsSqrt):
1032 (powUsedAsOneOverSqrt):
1033 (testPowUsedAsOneOverSqrt):
1035 (testPowUsedAsSquare):
1037 2016-04-28 Mark Lam <mark.lam@apple.com>
1039 DebuggerScope::className() should not assert scope->isValid().
1040 https://bugs.webkit.org/show_bug.cgi?id=157143
1042 Reviewed by Keith Miller.
1044 DebuggerScope::className() should not assert scope->isValid() because the
1045 TypeProfiler logs objects it encounters, and may indirectly call
1046 JSObject::calculatedClassName() on those objects later, thereby calling
1047 DebuggerScope::className() on an invalidated DebuggerScope.
1049 The existing handling in DebuggerScope::className() for an invalidated scope
1050 (that returns a null string) is sufficient.
1052 * debugger/DebuggerScope.cpp:
1053 (JSC::DebuggerScope::className):
1055 2016-04-28 Caitlin Potter <caitp@igalia.com>
1057 [JSC] implement spec changes for String#padStart and String#padEnd
1058 https://bugs.webkit.org/show_bug.cgi?id=157139
1060 Reviewed by Keith Miller.
1062 Previously, if the fill string was the empty string, it was treated as a
1063 single U+0020 SPACE character. Now, if this occurs, the original string
1064 is returned instead.
1066 Change was discussed at TC39 in March [1], and is reflected in new
1067 test262 tests for the feature.
1069 [1] https://github.com/tc39/tc39-notes/blob/master/es7/2016-03/march-29.md#stringprototypepadstartpadend
1071 * runtime/StringPrototype.cpp:
1073 * tests/es6/String.prototype_methods_String.prototype.padEnd.js:
1074 (TestFillerToString):
1075 (TestFillerEmptyString):
1076 * tests/es6/String.prototype_methods_String.prototype.padStart.js:
1077 (TestFillerToString):
1078 (TestFillerEmptyString):
1080 2016-04-28 Skachkov Oleksandr <gskachkov@gmail.com>
1082 Crash for non-static super property call in derived class constructor
1083 https://bugs.webkit.org/show_bug.cgi?id=157089
1085 Reviewed by Darin Adler.
1087 Added tdz check of the 'this' before access to the 'super' for FunctionCallBracketNode,
1088 the same as it was done for FunctionCallDotNode.
1090 * bytecompiler/NodesCodegen.cpp:
1091 (JSC::FunctionCallBracketNode::emitBytecode):
1093 2016-04-27 Mark Lam <mark.lam@apple.com>
1095 The GetterSetter structure needs a globalObject.
1096 https://bugs.webkit.org/show_bug.cgi?id=157120
1098 Reviewed by Filip Pizlo.
1100 In r199170: <http://trac.webkit.org/r199170>, GetterSetter was promoted from
1101 being a JSCell to a JSObject. JSObject methods expect their structure to have a
1102 globalObject. For example, see JSObject::calculatedClassName(). GetterSetter
1103 was previously using a singleton getterSetterStructure owned by the VM. That
1104 singleton getterSetterStructure is not associated with any globalObjects. As a
1105 result, JSObject::calculatedClassName() will run into a null globalObject when it
1106 is called on a GetterSetter object.
1108 This patch removes the VM singleton getterSetterStructure, and instead, creates
1109 a getterSetterStructure for each JSGlobalObject.
1111 * dfg/DFGAbstractInterpreterInlines.h:
1112 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1113 * dfg/DFGStructureRegistrationPhase.cpp:
1114 (JSC::DFG::StructureRegistrationPhase::run):
1115 * runtime/GetterSetter.h:
1116 * runtime/JSGlobalObject.cpp:
1117 (JSC::JSGlobalObject::init):
1118 (JSC::JSGlobalObject::visitChildren):
1119 * runtime/JSGlobalObject.h:
1120 (JSC::JSGlobalObject::functionStructure):
1121 (JSC::JSGlobalObject::boundFunctionStructure):
1122 (JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
1123 (JSC::JSGlobalObject::getterSetterStructure):
1124 (JSC::JSGlobalObject::nativeStdFunctionStructure):
1125 (JSC::JSGlobalObject::namedFunctionStructure):
1126 (JSC::JSGlobalObject::functionNameOffset):
1131 2016-04-27 Keith Miller <keith_miller@apple.com>
1133 Unreviewed, Revert r199397 due to PLT regressions
1135 * JavaScriptCore.xcodeproj/project.pbxproj:
1136 * builtins/ArrayPrototype.js:
1137 (concatSlowPath): Deleted.
1139 * bytecode/BytecodeIntrinsicRegistry.cpp:
1140 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): Deleted.
1141 * bytecode/BytecodeIntrinsicRegistry.h:
1142 * dfg/DFGAbstractInterpreterInlines.h:
1143 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1144 * dfg/DFGByteCodeParser.cpp:
1145 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
1146 (JSC::DFG::ByteCodeParser::handleIntrinsicCall): Deleted.
1147 * dfg/DFGClobberize.h:
1148 (JSC::DFG::clobberize):
1149 * dfg/DFGDoesGC.cpp:
1150 (JSC::DFG::doesGC): Deleted.
1151 * dfg/DFGFixupPhase.cpp:
1152 (JSC::DFG::FixupPhase::fixupNode):
1153 * dfg/DFGNodeType.h:
1154 * dfg/DFGOperations.cpp:
1155 * dfg/DFGOperations.h:
1156 * dfg/DFGPredictionPropagationPhase.cpp:
1157 * dfg/DFGSafeToExecute.h:
1158 (JSC::DFG::safeToExecute): Deleted.
1159 * dfg/DFGSpeculativeJIT.cpp:
1160 (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
1161 (JSC::DFG::SpeculativeJIT::compileIsJSArray): Deleted.
1162 (JSC::DFG::SpeculativeJIT::compileIsArrayObject): Deleted.
1163 (JSC::DFG::SpeculativeJIT::compileIsArrayConstructor): Deleted.
1164 (JSC::DFG::SpeculativeJIT::compileCallObjectConstructor): Deleted.
1165 * dfg/DFGSpeculativeJIT.h:
1166 (JSC::DFG::SpeculativeJIT::callOperation): Deleted.
1167 * dfg/DFGSpeculativeJIT32_64.cpp:
1168 (JSC::DFG::SpeculativeJIT::compile): Deleted.
1169 * dfg/DFGSpeculativeJIT64.cpp:
1170 (JSC::DFG::SpeculativeJIT::compile):
1171 * ftl/FTLCapabilities.cpp:
1172 (JSC::FTL::canCompile): Deleted.
1173 * ftl/FTLLowerDFGToB3.cpp:
1174 (JSC::FTL::DFG::LowerDFGToB3::compileNode): Deleted.
1175 (JSC::FTL::DFG::LowerDFGToB3::compileCallObjectConstructor): Deleted.
1176 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayObject): Deleted.
1177 (JSC::FTL::DFG::LowerDFGToB3::compileIsJSArray): Deleted.
1178 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayConstructor): Deleted.
1179 (JSC::FTL::DFG::LowerDFGToB3::isArray): Deleted.
1180 * jit/JITOperations.h:
1182 (GlobalObject::finishCreation):
1183 (functionDataLogValue): Deleted.
1184 * runtime/ArrayConstructor.cpp:
1185 (JSC::ArrayConstructor::finishCreation):
1186 (JSC::arrayConstructorPrivateFuncIsArrayConstructor):
1187 * runtime/ArrayConstructor.h:
1188 (JSC::isArrayConstructor): Deleted.
1189 * runtime/ArrayPrototype.cpp:
1190 (JSC::ArrayPrototype::finishCreation):
1191 (JSC::arrayProtoFuncConcat):
1192 (JSC::arrayProtoPrivateFuncIsJSArray): Deleted.
1193 (JSC::moveElements): Deleted.
1194 (JSC::arrayProtoPrivateFuncConcatMemcpy): Deleted.
1195 (JSC::arrayProtoPrivateFuncAppendMemcpy): Deleted.
1196 * runtime/ArrayPrototype.h:
1197 * runtime/CommonIdentifiers.h:
1198 * runtime/Intrinsic.h:
1199 * runtime/JSArray.cpp:
1200 (JSC::JSArray::fastConcatWith):
1201 (JSC::JSArray::appendMemcpy): Deleted.
1202 * runtime/JSArray.h:
1203 (JSC::JSArray::fastConcatType):
1204 (JSC::JSArray::createStructure):
1206 * runtime/JSArrayInlines.h: Removed.
1207 (JSC::JSArray::memCopyWithIndexingType): Deleted.
1208 (JSC::JSArray::canFastCopy): Deleted.
1209 * runtime/JSGlobalObject.cpp:
1210 (JSC::JSGlobalObject::init):
1212 * runtime/ObjectConstructor.h:
1213 (JSC::constructObject): Deleted.
1215 * tests/stress/array-concat-spread-object.js: Removed.
1217 * tests/stress/array-concat-spread-proxy-exception-check.js: Removed.
1219 * tests/stress/array-concat-spread-proxy.js: Removed.
1221 * tests/stress/array-concat-with-slow-indexingtypes.js: Removed.
1223 * tests/stress/array-species-config-array-constructor.js:
1225 2016-04-27 Michael Saboff <msaboff@apple.com>
1227 REGRESSION(r200117): Crash in lowerDFGToB3::compileStringReplace()
1228 https://bugs.webkit.org/show_bug.cgi?id=157099
1230 Reviewed by Saam Barati.
1232 Given that the DFGFixupPhase could mark the edge of child2 as StringUse,
1233 we need to lower that edge appropriately.
1235 * ftl/FTLLowerDFGToB3.cpp:
1236 (JSC::FTL::DFG::LowerDFGToB3::compileStringReplace):
1238 2016-04-27 Mark Lam <mark.lam@apple.com>
1240 Address feedback from https://bugs.webkit.org/show_bug.cgi?id=157048#c5.
1241 https://bugs.webkit.org/show_bug.cgi?id=157096
1243 Reviewed by Geoffrey Garen.
1245 1. Check for USE(APPLE_INTERNAL_SDK) instead of __has_include(<mach-o/dyld_priv.h>).
1246 2. Rename webkitFirstSDKVersionWithInitConstructorSupport to
1247 firstSDKVersionWithInitConstructorSupport.
1249 * API/JSWrapperMap.mm:
1250 (supportsInitMethodConstructors):
1252 2016-04-27 Mark Lam <mark.lam@apple.com>
1254 Restrict the availability of some JSC options to local debug builds only.
1255 https://bugs.webkit.org/show_bug.cgi?id=157058
1257 Reviewed by Geoffrey Garen.
1259 1. Each option will be given an availability flag.
1260 2. The functionOverrides and useDollarVM (along with its alias, enableDollarVM)
1261 will have "Restricted" availability.
1262 3. All other options will have “Normal” availability.
1263 4. Any options with "Restricted" availability will only be accessible if function
1264 allowRestrictedOptions() returns true.
1265 5. For now, allowRestrictedOptions() always returns false for release builds, and
1266 true for debug builds.
1268 If an option is "Restricted" and restricted options are not allowed, the VM will
1269 behave semantically as if that option does not exist at all:
1270 1. Option dumps will not show the option.
1271 2. Attempts to set the option will fail as if the option does not exist.
1273 Behind the scene, the option does exist, and is set to its default value
1274 (whatever that may be) once and only once on options initialization.
1276 * runtime/Options.cpp:
1277 (JSC::allowRestrictedOptions):
1279 (JSC::overrideOptionWithHeuristic):
1280 (JSC::Options::initialize):
1281 (JSC::Options::setOptionWithoutAlias):
1282 (JSC::Options::dumpOption):
1283 * runtime/Options.h:
1284 (JSC::Option::type):
1285 (JSC::Option::availability):
1286 (JSC::Option::isOverridden):
1288 2016-04-27 Gavin Barraclough <barraclough@apple.com>
1290 Enable separated heap by default on ios
1291 https://bugs.webkit.org/show_bug.cgi?id=156720
1292 <rdar://problem/25841790>
1294 Unreviewed rollout - caused memory regression.
1296 * runtime/Options.cpp:
1297 (JSC::recomputeDependentOptions):
1299 2016-04-27 Benjamin Poulain <bpoulain@apple.com>
1301 Follow up for r200113 on 32bit
1303 I forgot to do the 32bit counterpart of r200113.
1304 The test fails on the bots.
1306 * dfg/DFGSpeculativeJIT32_64.cpp:
1307 (JSC::DFG::SpeculativeJIT::compile):
1309 2016-04-27 Alberto Garcia <berto@igalia.com>
1311 [GTK] Fails to build randomly when generating LLIntDesiredOffsets.h
1312 https://bugs.webkit.org/show_bug.cgi?id=155427
1314 Reviewed by Carlos Garcia Campos.
1316 If the build directory contains the -I string, the script that
1317 generates LLIntDesiredOffsets.h will confuse it with an option to
1318 declare an include directory.
1320 In order to avoid that we should only use the arguments that start
1321 with -I when extracting the list of include directories, instead
1322 of using the ones that simply contain that string.
1324 * offlineasm/parser.rb:
1326 2016-04-27 Saam barati <sbarati@apple.com>
1328 JSC should have an option to allow global const redeclarations
1329 https://bugs.webkit.org/show_bug.cgi?id=157006
1331 Reviewed by Geoffrey Garen.
1333 This patch implements an option that dictates whether
1334 const redeclarations at the program level will throw.
1335 This option defaults to true but allows users of JSC
1336 to set it to false. This option is per VM. This is needed
1337 for backwards compatibility with our old const implementation.
1340 (GlobalObject::finishCreation):
1341 (functionShadowChickenFunctionsOnStack):
1342 (functionSetGlobalConstRedeclarationShouldNotThrow):
1344 * runtime/Executable.cpp:
1345 (JSC::ProgramExecutable::initializeGlobalProperties):
1346 * runtime/JSGlobalLexicalEnvironment.cpp:
1347 (JSC::JSGlobalLexicalEnvironment::put):
1348 (JSC::JSGlobalLexicalEnvironment::isConstVariable):
1349 * runtime/JSGlobalLexicalEnvironment.h:
1350 (JSC::JSGlobalLexicalEnvironment::isEmpty):
1352 (JSC::VM::setGlobalConstRedeclarationShouldThrow):
1353 (JSC::VM::globalConstRedeclarationShouldThrow):
1354 * tests/stress/global-const-redeclaration-setting: Added.
1355 * tests/stress/global-const-redeclaration-setting-2.js: Added.
1357 * tests/stress/global-const-redeclaration-setting-3.js: Added.
1360 * tests/stress/global-const-redeclaration-setting-4.js: Added.
1363 * tests/stress/global-const-redeclaration-setting-5.js: Added.
1366 * tests/stress/global-const-redeclaration-setting.js: Added.
1368 * tests/stress/global-const-redeclaration-setting/first.js: Added.
1369 * tests/stress/global-const-redeclaration-setting/let.js: Added.
1370 * tests/stress/global-const-redeclaration-setting/second.js: Added.
1371 * tests/stress/global-const-redeclaration-setting/strict.js: Added.
1373 2016-04-26 Michael Saboff <msaboff@apple.com>
1375 [ES] Implement RegExp.prototype.@@replace and use it for String.prototype.replace
1376 https://bugs.webkit.org/show_bug.cgi?id=156562
1378 Reviewed by Filip Pizlo.
1380 Added builtins for String.prototype.replace as well as RegExp.prototype[Symbol.replace].
1382 The String.prototype.replace also has an intrinsic, StringPrototypeReplaceIntrinsic.
1383 This original intrinsic was copied to make StringPrototypeReplaceRegExpIntrinsic.
1384 The difference between the two intrinsics is that StringPrototypeReplaceIntrinsic has
1385 the same checks found in the new builtin hasObservableSideEffectsForStringReplace.
1386 We implement these primordial checks for StringPrototypeReplaceIntrinsic in two places.
1387 First, we do a trial check during ByteCode parsing time to see if the current
1388 RegExp.prototype properties have changed from the original. If they have, we don't
1389 inline the intrinsic. Later, in the fixup phase, we add nodes to the IR to emit the
1392 The new intrinsic StringPrototypeReplaceRegExpIntrinsic is only available via the
1393 private @replaceUsingRegExp, which is called in the String.prototype.replace builtin.
1394 It is only called after hasObservableSideEffectsForStringReplace has been called
1396 Both of these intrinsics are needed, because the JS code containing String.replace() calls
1397 runs initially in the LLint and then the baseline JIT. Even after the function tiers up
1398 to the DFG JIT, the inlining budget may not allow StringPrototypeReplaceIntrinsic to be inlined.
1399 Having StringPrototypeReplaceRegExpIntrinsic allows for the String.prototype.replace builtin to
1400 get reasonable performance before the other intrinsic is inlined or when it can't.
1402 * builtins/RegExpPrototype.js:
1408 * builtins/StringPrototype.js:
1410 (hasObservableSideEffectsForStringReplace):
1411 (intrinsic.StringPrototypeReplaceIntrinsic.replace):
1413 New builtins for String.prototype.replace and RegExp.prototype[Symbol.replace].
1415 * bytecode/BytecodeIntrinsicRegistry.cpp:
1416 * bytecode/BytecodeIntrinsicRegistry.h:
1417 * dfg/DFGAbstractInterpreterInlines.h:
1418 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1419 * dfg/DFGByteCodeParser.cpp:
1420 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
1421 * dfg/DFGClobberize.h:
1422 (JSC::DFG::clobberize):
1423 * dfg/DFGDoesGC.cpp:
1425 * dfg/DFGFixupPhase.cpp:
1426 (JSC::DFG::FixupPhase::fixupNode):
1427 (JSC::DFG::FixupPhase::fixupGetAndSetLocalsInBlock):
1428 (JSC::DFG::FixupPhase::tryAddStringReplacePrimordialChecks):
1429 (JSC::DFG::FixupPhase::checkArray):
1431 (JSC::DFG::Graph::getRegExpPrototypeProperty):
1433 (JSC::DFG::Graph::getRegExpPrototypeProperty):
1435 (JSC::DFG::Node::hasHeapPrediction):
1436 * dfg/DFGNodeType.h:
1437 * dfg/DFGPredictionPropagationPhase.cpp:
1438 * dfg/DFGSafeToExecute.h:
1439 (JSC::DFG::safeToExecute):
1440 * dfg/DFGSpeculativeJIT32_64.cpp:
1441 (JSC::DFG::SpeculativeJIT::compile):
1442 * dfg/DFGSpeculativeJIT64.cpp:
1443 (JSC::DFG::SpeculativeJIT::compile):
1444 * dfg/DFGStrengthReductionPhase.cpp:
1445 (JSC::DFG::StrengthReductionPhase::handleNode):
1446 * ftl/FTLCapabilities.cpp:
1447 (JSC::FTL::canCompile):
1448 * ftl/FTLLowerDFGToB3.cpp:
1449 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1450 * runtime/CommonIdentifiers.h:
1451 * runtime/Intrinsic.h:
1452 * runtime/RegExpPrototype.cpp:
1453 (JSC::RegExpPrototype::finishCreation):
1454 * runtime/StringPrototype.cpp:
1455 (JSC::StringPrototype::finishCreation):
1457 (JSC::stringProtoFuncReplaceUsingRegExp):
1458 (JSC::stringProtoFuncReplaceUsingStringSearch):
1459 (JSC::operationStringProtoFuncReplaceGeneric):
1460 (JSC::stringProtoFuncReplace): Deleted.
1461 Added StringReplaceRegExp intrinsic. Added checks for RegExp profiled arguments to StringReplace
1462 that mirror what is in hasObservableSideEffectsForStringReplace(). If we aren't able to add the
1463 checks, we OSR exit. Add Graph::getPrimordialRegExpPrototypeProperty() as a helper to get the
1464 primordial values from RegExp.prototype.
1466 * runtime/JSGlobalObject.cpp:
1467 (JSC::JSGlobalObject::init): Added @regExpPrototypeSymbolReplace and
1468 @hasObservableSideEffectsForStringReplace here instead og String.prototype so that we reduce the
1469 number of objects we have to traverse.
1471 * tests/es6.yaml: Changed expectations for the various replace related tests to passing.
1473 * tests/stress/regexp-replace-proxy.js:
1475 (let.getProxyNullExec.new.Proxy):
1476 (let.getSetProxyNullExec.new.Proxy):
1477 (get resetTracking):
1478 (let.getSetProxyMatches_comma.new.Proxy):
1479 (set get getSetProxyNullExec):
1480 (let.getSetProxyReplace_phoneNumber.new.Proxy):
1481 (set get getSetProxyMatches_comma):
1482 (let.getSetProxyReplaceUnicode_digit_nonGreedy.new.Proxy):
1483 (set get resetTracking):
1484 * tests/stress/string-replace-proxy.js:
1486 (let.getSetProxyReplace.new.Proxy.replace):
1489 2016-04-26 Mark Lam <mark.lam@apple.com>
1491 Gardening: speculative build fix.
1495 * API/JSWrapperMap.mm:
1497 2016-04-26 Mark Lam <mark.lam@apple.com>
1499 Update the compatibility version check for the ObjC API's InitConstructorSupport to use dyld_get_program_sdk_version().
1500 https://bugs.webkit.org/show_bug.cgi?id=157048
1502 Reviewed by Geoffrey Garen.
1504 * API/JSWrapperMap.mm:
1505 (supportsInitMethodConstructors):
1506 (getJSExportProtocol):
1508 2016-04-26 Benjamin Poulain <bpoulain@apple.com>
1510 [JSC] GetByVal on Undecided use its children before its OSR Exit
1511 https://bugs.webkit.org/show_bug.cgi?id=157046
1513 Reviewed by Mark Lam.
1515 Very silly bug: GetByVal on Undecided uses its children before
1516 the speculationCheck(). If we fail the speculation, we have already
1517 lost how to recover the values.
1519 The existing tests did not catch this because we tier up to B3
1520 before such Exits happen. B3 has explicit liveness and did not suffer
1522 The new test has a smaller warmup to exercise the OSR Exit in DFG
1525 * dfg/DFGSpeculativeJIT64.cpp:
1526 (JSC::DFG::SpeculativeJIT::compile):
1527 * tests/stress/get-by-val-on-undecided-out-of-bounds.js: Added.
1528 (string_appeared_here.opaqueGetByValKnownArray):
1530 2016-04-26 Skachkov Oleksandr <gskachkov@gmail.com>
1532 calling super() a second time in a constructor should throw
1533 https://bugs.webkit.org/show_bug.cgi?id=151113
1535 Reviewed by Saam Barati.
1537 Currently, our implementation checks if 'super()' was called in a constructor more
1538 than once and raises a RuntimeError before the second call. According to the spec
1539 we need to raise an error just after the second super() is finished and before
1540 the new 'this' is assigned https://esdiscuss.org/topic/duplicate-super-call-behaviour.
1541 To implement this behavior this patch adds a new op code, op_is_empty, that is used
1542 to check if 'this' is empty.
1544 * bytecode/BytecodeList.json:
1545 * bytecode/BytecodeUseDef.h:
1546 (JSC::computeUsesForBytecodeOffset):
1547 (JSC::computeDefsForBytecodeOffset):
1548 * bytecode/CodeBlock.cpp:
1549 (JSC::CodeBlock::dumpBytecode):
1550 * bytecompiler/BytecodeGenerator.cpp:
1551 (JSC::BytecodeGenerator::emitIsEmpty):
1552 * bytecompiler/BytecodeGenerator.h:
1553 * bytecompiler/NodesCodegen.cpp:
1554 (JSC::FunctionCallValueNode::emitBytecode):
1555 * dfg/DFGAbstractInterpreterInlines.h:
1556 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1557 * dfg/DFGByteCodeParser.cpp:
1558 (JSC::DFG::ByteCodeParser::parseBlock):
1559 * dfg/DFGCapabilities.cpp:
1560 (JSC::DFG::capabilityLevel):
1561 * dfg/DFGClobberize.h:
1562 (JSC::DFG::clobberize):
1563 * dfg/DFGDoesGC.cpp:
1565 * dfg/DFGFixupPhase.cpp:
1566 (JSC::DFG::FixupPhase::fixupNode):
1567 * dfg/DFGNodeType.h:
1568 * dfg/DFGPredictionPropagationPhase.cpp:
1569 * dfg/DFGSafeToExecute.h:
1570 (JSC::DFG::safeToExecute):
1571 * dfg/DFGSpeculativeJIT32_64.cpp:
1572 (JSC::DFG::SpeculativeJIT::compile):
1573 * dfg/DFGSpeculativeJIT64.cpp:
1574 (JSC::DFG::SpeculativeJIT::compile):
1575 * ftl/FTLCapabilities.cpp:
1576 (JSC::FTL::canCompile):
1577 * ftl/FTLLowerDFGToB3.cpp:
1578 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1579 (JSC::FTL::DFG::LowerDFGToB3::compileIsEmpty):
1581 (JSC::JIT::privateCompileMainPass):
1583 * jit/JITOpcodes.cpp:
1584 (JSC::JIT::emit_op_is_empty):
1585 * jit/JITOpcodes32_64.cpp:
1586 (JSC::JIT::emit_op_is_empty):
1587 * llint/LowLevelInterpreter32_64.asm:
1588 * llint/LowLevelInterpreter64.asm:
1589 * tests/stress/class-syntax-double-constructor.js: Added.
1591 2016-04-26 Mark Lam <mark.lam@apple.com>
1593 Changed jsc options title to be more descriptive.
1594 https://bugs.webkit.org/show_bug.cgi?id=157036
1596 Reviewed by Joseph Pecoraro.
1598 Let the title for --dumpOptions be "Modified JSC runtime options:" since it only
1599 dumps overridden options. The title for --options will remain "All JSC runtime
1600 options:" since it dumps all all options with verbose detail.
1603 (CommandLine::parseArguments):
1605 2016-04-26 Oliver Hunt <oliver@apple.com>
1607 Enable separated heap by default on ios
1608 https://bugs.webkit.org/show_bug.cgi?id=156720
1610 Unreviewed roll-in of this change. There is only one
1611 additional allocation involved in this logic, and that
1612 is a duplicate mapping.
1614 Either our tools are not report real memory usage
1615 or this revision is not responsible for the regression.
1617 * runtime/Options.cpp:
1618 (JSC::recomputeDependentOptions):
1620 2016-04-26 Filip Pizlo <fpizlo@apple.com>
1622 DFG backends shouldn't emit type checks at KnownBlah edges
1623 https://bugs.webkit.org/show_bug.cgi?id=157025
1625 Reviewed by Michael Saboff.
1627 This fixes a crash I found when browsing Bing maps with forceEagerCompilation. I include a
1628 100% repro test case.
1630 The issue is that our code still doesn't fully appreciate the devious implications of
1631 KnownBlah use kinds. Consider KnownCell for example. It means: "trust me, I know that this
1632 value will be a cell". You aren't required to provide a proof when you use KnownCell. Often,
1633 we use it as a result of a path-sensitive proof. The abstract interpreter is not
1634 path-sensitive, so AI will be absolutely sure that the KnownCell use might see a non-cell.
1635 This can lead to debug assertions (which this change removes) and it can lead to the backends
1636 emitting a type check. That type check can be pure evil if the node that has this edge does
1637 not have an exit origin. Such a node would have passed validation because the validater would
1638 have thought that the node cannot exit (after all, according to the IR semantics, there is no
1639 speculation at KnownCell).
1641 This comprehensively fixes the issue by recognizing that Foo(KnownCell:@x) means: I have
1642 already proved that by the time you start executing Foo, @x will already be a cell. I cannot
1643 tell you how I proved this but you can rely on it anyway. AI now takes advantage of this
1644 meaning and will always do filtering of KnownBlah edges regardless of whether the backend
1645 actually emits any type checks for those edges. Since the filtering runs before the backend,
1646 the backend will not emit any checks because it will know that the edge was already checked
1647 (by whatever mechanism we used when we made the edge KnownBlah).
1649 Note that it's good that we found this bug now. The DFG currently does very few
1650 sparse-conditional or path-sensitive optimizations, but it will probably do more in the
1651 future. The bug happens because GetByOffset and friends can achieve path-sensitive proofs via
1652 watchpoints on the inferred type. Normally, AI can follow along with this proof. But in the
1653 example program, and on Bing maps, we would GCSE one GetByOffset with another that had a
1654 weaker proven type. That turned out to be completely sound - between the two GetByOffset's
1655 there was a Branch to null check it. The inferred type of the second GetByOffset ended up
1656 knowing that it cannot be null because null only occurred in some structures but not others.
1657 If we added more sparse-conditional stuff to Branch, then AI would know how to follow along
1658 with the proof but it would also create more situations where we'd have a path-sensitive
1659 proof. So, it's good that we're now getting this right.
1661 * dfg/DFGAbstractInterpreter.h:
1662 (JSC::DFG::AbstractInterpreter::filterEdgeByUse):
1663 * dfg/DFGAbstractInterpreterInlines.h:
1664 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEdges):
1665 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeKnownEdgeTypes):
1666 (JSC::DFG::AbstractInterpreter<AbstractStateType>::verifyEdge):
1667 * dfg/DFGSpeculativeJIT.cpp:
1668 (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
1670 (JSC::DFG::typeFilterFor):
1671 * ftl/FTLLowerDFGToB3.cpp:
1672 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1673 * tests/stress/path-sensitive-known-cell-crash.js: Added.
1677 2016-04-26 Gavin Barraclough <barraclough@apple.com>
1679 Enable separated heap by default on ios
1680 https://bugs.webkit.org/show_bug.cgi?id=156720
1682 Unreviewed rollout - caused memory regression.
1684 * runtime/Options.cpp:
1685 (JSC::recomputeDependentOptions):
1687 2016-04-26 Joseph Pecoraro <pecoraro@apple.com>
1689 Improve jsc --help and making sampling options
1690 https://bugs.webkit.org/show_bug.cgi?id=157015
1692 Reviewed by Saam Barati.
1694 Simplify sampling options to be easier to remember:
1696 * --reportSamplingProfilerData => --sample
1697 * --samplingProfilerTimingInterval => --sampleInterval
1699 Update the --help to mention --sample, and restore the behavior of
1700 --options outputing all possible options so you can discover which
1701 options are available.
1704 (printUsageStatement):
1705 (CommandLine::parseArguments):
1706 Improve help and modify option dumping.
1708 * runtime/Options.h:
1709 * runtime/SamplingProfiler.cpp:
1710 (JSC::SamplingProfiler::SamplingProfiler):
1711 Rename the sampling interval option.
1713 2016-04-26 Commit Queue <commit-queue@webkit.org>
1715 Unreviewed, rolling out r200083.
1716 https://bugs.webkit.org/show_bug.cgi?id=157033
1718 It brokes the debug build (Requested by gskachkov on
1723 "calling super() a second time in a constructor should throw"
1724 https://bugs.webkit.org/show_bug.cgi?id=151113
1725 http://trac.webkit.org/changeset/200083
1727 2016-04-26 Skachkov Oleksandr <gskachkov@gmail.com>
1729 calling super() a second time in a constructor should throw
1730 https://bugs.webkit.org/show_bug.cgi?id=151113
1732 Reviewed by Saam Barati.
1734 Currently, our implementation checks if 'super()' was called in a constructor more
1735 than once and raises a RuntimeError before the second call. According to the spec
1736 we need to raise an error just after the second super() is finished and before
1737 the new 'this' is assigned https://esdiscuss.org/topic/duplicate-super-call-behaviour.
1738 To implement this behavior this patch adds a new op code, op_is_empty, that is used
1739 to check if 'this' is empty.
1741 * bytecode/BytecodeList.json:
1742 * bytecode/BytecodeUseDef.h:
1743 (JSC::computeUsesForBytecodeOffset):
1744 (JSC::computeDefsForBytecodeOffset):
1745 * bytecode/CodeBlock.cpp:
1746 (JSC::CodeBlock::dumpBytecode):
1747 * bytecompiler/BytecodeGenerator.cpp:
1748 (JSC::BytecodeGenerator::emitIsEmpty):
1749 * bytecompiler/BytecodeGenerator.h:
1750 * bytecompiler/NodesCodegen.cpp:
1751 (JSC::FunctionCallValueNode::emitBytecode):
1752 * dfg/DFGAbstractInterpreterInlines.h:
1753 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1754 * dfg/DFGByteCodeParser.cpp:
1755 (JSC::DFG::ByteCodeParser::parseBlock):
1756 * dfg/DFGCapabilities.cpp:
1757 (JSC::DFG::capabilityLevel):
1758 * dfg/DFGClobberize.h:
1759 (JSC::DFG::clobberize):
1760 * dfg/DFGDoesGC.cpp:
1762 * dfg/DFGFixupPhase.cpp:
1763 (JSC::DFG::FixupPhase::fixupNode):
1764 * dfg/DFGNodeType.h:
1765 * dfg/DFGSafeToExecute.h:
1766 (JSC::DFG::safeToExecute):
1767 * dfg/DFGSpeculativeJIT32_64.cpp:
1768 (JSC::DFG::SpeculativeJIT::compile):
1769 * dfg/DFGSpeculativeJIT64.cpp:
1770 (JSC::DFG::SpeculativeJIT::compile):
1771 * ftl/FTLCapabilities.cpp:
1772 (JSC::FTL::canCompile):
1773 * ftl/FTLLowerDFGToB3.cpp:
1774 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
1775 (JSC::FTL::DFG::LowerDFGToB3::compileIsEmpty):
1777 (JSC::JIT::privateCompileMainPass):
1779 * jit/JITOpcodes.cpp:
1780 (JSC::JIT::emit_op_is_empty):
1781 * jit/JITOpcodes32_64.cpp:
1782 (JSC::JIT::emit_op_is_empty):
1783 * llint/LowLevelInterpreter32_64.asm:
1784 * llint/LowLevelInterpreter64.asm:
1785 * tests/stress/class-syntax-double-constructor.js: Added.
1787 2016-04-25 Ryosuke Niwa <rniwa@webkit.org>
1789 Remove the build flag for template elements
1790 https://bugs.webkit.org/show_bug.cgi?id=157022
1792 Reviewed by Daniel Bates.
1794 * Configurations/FeatureDefines.xcconfig:
1796 2016-04-25 Benjamin Poulain <bpoulain@apple.com>
1798 [JSC] Constant folding of UInt32ToNumber is incorrect
1799 https://bugs.webkit.org/show_bug.cgi?id=157011
1800 rdar://problem/25769641
1802 Reviewed by Geoffrey Garen.
1804 UInt32ToNumber should return the unsigned 32bit value of
1805 its child. The abstract interpreter fails to do that when handling
1808 None of the tests caught that because the bytecode generator already
1809 fold the operation if given a constant. If the constant is not visible
1810 from the bytecode generator (for example because it comes from an inlined call),
1811 then the abstract interpreter folding was producing invalid results.
1813 * dfg/DFGAbstractInterpreterInlines.h:
1814 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1815 * tests/stress/uint32-to-number-constant-folding.js: Added.
1816 (uint32ToNumberMinusOne):
1817 (uint32ToNumberMinusOnePlusInteger):
1819 (uint32ToNumberOnHiddenMinusOne):
1820 (uint32ToNumberOnHiddenMinusOnePlusInteger):
1821 (inlineLargeNegativeNumber1):
1822 (inlineLargeNegativeNumber2):
1823 (inlineLargeNegativeNumber3):
1824 (uint32ToNumberOnHiddenLargeNegativeNumber1):
1825 (uint32ToNumberOnHiddenLargeNegativeNumber2):
1826 (uint32ToNumberOnHiddenLargeNegativeNumber3):
1828 2016-04-25 Fujii Hironori <Hironori.Fujii@sony.com>
1830 Heap corruption is detected when destructing JSGlobalObject
1831 https://bugs.webkit.org/show_bug.cgi?id=156831
1833 Reviewed by Mark Lam.
1835 WebKit uses CRT static library on Windows. Each copy of the CRT
1836 library has its own heap manager, allocating memory in one CRT
1837 library and passing the pointer across a DLL boundary to be freed
1838 by a different copy of the CRT library is a potential cause for
1841 Potential Errors Passing CRT Objects Across DLL Boundaries
1842 <https://msdn.microsoft.com/en-us/library/ms235460(v=vs.140).aspx>
1844 JSGlobalObject::createRareDataIfNeeded is inlined but
1845 JSGlobalObject::~JSGlobalObject is not. Then, the heap of
1846 allocating JSGlobalObjectRareData is WebKit.dll, but deallocating
1847 JavaScriptCore.dll. Adding WTF_MAKE_FAST_ALLOCATED to
1848 JSGlobalObjectRareData ensures heap consistency of it. WTF::Lock
1849 also needs WTF_MAKE_FAST_ALLOCATED because it is allocated from
1850 the inlined constructor of JSGlobalObjectRareData.
1852 Test: fast/dom/insertedIntoDocument-iframe.html
1854 * runtime/JSGlobalObject.h:
1855 Add WTF_MAKE_FAST_ALLOCATED to JSGlobalObjectRareData.
1857 2016-04-25 Michael Saboff <msaboff@apple.com>
1859 Crash using @tryGetById in DFG
1860 https://bugs.webkit.org/show_bug.cgi?id=156992
1862 Reviewed by Filip Pizlo.
1864 We need to spill live registers when compiling TryGetById in DFG.
1866 * dfg/DFGSpeculativeJIT.cpp:
1867 (JSC::DFG::SpeculativeJIT::compileTryGetById):
1868 * tests/stress/regress-156992.js: New test.
1869 (tryMultipleGetByIds):
1872 2016-04-25 Saam barati <sbarati@apple.com>
1874 We don't have to parse a function's parameters every time if the function is in the source provider cache
1875 https://bugs.webkit.org/show_bug.cgi?id=156943
1877 Reviewed by Filip Pizlo.
1879 This patch makes a few changes to make parsing inner functions
1882 First, we were always parsing an inner function's parameter
1883 list using the templatized TreeBuiler. This means if our parent scope
1884 was building an AST, we ended up building AST nodes for the inner
1885 function's parameter list even though these nodes would go unused.
1886 This patch fixes that to *always* build an inner function's parameter
1887 list using the SyntaxChecker. (Note that this is consistent now with
1888 always building an inner function's body with a SyntaxChecker.)
1890 Second, we were always parsing an inner function's parameter list
1891 even if we had that function saved in the source provider cache.
1892 I've fixed that bug and made it so that we skip over the parsing
1893 of a function's parameter list when it's in the source provider
1894 cache. We could probably enhance this in the future to skip
1895 over the entirety of a function starting at the "function"
1896 keyword or any other start of the function (depending on
1897 the function type: arrow function, method, etc).
1899 This patch also renames a few fields. First, I fixed a typo
1900 from "tocken" => "token" for a few field names. Secondly,
1901 I renamed a field that was called 'bodyStartColumn' to
1902 'parametersStartColumn' because the field really held the
1903 parameter list's start column.
1905 I'm benchmarking this as a 1.5-2% octane/jquery speedup
1908 * parser/ASTBuilder.h:
1909 (JSC::ASTBuilder::createFunctionExpr):
1910 (JSC::ASTBuilder::createMethodDefinition):
1911 (JSC::ASTBuilder::createArrowFunctionExpr):
1912 (JSC::ASTBuilder::createGetterOrSetterProperty):
1913 (JSC::ASTBuilder::createFuncDeclStatement):
1915 (JSC::Lexer<T>::lex):
1917 (JSC::Lexer::currentPosition):
1918 (JSC::Lexer::positionBeforeLastNewline):
1919 (JSC::Lexer::lastTokenLocation):
1920 (JSC::Lexer::setLastLineNumber):
1921 (JSC::Lexer::lastLineNumber):
1922 (JSC::Lexer::prevTerminator):
1923 * parser/Parser.cpp:
1924 (JSC::Parser<LexerType>::parseInner):
1925 (JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
1926 (JSC::Parser<LexerType>::parseFunctionBody):
1927 (JSC::stringForFunctionMode):
1928 (JSC::Parser<LexerType>::parseFunctionParameters):
1929 (JSC::Parser<LexerType>::parseFunctionInfo):
1931 (JSC::Scope::usedVariablesContains):
1932 (JSC::Scope::forEachUsedVariable):
1933 (JSC::Scope::useVariable):
1934 (JSC::Scope::copyCapturedVariablesToVector):
1935 (JSC::Scope::fillParametersForSourceProviderCache):
1936 (JSC::Scope::restoreFromSourceProviderCache):
1937 * parser/ParserFunctionInfo.h:
1938 * parser/SourceProviderCacheItem.h:
1939 (JSC::SourceProviderCacheItem::endFunctionToken):
1940 (JSC::SourceProviderCacheItem::usedVariables):
1941 (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
1943 2016-04-25 Mark Lam <mark.lam@apple.com>
1945 Renaming SpecInt32, SpecInt52, MachineInt to SpecInt32Only, SpecInt52Only, AnyInt.
1946 https://bugs.webkit.org/show_bug.cgi?id=156941
1948 Reviewed by Filip Pizlo.
1950 While looking at https://bugs.webkit.org/show_bug.cgi?id=153431, it was decided
1951 that SpecInt32Only, SpecInt52Only, and AnyInt would be better names for
1952 SpecInt32, SpecInt52, and MachineInt. Let's do a bulk rename.
1954 This is only a renaming patch, and deletion of a piece of unused code. There are
1955 no semantic changes.
1957 * bindings/ScriptValue.cpp:
1958 (Inspector::jsToInspectorValue):
1959 * bytecode/SpeculatedType.cpp:
1960 (JSC::dumpSpeculation):
1961 (JSC::speculationToAbbreviatedString):
1962 (JSC::speculationFromValue):
1963 (JSC::leastUpperBoundOfStrictlyEquivalentSpeculations):
1964 (JSC::typeOfDoubleNegation):
1965 (JSC::typeOfDoubleRounding):
1966 * bytecode/SpeculatedType.h:
1967 (JSC::isInt32Speculation):
1968 (JSC::isInt32OrBooleanSpeculation):
1969 (JSC::isInt32SpeculationForArithmetic):
1970 (JSC::isInt32OrBooleanSpeculationForArithmetic):
1971 (JSC::isInt32OrBooleanSpeculationExpectingDefined):
1972 (JSC::isInt52Speculation):
1973 (JSC::isAnyIntSpeculation):
1974 (JSC::isAnyIntAsDoubleSpeculation):
1975 (JSC::isDoubleRealSpeculation):
1976 (JSC::isMachineIntSpeculation): Deleted.
1977 (JSC::isInt52AsDoubleSpeculation): Deleted.
1978 (JSC::isIntegerSpeculation): Deleted.
1979 * dfg/DFGAbstractInterpreterInlines.h:
1980 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1981 * dfg/DFGAbstractValue.cpp:
1982 (JSC::DFG::AbstractValue::set):
1983 (JSC::DFG::AbstractValue::fixTypeForRepresentation):
1984 (JSC::DFG::AbstractValue::checkConsistency):
1985 (JSC::DFG::AbstractValue::resultType):
1986 * dfg/DFGAbstractValue.h:
1987 (JSC::DFG::AbstractValue::validateType):
1988 * dfg/DFGArgumentsUtilities.cpp:
1989 (JSC::DFG::emitCodeToGetArgumentsArrayLength):
1990 * dfg/DFGByteCodeParser.cpp:
1991 (JSC::DFG::ByteCodeParser::handleInlining):
1992 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
1993 * dfg/DFGFixupPhase.cpp:
1994 (JSC::DFG::FixupPhase::fixupNode):
1995 (JSC::DFG::FixupPhase::fixupToThis):
1996 (JSC::DFG::FixupPhase::observeUseKindOnNode):
1997 (JSC::DFG::FixupPhase::fixIntConvertingEdge):
1998 (JSC::DFG::FixupPhase::fixIntOrBooleanEdge):
1999 (JSC::DFG::FixupPhase::fixDoubleOrBooleanEdge):
2000 (JSC::DFG::FixupPhase::truncateConstantToInt32):
2001 (JSC::DFG::FixupPhase::attemptToMakeIntegerAdd):
2002 (JSC::DFG::FixupPhase::prependGetArrayLength):
2003 (JSC::DFG::FixupPhase::fixupChecksInBlock):
2005 (JSC::DFG::Graph::addShouldSpeculateInt32):
2006 (JSC::DFG::Graph::addShouldSpeculateAnyInt):
2007 (JSC::DFG::Graph::binaryArithShouldSpeculateInt32):
2008 (JSC::DFG::Graph::binaryArithShouldSpeculateAnyInt):
2009 (JSC::DFG::Graph::unaryArithShouldSpeculateInt32):
2010 (JSC::DFG::Graph::unaryArithShouldSpeculateAnyInt):
2011 (JSC::DFG::Graph::addShouldSpeculateMachineInt): Deleted.
2012 (JSC::DFG::Graph::binaryArithShouldSpeculateMachineInt): Deleted.
2013 (JSC::DFG::Graph::unaryArithShouldSpeculateMachineInt): Deleted.
2014 * dfg/DFGInPlaceAbstractState.cpp:
2015 (JSC::DFG::InPlaceAbstractState::initialize):
2016 * dfg/DFGJITCompiler.cpp:
2017 (JSC::DFG::JITCompiler::noticeOSREntry):
2019 (JSC::DFG::Node::convertToIdentityOn):
2021 (JSC::DFG::Node::asNumber):
2022 (JSC::DFG::Node::isAnyIntConstant):
2023 (JSC::DFG::Node::asAnyInt):
2024 (JSC::DFG::Node::isBooleanConstant):
2025 (JSC::DFG::Node::shouldSpeculateInt32OrBooleanExpectingDefined):
2026 (JSC::DFG::Node::shouldSpeculateAnyInt):
2027 (JSC::DFG::Node::shouldSpeculateDouble):
2028 (JSC::DFG::Node::shouldSpeculateNumber):
2029 (JSC::DFG::Node::isMachineIntConstant): Deleted.
2030 (JSC::DFG::Node::asMachineInt): Deleted.
2031 (JSC::DFG::Node::shouldSpeculateMachineInt): Deleted.
2032 * dfg/DFGOSREntry.cpp:
2033 (JSC::DFG::OSREntryData::dumpInContext):
2034 (JSC::DFG::prepareOSREntry):
2035 * dfg/DFGOSREntry.h:
2036 * dfg/DFGPredictionPropagationPhase.cpp:
2037 * dfg/DFGSSALoweringPhase.cpp:
2038 (JSC::DFG::SSALoweringPhase::handleNode):
2039 (JSC::DFG::SSALoweringPhase::lowerBoundsCheck):
2040 * dfg/DFGSafeToExecute.h:
2041 (JSC::DFG::SafeToExecuteEdge::operator()):
2042 * dfg/DFGSpeculativeJIT.cpp:
2043 (JSC::DFG::SpeculativeJIT::silentFill):
2044 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
2045 (JSC::DFG::SpeculativeJIT::compileArithAdd):
2046 (JSC::DFG::SpeculativeJIT::compileArithSub):
2047 (JSC::DFG::SpeculativeJIT::compileArithNegate):
2048 (JSC::DFG::SpeculativeJIT::speculateInt32):
2049 (JSC::DFG::SpeculativeJIT::speculateNumber):
2050 (JSC::DFG::SpeculativeJIT::speculateMisc):
2051 (JSC::DFG::SpeculativeJIT::speculate):
2052 * dfg/DFGSpeculativeJIT.h:
2053 (JSC::DFG::SpeculativeJIT::spill):
2054 (JSC::DFG::SpeculativeJIT::isKnownInteger):
2055 (JSC::DFG::SpeculativeJIT::isKnownCell):
2056 (JSC::DFG::SpeculativeJIT::isKnownNotInteger):
2057 (JSC::DFG::SpeculativeJIT::isKnownNotNumber):
2058 (JSC::DFG::SpeculativeJIT::isKnownNotCell):
2059 (JSC::DFG::SpeculativeJIT::isKnownNotOther):
2060 * dfg/DFGSpeculativeJIT32_64.cpp:
2061 (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal):
2062 (JSC::DFG::SpeculativeJIT::compile):
2063 * dfg/DFGSpeculativeJIT64.cpp:
2064 (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal):
2065 (JSC::DFG::SpeculativeJIT::fillSpeculateInt52):
2066 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
2067 (JSC::DFG::SpeculativeJIT::emitBranch):
2068 (JSC::DFG::SpeculativeJIT::compile):
2069 (JSC::DFG::SpeculativeJIT::blessBoolean):
2070 (JSC::DFG::SpeculativeJIT::convertAnyInt):
2071 (JSC::DFG::SpeculativeJIT::speculateAnyInt):
2072 (JSC::DFG::SpeculativeJIT::speculateDoubleRepAnyInt):
2073 (JSC::DFG::SpeculativeJIT::convertMachineInt): Deleted.
2074 (JSC::DFG::SpeculativeJIT::speculateMachineInt): Deleted.
2075 (JSC::DFG::SpeculativeJIT::speculateDoubleRepMachineInt): Deleted.
2076 * dfg/DFGUseKind.cpp:
2077 (WTF::printInternal):
2079 (JSC::DFG::typeFilterFor):
2080 (JSC::DFG::isNumerical):
2081 (JSC::DFG::isDouble):
2082 * dfg/DFGValidate.cpp:
2083 * dfg/DFGVariableAccessData.cpp:
2084 (JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
2085 (JSC::DFG::VariableAccessData::couldRepresentInt52Impl):
2086 (JSC::DFG::VariableAccessData::flushFormat):
2087 * ftl/FTLCapabilities.cpp:
2088 (JSC::FTL::canCompile):
2089 * ftl/FTLLowerDFGToB3.cpp:
2090 (JSC::FTL::DFG::LowerDFGToB3::compileInt52Constant):
2091 (JSC::FTL::DFG::LowerDFGToB3::compileInt52Rep):
2092 (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub):
2093 (JSC::FTL::DFG::LowerDFGToB3::compileArithNegate):
2094 (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
2095 (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
2096 (JSC::FTL::DFG::LowerDFGToB3::compileArrayPush):
2097 (JSC::FTL::DFG::LowerDFGToB3::lowInt32):
2098 (JSC::FTL::DFG::LowerDFGToB3::strictInt52ToInt32):
2099 (JSC::FTL::DFG::LowerDFGToB3::isInt32):
2100 (JSC::FTL::DFG::LowerDFGToB3::isNotInt32):
2101 (JSC::FTL::DFG::LowerDFGToB3::jsValueToStrictInt52):
2102 (JSC::FTL::DFG::LowerDFGToB3::doubleToStrictInt52):
2103 (JSC::FTL::DFG::LowerDFGToB3::speculate):
2104 (JSC::FTL::DFG::LowerDFGToB3::speculateCellOrOther):
2105 (JSC::FTL::DFG::LowerDFGToB3::speculateAnyInt):
2106 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepReal):
2107 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepAnyInt):
2108 (JSC::FTL::DFG::LowerDFGToB3::speculateMachineInt): Deleted.
2109 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepMachineInt): Deleted.
2110 * jit/JITOpcodes.cpp:
2111 (JSC::JIT::emit_op_profile_type):
2112 * jit/JITOpcodes32_64.cpp:
2113 (JSC::JIT::emit_op_profile_type):
2114 * runtime/JSCJSValue.h:
2115 * runtime/JSCJSValueInlines.h:
2117 (JSC::JSValue::isAnyInt):
2118 (JSC::JSValue::asAnyInt):
2119 (JSC::JSValue::isMachineInt): Deleted.
2120 (JSC::JSValue::asMachineInt): Deleted.
2121 * runtime/RuntimeType.cpp:
2122 (JSC::runtimeTypeForValue):
2123 (JSC::runtimeTypeAsString):
2124 * runtime/RuntimeType.h:
2125 * runtime/TypeSet.cpp:
2126 (JSC::TypeSet::dumpTypes):
2127 (JSC::TypeSet::displayName):
2128 (JSC::TypeSet::inspectorTypeSet):
2129 (JSC::TypeSet::toJSONString):
2131 2016-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
2133 [JSC] Optimize JSON.parse string fast path
2134 https://bugs.webkit.org/show_bug.cgi?id=156953
2136 Reviewed by Mark Lam.
2138 This patch further optimizes the string parsing fast path.
2139 Previously, we generated the WTF::String to hold the ownership of the token's string.
2140 And always copied the token in LiteralParser side.
2141 Instead, we hold the ownership of the token String by the StringBuilder in LiteralParser::Lexer,
2142 and remove the processing in the string parsing fast path.
2143 This patch gives us stable 1 - 2.5% improvement in Kraken json-parse-financial.
2147 json-parse-financial 41.383+-0.248 ^ 40.894+-0.189 ^ definitely 1.0120x faster
2149 * runtime/LiteralParser.cpp:
2150 (JSC::LiteralParser<CharType>::tryJSONPParse):
2151 (JSC::LiteralParser<CharType>::Lexer::lex):
2152 (JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
2153 (JSC::LiteralParser<CharType>::parse):
2154 (JSC::LiteralParser<CharType>::Lexer::lexString): Deleted.
2155 * runtime/LiteralParser.h:
2156 (JSC::LiteralParser::tryLiteralParse):
2157 (JSC::LiteralParser::Lexer::currentToken):
2158 (JSC::LiteralParser::Lexer::LiteralParserTokenPtr::LiteralParserTokenPtr):
2159 (JSC::LiteralParser::Lexer::LiteralParserTokenPtr::operator->):
2161 2016-04-24 Filip Pizlo <fpizlo@apple.com> and Andy VanWagoner <thetalecrafter@gmail.com>
2163 [INTL] Implement String.prototype.localeCompare in ECMA-402
2164 https://bugs.webkit.org/show_bug.cgi?id=147607
2166 Reviewed by Darin Adler.
2168 Part of this change is just rolling 194394 back in.
2170 The other part is making that not a regression on CDjs. Other than the fact that it uses
2171 bound functions, the problem with this new localeCompare implementation is that it uses
2172 the arguments object. It uses it in a way that *seems* like ArgumentsEliminationPhase
2173 ought to handle, but to my surprise it didn't:
2175 - If we have a ForceExit GetByVal on the arguments object, we would previously assume that
2176 it escaped. That's false since we just exit at ForceExit. On the other hand we probably
2177 should be pruning unreachable paths before we get here, but that's a separate issue. I
2178 don't want to play with phase order right now.
2180 - If we have a OutOfBounds GetByVal on the arguments object, then the best that would
2181 previously happen is that we'd compile it into an in-bounds arguments access. That's quite
2182 bad, as Andy's localeCompare illustrates: it uses out-of-bounds access on the arguments
2183 object to detect if an argument was passed. This change introduces an OutOfBounds version
2184 of GetMyArgumentByVal for this purpose.
2186 This change required registering sane chain watchpoints. In the process, I noticed that the
2187 old way of doing it had a race condition: we might register watchpoints for the structure
2188 that had become insane. This change introduces a double-checking idiom that I believe works
2189 because once the structure becomes insane it can't go back to sane and watchpoints
2190 registration already involves executing the hardest possible fences.
2192 * builtins/StringPrototype.js:
2196 * dfg/DFGAbstractInterpreterInlines.h:
2197 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2198 * dfg/DFGArgumentsEliminationPhase.cpp:
2199 * dfg/DFGArrayMode.cpp:
2200 (JSC::DFG::ArrayMode::refine):
2201 * dfg/DFGClobberize.h:
2202 (JSC::DFG::clobberize):
2203 * dfg/DFGConstantFoldingPhase.cpp:
2204 (JSC::DFG::ConstantFoldingPhase::foldConstants):
2205 * dfg/DFGDoesGC.cpp:
2207 * dfg/DFGFixupPhase.cpp:
2208 (JSC::DFG::FixupPhase::fixupNode):
2209 * dfg/DFGNodeType.h:
2210 * dfg/DFGPreciseLocalClobberize.h:
2211 (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
2212 * dfg/DFGPredictionPropagationPhase.cpp:
2213 * dfg/DFGSafeToExecute.h:
2214 (JSC::DFG::safeToExecute):
2215 * dfg/DFGSpeculativeJIT.cpp:
2216 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
2217 * dfg/DFGSpeculativeJIT32_64.cpp:
2218 (JSC::DFG::SpeculativeJIT::compile):
2219 * dfg/DFGSpeculativeJIT64.cpp:
2220 (JSC::DFG::SpeculativeJIT::compile):
2221 * dfg/DFGValidate.cpp:
2222 * ftl/FTLCapabilities.cpp:
2223 (JSC::FTL::canCompile):
2224 * ftl/FTLLowerDFGToB3.cpp:
2225 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
2226 (JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):
2227 (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
2228 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt):
2229 * ftl/FTLTypedPointer.h:
2230 (JSC::FTL::TypedPointer::TypedPointer):
2231 (JSC::FTL::TypedPointer::operator bool):
2232 (JSC::FTL::TypedPointer::heap):
2233 (JSC::FTL::TypedPointer::operator!): Deleted.
2234 * runtime/StringPrototype.cpp:
2235 (JSC::StringPrototype::finishCreation):
2237 2016-04-23 Filip Pizlo <fpizlo@apple.com>
2239 Unreviewed, unbreak cloop.
2242 (JSC::VM::getHostFunction):
2244 2016-04-22 Filip Pizlo <fpizlo@apple.com>
2246 Speed up bound functions a bit
2247 https://bugs.webkit.org/show_bug.cgi?id=156889
2249 Reviewed by Saam Barati.
2251 Bound functions are hard to optimize because JSC doesn't have a good notion of non-JS code
2252 that does JS-ey things like make JS calls. What I mean by "non-JS code" is code that did not
2253 originate from JS source. A bound function does a highly polymorphic call to the target
2254 stored in the JSBoundFunction. Prior to this change, we represented it as native code that
2255 used the generic native->JS call API. That's not cheap.
2257 We could model bound functions using a builtin, but it's not clear that this would be easy
2258 to grok, since so much of the code would have to access special parts of the JSBoundFunction
2259 type. Doing it that way might solve the performance problems but it would mean extra work to
2260 arrange for the builtin to have speedy access to the call target, the bound this, and the
2261 bound arguments. Also, optimizing bound functions that way would mean that bound function
2262 performance would be gated on the performance of a bunch of other things in our system. For
2263 example, we'd want this polymorphic call to be handled like the funnel that it is: if we're
2264 compiling the bound function's outgoing call with no context then we should compile it as
2265 fully polymorphic but we can let it assume basic sanity like that the callee is a real
2266 function; but if we're compiling the call with any amount of calling context then we want to
2267 use normal call IC's.
2269 Since the builtin path wouldn't lead to a simpler patch and since I think that the VM will
2270 benefit in the long run from using custom handling for bound functions, I kept the native
2271 code and just added Intrinsic/thunk support.
2273 This just adds an Intrinsic for bound function calls where the JSBoundFunction targets a
2274 JSFunction instance and has no bound arguments (only bound this). This intrinsic is
2275 currently only implemented as a thunk and not yet recognized by the DFG bytecode parser.
2277 I needed to loosen some restrictions to do this. For one, I was really tired of our bad use
2278 of ENABLE(JIT) conditionals, which made it so that any serious client of Intrinsics would
2279 have to have #ifdefs. Really what should happen is that if the JIT is not enabled then we
2280 just ignore intrinsics. Also, the code was previously assuming that having a native
2281 constructor and knowing the Intrinsic for your native call were mutually exclusive. This
2282 change makes it possible to have a native executable that has a custom function, custom
2283 constructor, and an Intrinsic.
2285 This is a >4x speed-up on bound function calls with no bound arguments.
2287 In the future, we should teach the DFG Intrinsic handling to deal with bound functions and
2288 we should teach the inliner (and ByteCodeParser::handleCall() in general) how to deal with
2289 the function call inside the bound function. That would be super awesome.
2291 * assembler/AbstractMacroAssembler.h:
2292 (JSC::AbstractMacroAssembler::timesPtr):
2293 (JSC::AbstractMacroAssembler::Address::withOffset):
2294 (JSC::AbstractMacroAssembler::BaseIndex::BaseIndex):
2295 (JSC::MacroAssemblerType>::Address::indexedBy):
2296 * jit/AssemblyHelpers.h:
2297 (JSC::AssemblyHelpers::storeCell):
2298 (JSC::AssemblyHelpers::loadCell):
2299 (JSC::AssemblyHelpers::storeValue):
2300 (JSC::AssemblyHelpers::emitSaveCalleeSaves):
2301 (JSC::AssemblyHelpers::emitSaveThenMaterializeTagRegisters):
2302 (JSC::AssemblyHelpers::emitRestoreCalleeSaves):
2303 (JSC::AssemblyHelpers::emitRestoreSavedTagRegisters):
2304 (JSC::AssemblyHelpers::copyCalleeSavesToVMCalleeSavesBuffer):
2305 * jit/JITThunks.cpp:
2306 (JSC::JITThunks::ctiNativeTailCall):
2307 (JSC::JITThunks::ctiNativeTailCallWithoutSavedTags):
2308 (JSC::JITThunks::ctiStub):
2309 (JSC::JITThunks::hostFunctionStub):
2310 (JSC::JITThunks::clearHostFunctionStubs):
2312 * jit/SpecializedThunkJIT.h:
2313 (JSC::SpecializedThunkJIT::callDoubleToDoublePreservingReturn):
2314 (JSC::SpecializedThunkJIT::tagReturnAsInt32):
2315 (JSC::SpecializedThunkJIT::emitSaveThenMaterializeTagRegisters): Deleted.
2316 (JSC::SpecializedThunkJIT::emitRestoreSavedTagRegisters): Deleted.
2317 * jit/ThunkGenerators.cpp:
2318 (JSC::virtualThunkFor):
2319 (JSC::nativeForGenerator):
2320 (JSC::nativeCallGenerator):
2321 (JSC::nativeTailCallGenerator):
2322 (JSC::nativeTailCallWithoutSavedTagsGenerator):
2323 (JSC::nativeConstructGenerator):
2324 (JSC::randomThunkGenerator):
2325 (JSC::boundThisNoArgsFunctionCallGenerator):
2326 * jit/ThunkGenerators.h:
2327 * runtime/Executable.cpp:
2328 (JSC::NativeExecutable::create):
2329 (JSC::NativeExecutable::destroy):
2330 (JSC::NativeExecutable::createStructure):
2331 (JSC::NativeExecutable::finishCreation):
2332 (JSC::NativeExecutable::NativeExecutable):
2333 (JSC::ScriptExecutable::ScriptExecutable):
2334 * runtime/Executable.h:
2335 * runtime/FunctionPrototype.cpp:
2336 (JSC::functionProtoFuncBind):
2337 * runtime/IntlCollatorPrototype.cpp:
2338 (JSC::IntlCollatorPrototypeGetterCompare):
2339 * runtime/Intrinsic.h:
2340 * runtime/JSBoundFunction.cpp:
2341 (JSC::boundThisNoArgsFunctionCall):
2342 (JSC::boundFunctionCall):
2343 (JSC::boundThisNoArgsFunctionConstruct):
2344 (JSC::boundFunctionConstruct):
2345 (JSC::getBoundFunctionStructure):
2346 (JSC::JSBoundFunction::create):
2347 (JSC::JSBoundFunction::customHasInstance):
2348 (JSC::JSBoundFunction::JSBoundFunction):
2349 * runtime/JSBoundFunction.h:
2350 (JSC::JSBoundFunction::targetFunction):
2351 (JSC::JSBoundFunction::boundThis):
2352 (JSC::JSBoundFunction::boundArgs):
2353 (JSC::JSBoundFunction::createStructure):
2354 (JSC::JSBoundFunction::offsetOfTargetFunction):
2355 (JSC::JSBoundFunction::offsetOfBoundThis):
2356 * runtime/JSFunction.cpp:
2357 (JSC::JSFunction::lookUpOrCreateNativeExecutable):
2358 (JSC::JSFunction::create):
2360 (JSC::thunkGeneratorForIntrinsic):
2361 (JSC::VM::getHostFunction):
2363 (JSC::VM::getCTIStub):
2364 (JSC::VM::exceptionOffset):
2366 2016-04-22 Joonghun Park <jh718.park@samsung.com>
2368 [JSC] Fix build break since r199866
2369 https://bugs.webkit.org/show_bug.cgi?id=156892
2371 Reviewed by Darin Adler.
2373 * runtime/MathCommon.cpp: Follow up to r199913. Remove 'include cmath' in cpp file.
2375 2016-04-22 Yusuke Suzuki <utatane.tea@gmail.com>
2377 [JSC] Optimize number parsing and string parsing in LiteralParser
2378 https://bugs.webkit.org/show_bug.cgi?id=156896
2380 Reviewed by Mark Lam.
2382 This patch aim to improve JSON.parse performance. Major 2 optimizations are included.
2384 1. Change `double result` to `int32_t result` in integer parsing case.
2385 We already have the optimized path for integer parsing, when it's digits are less than 10.
2386 At that case, the maximum number is 999999999, and the minimum number is -99999999.
2387 The both are in range of Int32. So We can use int32_t for accumulation instead of double.
2389 2. Add the string parsing fast / slow cases.
2390 We add the fast case for string parsing, which does not include any escape sequences.
2392 Both optimizations improve Kraken json-parse-financial, roughly 3.5 - 4.5%.
2394 json-parse-financial 49.128+-1.589 46.979+-0.912 might be 1.0457x faster
2396 * runtime/LiteralParser.cpp:
2397 (JSC::isJSONWhiteSpace):
2398 (JSC::isSafeStringCharacter):
2399 (JSC::LiteralParser<CharType>::Lexer::lexString):
2400 (JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
2401 (JSC::LiteralParser<CharType>::Lexer::lexNumber):
2402 * runtime/LiteralParser.h:
2404 2016-04-22 Joseph Pecoraro <pecoraro@apple.com>
2406 Web Inspector: Source directives lost when using Function constructor repeatedly
2407 https://bugs.webkit.org/show_bug.cgi?id=156863
2408 <rdar://problem/25861064>
2410 Reviewed by Geoffrey Garen.
2412 Source directives (sourceURL and sourceMappingURL) are normally accessed through
2413 the SourceProvider and normally set when the script is parsed. However, when a
2414 CodeCache lookup skips parsing, the new SourceProvider never gets the directives
2415 (sourceURL/sourceMappingURL). This patch stores the directives on the UnlinkedCodeBlock
2416 and UnlinkedFunctionExecutable when entering the cache, and copies to the new providers
2417 when the cache is used.
2419 * bytecode/UnlinkedCodeBlock.h:
2420 (JSC::UnlinkedCodeBlock::sourceURLDirective):
2421 (JSC::UnlinkedCodeBlock::sourceMappingURLDirective):
2422 (JSC::UnlinkedCodeBlock::setSourceURLDirective):
2423 (JSC::UnlinkedCodeBlock::setSourceMappingURLDirective):
2424 * bytecode/UnlinkedFunctionExecutable.h:
2425 * parser/SourceProvider.h:
2426 * runtime/CodeCache.cpp:
2427 (JSC::CodeCache::getGlobalCodeBlock):
2428 (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
2429 * runtime/CodeCache.h:
2430 Store directives on the unlinked code block / executable when adding
2431 to the cache, so they can be used to update new providers when the
2434 * runtime/JSGlobalObject.cpp:
2435 Add needed header after CodeCache header cleanup.
2437 2016-04-22 Mark Lam <mark.lam@apple.com>
2439 javascript jit bug affecting Google Maps.
2440 https://bugs.webkit.org/show_bug.cgi?id=153431
2442 Reviewed by Filip Pizlo.
2444 The issue was due to the abstract interpreter wrongly marking the type of the
2445 value read from the Uint3Array as SpecInt52, which precludes it from being an
2446 Int32. This proves to be false, and the generated code failed to handle the case
2447 where the read value is actually an Int32.
2449 The fix is to have the abstract interpreter use SpecMachineInt instead of
2452 * bytecode/SpeculatedType.h:
2453 * dfg/DFGAbstractInterpreterInlines.h:
2454 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2456 2016-04-22 Benjamin Poulain <bpoulain@apple.com>
2458 [JSC] PredictionPropagation should not be in the top 5 heaviest phases
2459 https://bugs.webkit.org/show_bug.cgi?id=156891
2461 Reviewed by Mark Lam.
2463 In DFG, PredictionPropagation is often way too high in profiles.
2464 It is a simple phase, it should not be that hot.
2466 Most of the time is spent accessing memory. This patch attempts
2469 First, propagate() is split in processInvariants() and propagates().
2470 The step processInvariants() sets all the types for nodes for which
2471 the type does not depends on other nodes.
2473 Adding processInvariants() lowers two hotspot inside PredictionPropagation:
2474 speculationFromValue() and setPrediction().
2476 Next, to avoid touching all the nodes at every operation, we keep
2477 track of the nodes that actually need propagate().
2478 The vector m_dependentNodes keeps the list of those nodes and propagate()
2479 only need to process them at each phase.
2481 This is a smaller gain because growing m_dependentNodes negates
2484 On 3d-cube, this moves PredictionPropagation from fifth position
2485 to ninth. A lot of the remaining overhead is caused by double-voting
2486 and cannot be fixed by moving stuff around.
2488 * dfg/DFGPredictionPropagationPhase.cpp:
2489 (JSC::DFG::PredictionPropagationPhase::propagateToFixpoint): Deleted.
2490 (JSC::DFG::PredictionPropagationPhase::propagate): Deleted.
2491 (JSC::DFG::PredictionPropagationPhase::propagateForward): Deleted.
2492 (JSC::DFG::PredictionPropagationPhase::propagateBackward): Deleted.
2493 (JSC::DFG::PredictionPropagationPhase::doDoubleVoting): Deleted.
2494 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting): Deleted.
2495 (JSC::DFG::PredictionPropagationPhase::propagateThroughArgumentPositions): Deleted.
2497 2016-04-22 Geoffrey Garen <ggaren@apple.com>
2499 super should be available in object literals
2500 https://bugs.webkit.org/show_bug.cgi?id=156933
2502 Reviewed by Saam Barati.
2504 When we originally implemented classes, super seemed to be a class-only
2505 feature. But the final spec says it's available in object literals too.
2507 * bytecompiler/NodesCodegen.cpp:
2508 (JSC::PropertyListNode::emitBytecode): Having 'super' and being a class
2509 property are no longer synonymous, so we track two separate variables.
2511 (JSC::PropertyListNode::emitPutConstantProperty): Being inside the super
2512 branch no longer guarantees that you're a class property, so we decide
2513 our attributes and our function name dynamically.
2515 * parser/ASTBuilder.h:
2516 (JSC::ASTBuilder::createArrowFunctionExpr):
2517 (JSC::ASTBuilder::createGetterOrSetterProperty):
2518 (JSC::ASTBuilder::createArguments):
2519 (JSC::ASTBuilder::createArgumentsList):
2520 (JSC::ASTBuilder::createProperty):
2521 (JSC::ASTBuilder::createPropertyList): Pass through state to indicate
2522 whether we're a class property, since we can't infer it from 'super'
2525 * parser/NodeConstructors.h:
2526 (JSC::PropertyNode::PropertyNode): See ASTBuilder.h.
2529 (JSC::PropertyNode::expressionName):
2530 (JSC::PropertyNode::name):
2531 (JSC::PropertyNode::type):
2532 (JSC::PropertyNode::needsSuperBinding):
2533 (JSC::PropertyNode::isClassProperty):
2534 (JSC::PropertyNode::putType): See ASTBuilder.h.
2536 * parser/Parser.cpp:
2537 (JSC::Parser<LexerType>::parseFunctionInfo):
2538 (JSC::Parser<LexerType>::parseClass):
2539 (JSC::Parser<LexerType>::parseProperty):
2540 (JSC::Parser<LexerType>::parsePropertyMethod):
2541 (JSC::Parser<LexerType>::parseGetterSetter):
2542 (JSC::Parser<LexerType>::parseMemberExpression): I made these error
2543 messages generic because it is no longer practical to say concise things
2544 about the list of places you can use super.
2548 * parser/SyntaxChecker.h:
2549 (JSC::SyntaxChecker::createArgumentsList):
2550 (JSC::SyntaxChecker::createProperty):
2551 (JSC::SyntaxChecker::appendExportSpecifier):
2552 (JSC::SyntaxChecker::appendConstDecl):
2553 (JSC::SyntaxChecker::createGetterOrSetterProperty): Updated for
2556 * tests/stress/generator-with-super.js:
2558 * tests/stress/modules-syntax-error.js:
2559 * tests/stress/super-in-lexical-scope.js:
2561 (testSyntaxError.test):
2562 * tests/stress/tagged-templates-syntax.js: Updated for error message
2563 changes. See Parser.cpp.
2565 2016-04-22 Filip Pizlo <fpizlo@apple.com>
2567 ASSERT(m_stack.last().isTailDeleted) at ShadowChicken.cpp:127 inspecting the inspector
2568 https://bugs.webkit.org/show_bug.cgi?id=156930
2570 Reviewed by Joseph Pecoraro.
2572 The loop that prunes the stack from the top should preserve the invariant that the top frame
2573 cannot be tail-deleted.
2575 * interpreter/ShadowChicken.cpp:
2576 (JSC::ShadowChicken::update):
2578 2016-04-22 Benjamin Poulain <benjamin@webkit.org>
2580 Attempt to fix the CLoop after r199866
2582 * runtime/MathCommon.h:
2584 2016-04-22 Benjamin Poulain <bpoulain@apple.com>
2586 [JSC] Integer Multiply of a number by itself does not need negative zero support
2587 https://bugs.webkit.org/show_bug.cgi?id=156895
2589 Reviewed by Saam Barati.
2591 You cannot produce negative zero by squaring an integer.
2593 * dfg/DFGFixupPhase.cpp:
2594 (JSC::DFG::FixupPhase::fixupNode):
2595 * dfg/DFGSpeculativeJIT.cpp:
2596 (JSC::DFG::SpeculativeJIT::compileArithMul):
2597 Minor codegen fixes:
2598 -Use the right form of multiply for ARM.
2599 -Use a sign-extended 32bit immediates, that's the one with fast forms
2600 in the MacroAssembler.
2602 2016-04-21 Darin Adler <darin@apple.com>
2604 Follow-on to the build fix.
2606 * runtime/MathCommon.h: Use the C++ std namespace version of the
2609 2016-04-21 Joonghun Park <jh718.park@samsung.com>
2611 [JSC] Fix build break since r199866. Unreviewed.
2612 https://bugs.webkit.org/show_bug.cgi?id=156892
2614 * runtime/MathCommon.h: Add namespace std to isnormal invoking.
2616 2016-04-21 Benjamin Poulain <bpoulain@apple.com>
2618 [JSC] Add primitive String support to compare operators
2619 https://bugs.webkit.org/show_bug.cgi?id=156783
2621 Reviewed by Geoffrey Garen.
2624 We should eventually inline some of the simplest cases.
2626 This is a 2% improvement on Longspider. It is unfortunately neutral
2627 for Sunspider on my machine because most of the comparison are from
2630 * dfg/DFGAbstractInterpreterInlines.h:
2631 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2632 * dfg/DFGClobberize.h:
2633 (JSC::DFG::clobberize):
2634 * dfg/DFGFixupPhase.cpp:
2635 (JSC::DFG::FixupPhase::fixupNode):
2636 * dfg/DFGOperations.cpp:
2637 * dfg/DFGOperations.h:
2638 * dfg/DFGSpeculativeJIT.cpp:
2639 (JSC::DFG::SpeculativeJIT::compare):
2640 (JSC::DFG::SpeculativeJIT::compileStringCompare):
2641 (JSC::DFG::SpeculativeJIT::compileStringIdentCompare):
2642 * dfg/DFGSpeculativeJIT.h:
2643 (JSC::DFG::SpeculativeJIT::callOperation):
2644 * ftl/FTLCapabilities.cpp:
2645 (JSC::FTL::canCompile):
2646 * ftl/FTLLowerDFGToB3.cpp:
2647 (JSC::FTL::DFG::LowerDFGToB3::compileCompareLess):
2648 (JSC::FTL::DFG::LowerDFGToB3::compileCompareLessEq):
2649 (JSC::FTL::DFG::LowerDFGToB3::compileCompareGreater):
2650 (JSC::FTL::DFG::LowerDFGToB3::compileCompareGreaterEq):
2651 (JSC::FTL::DFG::LowerDFGToB3::compare):
2653 (JSC::FTL::Output::callWithoutSideEffects):
2654 * jit/JITOperations.h:
2655 * tests/stress/string-compare.js: Added.
2658 (let.operator.of.operators.eval.compareStringIdent):
2659 (let.operator.of.operators.compareStringString):
2660 (let.operator.of.operators.compareStringIdentString):
2661 (let.operator.of.operators.compareStringStringIdent):
2662 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.eval):
2664 2016-04-21 Benjamin Poulain <bpoulain@webkit.org>
2666 [JSC] Commute FDiv-by-constant into FMul-by-reciprocal when it is safe
2667 https://bugs.webkit.org/show_bug.cgi?id=156871
2669 Reviewed by Filip Pizlo.
2671 FMul is significantly faster than FDiv.
2672 For example, on Haswell, FMul has a latency of 5, a throughput of 1
2673 while FDiv has latency 10-24, throughput 8-18.
2675 Fortunately for us, Sunspider and Kraken have plenty of division
2676 by a simple power of 2 constant. Those are just exponent operations
2677 and can be easily reversed to use FMul instead of FDiv.
2679 LLVM does something similar in InstCombine.
2681 * dfg/DFGStrengthReductionPhase.cpp:
2682 (JSC::DFG::StrengthReductionPhase::handleNode):
2683 * jit/JITDivGenerator.cpp:
2684 (JSC::JITDivGenerator::loadOperand):
2685 (JSC::JITDivGenerator::generateFastPath):
2686 * jit/SnippetOperand.h:
2687 (JSC::SnippetOperand::asConstNumber):
2688 * runtime/MathCommon.h:
2689 (JSC::safeReciprocalForDivByConst):
2690 * tests/stress/floating-point-div-to-mul.js: Added.
2694 (opaqueDivBySafeMaxMinusOne):
2695 (opaqueDivBySafeMax):
2696 (opaqueDivBySafeMaxPlusOne):
2697 (opaqueDivBySafeMin):
2698 (opaqueDivBySafeMinMinusOne):
2700 (i.result.opaqueDivBySafeMin.valueOf):
2702 2016-04-21 Benjamin Poulain <benjamin@webkit.org>
2704 [JSC] Improve the absThunkGenerator() for 64bit
2705 https://bugs.webkit.org/show_bug.cgi?id=156888
2707 Reviewed by Michael Saboff.
2709 A few tests spend a lot of time in this abs() with double argument.
2711 This patch adds custom handling for the JSValue64 representation.
2713 -Do not load the value twice. Unbox the GPR if it is not an Int32.
2714 -Deal with IntMin inline instead of falling back to the C function call.
2715 -Box the values ourself to avoid a duplicate function tail and return.
2717 * jit/ThunkGenerators.cpp:
2718 (JSC::absThunkGenerator):
2720 2016-04-21 Saam barati <sbarati@apple.com>
2722 LLInt CallSiteIndex off by 1
2723 https://bugs.webkit.org/show_bug.cgi?id=156886
2725 Reviewed by Benjamin Poulain.
2727 I think was done for historical reasons but isn't needed anymore.
2729 * llint/LLIntSlowPaths.cpp:
2731 2016-04-21 Keith Miller <keith_miller@apple.com>
2733 FTL should handle exceptions in operationInOptimize
2734 https://bugs.webkit.org/show_bug.cgi?id=156885
2736 Reviewed by Michael Saboff.
2738 For some reasone we didn't handle any exceptions in "in" when we called
2739 operationInOptimize in the FTL.
2741 * bytecode/CodeBlock.cpp:
2742 (JSC::CodeBlock::dumpAssumingJITType):
2743 * ftl/FTLCapabilities.cpp:
2744 (JSC::FTL::canCompile):
2745 * ftl/FTLLowerDFGToB3.cpp:
2746 (JSC::FTL::DFG::LowerDFGToB3::compileIn):
2747 * ftl/FTLPatchpointExceptionHandle.h: Add comments explaining which
2748 function to use for different exception types.
2751 (GlobalObject::finishCreation):
2753 * runtime/Executable.cpp:
2754 (JSC::ScriptExecutable::ScriptExecutable):
2755 * runtime/Executable.h:
2756 (JSC::ScriptExecutable::setNeverFTLOptimize):
2757 (JSC::ScriptExecutable::neverFTLOptimize):
2758 * tests/stress/in-ftl-exception-check.js: Added.
2763 2016-04-21 Filip Pizlo <fpizlo@apple.com>
2765 JSC virtual call thunk shouldn't do a structure->classInfo lookup
2766 https://bugs.webkit.org/show_bug.cgi?id=156874
2768 Reviewed by Keith Miller.
2770 This lookup was unnecessary because we can just test the inlined type field.
2772 But also, this meant that we were exempting JSBoundFunction from the virtual call optimization.
2775 * jit/ThunkGenerators.cpp:
2776 (JSC::virtualThunkFor):
2778 2016-04-21 Joseph Pecoraro <pecoraro@apple.com>
2780 Web Inspector: sourceMappingURL not loaded in generated script
2781 https://bugs.webkit.org/show_bug.cgi?id=156022
2782 <rdar://problem/25438595>
2784 Reviewed by Geoffrey Garen.
2786 * inspector/JSGlobalObjectInspectorController.cpp:
2787 (Inspector::JSGlobalObjectInspectorController::appendAPIBacktrace):
2788 Synthetic CallFrames for native code will not have script identifiers.
2790 * inspector/ScriptCallFrame.cpp:
2791 (Inspector::ScriptCallFrame::ScriptCallFrame):
2792 (Inspector::ScriptCallFrame::isEqual):
2793 (Inspector::ScriptCallFrame::buildInspectorObject):
2794 * inspector/ScriptCallFrame.h:
2795 * inspector/protocol/Console.json:
2796 Include the script identifier in ScriptCallFrame so we can correlate this
2797 to the exactly script, even if there isn't a URL. The Script may have a
2798 sourceURL, so the Web Inspector frontend may decide to show / link to it.
2800 * inspector/ScriptCallStackFactory.cpp:
2801 (Inspector::CreateScriptCallStackFunctor::operator()):
2802 (Inspector::createScriptCallStackFromException):
2803 Include SourceID when we have it.
2805 * interpreter/Interpreter.cpp:
2806 (JSC::GetStackTraceFunctor::operator()):
2807 * interpreter/Interpreter.h:
2808 * interpreter/StackVisitor.cpp:
2809 (JSC::StackVisitor::Frame::sourceID):
2810 * interpreter/StackVisitor.h:
2811 Access the SourceID when we have it.
2813 2016-04-21 Saam barati <sbarati@apple.com>
2815 Lets do less locking of symbol tables in the BytecodeGenerator where we don't have race conditions
2816 https://bugs.webkit.org/show_bug.cgi?id=156821
2818 Reviewed by Filip Pizlo.
2820 The BytecodeGenerator allocates all the SymbolTables that it uses.
2821 This is before any concurrent compiler thread can use that SymbolTable.
2822 This means we don't actually need to lock for any operations of the
2823 SymbolTable. This patch makes this change by removing all locking.
2824 To do this, I've introduced a new constructor for ConcurrentJITLocker
2825 which implies no locking is necessary. You instantiate such a ConcurrentJITLocker like so:
2826 `ConcurrentJITLocker locker(ConcurrentJITLocker::NoLockingNecessary);`
2828 This patch also removes all uses of Strong<SymbolTable> from the bytecode
2829 generator and instead wraps bytecode generation in a DeferGC.
2831 * bytecode/UnlinkedFunctionExecutable.cpp:
2832 (JSC::generateUnlinkedFunctionCodeBlock):
2833 * bytecompiler/BytecodeGenerator.cpp:
2834 (JSC::BytecodeGenerator::BytecodeGenerator):
2835 (JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
2836 (JSC::BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded):
2837 (JSC::BytecodeGenerator::instantiateLexicalVariables):
2838 (JSC::BytecodeGenerator::emitPrefillStackTDZVariables):
2839 (JSC::BytecodeGenerator::pushLexicalScopeInternal):
2840 (JSC::BytecodeGenerator::initializeBlockScopedFunctions):
2841 (JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
2842 (JSC::BytecodeGenerator::popLexicalScopeInternal):
2843 (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration):
2844 (JSC::BytecodeGenerator::variable):
2845 (JSC::BytecodeGenerator::createVariable):
2846 (JSC::BytecodeGenerator::emitResolveScope):
2847 (JSC::BytecodeGenerator::emitPushWithScope):
2848 (JSC::BytecodeGenerator::emitPushFunctionNameScope):
2849 * bytecompiler/BytecodeGenerator.h:
2850 (JSC::BytecodeGenerator::constructorKind):
2851 (JSC::BytecodeGenerator::superBinding):
2852 (JSC::BytecodeGenerator::generate):
2853 * runtime/CodeCache.cpp:
2854 (JSC::CodeCache::getGlobalCodeBlock):
2855 * runtime/ConcurrentJITLock.h:
2856 (JSC::ConcurrentJITLockerBase::ConcurrentJITLockerBase):
2857 (JSC::ConcurrentJITLockerBase::~ConcurrentJITLockerBase):
2858 (JSC::ConcurrentJITLocker::ConcurrentJITLocker):
2860 2016-04-21 Saam barati <sbarati@apple.com>
2862 Remove some unnecessary RefPtrs in the parser
2863 https://bugs.webkit.org/show_bug.cgi?id=156865
2865 Reviewed by Filip Pizlo.
2867 The IdentifierArena or the SourceProviderCacheItem will own these UniquedStringImpls
2868 while we are using them. There is no need for us to reference count them.
2870 This might be a 0.5% speedup on octane code-load.
2872 * parser/Parser.cpp:
2873 (JSC::Parser<LexerType>::parseInner):
2875 (JSC::Scope::setIsLexicalScope):
2876 (JSC::Scope::isLexicalScope):
2877 (JSC::Scope::closedVariableCandidates):
2878 (JSC::Scope::declaredVariables):
2879 (JSC::Scope::lexicalVariables):
2880 (JSC::Scope::finalizeLexicalEnvironment):
2881 (JSC::Scope::computeLexicallyCapturedVariablesAndPurgeCandidates):
2882 (JSC::Scope::collectFreeVariables):
2883 (JSC::Scope::getCapturedVars):
2884 (JSC::Scope::setStrictMode):
2885 (JSC::Scope::isValidStrictMode):
2886 (JSC::Scope::shadowsArguments):
2887 (JSC::Scope::copyCapturedVariablesToVector):
2888 * parser/SourceProviderCacheItem.h:
2889 (JSC::SourceProviderCacheItem::usedVariables):
2890 (JSC::SourceProviderCacheItem::~SourceProviderCacheItem):
2891 (JSC::SourceProviderCacheItem::create):
2892 (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
2893 (JSC::SourceProviderCacheItem::writtenVariables): Deleted.
2895 2016-04-21 Filip Pizlo <fpizlo@apple.com>
2897 PolymorphicAccess adds sizeof(CallerFrameAndPC) rather than subtracting it when calculating stack height
2898 https://bugs.webkit.org/show_bug.cgi?id=156872
2900 Reviewed by Geoffrey Garen.
2902 The code that added sizeof(CallerFrameAndPC) emerged from a bad copy-paste in r189586. That was
2903 the revision that created the PolymorphicAccess class. It moved code for generating a
2904 getter/setter call from Repatch.cpp to PolymorphicAccess.cpp. You can see the code doing a
2907 http://trac.webkit.org/changeset/189586/trunk/Source/JavaScriptCore/jit/Repatch.cpp
2909 This makes the world right again.
2911 * bytecode/PolymorphicAccess.cpp:
2912 (JSC::AccessCase::generateImpl):
2914 2016-04-21 Geoffrey Garen <ggaren@apple.com>
2916 Build warning: CODE_SIGN_ENTITLEMENTS specified without specifying CODE_SIGN_IDENTITY
2917 https://bugs.webkit.org/show_bug.cgi?id=156862
2919 Reviewed by Joseph Pecoraro.
2921 * Configurations/Base.xcconfig: Specify the ad hoc signing identity by
2922 default. See <http://trac.webkit.org/changeset/143544>.
2924 2016-04-21 Andy Estes <aestes@apple.com>
2926 REGRESSION (r199734): WebKit crashes loading numerous websites in iOS Simulator
2927 https://bugs.webkit.org/show_bug.cgi?id=156842
2929 Reviewed by Daniel Bates.
2931 Disable separated heap on iOS Simulator.
2933 * runtime/Options.cpp:
2934 (JSC::recomputeDependentOptions):
2936 2016-04-21 Michael Saboff <msaboff@apple.com>
2938 Align RegExp[@@match] with other @@ methods
2939 https://bugs.webkit.org/show_bug.cgi?id=156832
2941 Reviewed by Mark Lam.
2943 Various changes to align the RegExp[@@match] with [@@search] and [@@split].
2945 Made RegExp.prototype.@exec a hidden property on the global object and
2946 called it @regExpBuiltinExec to match the name it has in the standard.
2947 Changed all places that used the old name to use the new one.
2949 Made the match fast path function, which used to be call @match, to be called
2950 @regExpMatchFast and put it on the global object. Changed it to also handle
2951 expressions both with and without the global flag. Refactored the builtin
2954 Added the builtin function @hasObservableSideEffectsForRegExpMatch() that
2955 checks to see if we can use the fast path of if we need the explicit version.
2957 Put the main RegExp functions @match, @search and @split in alphabetical
2958 order in RegExpPrototype.js. Did the same for @match, @repeat, @search and
2959 @split in StringPrototype.js.
2961 * builtins/RegExpPrototype.js:
2963 (hasObservableSideEffectsForRegExpMatch): New.
2966 (hasObservableSideEffectsForRegExpSplit):
2967 Reordered in the file and updated to use @regExpBuiltinExec.
2969 * builtins/StringPrototype.js:
2975 Reordered functions in the file.
2977 * runtime/CommonIdentifiers.h:
2978 * runtime/JSGlobalObject.cpp:
2979 (JSC::JSGlobalObject::setGlobalThis):
2981 (JSC::getGetterById):
2982 (JSC::JSGlobalObject::init):
2983 * runtime/RegExpPrototype.cpp:
2984 (JSC::RegExpPrototype::finishCreation):
2985 (JSC::regExpProtoFuncExec):
2986 (JSC::regExpProtoFuncMatchFast):
2987 (JSC::regExpProtoFuncMatchPrivate): Deleted.
2988 * runtime/RegExpPrototype.h:
2990 2016-04-20 Geoffrey Garen <ggaren@apple.com>
2992 JavaScriptCore garbage collection is missing an autorelease pool
2993 https://bugs.webkit.org/show_bug.cgi?id=156751
2994 <rdar://problem/25787802>
2996 Reviewed by Mark Lam.
2999 (JSC::Heap::releaseDelayedReleasedObjects): Add an autorelease pool to
3000 catch autoreleases when we call out to arbitrary ObjC code.
3002 We use the C interface here because this is not an ObjC compilation unit.
3004 2016-04-20 Filip Pizlo <fpizlo@apple.com>
3006 DFG del_by_id support forgets to set()
3007 https://bugs.webkit.org/show_bug.cgi?id=156830
3009 Reviewed by Saam Barati.
3011 * dfg/DFGByteCodeParser.cpp:
3012 (JSC::DFG::ByteCodeParser::parseBlock):
3013 * tests/stress/dfg-del-by-id.js: Added.
3015 2016-04-20 Saam barati <sbarati@apple.com>
3017 Improve sampling profiler CLI JSC tool
3018 https://bugs.webkit.org/show_bug.cgi?id=156824
3020 Reviewed by Mark Lam.
3022 This patch enhances the Sampling Profiler CLI tool from the JSC shell
3023 to display the JITType of a particular CodeBlock. Because this happens
3024 once we process a log of stack frames, the data for a particular frame
3025 being in LLInt vs. Baseline could be wrong. For example, we may have taken
3026 a stack trace of a CodeBlock while it was executing in the LLInt, then
3027 it tiers up to the baseline, then we process the log. We will show such CodeBlocks
3028 as being in the baseline JIT. We could be smarter about this in the future if
3029 it turns out to truly be a problem.
3031 This patch also adds a 'samplingProfilerTimingInterval' JSC option to allow
3032 CLI users to control the sleep time between stack traces.
3036 * runtime/Options.h:
3037 * runtime/SamplingProfiler.cpp:
3038 (JSC::SamplingProfiler::SamplingProfiler):
3039 (JSC::SamplingProfiler::processUnverifiedStackTraces):
3040 (JSC::SamplingProfiler::reportTopBytecodes):
3041 * runtime/SamplingProfiler.h:
3042 (JSC::SamplingProfiler::StackFrame::hasExpressionInfo):
3044 2016-04-20 Benjamin Poulain <bpoulain@apple.com>
3046 [JSC] DFG should not generate two jumps when the target of DoubleBranch is the next block
3047 https://bugs.webkit.org/show_bug.cgi?id=156815
3049 Reviewed by Mark Lam.
3051 * dfg/DFGSpeculativeJIT.cpp:
3052 (JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
3054 2016-04-20 Benjamin Poulain <bpoulain@apple.com>
3056 [JSC] Add register reuse for ArithAdd of an Int32 and constant in DFG
3057 https://bugs.webkit.org/show_bug.cgi?id=155164
3059 Reviewed by Mark Lam.
3061 Every "inc" in loop was looking like this:
3066 This patch add register Reuse to that case to remove
3070 (JSC::DFG::SpeculationRecovery::SpeculationRecovery):
3071 (JSC::DFG::SpeculationRecovery::immediate):
3072 * dfg/DFGOSRExitCompiler32_64.cpp:
3073 (JSC::DFG::OSRExitCompiler::compileExit):
3074 * dfg/DFGOSRExitCompiler64.cpp:
3075 (JSC::DFG::OSRExitCompiler::compileExit):
3076 * dfg/DFGSpeculativeJIT.cpp:
3077 (JSC::DFG::SpeculativeJIT::compileArithAdd):
3078 * tests/stress/arith-add-with-constant-overflow.js: Added.
3081 2016-04-20 Saam barati <sbarati@apple.com>
3083 We don't need a manual stack for an RAII object when the machine's stack will do just fine
3084 https://bugs.webkit.org/show_bug.cgi?id=156807
3086 Reviewed by Mark Lam.
3088 We kept around a vector for an RAII object to maintain
3089 the recursive nature of having these RAII objects on
3090 the stack as the parser recursed. Instead, the RAII object
3091 can just have a field with the value it wants to restore
3092 and use the machine's stack.
3094 This is a 1% octane code-load progression.
3096 * parser/SyntaxChecker.h:
3097 (JSC::SyntaxChecker::BinaryExprContext::BinaryExprContext):
3098 (JSC::SyntaxChecker::BinaryExprContext::~BinaryExprContext):
3099 (JSC::SyntaxChecker::UnaryExprContext::UnaryExprContext):
3100 (JSC::SyntaxChecker::UnaryExprContext::~UnaryExprContext):
3101 (JSC::SyntaxChecker::operatorStackPop):
3103 2016-04-20 Michael Saboff <msaboff@apple.com>
3105 REGRESSION(r190289): Spin trying to view/sign in to hbogo.com
3106 https://bugs.webkit.org/show_bug.cgi?id=156765
3108 Reviewed by Saam Barati.
3110 In the op_get_by_val case, we were holding the lock on a profiled CodeBlock
3111 when we call into handleGetById(). Changed to drop the lock before calling
3114 The bug here was that the call to handleGetById() may end up calling in to
3115 getPredictionWithoutOSRExit() for a tail call opcode. As part of that
3116 processing, we walk back up the stack to find the effective caller and when
3117 found, we lock the corresponding CodeBlock to get the predicition.
3118 That CodeBLock may be the same one locked above. There is no need anyway
3119 to hold the CodeBlock lock when calling handleGetById().
3121 Added a new stress test.
3123 * dfg/DFGByteCodeParser.cpp:
3124 (JSC::DFG::ByteCodeParser::parseBlock):
3125 * tests/stress/regress-156765.js: Added.
3130 2016-04-20 Mark Lam <mark.lam@apple.com>
3132 Unindent an unnecessary block in stringProtoFuncSplitFast().
3133 https://bugs.webkit.org/show_bug.cgi?id=156802
3135 Reviewed by Filip Pizlo.
3137 In webkit.org/b/156013, I refactored stringProtoFuncSplit into
3138 stringProtoFuncSplitFast. In that patch, I left an unnecessary block of code in
3139 its original block (with FIXMEs) to keep the diff for that patch minimal. Now
3140 that the patch for webkit.org/b/156013 has landed, I will unindent that block and
3143 * runtime/StringPrototype.cpp:
3144 (JSC::stringProtoFuncSplitFast):
3146 2016-04-20 Brady Eidson <beidson@apple.com>
3148 Modern IDB (Workers): Enable INDEXED_DATABASE_IN_WORKERS compile time flag, but disabled in RuntimeEnabledFeatures.
3149 https://bugs.webkit.org/show_bug.cgi?id=156782
3151 Reviewed by Alex Christensen.
3153 * Configurations/FeatureDefines.xcconfig:
3155 2016-04-20 Saam barati <sbarati@apple.com>
3157 Remove unused m_writtenVariables from the parser and related bits
3158 https://bugs.webkit.org/show_bug.cgi?id=156784
3160 Reviewed by Yusuke Suzuki.
3162 This isn't a octane/codeload speedup even though we're doing less work in
3163 collectFreeVariables. But it's good to get rid of things that are not used.
3166 (JSC::ScopeNode::usesEval):
3167 (JSC::ScopeNode::usesArguments):
3168 (JSC::ScopeNode::usesArrowFunction):
3169 (JSC::ScopeNode::isStrictMode):
3170 (JSC::ScopeNode::setUsesArguments):
3171 (JSC::ScopeNode::usesThis):
3172 (JSC::ScopeNode::modifiesParameter): Deleted.
3173 (JSC::ScopeNode::modifiesArguments): Deleted.
3174 * parser/Parser.cpp:
3175 (JSC::Parser<LexerType>::parseInner):
3176 (JSC::Parser<LexerType>::parseAssignmentExpression):
3178 (JSC::Scope::Scope):
3179 (JSC::Scope::hasDeclaredParameter):
3180 (JSC::Scope::preventAllVariableDeclarations):
3181 (JSC::Scope::collectFreeVariables):
3182 (JSC::Scope::mergeInnerArrowFunctionFeatures):
3183 (JSC::Scope::getSloppyModeHoistedFunctions):
3184 (JSC::Scope::getCapturedVars):
3185 (JSC::Scope::setStrictMode):
3186 (JSC::Scope::strictMode):
3187 (JSC::Scope::fillParametersForSourceProviderCache):
3188 (JSC::Scope::restoreFromSourceProviderCache):
3189 (JSC::Parser::hasDeclaredParameter):
3190 (JSC::Parser::exportName):
3191 (JSC::Scope::declareWrite): Deleted.
3192 (JSC::Parser::declareWrite): Deleted.
3193 * parser/ParserModes.h:
3195 2016-04-19 Saam barati <sbarati@apple.com>
3197 Unreviewed, fix cloop build after r199754.
3202 2016-04-19 Michael Saboff <msaboff@apple.com>
3204 iTunes crashing JavaScriptCore.dll
3205 https://bugs.webkit.org/show_bug.cgi?id=156647
3207 Reviewed by Filip Pizlo.
3209 Given that there there are only 128 FLS indices compared to over a 1000 for TLS,
3210 I eliminated the thread specific m_threadSpecificForThread and instead we look
3211 for the current thread in m_registeredThreads list when we need it.
3212 In most cases there will only be one thread.
3214 Added THREAD_SPECIFIC_CALL to signature of ThreadSpecific remove callbacks
3215 to set the calling convention correctly for Windows 32 bit.
3217 * heap/MachineStackMarker.cpp:
3218 (JSC::ActiveMachineThreadsManager::remove):
3219 (JSC::MachineThreads::MachineThreads):
3220 (JSC::MachineThreads::~MachineThreads):
3221 (JSC::MachineThreads::addCurrentThread):
3222 (JSC::MachineThreads::machineThreadForCurrentThread):
3223 (JSC::MachineThreads::removeThread):
3224 * heap/MachineStackMarker.h:
3226 2016-04-19 Benjamin Poulain <bpoulain@webkit.org>
3228 [JSC] Small cleanup of RegisterAtOffsetList
3229 https://bugs.webkit.org/show_bug.cgi?id=156779
3231 Reviewed by Mark Lam.
3233 I was wondering why RegisterAtOffsetList always cache-miss.
3234 It looks like it is doing more than it needs to.
3236 We do not need to sort the values. The total order of
3237 RegisterAtOffset is:
3239 2) Order of offsets.
3240 We already generate the list in order.
3242 Also allocate the right array size ahead of filling the array.
3244 * jit/RegisterAtOffsetList.cpp:
3245 (JSC::RegisterAtOffsetList::RegisterAtOffsetList):
3246 (JSC::RegisterAtOffsetList::sort): Deleted.
3247 * jit/RegisterAtOffsetList.h:
3248 (JSC::RegisterAtOffsetList::append): Deleted.
3250 2016-04-19 Saam barati <sbarati@apple.com>
3252 Add a couple UNLIKELY macros in parseMemberExpression
3253 https://bugs.webkit.org/show_bug.cgi?id=156775
3255 Reviewed by Filip Pizlo.
3257 These UNLIKELY macros have to do with the base of the
3258 member expression being 'super'. I think it's safe to
3259 argue that this is truly UNLIKELY. I am seeing speedups
3260 sometimes on Octane codeload. Usually around 0.5%. Sometimes 1%.
3262 * parser/Parser.cpp:
3263 (JSC::Parser<LexerType>::parseMemberExpression):
3265 2016-04-19 Saam barati <sbarati@apple.com>
3267 allow jsc shell to dump sampling profiler data
3268 https://bugs.webkit.org/show_bug.cgi?id=156725
3270 Reviewed by Benjamin Poulain.
3272 This patch adds a '--reportSamplingProfilerData' option to the
3273 JSC shell which will enable the sampling profiler and dump
3274 its data at the end of execution. The dump will include the
3275 40 hottest functions and the 80 hottest bytecode locations.
3276 If you're using this option to debug, it's easy to just hack
3277 on the code to make it dump more or less information.
3280 (CommandLine::parseArguments):
3282 * runtime/Options.h:
3283 * runtime/SamplingProfiler.cpp:
3284 (JSC::SamplingProfiler::processUnverifiedStackTraces):
3285 (JSC::SamplingProfiler::stackTracesAsJSON):
3286 (JSC::SamplingProfiler::reportTopFunctions):
3287 (JSC::SamplingProfiler::reportTopBytecodes):
3288 * runtime/SamplingProfiler.h:
3289 (JSC::SamplingProfiler::StackFrame::hasExpressionInfo):
3290 (JSC::SamplingProfiler::StackFrame::hasBytecodeIndex):
3291 (JSC::SamplingProfiler::StackFrame::hasCodeBlockHash):
3292 (JSC::SamplingProfiler::setStopWatch):
3294 2016-04-19 Mark Lam <mark.lam@apple.com>
3296 Re-landing: ES6: Implement RegExp.prototype[@@search].
3297 https://bugs.webkit.org/show_bug.cgi?id=156331
3299 Reviewed by Keith Miller.
3302 1. Implemented search builtin in RegExpPrototype.js.
3303 The native path is now used as a fast path.
3304 2. Added DFG support for an IsRegExpObjectIntrinsic (modelled after the
3305 IsJSArrayIntrinsic).
3306 3. Renamed @isRegExp to @isRegExpObject to match the new IsRegExpObjectIntrinsic.
3307 4. Change the esSpecIsRegExpObject() implementation to check if the object's
3308 JSType is RegExpObjectType instead of walking the classinfo chain.
3310 * builtins/RegExpPrototype.js:
3312 * builtins/StringPrototype.js:
3314 - fixed some indentation.
3316 * dfg/DFGAbstractInterpreterInlines.h:
3317 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
3318 * dfg/DFGByteCodeParser.cpp:
3319 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
3320 * dfg/DFGClobberize.h:
3321 (JSC::DFG::clobberize):
3322 * dfg/DFGDoesGC.cpp:
3324 * dfg/DFGFixupPhase.cpp:
3325 (JSC::DFG::FixupPhase::fixupNode):
3326 * dfg/DFGNodeType.h:
3327 * dfg/DFGPredictionPropagationPhase.cpp:
3328 (JSC::DFG::PredictionPropagationPhase::propagate):
3329 * dfg/DFGSafeToExecute.h:
3330 (JSC::DFG::safeToExecute):
3331 * dfg/DFGSpeculativeJIT.cpp:
3332 (JSC::DFG::SpeculativeJIT::compileIsArrayConstructor):
3333 (JSC::DFG::SpeculativeJIT::compileIsRegExpObject):
3334 (JSC::DFG::SpeculativeJIT::compileCallObjectConstructor):
3335 * dfg/DFGSpeculativeJIT.h:
3336 * dfg/DFGSpeculativeJIT32_64.cpp:
3337 (JSC::DFG::SpeculativeJIT::compile):
3338 * dfg/DFGSpeculativeJIT64.cpp:
3339 (JSC::DFG::SpeculativeJIT::compile):
3340 * ftl/FTLCapabilities.cpp:
3341 (JSC::FTL::canCompile):
3342 * ftl/FTLLowerDFGToB3.cpp:
3343 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
3344 (JSC::FTL::DFG::LowerDFGToB3::compileIsFunction):
3345 (JSC::FTL::DFG::LowerDFGToB3::compileIsRegExpObject):
3346 (JSC::FTL::DFG::LowerDFGToB3::compileTypeOf):
3347 (JSC::FTL::DFG::LowerDFGToB3::isExoticForTypeof):
3348 (JSC::FTL::DFG::LowerDFGToB3::isRegExpObject):
3349 (JSC::FTL::DFG::LowerDFGToB3::isType):
3350 * runtime/Intrinsic.h:
3351 - Added IsRegExpObjectIntrinsic.
3353 * runtime/CommonIdentifiers.h:
3355 * runtime/ECMAScriptSpecInternalFunctions.cpp:
3356 (JSC::esSpecIsConstructor):
3357 - Changed to use uncheckedArgument since this is only called from internal code.
3358 (JSC::esSpecIsRegExpObject):
3359 (JSC::esSpecIsRegExp): Deleted.
3360 * runtime/ECMAScriptSpecInternalFunctions.h:
3361 - Changed to check the object for a JSType of RegExpObjectType.
3363 * runtime/JSGlobalObject.cpp:
3364 (JSC::JSGlobalObject::init):
3365 - Added split fast path.
3367 * runtime/RegExpPrototype.cpp:
3368 (JSC::RegExpPrototype::finishCreation):
3369 (JSC::regExpProtoFuncSearchFast):
3370 (JSC::regExpProtoFuncSearch): Deleted.
3371 * runtime/RegExpPrototype.h:
3374 * tests/stress/regexp-search.js:
3377 2016-04-19 Mark Lam <mark.lam@apple.com>
3379 Replace $vm.printValue() with $vm.value().
3380 https://bugs.webkit.org/show_bug.cgi?id=156767
3382 Reviewed by Saam Barati.
3384 When debugging with $vm, this change allows us to do this:
3386 $vm.print("myObj = " + $vm.value(myObj) + "\n");
3388 ... instead of having to do this:
3390 $vm.print("myObj = ");
3391 $vm.printValue(myObj);
3394 * tools/JSDollarVMPrototype.cpp:
3395 (JSC::JSDollarVMPrototype::printValue):
3396 (JSC::functionValue):
3397 (JSC::JSDollarVMPrototype::finishCreation):
3398 (JSC::functionPrintValue): Deleted.
3400 2016-04-19 Mark Lam <mark.lam@apple.com>
3402 Re-landing: ES6: Implement String.prototype.split and RegExp.prototype[@@split].
3403 https://bugs.webkit.org/show_bug.cgi?id=156013
3405 Reviewed by Keith Miller.
3408 * JavaScriptCore.xcodeproj/project.pbxproj:
3409 * builtins/GlobalObject.js:
3410 (speciesConstructor):
3411 * builtins/PromisePrototype.js:
3412 - refactored to use the @speciesConstructor internal function.
3414 * builtins/RegExpPrototype.js:
3415 (advanceStringIndex):
3416 - refactored from @advanceStringIndexUnicode() to be match the spec.
3417 Benchmarks show that there's no advantage in doing the unicode check outside
3418 of the advanceStringIndexUnicode part. So, I simplified the code to match the
3419 spec (especially since @@split needs to call advanceStringIndex from more than
3422 - Removed an unnecessary call to @Object because it was already proven above.
3423 - Changed to use advanceStringIndex instead of advanceStringIndexUnicode.
3424 Again, there's no perf regression for this.
3426 (hasObservableSideEffectsForRegExpSplit):
3428 (advanceStringIndexUnicode): Deleted.
3430 * builtins/StringPrototype.js:
3432 - Modified to use RegExp.prototype[@@split].
3434 * bytecode/BytecodeIntrinsicRegistry.cpp:
3435 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
3436 (JSC::BytecodeIntrinsicRegistry::lookup):
3437 * bytecode/BytecodeIntrinsicRegistry.h:
3438 - Added the @@split symbol.
3440 * runtime/CommonIdentifiers.h:
3441 * runtime/ECMAScriptSpecInternalFunctions.cpp: Added.
3442 (JSC::esSpecIsConstructor):
3443 (JSC::esSpecIsRegExp):
3444 * runtime/ECMAScriptSpecInternalFunctions.h: Added.
3446 * runtime/JSGlobalObject.cpp:
3447 (JSC::getGetterById):
3448 (JSC::JSGlobalObject::init):
3450 * runtime/PropertyDescriptor.cpp:
3451 (JSC::PropertyDescriptor::setDescriptor):
3452 - Removed an assert that is no longer valid.
3454 * runtime/RegExpObject.h:
3455 - Made advanceStringUnicode() public so that it can be re-used by the regexp split
3458 * runtime/RegExpPrototype.cpp:
3459 (JSC::RegExpPrototype::finishCreation):
3460 (JSC::regExpProtoFuncExec):
3461 (JSC::regExpProtoFuncSearch):
3462 (JSC::advanceStringIndex):
3463 (JSC::regExpProtoFuncSplitFast):
3464 * runtime/RegExpPrototype.h:
3466 * runtime/StringObject.h:
3467 (JSC::jsStringWithReuse):
3469 - Hoisted some utility functions from StringPrototype.cpp so that they can be
3470 reused by the regexp split fast path.
3472 * runtime/StringPrototype.cpp:
3473 (JSC::StringPrototype::finishCreation):
3474 (JSC::stringProtoFuncSplitFast):
3475 (JSC::stringProtoFuncSubstr):
3476 (JSC::builtinStringSubstrInternal):
3477 (JSC::stringProtoFuncSubstring):
3478 (JSC::stringIncludesImpl):
3479 (JSC::stringProtoFuncIncludes):
3480 (JSC::builtinStringIncludesInternal):
3481 (JSC::jsStringWithReuse): Deleted.
3482 (JSC::jsSubstring): Deleted.
3483 (JSC::stringProtoFuncSplit): Deleted.
3484 * runtime/StringPrototype.h:
3488 2016-04-19 Commit Queue <commit-queue@webkit.org>
3490 Unreviewed, rolling out r199726.
3491 https://bugs.webkit.org/show_bug.cgi?id=156748
3493 WebKit tests crash on Windows 32 (Requested by msaboff on
3498 "iTunes crashing JavaScriptCore.dll"
3499 https://bugs.webkit.org/show_bug.cgi?id=156647
3500 http://trac.webkit.org/changeset/199726
3502 2016-04-19 Michael Saboff <msaboff@apple.com>
3504 iTunes crashing JavaScriptCore.dll
3505 https://bugs.webkit.org/show_bug.cgi?id=156647
3507 Reviewed by Saam Barati.
3509 Given that there there are only 128 FLS indices compared to over a 1000 for TLS, I
3510 eliminated the thread specific m_threadSpecificForThread and instead we look for the
3511 current thread in m_registeredThreads list when we need it. In most cases there
3512 will only be one thread.
3514 * heap/MachineStackMarker.cpp:
3515 (JSC::MachineThreads::MachineThreads):
3516 (JSC::MachineThreads::~MachineThreads):
3517 (JSC::MachineThreads::addCurrentThread):
3518 (JSC::MachineThreads::machineThreadForCurrentThread):
3519 (JSC::MachineThreads::removeThread):
3520 * heap/MachineStackMarker.h:
3522 2016-04-19 Yusuke Suzuki <utatane.tea@gmail.com>
3524 [INTL] Use @thisNumberValue instead of `instanceof @Number`
3525 https://bugs.webkit.org/show_bug.cgi?id=156680
3527 Reviewed by Saam Barati.
3529 Use @thisNumberValue instead of `instanceof @Number`.
3530 `instanceof @Number` is not enough;
3531 For example, given 2 realms, the object created in one realm does not
3532 inherit the Number of another realm.
3533 Another example is that the object which does not inherit Number.
3536 var number = new Number(42);
3537 number.__proto__ = null;
3540 * builtins/NumberPrototype.js:
3542 * runtime/CommonIdentifiers.h:
3543 * runtime/JSGlobalObject.cpp:
3544 (JSC::JSGlobalObject::init):
3545 * runtime/NumberPrototype.cpp:
3546 (JSC::numberProtoFuncValueOf):
3547 * runtime/NumberPrototype.h:
3548 * tests/stress/number-to-locale-string-should-accept-strange-number-objects.js: Added.
3551 2016-04-19 Commit Queue <commit-queue@webkit.org>
3553 Unreviewed, rolling out r199712.
3554 https://bugs.webkit.org/show_bug.cgi?id=156741
3556 It caused a serious regression on 32 bit platform (Requested
3557 by gskachkov on #webkit).
3561 "calling super() a second time in a constructor should throw"
3562 https://bugs.webkit.org/show_bug.cgi?id=151113
3563 http://trac.webkit.org/changeset/199712
3565 2016-04-09 Skachkov Oleksandr <gskachkov@gmail.com>
3567 calling super() a second time in a constructor should throw
3568 https://bugs.webkit.org/show_bug.cgi?id=151113
3570 Reviewed by Saam Barati and Keith Miller.
3572 Currently, our implementation checks if 'super()' was called in a constructor more
3573 than once and raises a RuntimeError before the second call. According to the spec
3574 we need to raise an error just after the second super() is finished and before
3575 the new 'this' is assigned https://esdiscuss.org/topic/duplicate-super-call-behaviour.
3576 To implement this behavior this patch adds a new op code, op_is_empty, that is used
3577 to check if 'this' is empty.
3579 * bytecode/BytecodeList.json:
3580 * bytecode/BytecodeUseDef.h:
3581 (JSC::computeUsesForBytecodeOffset):
3582 (JSC::computeDefsForBytecodeOffset):
3583 * bytecode/CodeBlock.cpp:
3584 (JSC::CodeBlock::dumpBytecode):
3585 * bytecompiler/BytecodeGenerator.cpp:
3586 (JSC::BytecodeGenerator::emitIsEmpty):
3587 * bytecompiler/BytecodeGenerator.h:
3588 * bytecompiler/NodesCodegen.cpp:
3589 (JSC::FunctionCallValueNode::emitBytecode):
3590 * dfg/DFGAbstractInterpreterInlines.h:
3591 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
3592 * dfg/DFGByteCodeParser.cpp:
3593 (JSC::DFG::ByteCodeParser::parseBlock):
3594 * dfg/DFGCapabilities.cpp:
3595 (JSC::DFG::capabilityLevel):
3596 * dfg/DFGClobberize.h:
3597 (JSC::DFG::clobberize):
3598 * dfg/DFGDoesGC.cpp:
3600 * dfg/DFGFixupPhase.cpp:
3601 (JSC::DFG::FixupPhase::fixupNode):
3602 * dfg/DFGNodeType.h:
3603 * dfg/DFGPredictionPropagationPhase.cpp:
3604 (JSC::DFG::PredictionPropagationPhase::propagate):
3605 * dfg/DFGSafeToExecute.h:
3606 (JSC::DFG::safeToExecute):
3607 * dfg/DFGSpeculativeJIT32_64.cpp:
3608 (JSC::DFG::SpeculativeJIT::compile):
3609 * dfg/DFGSpeculativeJIT64.cpp:
3610 (JSC::DFG::SpeculativeJIT::compile):
3611 * ftl/FTLCapabilities.cpp:
3612 (JSC::FTL::canCompile):
3613 * ftl/FTLLowerDFGToB3.cpp:
3614 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
3615 (JSC::FTL::DFG::LowerDFGToB3::compileIsEmpty):
3617 (JSC::JIT::privateCompileMainPass):
3619 * jit/JITOpcodes.cpp:
3620 (JSC::JIT::emit_op_is_empty):
3621 * jit/JITOpcodes32_64.cpp:
3622 (JSC::JIT::emit_op_is_empty):
3623 * llint/LowLevelInterpreter32_64.asm:
3624 * llint/LowLevelInterpreter64.asm:
3625 * tests/stress/class-syntax-double-constructor.js: Added.
3627 2016-04-18 Benjamin Poulain <bpoulain@apple.com>
3629 [JSC] Fix some overhead affecting small codegen
3630 https://bugs.webkit.org/show_bug.cgi?id=156728
3632 Reviewed by Filip Pizlo.
3634 * assembler/AbstractMacroAssembler.h:
3635 (JSC::AbstractMacroAssembler::AbstractMacroAssembler):
3636 (JSC::AbstractMacroAssembler::random):
3637 cryptographicallyRandomNumber() is very costly.
3638 We only need it in lowering some very particular cases
3639 of non-trusted immediates. No inline cache needs that.
3641 * assembler/LinkBuffer.h:
3642 (JSC::LinkBuffer::link):
3645 (JSC::JIT::addSlowCase):
3646 Do not copy the JumpList to access its elements.
3648 2016-04-18 Saam barati <sbarati@apple.com>
3650 implement dynamic scope accesses in the DFG/FTL
3651 https://bugs.webkit.org/show_bug.cgi?id=156567
3653 Reviewed by Geoffrey Garen.
3655 This patch adds dynamic scope operations to the DFG/FTL.
3656 This patch adds three new DFG nodes: ResolveScope, PutDynamicVar and GetDynamicVar.
3657 When we encounter a Dynamic/UnresolvedProperty/UnresolvedPropertyWithVarInjectionChecks
3658 resolve type, we will compile dynamic scope resolution nodes. When we encounter
3659 a resolve type that needs var injection checks and the var injection
3660 watchpoint has already been fired, we will compile dynamic scope resolution
3663 This patch also adds a new value to the InitializationMode enum: ConstInitialization.
3664 There was a subtle bug where we used to never compile the var injection variant of the
3665 resolve type for an eval that injected a var where there was also a global lexical variable with the same name.
3666 For example, the store compiled in this eval("var foo = 20;") wouldn't be compiled
3667 with var injection checks if there was global let/const variable named "foo".
3668 So there was the potential for the injected var to store to the GlobalLexicalObject.
3669 I found this bug because my initial implementation in the DFG/FTL ran into it.
3670 The reason this bug existed is because when we compile a const initialization,
3671 we never need a var injections check. The const initialization always
3672 knows where to store its value. This same logic leaked into the above eval's
3673 "var foo = 20" store. This new enum value allows us to distinguish const
3674 initialization stores from non-const initialization stores.
3676 (I also changed InitializationMode to be an enum class instead of an enum).
3678 * bytecode/CodeBlock.cpp:
3679 (JSC::CodeBlock::finishCreation):
3680 * bytecompiler/BytecodeGenerator.cpp:
3681 (JSC::BytecodeGenerator::generate):
3682 (JSC::BytecodeGenerator::BytecodeGenerator):
3683 (JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
3684 (JSC::BytecodeGenerator::initializeBlockScopedFunctions):
3685 (JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
3686 (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration):
3687 (JSC::BytecodeGenerator::emitGetFromScope):
3688 (JSC::BytecodeGenerator::initializeVariable):
3689 (JSC::BytecodeGenerator::emitInstanceOf):
3690 (JSC::BytecodeGenerator::emitPushFunctionNameScope):
3691 (JSC::BytecodeGenerator::pushScopedControlFlowContext):
3692 (JSC::BytecodeGenerator::emitPutNewTargetToArrowFunctionContextScope):
3693 (JSC::BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope):
3694 (JSC::BytecodeGenerator::emitPutThisToArrowFunctionContextScope):
3695 * bytecompiler/NodesCodegen.cpp:
3696 (JSC::PostfixNode::emitResolve):
3697 (JSC::PrefixNode::emitResolve):
3698 (JSC::ReadModifyResolveNode::emitBytecode):
3699 (JSC::initializationModeForAssignmentContext):
3700 (JSC::AssignResolveNode::emitBytecode):
3701 (JSC::EmptyLetExpression::emitBytecode):
3702 (JSC::ForInNode::emitLoopHeader):
3703 (JSC::ForOfNode::emitBytecode):
3704 (JSC::ClassExprNode::emitBytecode):
3705 (JSC::BindingNode::bindValue):
3706 (JSC::AssignmentElementNode::bindValue):
3707 (JSC::RestParameterNode::emit):
3708 * dfg/DFGAbstractInterpreterInlines.h:
3709 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
3710 * dfg/DFGByteCodeParser.cpp:
3711 (JSC::DFG::ByteCodeParser::noticeArgumentsUse):
3712 (JSC::DFG::ByteCodeParser::promoteToConstant):
3713 (JSC::DFG::ByteCodeParser::needsDynamicLookup):
3714 (JSC::DFG::ByteCodeParser::planLoad):
3715 (JSC::DFG::ByteCodeParser::parseBlock):
3716 * dfg/DFGCapabilities.cpp:
3717 (JSC::DFG::capabilityLevel):
3718 * dfg/DFGClobberize.h:
3719 (JSC::DFG::clobberize):
3720 * dfg/DFGDoesGC.cpp:
3722 * dfg/DFGFixupPhase.cpp:
3723 (JSC::DFG::FixupPhase::fixupNode):
3725 (JSC::DFG::Node::hasIdentifier):
3726 (JSC::DFG::Node::identifierNumber):
3727 (JSC::DFG::Node::hasGetPutInfo):
3728 (JSC::DFG::Node::getPutInfo):
3729 (JSC::DFG::Node::hasAccessorAttributes):
3730 * dfg/DFGNodeType.h:
3731 * dfg/DFGOperations.cpp:
3732 * dfg/DFGOperations.h:
3733 * dfg/DFGPredictionPropagationPhase.cpp:
3734 (JSC::DFG::PredictionPropagationPhase::propagate):
3735 * dfg/DFGSafeToExecute.h:
3736 (JSC::DFG::safeToExecute):
3737 * dfg/DFGSpeculativeJIT.cpp:
3738 (JSC::DFG::SpeculativeJIT::compilePutGetterSetterById):
3739 (JSC::DFG::SpeculativeJIT::compileResolveScope):
3740 (JSC::DFG::SpeculativeJIT::compileGetDynamicVar):
3741 (JSC::DFG::SpeculativeJIT::compilePutDynamicVar):
3742 (JSC::DFG::SpeculativeJIT::compilePutAccessorByVal):
3743 * dfg/DFGSpeculativeJIT.h:
3744 (JSC::DFG::SpeculativeJIT::callOperation):
3745 * dfg/DFGSpeculativeJIT32_64.cpp:
3746 (JSC::DFG::SpeculativeJIT::compile):
3747 * dfg/DFGSpeculativeJIT64.cpp:
3748 (JSC::DFG::SpeculativeJIT::compile):
3749 * ftl/FTLCapabilities.cpp:
3750 (JSC::FTL::canCompile):
3751 * ftl/FTLLowerDFGToB3.cpp:
3752 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
3753 (JSC::FTL::DFG::LowerDFGToB3::compare):
3754 (JSC::FTL::DFG::LowerDFGToB3::compileResolveScope):
3755 (JSC::FTL::DFG::LowerDFGToB3::compileGetDynamicVar):
3756 (JSC::FTL::DFG::LowerDFGToB3::compilePutDynamicVar):
3757 (JSC::FTL::DFG::LowerDFGToB3::compareEqObjectOrOtherToObject):
3758 * jit/CCallHelpers.h:
3759 (JSC::CCallHelpers::setupArgumentsWithExecState):
3760 * jit/JITOperations.cpp:
3761 * jit/JITOperations.h:
3762 * jit/JITPropertyAccess.cpp:
3763 (JSC::JIT::emit_op_put_to_scope):
3764 (JSC::JIT::emitSlow_op_put_to_scope):
3765 * jit/JITPropertyAccess32_64.cpp:
3766 (JSC::JIT::emit_op_put_to_scope):
3767 (JSC::JIT::emitSlow_op_put_to_scope):
3768 * llint/LLIntData.cpp:
3769 (JSC::LLInt::Data::performAssertions):
3770 * llint/LLIntSlowPaths.cpp:
3771 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
3772 * llint/LowLevelInterpreter.asm:
3773 * llint/LowLevelInterpreter64.asm:
3774 * runtime/GetPutInfo.h:
3775 (JSC::resolveModeName):
3776 (JSC::initializationModeName):
3777 (JSC::isInitialization):
3779 (JSC::GetPutInfo::GetPutInfo):
3780 * runtime/JSScope.cpp:
3781 (JSC::abstractAccess):
3783 2016-04-18 Filip Pizlo <fpizlo@apple.com>
3787 Rubber stampted by Benjamin Poulain.
3789 AVX is silly. If you use it and some of your other code isn't careful with float register bits, you
3790 will run 10x slower. We could fix the underlying issue, but it's better to stay away from this odd
3793 This fixes a massive regression on some real code.
3795 * assembler/MacroAssemblerX86Common.h:
3796 (JSC::MacroAssemblerX86Common::supportsAVX):
3797 (JSC::MacroAssemblerX86Common::updateEax1EcxFlags):
3799 2016-04-18 Filip Pizlo <fpizlo@apple.com>
3801 ToThis should have a fast path based on type info flags
3802 https://bugs.webkit.org/show_bug.cgi?id=156712
3804 Reviewed by Geoffrey Garen.
3806 Prior to this change, if we couldn't nail down the type of ToThis to something easy, we'd emit code
3807 that would take slow path if the argument was not a final object. We'd end up taking that slow path
3810 This adds a type info flag for ToThis having non-obvious behavior and changes the DFG and FTL paths
3811 to test this flag. This is a sub-1% speed-up on SunSpider and Octane.
3813 * dfg/DFGSpeculativeJIT32_64.cpp:
3814 (JSC::DFG::SpeculativeJIT::compile):
3815 * dfg/DFGSpeculativeJIT64.cpp:
3816 (JSC::DFG::SpeculativeJIT::compile):
3817 * ftl/FTLLowerDFGToB3.cpp:
3818 (JSC::FTL::DFG::LowerDFGToB3::compileToThis):
3819 * runtime/JSGlobalObject.h:
3820 (JSC::JSGlobalObject::create):
3821 * runtime/JSLexicalEnvironment.h:
3822 (JSC::JSLexicalEnvironment::create):
3823 * runtime/JSString.h:
3824 * runtime/JSTypeInfo.h:
3825 (JSC::TypeInfo::overridesGetOwnPropertySlot):
3826 (JSC::TypeInfo::interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero):
3827 (JSC::TypeInfo::structureIsImmortal):
3828 (JSC::TypeInfo::overridesToThis):
3829 (JSC::TypeInfo::overridesGetPropertyNames):
3830 (JSC::TypeInfo::prohibitsPropertyCaching):
3831 (JSC::TypeInfo::getOwnPropertySlotIsImpure):
3832 * runtime/StrictEvalActivation.h:
3833 (JSC::StrictEvalActivation::create):
3836 2016-04-18 Filip Pizlo <fpizlo@apple.com>
3838 Check to see how the perf bots react to megamorphic load being disabled.
3840 Rubber stamped by Chris Dumez.
3842 * runtime/Options.h:
3844 2016-04-18 Keith Miller <keith_miller@apple.com>
3846 We should support delete in the DFG
3847 https://bugs.webkit.org/show_bug.cgi?id=156607
3849 Reviewed by Benjamin Poulain.
3851 This patch adds support for the delete in the DFG as it appears that
3852 some major frameworks use the operation in particularly hot functions.
3853 As a result, even if the function rarely ever calls delete we would never
3854 tier up to the DFG. This patch also changes operationDeleteById to take a
3855 UniquedStringImpl and return a size_t.
3857 * dfg/DFGAbstractInterpreterInlines.h:
3858 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
3859 * dfg/DFGByteCodeParser.cpp:
3860 (JSC::DFG::ByteCodeParser::parseBlock):
3861 * dfg/DFGCapabilities.cpp:
3862 (JSC::DFG::capabilityLevel):
3863 * dfg/DFGClobberize.h:
3864 (JSC::DFG::clobberize):
3865 * dfg/DFGDoesGC.cpp:
3867 * dfg/DFGFixupPhase.cpp:
3868 (JSC::DFG::FixupPhase::fixupNode):
3870 (JSC::DFG::Node::hasIdentifier):
3871 * dfg/DFGNodeType.h:
3872 * dfg/DFGPredictionPropagationPhase.cpp:
3873 (JSC::DFG::PredictionPropagationPhase::propagate):
3874 * dfg/DFGSafeToExecute.h:
3875 (JSC::DFG::safeToExecute):
3876 * dfg/DFGSpeculativeJIT.cpp:
3877 (JSC::DFG::SpeculativeJIT::compileDeleteById):
3878 * dfg/DFGSpeculativeJIT.h:
3879 (JSC::DFG::SpeculativeJIT::callOperation):
3880 * dfg/DFGSpeculativeJIT32_64.cpp:
3881 (JSC::DFG::SpeculativeJIT::compile):
3882 * dfg/DFGSpeculativeJIT64.cpp:
3883 (JSC::DFG::SpeculativeJIT::compile):
3886 (JSC::JIT::callOperation):
3887 * jit/JITOperations.cpp:
3888 * jit/JITOperations.h:
3889 * jit/JITPropertyAccess.cpp:
3890 (JSC::JIT::emit_op_del_by_id):
3891 * jit/JITPropertyAccess32_64.cpp:
3892 (JSC::JIT::emit_op_del_by_id):
3894 2016-04-17 Filip Pizlo <fpizlo@apple.com>
3896 FTL should pin the tag registers at inline caches
3897 https://bugs.webkit.org/show_bug.cgi?id=156678
3899 Reviewed by Saam Barati.
3901 This is a long-overdue fix to our inline caches. Back when we had LLVM, we couldn't rely on the tags
3902 being pinned to any registers. So, if the inline caches needed tags, they'd have to materialize them.
3904 This removes those materializations. This should reduce the amount of code generated in inline caches
3905 and it should make inline caches faster. The effect appears to be small.
3907 It may be that after this change, we'll even be able to kill the
3908 HaveTagRegisters/DoNotHaveTagRegisters logic.
3910 * bytecode/PolymorphicAccess.cpp:
3911 (JSC::AccessCase::generateWithGuard):
3912 (JSC::AccessCase::generateImpl):
3913 * ftl/FTLLowerDFGToB3.cpp:
3914 (JSC::FTL::DFG::LowerDFGToB3::compilePutById):
3915 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct):
3916 (JSC::FTL::DFG::LowerDFGToB3::compileTailCall):
3917 (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
3918 (JSC::FTL::DFG::LowerDFGToB3::compileIn):
3919 (JSC::FTL::DFG::LowerDFGToB3::getById):
3921 (JSC::readCallTarget):
3922 (JSC::linkPolymorphicCall):
3923 * jit/ThunkGenerators.cpp:
3924 (JSC::virtualThunkFor):
3926 2016-04-18 Yusuke Suzuki <utatane.tea@gmail.com>