1 2016-05-05 Filip Pizlo <fpizlo@apple.com>
3 Reduce thresholds that control the maximum IC stub size.
5 Rubber stamped by Chris Dumez and Benjamin Poulain.
7 This reduces the thresholds to before the megamorphic load optimizations to see if that
8 recovers a PLT regression.
12 2016-05-05 Filip Pizlo <fpizlo@apple.com>
14 We shouldn't crash if DFG AI proved that something was unreachable on one run but then decided not to prove it on another run
15 https://bugs.webkit.org/show_bug.cgi?id=157379
19 Any run of DFG AI is a fixpoint that loosens the proof until it can't find any more
20 counterexamples to the proof. It errs on the side of loosening proofs, i.e., on the side of
23 We run this fixpoint multiple times since there are multiple points in the DFG optimization
24 pipeline when we run DFG AI. Each of those runs completes a fixpoint and produces the
25 tightest proof it can that did not result in counterexamples being found.
27 It's possible that on run K of DFG AI, we prove some property, but on run K+1, we don't prove
28 that property. The code could have changed between the two runs due to other phases. Other
29 phases may modify the code in such a way that it's less amenable to AI's analysis. Our design
30 allows this because DFG AI is not 100% precise. It defends itself from making unsound choices
31 or running forever by sometimes punting on proving some property. It must be able to do this,
32 and so therefore, it might sometimes prove fewer things on a later run.
34 Currently in trunk if the property that AI proves on run K but fails to prove on run K+1 is
35 the reachability of a piece of code, then run K+1 will crash on an assertion at the
36 Unreachable node. It will complain that it reached an Unreachable. But it might be reaching
37 that Unreachable because it failed to prove that something earlier was always exiting. That's
40 So, we should remove the assertion that AI doesn't see Unreachable.
42 No new tests because I don't know how to make this happen. I believe that this happens in the
43 wild based on crash logs.
45 * dfg/DFGAbstractInterpreterInlines.h:
46 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
48 2016-05-05 Joseph Pecoraro <pecoraro@apple.com>
50 Crash if you type "debugger" in the console and continue
51 https://bugs.webkit.org/show_bug.cgi?id=156924
52 <rdar://problem/25884189>
56 * inspector/agents/InspectorDebuggerAgent.cpp:
57 (Inspector::InspectorDebuggerAgent::evaluateOnCallFrame):
58 Bail with an error when we are not paused.
60 * inspector/agents/InspectorRuntimeAgent.cpp:
61 (Inspector::InspectorRuntimeAgent::callFunctionOn):
62 (Inspector::InspectorRuntimeAgent::getProperties):
63 (Inspector::InspectorRuntimeAgent::getDisplayableProperties):
64 (Inspector::InspectorRuntimeAgent::getCollectionEntries):
65 (Inspector::InspectorRuntimeAgent::saveResult):
66 Update poor error message.
68 2016-05-05 Keith Miller <keith_miller@apple.com>
70 Add support for delete by value to the DFG
71 https://bugs.webkit.org/show_bug.cgi?id=157372
73 Reviewed by Filip Pizlo.
75 This patch adds basic support for delete by value to the DFG. delete by value
76 just calls out to a C++ operation on each execution. Additionally, this patch
77 fixes an issue with delete by id where we would crash if the base was null
80 * dfg/DFGAbstractInterpreterInlines.h:
81 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
82 * dfg/DFGByteCodeParser.cpp:
83 (JSC::DFG::ByteCodeParser::parseBlock):
84 * dfg/DFGCapabilities.cpp:
85 (JSC::DFG::capabilityLevel):
86 * dfg/DFGClobberize.h:
87 (JSC::DFG::clobberize):
90 * dfg/DFGFixupPhase.cpp:
91 (JSC::DFG::FixupPhase::fixupNode):
93 * dfg/DFGPredictionPropagationPhase.cpp:
94 * dfg/DFGSafeToExecute.h:
95 (JSC::DFG::safeToExecute):
96 * dfg/DFGSpeculativeJIT.cpp:
97 (JSC::DFG::SpeculativeJIT::compileDeleteById):
98 (JSC::DFG::SpeculativeJIT::compileDeleteByVal):
99 * dfg/DFGSpeculativeJIT.h:
100 (JSC::DFG::SpeculativeJIT::callOperation):
101 * dfg/DFGSpeculativeJIT32_64.cpp:
102 (JSC::DFG::SpeculativeJIT::compile):
103 * dfg/DFGSpeculativeJIT64.cpp:
104 (JSC::DFG::SpeculativeJIT::compile):
106 (JSC::JIT::privateCompileMainPass):
108 * jit/JITOperations.cpp:
109 * jit/JITOperations.h:
110 * jit/JITPropertyAccess.cpp:
111 (JSC::JIT::emit_op_del_by_val):
112 * jit/JITPropertyAccess32_64.cpp:
113 (JSC::JIT::emit_op_del_by_val):
114 * tests/stress/delete-by-val.js: Added.
117 * tests/stress/delete-to-object-exception.js: Added.
121 2016-05-05 Michael Saboff <msaboff@apple.com>
123 Unreviewed build fix after change set r200447.
125 Made the detection of clang version XCode build specific.
126 Now shouldEnableDebugAnnotations() should return false for all other build types.
128 * offlineasm/config.rb:
130 2016-05-05 Joseph Pecoraro <pecoraro@apple.com>
132 Create console object lazily
133 https://bugs.webkit.org/show_bug.cgi?id=157328
135 Reviewed by Geoffrey Garen.
137 * runtime/CommonIdentifiers.h:
138 * runtime/JSGlobalObject.cpp:
139 (JSC::createConsoleProperty):
140 (JSC::JSGlobalObject::init): Deleted.
142 2016-05-04 Michael Saboff <msaboff@apple.com>
144 Enable Dwarf2 debug information in offline assembler for clang compiler
145 https://bugs.webkit.org/show_bug.cgi?id=157364.
147 Reviewed by Mark Lam.
149 Added a new function shouldEnableDebugAnnotations() that determines if
150 we are using clang and a new enough version to support the debug annotations.
152 * offlineasm/config.rb:
153 (shouldEnableDebugAnnotations): Added.
155 2016-05-04 Keith Miller <keith_miller@apple.com>
157 Unreviewed, fix test for new ArrayIteratorPrototype.next() error message.
159 * tests/stress/array-iterators-next-with-call.js:
161 2016-05-04 Filip Pizlo <fpizlo@apple.com>
163 Speed up JSGlobalObject initialization by making some properties lazy
164 https://bugs.webkit.org/show_bug.cgi?id=157045
166 Reviewed by Keith Miller.
168 This makes about half of JSGlobalObject's state lazy. There are three categories of
169 state in JSGlobalObject:
171 1) C++ fields in JSGlobalObject.
172 2) JS object properties in JSGlobalObject's JSObject superclass.
173 3) JS variables in JSGlobalObject's JSSegmentedVariableObject superclass.
175 State held in JS variables cannot yet be made lazy. That's why this patch only goes
178 State in JS object properties can be made lazy if we move it to the static property
179 hashtable. JSGlobalObject already had one of those. This patch makes static property
180 hashtables a lot more powerful, by adding three new kinds of static properties. These
181 new kinds allow us to make almost all of JSGlobalObject's object properties lazy.
183 State in C++ fields can now be made lazy thanks in part to WTF's support for stateless
184 lambdas. You can of course make anything lazy by hand, but there are many C++ fields in
185 JSGlobalObject and we are adding more all the time. We don't want to require that each
186 of these has a getter with an initialization check and a corresponding out-of-line slow
187 path that does the initialization. We want this kind of boilerplate to be handled by
190 The primary abstraction introduced in this patch is LazyProperty<Type>. Currently, this
191 only works where Type is a subclass of JSCell. Such a property holds a pointer to Type.
192 You can use it like you would a WriteBarrier<Type>. It even has set() and get() methods,
193 so it's almost a drop-in replacement.
195 The key to LazyProperty<Type>'s power is that you can do this:
199 LazyProperty<Foo> m_foo;
203 [] (const LazyProperty<Foo>::Initializer<Bar>& init) {
204 init.set(Foo::create(init.vm, init.owner));
207 This initLater() call requires that you pass a stateless lambda (see WTF changelog for
208 the definition). Miraculously, this initLater() call is guaranteed to compile to a store
209 of a pointer constant to m_foo, as in:
214 This magical pointer constant points to a callback that was generated by the template
215 instantiation of initLater(). That callback knows to call your stateless lambda, but
216 also does some other bookkeeping: it makes sure that you indeed initialized the property
217 inside the callback and it manages recursive initializations. It's totally legal to call
218 m_foo.get() inside the initLater() callback. If you do that before you call init.set(),
219 m_foo.get() will return null. This is an excellent escape hatch if we ever find
220 ourselves in a dependency cycle. I added this feature because I already had to create a
223 Note that using LazyProperties from DFG threads is super awkward. It's going to be hard
224 to get this right. The DFG thread cannot initialize those fields, so it has to make sure
225 that it does conservative things. But for some nodes this could mean adding a lot of new
226 logic, like NewTypedArray, which currently is written in such a way that it assumes that
227 we always have the typed array structure. Currently we take a two-fold approach: for
228 typed arrays we don't handle the NewTypedArray intrinsic if the structure isn't
229 initialized, and for everything else we don't make the properties lazy if the DFG needs
230 them. As we optimize this further we might need to teach the DFG to handle more lazy
231 properties. I tried to do this for RegExp but found it to be very confusing. With typed
234 There is also a somewhat more powerful construct called LazyClassStructure. We often
235 need to keep around the structure of some standard JS class, like Date. We also need to
236 make sure that the constructor ends up in the global object's property table. And we
237 often need to keep the original value of the constructor for ourselves. In this case, we
238 want to make sure that the creation of the structure-prototype-constructor constellation
239 is atomic. We don't want code to start looking at the structure if it points to a
240 prototype that doesn't have its "constructor" property set yet, for example.
241 LazyClassStructure solves this by abstracting that whole initialization. You provide the
242 callback that allocates everything, since we are super inconsistent about the way we
243 initialize things, but LazyClassStructure establishes the workflow and helps you not
246 Finally, the new static hashtable attributes allow for all of this to work with the JS
249 PropertyCallback: if you use this attribute, the second column in the table should be
250 the name of a function to call to initialize this property. This is useful for things
251 like the Math property. The Math object turns out to be very expensive to allocate.
252 Delaying its allocation is super easy with the PropertyCallback attribute.
254 CellProperty: with this attribute the second column should be a C++ field name like
255 JSGlobalObject::m_evalErrorConstructor. The static hashtable will grab the offset of
256 this property, and when it needs to be initialized, Lookup will assume you have a
257 LazyProperty<JSCell> and call its get() method. It will initialize the property to
258 whatever get() returned. Note that it's legal to cast a LazyProperty<Anything> to
259 LazyProperty<JSCell> for the purpose of calling get() because the get() method will just
260 call whatever callback function pointer is encoded in the property and it does not need
261 to know anything about what type that callback will instantiate.
263 ClassStructure: with this attribute the second column should be a C++ field name. The
264 static hashtable will initialize the property by treating the field as a
265 LazyClassStructure and it will call get(). LazyClassStructure completely owns the whole
266 initialization workflow, so Lookup assumes that when LazyClassStructure::get() returns,
267 the property in question will already be set. By convention, we have LazyClassStructure
268 initialize the property with a pointer to the constructor, since that's how all of our
269 classes work: "globalObject.Date" points to the DateConstructor.
271 This is a 2x speed-up in JSGlobalObject initialization time in a microbenchmark that
272 calls our C API. This is a 1% speed-up on SunSpider and JSRegress.
274 Rolling this back in after fixing the function pointer alignment issue. The last version
275 relied on function pointers being aligned to a 4-byte boundary. We cannot rely on this,
276 especially since ARMv7 uses the low bit of function pointers as a tag to indicate the
277 instruction set. This version adds an extra indirection, so that
278 LazyProperty<>::m_pointer points to a pointer that points to the function. A pointer to
279 a pointer is guaranteed to be at least 4-byte aligned.
281 * API/JSCallbackFunction.cpp:
282 (JSC::JSCallbackFunction::create):
283 * API/ObjCCallbackFunction.h:
284 (JSC::ObjCCallbackFunction::impl):
285 * API/ObjCCallbackFunction.mm:
286 (JSC::ObjCCallbackFunction::ObjCCallbackFunction):
287 (JSC::ObjCCallbackFunction::create):
289 * JavaScriptCore.xcodeproj/project.pbxproj:
291 * debugger/DebuggerScope.cpp:
292 (JSC::DebuggerScope::create):
293 (JSC::DebuggerScope::DebuggerScope):
294 * debugger/DebuggerScope.h:
295 (JSC::DebuggerScope::jsScope):
296 (JSC::DebuggerScope::create): Deleted.
297 * dfg/DFGAbstractInterpreterInlines.h:
298 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
299 * dfg/DFGAbstractValue.cpp:
300 (JSC::DFG::AbstractValue::set):
301 * dfg/DFGArrayMode.cpp:
302 (JSC::DFG::ArrayMode::originalArrayStructure):
303 * dfg/DFGByteCodeParser.cpp:
304 (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor):
305 * dfg/DFGSpeculativeJIT.cpp:
306 (JSC::DFG::SpeculativeJIT::compileNewTypedArray):
307 * dfg/DFGSpeculativeJIT32_64.cpp:
308 (JSC::DFG::SpeculativeJIT::compile):
309 * dfg/DFGSpeculativeJIT64.cpp:
310 (JSC::DFG::SpeculativeJIT::compile):
311 * dfg/DFGStructureRegistrationPhase.cpp:
312 (JSC::DFG::StructureRegistrationPhase::run):
313 * ftl/FTLLowerDFGToB3.cpp:
314 (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
315 * runtime/ClonedArguments.cpp:
316 (JSC::ClonedArguments::getOwnPropertySlot):
317 (JSC::ClonedArguments::materializeSpecials):
318 * runtime/CommonSlowPaths.cpp:
319 (JSC::SLOW_PATH_DECL):
320 * runtime/FunctionPrototype.cpp:
321 (JSC::functionProtoFuncToString):
322 * runtime/InternalFunction.cpp:
323 (JSC::InternalFunction::visitChildren):
324 (JSC::InternalFunction::name):
325 (JSC::InternalFunction::calculatedDisplayName):
326 (JSC::InternalFunction::createSubclassStructure):
327 * runtime/InternalFunction.h:
328 * runtime/JSBoundFunction.cpp:
329 (JSC::JSBoundFunction::finishCreation):
330 (JSC::JSBoundFunction::visitChildren):
331 * runtime/JSBoundSlotBaseFunction.cpp:
332 (JSC::JSBoundSlotBaseFunction::create):
333 * runtime/JSFunction.cpp:
334 (JSC::retrieveCallerFunction):
335 (JSC::getThrowTypeErrorGetterSetter):
336 (JSC::JSFunction::callerGetter):
337 (JSC::JSFunction::getOwnPropertySlot):
338 (JSC::JSFunction::defineOwnProperty):
339 * runtime/JSGenericTypedArrayViewConstructorInlines.h:
340 (JSC::constructGenericTypedArrayView):
341 * runtime/JSGlobalObject.cpp:
342 (JSC::createProxyProperty):
343 (JSC::createJSONProperty):
344 (JSC::createMathProperty):
345 (JSC::JSGlobalObject::init):
346 (JSC::JSGlobalObject::stringPrototypeChainIsSane):
347 (JSC::JSGlobalObject::resetPrototype):
348 (JSC::JSGlobalObject::visitChildren):
349 (JSC::JSGlobalObject::toThis):
350 (JSC::JSGlobalObject::getOwnPropertySlot):
351 (JSC::JSGlobalObject::createThrowTypeError): Deleted.
352 (JSC::JSGlobalObject::createThrowTypeErrorArgumentsAndCaller): Deleted.
353 * runtime/JSGlobalObject.h:
354 (JSC::JSGlobalObject::objectConstructor):
355 (JSC::JSGlobalObject::promiseConstructor):
356 (JSC::JSGlobalObject::internalPromiseConstructor):
357 (JSC::JSGlobalObject::evalErrorConstructor):
358 (JSC::JSGlobalObject::rangeErrorConstructor):
359 (JSC::JSGlobalObject::referenceErrorConstructor):
360 (JSC::JSGlobalObject::syntaxErrorConstructor):
361 (JSC::JSGlobalObject::typeErrorConstructor):
362 (JSC::JSGlobalObject::URIErrorConstructor):
363 (JSC::JSGlobalObject::nullGetterFunction):
364 (JSC::JSGlobalObject::nullSetterFunction):
365 (JSC::JSGlobalObject::callFunction):
366 (JSC::JSGlobalObject::applyFunction):
367 (JSC::JSGlobalObject::definePropertyFunction):
368 (JSC::JSGlobalObject::arrayProtoValuesFunction):
369 (JSC::JSGlobalObject::initializePromiseFunction):
370 (JSC::JSGlobalObject::newPromiseCapabilityFunction):
371 (JSC::JSGlobalObject::functionProtoHasInstanceSymbolFunction):
372 (JSC::JSGlobalObject::regExpProtoExecFunction):
373 (JSC::JSGlobalObject::regExpProtoSymbolReplaceFunction):
374 (JSC::JSGlobalObject::regExpProtoGlobalGetter):
375 (JSC::JSGlobalObject::regExpProtoUnicodeGetter):
376 (JSC::JSGlobalObject::throwTypeErrorGetterSetter):
377 (JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerGetterSetter):
378 (JSC::JSGlobalObject::moduleLoader):
379 (JSC::JSGlobalObject::objectPrototype):
380 (JSC::JSGlobalObject::functionPrototype):
381 (JSC::JSGlobalObject::arrayPrototype):
382 (JSC::JSGlobalObject::booleanPrototype):
383 (JSC::JSGlobalObject::stringPrototype):
384 (JSC::JSGlobalObject::symbolPrototype):
385 (JSC::JSGlobalObject::numberPrototype):
386 (JSC::JSGlobalObject::datePrototype):
387 (JSC::JSGlobalObject::regExpPrototype):
388 (JSC::JSGlobalObject::errorPrototype):
389 (JSC::JSGlobalObject::iteratorPrototype):
390 (JSC::JSGlobalObject::generatorFunctionPrototype):
391 (JSC::JSGlobalObject::generatorPrototype):
392 (JSC::JSGlobalObject::debuggerScopeStructure):
393 (JSC::JSGlobalObject::withScopeStructure):
394 (JSC::JSGlobalObject::strictEvalActivationStructure):
395 (JSC::JSGlobalObject::activationStructure):
396 (JSC::JSGlobalObject::moduleEnvironmentStructure):
397 (JSC::JSGlobalObject::directArgumentsStructure):
398 (JSC::JSGlobalObject::scopedArgumentsStructure):
399 (JSC::JSGlobalObject::clonedArgumentsStructure):
400 (JSC::JSGlobalObject::isOriginalArrayStructure):
401 (JSC::JSGlobalObject::booleanObjectStructure):
402 (JSC::JSGlobalObject::callbackConstructorStructure):
403 (JSC::JSGlobalObject::callbackFunctionStructure):
404 (JSC::JSGlobalObject::callbackObjectStructure):
405 (JSC::JSGlobalObject::propertyNameIteratorStructure):
406 (JSC::JSGlobalObject::objcCallbackFunctionStructure):
407 (JSC::JSGlobalObject::objcWrapperObjectStructure):
408 (JSC::JSGlobalObject::dateStructure):
409 (JSC::JSGlobalObject::nullPrototypeObjectStructure):
410 (JSC::JSGlobalObject::errorStructure):
411 (JSC::JSGlobalObject::calleeStructure):
412 (JSC::JSGlobalObject::functionStructure):
413 (JSC::JSGlobalObject::boundFunctionStructure):
414 (JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
415 (JSC::JSGlobalObject::getterSetterStructure):
416 (JSC::JSGlobalObject::nativeStdFunctionStructure):
417 (JSC::JSGlobalObject::namedFunctionStructure):
418 (JSC::JSGlobalObject::functionNameOffset):
419 (JSC::JSGlobalObject::numberObjectStructure):
420 (JSC::JSGlobalObject::privateNameStructure):
421 (JSC::JSGlobalObject::mapStructure):
422 (JSC::JSGlobalObject::regExpStructure):
423 (JSC::JSGlobalObject::generatorFunctionStructure):
424 (JSC::JSGlobalObject::setStructure):
425 (JSC::JSGlobalObject::stringObjectStructure):
426 (JSC::JSGlobalObject::symbolObjectStructure):
427 (JSC::JSGlobalObject::iteratorResultObjectStructure):
428 (JSC::JSGlobalObject::lazyTypedArrayStructure):
429 (JSC::JSGlobalObject::typedArrayStructure):
430 (JSC::JSGlobalObject::typedArrayStructureConcurrently):
431 (JSC::JSGlobalObject::isOriginalTypedArrayStructure):
432 (JSC::JSGlobalObject::typedArrayConstructor):
433 (JSC::JSGlobalObject::actualPointerFor):
434 (JSC::JSGlobalObject::internalFunctionStructure): Deleted.
435 * runtime/JSNativeStdFunction.cpp:
436 (JSC::JSNativeStdFunction::create):
437 * runtime/JSWithScope.cpp:
438 (JSC::JSWithScope::create):
439 (JSC::JSWithScope::visitChildren):
440 (JSC::JSWithScope::createStructure):
441 (JSC::JSWithScope::JSWithScope):
442 * runtime/JSWithScope.h:
443 (JSC::JSWithScope::object):
444 (JSC::JSWithScope::create): Deleted.
445 (JSC::JSWithScope::createStructure): Deleted.
446 (JSC::JSWithScope::JSWithScope): Deleted.
447 * runtime/LazyClassStructure.cpp: Added.
448 (JSC::LazyClassStructure::Initializer::Initializer):
449 (JSC::LazyClassStructure::Initializer::setPrototype):
450 (JSC::LazyClassStructure::Initializer::setStructure):
451 (JSC::LazyClassStructure::Initializer::setConstructor):
452 (JSC::LazyClassStructure::visit):
453 (JSC::LazyClassStructure::dump):
454 * runtime/LazyClassStructure.h: Added.
455 (JSC::LazyClassStructure::LazyClassStructure):
456 (JSC::LazyClassStructure::get):
457 (JSC::LazyClassStructure::prototype):
458 (JSC::LazyClassStructure::constructor):
459 (JSC::LazyClassStructure::getConcurrently):
460 (JSC::LazyClassStructure::prototypeConcurrently):
461 (JSC::LazyClassStructure::constructorConcurrently):
462 * runtime/LazyClassStructureInlines.h: Added.
463 (JSC::LazyClassStructure::initLater):
464 * runtime/LazyProperty.h: Added.
465 (JSC::LazyProperty::Initializer::Initializer):
466 (JSC::LazyProperty::LazyProperty):
467 (JSC::LazyProperty::get):
468 (JSC::LazyProperty::getConcurrently):
469 * runtime/LazyPropertyInlines.h: Added.
470 (JSC::ElementType>::Initializer::set):
471 (JSC::ElementType>::initLater):
472 (JSC::ElementType>::setMayBeNull):
473 (JSC::ElementType>::set):
474 (JSC::ElementType>::visit):
475 (JSC::ElementType>::dump):
476 (JSC::ElementType>::callFunc):
477 * runtime/Lookup.cpp:
478 (JSC::setUpStaticFunctionSlot):
480 (JSC::HashTableValue::function):
481 (JSC::HashTableValue::functionLength):
482 (JSC::HashTableValue::propertyGetter):
483 (JSC::HashTableValue::propertyPutter):
484 (JSC::HashTableValue::accessorGetter):
485 (JSC::HashTableValue::accessorSetter):
486 (JSC::HashTableValue::constantInteger):
487 (JSC::HashTableValue::lexerValue):
488 (JSC::HashTableValue::lazyCellPropertyOffset):
489 (JSC::HashTableValue::lazyClassStructureOffset):
490 (JSC::HashTableValue::lazyPropertyCallback):
491 (JSC::getStaticPropertySlot):
492 (JSC::getStaticValueSlot):
494 (JSC::reifyStaticProperty):
495 * runtime/PropertySlot.h:
496 * runtime/TypedArrayType.h:
498 2016-05-04 Joseph Pecoraro <pecoraro@apple.com>
500 Improve the grammar of some error messages 'a argument list' => 'an argument list'
501 https://bugs.webkit.org/show_bug.cgi?id=157350
502 <rdar://problem/26082108>
504 Reviewed by Mark Lam.
507 (JSC::Parser<LexerType>::parseIfStatement):
508 (JSC::Parser<LexerType>::parseImportDeclaration):
509 (JSC::Parser<LexerType>::parseExportDeclaration):
510 (JSC::Parser<LexerType>::parseObjectLiteral):
511 (JSC::Parser<LexerType>::parseStrictObjectLiteral):
512 (JSC::Parser<LexerType>::parseArguments):
513 Use the alternate error message formatter macro which outputs 'an'
514 instead of 'a' preceding the last argument.
516 2016-05-04 Keith Miller <keith_miller@apple.com>
518 Corrections to r200422
519 https://bugs.webkit.org/show_bug.cgi?id=157351
521 Reviewed by Joseph Pecoraro.
523 Fix some typos in various files. Also, make separate error messages
524 for the this value being undefined vs null in the ArrayIteratorprototype
525 next function and add test.
527 * Scripts/builtins/builtins_model.py:
528 * builtins/ArrayIteratorPrototype.js:
530 (arrayIteratorValueNext):
531 (arrayIteratorKeyNext):
532 (arrayIteratorKeyValueNext):
533 * builtins/ArrayPrototype.js:
536 * builtins/TypedArrayPrototype.js:
537 * runtime/JSGlobalObject.cpp:
538 (JSC::JSGlobalObject::init): Deleted.
539 * tests/stress/array-iterators-next-error-messages.js: Added.
543 2016-05-04 Keith Miller <keith_miller@apple.com>
545 Unreviewed, reland r200149 since the rollout had inconclusive PLT AB testing results.
547 2016-05-04 Mark Lam <mark.lam@apple.com>
549 ES6 Function.name inferred from property names of literal objects can break some websites.
550 https://bugs.webkit.org/show_bug.cgi?id=157246
552 Reviewed by Geoffrey Garen.
554 Specifically, the library mathjs (see http://mathjs.org and https://github.com/josdejong/mathjs)
555 uses an idiom where it created literal objects with property names that look like
556 this: 'number | BigNumber | Unit'. Later, this name is used in a string to create
557 function source code that gets eval'ed. Since 'number | BigNumber | Unit' is not
558 a valid function name, we get a syntax error.
560 Here are the details:
562 1. mathjs uses object literals with the funky property names for its function members.
565 // helper function to type check the middle value of the array
567 'number | BigNumber | Unit': function (value) {
572 2. mathjs' getName() uses Function.name to get the name of functions (hence, picks
573 up the property name as inferred value of Function.name as specified by ES6):
576 * Retrieve the function name from a set of functions, and check
577 * whether the name of all functions match (if given)
580 function getName (fns) {
583 for (var i = 0; i < fns.length; i++) {
591 3. mathjs uses that name to assembler new function source code that gets eval'ed:
594 * Compose a function from sub-functions each handling a single type signature.
597 function _typed(name, signatures) {
599 // generate code for the typed function
601 var _name = name || '';
603 code.push('function ' + _name + '(' + _args.join(', ') + ') {');
604 code.push(' "use strict";');
605 code.push(' var name = \'' + _name + '\';');
606 code.push(node.toCode(refs, ' '));
609 // generate body for the factory function
612 'return ' + code.join('\n')
615 // evaluate the JavaScript code and attach function references
616 var factory = (new Function(refs.name, 'createError', body)); // <== Syntax Error here!
617 var fn = factory(refs, createError);
622 Until mathjs (and any other frameworks that does similar things) and sites that
623 uses mathjs has been updated to work with ES6, we'll need a compatibility hack to
626 Here's what we'll do:
627 1. Introduce a needsSiteSpecificQuirks flag in JSGlobalObject.
628 2. Have WebCore's JSDOMWindowBase set that flag if the browser's
629 needsSiteSpecificQuirks is enabled in its settings.
630 3. If needsSiteSpecificQuirks is enabled, have JSFunction::reifyName() check for
631 ' ' or '|' in the name string it will use to reify the Function.name property.
632 If those characters exists in the name, we'll replace the name string with a
635 * runtime/JSFunction.cpp:
636 (JSC::JSFunction::reifyName):
637 * runtime/JSGlobalObject.h:
638 (JSC::JSGlobalObject::needsSiteSpecificQuirks):
639 (JSC::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
640 (JSC::JSGlobalObject::setNeedsSiteSpecificQuirks):
642 2016-05-04 Keith Miller <keith_miller@apple.com>
644 Speedup array iterators
645 https://bugs.webkit.org/show_bug.cgi?id=157315
647 Reviewed by Michael Saboff.
649 This patch improves the performance of Array iterators in ES6. There are two main changes
650 that make things faster. The first is that the value, keys and entries functions have been
651 moved to JS. This enables us to inline the construction of the iterator. Thus, when we get
652 to the FTL we are able to sink the allocation of the iterator object. This significantly
653 improves the performance of any for-of loop since we are now able to have both the iteration
654 counter and the iterated object in local variables rather than in the heap.
656 Secondly, instead of using a number to store the iteratation kind we now use a virtual
657 method on the iteration object to indicate which next function to use. This ends up being
658 helpful because it means we can eliminate the branches in the old next function that decide
659 what value to return. With those branches gone the various next functions are now small
660 enough to inline. Once the next functions are inlined then the FTL is able to sink the
661 allocation of next() result object. There is still room for optimization in the loop since
662 we currently don't recognize that the array access in the next function is in bounds or that
663 the increment to the loop counter cannot overflow.
665 The overall performance changes appear to be a ~4-6x speedup in a simple microbenchmark that
666 computes the sum of an array with some extra arithmetic. The variance depends on the exact
667 body of the loop. Additionally, on a new regress test that changes all the loops in
668 deltablue into for-of loops this patch is a 1.8x progression. Overall, it still looks like
669 for-of loops are significantly slower than an indexed for loop. In the first test it's ~2-4x
670 slower with the difference depending on the body of the loop. If the loop is just the sum
671 then we see a much larger regression than if the loop does even simple arithmetic. It looks
672 like the indexed for loop without extra arithmetic is small enough to fit into the x86
673 replay buffer on my machine, which would explain why there is such a big difference between
674 the for of loop in that case. On the deltablue benchmark it's 1.4x slower. It's clear from
675 these numbers that there is still a lot of work we can do to make for of loops faster.
677 This patch also makes some changes to the way that we decorate our builtin js
678 functions. Instead of the old syntax (putting the decorated values in [] before the function
679 declaration i.e. [intrinsic=foo]) this patch changes the syntax to be closer to the way that
680 decorators are proposed in a future ECMAScript proposal (using @ followed by the entry on a
681 new line before the function declaration i.e. @intrinsic=foo).
683 Finally, in the builtin scripts regular expressions re.S has been changed to re.DOTALL since
684 DOTALL is easier to understand without going to the reference page for python regular
687 * Scripts/builtins/builtins_model.py:
688 * builtins/ArrayIteratorPrototype.js:
690 (arrayIteratorValueNext):
691 (arrayIteratorKeyNext):
692 (arrayIteratorKeyValueNext):
693 * builtins/ArrayPrototype.js:
694 (createArrayIterator):
698 * builtins/RegExpPrototype.js:
699 (intrinsic.RegExpTestIntrinsic.test):
700 * builtins/StringPrototype.js:
701 (intrinsic.StringPrototypeReplaceIntrinsic.replace):
702 * builtins/TypedArrayPrototype.js:
706 * inspector/JSInjectedScriptHost.cpp:
707 (Inspector::cloneArrayIteratorObject):
708 (Inspector::JSInjectedScriptHost::iteratorEntries):
709 * jit/ThunkGenerators.cpp:
710 * runtime/ArrayPrototype.cpp:
711 (JSC::ArrayPrototype::finishCreation):
712 (JSC::arrayProtoFuncValues): Deleted.
713 (JSC::arrayProtoFuncEntries): Deleted.
714 (JSC::arrayProtoFuncKeys): Deleted.
715 * runtime/CommonIdentifiers.h:
716 * runtime/JSArrayIterator.cpp:
717 (JSC::JSArrayIterator::clone): Deleted.
718 * runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
719 (JSC::genericTypedArrayViewProtoFuncEntries): Deleted.
720 (JSC::genericTypedArrayViewProtoFuncKeys): Deleted.
721 (JSC::typedArrayViewProtoFuncValues): Deleted.
722 * runtime/JSGlobalObject.cpp:
723 (JSC::JSGlobalObject::init):
724 * runtime/JSGlobalObject.h:
725 * runtime/JSTypedArrayViewPrototype.cpp:
726 (JSC::JSTypedArrayViewPrototype::finishCreation):
727 (JSC::typedArrayViewProtoFuncEntries): Deleted.
728 (JSC::typedArrayViewProtoFuncKeys): Deleted.
729 (JSC::typedArrayViewProtoFuncValues): Deleted.
730 * runtime/MapPrototype.cpp:
731 (JSC::MapPrototype::finishCreation):
732 * runtime/SetPrototype.cpp:
733 (JSC::SetPrototype::finishCreation):
735 2016-05-04 Yusuke Suzuki <utatane.tea@gmail.com>
737 [JSC] Object constructor need to be aware of new.target
738 https://bugs.webkit.org/show_bug.cgi?id=157196
740 Reviewed by Darin Adler.
742 Object constructor should be aware of new.target.
743 When the new.target is specified, we should store it.prototype to the newly created
744 object's [[Prototype]].
746 * runtime/JSGlobalObject.cpp:
747 (JSC::JSGlobalObject::init):
748 (JSC::JSGlobalObject::visitChildren):
749 Take the design that caches the structure used for empty object.
750 This structure is also used in constructEmptyObject frequently.
752 * runtime/JSGlobalObject.h:
753 (JSC::JSGlobalObject::objectStructureForObjectConstructor):
754 * runtime/ObjectConstructor.cpp:
755 (JSC::constructObject):
756 (JSC::constructWithObjectConstructor):
757 (JSC::callObjectConstructor):
758 * runtime/ObjectConstructor.h:
759 (JSC::constructEmptyObject):
760 Construct the object by using the plain structure that is also used in the ObjectConstructor.
762 * tests/stress/object-constructor-should-be-new-target-aware.js: Added.
766 2016-05-04 Chris Dumez <cdumez@apple.com>
768 Unreviewed, rolling out r200383 and r200406.
770 Seems to have caused crashes on iOS / ARMv7s
774 "Speed up JSGlobalObject initialization by making some
776 https://bugs.webkit.org/show_bug.cgi?id=157045
777 http://trac.webkit.org/changeset/200383
779 "REGRESSION(r200383): Setting lazily initialized properties
780 across frame boundaries crashes"
781 https://bugs.webkit.org/show_bug.cgi?id=157333
782 http://trac.webkit.org/changeset/200406
784 2016-05-04 Yusuke Suzuki <utatane.tea@gmail.com>
786 Assertion failure for super() call in direct eval in method function
787 https://bugs.webkit.org/show_bug.cgi?id=157091
789 Reviewed by Darin Adler.
791 While we ensure that direct super is under the correct context,
792 we don't check it for the eval code. This patch moves the check from the end of parsing the function
793 to the places where we found the direct super or the super bindings. This covers the direct eval that
794 contains the direct super calls.
797 (JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
798 (JSC::Parser<LexerType>::parseFunctionInfo):
799 (JSC::Parser<LexerType>::parseMemberExpression):
801 (JSC::Scope::hasDirectSuper):
802 (JSC::Scope::setHasDirectSuper):
803 (JSC::Scope::needsSuperBinding):
804 (JSC::Scope::setNeedsSuperBinding):
805 (JSC::Parser::closestParentOrdinaryFunctionNonLexicalScope):
806 * tests/stress/eval-and-super.js: Added.
811 * tests/stress/generator-and-super.js: Added.
813 (testSyntaxError.Base.prototype.hello):
814 (testSyntaxError.Base.prototype.ok):
815 (testSyntaxError.Base):
816 (Hello.prototype.gen):
818 (testSyntaxError.hello):
820 2016-05-03 Filip Pizlo <fpizlo@apple.com>
822 REGRESSION(r200383): Setting lazily initialized properties across frame boundaries crashes
823 https://bugs.webkit.org/show_bug.cgi?id=157333
825 Reviewed by Benjamin Poulain.
827 I forgot to add logic for lazy properties in putEntry(). It turns out that it's easy to
832 * runtime/PropertySlot.h:
834 2016-05-03 Filip Pizlo <fpizlo@apple.com>
836 References from code to Structures should be stronger than weak
837 https://bugs.webkit.org/show_bug.cgi?id=157324
839 Reviewed by Mark Lam.
841 If code refers to a Structure and the Structure dies, then previously we'd kill the code.
842 This makes sense because the Structure could be the only thing left referring to some global
845 But this also causes unnecessary churn. Sometimes there will be a structure that we just
846 haven't really done anything with recently and so it appears dead. The approach we use
847 elsewhere in our type inference is that the type that the code uses is general enough to
848 handle every past execution. Having the GC clear code when some Structure it uses dies means
849 that we forget that the code used that Structure. We'll either assume that the code is more
850 monomorphic than it really is (because after GC we patch in some other structure but not the
851 deleted one, so it looks like we only ever saw the new structure), or we'll assume that it's
852 crazier than it really is (because we'll remember that there had been some structure that
853 caused deletion, so we'll assume that deletions might happen in the future, so we'll use a
856 This change introduces a more nuanced policy: if it's cheap to mark a dead Structure then we
857 should mark it just so that all of the code that refers to it remembers that there had been
858 this exact Structure in the past. If the code often goes through different Structures then
859 we already have great mechanisms to realize that the code is nutty (namely, the
860 PolymorphicAccess size limit). But if the code just does this a handful of times then
861 remembering this old Structure is probably net good:
863 - It obeys the "handle all past executions" law.
864 - It preserves the history of the property access, allowing a precise measure of its past
866 - It makes the code ready to run fast if the user decides to use that Structure again.
867 Marking the Structure means it will stay in whatever property transition tables it was in,
868 so if the program does the same thing it did in the past, it will get this old Structure.
870 It looks like this is a progression in gbemu and it makes gbemu perform more
871 deterministically. Also, it seems that this makes JetStream run faster.
873 Over five in-browser runs of JetStream, here's what we see before and after:
877 229.23 +- 8.2523 230.70 +- 12.888
878 232.91 +- 15.638 239.04 +- 13.766
879 234.79 +- 12.760 236.32 +- 15.562
880 236.20 +- 23.125 242.02 +- 3.3865
881 237.22 +- 2.1929 237.23 +- 17.664
885 541.0 +- 135.8 481.7 +- 143.4
886 518.9 +- 15.65 508.1 +- 136.3
887 362.5 +- 0.8884 489.7 +- 101.4
888 470.7 +- 313.3 530.7 +- 11.49
889 418.7 +- 180.6 537.2 +- 6.514
891 Notice that there is plenty of noise before and after, but the noise is now far less severe.
892 After this change I did not see any runs like "470.7 +- 313.3" where the size of the
893 confidence interval (313.3 * 2) is greater than the score (470.7). Also, notice that the
894 least noisy run before the change also got a lower score than we ever observed after the
895 change (36.5 +- 0.8884). The noise, and these occasional very low scores, are due to a
896 pathology where the GC would reset some stubs at an unfortunate time during profiling,
897 causing the optimizing compiler to make many poor decisions. That pathology doesn't exist
900 On the other hand, prior to this change it was possible for gbemu to sometimes run sooooper
901 fast because the GC would cause the profiler to forget gbemu's behavior on the first tick
902 and focus only on its behavior in subsequent ticks. So, in steady state, we'd optimize gbemu
903 for its later behavior rather than a combination of its early behavior and later behavior.
904 We rarely got lucky this way, so it's not fair to view this quirk as a feature.
906 * bytecode/CodeBlock.cpp:
907 (JSC::CodeBlock::propagateTransitions):
908 * bytecode/PolymorphicAccess.cpp:
909 (JSC::AccessCase::visitWeak):
910 (JSC::AccessCase::propagateTransitions):
911 (JSC::AccessCase::generateWithGuard):
912 (JSC::PolymorphicAccess::visitWeak):
913 (JSC::PolymorphicAccess::propagateTransitions):
914 (JSC::PolymorphicAccess::dump):
915 * bytecode/PolymorphicAccess.h:
916 * bytecode/StructureStubInfo.cpp:
917 (JSC::StructureStubInfo::visitWeakReferences):
918 (JSC::StructureStubInfo::propagateTransitions):
919 (JSC::StructureStubInfo::containsPC):
920 * bytecode/StructureStubInfo.h:
921 (JSC::StructureStubInfo::considerCaching):
922 * runtime/Structure.cpp:
923 (JSC::Structure::visitChildren):
924 (JSC::Structure::isCheapDuringGC):
925 (JSC::Structure::markIfCheap):
926 (JSC::Structure::prototypeChainMayInterceptStoreTo):
927 * runtime/Structure.h:
929 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
931 Web Inspector: Simplify console.clear
932 https://bugs.webkit.org/show_bug.cgi?id=157316
934 Reviewed by Timothy Hatcher.
936 * inspector/ScriptArguments.cpp:
937 (Inspector::ScriptArguments::createEmpty):
938 (Inspector::ScriptArguments::ScriptArguments):
939 * inspector/ScriptArguments.h:
940 Provide a way to create an empty list.
942 * runtime/ConsoleClient.cpp:
943 (JSC::ConsoleClient::clear):
944 * runtime/ConsoleClient.h:
945 Drop unnecessary parameter.
947 * runtime/ConsoleObject.cpp:
948 (JSC::consoleProtoFuncClear):
949 No need to parse arguments.
951 2016-05-03 Yusuke Suzuki <utatane.tea@gmail.com>
953 Improve Symbol() to string coercion error message
954 https://bugs.webkit.org/show_bug.cgi?id=157317
956 Reviewed by Geoffrey Garen.
958 Improve error messages related to Symbols.
960 * runtime/JSCJSValue.cpp:
961 (JSC::JSValue::toStringSlowCase):
962 * runtime/Symbol.cpp:
963 (JSC::Symbol::toNumber):
964 * runtime/SymbolConstructor.cpp:
965 (JSC::symbolConstructorKeyFor):
966 * runtime/SymbolPrototype.cpp:
967 (JSC::symbolProtoFuncToString):
968 (JSC::symbolProtoFuncValueOf):
969 * tests/stress/dfg-to-primitive-pass-symbol.js:
970 * tests/stress/floating-point-div-to-mul.js:
972 * tests/stress/string-from-code-point.js:
974 (string_appeared_here.shouldThrow):
975 * tests/stress/symbol-error-messages.js: Added.
977 * tests/stress/symbol-registry.js:
979 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
981 Web Inspector: Give console.time/timeEnd a default label and warnings
982 https://bugs.webkit.org/show_bug.cgi?id=157325
983 <rdar://problem/26073290>
985 Reviewed by Timothy Hatcher.
987 Provide more user friendly console.time/timeEnd. The timer name
988 is now optional, and is "default" if not provided. Also provide
989 warnings when attempting to start an already started timer,
990 or stop a timer that does not exist.
992 * inspector/agents/InspectorConsoleAgent.cpp:
993 (Inspector::InspectorConsoleAgent::startTiming):
994 (Inspector::InspectorConsoleAgent::stopTiming):
995 Warnings for bad cases.
997 * runtime/ConsoleObject.cpp:
998 (JSC::defaultLabelString):
999 (JSC::consoleProtoFuncTime):
1000 (JSC::consoleProtoFuncTimeEnd):
1001 Optional label becomes "default".
1003 2016-05-03 Xan Lopez <xlopez@igalia.com>
1005 Fix the ENABLE(WEBASSEMBLY) build
1006 https://bugs.webkit.org/show_bug.cgi?id=157312
1008 Reviewed by Darin Adler.
1010 * runtime/Executable.cpp:
1011 (JSC::WebAssemblyExecutable::WebAssemblyExecutable):
1012 * wasm/WASMFunctionCompiler.h:
1013 (JSC::WASMFunctionCompiler::convertValueToDouble):
1015 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
1017 Web Inspector: Remove unused parameter of ScriptArguments::getFirstArgumentAsString
1018 https://bugs.webkit.org/show_bug.cgi?id=157301
1020 Reviewed by Timothy Hatcher.
1022 * inspector/ScriptArguments.cpp:
1023 (Inspector::ScriptArguments::getFirstArgumentAsString):
1024 * inspector/ScriptArguments.h:
1025 Remove unused argument and related code.
1027 * runtime/ConsoleClient.cpp:
1028 (JSC::ConsoleClient::printConsoleMessageWithArguments):
1029 Drive by remove unnecessary cast.
1031 2016-05-03 Michael Saboff <msaboff@apple.com>
1033 Crash: Array.prototype.slice() and .splice() can call fastSlice() after an array is truncated
1034 https://bugs.webkit.org/show_bug.cgi?id=157322
1036 Reviewed by Filip Pizlo.
1038 Check to see if the source array has changed length before calling fastSlice().
1039 If it has, take the slow path.
1041 * runtime/ArrayPrototype.cpp:
1042 (JSC::arrayProtoFuncSlice):
1043 (JSC::arrayProtoFuncSplice):
1044 * tests/stress/regress-157322.js: New test.
1046 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
1048 Eliminate PassRefPtr conversion from ConsoleObject
1049 https://bugs.webkit.org/show_bug.cgi?id=157300
1051 Reviewed by Timothy Hatcher.
1053 * runtime/ConsoleObject.cpp:
1054 (JSC::consoleLogWithLevel):
1055 (JSC::consoleProtoFuncClear):
1056 (JSC::consoleProtoFuncDir):
1057 (JSC::consoleProtoFuncDirXML):
1058 (JSC::consoleProtoFuncTable):
1059 (JSC::consoleProtoFuncTrace):
1060 (JSC::consoleProtoFuncAssert):
1061 (JSC::consoleProtoFuncCount):
1062 (JSC::consoleProtoFuncTimeStamp):
1063 (JSC::consoleProtoFuncGroup):
1064 (JSC::consoleProtoFuncGroupCollapsed):
1065 (JSC::consoleProtoFuncGroupEnd):
1066 No need to release to a PassRefPtr, we can just move into the RefPtr<>&&.
1068 2016-05-01 Filip Pizlo <fpizlo@apple.com>
1070 Speed up JSGlobalObject initialization by making some properties lazy
1071 https://bugs.webkit.org/show_bug.cgi?id=157045
1073 Reviewed by Keith Miller.
1075 This makes about half of JSGlobalObject's state lazy. There are three categories of
1076 state in JSGlobalObject:
1078 1) C++ fields in JSGlobalObject.
1079 2) JS object properties in JSGlobalObject's JSObject superclass.
1080 3) JS variables in JSGlobalObject's JSSegmentedVariableObject superclass.
1082 State held in JS variables cannot yet be made lazy. That's why this patch only goes
1085 State in JS object properties can be made lazy if we move it to the static property
1086 hashtable. JSGlobalObject already had one of those. This patch makes static property
1087 hashtables a lot more powerful, by adding three new kinds of static properties. These
1088 new kinds allow us to make almost all of JSGlobalObject's object properties lazy.
1090 State in C++ fields can now be made lazy thanks in part to WTF's support for stateless
1091 lambdas. You can of course make anything lazy by hand, but there are many C++ fields in
1092 JSGlobalObject and we are adding more all the time. We don't want to require that each
1093 of these has a getter with an initialization check and a corresponding out-of-line slow
1094 path that does the initialization. We want this kind of boilerplate to be handled by
1097 The primary abstraction introduced in this patch is LazyProperty<Type>. Currently, this
1098 only works where Type is a subclass of JSCell. Such a property holds a pointer to Type.
1099 You can use it like you would a WriteBarrier<Type>. It even has set() and get() methods,
1100 so it's almost a drop-in replacement.
1102 The key to LazyProperty<Type>'s power is that you can do this:
1106 LazyProperty<Foo> m_foo;
1110 [] (const LazyProperty<Foo>::Initializer<Bar>& init) {
1111 init.set(Foo::create(init.vm, init.owner));
1114 This initLater() call requires that you pass a stateless lambda (see WTF changelog for
1115 the definition). Miraculously, this initLater() call is guaranteed to compile to a store
1116 of a pointer constant to m_foo, as in:
1118 movabsq 0xBLAH, %rax
1121 This magical pointer constant points to a callback that was generated by the template
1122 instantiation of initLater(). That callback knows to call your stateless lambda, but
1123 also does some other bookkeeping: it makes sure that you indeed initialized the property
1124 inside the callback and it manages recursive initializations. It's totally legal to call
1125 m_foo.get() inside the initLater() callback. If you do that before you call init.set(),
1126 m_foo.get() will return null. This is an excellent escape hatch if we ever find
1127 ourselves in a dependency cycle. I added this feature because I already had to create a
1130 Note that using LazyProperties from DFG threads is super awkward. It's going to be hard
1131 to get this right. The DFG thread cannot initialize those fields, so it has to make sure
1132 that it does conservative things. But for some nodes this could mean adding a lot of new
1133 logic, like NewTypedArray, which currently is written in such a way that it assumes that
1134 we always have the typed array structure. Currently we take a two-fold approach: for
1135 typed arrays we don't handle the NewTypedArray intrinsic if the structure isn't
1136 initialized, and for everything else we don't make the properties lazy if the DFG needs
1137 them. As we optimize this further we might need to teach the DFG to handle more lazy
1138 properties. I tried to do this for RegExp but found it to be very confusing. With typed
1141 There is also a somewhat more powerful construct called LazyClassStructure. We often
1142 need to keep around the structure of some standard JS class, like Date. We also need to
1143 make sure that the constructor ends up in the global object's property table. And we
1144 often need to keep the original value of the constructor for ourselves. In this case, we
1145 want to make sure that the creation of the structure-prototype-constructor constellation
1146 is atomic. We don't want code to start looking at the structure if it points to a
1147 prototype that doesn't have its "constructor" property set yet, for example.
1148 LazyClassStructure solves this by abstracting that whole initialization. You provide the
1149 callback that allocates everything, since we are super inconsistent about the way we
1150 initialize things, but LazyClassStructure establishes the workflow and helps you not
1153 Finally, the new static hashtable attributes allow for all of this to work with the JS
1156 PropertyCallback: if you use this attribute, the second column in the table should be
1157 the name of a function to call to initialize this property. This is useful for things
1158 like the Math property. The Math object turns out to be very expensive to allocate.
1159 Delaying its allocation is super easy with the PropertyCallback attribute.
1161 CellProperty: with this attribute the second column should be a C++ field name like
1162 JSGlobalObject::m_evalErrorConstructor. The static hashtable will grab the offset of
1163 this property, and when it needs to be initialized, Lookup will assume you have a
1164 LazyProperty<JSCell> and call its get() method. It will initialize the property to
1165 whatever get() returned. Note that it's legal to cast a LazyProperty<Anything> to
1166 LazyProperty<JSCell> for the purpose of calling get() because the get() method will just
1167 call whatever callback function pointer is encoded in the property and it does not need
1168 to know anything about what type that callback will instantiate.
1170 ClassStructure: with this attribute the second column should be a C++ field name. The
1171 static hashtable will initialize the property by treating the field as a
1172 LazyClassStructure and it will call get(). LazyClassStructure completely owns the whole
1173 initialization workflow, so Lookup assumes that when LazyClassStructure::get() returns,
1174 the property in question will already be set. By convention, we have LazyClassStructure
1175 initialize the property with a pointer to the constructor, since that's how all of our
1176 classes work: "globalObject.Date" points to the DateConstructor.
1178 This is a 2x speed-up in JSGlobalObject initialization time in a microbenchmark that
1179 calls our C API. This is a 1% speed-up on SunSpider and JSRegress.
1181 * API/JSCallbackFunction.cpp:
1182 (JSC::JSCallbackFunction::create):
1183 * API/ObjCCallbackFunction.h:
1184 (JSC::ObjCCallbackFunction::impl):
1185 * API/ObjCCallbackFunction.mm:
1186 (JSC::ObjCCallbackFunction::ObjCCallbackFunction):
1187 (JSC::ObjCCallbackFunction::create):
1189 * JavaScriptCore.xcodeproj/project.pbxproj:
1190 * create_hash_table:
1191 * dfg/DFGAbstractInterpreterInlines.h:
1192 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1193 * dfg/DFGAbstractValue.cpp:
1194 (JSC::DFG::AbstractValue::set):
1195 * dfg/DFGArrayMode.cpp:
1196 (JSC::DFG::ArrayMode::originalArrayStructure):
1197 * dfg/DFGByteCodeParser.cpp:
1198 (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor):
1199 * dfg/DFGSpeculativeJIT.cpp:
1200 (JSC::DFG::SpeculativeJIT::compileNewTypedArray):
1201 * dfg/DFGSpeculativeJIT32_64.cpp:
1202 (JSC::DFG::SpeculativeJIT::compile):
1203 * dfg/DFGSpeculativeJIT64.cpp:
1204 (JSC::DFG::SpeculativeJIT::compile):
1205 * dfg/DFGStructureRegistrationPhase.cpp:
1206 (JSC::DFG::StructureRegistrationPhase::run):
1207 * ftl/FTLLowerDFGToB3.cpp:
1208 (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
1209 * runtime/ClonedArguments.cpp:
1210 (JSC::ClonedArguments::getOwnPropertySlot):
1211 (JSC::ClonedArguments::materializeSpecials):
1212 * runtime/CommonSlowPaths.cpp:
1213 (JSC::SLOW_PATH_DECL):
1214 * runtime/FunctionPrototype.cpp:
1215 (JSC::functionProtoFuncToString):
1216 * runtime/InternalFunction.cpp:
1217 (JSC::InternalFunction::visitChildren):
1218 (JSC::InternalFunction::name):
1219 (JSC::InternalFunction::calculatedDisplayName):
1220 (JSC::InternalFunction::createSubclassStructure):
1221 * runtime/InternalFunction.h:
1222 * runtime/JSBoundFunction.cpp:
1223 (JSC::JSBoundFunction::finishCreation):
1224 (JSC::JSBoundFunction::visitChildren):
1225 * runtime/JSFunction.cpp:
1226 (JSC::JSFunction::getOwnPropertySlot):
1227 (JSC::JSFunction::defineOwnProperty):
1228 * runtime/JSGenericTypedArrayViewConstructorInlines.h:
1229 (JSC::constructGenericTypedArrayView):
1230 * runtime/JSGlobalObject.cpp:
1231 (JSC::createProxyProperty):
1232 (JSC::createJSONProperty):
1233 (JSC::createMathProperty):
1234 (JSC::JSGlobalObject::init):
1235 (JSC::JSGlobalObject::stringPrototypeChainIsSane):
1236 (JSC::JSGlobalObject::resetPrototype):
1237 (JSC::JSGlobalObject::visitChildren):
1238 (JSC::JSGlobalObject::toThis):
1239 (JSC::JSGlobalObject::getOwnPropertySlot):
1240 (JSC::JSGlobalObject::createThrowTypeError): Deleted.
1241 * runtime/JSGlobalObject.h:
1242 (JSC::JSGlobalObject::objectConstructor):
1243 (JSC::JSGlobalObject::promiseConstructor):
1244 (JSC::JSGlobalObject::internalPromiseConstructor):
1245 (JSC::JSGlobalObject::evalErrorConstructor):
1246 (JSC::JSGlobalObject::rangeErrorConstructor):
1247 (JSC::JSGlobalObject::referenceErrorConstructor):
1248 (JSC::JSGlobalObject::syntaxErrorConstructor):
1249 (JSC::JSGlobalObject::typeErrorConstructor):
1250 (JSC::JSGlobalObject::URIErrorConstructor):
1251 (JSC::JSGlobalObject::nullGetterFunction):
1252 (JSC::JSGlobalObject::nullSetterFunction):
1253 (JSC::JSGlobalObject::callFunction):
1254 (JSC::JSGlobalObject::applyFunction):
1255 (JSC::JSGlobalObject::definePropertyFunction):
1256 (JSC::JSGlobalObject::arrayProtoValuesFunction):
1257 (JSC::JSGlobalObject::initializePromiseFunction):
1258 (JSC::JSGlobalObject::newPromiseCapabilityFunction):
1259 (JSC::JSGlobalObject::functionProtoHasInstanceSymbolFunction):
1260 (JSC::JSGlobalObject::regExpProtoExecFunction):
1261 (JSC::JSGlobalObject::regExpProtoSymbolReplaceFunction):
1262 (JSC::JSGlobalObject::regExpProtoGlobalGetter):
1263 (JSC::JSGlobalObject::regExpProtoUnicodeGetter):
1264 (JSC::JSGlobalObject::throwTypeErrorGetterSetter):
1265 (JSC::JSGlobalObject::moduleLoader):
1266 (JSC::JSGlobalObject::objectPrototype):
1267 (JSC::JSGlobalObject::functionPrototype):
1268 (JSC::JSGlobalObject::arrayPrototype):
1269 (JSC::JSGlobalObject::booleanPrototype):
1270 (JSC::JSGlobalObject::stringPrototype):
1271 (JSC::JSGlobalObject::symbolPrototype):
1272 (JSC::JSGlobalObject::numberPrototype):
1273 (JSC::JSGlobalObject::datePrototype):
1274 (JSC::JSGlobalObject::regExpPrototype):
1275 (JSC::JSGlobalObject::errorPrototype):
1276 (JSC::JSGlobalObject::iteratorPrototype):
1277 (JSC::JSGlobalObject::generatorFunctionPrototype):
1278 (JSC::JSGlobalObject::generatorPrototype):
1279 (JSC::JSGlobalObject::debuggerScopeStructure):
1280 (JSC::JSGlobalObject::withScopeStructure):
1281 (JSC::JSGlobalObject::strictEvalActivationStructure):
1282 (JSC::JSGlobalObject::activationStructure):
1283 (JSC::JSGlobalObject::moduleEnvironmentStructure):
1284 (JSC::JSGlobalObject::directArgumentsStructure):
1285 (JSC::JSGlobalObject::scopedArgumentsStructure):
1286 (JSC::JSGlobalObject::clonedArgumentsStructure):
1287 (JSC::JSGlobalObject::isOriginalArrayStructure):
1288 (JSC::JSGlobalObject::booleanObjectStructure):
1289 (JSC::JSGlobalObject::callbackConstructorStructure):
1290 (JSC::JSGlobalObject::callbackFunctionStructure):
1291 (JSC::JSGlobalObject::callbackObjectStructure):
1292 (JSC::JSGlobalObject::propertyNameIteratorStructure):
1293 (JSC::JSGlobalObject::objcCallbackFunctionStructure):
1294 (JSC::JSGlobalObject::objcWrapperObjectStructure):
1295 (JSC::JSGlobalObject::dateStructure):
1296 (JSC::JSGlobalObject::nullPrototypeObjectStructure):
1297 (JSC::JSGlobalObject::errorStructure):
1298 (JSC::JSGlobalObject::calleeStructure):
1299 (JSC::JSGlobalObject::functionStructure):
1300 (JSC::JSGlobalObject::boundFunctionStructure):
1301 (JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
1302 (JSC::JSGlobalObject::getterSetterStructure):
1303 (JSC::JSGlobalObject::nativeStdFunctionStructure):
1304 (JSC::JSGlobalObject::namedFunctionStructure):
1305 (JSC::JSGlobalObject::functionNameOffset):
1306 (JSC::JSGlobalObject::numberObjectStructure):
1307 (JSC::JSGlobalObject::privateNameStructure):
1308 (JSC::JSGlobalObject::mapStructure):
1309 (JSC::JSGlobalObject::regExpStructure):
1310 (JSC::JSGlobalObject::generatorFunctionStructure):
1311 (JSC::JSGlobalObject::setStructure):
1312 (JSC::JSGlobalObject::stringObjectStructure):
1313 (JSC::JSGlobalObject::symbolObjectStructure):
1314 (JSC::JSGlobalObject::iteratorResultObjectStructure):
1315 (JSC::JSGlobalObject::lazyTypedArrayStructure):
1316 (JSC::JSGlobalObject::typedArrayStructure):
1317 (JSC::JSGlobalObject::typedArrayStructureConcurrently):
1318 (JSC::JSGlobalObject::isOriginalTypedArrayStructure):
1319 (JSC::JSGlobalObject::typedArrayConstructor):
1320 (JSC::JSGlobalObject::actualPointerFor):
1321 (JSC::JSGlobalObject::internalFunctionStructure): Deleted.
1322 * runtime/JSNativeStdFunction.cpp:
1323 (JSC::JSNativeStdFunction::create):
1324 * runtime/JSWithScope.cpp:
1325 (JSC::JSWithScope::create):
1326 (JSC::JSWithScope::visitChildren):
1327 (JSC::JSWithScope::createStructure):
1328 (JSC::JSWithScope::JSWithScope):
1329 * runtime/JSWithScope.h:
1330 (JSC::JSWithScope::object):
1331 (JSC::JSWithScope::create): Deleted.
1332 (JSC::JSWithScope::createStructure): Deleted.
1333 (JSC::JSWithScope::JSWithScope): Deleted.
1334 * runtime/LazyClassStructure.cpp: Added.
1335 (JSC::LazyClassStructure::Initializer::Initializer):
1336 (JSC::LazyClassStructure::Initializer::setPrototype):
1337 (JSC::LazyClassStructure::Initializer::setStructure):
1338 (JSC::LazyClassStructure::Initializer::setConstructor):
1339 (JSC::LazyClassStructure::visit):
1340 (JSC::LazyClassStructure::dump):
1341 * runtime/LazyClassStructure.h: Added.
1342 (JSC::LazyClassStructure::LazyClassStructure):
1343 (JSC::LazyClassStructure::get):
1344 (JSC::LazyClassStructure::prototype):
1345 (JSC::LazyClassStructure::constructor):
1346 (JSC::LazyClassStructure::getConcurrently):
1347 (JSC::LazyClassStructure::prototypeConcurrently):
1348 (JSC::LazyClassStructure::constructorConcurrently):
1349 * runtime/LazyClassStructureInlines.h: Added.
1350 (JSC::LazyClassStructure::initLater):
1351 * runtime/LazyProperty.h: Added.
1352 (JSC::LazyProperty::Initializer::Initializer):
1353 (JSC::LazyProperty::LazyProperty):
1354 (JSC::LazyProperty::get):
1355 (JSC::LazyProperty::getConcurrently):
1356 * runtime/LazyPropertyInlines.h: Added.
1357 (JSC::LazyProperty<ElementType>::Initializer<OwnerType>::set):
1358 (JSC::LazyProperty<ElementType>::initLater):
1359 (JSC::LazyProperty<ElementType>::setMayBeNull):
1360 (JSC::LazyProperty<ElementType>::set):
1361 (JSC::LazyProperty<ElementType>::visit):
1362 (JSC::LazyProperty<ElementType>::dump):
1363 (JSC::LazyProperty<ElementType>::callFunc):
1364 * runtime/Lookup.cpp:
1365 (JSC::setUpStaticFunctionSlot):
1367 (JSC::HashTableValue::function):
1368 (JSC::HashTableValue::functionLength):
1369 (JSC::HashTableValue::propertyGetter):
1370 (JSC::HashTableValue::propertyPutter):
1371 (JSC::HashTableValue::accessorGetter):
1372 (JSC::HashTableValue::accessorSetter):
1373 (JSC::HashTableValue::constantInteger):
1374 (JSC::HashTableValue::lexerValue):
1375 (JSC::HashTableValue::lazyCellPropertyOffset):
1376 (JSC::HashTableValue::lazyClassStructureOffset):
1377 (JSC::HashTableValue::lazyPropertyCallback):
1378 (JSC::getStaticPropertySlot):
1379 (JSC::getStaticValueSlot):
1380 (JSC::reifyStaticProperty):
1381 * runtime/PropertySlot.h:
1382 * runtime/TypedArrayType.h:
1384 2016-05-03 Per Arne Vollan <peavo@outlook.com>
1386 [Win] Remove Windows XP Compatibility Requirements
1387 https://bugs.webkit.org/show_bug.cgi?id=152899
1389 Reviewed by Brent Fulgham.
1391 Windows XP is not supported anymore, we can remove workarounds.
1393 * JavaScriptCore.vcxproj/jsc/DLLLauncherMain.cpp:
1394 (enableTerminationOnHeapCorruption):
1396 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
1398 Web Inspector: console.assert should do far less work when the assertion is true
1399 https://bugs.webkit.org/show_bug.cgi?id=157297
1400 <rdar://problem/26056556>
1402 Reviewed by Timothy Hatcher.
1404 * runtime/ConsoleClient.h:
1405 * runtime/ConsoleClient.cpp:
1406 (JSC::ConsoleClient::assertion):
1407 (JSC::ConsoleClient::assertCondition): Deleted.
1408 Rename, now that this will only get called when the assertion failed.
1410 * runtime/ConsoleObject.cpp:
1411 (JSC::consoleProtoFuncAssert):
1412 Avoid doing any work if the assertion succeeded.
1414 2016-05-03 Joseph Pecoraro <pecoraro@apple.com>
1416 Unreviewed follow-up testapi fix after r200355.
1418 * runtime/JSGlobalObject.cpp:
1419 (JSC::JSGlobalObject::init):
1420 Revert back to non-enumerable. This matches our older behavior,
1421 we can decide to make this Enumerable later if needed.
1423 2016-05-02 Joseph Pecoraro <pecoraro@apple.com>
1425 Web Inspector: Reflect.toString() should be [object Object] not [object Reflect]
1426 https://bugs.webkit.org/show_bug.cgi?id=157288
1428 Reviewed by Darin Adler.
1430 * runtime/ReflectObject.cpp:
1431 * tests/stress/reflect.js: Added.
1433 2016-05-02 Jon Davis <jond@apple.com>
1435 Add Resource Timing entry to the Feature Status page.
1436 https://bugs.webkit.org/show_bug.cgi?id=157285
1438 Reviewed by Timothy Hatcher.
1442 2016-05-02 Joseph Pecoraro <pecoraro@apple.com>
1444 Make console a namespace object (like Math/JSON), allowing functions to be called unbound
1445 https://bugs.webkit.org/show_bug.cgi?id=157286
1446 <rdar://problem/26052830>
1448 Reviewed by Timothy Hatcher.
1450 This changes `console` to be a global namespace object, like `Math` and `JSON`.
1451 It just holds a bunch of functions, that can be used on their own, unbound.
1452 For example, `[1,2,3].forEach(console.log)` and `var log = console.log; log(1)`
1453 used to throw exceptions and now do not.
1455 Previously console was an Object/Prototype pair, so functions were on
1456 ConsolePrototype (console.__proto__.log) and they needed to be called
1457 Console objects as the `this` value. Now, `console` is just a standard
1458 object with a bunch of functions. Since there is no console prototype the
1459 functions can be passed around and called as expected and they will
1460 just do the right thing.
1462 For compatability with other browsers, `console` was made enumerable
1463 on the global object.
1466 * JavaScriptCore.xcodeproj/project.pbxproj:
1467 Add new files and remove old files.
1469 * runtime/CommonIdentifiers.h:
1472 * runtime/ConsoleObject.cpp: Renamed from Source/JavaScriptCore/runtime/ConsolePrototype.cpp.
1473 (JSC::ConsoleObject::ConsoleObject):
1474 (JSC::ConsoleObject::finishCreation):
1475 (JSC::valueToStringWithUndefinedOrNullCheck):
1476 (JSC::consoleLogWithLevel):
1477 (JSC::consoleProtoFuncDebug):
1478 (JSC::consoleProtoFuncError):
1479 (JSC::consoleProtoFuncLog):
1480 (JSC::consoleProtoFuncInfo):
1481 (JSC::consoleProtoFuncWarn):
1482 (JSC::consoleProtoFuncClear):
1483 (JSC::consoleProtoFuncDir):
1484 (JSC::consoleProtoFuncDirXML):
1485 (JSC::consoleProtoFuncTable):
1486 (JSC::consoleProtoFuncTrace):
1487 (JSC::consoleProtoFuncAssert):
1488 (JSC::consoleProtoFuncCount):
1489 (JSC::consoleProtoFuncProfile):
1490 (JSC::consoleProtoFuncProfileEnd):
1491 (JSC::consoleProtoFuncTakeHeapSnapshot):
1492 (JSC::consoleProtoFuncTime):
1493 (JSC::consoleProtoFuncTimeEnd):
1494 (JSC::consoleProtoFuncTimeStamp):
1495 (JSC::consoleProtoFuncGroup):
1496 (JSC::consoleProtoFuncGroupCollapsed):
1497 (JSC::consoleProtoFuncGroupEnd):
1498 Console functions no longer need to check if the this object is
1499 a Console object. They will always just work now.
1501 * runtime/MathObject.cpp:
1502 * runtime/MathObject.h:
1503 * runtime/ConsoleObject.h: Renamed from Source/JavaScriptCore/runtime/ConsolePrototype.h.
1504 (JSC::ConsoleObject::create):
1505 (JSC::ConsoleObject::createStructure):
1506 ConsoleObject is a basic object like MathObject.
1508 * runtime/JSConsole.cpp: Removed.
1509 * runtime/JSConsole.h: Removed.
1510 * runtime/JSGlobalObject.h:
1511 * runtime/JSGlobalObject.cpp:
1512 (JSC::JSGlobalObject::init):
1513 (JSC::JSGlobalObject::visitChildren):
1514 Remove JSConsole / ConsolePrototype in favor of the single ConsoleObject.
1516 2016-05-02 Per Arne Vollan <peavo@outlook.com>
1518 [Win] Clean up annoying compiler warnings
1519 https://bugs.webkit.org/show_bug.cgi?id=149813
1521 Reviewed by Alex Christensen.
1523 * bytecode/PropertyCondition.cpp:
1524 (JSC::PropertyCondition::isWatchableWhenValid):
1525 * dfg/DFGObjectAllocationSinkingPhase.cpp:
1526 * dfg/DFGSpeculativeJIT32_64.cpp:
1527 (JSC::DFG::SpeculativeJIT::emitCall):
1528 * inspector/InspectorBackendDispatcher.cpp:
1529 (Inspector::BackendDispatcher::sendPendingErrors):
1530 * jit/JITCall32_64.cpp:
1531 (JSC::JIT::compileOpCall):
1532 * parser/Parser.cpp:
1533 (JSC::Parser<LexerType>::parseAssignmentExpression):
1534 * runtime/ClonedArguments.cpp:
1535 (JSC::ClonedArguments::createWithInlineFrame):
1536 * runtime/Error.cpp:
1537 (JSC::addErrorInfoAndGetBytecodeOffset):
1538 * runtime/IntlNumberFormat.cpp:
1539 (JSC::IntlNumberFormat::initializeNumberFormat):
1540 * runtime/JSObject.cpp:
1541 (JSC::JSObject::heapSnapshot):
1542 (JSC::callToPrimitiveFunction):
1543 * runtime/RegExpPrototype.cpp:
1545 * runtime/SamplingProfiler.cpp:
1546 (JSC::SamplingProfiler::StackFrame::functionStartColumn):
1548 2016-05-02 Keith Miller <keith_miller@apple.com>
1550 ToThis should be able to be eliminated in Constant Folding
1551 https://bugs.webkit.org/show_bug.cgi?id=157213
1553 Reviewed by Saam Barati.
1555 This patch enables eliminating the ToThis value when we have abstract interpreter
1556 indicates the node is not needed. Since there are Objects that override their
1557 ToThis behavior we first check if we can eliminate the node by looking at its
1558 speculated type. If the function is in strict mode then we can eliminate ToThis as
1559 long as the speculated type is not SpecObjectOther since that contains objects
1560 that may set OverridesToThis. If the function is not in strict mode then we can
1561 eliminate ToThis as long is the speculated type is an object that is not SpecObjectOther.
1563 If we can't eliminate with type information we can still eliminate the ToThis node with
1564 the proven structure set. When ToThis only sees structures that do not set OverridesToThis
1565 it can be eliminated. Additionally, if the function is in strict mode then we can eliminate
1566 ToThis as long as all only the object structures don't set OverridesToThis.
1568 * dfg/DFGAbstractInterpreterInlines.h:
1569 (JSC::DFG::isToThisAnIdentity):
1570 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
1571 * dfg/DFGConstantFoldingPhase.cpp:
1572 (JSC::DFG::ConstantFoldingPhase::foldConstants):
1573 * dfg/DFGFixupPhase.cpp:
1574 (JSC::DFG::FixupPhase::fixupToThis):
1575 * tests/stress/to-this-global-object.js: Added.
1580 2016-05-01 Skachkov Oleksandr <gskachkov@gmail.com>
1582 Class contructor and methods shouldn't have "arguments" and "caller"
1583 https://bugs.webkit.org/show_bug.cgi?id=144238
1585 Reviewed by Ryosuke Niwa.
1587 Added TypeError that is raised in case of access to properties 'arguments' or 'caller'
1588 of constructor or method of class. Actually TypeError already raised for most cases, except
1589 case with undeclared constructor e. g.
1591 (new A).constructor.caller
1592 (new A).constructor.arguments
1594 * runtime/JSFunction.cpp:
1595 (JSC::getThrowTypeErrorGetterSetter):
1596 (JSC::JSFunction::getOwnPropertySlot):
1597 * runtime/JSGlobalObject.cpp:
1598 (JSC::JSGlobalObject::createThrowTypeErrorArgumentsAndCaller):
1599 (JSC::JSGlobalObject::visitChildren):
1600 * runtime/JSGlobalObject.h:
1601 (JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerGetterSetter):
1602 * runtime/JSGlobalObjectFunctions.cpp:
1603 (JSC::globalFuncThrowTypeErrorArgumentsAndCaller):
1604 * runtime/JSGlobalObjectFunctions.h:
1606 2016-05-02 Yoav Weiss <yoav@yoav.ws>
1608 Move ResourceTiming behind a runtime flag
1609 https://bugs.webkit.org/show_bug.cgi?id=157133
1611 Reviewed by Alex Christensen.
1613 * runtime/CommonIdentifiers.h: Added PerformanceEntry, PerformanceEntryList and PerformanceResourceTiming as property names.
1615 2016-05-02 Yusuke Suzuki <utatane.tea@gmail.com>
1617 Assertion failure for bound function with custom prototype and Reflect.construct
1618 https://bugs.webkit.org/show_bug.cgi?id=157081
1620 Reviewed by Saam Barati.
1622 We ensured `newTarget != exec->callee()`. However, it does not mean `newTarget.get("prototype") != exec->callee()->get("prototype")`.
1623 When the given `prototype` is the same to `baseStructure->sotredPrototype()`, it is unnecessary to create a new structure from this
1626 * bytecode/InternalFunctionAllocationProfile.h:
1627 (JSC::InternalFunctionAllocationProfile::createAllocationStructureFromBase):
1628 * tests/stress/custom-prototype-may-be-same-to-original-one.js: Added.
1632 2016-04-30 Konstantin Tokarev <annulen@yandex.ru>
1634 Guard ObjC-specific code in Heap.cpp with USE(FOUNDATION)
1635 https://bugs.webkit.org/show_bug.cgi?id=157236
1637 Reviewed by Darin Adler.
1639 This also fixes build with GCC 4.8 which does not provide
1644 2016-04-30 Yusuke Suzuki <utatane.tea@gmail.com>
1646 Assertion failure for destructuring assignment with new.target and unary operator
1647 https://bugs.webkit.org/show_bug.cgi?id=157149
1649 Reviewed by Saam Barati.
1651 The caller of parseDefaultValueForDestructuringPattern() should propagate errors.
1652 And this patch also cleans up createSavePoint and createSavePointForError; introducing SavePointWithError.
1654 * parser/Parser.cpp:
1655 (JSC::Parser<LexerType>::parseSourceElements):
1656 (JSC::Parser<LexerType>::parseDestructuringPattern):
1657 Add propagateErorr() for parseDefaultValueForDestructuringPattern.
1659 (JSC::Parser<LexerType>::parseAssignmentExpression):
1661 (JSC::Parser::restoreLexerState):
1662 (JSC::Parser::internalSaveState):
1663 (JSC::Parser::createSavePointForError):
1664 (JSC::Parser::createSavePoint):
1665 (JSC::Parser::internalRestoreState):
1666 (JSC::Parser::restoreSavePointWithError):
1667 (JSC::Parser::restoreSavePoint):
1668 * tests/stress/default-value-parsing-should-propagate-error.js: Added.
1670 (testSyntaxError.f):
1672 2016-04-28 Darin Adler <darin@apple.com>
1674 First step in using "enum class" instead of "String" for enumerations in DOM
1675 https://bugs.webkit.org/show_bug.cgi?id=157163
1677 Reviewed by Chris Dumez.
1679 * runtime/JSString.h:
1680 (JSC::jsStringWithCache): Deleted unneeded overload for AtomicString.
1682 2016-04-29 Benjamin Poulain <bpoulain@apple.com>
1684 [JSC][ARMv7S] Arithmetic module results change when tiering up to DFG
1685 https://bugs.webkit.org/show_bug.cgi?id=157217
1686 rdar://problem/24733432
1688 Reviewed by Mark Lam.
1690 ARMv7's fmod() returns less accurate results than an integer division.
1691 Since we have integer div on ARMv7s, the results start changing when
1694 In this patch, I change our fmod slow path to behave like the fast path
1697 * dfg/DFGSpeculativeJIT.cpp:
1698 (JSC::DFG::SpeculativeJIT::compileArithMod):
1699 (JSC::DFG::fmodAsDFGOperation): Deleted.
1700 * runtime/CommonSlowPaths.cpp:
1701 (JSC::SLOW_PATH_DECL):
1702 * runtime/MathCommon.cpp:
1703 (JSC::isStrictInt32):
1704 * runtime/MathCommon.h:
1706 2016-04-29 Joseph Pecoraro <pecoraro@apple.com>
1708 Web Inspector: Issues inspecting the inspector, pausing on breakpoints causes content to not load
1709 https://bugs.webkit.org/show_bug.cgi?id=157198
1710 <rdar://problem/26011049>
1712 Reviewed by Timothy Hatcher.
1714 * inspector/InspectorBackendDispatcher.cpp:
1715 (Inspector::BackendDispatcher::sendResponse):
1716 While auditing the code, add a WTFMove.
1718 2016-04-29 Mark Lam <mark.lam@apple.com>
1720 Make RegExp.prototype.test spec compliant.
1721 https://bugs.webkit.org/show_bug.cgi?id=155862
1723 Reviewed by Saam Barati.
1725 * builtins/RegExpPrototype.js:
1726 (intrinsic.RegExpTestIntrinsic.test):
1728 * create_hash_table:
1729 - Delete obsoleted code.
1731 * dfg/DFGByteCodeParser.cpp:
1732 (JSC::DFG::ByteCodeParser::addToGraph):
1733 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
1734 - We now have 2 intrinsics for RegExp.prototype.test:
1735 RegExpTestIntrinsic and RegExpTestFastIntrinsic.
1737 RegExpTestIntrinsic maps to the entry at the top of the builtin ES6
1738 RegExp.prototype.test.
1739 RegExpTestFastIntrinsic maps to the fast path in the builtin ES6
1740 RegExp.prototype.test.
1742 Both will end up using the RegExpTest DFG node to implement the fast path
1743 of RegExp.prototype.test. RegExpTestIntrinsic will have some additional checks
1744 before the RegExpTest node. Those checks are for speculating that it is ok for
1745 us to take the fast path.
1747 * runtime/CommonIdentifiers.h:
1748 * runtime/Intrinsic.h:
1750 * runtime/JSGlobalObject.cpp:
1751 (JSC::JSGlobalObject::init):
1752 - Added the regExpTestFast function.
1753 - Also fixed the parameter length on 2 other functions that were erroneous.
1755 * runtime/RegExpPrototype.cpp:
1756 (JSC::RegExpPrototype::finishCreation):
1757 (JSC::regExpProtoFuncTestFast):
1758 (JSC::regExpProtoFuncTest): Deleted.
1759 * runtime/RegExpPrototype.h:
1762 2016-04-29 Benjamin Poulain <benjamin@webkit.org>
1764 Extend math-pow-stable-results.js to get more information about the failure
1766 * tests/stress/math-pow-stable-results.js:
1768 2016-04-29 Yusuke Suzuki <utatane.tea@gmail.com>
1770 Assertion failure for exception in "prototype" property getter and Reflect.construct
1771 https://bugs.webkit.org/show_bug.cgi?id=157084
1773 Reviewed by Mark Lam.
1775 InternalFunction::createSubclassStrucuture may throw exceptions because it performs [[Get]] to
1776 look up the "prototype" object. The current assertion is invalid.
1777 We also found that Object constructor is not aware of new.target. This is filed[1].
1779 [1]: https://bugs.webkit.org/show_bug.cgi?id=157196
1781 * runtime/InternalFunction.cpp:
1782 (JSC::InternalFunction::createSubclassStructure):
1783 * tests/stress/create-subclass-structure-may-throw-exception-when-getting-prototype.js: Added.
1787 2016-04-29 Commit Queue <commit-queue@webkit.org>
1789 Unreviewed, rolling out r200232.
1790 https://bugs.webkit.org/show_bug.cgi?id=157189
1792 This change broke the Mac CMake build and its LayoutTest is
1793 failing and/or flaky on all platforms (Requested by ryanhaddad
1798 "Move ResourceTiming behind a runtime flag"
1799 https://bugs.webkit.org/show_bug.cgi?id=157133
1800 http://trac.webkit.org/changeset/200232
1802 2016-04-29 Yusuke Suzuki <utatane.tea@gmail.com>
1804 [ES6] RegExp.prototype.@@replace should use @isObject instead of `instanceof` for object guard
1805 https://bugs.webkit.org/show_bug.cgi?id=157124
1807 Reviewed by Keith Miller.
1809 Use @isObject instead of `instanceof @Object`.
1810 The `instanceof` check is not enough to check Object Type.
1811 This fix itself is the same to r199647, and this patch is for RegExp.prototype.@@replace.
1813 * builtins/RegExpPrototype.js:
1815 * tests/stress/regexp-replace-in-other-realm-should-work.js: Added.
1817 * tests/stress/regexp-replace-should-work-with-objects-not-inheriting-object-prototype.js: Added.
1821 2016-04-29 Yoav Weiss <yoav@yoav.ws>
1823 Move ResourceTiming behind a runtime flag
1824 https://bugs.webkit.org/show_bug.cgi?id=157133
1826 Reviewed by Alex Christensen.
1828 * runtime/CommonIdentifiers.h: Added PerformanceEntry, PerformanceEntryList and PerformanceResourceTiming as property names.
1830 2016-04-28 Joseph Pecoraro <pecoraro@apple.com>
1832 Remove unused bool parameter in CodeCache::getGlobalCodeBlock
1833 https://bugs.webkit.org/show_bug.cgi?id=157156
1835 Reviewed by Mark Lam.
1837 The bool parameter appears to be isArrowFunctionContext, but the method's
1838 contents just get that property from the Executable, so the parameter is
1839 unnecessary and unused.
1841 * runtime/CodeCache.cpp:
1842 (JSC::CodeCache::getGlobalCodeBlock):
1843 (JSC::CodeCache::getProgramCodeBlock):
1844 (JSC::CodeCache::getEvalCodeBlock):
1845 (JSC::CodeCache::getModuleProgramCodeBlock):
1846 * runtime/CodeCache.h:
1847 * runtime/Executable.cpp:
1848 (JSC::EvalExecutable::create):
1849 * runtime/JSGlobalObject.cpp:
1850 (JSC::JSGlobalObject::createEvalCodeBlock):
1851 * runtime/JSGlobalObject.h:
1853 2016-04-28 Caitlin Potter <caitp@igalia.com>
1855 [JSC] re-implement String#padStart and String#padEnd in JavaScript
1856 https://bugs.webkit.org/show_bug.cgi?id=157146
1858 Reviewed by Saam Barati.
1860 * builtins/StringPrototype.js:
1861 (repeatCharactersSlowPath):
1864 * runtime/JSGlobalObject.cpp:
1865 (JSC::JSGlobalObject::init):
1866 * runtime/StringPrototype.cpp:
1867 (JSC::StringPrototype::finishCreation): Deleted.
1868 (JSC::repeatStringPattern): Deleted.
1869 (JSC::padString): Deleted.
1870 (JSC::stringProtoFuncPadEnd): Deleted.
1871 (JSC::stringProtoFuncPadStart): Deleted.
1873 2016-04-28 Joseph Pecoraro <pecoraro@apple.com>
1875 Web Inspector: Tweak auto attach initialization on some platforms
1876 https://bugs.webkit.org/show_bug.cgi?id=157150
1877 <rdar://problem/21222045>
1879 Reviewed by Timothy Hatcher.
1881 * inspector/EventLoop.cpp:
1882 (Inspector::EventLoop::cycle):
1883 * inspector/remote/RemoteInspector.mm:
1884 (Inspector::RemoteInspector::updateAutomaticInspectionCandidate):
1886 2016-04-28 Benjamin Poulain <bpoulain@apple.com>
1888 [JSC] Unify Math.pow() accross all tiers
1889 https://bugs.webkit.org/show_bug.cgi?id=157121
1891 Reviewed by Geoffrey Garen.
1893 My previous optimizations of DFG compile time have slowly
1894 regressed Sunspider's math-partial-sums.
1896 What is happenning is baseline used a thunk for Math.pow()
1897 that has a special case for an exponent of -0.5, while
1898 DFG/FTL have other special cases for other exponents.
1899 The faster we get to DFG, the less time we spend in that fast
1902 While looking into this, I discovered some correctness issues. Baseline
1903 optimizes y=-0.5 by turning it into 1/sqrt(). DFG/FTL optimize constant
1904 y=0.5 by turning it into sqrt(). The problem is sqrt() behaves differently
1905 for -0 and -Infinity. With sqrt(), negative numbers are undefined,
1906 and the result is NaN. With pow(), they have a result.
1908 Something else that has bothered me for a while is that Math.pow()
1909 with the same arguments give you different results in LLINT, Baseline,
1910 and DFG/FTL. This seems a bit dangerous for numerical stability.
1912 With this patch, I unify the behaviors for all tiers while keeping
1913 the "special cases".
1915 We have pow() that is super slow, but most callers don't need the
1916 full power. We have:
1917 -pow() with an exponent between 0 and 1000 is a fast path implemented
1918 by multiplication only.
1919 -pow(x, 0.5) is sqrt with special checks for negative values.
1920 -pow(x, -0.5) is sqrt with special checks for negative values.
1922 The C++ implementation handles all those optimizations too. This ensure
1923 you get the same results from LLINT to FTL.
1925 The thunk is eliminated, it was producing incorrect results and only
1926 optimized Sunspider's partial-sums.
1928 DFG gets the optimized integer, 0.5 and -0.5 cases since those are important
1929 for somewhat-hot code. DFG falls back to the C++ code for any non-obvious case.
1931 FTL gets the full C++ implementation inlined in B3. B3 knows how to eliminate
1932 all the dead cases so you get the best if your code is hot enough to reach FTL.
1934 * dfg/DFGFixupPhase.cpp:
1935 (JSC::DFG::FixupPhase::fixupNode): Deleted.
1937 (JSC::DFG::Node::convertToArithSqrt): Deleted.
1938 * dfg/DFGNodeType.h:
1939 * dfg/DFGSpeculativeJIT.cpp:
1940 (JSC::DFG::compileArithPowIntegerFastPath):
1941 (JSC::DFG::SpeculativeJIT::compileArithPow):
1942 * dfg/DFGStrengthReductionPhase.cpp:
1943 (JSC::DFG::StrengthReductionPhase::handleNode):
1944 * ftl/FTLLowerDFGToB3.cpp:
1945 (JSC::FTL::DFG::LowerDFGToB3::compileArithPow):
1946 * jit/ThunkGenerators.cpp:
1947 (JSC::powThunkGenerator): Deleted.
1948 * jit/ThunkGenerators.h:
1949 * runtime/MathCommon.cpp:
1950 (JSC::operationMathPow):
1951 * runtime/MathCommon.h:
1953 (JSC::thunkGeneratorForIntrinsic): Deleted.
1954 * tests/stress/math-pow-stable-results.js: Added.
1955 Getting consistent results when tiering up is new.
1956 This test verify that results always remains the same as LLINT.
1958 * tests/stress/math-pow-with-constants.js:
1959 (testPowUsedAsSqrt):
1960 (powUsedAsOneOverSqrt):
1961 (testPowUsedAsOneOverSqrt):
1963 (testPowUsedAsSquare):
1965 2016-04-28 Mark Lam <mark.lam@apple.com>
1967 DebuggerScope::className() should not assert scope->isValid().
1968 https://bugs.webkit.org/show_bug.cgi?id=157143
1970 Reviewed by Keith Miller.
1972 DebuggerScope::className() should not assert scope->isValid() because the
1973 TypeProfiler logs objects it encounters, and may indirectly call
1974 JSObject::calculatedClassName() on those objects later, thereby calling
1975 DebuggerScope::className() on an invalidated DebuggerScope.
1977 The existing handling in DebuggerScope::className() for an invalidated scope
1978 (that returns a null string) is sufficient.
1980 * debugger/DebuggerScope.cpp:
1981 (JSC::DebuggerScope::className):
1983 2016-04-28 Caitlin Potter <caitp@igalia.com>
1985 [JSC] implement spec changes for String#padStart and String#padEnd
1986 https://bugs.webkit.org/show_bug.cgi?id=157139
1988 Reviewed by Keith Miller.
1990 Previously, if the fill string was the empty string, it was treated as a
1991 single U+0020 SPACE character. Now, if this occurs, the original string
1992 is returned instead.
1994 Change was discussed at TC39 in March [1], and is reflected in new
1995 test262 tests for the feature.
1997 [1] https://github.com/tc39/tc39-notes/blob/master/es7/2016-03/march-29.md#stringprototypepadstartpadend
1999 * runtime/StringPrototype.cpp:
2001 * tests/es6/String.prototype_methods_String.prototype.padEnd.js:
2002 (TestFillerToString):
2003 (TestFillerEmptyString):
2004 * tests/es6/String.prototype_methods_String.prototype.padStart.js:
2005 (TestFillerToString):
2006 (TestFillerEmptyString):
2008 2016-04-28 Skachkov Oleksandr <gskachkov@gmail.com>
2010 Crash for non-static super property call in derived class constructor
2011 https://bugs.webkit.org/show_bug.cgi?id=157089
2013 Reviewed by Darin Adler.
2015 Added tdz check of the 'this' before access to the 'super' for FunctionCallBracketNode,
2016 the same as it was done for FunctionCallDotNode.
2018 * bytecompiler/NodesCodegen.cpp:
2019 (JSC::FunctionCallBracketNode::emitBytecode):
2021 2016-04-27 Mark Lam <mark.lam@apple.com>
2023 The GetterSetter structure needs a globalObject.
2024 https://bugs.webkit.org/show_bug.cgi?id=157120
2026 Reviewed by Filip Pizlo.
2028 In r199170: <http://trac.webkit.org/r199170>, GetterSetter was promoted from
2029 being a JSCell to a JSObject. JSObject methods expect their structure to have a
2030 globalObject. For example, see JSObject::calculatedClassName(). GetterSetter
2031 was previously using a singleton getterSetterStructure owned by the VM. That
2032 singleton getterSetterStructure is not associated with any globalObjects. As a
2033 result, JSObject::calculatedClassName() will run into a null globalObject when it
2034 is called on a GetterSetter object.
2036 This patch removes the VM singleton getterSetterStructure, and instead, creates
2037 a getterSetterStructure for each JSGlobalObject.
2039 * dfg/DFGAbstractInterpreterInlines.h:
2040 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2041 * dfg/DFGStructureRegistrationPhase.cpp:
2042 (JSC::DFG::StructureRegistrationPhase::run):
2043 * runtime/GetterSetter.h:
2044 * runtime/JSGlobalObject.cpp:
2045 (JSC::JSGlobalObject::init):
2046 (JSC::JSGlobalObject::visitChildren):
2047 * runtime/JSGlobalObject.h:
2048 (JSC::JSGlobalObject::functionStructure):
2049 (JSC::JSGlobalObject::boundFunctionStructure):
2050 (JSC::JSGlobalObject::boundSlotBaseFunctionStructure):
2051 (JSC::JSGlobalObject::getterSetterStructure):
2052 (JSC::JSGlobalObject::nativeStdFunctionStructure):
2053 (JSC::JSGlobalObject::namedFunctionStructure):
2054 (JSC::JSGlobalObject::functionNameOffset):
2059 2016-04-27 Keith Miller <keith_miller@apple.com>
2061 Unreviewed, Revert r199397 due to PLT regressions
2063 * JavaScriptCore.xcodeproj/project.pbxproj:
2064 * builtins/ArrayPrototype.js:
2065 (concatSlowPath): Deleted.
2067 * bytecode/BytecodeIntrinsicRegistry.cpp:
2068 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): Deleted.
2069 * bytecode/BytecodeIntrinsicRegistry.h:
2070 * dfg/DFGAbstractInterpreterInlines.h:
2071 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2072 * dfg/DFGByteCodeParser.cpp:
2073 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
2074 (JSC::DFG::ByteCodeParser::handleIntrinsicCall): Deleted.
2075 * dfg/DFGClobberize.h:
2076 (JSC::DFG::clobberize):
2077 * dfg/DFGDoesGC.cpp:
2078 (JSC::DFG::doesGC): Deleted.
2079 * dfg/DFGFixupPhase.cpp:
2080 (JSC::DFG::FixupPhase::fixupNode):
2081 * dfg/DFGNodeType.h:
2082 * dfg/DFGOperations.cpp:
2083 * dfg/DFGOperations.h:
2084 * dfg/DFGPredictionPropagationPhase.cpp:
2085 * dfg/DFGSafeToExecute.h:
2086 (JSC::DFG::safeToExecute): Deleted.
2087 * dfg/DFGSpeculativeJIT.cpp:
2088 (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
2089 (JSC::DFG::SpeculativeJIT::compileIsJSArray): Deleted.
2090 (JSC::DFG::SpeculativeJIT::compileIsArrayObject): Deleted.
2091 (JSC::DFG::SpeculativeJIT::compileIsArrayConstructor): Deleted.
2092 (JSC::DFG::SpeculativeJIT::compileCallObjectConstructor): Deleted.
2093 * dfg/DFGSpeculativeJIT.h:
2094 (JSC::DFG::SpeculativeJIT::callOperation): Deleted.
2095 * dfg/DFGSpeculativeJIT32_64.cpp:
2096 (JSC::DFG::SpeculativeJIT::compile): Deleted.
2097 * dfg/DFGSpeculativeJIT64.cpp:
2098 (JSC::DFG::SpeculativeJIT::compile):
2099 * ftl/FTLCapabilities.cpp:
2100 (JSC::FTL::canCompile): Deleted.
2101 * ftl/FTLLowerDFGToB3.cpp:
2102 (JSC::FTL::DFG::LowerDFGToB3::compileNode): Deleted.
2103 (JSC::FTL::DFG::LowerDFGToB3::compileCallObjectConstructor): Deleted.
2104 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayObject): Deleted.
2105 (JSC::FTL::DFG::LowerDFGToB3::compileIsJSArray): Deleted.
2106 (JSC::FTL::DFG::LowerDFGToB3::compileIsArrayConstructor): Deleted.
2107 (JSC::FTL::DFG::LowerDFGToB3::isArray): Deleted.
2108 * jit/JITOperations.h:
2110 (GlobalObject::finishCreation):
2111 (functionDataLogValue): Deleted.
2112 * runtime/ArrayConstructor.cpp:
2113 (JSC::ArrayConstructor::finishCreation):
2114 (JSC::arrayConstructorPrivateFuncIsArrayConstructor):
2115 * runtime/ArrayConstructor.h:
2116 (JSC::isArrayConstructor): Deleted.
2117 * runtime/ArrayPrototype.cpp:
2118 (JSC::ArrayPrototype::finishCreation):
2119 (JSC::arrayProtoFuncConcat):
2120 (JSC::arrayProtoPrivateFuncIsJSArray): Deleted.
2121 (JSC::moveElements): Deleted.
2122 (JSC::arrayProtoPrivateFuncConcatMemcpy): Deleted.
2123 (JSC::arrayProtoPrivateFuncAppendMemcpy): Deleted.
2124 * runtime/ArrayPrototype.h:
2125 * runtime/CommonIdentifiers.h:
2126 * runtime/Intrinsic.h:
2127 * runtime/JSArray.cpp:
2128 (JSC::JSArray::fastConcatWith):
2129 (JSC::JSArray::appendMemcpy): Deleted.
2130 * runtime/JSArray.h:
2131 (JSC::JSArray::fastConcatType):
2132 (JSC::JSArray::createStructure):
2134 * runtime/JSArrayInlines.h: Removed.
2135 (JSC::JSArray::memCopyWithIndexingType): Deleted.
2136 (JSC::JSArray::canFastCopy): Deleted.
2137 * runtime/JSGlobalObject.cpp:
2138 (JSC::JSGlobalObject::init):
2140 * runtime/ObjectConstructor.h:
2141 (JSC::constructObject): Deleted.
2143 * tests/stress/array-concat-spread-object.js: Removed.
2145 * tests/stress/array-concat-spread-proxy-exception-check.js: Removed.
2147 * tests/stress/array-concat-spread-proxy.js: Removed.
2149 * tests/stress/array-concat-with-slow-indexingtypes.js: Removed.
2151 * tests/stress/array-species-config-array-constructor.js:
2153 2016-04-27 Michael Saboff <msaboff@apple.com>
2155 REGRESSION(r200117): Crash in lowerDFGToB3::compileStringReplace()
2156 https://bugs.webkit.org/show_bug.cgi?id=157099
2158 Reviewed by Saam Barati.
2160 Given that the DFGFixupPhase could mark the edge of child2 as StringUse,
2161 we need to lower that edge appropriately.
2163 * ftl/FTLLowerDFGToB3.cpp:
2164 (JSC::FTL::DFG::LowerDFGToB3::compileStringReplace):
2166 2016-04-27 Mark Lam <mark.lam@apple.com>
2168 Address feedback from https://bugs.webkit.org/show_bug.cgi?id=157048#c5.
2169 https://bugs.webkit.org/show_bug.cgi?id=157096
2171 Reviewed by Geoffrey Garen.
2173 1. Check for USE(APPLE_INTERNAL_SDK) instead of __has_include(<mach-o/dyld_priv.h>).
2174 2. Rename webkitFirstSDKVersionWithInitConstructorSupport to
2175 firstSDKVersionWithInitConstructorSupport.
2177 * API/JSWrapperMap.mm:
2178 (supportsInitMethodConstructors):
2180 2016-04-27 Mark Lam <mark.lam@apple.com>
2182 Restrict the availability of some JSC options to local debug builds only.
2183 https://bugs.webkit.org/show_bug.cgi?id=157058
2185 Reviewed by Geoffrey Garen.
2187 1. Each option will be given an availability flag.
2188 2. The functionOverrides and useDollarVM (along with its alias, enableDollarVM)
2189 will have "Restricted" availability.
2190 3. All other options will have “Normal” availability.
2191 4. Any options with "Restricted" availability will only be accessible if function
2192 allowRestrictedOptions() returns true.
2193 5. For now, allowRestrictedOptions() always returns false for release builds, and
2194 true for debug builds.
2196 If an option is "Restricted" and restricted options are not allowed, the VM will
2197 behave semantically as if that option does not exist at all:
2198 1. Option dumps will not show the option.
2199 2. Attempts to set the option will fail as if the option does not exist.
2201 Behind the scene, the option does exist, and is set to its default value
2202 (whatever that may be) once and only once on options initialization.
2204 * runtime/Options.cpp:
2205 (JSC::allowRestrictedOptions):
2207 (JSC::overrideOptionWithHeuristic):
2208 (JSC::Options::initialize):
2209 (JSC::Options::setOptionWithoutAlias):
2210 (JSC::Options::dumpOption):
2211 * runtime/Options.h:
2212 (JSC::Option::type):
2213 (JSC::Option::availability):
2214 (JSC::Option::isOverridden):
2216 2016-04-27 Gavin Barraclough <barraclough@apple.com>
2218 Enable separated heap by default on ios
2219 https://bugs.webkit.org/show_bug.cgi?id=156720
2220 <rdar://problem/25841790>
2222 Unreviewed rollout - caused memory regression.
2224 * runtime/Options.cpp:
2225 (JSC::recomputeDependentOptions):
2227 2016-04-27 Benjamin Poulain <bpoulain@apple.com>
2229 Follow up for r200113 on 32bit
2231 I forgot to do the 32bit counterpart of r200113.
2232 The test fails on the bots.
2234 * dfg/DFGSpeculativeJIT32_64.cpp:
2235 (JSC::DFG::SpeculativeJIT::compile):
2237 2016-04-27 Alberto Garcia <berto@igalia.com>
2239 [GTK] Fails to build randomly when generating LLIntDesiredOffsets.h
2240 https://bugs.webkit.org/show_bug.cgi?id=155427
2242 Reviewed by Carlos Garcia Campos.
2244 If the build directory contains the -I string, the script that
2245 generates LLIntDesiredOffsets.h will confuse it with an option to
2246 declare an include directory.
2248 In order to avoid that we should only use the arguments that start
2249 with -I when extracting the list of include directories, instead
2250 of using the ones that simply contain that string.
2252 * offlineasm/parser.rb:
2254 2016-04-27 Saam barati <sbarati@apple.com>
2256 JSC should have an option to allow global const redeclarations
2257 https://bugs.webkit.org/show_bug.cgi?id=157006
2259 Reviewed by Geoffrey Garen.
2261 This patch implements an option that dictates whether
2262 const redeclarations at the program level will throw.
2263 This option defaults to true but allows users of JSC
2264 to set it to false. This option is per VM. This is needed
2265 for backwards compatibility with our old const implementation.
2268 (GlobalObject::finishCreation):
2269 (functionShadowChickenFunctionsOnStack):
2270 (functionSetGlobalConstRedeclarationShouldNotThrow):
2272 * runtime/Executable.cpp:
2273 (JSC::ProgramExecutable::initializeGlobalProperties):
2274 * runtime/JSGlobalLexicalEnvironment.cpp:
2275 (JSC::JSGlobalLexicalEnvironment::put):
2276 (JSC::JSGlobalLexicalEnvironment::isConstVariable):
2277 * runtime/JSGlobalLexicalEnvironment.h:
2278 (JSC::JSGlobalLexicalEnvironment::isEmpty):
2280 (JSC::VM::setGlobalConstRedeclarationShouldThrow):
2281 (JSC::VM::globalConstRedeclarationShouldThrow):
2282 * tests/stress/global-const-redeclaration-setting: Added.
2283 * tests/stress/global-const-redeclaration-setting-2.js: Added.
2285 * tests/stress/global-const-redeclaration-setting-3.js: Added.
2288 * tests/stress/global-const-redeclaration-setting-4.js: Added.
2291 * tests/stress/global-const-redeclaration-setting-5.js: Added.
2294 * tests/stress/global-const-redeclaration-setting.js: Added.
2296 * tests/stress/global-const-redeclaration-setting/first.js: Added.
2297 * tests/stress/global-const-redeclaration-setting/let.js: Added.
2298 * tests/stress/global-const-redeclaration-setting/second.js: Added.
2299 * tests/stress/global-const-redeclaration-setting/strict.js: Added.
2301 2016-04-26 Michael Saboff <msaboff@apple.com>
2303 [ES] Implement RegExp.prototype.@@replace and use it for String.prototype.replace
2304 https://bugs.webkit.org/show_bug.cgi?id=156562
2306 Reviewed by Filip Pizlo.
2308 Added builtins for String.prototype.replace as well as RegExp.prototype[Symbol.replace].
2310 The String.prototype.replace also has an intrinsic, StringPrototypeReplaceIntrinsic.
2311 This original intrinsic was copied to make StringPrototypeReplaceRegExpIntrinsic.
2312 The difference between the two intrinsics is that StringPrototypeReplaceIntrinsic has
2313 the same checks found in the new builtin hasObservableSideEffectsForStringReplace.
2314 We implement these primordial checks for StringPrototypeReplaceIntrinsic in two places.
2315 First, we do a trial check during ByteCode parsing time to see if the current
2316 RegExp.prototype properties have changed from the original. If they have, we don't
2317 inline the intrinsic. Later, in the fixup phase, we add nodes to the IR to emit the
2320 The new intrinsic StringPrototypeReplaceRegExpIntrinsic is only available via the
2321 private @replaceUsingRegExp, which is called in the String.prototype.replace builtin.
2322 It is only called after hasObservableSideEffectsForStringReplace has been called
2324 Both of these intrinsics are needed, because the JS code containing String.replace() calls
2325 runs initially in the LLint and then the baseline JIT. Even after the function tiers up
2326 to the DFG JIT, the inlining budget may not allow StringPrototypeReplaceIntrinsic to be inlined.
2327 Having StringPrototypeReplaceRegExpIntrinsic allows for the String.prototype.replace builtin to
2328 get reasonable performance before the other intrinsic is inlined or when it can't.
2330 * builtins/RegExpPrototype.js:
2336 * builtins/StringPrototype.js:
2338 (hasObservableSideEffectsForStringReplace):
2339 (intrinsic.StringPrototypeReplaceIntrinsic.replace):
2341 New builtins for String.prototype.replace and RegExp.prototype[Symbol.replace].
2343 * bytecode/BytecodeIntrinsicRegistry.cpp:
2344 * bytecode/BytecodeIntrinsicRegistry.h:
2345 * dfg/DFGAbstractInterpreterInlines.h:
2346 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2347 * dfg/DFGByteCodeParser.cpp:
2348 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
2349 * dfg/DFGClobberize.h:
2350 (JSC::DFG::clobberize):
2351 * dfg/DFGDoesGC.cpp:
2353 * dfg/DFGFixupPhase.cpp:
2354 (JSC::DFG::FixupPhase::fixupNode):
2355 (JSC::DFG::FixupPhase::fixupGetAndSetLocalsInBlock):
2356 (JSC::DFG::FixupPhase::tryAddStringReplacePrimordialChecks):
2357 (JSC::DFG::FixupPhase::checkArray):
2359 (JSC::DFG::Graph::getRegExpPrototypeProperty):
2361 (JSC::DFG::Graph::getRegExpPrototypeProperty):
2363 (JSC::DFG::Node::hasHeapPrediction):
2364 * dfg/DFGNodeType.h:
2365 * dfg/DFGPredictionPropagationPhase.cpp:
2366 * dfg/DFGSafeToExecute.h:
2367 (JSC::DFG::safeToExecute):
2368 * dfg/DFGSpeculativeJIT32_64.cpp:
2369 (JSC::DFG::SpeculativeJIT::compile):
2370 * dfg/DFGSpeculativeJIT64.cpp:
2371 (JSC::DFG::SpeculativeJIT::compile):
2372 * dfg/DFGStrengthReductionPhase.cpp:
2373 (JSC::DFG::StrengthReductionPhase::handleNode):
2374 * ftl/FTLCapabilities.cpp:
2375 (JSC::FTL::canCompile):
2376 * ftl/FTLLowerDFGToB3.cpp:
2377 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
2378 * runtime/CommonIdentifiers.h:
2379 * runtime/Intrinsic.h:
2380 * runtime/RegExpPrototype.cpp:
2381 (JSC::RegExpPrototype::finishCreation):
2382 * runtime/StringPrototype.cpp:
2383 (JSC::StringPrototype::finishCreation):
2385 (JSC::stringProtoFuncReplaceUsingRegExp):
2386 (JSC::stringProtoFuncReplaceUsingStringSearch):
2387 (JSC::operationStringProtoFuncReplaceGeneric):
2388 (JSC::stringProtoFuncReplace): Deleted.
2389 Added StringReplaceRegExp intrinsic. Added checks for RegExp profiled arguments to StringReplace
2390 that mirror what is in hasObservableSideEffectsForStringReplace(). If we aren't able to add the
2391 checks, we OSR exit. Add Graph::getPrimordialRegExpPrototypeProperty() as a helper to get the
2392 primordial values from RegExp.prototype.
2394 * runtime/JSGlobalObject.cpp:
2395 (JSC::JSGlobalObject::init): Added @regExpPrototypeSymbolReplace and
2396 @hasObservableSideEffectsForStringReplace here instead og String.prototype so that we reduce the
2397 number of objects we have to traverse.
2399 * tests/es6.yaml: Changed expectations for the various replace related tests to passing.
2401 * tests/stress/regexp-replace-proxy.js:
2403 (let.getProxyNullExec.new.Proxy):
2404 (let.getSetProxyNullExec.new.Proxy):
2405 (get resetTracking):
2406 (let.getSetProxyMatches_comma.new.Proxy):
2407 (set get getSetProxyNullExec):
2408 (let.getSetProxyReplace_phoneNumber.new.Proxy):
2409 (set get getSetProxyMatches_comma):
2410 (let.getSetProxyReplaceUnicode_digit_nonGreedy.new.Proxy):
2411 (set get resetTracking):
2412 * tests/stress/string-replace-proxy.js:
2414 (let.getSetProxyReplace.new.Proxy.replace):
2417 2016-04-26 Mark Lam <mark.lam@apple.com>
2419 Gardening: speculative build fix.
2423 * API/JSWrapperMap.mm:
2425 2016-04-26 Mark Lam <mark.lam@apple.com>
2427 Update the compatibility version check for the ObjC API's InitConstructorSupport to use dyld_get_program_sdk_version().
2428 https://bugs.webkit.org/show_bug.cgi?id=157048
2430 Reviewed by Geoffrey Garen.
2432 * API/JSWrapperMap.mm:
2433 (supportsInitMethodConstructors):
2434 (getJSExportProtocol):
2436 2016-04-26 Benjamin Poulain <bpoulain@apple.com>
2438 [JSC] GetByVal on Undecided use its children before its OSR Exit
2439 https://bugs.webkit.org/show_bug.cgi?id=157046
2441 Reviewed by Mark Lam.
2443 Very silly bug: GetByVal on Undecided uses its children before
2444 the speculationCheck(). If we fail the speculation, we have already
2445 lost how to recover the values.
2447 The existing tests did not catch this because we tier up to B3
2448 before such Exits happen. B3 has explicit liveness and did not suffer
2450 The new test has a smaller warmup to exercise the OSR Exit in DFG
2453 * dfg/DFGSpeculativeJIT64.cpp:
2454 (JSC::DFG::SpeculativeJIT::compile):
2455 * tests/stress/get-by-val-on-undecided-out-of-bounds.js: Added.
2456 (string_appeared_here.opaqueGetByValKnownArray):
2458 2016-04-26 Skachkov Oleksandr <gskachkov@gmail.com>
2460 calling super() a second time in a constructor should throw
2461 https://bugs.webkit.org/show_bug.cgi?id=151113
2463 Reviewed by Saam Barati.
2465 Currently, our implementation checks if 'super()' was called in a constructor more
2466 than once and raises a RuntimeError before the second call. According to the spec
2467 we need to raise an error just after the second super() is finished and before
2468 the new 'this' is assigned https://esdiscuss.org/topic/duplicate-super-call-behaviour.
2469 To implement this behavior this patch adds a new op code, op_is_empty, that is used
2470 to check if 'this' is empty.
2472 * bytecode/BytecodeList.json:
2473 * bytecode/BytecodeUseDef.h:
2474 (JSC::computeUsesForBytecodeOffset):
2475 (JSC::computeDefsForBytecodeOffset):
2476 * bytecode/CodeBlock.cpp:
2477 (JSC::CodeBlock::dumpBytecode):
2478 * bytecompiler/BytecodeGenerator.cpp:
2479 (JSC::BytecodeGenerator::emitIsEmpty):
2480 * bytecompiler/BytecodeGenerator.h:
2481 * bytecompiler/NodesCodegen.cpp:
2482 (JSC::FunctionCallValueNode::emitBytecode):
2483 * dfg/DFGAbstractInterpreterInlines.h:
2484 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2485 * dfg/DFGByteCodeParser.cpp:
2486 (JSC::DFG::ByteCodeParser::parseBlock):
2487 * dfg/DFGCapabilities.cpp:
2488 (JSC::DFG::capabilityLevel):
2489 * dfg/DFGClobberize.h:
2490 (JSC::DFG::clobberize):
2491 * dfg/DFGDoesGC.cpp:
2493 * dfg/DFGFixupPhase.cpp:
2494 (JSC::DFG::FixupPhase::fixupNode):
2495 * dfg/DFGNodeType.h:
2496 * dfg/DFGPredictionPropagationPhase.cpp:
2497 * dfg/DFGSafeToExecute.h:
2498 (JSC::DFG::safeToExecute):
2499 * dfg/DFGSpeculativeJIT32_64.cpp:
2500 (JSC::DFG::SpeculativeJIT::compile):
2501 * dfg/DFGSpeculativeJIT64.cpp:
2502 (JSC::DFG::SpeculativeJIT::compile):
2503 * ftl/FTLCapabilities.cpp:
2504 (JSC::FTL::canCompile):
2505 * ftl/FTLLowerDFGToB3.cpp:
2506 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
2507 (JSC::FTL::DFG::LowerDFGToB3::compileIsEmpty):
2509 (JSC::JIT::privateCompileMainPass):
2511 * jit/JITOpcodes.cpp:
2512 (JSC::JIT::emit_op_is_empty):
2513 * jit/JITOpcodes32_64.cpp:
2514 (JSC::JIT::emit_op_is_empty):
2515 * llint/LowLevelInterpreter32_64.asm:
2516 * llint/LowLevelInterpreter64.asm:
2517 * tests/stress/class-syntax-double-constructor.js: Added.
2519 2016-04-26 Mark Lam <mark.lam@apple.com>
2521 Changed jsc options title to be more descriptive.
2522 https://bugs.webkit.org/show_bug.cgi?id=157036
2524 Reviewed by Joseph Pecoraro.
2526 Let the title for --dumpOptions be "Modified JSC runtime options:" since it only
2527 dumps overridden options. The title for --options will remain "All JSC runtime
2528 options:" since it dumps all all options with verbose detail.
2531 (CommandLine::parseArguments):
2533 2016-04-26 Oliver Hunt <oliver@apple.com>
2535 Enable separated heap by default on ios
2536 https://bugs.webkit.org/show_bug.cgi?id=156720
2538 Unreviewed roll-in of this change. There is only one
2539 additional allocation involved in this logic, and that
2540 is a duplicate mapping.
2542 Either our tools are not report real memory usage
2543 or this revision is not responsible for the regression.
2545 * runtime/Options.cpp:
2546 (JSC::recomputeDependentOptions):
2548 2016-04-26 Filip Pizlo <fpizlo@apple.com>
2550 DFG backends shouldn't emit type checks at KnownBlah edges
2551 https://bugs.webkit.org/show_bug.cgi?id=157025
2553 Reviewed by Michael Saboff.
2555 This fixes a crash I found when browsing Bing maps with forceEagerCompilation. I include a
2556 100% repro test case.
2558 The issue is that our code still doesn't fully appreciate the devious implications of
2559 KnownBlah use kinds. Consider KnownCell for example. It means: "trust me, I know that this
2560 value will be a cell". You aren't required to provide a proof when you use KnownCell. Often,
2561 we use it as a result of a path-sensitive proof. The abstract interpreter is not
2562 path-sensitive, so AI will be absolutely sure that the KnownCell use might see a non-cell.
2563 This can lead to debug assertions (which this change removes) and it can lead to the backends
2564 emitting a type check. That type check can be pure evil if the node that has this edge does
2565 not have an exit origin. Such a node would have passed validation because the validater would
2566 have thought that the node cannot exit (after all, according to the IR semantics, there is no
2567 speculation at KnownCell).
2569 This comprehensively fixes the issue by recognizing that Foo(KnownCell:@x) means: I have
2570 already proved that by the time you start executing Foo, @x will already be a cell. I cannot
2571 tell you how I proved this but you can rely on it anyway. AI now takes advantage of this
2572 meaning and will always do filtering of KnownBlah edges regardless of whether the backend
2573 actually emits any type checks for those edges. Since the filtering runs before the backend,
2574 the backend will not emit any checks because it will know that the edge was already checked
2575 (by whatever mechanism we used when we made the edge KnownBlah).
2577 Note that it's good that we found this bug now. The DFG currently does very few
2578 sparse-conditional or path-sensitive optimizations, but it will probably do more in the
2579 future. The bug happens because GetByOffset and friends can achieve path-sensitive proofs via
2580 watchpoints on the inferred type. Normally, AI can follow along with this proof. But in the
2581 example program, and on Bing maps, we would GCSE one GetByOffset with another that had a
2582 weaker proven type. That turned out to be completely sound - between the two GetByOffset's
2583 there was a Branch to null check it. The inferred type of the second GetByOffset ended up
2584 knowing that it cannot be null because null only occurred in some structures but not others.
2585 If we added more sparse-conditional stuff to Branch, then AI would know how to follow along
2586 with the proof but it would also create more situations where we'd have a path-sensitive
2587 proof. So, it's good that we're now getting this right.
2589 * dfg/DFGAbstractInterpreter.h:
2590 (JSC::DFG::AbstractInterpreter::filterEdgeByUse):
2591 * dfg/DFGAbstractInterpreterInlines.h:
2592 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEdges):
2593 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeKnownEdgeTypes):
2594 (JSC::DFG::AbstractInterpreter<AbstractStateType>::verifyEdge):
2595 * dfg/DFGSpeculativeJIT.cpp:
2596 (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
2598 (JSC::DFG::typeFilterFor):
2599 * ftl/FTLLowerDFGToB3.cpp:
2600 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
2601 * tests/stress/path-sensitive-known-cell-crash.js: Added.
2605 2016-04-26 Gavin Barraclough <barraclough@apple.com>
2607 Enable separated heap by default on ios
2608 https://bugs.webkit.org/show_bug.cgi?id=156720
2610 Unreviewed rollout - caused memory regression.
2612 * runtime/Options.cpp:
2613 (JSC::recomputeDependentOptions):
2615 2016-04-26 Joseph Pecoraro <pecoraro@apple.com>
2617 Improve jsc --help and making sampling options
2618 https://bugs.webkit.org/show_bug.cgi?id=157015
2620 Reviewed by Saam Barati.
2622 Simplify sampling options to be easier to remember:
2624 * --reportSamplingProfilerData => --sample
2625 * --samplingProfilerTimingInterval => --sampleInterval
2627 Update the --help to mention --sample, and restore the behavior of
2628 --options outputing all possible options so you can discover which
2629 options are available.
2632 (printUsageStatement):
2633 (CommandLine::parseArguments):
2634 Improve help and modify option dumping.
2636 * runtime/Options.h:
2637 * runtime/SamplingProfiler.cpp:
2638 (JSC::SamplingProfiler::SamplingProfiler):
2639 Rename the sampling interval option.
2641 2016-04-26 Commit Queue <commit-queue@webkit.org>
2643 Unreviewed, rolling out r200083.
2644 https://bugs.webkit.org/show_bug.cgi?id=157033
2646 It brokes the debug build (Requested by gskachkov on
2651 "calling super() a second time in a constructor should throw"
2652 https://bugs.webkit.org/show_bug.cgi?id=151113
2653 http://trac.webkit.org/changeset/200083
2655 2016-04-26 Skachkov Oleksandr <gskachkov@gmail.com>
2657 calling super() a second time in a constructor should throw
2658 https://bugs.webkit.org/show_bug.cgi?id=151113
2660 Reviewed by Saam Barati.
2662 Currently, our implementation checks if 'super()' was called in a constructor more
2663 than once and raises a RuntimeError before the second call. According to the spec
2664 we need to raise an error just after the second super() is finished and before
2665 the new 'this' is assigned https://esdiscuss.org/topic/duplicate-super-call-behaviour.
2666 To implement this behavior this patch adds a new op code, op_is_empty, that is used
2667 to check if 'this' is empty.
2669 * bytecode/BytecodeList.json:
2670 * bytecode/BytecodeUseDef.h:
2671 (JSC::computeUsesForBytecodeOffset):
2672 (JSC::computeDefsForBytecodeOffset):
2673 * bytecode/CodeBlock.cpp:
2674 (JSC::CodeBlock::dumpBytecode):
2675 * bytecompiler/BytecodeGenerator.cpp:
2676 (JSC::BytecodeGenerator::emitIsEmpty):
2677 * bytecompiler/BytecodeGenerator.h:
2678 * bytecompiler/NodesCodegen.cpp:
2679 (JSC::FunctionCallValueNode::emitBytecode):
2680 * dfg/DFGAbstractInterpreterInlines.h:
2681 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2682 * dfg/DFGByteCodeParser.cpp:
2683 (JSC::DFG::ByteCodeParser::parseBlock):
2684 * dfg/DFGCapabilities.cpp:
2685 (JSC::DFG::capabilityLevel):
2686 * dfg/DFGClobberize.h:
2687 (JSC::DFG::clobberize):
2688 * dfg/DFGDoesGC.cpp:
2690 * dfg/DFGFixupPhase.cpp:
2691 (JSC::DFG::FixupPhase::fixupNode):
2692 * dfg/DFGNodeType.h:
2693 * dfg/DFGSafeToExecute.h:
2694 (JSC::DFG::safeToExecute):
2695 * dfg/DFGSpeculativeJIT32_64.cpp:
2696 (JSC::DFG::SpeculativeJIT::compile):
2697 * dfg/DFGSpeculativeJIT64.cpp:
2698 (JSC::DFG::SpeculativeJIT::compile):
2699 * ftl/FTLCapabilities.cpp:
2700 (JSC::FTL::canCompile):
2701 * ftl/FTLLowerDFGToB3.cpp:
2702 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
2703 (JSC::FTL::DFG::LowerDFGToB3::compileIsEmpty):
2705 (JSC::JIT::privateCompileMainPass):
2707 * jit/JITOpcodes.cpp:
2708 (JSC::JIT::emit_op_is_empty):
2709 * jit/JITOpcodes32_64.cpp:
2710 (JSC::JIT::emit_op_is_empty):
2711 * llint/LowLevelInterpreter32_64.asm:
2712 * llint/LowLevelInterpreter64.asm:
2713 * tests/stress/class-syntax-double-constructor.js: Added.
2715 2016-04-25 Ryosuke Niwa <rniwa@webkit.org>
2717 Remove the build flag for template elements
2718 https://bugs.webkit.org/show_bug.cgi?id=157022
2720 Reviewed by Daniel Bates.
2722 * Configurations/FeatureDefines.xcconfig:
2724 2016-04-25 Benjamin Poulain <bpoulain@apple.com>
2726 [JSC] Constant folding of UInt32ToNumber is incorrect
2727 https://bugs.webkit.org/show_bug.cgi?id=157011
2728 rdar://problem/25769641
2730 Reviewed by Geoffrey Garen.
2732 UInt32ToNumber should return the unsigned 32bit value of
2733 its child. The abstract interpreter fails to do that when handling
2736 None of the tests caught that because the bytecode generator already
2737 fold the operation if given a constant. If the constant is not visible
2738 from the bytecode generator (for example because it comes from an inlined call),
2739 then the abstract interpreter folding was producing invalid results.
2741 * dfg/DFGAbstractInterpreterInlines.h:
2742 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2743 * tests/stress/uint32-to-number-constant-folding.js: Added.
2744 (uint32ToNumberMinusOne):
2745 (uint32ToNumberMinusOnePlusInteger):
2747 (uint32ToNumberOnHiddenMinusOne):
2748 (uint32ToNumberOnHiddenMinusOnePlusInteger):
2749 (inlineLargeNegativeNumber1):
2750 (inlineLargeNegativeNumber2):
2751 (inlineLargeNegativeNumber3):
2752 (uint32ToNumberOnHiddenLargeNegativeNumber1):
2753 (uint32ToNumberOnHiddenLargeNegativeNumber2):
2754 (uint32ToNumberOnHiddenLargeNegativeNumber3):
2756 2016-04-25 Fujii Hironori <Hironori.Fujii@sony.com>
2758 Heap corruption is detected when destructing JSGlobalObject
2759 https://bugs.webkit.org/show_bug.cgi?id=156831
2761 Reviewed by Mark Lam.
2763 WebKit uses CRT static library on Windows. Each copy of the CRT
2764 library has its own heap manager, allocating memory in one CRT
2765 library and passing the pointer across a DLL boundary to be freed
2766 by a different copy of the CRT library is a potential cause for
2769 Potential Errors Passing CRT Objects Across DLL Boundaries
2770 <https://msdn.microsoft.com/en-us/library/ms235460(v=vs.140).aspx>
2772 JSGlobalObject::createRareDataIfNeeded is inlined but
2773 JSGlobalObject::~JSGlobalObject is not. Then, the heap of
2774 allocating JSGlobalObjectRareData is WebKit.dll, but deallocating
2775 JavaScriptCore.dll. Adding WTF_MAKE_FAST_ALLOCATED to
2776 JSGlobalObjectRareData ensures heap consistency of it. WTF::Lock
2777 also needs WTF_MAKE_FAST_ALLOCATED because it is allocated from
2778 the inlined constructor of JSGlobalObjectRareData.
2780 Test: fast/dom/insertedIntoDocument-iframe.html
2782 * runtime/JSGlobalObject.h:
2783 Add WTF_MAKE_FAST_ALLOCATED to JSGlobalObjectRareData.
2785 2016-04-25 Michael Saboff <msaboff@apple.com>
2787 Crash using @tryGetById in DFG
2788 https://bugs.webkit.org/show_bug.cgi?id=156992
2790 Reviewed by Filip Pizlo.
2792 We need to spill live registers when compiling TryGetById in DFG.
2794 * dfg/DFGSpeculativeJIT.cpp:
2795 (JSC::DFG::SpeculativeJIT::compileTryGetById):
2796 * tests/stress/regress-156992.js: New test.
2797 (tryMultipleGetByIds):
2800 2016-04-25 Saam barati <sbarati@apple.com>
2802 We don't have to parse a function's parameters every time if the function is in the source provider cache
2803 https://bugs.webkit.org/show_bug.cgi?id=156943
2805 Reviewed by Filip Pizlo.
2807 This patch makes a few changes to make parsing inner functions
2810 First, we were always parsing an inner function's parameter
2811 list using the templatized TreeBuiler. This means if our parent scope
2812 was building an AST, we ended up building AST nodes for the inner
2813 function's parameter list even though these nodes would go unused.
2814 This patch fixes that to *always* build an inner function's parameter
2815 list using the SyntaxChecker. (Note that this is consistent now with
2816 always building an inner function's body with a SyntaxChecker.)
2818 Second, we were always parsing an inner function's parameter list
2819 even if we had that function saved in the source provider cache.
2820 I've fixed that bug and made it so that we skip over the parsing
2821 of a function's parameter list when it's in the source provider
2822 cache. We could probably enhance this in the future to skip
2823 over the entirety of a function starting at the "function"
2824 keyword or any other start of the function (depending on
2825 the function type: arrow function, method, etc).
2827 This patch also renames a few fields. First, I fixed a typo
2828 from "tocken" => "token" for a few field names. Secondly,
2829 I renamed a field that was called 'bodyStartColumn' to
2830 'parametersStartColumn' because the field really held the
2831 parameter list's start column.
2833 I'm benchmarking this as a 1.5-2% octane/jquery speedup
2836 * parser/ASTBuilder.h:
2837 (JSC::ASTBuilder::createFunctionExpr):
2838 (JSC::ASTBuilder::createMethodDefinition):
2839 (JSC::ASTBuilder::createArrowFunctionExpr):
2840 (JSC::ASTBuilder::createGetterOrSetterProperty):
2841 (JSC::ASTBuilder::createFuncDeclStatement):
2843 (JSC::Lexer<T>::lex):
2845 (JSC::Lexer::currentPosition):
2846 (JSC::Lexer::positionBeforeLastNewline):
2847 (JSC::Lexer::lastTokenLocation):
2848 (JSC::Lexer::setLastLineNumber):
2849 (JSC::Lexer::lastLineNumber):
2850 (JSC::Lexer::prevTerminator):
2851 * parser/Parser.cpp:
2852 (JSC::Parser<LexerType>::parseInner):
2853 (JSC::Parser<LexerType>::parseGeneratorFunctionSourceElements):
2854 (JSC::Parser<LexerType>::parseFunctionBody):
2855 (JSC::stringForFunctionMode):
2856 (JSC::Parser<LexerType>::parseFunctionParameters):
2857 (JSC::Parser<LexerType>::parseFunctionInfo):
2859 (JSC::Scope::usedVariablesContains):
2860 (JSC::Scope::forEachUsedVariable):
2861 (JSC::Scope::useVariable):
2862 (JSC::Scope::copyCapturedVariablesToVector):
2863 (JSC::Scope::fillParametersForSourceProviderCache):
2864 (JSC::Scope::restoreFromSourceProviderCache):
2865 * parser/ParserFunctionInfo.h:
2866 * parser/SourceProviderCacheItem.h:
2867 (JSC::SourceProviderCacheItem::endFunctionToken):
2868 (JSC::SourceProviderCacheItem::usedVariables):
2869 (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
2871 2016-04-25 Mark Lam <mark.lam@apple.com>
2873 Renaming SpecInt32, SpecInt52, MachineInt to SpecInt32Only, SpecInt52Only, AnyInt.
2874 https://bugs.webkit.org/show_bug.cgi?id=156941
2876 Reviewed by Filip Pizlo.
2878 While looking at https://bugs.webkit.org/show_bug.cgi?id=153431, it was decided
2879 that SpecInt32Only, SpecInt52Only, and AnyInt would be better names for
2880 SpecInt32, SpecInt52, and MachineInt. Let's do a bulk rename.
2882 This is only a renaming patch, and deletion of a piece of unused code. There are
2883 no semantic changes.
2885 * bindings/ScriptValue.cpp:
2886 (Inspector::jsToInspectorValue):
2887 * bytecode/SpeculatedType.cpp:
2888 (JSC::dumpSpeculation):
2889 (JSC::speculationToAbbreviatedString):
2890 (JSC::speculationFromValue):
2891 (JSC::leastUpperBoundOfStrictlyEquivalentSpeculations):
2892 (JSC::typeOfDoubleNegation):
2893 (JSC::typeOfDoubleRounding):
2894 * bytecode/SpeculatedType.h:
2895 (JSC::isInt32Speculation):
2896 (JSC::isInt32OrBooleanSpeculation):
2897 (JSC::isInt32SpeculationForArithmetic):
2898 (JSC::isInt32OrBooleanSpeculationForArithmetic):
2899 (JSC::isInt32OrBooleanSpeculationExpectingDefined):
2900 (JSC::isInt52Speculation):
2901 (JSC::isAnyIntSpeculation):
2902 (JSC::isAnyIntAsDoubleSpeculation):
2903 (JSC::isDoubleRealSpeculation):
2904 (JSC::isMachineIntSpeculation): Deleted.
2905 (JSC::isInt52AsDoubleSpeculation): Deleted.
2906 (JSC::isIntegerSpeculation): Deleted.
2907 * dfg/DFGAbstractInterpreterInlines.h:
2908 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
2909 * dfg/DFGAbstractValue.cpp:
2910 (JSC::DFG::AbstractValue::set):
2911 (JSC::DFG::AbstractValue::fixTypeForRepresentation):
2912 (JSC::DFG::AbstractValue::checkConsistency):
2913 (JSC::DFG::AbstractValue::resultType):
2914 * dfg/DFGAbstractValue.h:
2915 (JSC::DFG::AbstractValue::validateType):
2916 * dfg/DFGArgumentsUtilities.cpp:
2917 (JSC::DFG::emitCodeToGetArgumentsArrayLength):
2918 * dfg/DFGByteCodeParser.cpp:
2919 (JSC::DFG::ByteCodeParser::handleInlining):
2920 (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
2921 * dfg/DFGFixupPhase.cpp:
2922 (JSC::DFG::FixupPhase::fixupNode):
2923 (JSC::DFG::FixupPhase::fixupToThis):
2924 (JSC::DFG::FixupPhase::observeUseKindOnNode):
2925 (JSC::DFG::FixupPhase::fixIntConvertingEdge):
2926 (JSC::DFG::FixupPhase::fixIntOrBooleanEdge):
2927 (JSC::DFG::FixupPhase::fixDoubleOrBooleanEdge):
2928 (JSC::DFG::FixupPhase::truncateConstantToInt32):
2929 (JSC::DFG::FixupPhase::attemptToMakeIntegerAdd):
2930 (JSC::DFG::FixupPhase::prependGetArrayLength):
2931 (JSC::DFG::FixupPhase::fixupChecksInBlock):
2933 (JSC::DFG::Graph::addShouldSpeculateInt32):
2934 (JSC::DFG::Graph::addShouldSpeculateAnyInt):
2935 (JSC::DFG::Graph::binaryArithShouldSpeculateInt32):
2936 (JSC::DFG::Graph::binaryArithShouldSpeculateAnyInt):
2937 (JSC::DFG::Graph::unaryArithShouldSpeculateInt32):
2938 (JSC::DFG::Graph::unaryArithShouldSpeculateAnyInt):
2939 (JSC::DFG::Graph::addShouldSpeculateMachineInt): Deleted.
2940 (JSC::DFG::Graph::binaryArithShouldSpeculateMachineInt): Deleted.
2941 (JSC::DFG::Graph::unaryArithShouldSpeculateMachineInt): Deleted.
2942 * dfg/DFGInPlaceAbstractState.cpp:
2943 (JSC::DFG::InPlaceAbstractState::initialize):
2944 * dfg/DFGJITCompiler.cpp:
2945 (JSC::DFG::JITCompiler::noticeOSREntry):
2947 (JSC::DFG::Node::convertToIdentityOn):
2949 (JSC::DFG::Node::asNumber):
2950 (JSC::DFG::Node::isAnyIntConstant):
2951 (JSC::DFG::Node::asAnyInt):
2952 (JSC::DFG::Node::isBooleanConstant):
2953 (JSC::DFG::Node::shouldSpeculateInt32OrBooleanExpectingDefined):
2954 (JSC::DFG::Node::shouldSpeculateAnyInt):
2955 (JSC::DFG::Node::shouldSpeculateDouble):
2956 (JSC::DFG::Node::shouldSpeculateNumber):
2957 (JSC::DFG::Node::isMachineIntConstant): Deleted.
2958 (JSC::DFG::Node::asMachineInt): Deleted.
2959 (JSC::DFG::Node::shouldSpeculateMachineInt): Deleted.
2960 * dfg/DFGOSREntry.cpp:
2961 (JSC::DFG::OSREntryData::dumpInContext):
2962 (JSC::DFG::prepareOSREntry):
2963 * dfg/DFGOSREntry.h:
2964 * dfg/DFGPredictionPropagationPhase.cpp:
2965 * dfg/DFGSSALoweringPhase.cpp:
2966 (JSC::DFG::SSALoweringPhase::handleNode):
2967 (JSC::DFG::SSALoweringPhase::lowerBoundsCheck):
2968 * dfg/DFGSafeToExecute.h:
2969 (JSC::DFG::SafeToExecuteEdge::operator()):
2970 * dfg/DFGSpeculativeJIT.cpp:
2971 (JSC::DFG::SpeculativeJIT::silentFill):
2972 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
2973 (JSC::DFG::SpeculativeJIT::compileArithAdd):
2974 (JSC::DFG::SpeculativeJIT::compileArithSub):
2975 (JSC::DFG::SpeculativeJIT::compileArithNegate):
2976 (JSC::DFG::SpeculativeJIT::speculateInt32):
2977 (JSC::DFG::SpeculativeJIT::speculateNumber):
2978 (JSC::DFG::SpeculativeJIT::speculateMisc):
2979 (JSC::DFG::SpeculativeJIT::speculate):
2980 * dfg/DFGSpeculativeJIT.h:
2981 (JSC::DFG::SpeculativeJIT::spill):
2982 (JSC::DFG::SpeculativeJIT::isKnownInteger):
2983 (JSC::DFG::SpeculativeJIT::isKnownCell):
2984 (JSC::DFG::SpeculativeJIT::isKnownNotInteger):
2985 (JSC::DFG::SpeculativeJIT::isKnownNotNumber):
2986 (JSC::DFG::SpeculativeJIT::isKnownNotCell):
2987 (JSC::DFG::SpeculativeJIT::isKnownNotOther):
2988 * dfg/DFGSpeculativeJIT32_64.cpp:
2989 (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal):
2990 (JSC::DFG::SpeculativeJIT::compile):
2991 * dfg/DFGSpeculativeJIT64.cpp:
2992 (JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal):
2993 (JSC::DFG::SpeculativeJIT::fillSpeculateInt52):
2994 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
2995 (JSC::DFG::SpeculativeJIT::emitBranch):
2996 (JSC::DFG::SpeculativeJIT::compile):
2997 (JSC::DFG::SpeculativeJIT::blessBoolean):
2998 (JSC::DFG::SpeculativeJIT::convertAnyInt):
2999 (JSC::DFG::SpeculativeJIT::speculateAnyInt):
3000 (JSC::DFG::SpeculativeJIT::speculateDoubleRepAnyInt):
3001 (JSC::DFG::SpeculativeJIT::convertMachineInt): Deleted.
3002 (JSC::DFG::SpeculativeJIT::speculateMachineInt): Deleted.
3003 (JSC::DFG::SpeculativeJIT::speculateDoubleRepMachineInt): Deleted.
3004 * dfg/DFGUseKind.cpp:
3005 (WTF::printInternal):
3007 (JSC::DFG::typeFilterFor):
3008 (JSC::DFG::isNumerical):
3009 (JSC::DFG::isDouble):
3010 * dfg/DFGValidate.cpp:
3011 * dfg/DFGVariableAccessData.cpp:
3012 (JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
3013 (JSC::DFG::VariableAccessData::couldRepresentInt52Impl):
3014 (JSC::DFG::VariableAccessData::flushFormat):
3015 * ftl/FTLCapabilities.cpp:
3016 (JSC::FTL::canCompile):
3017 * ftl/FTLLowerDFGToB3.cpp:
3018 (JSC::FTL::DFG::LowerDFGToB3::compileInt52Constant):
3019 (JSC::FTL::DFG::LowerDFGToB3::compileInt52Rep):
3020 (JSC::FTL::DFG::LowerDFGToB3::compileArithAddOrSub):
3021 (JSC::FTL::DFG::LowerDFGToB3::compileArithNegate):
3022 (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
3023 (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
3024 (JSC::FTL::DFG::LowerDFGToB3::compileArrayPush):
3025 (JSC::FTL::DFG::LowerDFGToB3::lowInt32):
3026 (JSC::FTL::DFG::LowerDFGToB3::strictInt52ToInt32):
3027 (JSC::FTL::DFG::LowerDFGToB3::isInt32):
3028 (JSC::FTL::DFG::LowerDFGToB3::isNotInt32):
3029 (JSC::FTL::DFG::LowerDFGToB3::jsValueToStrictInt52):
3030 (JSC::FTL::DFG::LowerDFGToB3::doubleToStrictInt52):
3031 (JSC::FTL::DFG::LowerDFGToB3::speculate):
3032 (JSC::FTL::DFG::LowerDFGToB3::speculateCellOrOther):
3033 (JSC::FTL::DFG::LowerDFGToB3::speculateAnyInt):
3034 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepReal):
3035 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepAnyInt):
3036 (JSC::FTL::DFG::LowerDFGToB3::speculateMachineInt): Deleted.
3037 (JSC::FTL::DFG::LowerDFGToB3::speculateDoubleRepMachineInt): Deleted.
3038 * jit/JITOpcodes.cpp:
3039 (JSC::JIT::emit_op_profile_type):
3040 * jit/JITOpcodes32_64.cpp:
3041 (JSC::JIT::emit_op_profile_type):
3042 * runtime/JSCJSValue.h:
3043 * runtime/JSCJSValueInlines.h:
3045 (JSC::JSValue::isAnyInt):
3046 (JSC::JSValue::asAnyInt):
3047 (JSC::JSValue::isMachineInt): Deleted.
3048 (JSC::JSValue::asMachineInt): Deleted.
3049 * runtime/RuntimeType.cpp:
3050 (JSC::runtimeTypeForValue):
3051 (JSC::runtimeTypeAsString):
3052 * runtime/RuntimeType.h:
3053 * runtime/TypeSet.cpp:
3054 (JSC::TypeSet::dumpTypes):
3055 (JSC::TypeSet::displayName):
3056 (JSC::TypeSet::inspectorTypeSet):
3057 (JSC::TypeSet::toJSONString):
3059 2016-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
3061 [JSC] Optimize JSON.parse string fast path
3062 https://bugs.webkit.org/show_bug.cgi?id=156953
3064 Reviewed by Mark Lam.
3066 This patch further optimizes the string parsing fast path.
3067 Previously, we generated the WTF::String to hold the ownership of the token's string.
3068 And always copied the token in LiteralParser side.
3069 Instead, we hold the ownership of the token String by the StringBuilder in LiteralParser::Lexer,
3070 and remove the processing in the string parsing fast path.
3071 This patch gives us stable 1 - 2.5% improvement in Kraken json-parse-financial.
3075 json-parse-financial 41.383+-0.248 ^ 40.894+-0.189 ^ definitely 1.0120x faster
3077 * runtime/LiteralParser.cpp:
3078 (JSC::LiteralParser<CharType>::tryJSONPParse):
3079 (JSC::LiteralParser<CharType>::Lexer::lex):
3080 (JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
3081 (JSC::LiteralParser<CharType>::parse):
3082 (JSC::LiteralParser<CharType>::Lexer::lexString): Deleted.
3083 * runtime/LiteralParser.h:
3084 (JSC::LiteralParser::tryLiteralParse):
3085 (JSC::LiteralParser::Lexer::currentToken):
3086 (JSC::LiteralParser::Lexer::LiteralParserTokenPtr::LiteralParserTokenPtr):
3087 (JSC::LiteralParser::Lexer::LiteralParserTokenPtr::operator->):
3089 2016-04-24 Filip Pizlo <fpizlo@apple.com> and Andy VanWagoner <thetalecrafter@gmail.com>
3091 [INTL] Implement String.prototype.localeCompare in ECMA-402
3092 https://bugs.webkit.org/show_bug.cgi?id=147607
3094 Reviewed by Darin Adler.
3096 Part of this change is just rolling 194394 back in.
3098 The other part is making that not a regression on CDjs. Other than the fact that it uses
3099 bound functions, the problem with this new localeCompare implementation is that it uses
3100 the arguments object. It uses it in a way that *seems* like ArgumentsEliminationPhase
3101 ought to handle, but to my surprise it didn't:
3103 - If we have a ForceExit GetByVal on the arguments object, we would previously assume that
3104 it escaped. That's false since we just exit at ForceExit. On the other hand we probably
3105 should be pruning unreachable paths before we get here, but that's a separate issue. I
3106 don't want to play with phase order right now.
3108 - If we have a OutOfBounds GetByVal on the arguments object, then the best that would
3109 previously happen is that we'd compile it into an in-bounds arguments access. That's quite
3110 bad, as Andy's localeCompare illustrates: it uses out-of-bounds access on the arguments
3111 object to detect if an argument was passed. This change introduces an OutOfBounds version
3112 of GetMyArgumentByVal for this purpose.
3114 This change required registering sane chain watchpoints. In the process, I noticed that the
3115 old way of doing it had a race condition: we might register watchpoints for the structure
3116 that had become insane. This change introduces a double-checking idiom that I believe works
3117 because once the structure becomes insane it can't go back to sane and watchpoints
3118 registration already involves executing the hardest possible fences.
3120 * builtins/StringPrototype.js:
3124 * dfg/DFGAbstractInterpreterInlines.h:
3125 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
3126 * dfg/DFGArgumentsEliminationPhase.cpp:
3127 * dfg/DFGArrayMode.cpp:
3128 (JSC::DFG::ArrayMode::refine):
3129 * dfg/DFGClobberize.h:
3130 (JSC::DFG::clobberize):
3131 * dfg/DFGConstantFoldingPhase.cpp:
3132 (JSC::DFG::ConstantFoldingPhase::foldConstants):
3133 * dfg/DFGDoesGC.cpp:
3135 * dfg/DFGFixupPhase.cpp:
3136 (JSC::DFG::FixupPhase::fixupNode):
3137 * dfg/DFGNodeType.h:
3138 * dfg/DFGPreciseLocalClobberize.h:
3139 (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
3140 * dfg/DFGPredictionPropagationPhase.cpp:
3141 * dfg/DFGSafeToExecute.h:
3142 (JSC::DFG::safeToExecute):
3143 * dfg/DFGSpeculativeJIT.cpp:
3144 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
3145 * dfg/DFGSpeculativeJIT32_64.cpp:
3146 (JSC::DFG::SpeculativeJIT::compile):
3147 * dfg/DFGSpeculativeJIT64.cpp:
3148 (JSC::DFG::SpeculativeJIT::compile):
3149 * dfg/DFGValidate.cpp:
3150 * ftl/FTLCapabilities.cpp:
3151 (JSC::FTL::canCompile):
3152 * ftl/FTLLowerDFGToB3.cpp:
3153 (JSC::FTL::DFG::LowerDFGToB3::compileNode):
3154 (JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):
3155 (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
3156 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt):
3157 * ftl/FTLTypedPointer.h:
3158 (JSC::FTL::TypedPointer::TypedPointer):
3159 (JSC::FTL::TypedPointer::operator bool):
3160 (JSC::FTL::TypedPointer::heap):
3161 (JSC::FTL::TypedPointer::operator!): Deleted.
3162 * runtime/StringPrototype.cpp:
3163 (JSC::StringPrototype::finishCreation):
3165 2016-04-23 Filip Pizlo <fpizlo@apple.com>
3167 Unreviewed, unbreak cloop.
3170 (JSC::VM::getHostFunction):
3172 2016-04-22 Filip Pizlo <fpizlo@apple.com>
3174 Speed up bound functions a bit
3175 https://bugs.webkit.org/show_bug.cgi?id=156889
3177 Reviewed by Saam Barati.
3179 Bound functions are hard to optimize because JSC doesn't have a good notion of non-JS code
3180 that does JS-ey things like make JS calls. What I mean by "non-JS code" is code that did not
3181 originate from JS source. A bound function does a highly polymorphic call to the target
3182 stored in the JSBoundFunction. Prior to this change, we represented it as native code that
3183 used the generic native->JS call API. That's not cheap.
3185 We could model bound functions using a builtin, but it's not clear that this would be easy
3186 to grok, since so much of the code would have to access special parts of the JSBoundFunction
3187 type. Doing it that way might solve the performance problems but it would mean extra work to
3188 arrange for the builtin to have speedy access to the call target, the bound this, and the
3189 bound arguments. Also, optimizing bound functions that way would mean that bound function
3190 performance would be gated on the performance of a bunch of other things in our system. For
3191 example, we'd want this polymorphic call to be handled like the funnel that it is: if we're
3192 compiling the bound function's outgoing call with no context then we should compile it as
3193 fully polymorphic but we can let it assume basic sanity like that the callee is a real
3194 function; but if we're compiling the call with any amount of calling context then we want to
3195 use normal call IC's.
3197 Since the builtin path wouldn't lead to a simpler patch and since I think that the VM will
3198 benefit in the long run from using custom handling for bound functions, I kept the native
3199 code and just added Intrinsic/thunk support.
3201 This just adds an Intrinsic for bound function calls where the JSBoundFunction targets a
3202 JSFunction instance and has no bound arguments (only bound this). This intrinsic is
3203 currently only implemented as a thunk and not yet recognized by the DFG bytecode parser.
3205 I needed to loosen some restrictions to do this. For one, I was really tired of our bad use
3206 of ENABLE(JIT) conditionals, which made it so that any serious client of Intrinsics would
3207 have to have #ifdefs. Really what should happen is that if the JIT is not enabled then we
3208 just ignore intrinsics. Also, the code was previously assuming that having a native
3209 constructor and knowing the Intrinsic for your native call were mutually exclusive. This
3210 change makes it possible to have a native executable that has a custom function, custom
3211 constructor, and an Intrinsic.
3213 This is a >4x speed-up on bound function calls with no bound arguments.
3215 In the future, we should teach the DFG Intrinsic handling to deal with bound functions and
3216 we should teach the inliner (and ByteCodeParser::handleCall() in general) how to deal with
3217 the function call inside the bound function. That would be super awesome.
3219 * assembler/AbstractMacroAssembler.h:
3220 (JSC::AbstractMacroAssembler::timesPtr):
3221 (JSC::AbstractMacroAssembler::Address::withOffset):
3222 (JSC::AbstractMacroAssembler::BaseIndex::BaseIndex):
3223 (JSC::MacroAssemblerType>::Address::indexedBy):
3224 * jit/AssemblyHelpers.h:
3225 (JSC::AssemblyHelpers::storeCell):
3226 (JSC::AssemblyHelpers::loadCell):
3227 (JSC::AssemblyHelpers::storeValue):
3228 (JSC::AssemblyHelpers::emitSaveCalleeSaves):
3229 (JSC::AssemblyHelpers::emitSaveThenMaterializeTagRegisters):
3230 (JSC::AssemblyHelpers::emitRestoreCalleeSaves):
3231 (JSC::AssemblyHelpers::emitRestoreSavedTagRegisters):
3232 (JSC::AssemblyHelpers::copyCalleeSavesToVMCalleeSavesBuffer):
3233 * jit/JITThunks.cpp:
3234 (JSC::JITThunks::ctiNativeTailCall):
3235 (JSC::JITThunks::ctiNativeTailCallWithoutSavedTags):
3236 (JSC::JITThunks::ctiStub):
3237 (JSC::JITThunks::hostFunctionStub):
3238 (JSC::JITThunks::clearHostFunctionStubs):
3240 * jit/SpecializedThunkJIT.h:
3241 (JSC::SpecializedThunkJIT::callDoubleToDoublePreservingReturn):
3242 (JSC::SpecializedThunkJIT::tagReturnAsInt32):
3243 (JSC::SpecializedThunkJIT::emitSaveThenMaterializeTagRegisters): Deleted.
3244 (JSC::SpecializedThunkJIT::emitRestoreSavedTagRegisters): Deleted.
3245 * jit/ThunkGenerators.cpp:
3246 (JSC::virtualThunkFor):
3247 (JSC::nativeForGenerator):
3248 (JSC::nativeCallGenerator):
3249 (JSC::nativeTailCallGenerator):
3250 (JSC::nativeTailCallWithoutSavedTagsGenerator):
3251 (JSC::nativeConstructGenerator):
3252 (JSC::randomThunkGenerator):
3253 (JSC::boundThisNoArgsFunctionCallGenerator):
3254 * jit/ThunkGenerators.h:
3255 * runtime/Executable.cpp:
3256 (JSC::NativeExecutable::create):
3257 (JSC::NativeExecutable::destroy):
3258 (JSC::NativeExecutable::createStructure):
3259 (JSC::NativeExecutable::finishCreation):
3260 (JSC::NativeExecutable::NativeExecutable):
3261 (JSC::ScriptExecutable::ScriptExecutable):
3262 * runtime/Executable.h:
3263 * runtime/FunctionPrototype.cpp:
3264 (JSC::functionProtoFuncBind):
3265 * runtime/IntlCollatorPrototype.cpp:
3266 (JSC::IntlCollatorPrototypeGetterCompare):
3267 * runtime/Intrinsic.h:
3268 * runtime/JSBoundFunction.cpp:
3269 (JSC::boundThisNoArgsFunctionCall):
3270 (JSC::boundFunctionCall):
3271 (JSC::boundThisNoArgsFunctionConstruct):
3272 (JSC::boundFunctionConstruct):
3273 (JSC::getBoundFunctionStructure):
3274 (JSC::JSBoundFunction::create):
3275 (JSC::JSBoundFunction::customHasInstance):
3276 (JSC::JSBoundFunction::JSBoundFunction):
3277 * runtime/JSBoundFunction.h:
3278 (JSC::JSBoundFunction::targetFunction):
3279 (JSC::JSBoundFunction::boundThis):
3280 (JSC::JSBoundFunction::boundArgs):
3281 (JSC::JSBoundFunction::createStructure):
3282 (JSC::JSBoundFunction::offsetOfTargetFunction):
3283 (JSC::JSBoundFunction::offsetOfBoundThis):
3284 * runtime/JSFunction.cpp:
3285 (JSC::JSFunction::lookUpOrCreateNativeExecutable):
3286 (JSC::JSFunction::create):
3288 (JSC::thunkGeneratorForIntrinsic):
3289 (JSC::VM::getHostFunction):
3291 (JSC::VM::getCTIStub):
3292 (JSC::VM::exceptionOffset):
3294 2016-04-22 Joonghun Park <jh718.park@samsung.com>
3296 [JSC] Fix build break since r199866
3297 https://bugs.webkit.org/show_bug.cgi?id=156892
3299 Reviewed by Darin Adler.
3301 * runtime/MathCommon.cpp: Follow up to r199913. Remove 'include cmath' in cpp file.
3303 2016-04-22 Yusuke Suzuki <utatane.tea@gmail.com>
3305 [JSC] Optimize number parsing and string parsing in LiteralParser
3306 https://bugs.webkit.org/show_bug.cgi?id=156896
3308 Reviewed by Mark Lam.
3310 This patch aim to improve JSON.parse performance. Major 2 optimizations are included.
3312 1. Change `double result` to `int32_t result` in integer parsing case.
3313 We already have the optimized path for integer parsing, when it's digits are less than 10.
3314 At that case, the maximum number is 999999999, and the minimum number is -99999999.
3315 The both are in range of Int32. So We can use int32_t for accumulation instead of double.
3317 2. Add the string parsing fast / slow cases.
3318 We add the fast case for string parsing, which does not include any escape sequences.
3320 Both optimizations improve Kraken json-parse-financial, roughly 3.5 - 4.5%.
3322 json-parse-financial 49.128+-1.589 46.979+-0.912 might be 1.0457x faster
3324 * runtime/LiteralParser.cpp:
3325 (JSC::isJSONWhiteSpace):
3326 (JSC::isSafeStringCharacter):
3327 (JSC::LiteralParser<CharType>::Lexer::lexString):
3328 (JSC::LiteralParser<CharType>::Lexer::lexStringSlow):
3329 (JSC::LiteralParser<CharType>::Lexer::lexNumber):
3330 * runtime/LiteralParser.h:
3332 2016-04-22 Joseph Pecoraro <pecoraro@apple.com>
3334 Web Inspector: Source directives lost when using Function constructor repeatedly
3335 https://bugs.webkit.org/show_bug.cgi?id=156863
3336 <rdar://problem/25861064>
3338 Reviewed by Geoffrey Garen.
3340 Source directives (sourceURL and sourceMappingURL) are normally accessed through
3341 the SourceProvider and normally set when the script is parsed. However, when a
3342 CodeCache lookup skips parsing, the new SourceProvider never gets the directives
3343 (sourceURL/sourceMappingURL). This patch stores the directives on the UnlinkedCodeBlock
3344 and UnlinkedFunctionExecutable when entering the cache, and copies to the new providers
3345 when the cache is used.
3347 * bytecode/UnlinkedCodeBlock.h:
3348 (JSC::UnlinkedCodeBlock::sourceURLDirective):
3349 (JSC::UnlinkedCodeBlock::sourceMappingURLDirective):
3350 (JSC::UnlinkedCodeBlock::setSourceURLDirective):
3351 (JSC::UnlinkedCodeBlock::setSourceMappingURLDirective):
3352 * bytecode/UnlinkedFunctionExecutable.h:
3353 * parser/SourceProvider.h:
3354 * runtime/CodeCache.cpp:
3355 (JSC::CodeCache::getGlobalCodeBlock):
3356 (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
3357 * runtime/CodeCache.h:
3358 Store directives on the unlinked code block / executable when adding
3359 to the cache, so they can be used to update new providers when the
3362 * runtime/JSGlobalObject.cpp:
3363 Add needed header after CodeCache header cleanup.
3365 2016-04-22 Mark Lam <mark.lam@apple.com>
3367 javascript jit bug affecting Google Maps.
3368 https://bugs.webkit.org/show_bug.cgi?id=153431
3370 Reviewed by Filip Pizlo.
3372 The issue was due to the abstract interpreter wrongly marking the type of the
3373 value read from the Uint3Array as SpecInt52, which precludes it from being an
3374 Int32. This proves to be false, and the generated code failed to handle the case
3375 where the read value is actually an Int32.
3377 The fix is to have the abstract interpreter use SpecMachineInt instead of
3380 * bytecode/SpeculatedType.h:
3381 * dfg/DFGAbstractInterpreterInlines.h:
3382 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
3384 2016-04-22 Benjamin Poulain <bpoulain@apple.com>
3386 [JSC] PredictionPropagation should not be in the top 5 heaviest phases
3387 https://bugs.webkit.org/show_bug.cgi?id=156891
3389 Reviewed by Mark Lam.
3391 In DFG, PredictionPropagation is often way too high in profiles.
3392 It is a simple phase, it should not be that hot.
3394 Most of the time is spent accessing memory. This patch attempts
3397 First, propagate() is split in processInvariants() and propagates().
3398 The step processInvariants() sets all the types for nodes for which
3399 the type does not depends on other nodes.
3401 Adding processInvariants() lowers two hotspot inside PredictionPropagation:
3402 speculationFromValue() and setPrediction().
3404 Next, to avoid touching all the nodes at every operation, we keep
3405 track of the nodes that actually need propagate().
3406 The vector m_dependentNodes keeps the list of those nodes and propagate()
3407 only need to process them at each phase.
3409 This is a smaller gain because growing m_dependentNodes negates
3412 On 3d-cube, this moves PredictionPropagation from fifth position
3413 to ninth. A lot of the remaining overhead is caused by double-voting
3414 and cannot be fixed by moving stuff around.
3416 * dfg/DFGPredictionPropagationPhase.cpp:
3417 (JSC::DFG::PredictionPropagationPhase::propagateToFixpoint): Deleted.
3418 (JSC::DFG::PredictionPropagationPhase::propagate): Deleted.
3419 (JSC::DFG::PredictionPropagationPhase::propagateForward): Deleted.
3420 (JSC::DFG::PredictionPropagationPhase::propagateBackward): Deleted.
3421 (JSC::DFG::PredictionPropagationPhase::doDoubleVoting): Deleted.
3422 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting): Deleted.
3423 (JSC::DFG::PredictionPropagationPhase::propagateThroughArgumentPositions): Deleted.
3425 2016-04-22 Geoffrey Garen <ggaren@apple.com>
3427 super should be available in object literals
3428 https://bugs.webkit.org/show_bug.cgi?id=156933
3430 Reviewed by Saam Barati.
3432 When we originally implemented classes, super seemed to be a class-only
3433 feature. But the final spec says it's available in object literals too.
3435 * bytecompiler/NodesCodegen.cpp:
3436 (JSC::PropertyListNode::emitBytecode): Having 'super' and being a class
3437 property are no longer synonymous, so we track two separate variables.
3439 (JSC::PropertyListNode::emitPutConstantProperty): Being inside the super
3440 branch no longer guarantees that you're a class property, so we decide
3441 our attributes and our function name dynamically.
3443 * parser/ASTBuilder.h:
3444 (JSC::ASTBuilder::createArrowFunctionExpr):
3445 (JSC::ASTBuilder::createGetterOrSetterProperty):
3446 (JSC::ASTBuilder::createArguments):
3447 (JSC::ASTBuilder::createArgumentsList):
3448 (JSC::ASTBuilder::createProperty):
3449 (JSC::ASTBuilder::createPropertyList): Pass through state to indicate
3450 whether we're a class property, since we can't infer it from 'super'
3453 * parser/NodeConstructors.h:
3454 (JSC::PropertyNode::PropertyNode): See ASTBuilder.h.
3457 (JSC::PropertyNode::expressionName):
3458 (JSC::PropertyNode::name):
3459 (JSC::PropertyNode::type):
3460 (JSC::PropertyNode::needsSuperBinding):
3461 (JSC::PropertyNode::isClassProperty):
3462 (JSC::PropertyNode::putType): See ASTBuilder.h.
3464 * parser/Parser.cpp:
3465 (JSC::Parser<LexerType>::parseFunctionInfo):
3466 (JSC::Parser<LexerType>::parseClass):
3467 (JSC::Parser<LexerType>::parseProperty):
3468 (JSC::Parser<LexerType>::parsePropertyMethod):
3469 (JSC::Parser<LexerType>::parseGetterSetter):
3470 (JSC::Parser<LexerType>::parseMemberExpression): I made these error
3471 messages generic because it is no longer practical to say concise things
3472 about the list of places you can use super.
3476 * parser/SyntaxChecker.h:
3477 (JSC::SyntaxChecker::createArgumentsList):
3478 (JSC::SyntaxChecker::createProperty):
3479 (JSC::SyntaxChecker::appendExportSpecifier):
3480 (JSC::SyntaxChecker::appendConstDecl):
3481 (JSC::SyntaxChecker::createGetterOrSetterProperty): Updated for
3484 * tests/stress/generator-with-super.js:
3486 * tests/stress/modules-syntax-error.js:
3487 * tests/stress/super-in-lexical-scope.js:
3489 (testSyntaxError.test):
3490 * tests/stress/tagged-templates-syntax.js: Updated for error message
3491 changes. See Parser.cpp.
3493 2016-04-22 Filip Pizlo <fpizlo@apple.com>
3495 ASSERT(m_stack.last().isTailDeleted) at ShadowChicken.cpp:127 inspecting the inspector
3496 https://bugs.webkit.org/show_bug.cgi?id=156930
3498 Reviewed by Joseph Pecoraro.
3500 The loop that prunes the stack from the top should preserve the invariant that the top frame
3501 cannot be tail-deleted.
3503 * interpreter/ShadowChicken.cpp:
3504 (JSC::ShadowChicken::update):
3506 2016-04-22 Benjamin Poulain <benjamin@webkit.org>
3508 Attempt to fix the CLoop after r199866
3510 * runtime/MathCommon.h:
3512 2016-04-22 Benjamin Poulain <bpoulain@apple.com>
3514 [JSC] Integer Multiply of a number by itself does not need negative zero support
3515 https://bugs.webkit.org/show_bug.cgi?id=156895
3517 Reviewed by Saam Barati.
3519 You cannot produce negative zero by squaring an integer.
3521 * dfg/DFGFixupPhase.cpp:
3522 (JSC::DFG::FixupPhase::fixupNode):
3523 * dfg/DFGSpeculativeJIT.cpp:
3524 (JSC::DFG::SpeculativeJIT::compileArithMul):
3525 Minor codegen fixes:
3526 -Use the right form of multiply for ARM.
3527 -Use a sign-extended 32bit immediates, that's the one with fast forms
3528 in the MacroAssembler.
3530 2016-04-21 Darin Adler <darin@apple.com>
3532 Follow-on to the build fix.
3534 * runtime/MathCommon.h: Use the C++ std namespace version of the
3537 2016-04-21 Joonghun Park <jh718.park@samsung.com>
3539 [JSC] Fix build break since r199866. Unreviewed.
3540 https://bugs.webkit.org/show_bug.cgi?id=156892
3542 * runtime/MathCommon.h: Add namespace std to isnormal invoking.
3544 2016-04-21 Benjamin Poulain <bpoulain@apple.com>
3546 [JSC] Add primitive String support to compare operators
3547 https://bugs.webkit.org/show_bug.cgi?id=156783
3549 Reviewed by Geoffrey Garen.
3552 We should eventually inline some of the simplest cases.
3554 This is a 2% improvement on Longspider. It is unfortunately neutral
3555 for Sunspider on my machine because most of the comparison are from
3558 * dfg/DFGAbstractInterpreterInlines.h:
3559 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
3560 * dfg/DFGClobberize.h:
3561 (JSC::DFG::clobberize):
3562 * dfg/DFGFixupPhase.cpp:
3563 (JSC::DFG::FixupPhase::fixupNode):
3564 * dfg/DFGOperations.cpp:
3565 * dfg/DFGOperations.h:
3566 * dfg/DFGSpeculativeJIT.cpp:
3567 (JSC::DFG::SpeculativeJIT::compare):
3568 (JSC::DFG::SpeculativeJIT::compileStringCompare):
3569 (JSC::DFG::SpeculativeJIT::compileStringIdentCompare):
3570 * dfg/DFGSpeculativeJIT.h:
3571 (JSC::DFG::SpeculativeJIT::callOperation):
3572 * ftl/FTLCapabilities.cpp:
3573 (JSC::FTL::canCompile):
3574 * ftl/FTLLowerDFGToB3.cpp:
3575 (JSC::FTL::DFG::LowerDFGToB3::compileCompareLess):
3576 (JSC::FTL::DFG::LowerDFGToB3::compileCompareLessEq):
3577 (JSC::FTL::DFG::LowerDFGToB3::compileCompareGreater):
3578 (JSC::FTL::DFG::LowerDFGToB3::compileCompareGreaterEq):
3579 (JSC::FTL::DFG::LowerDFGToB3::compare):
3581 (JSC::FTL::Output::callWithoutSideEffects):
3582 * jit/JITOperations.h:
3583 * tests/stress/string-compare.js: Added.
3586 (let.operator.of.operators.eval.compareStringIdent):
3587 (let.operator.of.operators.compareStringString):
3588 (let.operator.of.operators.compareStringIdentString):
3589 (let.operator.of.operators.compareStringStringIdent):
3590 (let.operator.of.operators.let.left.of.typeCases.let.right.of.typeCases.eval):
3592 2016-04-21 Benjamin Poulain <bpoulain@webkit.org>
3594 [JSC] Commute FDiv-by-constant into FMul-by-reciprocal when it is safe
3595 https://bugs.webkit.org/show_bug.cgi?id=156871
3597 Reviewed by Filip Pizlo.
3599 FMul is significantly faster than FDiv.
3600 For example, on Haswell, FMul has a latency of 5, a throughput of 1
3601 while FDiv has latency 10-24, throughput 8-18.
3603 Fortunately for us, Sunspider and Kraken have plenty of division
3604 by a simple power of 2 constant. Those are just exponent operations
3605 and can be easily reversed to use FMul instead of FDiv.
3607 LLVM does something similar in InstCombine.
3609 * dfg/DFGStrengthReductionPhase.cpp:
3610 (JSC::DFG::StrengthReductionPhase::handleNode):
3611 * jit/JITDivGenerator.cpp:
3612 (JSC::JITDivGenerator::loadOperand):
3613 (JSC::JITDivGenerator::generateFastPath):
3614 * jit/SnippetOperand.h:
3615 (JSC::SnippetOperand::asConstNumber):
3616 * runtime/MathCommon.h:
3617 (JSC::safeReciprocalForDivByConst):
3618 * tests/stress/floating-point-div-to-mul.js: Added.
3622 (opaqueDivBySafeMaxMinusOne):
3623 (opaqueDivBySafeMax):
3624 (opaqueDivBySafeMaxPlusOne):
3625 (opaqueDivBySafeMin):
3626 (opaqueDivBySafeMinMinusOne):
3628 (i.result.opaqueDivBySafeMin.valueOf):
3630 2016-04-21 Benjamin Poulain <benjamin@webkit.org>
3632 [JSC] Improve the absThunkGenerator() for 64bit
3633 https://bugs.webkit.org/show_bug.cgi?id=156888
3635 Reviewed by Michael Saboff.
3637 A few tests spend a lot of time in this abs() with double argument.
3639 This patch adds custom handling for the JSValue64 representation.
3641 -Do not load the value twice. Unbox the GPR if it is not an Int32.
3642 -Deal with IntMin inline instead of falling back to the C function call.
3643 -Box the values ourself to avoid a duplicate function tail and return.
3645 * jit/ThunkGenerators.cpp:
3646 (JSC::absThunkGenerator):
3648 2016-04-21 Saam barati <sbarati@apple.com>
3650 LLInt CallSiteIndex off by 1
3651 https://bugs.webkit.org/show_bug.cgi?id=156886
3653 Reviewed by Benjamin Poulain.
3655 I think was done for historical reasons but isn't needed anymore.
3657 * llint/LLIntSlowPaths.cpp:
3659 2016-04-21 Keith Miller <keith_miller@apple.com>
3661 FTL should handle exceptions in operationInOptimize
3662 https://bugs.webkit.org/show_bug.cgi?id=156885
3664 Reviewed by Michael Saboff.
3666 For some reasone we didn't handle any exceptions in "in" when we called
3667 operationInOptimize in the FTL.
3669 * bytecode/CodeBlock.cpp:
3670 (JSC::CodeBlock::dumpAssumingJITType):
3671 * ftl/FTLCapabilities.cpp:
3672 (JSC::FTL::canCompile):
3673 * ftl/FTLLowerDFGToB3.cpp:
3674 (JSC::FTL::DFG::LowerDFGToB3::compileIn):
3675 * ftl/FTLPatchpointExceptionHandle.h: Add comments explaining which
3676 function to use for different exception types.
3679 (GlobalObject::finishCreation):
3681 * runtime/Executable.cpp:
3682 (JSC::ScriptExecutable::ScriptExecutable):
3683 * runtime/Executable.h:
3684 (JSC::ScriptExecutable::setNeverFTLOptimize):
3685 (JSC::ScriptExecutable::neverFTLOptimize):
3686 * tests/stress/in-ftl-exception-check.js: Added.
3691 2016-04-21 Filip Pizlo <fpizlo@apple.com>
3693 JSC virtual call thunk shouldn't do a structure->classInfo lookup
3694 https://bugs.webkit.org/show_bug.cgi?id=156874
3696 Reviewed by Keith Miller.
3698 This lookup was unnecessary because we can just test the inlined type field.
3700 But also, this meant that we were exempting JSBoundFunction from the virtual call optimization.
3703 * jit/ThunkGenerators.cpp:
3704 (JSC::virtualThunkFor):
3706 2016-04-21 Joseph Pecoraro <pecoraro@apple.com>
3708 Web Inspector: sourceMappingURL not loaded in generated script
3709 https://bugs.webkit.org/show_bug.cgi?id=156022
3710 <rdar://problem/25438595>
3712 Reviewed by Geoffrey Garen.
3714 * inspector/JSGlobalObjectInspectorController.cpp:
3715 (Inspector::JSGlobalObjectInspectorController::appendAPIBacktrace):
3716 Synthetic CallFrames for native code will not have script identifiers.
3718 * inspector/ScriptCallFrame.cpp:
3719 (Inspector::ScriptCallFrame::ScriptCallFrame):
3720 (Inspector::ScriptCallFrame::isEqual):
3721 (Inspector::ScriptCallFrame::buildInspectorObject):
3722 * inspector/ScriptCallFrame.h:
3723 * inspector/protocol/Console.json:
3724 Include the script identifier in ScriptCallFrame so we can correlate this
3725 to the exactly script, even if there isn't a URL. The Script may have a
3726 sourceURL, so the Web Inspector frontend may decide to show / link to it.
3728 * inspector/ScriptCallStackFactory.cpp:
3729 (Inspector::CreateScriptCallStackFunctor::operator()):
3730 (Inspector::createScriptCallStackFromException):
3731 Include SourceID when we have it.
3733 * interpreter/Interpreter.cpp:
3734 (JSC::GetStackTraceFunctor::operator()):
3735 * interpreter/Interpreter.h:
3736 * interpreter/StackVisitor.cpp:
3737 (JSC::StackVisitor::Frame::sourceID):
3738 * interpreter/StackVisitor.h:
3739 Access the SourceID when we have it.
3741 2016-04-21 Saam barati <sbarati@apple.com>
3743 Lets do less locking of symbol tables in the BytecodeGenerator where we don't have race conditions
3744 https://bugs.webkit.org/show_bug.cgi?id=156821
3746 Reviewed by Filip Pizlo.
3748 The BytecodeGenerator allocates all the SymbolTables that it uses.
3749 This is before any concurrent compiler thread can use that SymbolTable.
3750 This means we don't actually need to lock for any operations of the
3751 SymbolTable. This patch makes this change by removing all locking.
3752 To do this, I've introduced a new constructor for ConcurrentJITLocker
3753 which implies no locking is necessary. You instantiate such a ConcurrentJITLocker like so:
3754 `ConcurrentJITLocker locker(ConcurrentJITLocker::NoLockingNecessary);`
3756 This patch also removes all uses of Strong<SymbolTable> from the bytecode
3757 generator and instead wraps bytecode generation in a DeferGC.
3759 * bytecode/UnlinkedFunctionExecutable.cpp:
3760 (JSC::generateUnlinkedFunctionCodeBlock):
3761 * bytecompiler/BytecodeGenerator.cpp:
3762 (JSC::BytecodeGenerator::BytecodeGenerator):
3763 (JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
3764 (JSC::BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded):
3765 (JSC::BytecodeGenerator::instantiateLexicalVariables):
3766 (JSC::BytecodeGenerator::emitPrefillStackTDZVariables):
3767 (JSC::BytecodeGenerator::pushLexicalScopeInternal):
3768 (JSC::BytecodeGenerator::initializeBlockScopedFunctions):
3769 (JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
3770 (JSC::BytecodeGenerator::popLexicalScopeInternal):
3771 (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration):
3772 (JSC::BytecodeGenerator::variable):
3773 (JSC::BytecodeGenerator::createVariable):
3774 (JSC::BytecodeGenerator::emitResolveScope):
3775 (JSC::BytecodeGenerator::emitPushWithScope):
3776 (JSC::BytecodeGenerator::emitPushFunctionNameScope):
3777 * bytecompiler/BytecodeGenerator.h:
3778 (JSC::BytecodeGenerator::constructorKind):
3779 (JSC::BytecodeGenerator::superBinding):
3780 (JSC::BytecodeGenerator::generate):
3781 * runtime/CodeCache.cpp:
3782 (JSC::CodeCache::getGlobalCodeBlock):
3783 * runtime/ConcurrentJITLock.h:
3784 (JSC::ConcurrentJITLockerBase::ConcurrentJITLockerBase):
3785 (JSC::ConcurrentJITLockerBase::~ConcurrentJITLockerBase):
3786 (JSC::ConcurrentJITLocker::ConcurrentJITLocker):
3788 2016-04-21 Saam barati <sbarati@apple.com>
3790 Remove some unnecessary RefPtrs in the parser
3791 https://bugs.webkit.org/show_bug.cgi?id=156865
3793 Reviewed by Filip Pizlo.
3795 The IdentifierArena or the SourceProviderCacheItem will own these UniquedStringImpls
3796 while we are using them. There is no need for us to reference count them.
3798 This might be a 0.5% speedup on octane code-load.
3800 * parser/Parser.cpp:
3801 (JSC::Parser<LexerType>::parseInner):
3803 (JSC::Scope::setIsLexicalScope):
3804 (JSC::Scope::isLexicalScope):
3805 (JSC::Scope::closedVariableCandidates):
3806 (JSC::Scope::declaredVariables):
3807 (JSC::Scope::lexicalVariables):
3808 (JSC::Scope::finalizeLexicalEnvironment):
3809 (JSC::Scope::computeLexicallyCapturedVariablesAndPurgeCandidates):
3810 (JSC::Scope::collectFreeVariables):
3811 (JSC::Scope::getCapturedVars):
3812 (JSC::Scope::setStrictMode):
3813 (JSC::Scope::isValidStrictMode):
3814 (JSC::Scope::shadowsArguments):
3815 (JSC::Scope::copyCapturedVariablesToVector):
3816 * parser/SourceProviderCacheItem.h:
3817 (JSC::SourceProviderCacheItem::usedVariables):
3818 (JSC::SourceProviderCacheItem::~SourceProviderCacheItem):
3819 (JSC::SourceProviderCacheItem::create):
3820 (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
3821 (JSC::SourceProviderCacheItem::writtenVariables): Deleted.
3823 2016-04-21 Filip Pizlo <fpizlo@apple.com>
3825 PolymorphicAccess adds sizeof(CallerFrameAndPC) rather than subtracting it when calculating stack height
3826 https://bugs.webkit.org/show_bug.cgi?id=156872
3828 Reviewed by Geoffrey Garen.
3830 The code that added sizeof(CallerFrameAndPC) emerged from a bad copy-paste in r189586. That was
3831 the revision that created the PolymorphicAccess class. It moved code for generating a
3832 getter/setter call from Repatch.cpp to PolymorphicAccess.cpp. You can see the code doing a
3835 http://trac.webkit.org/changeset/189586/trunk/Source/JavaScriptCore/jit/Repatch.cpp
3837 This makes the world right again.
3839 * bytecode/PolymorphicAccess.cpp:
3840 (JSC::AccessCase::generateImpl):
3842 2016-04-21 Geoffrey Garen <ggaren@apple.com>
3844 Build warning: CODE_SIGN_ENTITLEMENTS specified without specifying CODE_SIGN_IDENTITY
3845 https://bugs.webkit.org/show_bug.cgi?id=156862
3847 Reviewed by Joseph Pecoraro.
3849 * Configurations/Base.xcconfig: Specify the ad hoc signing identity by