1 2013-03-22 David Kilzer <ddkilzer@apple.com>
3 BUILD FIX (r145119): Make JSValue* properties default to (assign)
4 <rdar://problem/13380794>
6 Reviewed by Mark Hahnenberg.
8 Fixes the following build failures:
10 Source/JavaScriptCore/API/tests/testapi.mm:106:1: error: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Werror,-Wobjc-property-no-attribute]
11 @property JSValue *onclick;
13 Source/JavaScriptCore/API/tests/testapi.mm:106:1: error: default property attrib ute 'assign' not appropriate for non-GC object [-Werror,-Wobjc-property-no-attribute]
14 Source/JavaScriptCore/API/tests/testapi.mm:107:1: error: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Werror,-Wobjc-property-no-attribute]
15 @property JSValue *weakOnclick;
17 Source/JavaScriptCore/API/tests/testapi.mm:107:1: error: default property attribute 'assign' not appropriate for non-GC object [-Werror,-Wobjc-property-no-attribute]
20 * API/tests/testapi.mm: Default to (assign) for JSValue*
23 2013-03-22 Ryosuke Niwa <rniwa@webkit.org>
25 testLeakingPrototypesAcrossContexts added in r146682 doesn't compile on Win and fails on Mac
26 https://bugs.webkit.org/show_bug.cgi?id=113125
28 Reviewed by Mark Hahnenberg
30 Remove the test added in r146682 as it's now failing on Mac.
31 This is the test that was causing a compilation failure on Windows.
33 * API/tests/testapi.c:
36 2013-03-22 Ryosuke Niwa <rniwa@webkit.org>
38 Fix the typo: WIN -> WINDOWS.
40 * API/tests/testapi.c:
43 2013-03-22 Ryosuke Niwa <rniwa@webkit.org>
45 I really can't figure out what's wrong with this one.
46 Temporarily disable the test added by r146682 on Windows since it doesn't compile.
48 * API/tests/testapi.c:
51 2013-03-22 Ryosuke Niwa <rniwa@webkit.org>
53 Another build fix (after r146693) for r146682.
55 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
56 * JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in:
58 2013-03-22 Roger Fong <roger_fong@apple.com>
60 Unreviewed. AppleWin build fix.
62 * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
63 * JavaScriptCore.vcxproj/copy-files.cmd:
65 2013-03-22 Mark Hahnenberg <mhahnenberg@apple.com>
67 -[TinyDOMNode dealloc] should call [super dealloc] when ARC is not enabled
68 https://bugs.webkit.org/show_bug.cgi?id=113054
70 Reviewed by Geoffrey Garen.
72 * API/tests/testapi.mm:
73 (-[TinyDOMNode dealloc]):
75 2013-03-22 Mark Hahnenberg <mhahnenberg@apple.com>
77 opaqueJSClassData should be cached on JSGlobalObject, not the JSGlobalData
78 https://bugs.webkit.org/show_bug.cgi?id=113086
80 Reviewed by Geoffrey Garen.
82 opaqueJSClassData stores cached prototypes for JSClassRefs in the C API. It doesn't make sense to
83 share these prototypes within a JSGlobalData across JSGlobalObjects, and in fact doing so will cause
84 a leak of the original JSGlobalObject that these prototypes were created in. Therefore we should move
85 this cache to JSGlobalObject where it belongs and where it won't cause memory leaks.
87 * API/JSBase.cpp: Needed to add an extern "C" so that testapi.c can use the super secret GC function.
88 * API/JSClassRef.cpp: We now grab the cached context data from the global object rather than the global data.
89 (OpaqueJSClass::contextData):
90 * API/JSClassRef.h: Remove this header because it's unnecessary and causes circular dependencies.
91 * API/tests/testapi.c: Added a new test that makes sure that using the same JSClassRef in two different contexts
92 doesn't cause leaks of the original global object.
94 (nestedAllocateObject): This is a hack to bypass the conservative scan of the GC, which was unnecessarily marking
95 objects and keeping them alive, ruining the test result.
96 (testLeakingPrototypesAcrossContexts):
98 * API/tests/testapi.mm: extern "C" this so we can continue using it here.
99 * runtime/JSGlobalData.cpp: Remove JSClassRef related stuff.
100 (JSC::JSGlobalData::~JSGlobalData):
101 * runtime/JSGlobalData.h:
103 * runtime/JSGlobalObject.h: Add the stuff that JSGlobalData had. We add it to JSGlobalObjectRareData so that
104 clients who don't use the C API don't have to pay the memory cost of this extra HashMap.
106 (JSGlobalObjectRareData):
107 (JSC::JSGlobalObject::opaqueJSClassData):
109 2013-03-19 Martin Robinson <mrobinson@igalia.com>
111 [GTK] Add support for building the WebCore bindings to the gyp build
112 https://bugs.webkit.org/show_bug.cgi?id=112638
114 Reviewed by Nico Weber.
116 * JavaScriptCore.gyp/JavaScriptCoreGTK.gyp: Export all include directories to direct
117 dependents and fix the indentation of the libjavascriptcore target.
119 2013-03-21 Filip Pizlo <fpizlo@apple.com>
121 Fix some minor issues in the DFG's profiling of heap accesses
122 https://bugs.webkit.org/show_bug.cgi?id=113010
124 Reviewed by Goeffrey Garen.
126 1) If a CodeBlock gets jettisoned by GC, we should count the exit sites.
128 2) If a CodeBlock clears a structure stub during GC, it should record this, and
129 the DFG should prefer to not inline that access (i.e. treat it as if it had an
132 3) If a PutById was seen by the baseline JIT, and the JIT attempted to cache it,
133 but it chose not to, then assume that it will take slow path.
135 4) If we frequently exited because of a structure check on a weak constant,
136 don't try to inline that access in the future.
138 5) Treat all exits that were counted as being frequent.
140 81% speed-up on Octane/gbemu. Small speed-ups elsewhere, and no regressions.
142 * bytecode/CodeBlock.cpp:
143 (JSC::CodeBlock::finalizeUnconditionally):
145 (JSC::CodeBlock::resetStubDuringGCInternal):
146 (JSC::CodeBlock::reoptimize):
147 (JSC::CodeBlock::jettison):
148 (JSC::ProgramCodeBlock::jettisonImpl):
149 (JSC::EvalCodeBlock::jettisonImpl):
150 (JSC::FunctionCodeBlock::jettisonImpl):
151 (JSC::CodeBlock::tallyFrequentExitSites):
152 * bytecode/CodeBlock.h:
154 (JSC::CodeBlock::tallyFrequentExitSites):
158 * bytecode/GetByIdStatus.cpp:
159 (JSC::GetByIdStatus::computeFor):
160 * bytecode/PutByIdStatus.cpp:
161 (JSC::PutByIdStatus::computeFor):
162 * bytecode/StructureStubInfo.h:
163 (JSC::StructureStubInfo::StructureStubInfo):
165 * dfg/DFGByteCodeParser.cpp:
166 (JSC::DFG::ByteCodeParser::handleGetById):
167 (JSC::DFG::ByteCodeParser::parseBlock):
168 * dfg/DFGOSRExit.cpp:
169 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
171 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSite):
174 (JSC::DEFINE_STUB_FUNCTION):
178 2013-03-22 Filip Pizlo <fpizlo@apple.com>
180 DFG folding of PutById to SimpleReplace should consider the specialized function case
181 https://bugs.webkit.org/show_bug.cgi?id=113093
183 Reviewed by Geoffrey Garen and Mark Hahnenberg.
185 * bytecode/PutByIdStatus.cpp:
186 (JSC::PutByIdStatus::computeFor):
188 2013-03-22 David Kilzer <ddkilzer@apple.com>
190 BUILD FIX (r146558): Build testapi.mm with ARC enabled for armv7s
191 <http://webkit.org/b/112608>
193 Fixes the following build failure:
195 Source/JavaScriptCore/API/tests/testapi.mm:205:1: error: method possibly missing a [super dealloc] call [-Werror,-Wobjc-missing-super-calls]
200 * Configurations/ToolExecutable.xcconfig: Enable ARC for armv7s
203 2013-03-22 David Kilzer <ddkilzer@apple.com>
205 Revert "BUILD FIX (r146558): Call [super dealloc] from -[TinyDOMNode dealloc]"
207 This fixes a build failure introduced by this change:
209 Source/JavaScriptCore/API/tests/testapi.mm:206:6: error: ARC forbids explicit message send of 'dealloc'
214 Not sure why this didn't fail locally on my Mac Pro.
216 * API/tests/testapi.mm:
217 (-[TinyDOMNode dealloc]): Remove call to [super dealloc].
219 2013-03-22 David Kilzer <ddkilzer@apple.com>
221 BUILD FIX (r146558): Call [super dealloc] from -[TinyDOMNode dealloc]
222 <http://webkit.org/b/112608>
224 Fixes the following build failure:
226 Source/JavaScriptCore/API/tests/testapi.mm:205:1: error: method possibly missing a [super dealloc] call [-Werror,-Wobjc-missing-super-calls]
231 * API/tests/testapi.mm:
232 (-[TinyDOMNode dealloc]): Call [super dealloc].
234 2013-03-22 Ryosuke Niwa <rniwa@webkit.org>
236 Leak bots erroneously report JSC::WatchpointSet as leaking
237 https://bugs.webkit.org/show_bug.cgi?id=107781
239 Reviewed by Filip Pizlo.
241 Since leaks doesn't support tagged pointers, avoid using it by flipping the bit flag to indicate
242 the entry is "fat". We set the flag when the entry is NOT fat; i.e. slim.
244 Replaced FatFlag by SlimFlag and initialized m_bits with this flag to indicate that the entry is
247 * runtime/SymbolTable.cpp:
248 (JSC::SymbolTableEntry::copySlow): Don't set FatFlag since it has been replaced by SlimFlag.
249 (JSC::SymbolTableEntry::inflateSlow): Ditto.
251 * runtime/SymbolTable.h:
252 (JSC::SymbolTableEntry::Fast::Fast): Set SlimFlag by default.
253 (JSC::SymbolTableEntry::Fast::isNull): Ignore SlimFlag.
254 (JSC::SymbolTableEntry::Fast::isFat): An entry is fat when m_bits is not entirely zero and SlimFlag
257 (JSC::SymbolTableEntry::SymbolTableEntry): Set SlimFlag by default.
258 (JSC::SymbolTableEntry::SymbolTableEntry::getFast): Set SlimFlag when creating Fast from a fat entry.
259 (JSC::SymbolTableEntry::isNull): Ignore SlimFlag.
260 (JSC::SymbolTableEntry::FatEntry::FatEntry): Strip SlimFlag.
261 (JSC::SymbolTableEntry::isFat): An entry is fat when m_bits is not entirely zero and SlimFlag is unset.
262 (JSC::SymbolTableEntry::fatEntry): Don't strip FatFlag as this flag doesn't exist anymore.
263 (JSC::SymbolTableEntry::pack): Preserve SlimFlag.
265 (JSC::SymbolTableIndexHashTraits): empty value is no longer zero so don't set emptyValueIsZero true.
267 2013-03-21 Mark Hahnenberg <mhahnenberg@apple.com>
269 Objective-C API: Need a good way to preserve custom properties on JS wrappers
270 https://bugs.webkit.org/show_bug.cgi?id=112608
272 Reviewed by Geoffrey Garen.
274 Currently, we just use a weak map, which means that garbage collection can cause a wrapper to
275 disappear if it isn't directly exported to JavaScript.
277 The most straightforward and safe way (with respect to garbage collection and concurrency) is to have
278 clients add and remove their external references along with their owners. Effectively, the client is
279 recording the structure of the external object graph so that the garbage collector can make sure to
280 mark any wrappers that are reachable through either the JS object graph of the external Obj-C object
281 graph. By keeping these wrappers alive, this has the effect that custom properties on these wrappers
282 will also remain alive.
284 The rule for if an object needs to be tracked by the runtime (and therefore whether the client should report it) is as follows:
285 For a particular object, its references to its children should be added if:
286 1. The child is referenced from JavaScript.
287 2. The child contains references to other objects for which (1) or (2) are true.
289 * API/JSAPIWrapperObject.mm:
290 (JSAPIWrapperObjectHandleOwner::finalize):
291 (JSAPIWrapperObjectHandleOwner::isReachableFromOpaqueRoots): A wrapper object is kept alive only if its JSGlobalObject
292 is marked and its corresponding Objective-C object was added to the set of opaque roots.
293 (JSC::JSAPIWrapperObject::visitChildren): We now call out to scanExternalObjectGraph, which handles adding all Objective-C
294 objects to the set of opaque roots.
295 * API/JSAPIWrapperObject.h:
296 (JSAPIWrapperObject):
297 * API/JSContext.mm: Moved dealloc to its proper place in the main implementation.
298 (-[JSContext dealloc]):
299 * API/JSVirtualMachine.h:
300 * API/JSVirtualMachine.mm:
301 (-[JSVirtualMachine initWithContextGroupRef:]):
302 (-[JSVirtualMachine dealloc]):
303 (getInternalObjcObject): Helper funciton to get the Objective-C object out of JSManagedValues or JSValues if there is one.
304 (-[JSVirtualMachine addManagedReference:withOwner:]): Adds the Objective-C object to the set of objects
305 owned by the owner object in that particular virtual machine.
306 (-[JSVirtualMachine removeManagedReference:withOwner:]): Removes the relationship between the two objects.
307 (-[JSVirtualMachine externalObjectGraph]):
308 (scanExternalObjectGraph): Does a depth-first search of the external object graph in a particular virtual machine starting at
309 the specified root. Each new object it encounters it adds to the set of opaque roots. These opaque roots will keep their
310 corresponding wrapper objects alive if they have them.
311 * API/JSManagedReferenceInternal.h: Added.
312 * API/JSVirtualMachine.mm: Added the per-JSVirtualMachine map between objects and the objects they own, which is more formally
313 known as that virtual machine's external object graph.
314 * API/JSWrapperMap.mm:
315 (-[JSWrapperMap dealloc]): We were leaking this before :-(
316 (-[JSVirtualMachine initWithContextGroupRef:]):
317 (-[JSVirtualMachine dealloc]):
318 (-[JSVirtualMachine externalObjectGraph]):
319 * API/JSVirtualMachineInternal.h:
320 * API/tests/testapi.mm: Added two new tests using the TinyDOMNode class. The first tests that a custom property added to a wrapper
321 doesn't vanish after GC, even though that wrapper isn't directly accessible to the JS garbage collector but is accessible through
322 the external Objective-C object graph. The second test makes sure that adding an object to the external object graph with the same
323 owner doesn't cause any sort of problems.
324 (+[TinyDOMNode sharedVirtualMachine]):
325 (-[TinyDOMNode init]):
326 (-[TinyDOMNode dealloc]):
327 (-[TinyDOMNode appendChild:]):
328 (-[TinyDOMNode numberOfChildren]):
329 (-[TinyDOMNode childAtIndex:]):
330 (-[TinyDOMNode removeChildAtIndex:]):
331 * JavaScriptCore.xcodeproj/project.pbxproj:
332 * heap/SlotVisitor.h:
334 * heap/SlotVisitorInlines.h:
335 (JSC::SlotVisitor::containsOpaqueRootTriState): Added a new method to SlotVisitor to allow scanExternalObjectGraph to have a
336 thread-safe view of opaque roots during parallel marking. The set of opaque roots available to any one SlotVisitor isn't guaranteed
337 to be 100% correct, but that just results in a small duplication of work in scanExternalObjectGraph. To indicate this change for
338 false negatives we return a TriState that's either true or mixed, but never false.
340 2013-03-21 Mark Lam <mark.lam@apple.com>
342 Fix O(n^2) op_debug bytecode charPosition to column computation.
343 https://bugs.webkit.org/show_bug.cgi?id=112957.
345 Reviewed by Geoffrey Garen.
347 The previous algorithm does a linear reverse scan of the source string
348 to find the line start for any given char position. This results in a
349 O(n^2) algortithm when the source string has no line breaks.
351 The new algorithm computes a line start column table for a
352 SourceProvider on first use. This line start table is used to fix up
353 op_debug's charPosition operand into a column operand when an
354 UnlinkedCodeBlock is linked into a CodeBlock. The initialization of
355 the line start table is O(n), and the CodeBlock column fix up is
358 * bytecode/CodeBlock.cpp:
359 (JSC::CodeBlock::dumpBytecode):
360 (JSC::CodeBlock::CodeBlock): - do column fix up.
361 * interpreter/Interpreter.cpp:
362 (JSC::Interpreter::debug): - no need to do column fixup anymore.
363 * interpreter/Interpreter.h:
365 (JSC::DEFINE_STUB_FUNCTION):
366 * llint/LLIntSlowPaths.cpp:
367 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
368 * parser/SourceProvider.cpp:
369 (JSC::SourceProvider::lineStarts):
370 (JSC::charPositionExtractor):
371 (JSC::SourceProvider::charPositionToColumnNumber):
372 - initialize line start column table if needed.
373 - look up line start for the given char position.
374 * parser/SourceProvider.h:
376 2013-03-21 Filip Pizlo <fpizlo@apple.com>
378 JSC profiler should have an at-a-glance report of the success of DFG optimization
379 https://bugs.webkit.org/show_bug.cgi?id=112988
381 Reviewed by Geoffrey Garen.
383 * dfg/DFGByteCodeParser.cpp:
384 (JSC::DFG::ByteCodeParser::handleCall):
385 (JSC::DFG::ByteCodeParser::handleGetById):
386 (JSC::DFG::ByteCodeParser::parseBlock):
387 * profiler/ProfilerCompilation.cpp:
388 (JSC::Profiler::Compilation::Compilation):
389 (JSC::Profiler::Compilation::toJS):
390 * profiler/ProfilerCompilation.h:
391 (JSC::Profiler::Compilation::noticeInlinedGetById):
392 (JSC::Profiler::Compilation::noticeInlinedPutById):
393 (JSC::Profiler::Compilation::noticeInlinedCall):
395 * runtime/CommonIdentifiers.h:
397 2013-03-21 Mark Lam <mark.lam@apple.com>
399 Fix lexer charPosition computation when "rewind"ing the lexer.
400 https://bugs.webkit.org/show_bug.cgi?id=112952.
402 Reviewed by Michael Saboff.
404 Changed the Lexer to no longer keep a m_charPosition. Instead, we compute
405 currentCharPosition() from m_code and m_codeStartPlusOffset, where
406 m_codeStartPlusOffset is the SourceProvider m_codeStart + the SourceCode
407 start offset. This ensures that the charPosition is always in sync with
412 (JSC::::internalShift):
416 (JSC::Lexer::currentCharPosition):
417 (JSC::::lexExpectIdentifier):
419 2013-03-21 Alberto Garcia <agarcia@igalia.com>
421 [BlackBerry] GCActivityCallback: replace JSLock with JSLockHolder
422 https://bugs.webkit.org/show_bug.cgi?id=112448
424 Reviewed by Xan Lopez.
426 This changed in r121381.
428 * runtime/GCActivityCallbackBlackBerry.cpp:
429 (JSC::DefaultGCActivityCallback::doWork):
431 2013-03-21 Mark Hahnenberg <mhahnenberg@apple.com>
433 Objective-C API: wrapperClass holds a static JSClassRef, which causes JSGlobalObjects to leak
434 https://bugs.webkit.org/show_bug.cgi?id=112856
436 Reviewed by Geoffrey Garen.
438 Through a very convoluted path that involves the caching of prototypes on the JSClassRef, we can leak
439 JSGlobalObjects when inserting an Objective-C object into multiple independent JSContexts.
441 * API/JSAPIWrapperObject.cpp: Removed.
442 * API/JSAPIWrapperObject.h:
443 (JSAPIWrapperObject):
444 * API/JSAPIWrapperObject.mm: Copied from Source/JavaScriptCore/API/JSAPIWrapperObject.cpp. Made this an
445 Objective-C++ file so that we can call release on the wrappedObject. Also added a WeakHandleOwner for
446 JSAPIWrapperObjects. This will also be used in a future patch for https://bugs.webkit.org/show_bug.cgi?id=112608.
447 (JSAPIWrapperObjectHandleOwner):
448 (jsAPIWrapperObjectHandleOwner):
449 (JSAPIWrapperObjectHandleOwner::finalize): This finalize replaces the old finalize that was done through
451 (JSC::JSAPIWrapperObject::finishCreation): Allocate the WeakImpl. Balanced in finalize.
452 (JSC::JSAPIWrapperObject::setWrappedObject): We now do the retain of the wrappedObject here rather than in random
453 places scattered around JSWrapperMap.mm
454 * API/JSObjectRef.cpp: Added some ifdefs for platforms that don't support the Obj-C API.
455 (JSObjectGetPrivate): Ditto.
456 (JSObjectSetPrivate): Ditto.
457 (JSObjectGetPrivateProperty): Ditto.
458 (JSObjectSetPrivateProperty): Ditto.
459 (JSObjectDeletePrivateProperty): Ditto.
460 * API/JSValueRef.cpp: Ditto.
461 (JSValueIsObjectOfClass): Ditto.
462 * API/JSWrapperMap.mm: Remove wrapperClass().
463 (objectWithCustomBrand): Change to no longer use a parent class, which was only used to give the ability to
464 finalize wrapper objects.
465 (-[JSObjCClassInfo initWithContext:forClass:superClassInfo:]): Change to no longer use wrapperClass().
466 (-[JSObjCClassInfo allocateConstructorAndPrototypeWithSuperClassInfo:]): Ditto.
467 (tryUnwrapObjcObject): We now check if the object inherits from JSAPIWrapperObject.
468 * API/tests/testapi.mm: Added a test that exports an Objective-C object to two different JSContexts and makes
469 sure that the first one is collected properly by using a weak JSManagedValue for the wrapper in the first JSContext.
470 * CMakeLists.txt: Build file modifications.
471 * GNUmakefile.list.am: Ditto.
472 * JavaScriptCore.gypi: Ditto.
473 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
474 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: Ditto.
475 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: Ditto.
476 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
477 * runtime/JSGlobalObject.cpp: More ifdefs for unsupported platforms.
478 (JSC::JSGlobalObject::reset): Ditto.
479 (JSC::JSGlobalObject::visitChildren): Ditto.
480 * runtime/JSGlobalObject.h: Ditto.
481 (JSGlobalObject): Ditto.
482 (JSC::JSGlobalObject::objcCallbackFunctionStructure): Ditto.
484 2013-03-21 Anton Muhin <antonm@chromium.org>
486 Unreviewed, rolling out r146483.
487 http://trac.webkit.org/changeset/146483
488 https://bugs.webkit.org/show_bug.cgi?id=111695
492 * bytecode/GlobalResolveInfo.h: Removed property svn:mergeinfo.
494 2013-03-21 Gabor Rapcsanyi <rgabor@webkit.org>
496 Implement LLInt for CPU(ARM_TRADITIONAL)
497 https://bugs.webkit.org/show_bug.cgi?id=97589
499 Reviewed by Zoltan Herczeg.
501 Enable LLInt for ARMv5 and ARMv7 traditional as well.
503 * llint/LLIntOfflineAsmConfig.h:
504 * llint/LowLevelInterpreter.asm:
505 * llint/LowLevelInterpreter32_64.asm:
507 * offlineasm/backends.rb:
508 * offlineasm/instructions.rb:
510 2013-03-20 Cosmin Truta <ctruta@blackberry.com>
512 [QNX][ARM] REGRESSION(r135330): Various failures in Octane
513 https://bugs.webkit.org/show_bug.cgi?id=112863
517 This was fixed in http://trac.webkit.org/changeset/146396 on Linux only.
518 Enable this fix on QNX.
520 * assembler/ARMv7Assembler.h:
522 (JSC::ARMv7Assembler::replaceWithJump):
523 (JSC::ARMv7Assembler::maxJumpReplacementSize):
524 * assembler/MacroAssemblerARMv7.h:
525 (JSC::MacroAssemblerARMv7::revertJumpReplacementToBranchPtrWithPatch):
527 2013-03-20 Filip Pizlo <fpizlo@apple.com>
529 Fix indentation of JSString.h
531 Rubber stamped by Mark Hahnenberg.
533 * runtime/JSString.h:
535 2013-03-20 Filip Pizlo <fpizlo@apple.com>
537 "" + x where x is not a string should be optimized by the DFG to some manner of ToString conversion
538 https://bugs.webkit.org/show_bug.cgi?id=112845
540 Reviewed by Mark Hahnenberg.
542 I like to do "" + x. So I decided to make DFG recognize it, and related idioms.
544 * dfg/DFGFixupPhase.cpp:
545 (JSC::DFG::FixupPhase::fixupNode):
546 (JSC::DFG::FixupPhase::fixupToPrimitive):
548 (JSC::DFG::FixupPhase::fixupToString):
549 (JSC::DFG::FixupPhase::attemptToMakeFastStringAdd):
550 * dfg/DFGPredictionPropagationPhase.cpp:
551 (JSC::DFG::resultOfToPrimitive):
553 (JSC::DFG::PredictionPropagationPhase::propagate):
554 * dfg/DFGPredictionPropagationPhase.h:
557 2013-03-20 Zoltan Herczeg <zherczeg@webkit.org>
559 ARMv7 replaceWithJump ASSERT failure after r135330.
560 https://bugs.webkit.org/show_bug.cgi?id=103146
562 Reviewed by Filip Pizlo.
564 On Linux, the 24 bit distance range of jumps sometimes does not
565 enough to cover all targets addresses. This patch supports jumps
566 outside of this range using a mov/movt/bx 10 byte long sequence.
568 * assembler/ARMv7Assembler.h:
570 (JSC::ARMv7Assembler::revertJumpTo_movT3movtcmpT2):
571 (JSC::ARMv7Assembler::nopw):
572 (JSC::ARMv7Assembler::label):
573 (JSC::ARMv7Assembler::replaceWithJump):
574 (JSC::ARMv7Assembler::maxJumpReplacementSize):
575 * assembler/MacroAssemblerARMv7.h:
576 (JSC::MacroAssemblerARMv7::revertJumpReplacementToBranchPtrWithPatch):
578 2013-03-20 Mark Hahnenberg <mhahnenberg@apple.com>
580 Objective-C API: Fix over-releasing in allocateConstructorAndPrototypeWithSuperClassInfo:
581 https://bugs.webkit.org/show_bug.cgi?id=112832
583 Reviewed by Geoffrey Garen.
585 If either the m_constructor or m_prototype (but not both) is collected, we will call
586 allocateConstructorAndPrototypeWithSuperClassInfo, which will create a new object to replace the one
587 that was collected, but at the end of the method we call release on both of them.
588 This is incorrect since we autorelease the JSValue in the case that the object doesn't need to be
589 reallocated. Thus we'll end up overreleasing later during the drain of the autorelease pool.
591 * API/JSWrapperMap.mm:
592 (objectWithCustomBrand): We no longer alloc here. We instead call the JSValue valueWithValue class method,
593 which autoreleases for us.
594 (-[JSObjCClassInfo allocateConstructorAndPrototypeWithSuperClassInfo:]): We no longer call release on the
595 constructor or prototype JSValues.
596 * API/tests/testapi.mm: Added a new test that crashes on ToT due to over-releasing.
598 2013-03-19 Filip Pizlo <fpizlo@apple.com>
600 It's called "Hash Consing" not "Hash Consting"
601 https://bugs.webkit.org/show_bug.cgi?id=112768
603 Rubber stamped by Mark Hahnenberg.
605 See http://en.wikipedia.org/wiki/Hash_consing
607 * heap/GCThreadSharedData.cpp:
608 (JSC::GCThreadSharedData::GCThreadSharedData):
609 (JSC::GCThreadSharedData::reset):
610 * heap/GCThreadSharedData.h:
611 (GCThreadSharedData):
612 * heap/SlotVisitor.cpp:
613 (JSC::SlotVisitor::SlotVisitor):
614 (JSC::SlotVisitor::setup):
615 (JSC::SlotVisitor::reset):
616 (JSC::JSString::tryHashConsLock):
617 (JSC::JSString::releaseHashConsLock):
618 (JSC::JSString::shouldTryHashCons):
619 (JSC::SlotVisitor::internalAppend):
620 * heap/SlotVisitor.h:
622 * runtime/JSGlobalData.cpp:
623 (JSC::JSGlobalData::JSGlobalData):
624 * runtime/JSGlobalData.h:
626 (JSC::JSGlobalData::haveEnoughNewStringsToHashCons):
627 (JSC::JSGlobalData::resetNewStringsSinceLastHashCons):
628 * runtime/JSString.h:
629 (JSC::JSString::finishCreation):
631 (JSC::JSString::isHashConsSingleton):
632 (JSC::JSString::clearHashConsSingleton):
633 (JSC::JSString::setHashConsSingleton):
635 2013-03-20 Filip Pizlo <fpizlo@apple.com>
637 DFG implementation of op_strcat should inline rope allocations
638 https://bugs.webkit.org/show_bug.cgi?id=112780
640 Reviewed by Oliver Hunt.
642 This gets rid of the StrCat node and adds a MakeRope node. The MakeRope node can
643 take either two or three operands, and allocates a rope string with either two or
644 three fibers. (The magic choice of three children for non-VarArg nodes happens to
645 match exactly with the magic choice of three fibers for rope strings.)
647 ValueAdd on KnownString is replaced with MakeRope with two children.
649 StrCat gets replaced by an appropriate sequence of MakeRope's.
651 MakeRope does not do the dynamic check to see if its children are empty strings.
652 This is replaced by a static check, instead. The downside is that we may use more
653 memory if the strings passed to MakeRope turn out to dynamically be empty. The
654 upside is that we do fewer checks in the cases where either the strings are not
655 empty, or where the strings are statically known to be empty. I suspect both of
656 those cases are more common, than the case where the string is dynamically empty.
658 This also results in some badness for X86. MakeRope needs six registers if it is
659 allocating a three-rope. We don't have six registers to spare on X86. Currently,
660 the code side-steps this problem by just never usign three-ropes in optimized
661 code on X86. All other architectures, including X86_64, don't have this problem.
663 This is a shocking speed-up. 9% progressions on both V8/splay and
664 SunSpider/date-format-xparb. 1% progression on V8v7 overall, and ~0.5% progression
665 on SunSpider. 2x speed-up on microbenchmarks that test op_strcat.
667 * dfg/DFGAbstractState.cpp:
668 (JSC::DFG::AbstractState::executeEffects):
669 * dfg/DFGAdjacencyList.h:
671 (JSC::DFG::AdjacencyList::removeEdge):
672 * dfg/DFGArgumentsSimplificationPhase.cpp:
673 (JSC::DFG::ArgumentsSimplificationPhase::removeArgumentsReferencingPhantomChild):
674 * dfg/DFGBackwardsPropagationPhase.cpp:
675 (JSC::DFG::BackwardsPropagationPhase::propagate):
676 * dfg/DFGByteCodeParser.cpp:
677 (JSC::DFG::ByteCodeParser::parseBlock):
678 * dfg/DFGCSEPhase.cpp:
679 (JSC::DFG::CSEPhase::putStructureStoreElimination):
680 (JSC::DFG::CSEPhase::eliminateIrrelevantPhantomChildren):
681 (JSC::DFG::CSEPhase::performNodeCSE):
682 * dfg/DFGDCEPhase.cpp:
683 (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren):
684 * dfg/DFGFixupPhase.cpp:
685 (JSC::DFG::FixupPhase::fixupNode):
686 (JSC::DFG::FixupPhase::createToString):
687 (JSC::DFG::FixupPhase::attemptToForceStringArrayModeByToStringConversion):
688 (JSC::DFG::FixupPhase::convertStringAddUse):
690 (JSC::DFG::FixupPhase::convertToMakeRope):
691 (JSC::DFG::FixupPhase::fixupMakeRope):
692 (JSC::DFG::FixupPhase::attemptToMakeFastStringAdd):
695 * dfg/DFGOperations.cpp:
696 * dfg/DFGOperations.h:
697 * dfg/DFGPredictionPropagationPhase.cpp:
698 (JSC::DFG::PredictionPropagationPhase::propagate):
699 * dfg/DFGSpeculativeJIT.cpp:
700 (JSC::DFG::SpeculativeJIT::compileAdd):
701 (JSC::DFG::SpeculativeJIT::compileMakeRope):
703 * dfg/DFGSpeculativeJIT.h:
704 (JSC::DFG::SpeculativeJIT::callOperation):
706 (JSC::DFG::SpeculateCellOperand::SpeculateCellOperand):
707 (JSC::DFG::SpeculateCellOperand::~SpeculateCellOperand):
708 (JSC::DFG::SpeculateCellOperand::gpr):
709 (JSC::DFG::SpeculateCellOperand::use):
710 * dfg/DFGSpeculativeJIT32_64.cpp:
711 (JSC::DFG::SpeculativeJIT::compile):
712 * dfg/DFGSpeculativeJIT64.cpp:
713 (JSC::DFG::SpeculativeJIT::compile):
714 * runtime/JSString.h:
717 2013-03-20 Peter Gal <galpeter@inf.u-szeged.hu>
719 Implement and32 on MIPS platform
720 https://bugs.webkit.org/show_bug.cgi?id=112665
722 Reviewed by Zoltan Herczeg.
724 * assembler/MacroAssemblerMIPS.h:
725 (JSC::MacroAssemblerMIPS::and32): Added missing method.
726 (MacroAssemblerMIPS):
728 2013-03-20 Mark Lam <mark.lam@apple.com>
730 Fix incorrect debugger column number value.
731 https://bugs.webkit.org/show_bug.cgi?id=112741.
733 Reviewed by Oliver Hunt.
735 1. In lexer, parser, and debugger code, renamed column to charPosition.
736 2. Convert the charPosition to the equivalent column number before
737 passing it to the debugger.
738 3. Changed ScopeNodes to take both a startLocation and an endLocation.
739 This allows FunctionBodyNodes, ProgramNodes, and EvalNodess to emit
740 correct debug hooks with correct starting line and column numbers.
741 4. Fixed the Lexer to not reset the charPosition (previously
742 columnNumber) in Lexer::lex().
744 * JavaScriptCore.order:
745 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
746 * JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in:
747 * bytecode/CodeBlock.cpp:
748 (JSC::CodeBlock::dumpBytecode):
749 * bytecompiler/BytecodeGenerator.cpp:
750 (JSC::BytecodeGenerator::emitDebugHook):
751 * bytecompiler/BytecodeGenerator.h:
752 (JSC::BytecodeGenerator::emitExpressionInfo):
753 * bytecompiler/NodesCodegen.cpp:
754 (JSC::ArrayNode::toArgumentList):
755 (JSC::ConstStatementNode::emitBytecode):
756 (JSC::EmptyStatementNode::emitBytecode):
757 (JSC::DebuggerStatementNode::emitBytecode):
758 (JSC::ExprStatementNode::emitBytecode):
759 (JSC::VarStatementNode::emitBytecode):
760 (JSC::IfNode::emitBytecode):
761 (JSC::IfElseNode::emitBytecode):
762 (JSC::DoWhileNode::emitBytecode):
763 (JSC::WhileNode::emitBytecode):
764 (JSC::ForNode::emitBytecode):
765 (JSC::ForInNode::emitBytecode):
766 (JSC::ContinueNode::emitBytecode):
767 (JSC::BreakNode::emitBytecode):
768 (JSC::ReturnNode::emitBytecode):
769 (JSC::WithNode::emitBytecode):
770 (JSC::SwitchNode::emitBytecode):
771 (JSC::LabelNode::emitBytecode):
772 (JSC::ThrowNode::emitBytecode):
773 (JSC::TryNode::emitBytecode):
774 (JSC::ProgramNode::emitBytecode):
775 (JSC::EvalNode::emitBytecode):
776 (JSC::FunctionBodyNode::emitBytecode):
777 * interpreter/Interpreter.cpp:
778 (JSC::Interpreter::debug):
779 - convert charPosition to column for the debugger.
780 * interpreter/Interpreter.h:
782 (DEFINE_STUB_FUNCTION(void, op_debug)):
783 * llint/LLIntSlowPaths.cpp:
784 (LLINT_SLOW_PATH_DECL(slow_op_debug)):
785 * parser/ASTBuilder.h:
786 (JSC::ASTBuilder::createFunctionExpr):
787 (JSC::ASTBuilder::createFunctionBody):
788 (JSC::ASTBuilder::createGetterOrSetterProperty):
789 (JSC::ASTBuilder::createFuncDeclStatement):
790 (JSC::ASTBuilder::createBlockStatement):
791 (JSC::ASTBuilder::createExprStatement):
792 (JSC::ASTBuilder::createIfStatement):
793 (JSC::ASTBuilder::createForLoop):
794 (JSC::ASTBuilder::createForInLoop):
795 (JSC::ASTBuilder::createVarStatement):
796 (JSC::ASTBuilder::createReturnStatement):
797 (JSC::ASTBuilder::createBreakStatement):
798 (JSC::ASTBuilder::createContinueStatement):
799 (JSC::ASTBuilder::createTryStatement):
800 (JSC::ASTBuilder::createSwitchStatement):
801 (JSC::ASTBuilder::createWhileStatement):
802 (JSC::ASTBuilder::createDoWhileStatement):
803 (JSC::ASTBuilder::createWithStatement):
804 (JSC::ASTBuilder::createThrowStatement):
805 (JSC::ASTBuilder::createDebugger):
806 (JSC::ASTBuilder::createConstStatement):
809 (JSC::::internalShift):
813 (JSC::Lexer::currentCharPosition):
815 (JSC::::lexExpectIdentifier):
816 * parser/NodeConstructors.h:
819 (JSC::StatementNode::setLoc):
820 (JSC::ScopeNode::ScopeNode):
821 (JSC::ProgramNode::ProgramNode):
822 (JSC::ProgramNode::create):
823 (JSC::EvalNode::EvalNode):
824 (JSC::EvalNode::create):
825 (JSC::FunctionBodyNode::FunctionBodyNode):
826 (JSC::FunctionBodyNode::create):
828 (JSC::Node::charPosition):
831 (JSC::StatementNode::lastLine):
833 (JSC::ScopeNode::startLine):
834 (JSC::ScopeNode::startCharPosition):
840 (JSC::::parseFunctionBody):
841 (JSC::::parseFunctionInfo):
844 * parser/ParserTokens.h:
845 (JSC::JSTokenLocation::JSTokenLocation):
847 * parser/SyntaxChecker.h:
848 (JSC::SyntaxChecker::createFunctionBody):
850 2013-03-20 Csaba Osztrogonác <ossy@webkit.org>
852 REGRESSION(r146089): It broke 20 sputnik tests on ARM traditional and Thumb2
853 https://bugs.webkit.org/show_bug.cgi?id=112676
855 Rubber-stamped by Filip Pizlo.
857 Add one more EABI_32BIT_DUMMY_ARG to make DFG JIT ARM EABI compatible
858 again after r146089 similar to https://bugs.webkit.org/show_bug.cgi?id=84449
860 * dfg/DFGSpeculativeJIT.h:
861 (JSC::DFG::SpeculativeJIT::callOperation):
863 2013-03-19 Michael Saboff <msaboff@apple.com>
865 Crash when loading http://www.jqchart.com/jquery/gauges/RadialGauge/LiveData
866 https://bugs.webkit.org/show_bug.cgi?id=112694
868 Reviewed by Filip Pizlo.
870 We were trying to convert an NewArray to a Phantom, but convertToPhantom doesn't handle
871 nodes with variable arguments. Added code to insert a Phantom node in front of all the
872 live children of a var args node. Added ASSERT not var args for convertToPhantom to
873 catch any other similar cases. Added a new convertToPhantomUnchecked() for converting
876 * dfg/DFGDCEPhase.cpp:
877 (JSC::DFG::DCEPhase::run):
880 (JSC::DFG::Node::setOpAndDefaultNonExitFlags): Added ASSERT(!(m_flags & NodeHasVarArgs))
881 (JSC::DFG::Node::setOpAndDefaultNonExitFlagsUnchecked):
882 (JSC::DFG::Node::convertToPhantomUnchecked):
884 2013-03-19 Mark Hahnenberg <mhahnenberg@apple.com>
886 Crash in SpeculativeJIT::fillSpeculateIntInternal<false> on http://bellard.org/jslinux
887 https://bugs.webkit.org/show_bug.cgi?id=112738
889 Reviewed by Filip Pizlo.
891 * dfg/DFGFixupPhase.cpp:
892 (JSC::DFG::FixupPhase::fixIntEdge): We shouldn't be killing this node because it could be
893 referenced by other people.
895 2013-03-19 Oliver Hunt <oliver@apple.com>
897 RELEASE_ASSERT fires in exception handler lookup
901 Temporarily switch this RELEASE_ASSERT into a regular ASSERT
902 as currently this is producing fairly bad crashiness.
904 * bytecode/CodeBlock.cpp:
905 (JSC::CodeBlock::handlerForBytecodeOffset):
907 2013-03-18 Filip Pizlo <fpizlo@apple.com>
909 DFG should optimize StringObject.length and StringOrStringObject.length
910 https://bugs.webkit.org/show_bug.cgi?id=112658
912 Reviewed by Mark Hahnenberg.
914 Implemented by injecting a ToString(StringObject:@a) or ToString(StringOrStringObject:@a) prior
915 to GetArrayLength with ArrayMode(Array::String) if @a is predicted StringObject or
916 StringOrStringObject.
918 * dfg/DFGFixupPhase.cpp:
919 (JSC::DFG::FixupPhase::fixupNode):
920 (JSC::DFG::FixupPhase::createToString):
922 (JSC::DFG::FixupPhase::attemptToForceStringArrayModeByToStringConversion):
923 (JSC::DFG::FixupPhase::convertStringAddUse):
925 2013-03-19 Gabor Rapcsanyi <rgabor@webkit.org>
927 Implement and32 on ARMv7 and ARM traditional platforms
928 https://bugs.webkit.org/show_bug.cgi?id=112663
930 Reviewed by Zoltan Herczeg.
932 * assembler/MacroAssemblerARM.h:
933 (JSC::MacroAssemblerARM::and32): Add missing method.
935 * assembler/MacroAssemblerARMv7.h:
936 (JSC::MacroAssemblerARMv7::and32): Add missing method.
937 (MacroAssemblerARMv7):
939 2013-03-18 Filip Pizlo <fpizlo@apple.com>
941 DFG ToString generic cases should work correctly
942 https://bugs.webkit.org/show_bug.cgi?id=112654
943 <rdar://problem/13447250>
945 Reviewed by Geoffrey Garen.
947 * dfg/DFGSpeculativeJIT.cpp:
948 (JSC::DFG::SpeculativeJIT::compileToStringOnCell):
949 * dfg/DFGSpeculativeJIT32_64.cpp:
950 (JSC::DFG::SpeculativeJIT::compile):
951 * dfg/DFGSpeculativeJIT64.cpp:
952 (JSC::DFG::SpeculativeJIT::compile):
954 2013-03-18 Michael Saboff <msaboff@apple.com>
956 Unreviewed build fix for 32 bit builds.
958 * dfg/DFGSpeculativeJIT32_64.cpp:
959 (JSC::DFG::SpeculativeJIT::compile):
961 2013-03-18 Michael Saboff <msaboff@apple.com>
963 EFL: Unsafe branch detected in compilePutByValForFloatTypedArray()
964 https://bugs.webkit.org/show_bug.cgi?id=112609
966 Reviewed by Geoffrey Garen.
968 Created local valueFPR and scratchFPR and filled them with valueOp.fpr() and scratch.fpr()
969 respectively so that if valueOp.fpr() causes a spill during allocation, it occurs before the
970 branch and also to follow convention. Added register allocation checks to FPRTemporary.
971 Cleaned up a couple of other places to follow the "AllocatVirtualRegType foo, get machine
972 reg from foo" pattern.
974 * dfg/DFGSpeculativeJIT.cpp:
975 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
976 * dfg/DFGSpeculativeJIT.h:
977 (JSC::DFG::SpeculativeJIT::fprAllocate):
978 * dfg/DFGSpeculativeJIT32_64.cpp:
979 (JSC::DFG::SpeculativeJIT::convertToDouble):
980 (JSC::DFG::SpeculativeJIT::compile):
981 * dfg/DFGSpeculativeJIT64.cpp:
982 (JSC::DFG::SpeculativeJIT::compile):
984 2013-03-18 Filip Pizlo <fpizlo@apple.com>
986 DFG should inline binary string concatenations (i.e. ValueAdd with string children)
987 https://bugs.webkit.org/show_bug.cgi?id=112599
989 Reviewed by Oliver Hunt.
991 This does as advertised: if you do x + y where x and y are strings, you'll get
992 a fast inlined JSRopeString allocation (along with whatever checks are necessary).
993 It also does good things if either x or y (or both) are StringObjects, or some
994 other thing like StringOrStringObject. It also lays the groundwork for making this
995 fast if either x or y are numbers, or some other reasonably-cheap-to-convert
998 * dfg/DFGAbstractState.cpp:
999 (JSC::DFG::AbstractState::executeEffects):
1000 * dfg/DFGFixupPhase.cpp:
1001 (JSC::DFG::FixupPhase::fixupNode):
1003 (JSC::DFG::FixupPhase::isStringObjectUse):
1004 (JSC::DFG::FixupPhase::convertStringAddUse):
1005 (JSC::DFG::FixupPhase::attemptToMakeFastStringAdd):
1006 * dfg/DFGOperations.cpp:
1007 * dfg/DFGOperations.h:
1008 * dfg/DFGSpeculativeJIT.cpp:
1009 (JSC::DFG::SpeculativeJIT::compileAdd):
1010 * dfg/DFGSpeculativeJIT.h:
1011 (JSC::DFG::SpeculativeJIT::callOperation):
1013 (JSC::DFG::SpeculativeJIT::emitAllocateJSCell):
1014 (JSC::DFG::SpeculativeJIT::emitAllocateJSObject):
1015 * runtime/JSString.h:
1016 (JSC::JSString::offsetOfFlags):
1019 (JSC::JSRopeString::offsetOfFibers):
1021 2013-03-18 Filip Pizlo <fpizlo@apple.com>
1023 JSC_NATIVE_FUNCTION() takes an identifier for the name and then uses #name, which is unsafe if name was already #define'd to something else
1024 https://bugs.webkit.org/show_bug.cgi?id=112639
1026 Reviewed by Michael Saboff.
1028 Change it to take a string instead.
1030 * runtime/JSObject.h:
1032 * runtime/ObjectPrototype.cpp:
1033 (JSC::ObjectPrototype::finishCreation):
1034 * runtime/StringPrototype.cpp:
1035 (JSC::StringPrototype::finishCreation):
1037 2013-03-18 Brent Fulgham <bfulgham@webkit.org>
1039 [WinCairo] Get build working under VS2010.
1040 https://bugs.webkit.org/show_bug.cgi?id=112604
1042 Reviewed by Tim Horton.
1044 * JavaScriptCore.vcxproj/testapi/testapi.vcxproj: Use CFLite-specific
1045 build target (standard version links against CoreFoundation.lib
1046 instead of CFLite.lib).
1047 * JavaScriptCore.vcxproj/testapi/testapiCommonCFLite.props: Added.
1048 * JavaScriptCore.vcxproj/testapi/testapiDebugCFLite.props: Added.
1049 * JavaScriptCore.vcxproj/testapi/testapiReleaseCFLite.props: Added.
1051 2013-03-18 Roger Fong <roger_fong@apple.com>
1053 AppleWin VS2010 Debug configuration build fix..
1055 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
1057 2013-03-18 Brent Fulgham <bfulgham@webkit.org>
1059 [WinCairo] Get build working under VS2010.
1060 https://bugs.webkit.org/show_bug.cgi?id=112604
1062 Reviewed by Tim Horton.
1064 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: Add build targets for
1065 Debug_WinCairo and Release_WinCairo using CFLite.
1066 * JavaScriptCore.vcxproj/JavaScriptCoreCFLite.props: Added.
1067 * JavaScriptCore.vcxproj/JavaScriptCoreDebugCFLite.props: Added.
1068 * JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExportGenerator.vcxproj:
1069 Add Debug_WinCairo and Release_WinCairo build targets to
1070 make sure headers are copied to proper build folder.
1071 * JavaScriptCore.vcxproj/JavaScriptCoreGenerated.vcxproj: Ditto.
1072 * JavaScriptCore.vcxproj/JavaScriptCoreReleaseCFLite.props: Added.
1073 * JavaScriptCore.vcxproj/LLInt/LLIntAssembly/LLIntAssembly.vcxproj:
1074 Add Debug_WinCairo and Release_WinCairo build targets to
1075 make sure headers are copied to proper build folder.
1076 * JavaScriptCore.vcxproj/LLInt/LLIntDesiredOffsets/LLIntDesiredOffsets.vcxproj:
1078 * JavaScriptCore.vcxproj/LLInt/LLIntOffsetsExtractor/LLIntOffsetsExtractor.vcxproj:
1080 * JavaScriptCore.vcxproj/jsc/jsc.vcxproj: Ditto.
1081 * JavaScriptCore.vcxproj/testRegExp/testRegExp.vcxproj: Ditto.
1082 * JavaScriptCore.vcxproj/testapi/testapi.vcxproj: Ditto.
1084 2013-03-18 Michael Saboff <msaboff@apple.com>
1086 Potentially unsafe register allocations in DFG code generation
1087 https://bugs.webkit.org/show_bug.cgi?id=112477
1089 Reviewed by Geoffrey Garen.
1091 Moved allocation of temporary GPRs to be before any generated branches in the functions below.
1093 * dfg/DFGSpeculativeJIT32_64.cpp:
1094 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
1095 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
1096 (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
1097 * dfg/DFGSpeculativeJIT64.cpp:
1098 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
1099 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
1100 (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
1102 2013-03-15 Filip Pizlo <fpizlo@apple.com>
1104 DFG string conversions and allocations should be inlined
1105 https://bugs.webkit.org/show_bug.cgi?id=112376
1107 Reviewed by Geoffrey Garen.
1109 This turns new String(), String(), String.prototype.valueOf(), and
1110 String.prototype.toString() into intrinsics. It gives the DFG the ability to handle
1111 conversions from StringObject to JSString and vice-versa, and also gives it the
1112 ability to handle cases where a variable may be either a StringObject or a JSString.
1113 To do this, I added StringObject to value profiling (and removed the stale
1114 distinction between Myarguments and Foreignarguments). I also cleaned up ToPrimitive
1115 handling, using some of the new functionality but also taking advantage of the
1116 existence of Identity(String:@a).
1118 This is a 2% SunSpider speed-up. Also there are some speed-ups on V8v7 and Kraken.
1119 On microbenchmarks that stress new String() this is a 14x speed-up.
1122 * DerivedSources.make:
1123 * DerivedSources.pri:
1124 * GNUmakefile.list.am:
1125 * bytecode/CodeBlock.h:
1127 (JSC::CodeBlock::hasExitSite):
1129 * bytecode/DFGExitProfile.cpp:
1130 (JSC::DFG::ExitProfile::hasExitSite):
1132 * bytecode/DFGExitProfile.h:
1134 (JSC::DFG::ExitProfile::hasExitSite):
1135 * bytecode/ExitKind.cpp:
1136 (JSC::exitKindToString):
1137 * bytecode/ExitKind.h:
1138 * bytecode/SpeculatedType.cpp:
1139 (JSC::dumpSpeculation):
1140 (JSC::speculationToAbbreviatedString):
1141 (JSC::speculationFromClassInfo):
1142 * bytecode/SpeculatedType.h:
1144 (JSC::isStringObjectSpeculation):
1145 (JSC::isStringOrStringObjectSpeculation):
1146 * create_hash_table:
1147 * dfg/DFGAbstractState.cpp:
1148 (JSC::DFG::AbstractState::executeEffects):
1149 * dfg/DFGAbstractState.h:
1150 (JSC::DFG::AbstractState::filterEdgeByUse):
1151 * dfg/DFGByteCodeParser.cpp:
1153 (JSC::DFG::ByteCodeParser::handleCall):
1154 (JSC::DFG::ByteCodeParser::emitArgumentPhantoms):
1156 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
1157 * dfg/DFGCSEPhase.cpp:
1158 (JSC::DFG::CSEPhase::putStructureStoreElimination):
1160 (JSC::DFG::Edge::shift):
1161 * dfg/DFGFixupPhase.cpp:
1162 (JSC::DFG::FixupPhase::fixupNode):
1163 (JSC::DFG::FixupPhase::isStringPrototypeMethodSane):
1165 (JSC::DFG::FixupPhase::canOptimizeStringObjectAccess):
1166 (JSC::DFG::FixupPhase::observeUseKindOnNode):
1168 (JSC::DFG::Graph::hasGlobalExitSite):
1170 (JSC::DFG::Graph::hasExitSite):
1171 (JSC::DFG::Graph::clobbersWorld):
1173 (JSC::DFG::Node::convertToToString):
1175 (JSC::DFG::Node::hasStructure):
1176 (JSC::DFG::Node::shouldSpeculateStringObject):
1177 (JSC::DFG::Node::shouldSpeculateStringOrStringObject):
1178 * dfg/DFGNodeType.h:
1180 * dfg/DFGOperations.cpp:
1181 * dfg/DFGOperations.h:
1182 * dfg/DFGPredictionPropagationPhase.cpp:
1183 (JSC::DFG::PredictionPropagationPhase::propagate):
1184 * dfg/DFGSpeculativeJIT.cpp:
1185 (JSC::DFG::SpeculativeJIT::compileToStringOnCell):
1187 (JSC::DFG::SpeculativeJIT::compileNewStringObject):
1188 (JSC::DFG::SpeculativeJIT::speculateObject):
1189 (JSC::DFG::SpeculativeJIT::speculateObjectOrOther):
1190 (JSC::DFG::SpeculativeJIT::speculateString):
1191 (JSC::DFG::SpeculativeJIT::speculateStringObject):
1192 (JSC::DFG::SpeculativeJIT::speculateStringOrStringObject):
1193 (JSC::DFG::SpeculativeJIT::speculate):
1194 * dfg/DFGSpeculativeJIT.h:
1195 (JSC::DFG::SpeculativeJIT::callOperation):
1197 (JSC::DFG::SpeculateCellOperand::SpeculateCellOperand):
1199 (JSC::DFG::SpeculativeJIT::speculateStringObjectForStructure):
1200 * dfg/DFGSpeculativeJIT32_64.cpp:
1201 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
1202 (JSC::DFG::SpeculativeJIT::compile):
1203 * dfg/DFGSpeculativeJIT64.cpp:
1204 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
1205 (JSC::DFG::SpeculativeJIT::compile):
1206 * dfg/DFGUseKind.cpp:
1207 (WTF::printInternal):
1209 (JSC::DFG::typeFilterFor):
1210 * interpreter/CallFrame.h:
1211 (JSC::ExecState::regExpPrototypeTable):
1212 * runtime/CommonIdentifiers.h:
1213 * runtime/Intrinsic.h:
1214 * runtime/JSDestructibleObject.h:
1215 (JSDestructibleObject):
1216 (JSC::JSDestructibleObject::classInfoOffset):
1217 * runtime/JSGlobalData.cpp:
1219 (JSC::JSGlobalData::JSGlobalData):
1220 (JSC::JSGlobalData::~JSGlobalData):
1221 * runtime/JSGlobalData.h:
1223 * runtime/JSObject.cpp:
1224 * runtime/JSObject.h:
1226 * runtime/JSWrapperObject.h:
1227 (JSC::JSWrapperObject::allocationSize):
1229 (JSC::JSWrapperObject::internalValueOffset):
1230 (JSC::JSWrapperObject::internalValueCellOffset):
1231 * runtime/StringPrototype.cpp:
1233 (JSC::StringPrototype::finishCreation):
1234 (JSC::StringPrototype::create):
1235 * runtime/StringPrototype.h:
1238 2013-03-18 Filip Pizlo <fpizlo@apple.com>
1240 ObjectPrototype properties should be eagerly created rather than lazily via static tables
1241 https://bugs.webkit.org/show_bug.cgi?id=112539
1243 Reviewed by Oliver Hunt.
1245 This is the first part of https://bugs.webkit.org/show_bug.cgi?id=112233. Rolling this
1246 in first since it's the less-likely-to-be-broken part.
1249 * DerivedSources.make:
1250 * DerivedSources.pri:
1251 * GNUmakefile.list.am:
1252 * interpreter/CallFrame.h:
1253 (JSC::ExecState::objectConstructorTable):
1254 * runtime/CommonIdentifiers.h:
1255 * runtime/JSGlobalData.cpp:
1257 (JSC::JSGlobalData::JSGlobalData):
1258 (JSC::JSGlobalData::~JSGlobalData):
1259 * runtime/JSGlobalData.h:
1261 * runtime/JSObject.cpp:
1262 (JSC::JSObject::putDirectNativeFunction):
1264 * runtime/JSObject.h:
1267 * runtime/Lookup.cpp:
1268 (JSC::setUpStaticFunctionSlot):
1269 * runtime/ObjectPrototype.cpp:
1271 (JSC::ObjectPrototype::finishCreation):
1272 (JSC::ObjectPrototype::create):
1273 * runtime/ObjectPrototype.h:
1276 2013-03-16 Pratik Solanki <psolanki@apple.com>
1278 Disable High DPI Canvas on iOS
1279 https://bugs.webkit.org/show_bug.cgi?id=112511
1281 Reviewed by Joseph Pecoraro.
1283 * Configurations/FeatureDefines.xcconfig:
1285 2013-03-15 Andreas Kling <akling@apple.com>
1287 Don't also clone StructureRareData when cloning Structure.
1288 <http://webkit.org/b/111672>
1290 Reviewed by Mark Hahnenberg.
1292 We were cloning a lot of StructureRareData with only the previousID pointer set since
1293 the enumerationCache is not shared between clones.
1295 Let the Structure copy constructor decide whether it wants to clone the rare data.
1296 The decision is made by StructureRareData::needsCloning() and will currently always
1297 return false, since StructureRareData only holds on to caches at present.
1298 This may change in the future as more members are added to StructureRareData.
1300 * runtime/Structure.cpp:
1301 (JSC::Structure::Structure):
1302 (JSC::Structure::cloneRareDataFrom):
1303 * runtime/StructureInlines.h:
1304 (JSC::Structure::create):
1306 2013-03-15 Mark Hahnenberg <mhahnenberg@apple.com>
1309 https://bugs.webkit.org/show_bug.cgi?id=112458
1311 Unreviewed. Requested by Filip Pizlo.
1314 * DerivedSources.make:
1315 * DerivedSources.pri:
1316 * GNUmakefile.list.am:
1317 * dfg/DFGOperations.cpp:
1318 * interpreter/CallFrame.h:
1319 (JSC::ExecState::objectPrototypeTable):
1322 * llint/LLIntSlowPaths.cpp:
1323 (JSC::LLInt::getByVal):
1324 * runtime/CommonIdentifiers.h:
1325 * runtime/JSCell.cpp:
1329 * runtime/JSCellInlines.h:
1331 (JSC::JSCell::fastGetOwnProperty):
1332 * runtime/JSGlobalData.cpp:
1334 (JSC::JSGlobalData::JSGlobalData):
1335 (JSC::JSGlobalData::~JSGlobalData):
1336 * runtime/JSGlobalData.h:
1338 * runtime/JSObject.cpp:
1340 * runtime/JSObject.h:
1343 * runtime/Lookup.cpp:
1344 (JSC::setUpStaticFunctionSlot):
1345 * runtime/ObjectPrototype.cpp:
1347 (JSC::ObjectPrototype::finishCreation):
1348 (JSC::ObjectPrototype::getOwnPropertySlot):
1349 (JSC::ObjectPrototype::getOwnPropertyDescriptor):
1350 * runtime/ObjectPrototype.h:
1351 (JSC::ObjectPrototype::create):
1353 * runtime/PropertyMapHashTable.h:
1354 (JSC::PropertyTable::findWithString):
1355 * runtime/Structure.h:
1357 * runtime/StructureInlines.h:
1358 (JSC::Structure::get):
1360 2013-03-15 Michael Saboff <msaboff@apple.com>
1362 Cleanup of DFG and Baseline JIT debugging code
1363 https://bugs.webkit.org/show_bug.cgi?id=111871
1365 Reviewed by Geoffrey Garen.
1367 Fixed various debug related issue in baseline and DFG JITs. See below.
1369 * dfg/DFGRepatch.cpp:
1370 (JSC::DFG::dfgLinkClosureCall): Used pointerDump() to handle when calleeCodeBlock is NULL.
1371 * dfg/DFGScratchRegisterAllocator.h: Now use ScratchBuffer::activeLengthPtr() to get
1372 pointer to scratch register length.
1373 (JSC::DFG::ScratchRegisterAllocator::preserveUsedRegistersToScratchBuffer):
1374 (JSC::DFG::ScratchRegisterAllocator::restoreUsedRegistersFromScratchBuffer):
1375 * dfg/DFGSpeculativeJIT.cpp:
1376 (JSC::DFG::SpeculativeJIT::checkConsistency): Added missing case labels for DataFormatOSRMarker,
1377 DataFormatDead, and DataFormatArguments and made them RELEASE_ASSERT_NOT_REACHED();
1379 (JSC::JIT::privateCompileClosureCall): Used pointerDump() to handle when calleeCodeBlock is NULL.
1380 * jit/JITCall32_64.cpp:
1381 (JSC::JIT::privateCompileClosureCall): Used pointerDump() to handle when calleeCodeBlock is NULL.
1382 * runtime/JSGlobalData.h:
1383 (JSC::ScratchBuffer::ScratchBuffer): Fixed buffer allocation alignment to
1384 be on a double boundary.
1385 (JSC::ScratchBuffer::setActiveLength):
1386 (JSC::ScratchBuffer::activeLength):
1387 (JSC::ScratchBuffer::activeLengthPtr):
1389 2013-03-15 Michael Saboff <msaboff@apple.com>
1391 Add runtime check for improper register allocations in DFG
1392 https://bugs.webkit.org/show_bug.cgi?id=112380
1394 Reviewed by Geoffrey Garen.
1396 Added framework to check for register allocation within a branch source - target range. All register allocations
1397 are saved using the offset in the code stream where the allocation occurred. Later when a jump is linked, the
1398 currently saved register allocations are checked to make sure that they didn't occur in the range of code that was
1399 jumped over. This protects against the case where an allocation could have spilled register contents to free up
1400 a register and that spill only occurs on one path of a many through the code. A subsequent fill of the spilled
1401 register may load garbage. See https://bugs.webkit.org/show_bug.cgi?id=111777 for one such bug.
1402 This code is protected by the compile time check of #if ENABLE(DFG_REGISTER_ALLOCATION_VALIDATION).
1403 The check is only done during the processing of SpeculativeJIT::compile(Node* node) and its callees.
1405 * assembler/AbstractMacroAssembler.h:
1406 (JSC::AbstractMacroAssembler::Jump::link): Invoke register allocation checks using source and target of link.
1407 (JSC::AbstractMacroAssembler::Jump::linkTo): Invoke register allocation checks using source and target of link.
1408 (AbstractMacroAssembler):
1409 (RegisterAllocationOffset): New helper class to store the instruction stream offset and compare against a
1411 (JSC::AbstractMacroAssembler::RegisterAllocationOffset::RegisterAllocationOffset):
1412 (JSC::AbstractMacroAssembler::RegisterAllocationOffset::check):
1413 (JSC::AbstractMacroAssembler::addRegisterAllocationAtOffset):
1414 (JSC::AbstractMacroAssembler::clearRegisterAllocationOffsets):
1415 (JSC::AbstractMacroAssembler::checkRegisterAllocationAgainstBranchRange):
1416 * dfg/DFGSpeculativeJIT.h:
1417 (JSC::DFG::SpeculativeJIT::allocate):
1418 * dfg/DFGSpeculativeJIT32_64.cpp:
1419 (JSC::DFG::SpeculativeJIT::compile):
1420 * dfg/DFGSpeculativeJIT64.cpp:
1421 (JSC::DFG::SpeculativeJIT::compile):
1423 2013-03-14 Oliver Hunt <oliver@apple.com>
1425 REGRESSION(r145000): Crash loading arstechnica.com when Safari Web Inspector is open
1426 https://bugs.webkit.org/show_bug.cgi?id=111868
1428 Reviewed by Antti Koivisto.
1430 Don't allow non-local property lookup when the debugger is enabled.
1432 * bytecompiler/BytecodeGenerator.cpp:
1433 (JSC::BytecodeGenerator::resolve):
1435 2013-03-11 Mark Hahnenberg <mhahnenberg@apple.com>
1437 Objective-C API: Objective-C functions exposed to JavaScript have the wrong type (object instead of function)
1438 https://bugs.webkit.org/show_bug.cgi?id=105892
1440 Reviewed by Geoffrey Garen.
1442 Changed ObjCCallbackFunction to subclass JSCallbackFunction which already has all of the machinery to call
1443 functions using the C API. Since ObjCCallbackFunction is now a JSCell, we changed the old implementation of
1444 ObjCCallbackFunction to be the internal implementation and keep track of all the proper data so that we
1445 don't have to put all of that in the header, which will now be included from C++ files (e.g. JSGlobalObject.cpp).
1447 * API/JSCallbackFunction.cpp: Change JSCallbackFunction to allow subclassing. Originally it was internally
1448 passing its own Structure up the chain of constructors, but we now want to be able to pass other Structures as well.
1449 (JSC::JSCallbackFunction::JSCallbackFunction):
1450 (JSC::JSCallbackFunction::create):
1451 * API/JSCallbackFunction.h:
1452 (JSCallbackFunction):
1453 * API/JSWrapperMap.mm: Changed interface to tryUnwrapBlock.
1454 (tryUnwrapObjcObject):
1455 * API/ObjCCallbackFunction.h:
1456 (ObjCCallbackFunction): Moved into the JSC namespace, just like JSCallbackFunction.
1457 (JSC::ObjCCallbackFunction::createStructure): Overridden so that the correct ClassInfo gets used since we have
1459 (JSC::ObjCCallbackFunction::impl): Getter for the internal impl.
1460 * API/ObjCCallbackFunction.mm:
1461 (JSC::ObjCCallbackFunctionImpl::ObjCCallbackFunctionImpl): What used to be ObjCCallbackFunction is now
1462 ObjCCallbackFunctionImpl. It handles the Objective-C specific parts of managing callback functions.
1463 (JSC::ObjCCallbackFunctionImpl::~ObjCCallbackFunctionImpl):
1464 (JSC::objCCallbackFunctionCallAsFunction): Same as the old one, but now it casts to ObjCCallbackFunction and grabs the impl
1465 rather than using JSObjectGetPrivate.
1466 (JSC::ObjCCallbackFunction::ObjCCallbackFunction): New bits to allow being part of the JSCell hierarchy.
1467 (JSC::ObjCCallbackFunction::create):
1468 (JSC::ObjCCallbackFunction::destroy):
1469 (JSC::ObjCCallbackFunctionImpl::call): Handles the actual invocation, just like it used to.
1470 (objCCallbackFunctionForInvocation):
1471 (tryUnwrapBlock): Changed to check the ClassInfo for inheritance directly, rather than going through the C API call.
1472 * API/tests/testapi.mm: Added new test to make sure that doing Function.prototype.toString.call(f) won't result in
1473 an error when f is an Objective-C method or block underneath the covers.
1474 * runtime/JSGlobalObject.cpp: Added new Structure for ObjCCallbackFunction.
1475 (JSC::JSGlobalObject::reset):
1476 (JSC::JSGlobalObject::visitChildren):
1477 * runtime/JSGlobalObject.h:
1479 (JSC::JSGlobalObject::objcCallbackFunctionStructure):
1481 2013-03-14 Mark Hahnenberg <mhahnenberg@apple.com>
1483 Objective-C API: Nested dictionaries are not converted properly in the Objective-C binding
1484 https://bugs.webkit.org/show_bug.cgi?id=112377
1486 Reviewed by Oliver Hunt.
1488 Accidental reassignment of the root task in the container conversion logic was causing the last
1489 array or dictionary processed to be returned in the case of nested containers.
1492 (containerValueToObject):
1493 * API/tests/testapi.mm:
1495 2013-03-13 Filip Pizlo <fpizlo@apple.com>
1497 JSObject fast by-string access optimizations should work even on the prototype chain, and even when the result is undefined
1498 https://bugs.webkit.org/show_bug.cgi?id=112233
1500 Reviewed by Oliver Hunt.
1502 Extended the existing fast access path for String keys to work over the entire prototype chain,
1503 not just the self access case. This will fail as soon as it sees an object that intercepts
1504 getOwnPropertySlot, so this patch also ensures that ObjectPrototype does not fall into that
1505 category. This is accomplished by making ObjectPrototype eagerly reify all of its properties.
1506 This is safe for ObjectPrototype because it's so common and we expect all of its properties to
1507 be reified for any interesting programs anyway. A new idiom for adding native functions to
1508 prototypes is introduced, which ought to work well for any other prototypes that we wish to do
1509 this conversion for.
1511 This is a >60% speed-up in the case that you frequently do by-string lookups that "miss", i.e.
1512 they don't turn up anything.
1515 * DerivedSources.make:
1516 * DerivedSources.pri:
1517 * GNUmakefile.list.am:
1518 * dfg/DFGOperations.cpp:
1519 * interpreter/CallFrame.h:
1520 (JSC::ExecState::objectConstructorTable):
1523 * llint/LLIntSlowPaths.cpp:
1524 (JSC::LLInt::getByVal):
1525 * runtime/CommonIdentifiers.h:
1526 * runtime/JSCell.cpp:
1527 (JSC::JSCell::getByStringSlow):
1531 * runtime/JSCellInlines.h:
1533 (JSC::JSCell::getByStringAndKey):
1534 (JSC::JSCell::getByString):
1535 * runtime/JSGlobalData.cpp:
1537 (JSC::JSGlobalData::JSGlobalData):
1538 (JSC::JSGlobalData::~JSGlobalData):
1539 * runtime/JSGlobalData.h:
1541 * runtime/JSObject.cpp:
1542 (JSC::JSObject::putDirectNativeFunction):
1544 * runtime/JSObject.h:
1547 * runtime/Lookup.cpp:
1548 (JSC::setUpStaticFunctionSlot):
1549 * runtime/ObjectPrototype.cpp:
1551 (JSC::ObjectPrototype::finishCreation):
1552 (JSC::ObjectPrototype::create):
1553 * runtime/ObjectPrototype.h:
1555 * runtime/PropertyMapHashTable.h:
1556 (JSC::PropertyTable::findWithString):
1557 * runtime/Structure.h:
1559 * runtime/StructureInlines.h:
1560 (JSC::Structure::get):
1563 2013-03-13 Filip Pizlo <fpizlo@apple.com>
1565 DFG bytecode parser is too aggressive about getting rid of GetLocals on captured variables
1566 https://bugs.webkit.org/show_bug.cgi?id=112287
1567 <rdar://problem/13342340>
1569 Reviewed by Oliver Hunt.
1571 * bytecode/CodeBlock.cpp:
1572 (JSC::CodeBlock::dumpBytecode):
1573 (JSC::CodeBlock::finalizeUnconditionally):
1574 * dfg/DFGByteCodeParser.cpp:
1575 (JSC::DFG::ByteCodeParser::getLocal):
1577 2013-03-13 Ryosuke Niwa <rniwa@webkit.org>
1579 Threaded HTML Parser is missing feature define flags in all but Chromium port's build files
1580 https://bugs.webkit.org/show_bug.cgi?id=112277
1582 Reviewed by Adam Barth.
1584 * Configurations/FeatureDefines.xcconfig:
1586 2013-03-13 Csaba Osztrogonác <ossy@webkit.org>
1588 LLINT C loop warning fix for GCC
1589 https://bugs.webkit.org/show_bug.cgi?id=112145
1591 Reviewed by Filip Pizlo.
1593 * llint/LowLevelInterpreter.cpp:
1594 (JSC::CLoop::execute):
1596 2013-02-13 Simon Hausmann <simon.hausmann@digia.com>
1598 Add support for convenient conversion from JSStringRef to QString
1599 https://bugs.webkit.org/show_bug.cgi?id=109694
1601 Reviewed by Allan Sandfeld Jensen.
1603 Add JSStringCopyQString helper function that allows for the convenient
1604 extraction of a QString out of a JSStringRef.
1606 * API/JSStringRefQt.cpp: Added.
1607 (JSStringCopyQString):
1608 * API/JSStringRefQt.h: Added.
1609 * API/OpaqueJSString.h:
1611 (OpaqueJSString::qString):
1612 (OpaqueJSString::OpaqueJSString):
1615 2013-03-13 Peter Gal <galpeter@inf.u-szeged.hu>
1617 Token 'not' is ignored in the offlineasm.
1618 https://bugs.webkit.org/show_bug.cgi?id=111568
1620 Reviewed by Filip Pizlo.
1622 * offlineasm/parser.rb: Build the Not AST node if the 'not' token is found.
1624 2013-03-12 Tim Horton <timothy_horton@apple.com>
1626 WTF uses macros for exports. Try to fix the Windows build. Unreviewed.
1628 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
1629 * JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in:
1631 2013-03-12 Filip Pizlo <fpizlo@apple.com>
1633 Array.prototype.sort should at least try to be PTIME even when the array is in some bizarre mode
1634 https://bugs.webkit.org/show_bug.cgi?id=112187
1635 <rdar://problem/13393550>
1637 Reviewed by Michael Saboff and Gavin Barraclough.
1639 If we have an array-like object in crazy mode passed into Array.prototype.sort, and its length is large,
1640 then first copy all elements into a separate, compact, un-holy array and sort that. Then copy back.
1641 This means that sorting will be at worst O(n^2) in the actual number of things in the array, rather than
1642 O(n^2) in the array's length.
1644 * runtime/ArrayPrototype.cpp:
1645 (JSC::attemptFastSort):
1646 (JSC::performSlowSort):
1648 (JSC::arrayProtoFuncSort):
1650 2013-03-12 Tim Horton <timothy_horton@apple.com>
1652 Try to fix the Windows build.
1656 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
1658 2013-03-12 Geoffrey Garen <ggaren@apple.com>
1660 Try to fix the Windows build.
1664 * JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in:
1667 2013-03-11 Oliver Hunt <oliver@apple.com>
1669 Harden JSStringJoiner
1670 https://bugs.webkit.org/show_bug.cgi?id=112093
1672 Reviewed by Filip Pizlo.
1674 Harden JSStringJoiner, make it use our CheckedArithmetic
1675 class to simplify everything.
1677 * runtime/JSStringJoiner.cpp:
1678 (JSC::JSStringJoiner::build):
1679 * runtime/JSStringJoiner.h:
1681 (JSC::JSStringJoiner::JSStringJoiner):
1682 (JSC::JSStringJoiner::append):
1684 2013-03-12 Filip Pizlo <fpizlo@apple.com>
1686 DFG generic array access cases should not be guarded by CheckStructure even of the profiling tells us that it could be
1687 https://bugs.webkit.org/show_bug.cgi?id=112183
1689 Reviewed by Oliver Hunt.
1691 Slight speed-up on string-unpack-code.
1693 * dfg/DFGFixupPhase.cpp:
1694 (JSC::DFG::FixupPhase::findAndRemoveUnnecessaryStructureCheck):
1696 (JSC::DFG::FixupPhase::checkArray):
1697 (JSC::DFG::FixupPhase::blessArrayOperation):
1699 2013-03-12 Gabor Rapcsanyi <rgabor@webkit.org>
1701 https://bugs.webkit.org/show_bug.cgi?id=112141
1702 LLInt CLoop backend misses Double2Ints() on 32bit architectures
1704 Reviewed by Filip Pizlo.
1706 Implement Double2Ints() in CLoop backend of LLInt on 32bit architectures.
1708 * llint/LowLevelInterpreter.cpp:
1710 (JSC::LLInt::Double2Ints):
1711 * offlineasm/cloop.rb:
1713 2013-03-12 Gabor Rapcsanyi <rgabor@webkit.org>
1715 Making more sophisticated cache flush on ARM Linux platform
1716 https://bugs.webkit.org/show_bug.cgi?id=111854
1718 Reviewed by Zoltan Herczeg.
1720 The cache flush on ARM Linux invalidates whole pages
1721 instead of just the required area.
1723 * assembler/ARMAssembler.h:
1725 (JSC::ARMAssembler::linuxPageFlush):
1726 (JSC::ARMAssembler::cacheFlush):
1727 * assembler/ARMv7Assembler.h:
1729 (JSC::ARMv7Assembler::linuxPageFlush):
1730 (JSC::ARMv7Assembler::cacheFlush):
1732 2013-03-12 Gabor Rapcsanyi <rgabor@webkit.org>
1734 Renaming the armv7.rb LLINT backend to arm.rb
1735 https://bugs.webkit.org/show_bug.cgi?id=110565
1737 Reviewed by Zoltan Herczeg.
1739 This is the first step of a unified ARM backend for
1740 all ARM 32 bit architectures in LLInt.
1743 * GNUmakefile.list.am:
1744 * JavaScriptCore.gypi:
1745 * LLIntOffsetsExtractor.pro:
1746 * offlineasm/arm.rb: Copied from Source/JavaScriptCore/offlineasm/armv7.rb.
1747 * offlineasm/armv7.rb: Removed.
1748 * offlineasm/backends.rb:
1749 * offlineasm/risc.rb:
1751 2013-03-12 Csaba Osztrogonác <ossy@webkit.org>
1753 REGRESSION(r145482): It broke 33 jsc tests and zillion layout tests on all platform
1754 https://bugs.webkit.org/show_bug.cgi?id=112112
1756 Reviewed by Oliver Hunt.
1758 Rolling out https://trac.webkit.org/changeset/145482 to unbreak the bots.
1760 * runtime/JSStringJoiner.cpp:
1761 (JSC::JSStringJoiner::build):
1762 * runtime/JSStringJoiner.h:
1764 (JSC::JSStringJoiner::JSStringJoiner):
1765 (JSC::JSStringJoiner::append):
1767 2013-03-12 Filip Pizlo <fpizlo@apple.com>
1769 DFG prediction propagation phase should not rerun forward propagation if double voting has already converged
1770 https://bugs.webkit.org/show_bug.cgi?id=111920
1772 Reviewed by Oliver Hunt.
1774 I don't know why we weren't exiting early after double voting if !m_changed.
1776 This change also removes backwards propagation from the voting fixpoint, since at that
1777 point short-circuiting loops is probably not particularly profitable. Profiling shows
1778 that this reduces the time spent in prediction propagation even further.
1780 This change appears to be a 1% SunSpider speed-up.
1782 * dfg/DFGPredictionPropagationPhase.cpp:
1783 (JSC::DFG::PredictionPropagationPhase::run):
1785 2013-03-11 Filip Pizlo <fpizlo@apple.com>
1787 DFG overflow check elimination is too smart for its own good
1788 https://bugs.webkit.org/show_bug.cgi?id=111832
1790 Reviewed by Oliver Hunt and Gavin Barraclough.
1792 Rolling this back in after fixing accidental misuse of JSValue. The code was doing value < someInt
1793 rather than value.asInt32() < someInt. This "worked" when isWithinPowerOfTwo wasn't templatized.
1794 It worked by always being false and always disabling the relvant optimization.
1796 This improves overflow check elimination in three ways:
1798 1) It reduces the amount of time the compiler will spend doing it.
1800 2) It fixes bugs where overflow check elimination was overzealous. Precisely, for a binary operation
1801 over @a and @b where both @a and @b will type check that their inputs (@a->children, @b->children)
1802 are int32's and then perform a possibly-overflowing operation, we must be careful not to assume
1803 that @a's non-int32 parts don't matter if at the point that @a runs we have as yet not proved that
1804 @b->children are int32's and that hence @b might produce a large enough result that doubles would
1805 start chopping low bits. The specific implication of this is that for a binary operation to not
1806 propagate that it cares about non-int32 parts (NodeUsedAsNumber), we must prove that at least one
1807 of the inputs is guaranteed to produce a result within 2^32 and that there won't be a tower of such
1808 operations large enough to ultimately produce a double greater than 2^52 (roughly). We achieve the
1809 latter by disabling this optimization for very large basic blocks. It's noteworthy that blocks that
1810 large won't even make it into the DFG currently.
1812 3) It makes the overflow check elimination more precise for cases where the inputs to an Add or Sub
1813 are the outputs of a bit-op. For example in (@a + (@b | 0)) | 0, we don't need to propagate
1814 NodeUsedAsNumber to either @a or @b.
1816 This is neutral on V8v7 and a slight speed-up on compile time benchmarks.
1819 * GNUmakefile.list.am:
1820 * JavaScriptCore.xcodeproj/project.pbxproj:
1822 * dfg/DFGArrayMode.cpp:
1823 (JSC::DFG::ArrayMode::refine):
1824 * dfg/DFGBackwardsPropagationPhase.cpp: Added.
1826 (BackwardsPropagationPhase):
1827 (JSC::DFG::BackwardsPropagationPhase::BackwardsPropagationPhase):
1828 (JSC::DFG::BackwardsPropagationPhase::run):
1829 (JSC::DFG::BackwardsPropagationPhase::isNotNegZero):
1830 (JSC::DFG::BackwardsPropagationPhase::isNotZero):
1831 (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwoForConstant):
1832 (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwoNonRecursive):
1833 (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwo):
1834 (JSC::DFG::BackwardsPropagationPhase::mergeDefaultFlags):
1835 (JSC::DFG::BackwardsPropagationPhase::propagate):
1836 (JSC::DFG::performBackwardsPropagation):
1837 * dfg/DFGBackwardsPropagationPhase.h: Added.
1839 * dfg/DFGCPSRethreadingPhase.cpp:
1840 (JSC::DFG::CPSRethreadingPhase::run):
1841 (JSC::DFG::CPSRethreadingPhase::clearIsLoadedFrom):
1842 (CPSRethreadingPhase):
1843 (JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocalFor):
1844 (JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocalFor):
1845 * dfg/DFGDriver.cpp:
1846 (JSC::DFG::compile):
1848 (JSC::DFG::Graph::dump):
1849 * dfg/DFGNodeFlags.cpp:
1850 (JSC::DFG::dumpNodeFlags):
1852 * dfg/DFGNodeFlags.h:
1854 * dfg/DFGPredictionPropagationPhase.cpp:
1855 (PredictionPropagationPhase):
1856 (JSC::DFG::PredictionPropagationPhase::propagate):
1857 * dfg/DFGUnificationPhase.cpp:
1858 (JSC::DFG::UnificationPhase::run):
1859 * dfg/DFGVariableAccessData.h:
1860 (JSC::DFG::VariableAccessData::VariableAccessData):
1861 (JSC::DFG::VariableAccessData::mergeIsLoadedFrom):
1862 (VariableAccessData):
1863 (JSC::DFG::VariableAccessData::setIsLoadedFrom):
1864 (JSC::DFG::VariableAccessData::isLoadedFrom):
1866 2013-03-11 Oliver Hunt <oliver@apple.com>
1868 Harden JSStringJoiner
1869 https://bugs.webkit.org/show_bug.cgi?id=112093
1871 Reviewed by Filip Pizlo.
1873 Harden JSStringJoiner, make it use our CheckedArithmetic
1874 class to simplify everything.
1876 * runtime/JSStringJoiner.cpp:
1877 (JSC::JSStringJoiner::build):
1878 * runtime/JSStringJoiner.h:
1880 (JSC::JSStringJoiner::JSStringJoiner):
1881 (JSC::JSStringJoiner::append):
1883 2013-03-11 Michael Saboff <msaboff@apple.com>
1885 Crash beneath operationCreateInlinedArguments running fast/js/dfg-create-inlined-arguments-in-closure-inline.html (32-bit only)
1886 https://bugs.webkit.org/show_bug.cgi?id=112067
1888 Reviewed by Geoffrey Garen.
1890 We weren't setting the tag in SetCallee. Therefore set it to CellTag.
1892 * dfg/DFGSpeculativeJIT32_64.cpp:
1893 (JSC::DFG::SpeculativeJIT::compile):
1895 2013-03-11 Oliver Hunt <oliver@apple.com>
1897 Make SegmentedVector Noncopyable
1898 https://bugs.webkit.org/show_bug.cgi?id=112059
1900 Reviewed by Geoffrey Garen.
1902 Copying a SegmentedVector is very expensive, and really shouldn't
1903 be necessary. So I've taken the one place where we currently copy
1904 and replaced it with a regular Vector, and replaced the address
1905 dependent logic with a indexing ref instead.
1907 * bytecompiler/BytecodeGenerator.cpp:
1908 (JSC::BytecodeGenerator::newLabelScope):
1909 (JSC::BytecodeGenerator::emitComplexJumpScopes):
1910 * bytecompiler/BytecodeGenerator.h:
1911 (BytecodeGenerator):
1912 * bytecompiler/LabelScope.h:
1914 (JSC::LabelScopePtr::LabelScopePtr):
1916 (JSC::LabelScopePtr::operator=):
1917 (JSC::LabelScopePtr::~LabelScopePtr):
1918 (JSC::LabelScopePtr::operator*):
1919 (JSC::LabelScopePtr::operator->):
1920 * bytecompiler/NodesCodegen.cpp:
1921 (JSC::DoWhileNode::emitBytecode):
1922 (JSC::WhileNode::emitBytecode):
1923 (JSC::ForNode::emitBytecode):
1924 (JSC::ForInNode::emitBytecode):
1925 (JSC::SwitchNode::emitBytecode):
1926 (JSC::LabelNode::emitBytecode):
1928 2013-03-10 Andreas Kling <akling@apple.com>
1930 SpeculativeJIT should use OwnPtr<SlowPathGenerator>.
1931 <http://webkit.org/b/111942>
1933 Reviewed by Anders Carlsson.
1935 There's no need to include DFGSlowPathGenerator.h from the header as long as the destructor is out-of-line,
1936 so let's use OwnPtr instead of raw pointers + deleteAllValues().
1938 * dfg/DFGSpeculativeJIT.cpp:
1939 (JSC::DFG::SpeculativeJIT::~SpeculativeJIT):
1940 (JSC::DFG::SpeculativeJIT::addSlowPathGenerator):
1941 * dfg/DFGSpeculativeJIT.h:
1944 2013-03-09 Sheriff Bot <webkit.review.bot@gmail.com>
1946 Unreviewed, rolling out r145299.
1947 http://trac.webkit.org/changeset/145299
1948 https://bugs.webkit.org/show_bug.cgi?id=111928
1950 compilation failure with recent clang
1951 (DFGBackwardsPropagationPhase.cpp:132:35: error: comparison of
1952 constant 10 with expression of type 'bool' is always false)
1953 (Requested by thorton on #webkit).
1956 * GNUmakefile.list.am:
1957 * JavaScriptCore.xcodeproj/project.pbxproj:
1959 * dfg/DFGArrayMode.cpp:
1960 (JSC::DFG::ArrayMode::refine):
1961 * dfg/DFGBackwardsPropagationPhase.cpp: Removed.
1962 * dfg/DFGBackwardsPropagationPhase.h: Removed.
1963 * dfg/DFGCPSRethreadingPhase.cpp:
1964 (JSC::DFG::CPSRethreadingPhase::run):
1965 (CPSRethreadingPhase):
1966 (JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocalFor):
1967 (JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocalFor):
1968 * dfg/DFGDriver.cpp:
1969 (JSC::DFG::compile):
1971 (JSC::DFG::Graph::dump):
1972 * dfg/DFGNodeFlags.cpp:
1973 (JSC::DFG::nodeFlagsAsString):
1975 * dfg/DFGNodeFlags.h:
1977 * dfg/DFGPredictionPropagationPhase.cpp:
1978 (JSC::DFG::PredictionPropagationPhase::isNotNegZero):
1979 (PredictionPropagationPhase):
1980 (JSC::DFG::PredictionPropagationPhase::isNotZero):
1981 (JSC::DFG::PredictionPropagationPhase::isWithinPowerOfTwoForConstant):
1982 (JSC::DFG::PredictionPropagationPhase::isWithinPowerOfTwoNonRecursive):
1983 (JSC::DFG::PredictionPropagationPhase::isWithinPowerOfTwo):
1984 (JSC::DFG::PredictionPropagationPhase::propagate):
1985 (JSC::DFG::PredictionPropagationPhase::mergeDefaultFlags):
1986 * dfg/DFGUnificationPhase.cpp:
1987 (JSC::DFG::UnificationPhase::run):
1988 * dfg/DFGVariableAccessData.h:
1989 (JSC::DFG::VariableAccessData::VariableAccessData):
1990 (VariableAccessData):
1992 2013-03-08 Filip Pizlo <fpizlo@apple.com>
1994 DFG overflow check elimination is too smart for its own good
1995 https://bugs.webkit.org/show_bug.cgi?id=111832
1997 Reviewed by Oliver Hunt and Gavin Barraclough.
1999 This improves overflow check elimination in three ways:
2001 1) It reduces the amount of time the compiler will spend doing it.
2003 2) It fixes bugs where overflow check elimination was overzealous. Precisely, for a binary operation
2004 over @a and @b where both @a and @b will type check that their inputs (@a->children, @b->children)
2005 are int32's and then perform a possibly-overflowing operation, we must be careful not to assume
2006 that @a's non-int32 parts don't matter if at the point that @a runs we have as yet not proved that
2007 @b->children are int32's and that hence @b might produce a large enough result that doubles would
2008 start chopping low bits. The specific implication of this is that for a binary operation to not
2009 propagate that it cares about non-int32 parts (NodeUsedAsNumber), we must prove that at least one
2010 of the inputs is guaranteed to produce a result within 2^32 and that there won't be a tower of such
2011 operations large enough to ultimately produce a double greater than 2^52 (roughly). We achieve the
2012 latter by disabling this optimization for very large basic blocks. It's noteworthy that blocks that
2013 large won't even make it into the DFG currently.
2015 3) It makes the overflow check elimination more precise for cases where the inputs to an Add or Sub
2016 are the outputs of a bit-op. For example in (@a + (@b | 0)) | 0, we don't need to propagate
2017 NodeUsedAsNumber to either @a or @b.
2019 This is neutral on V8v7 and a slight speed-up on compile time benchmarks.
2022 * GNUmakefile.list.am:
2023 * JavaScriptCore.xcodeproj/project.pbxproj:
2025 * dfg/DFGArrayMode.cpp:
2026 (JSC::DFG::ArrayMode::refine):
2027 * dfg/DFGBackwardsPropagationPhase.cpp: Added.
2029 (BackwardsPropagationPhase):
2030 (JSC::DFG::BackwardsPropagationPhase::BackwardsPropagationPhase):
2031 (JSC::DFG::BackwardsPropagationPhase::run):
2032 (JSC::DFG::BackwardsPropagationPhase::isNotNegZero):
2033 (JSC::DFG::BackwardsPropagationPhase::isNotZero):
2034 (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwoForConstant):
2035 (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwoNonRecursive):
2036 (JSC::DFG::BackwardsPropagationPhase::isWithinPowerOfTwo):
2037 (JSC::DFG::BackwardsPropagationPhase::mergeDefaultFlags):
2038 (JSC::DFG::BackwardsPropagationPhase::propagate):
2039 (JSC::DFG::performBackwardsPropagation):
2040 * dfg/DFGBackwardsPropagationPhase.h: Added.
2042 * dfg/DFGCPSRethreadingPhase.cpp:
2043 (JSC::DFG::CPSRethreadingPhase::run):
2044 (JSC::DFG::CPSRethreadingPhase::clearIsLoadedFrom):
2045 (CPSRethreadingPhase):
2046 (JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocalFor):
2047 (JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocalFor):
2048 * dfg/DFGDriver.cpp:
2049 (JSC::DFG::compile):
2051 (JSC::DFG::Graph::dump):
2052 * dfg/DFGNodeFlags.cpp:
2053 (JSC::DFG::dumpNodeFlags):
2055 * dfg/DFGNodeFlags.h:
2057 * dfg/DFGPredictionPropagationPhase.cpp:
2058 (PredictionPropagationPhase):
2059 (JSC::DFG::PredictionPropagationPhase::propagate):
2060 * dfg/DFGUnificationPhase.cpp:
2061 (JSC::DFG::UnificationPhase::run):
2062 * dfg/DFGVariableAccessData.h:
2063 (JSC::DFG::VariableAccessData::VariableAccessData):
2064 (JSC::DFG::VariableAccessData::mergeIsLoadedFrom):
2065 (VariableAccessData):
2066 (JSC::DFG::VariableAccessData::setIsLoadedFrom):
2067 (JSC::DFG::VariableAccessData::isLoadedFrom):
2069 2013-03-08 Roger Fong <roger_fong@apple.com>
2073 * JavaScriptCore.vcxproj/JavaScriptCore.make:
2075 2013-03-08 Gabor Rapcsanyi <rgabor@webkit.org>
2077 Cache flush problem on ARMv7 JSC
2078 https://bugs.webkit.org/show_bug.cgi?id=111441
2080 Reviewed by Zoltan Herczeg.
2082 Not proper cache flush causing random crashes on ARMv7 Linux with V8 tests.
2083 The problem is similar to https://bugs.webkit.org/show_bug.cgi?id=77712.
2084 Change the cache fulsh mechanism similar to ARM traditinal and revert the
2087 * assembler/ARMv7Assembler.h:
2088 (JSC::ARMv7Assembler::cacheFlush):
2090 2013-03-07 Geoffrey Garen <ggaren@apple.com>
2092 REGRESSION (r143759): 40% JSBench regression, 20% Octane/closure regression, 40% Octane/jquery regression, 2% Octane regression
2093 https://bugs.webkit.org/show_bug.cgi?id=111797
2095 Reviewed by Oliver Hunt.
2097 The bot's testing configuration stresses the cache's starting guess
2100 This patch removes any starting guess, and just uses wall clock time
2101 to discover the initial working set size of an app, in code size.
2103 * runtime/CodeCache.cpp:
2104 (JSC::CodeCacheMap::pruneSlowCase): Update our timer as we go.
2106 Also fixed a bug where pruning from 0 to 0 would hang -- that case is
2107 a possibility now that we start with a capacity of 0.
2109 * runtime/CodeCache.h:
2111 (JSC::CodeCacheMap::CodeCacheMap):
2112 (JSC::CodeCacheMap::add):
2113 (JSC::CodeCacheMap::prune): Don't prune if we're in the middle of
2114 discovering the working set size of an app, in code size.
2116 2013-03-07 Michael Saboff <msaboff@apple.com>
2118 Crash when updating predictions below JSC::arrayProtoFuncForEach on tuaw.com article
2119 https://bugs.webkit.org/show_bug.cgi?id=111777
2121 Reviewed by Filip Pizlo.
2123 Moved register allocations to be above any generated control flow so that any
2124 resulting spill would be visible to all subsequently generated code.
2126 * dfg/DFGSpeculativeJIT32_64.cpp:
2127 (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull):
2128 (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull):
2129 (JSC::DFG::SpeculativeJIT::compile):
2130 * dfg/DFGSpeculativeJIT64.cpp:
2131 (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull):
2132 (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull):
2133 (JSC::DFG::SpeculativeJIT::compile):
2135 2013-03-07 Filip Pizlo <fpizlo@apple.com>
2137 DFG should not get corrupted IR in the case of code that is dead, unreachable, and contains a chain of nodes that use each other in an untyped way
2138 https://bugs.webkit.org/show_bug.cgi?id=111783
2140 Reviewed by Mark Hahnenberg.
2142 Unreachable code is not touched by CFA and so thinks that even untyped uses are checked.
2143 But dead untyped uses don't need checks and hence don't need to be Phantom'd. The DCE knew
2144 this in findTypeCheckRoot() but not in eliminateIrrelevantPhantomChildren(), leading to a
2145 Phantom node that had another Phantom node as one of its kids.
2147 * dfg/DFGDCEPhase.cpp:
2148 (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren):
2150 2013-03-07 Filip Pizlo <fpizlo@apple.com>
2152 The DFG fixpoint is not strictly profitable, and should be straight-lined
2153 https://bugs.webkit.org/show_bug.cgi?id=111764
2155 Reviewed by Oliver Hunt and Geoffrey Garen.
2157 The DFG previously ran optimizations to fixpoint because there exists a circular dependency:
2159 CSE depends on CFG simplification: CFG simplification merges blocks, and CSE is block-local.
2161 CFG simplification depends on CFA and constant folding: constant folding reveals branches on
2164 CFA depends on CSE: CSE reveals must-alias relationships by proving that two operations
2165 always produce identical values.
2167 Arguments simplification also depends on CSE, but it ought not depend on anything else.
2169 Hence we get a cycle like: CFA -> folding -> CFG -> CSE -> CFA.
2171 Note that before we had sparse conditional CFA, we also had CFA depending on CFG. This ought
2172 not be the case anymore: CFG simplification should not by itself lead to better CFA results.
2174 My guess is that the weakest link in this cycle is CFG -> CSE. CSE cuts both ways: if you
2175 CSE too much then you increase register pressure. Hence it's not clear that you always want
2176 to CSE after simplifying control flow. This leads to an order of optimization as follows:
2178 CSE -> arguments -> CFA -> folding -> CFG
2180 This is a 2.5% speed-up on SunSpider, a 4% speed-up on V8Spider, a possible 0.3% slow-down
2181 on V8v7, nothing on Kraken, and 1.2% speed-up in the JSRegress geomean. I'll take a 2.5%
2182 speed-up over a 0.3% V8v7 speed-up.
2184 * dfg/DFGDriver.cpp:
2185 (JSC::DFG::compile):
2187 2013-03-07 Roger Fong <roger_fong@apple.com>
2189 Build fix for AppleWin VS2010.
2191 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
2192 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
2194 2013-03-05 Mark Hahnenberg <mhahnenberg@apple.com>
2196 Objective-C API: Need a good way to reference event handlers without causing cycles
2197 https://bugs.webkit.org/show_bug.cgi?id=111088
2199 Reviewed by Geoffrey Garen.
2201 JSManagedValue is like a special kind of weak value. When you create a JSManagedValue, you can
2202 supply an Objective-C object as its "owner". As long as the Objective-C owner object remains
2203 alive and its wrapper remains accessible to the JSC garbage collector (e.g. by being marked by
2204 the global object), the reference to the JavaScript value is strong. As soon as the Objective-C
2205 owner is deallocated or its wrapper becomes inaccessible to the garbage collector, the reference
2208 If you do not supply an owner or you use the weakValueWithValue: convenience class method, the
2209 returned JSManagedValue behaves as a normal weak reference.
2211 This new class allows clients to maintain references to JavaScript values in the Objective-C
2212 heap without creating reference cycles/leaking memory.
2214 * API/JSAPIWrapperObject.cpp: Added.
2216 (JSC::::createStructure):
2217 (JSC::JSAPIWrapperObject::JSAPIWrapperObject): This is a special JSObject for the Objective-C API that knows
2218 for the purposes of garbage collection/marking that it wraps an opaque Objective-C object.
2219 (JSC::JSAPIWrapperObject::visitChildren): We add the pointer to the wrapped Objective-C object to the set of
2220 opaque roots so that the weak handle owner for JSManagedValues can find it later.
2221 * API/JSAPIWrapperObject.h: Added.
2223 (JSAPIWrapperObject):
2224 (JSC::JSAPIWrapperObject::wrappedObject):
2225 (JSC::JSAPIWrapperObject::setWrappedObject):
2227 (JSSynchronousGarbageCollect):
2228 * API/JSBasePrivate.h:
2229 * API/JSCallbackObject.cpp:
2231 * API/JSCallbackObject.h:
2232 (JSC::JSCallbackObject::destroy): Moved this to the header so that we don't get link errors with JSAPIWrapperObject.
2234 (-[JSContext initWithVirtualMachine:]): We weren't adding manually allocated/initialized JSVirtualMachine objects to
2235 the global cache of virtual machines. The init methods handle this now rather than contextWithGlobalContextRef, since
2236 not everyone is guaranteed to use the latter.
2237 (-[JSContext initWithGlobalContextRef:]):
2238 (+[JSContext contextWithGlobalContextRef:]):
2239 * API/JSManagedValue.h: Added.
2240 * API/JSManagedValue.mm: Added.
2241 (JSManagedValueHandleOwner):
2242 (managedValueHandleOwner):
2243 (+[JSManagedValue weakValueWithValue:]):
2244 (+[JSManagedValue managedValueWithValue:owner:]):
2245 (-[JSManagedValue init]): We explicitly call the ARC entrypoints to initialize/get the weak owner field since we don't
2246 use ARC when building our framework.
2247 (-[JSManagedValue initWithValue:]):
2248 (-[JSManagedValue initWithValue:owner:]):
2249 (-[JSManagedValue dealloc]):
2250 (-[JSManagedValue value]):
2251 (-[JSManagedValue weakOwner]):
2252 (JSManagedValueHandleOwner::isReachableFromOpaqueRoots): If the Objective-C owner is still alive (i.e. loading the weak field
2253 returns non-nil) and that value was added to the set of opaque roots by the wrapper for that Objective-C owner, then the the
2254 JSObject to which the JSManagedObject refers is still alive.
2255 * API/JSObjectRef.cpp: We have to add explicit checks for the JSAPIWrapperObject, just like the other types of JSCallbackObjects.
2256 (JSObjectGetPrivate):
2257 (JSObjectSetPrivate):
2258 (JSObjectGetPrivateProperty):
2259 (JSObjectSetPrivateProperty):
2260 (JSObjectDeletePrivateProperty):
2262 (objectToValueWithoutCopy):
2263 * API/JSValueRef.cpp:
2264 (JSValueIsObjectOfClass):
2265 * API/JSVirtualMachine.mm:
2266 (-[JSVirtualMachine initWithContextGroupRef:]):
2267 (+[JSVirtualMachine virtualMachineWithContextGroupRef:]):
2268 * API/JSWrapperMap.mm:
2270 (makeWrapper): This is our own internal version of JSObjectMake which creates JSAPIWrapperObjects, the Obj-C API
2271 version of JSCallbackObjects.
2272 (createObjectWithCustomBrand):
2273 (-[JSObjCClassInfo wrapperForObject:]):
2274 (tryUnwrapObjcObject):
2275 * API/JavaScriptCore.h:
2276 * API/tests/testapi.mm: Added new tests for the strong and weak uses of JSManagedValue in the context of an
2277 onclick handler for an Objective-C object inserted into a JSContext.
2278 (-[TextXYZ setWeakOnclick:]):
2279 (-[TextXYZ setOnclick:]):
2280 (-[TextXYZ weakOnclick]):
2281 (-[TextXYZ onclick]):
2283 * CMakeLists.txt: Various build system additions.
2284 * GNUmakefile.list.am:
2285 * JavaScriptCore.gypi:
2286 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2287 * JavaScriptCore.xcodeproj/project.pbxproj:
2288 * runtime/JSGlobalObject.cpp: Added the new canonical Structure for the JSAPIWrapperObject class.
2289 (JSC::JSGlobalObject::reset):
2291 (JSC::JSGlobalObject::visitChildren):
2292 * runtime/JSGlobalObject.h:
2294 (JSC::JSGlobalObject::objcWrapperObjectStructure):
2296 2013-03-06 Filip Pizlo <fpizlo@apple.com>
2298 ConvertThis should be turned into Identity based on predictions in Fixup, rather than based on proofs in ConstantFolding
2299 https://bugs.webkit.org/show_bug.cgi?id=111674
2301 Reviewed by Oliver Hunt.
2303 This gets rid of the speculated forms of ConvertThis in the backend, and has Fixup
2304 convert them to either Identity(Object:@child) if the child is predicted object, or
2305 Phantom(Other:@child) ; WeakJSConstant(global this object) if it's predicted Other.
2307 The goal of this is to ensure that the optimization fixpoint doesn't create
2308 Identity's, since doing so requires a rerun of CSE. So far this isn't a speed-up
2309 but I'm hoping this will be a step towards reducing the need to rerun the fixpoint
2310 so as to ultimately reduce compile times.
2312 * dfg/DFGAbstractState.cpp:
2313 (JSC::DFG::AbstractState::executeEffects):
2314 * dfg/DFGAssemblyHelpers.h:
2316 * dfg/DFGConstantFoldingPhase.cpp:
2317 (JSC::DFG::ConstantFoldingPhase::foldConstants):
2318 * dfg/DFGFixupPhase.cpp:
2319 (JSC::DFG::FixupPhase::fixupNode):
2321 (JSC::DFG::FixupPhase::observeUseKindOnNode):
2322 (JSC::DFG::FixupPhase::setUseKindAndUnboxIfProfitable):
2324 (JSC::DFG::Graph::globalThisObjectFor):
2328 (JSC::DFG::Node::convertToIdentity):
2329 (JSC::DFG::Node::convertToWeakConstant):
2330 * dfg/DFGSpeculativeJIT32_64.cpp:
2331 (JSC::DFG::SpeculativeJIT::compile):
2332 * dfg/DFGSpeculativeJIT64.cpp:
2333 (JSC::DFG::SpeculativeJIT::compile):
2335 2013-03-07 Peter Gal <galpeter@inf.u-szeged.hu>
2337 Children method in LLINT AST Not class should return [@child]
2338 https://bugs.webkit.org/show_bug.cgi?id=90740
2340 Reviewed by Filip Pizlo.
2342 * offlineasm/ast.rb: Fixed the return value of the children method in the Not AST class.
2344 2013-03-05 Oliver Hunt <oliver@apple.com>
2346 Bring back eager resolution of function scoped variables
2347 https://bugs.webkit.org/show_bug.cgi?id=111497
2349 Reviewed by Geoffrey Garen.
2351 This reverts the get/put_scoped_var part of the great non-local
2352 variable resolution refactoring. This still leaves all the lazy
2353 variable resolution logic as it's necessary for global property
2354 resolution, and i don't want to make the patch bigger than it
2357 * bytecode/CodeBlock.cpp:
2358 (JSC::CodeBlock::dumpBytecode):
2359 (JSC::CodeBlock::CodeBlock):
2360 * bytecode/CodeBlock.h:
2362 * bytecode/Opcode.h:
2364 (JSC::padOpcodeName):
2365 * bytecode/UnlinkedCodeBlock.cpp:
2366 (JSC::generateFunctionCodeBlock):
2367 (JSC::UnlinkedFunctionExecutable::codeBlockFor):
2368 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
2369 * bytecode/UnlinkedCodeBlock.h:
2371 (UnlinkedFunctionExecutable):
2372 (UnlinkedCodeBlock):
2373 (JSC::UnlinkedCodeBlock::usesGlobalObject):
2374 (JSC::UnlinkedCodeBlock::setGlobalObjectRegister):
2375 (JSC::UnlinkedCodeBlock::globalObjectRegister):
2376 * bytecompiler/BytecodeGenerator.cpp:
2377 (JSC::ResolveResult::checkValidity):
2378 (JSC::BytecodeGenerator::BytecodeGenerator):
2379 (JSC::BytecodeGenerator::emitLoadGlobalObject):
2381 (JSC::BytecodeGenerator::resolve):
2382 (JSC::BytecodeGenerator::resolveConstDecl):
2383 (JSC::BytecodeGenerator::emitResolve):
2384 (JSC::BytecodeGenerator::emitResolveBase):
2385 (JSC::BytecodeGenerator::emitResolveBaseForPut):
2386 (JSC::BytecodeGenerator::emitResolveWithBaseForPut):
2387 (JSC::BytecodeGenerator::emitResolveWithThis):
2388 (JSC::BytecodeGenerator::emitGetStaticVar):
2389 (JSC::BytecodeGenerator::emitPutStaticVar):
2390 * bytecompiler/BytecodeGenerator.h:
2391 (JSC::ResolveResult::lexicalResolve):
2392 (JSC::ResolveResult::isStatic):
2393 (JSC::ResolveResult::depth):
2394 (JSC::ResolveResult::index):
2396 (JSC::ResolveResult::ResolveResult):
2397 (BytecodeGenerator):
2398 * bytecompiler/NodesCodegen.cpp:
2399 (JSC::ResolveNode::isPure):
2400 (JSC::FunctionCallResolveNode::emitBytecode):
2401 (JSC::PostfixNode::emitResolve):
2402 (JSC::TypeOfResolveNode::emitBytecode):
2403 (JSC::PrefixNode::emitResolve):
2404 (JSC::ReadModifyResolveNode::emitBytecode):
2405 (JSC::AssignResolveNode::emitBytecode):
2406 (JSC::ConstDeclNode::emitCodeSingle):
2407 * dfg/DFGByteCodeParser.cpp:
2408 (JSC::DFG::ByteCodeParser::parseBlock):
2409 * dfg/DFGCapabilities.cpp:
2410 (JSC::DFG::debugFail):
2411 * dfg/DFGCapabilities.h:
2412 (JSC::DFG::canCompileOpcode):
2413 (JSC::DFG::canInlineOpcode):
2415 (JSC::JIT::privateCompileMainPass):
2418 * jit/JITPropertyAccess.cpp:
2419 (JSC::JIT::emit_op_get_scoped_var):
2421 (JSC::JIT::emit_op_put_scoped_var):
2422 * jit/JITPropertyAccess32_64.cpp:
2423 (JSC::JIT::emit_op_get_scoped_var):
2425 (JSC::JIT::emit_op_put_scoped_var):
2426 * llint/LowLevelInterpreter32_64.asm:
2427 * llint/LowLevelInterpreter64.asm:
2428 * runtime/CodeCache.cpp:
2429 (JSC::CodeCache::getCodeBlock):
2430 (JSC::CodeCache::getProgramCodeBlock):
2431 (JSC::CodeCache::getEvalCodeBlock):
2432 * runtime/CodeCache.h:
2435 * runtime/Executable.cpp:
2436 (JSC::EvalExecutable::compileInternal):
2437 (JSC::FunctionExecutable::produceCodeBlockFor):
2438 * runtime/JSGlobalObject.cpp:
2439 (JSC::JSGlobalObject::createEvalCodeBlock):
2440 * runtime/JSGlobalObject.h:
2442 * runtime/Options.cpp:
2443 (JSC::Options::initialize):
2445 2013-03-06 Filip Pizlo <fpizlo@apple.com>
2447 Unreviewed, roll out http://trac.webkit.org/changeset/144989
2449 I think we want the assertion that I removed.
2451 * dfg/DFGAbstractState.cpp:
2452 (JSC::DFG::AbstractState::merge):
2453 (JSC::DFG::AbstractState::mergeVariableBetweenBlocks):
2454 * dfg/DFGAbstractState.h:
2457 2013-03-06 Filip Pizlo <fpizlo@apple.com>
2459 DFG::AbstractState::merge() is still more complicated than it needs to be
2460 https://bugs.webkit.org/show_bug.cgi?id=111619
2462 Reviewed by Mark Hahnenberg.
2464 This method is the one place where we still do some minimal amount of liveness pruning, but the style with
2465 which it is written is awkward, and it makes an assertion about variablesAtTail that will be invalidated
2466 by https://bugs.webkit.org/show_bug.cgi?id=111539.
2468 * dfg/DFGAbstractState.cpp:
2469 (JSC::DFG::AbstractState::merge):
2470 (JSC::DFG::AbstractState::mergeVariableBetweenBlocks):
2471 * dfg/DFGAbstractState.h:
2474 2013-03-06 Filip Pizlo <fpizlo@apple.com>
2476 DFG should not run full CSE after the optimization fixpoint, since it really just wants store elimination
2477 https://bugs.webkit.org/show_bug.cgi?id=111536
2479 Reviewed by Oliver Hunt and Mark Hahnenberg.
2481 The fixpoint will do aggressive load elimination and pure CSE. There's no need to do it after the fixpoint.
2482 On the other hand, the fixpoint does not profit from doing store elimination (except for SetLocal/Flush).
2483 Previously we had CSE do both, and had it avoid doing some store elimination during the fixpoint by querying
2484 the fixpoint state. This changes CSE to be templated on mode - either NormalCSE or StoreElimination - so
2485 that we explicitly put it into one of those modes depending on where we call it from. The goal is to reduce
2486 time spent doing load elimination after the fixpoint, since that is just wasted cycles.
2488 * dfg/DFGCSEPhase.cpp:
2489 (JSC::DFG::CSEPhase::CSEPhase):
2490 (JSC::DFG::CSEPhase::run):
2491 (JSC::DFG::CSEPhase::performNodeCSE):
2492 (JSC::DFG::CSEPhase::performBlockCSE):
2493 (JSC::DFG::performCSE):
2495 (JSC::DFG::performStoreElimination):
2496 * dfg/DFGCSEPhase.h:
2498 * dfg/DFGDriver.cpp:
2499 (JSC::DFG::compile):
2501 2013-03-06 Andreas Kling <akling@apple.com>
2503 Pack Structure members better.
2504 <http://webkit.org/b/111593>
2505 <rdar://problem/13359200>
2507 Reviewed by Mark Hahnenberg.
2509 Shrink Structure by 8 bytes (now at 104 bytes) on 64-bit by packing the members better.
2511 * runtime/Structure.cpp:
2512 (JSC::Structure::Structure):
2513 * runtime/Structure.h:
2516 2013-03-06 Andreas Kling <akling@apple.com>
2518 Unreviewed, fix Windows build after r144910.
2520 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2522 2013-03-05 Filip Pizlo <fpizlo@apple.com>
2524 DFG should not check if nodes are shouldGenerate prior to DCE
2525 https://bugs.webkit.org/show_bug.cgi?id=111520
2527 Reviewed by Geoffrey Garen.
2529 All nodes are live before DCE. We don't need to check that they aren't, because they
2532 * dfg/DFGArgumentsSimplificationPhase.cpp:
2533 (JSC::DFG::ArgumentsSimplificationPhase::run):
2534 * dfg/DFGCFAPhase.cpp:
2535 (JSC::DFG::CFAPhase::performBlockCFA):
2536 * dfg/DFGCFGSimplificationPhase.cpp:
2537 (JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
2538 * dfg/DFGCSEPhase.cpp:
2539 (JSC::DFG::CSEPhase::pureCSE):
2540 (JSC::DFG::CSEPhase::int32ToDoubleCSE):
2541 (JSC::DFG::CSEPhase::constantCSE):
2542 (JSC::DFG::CSEPhase::weakConstantCSE):
2543 (JSC::DFG::CSEPhase::getCalleeLoadElimination):
2544 (JSC::DFG::CSEPhase::getArrayLengthElimination):
2545 (JSC::DFG::CSEPhase::globalVarLoadElimination):
2546 (JSC::DFG::CSEPhase::scopedVarLoadElimination):
2547 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
2548 (JSC::DFG::CSEPhase::globalVarStoreElimination):
2549 (JSC::DFG::CSEPhase::scopedVarStoreElimination):
2550 (JSC::DFG::CSEPhase::getByValLoadElimination):
2551 (JSC::DFG::CSEPhase::checkStructureElimination):
2552 (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
2553 (JSC::DFG::CSEPhase::putStructureStoreElimination):
2554 (JSC::DFG::CSEPhase::getByOffsetLoadElimination):
2555 (JSC::DFG::CSEPhase::putByOffsetStoreElimination):
2556 (JSC::DFG::CSEPhase::getPropertyStorageLoadElimination):
2557 (JSC::DFG::CSEPhase::checkArrayElimination):
2558 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
2559 (JSC::DFG::CSEPhase::getMyScopeLoadElimination):
2560 (JSC::DFG::CSEPhase::getLocalLoadElimination):
2561 (JSC::DFG::CSEPhase::setLocalStoreElimination):
2562 (JSC::DFG::CSEPhase::performNodeCSE):
2563 * dfg/DFGFixupPhase.cpp:
2564 (JSC::DFG::FixupPhase::fixupNode):
2565 (JSC::DFG::FixupPhase::fixupSetLocalsInBlock):
2566 * dfg/DFGPredictionPropagationPhase.cpp:
2567 (JSC::DFG::PredictionPropagationPhase::propagate):
2568 * dfg/DFGStructureCheckHoistingPhase.cpp:
2569 (JSC::DFG::StructureCheckHoistingPhase::run):
2571 2013-03-06 Csaba Osztrogonác <ossy@webkit.org>
2573 Fix unused parameter warnings in ARM assembler
2574 https://bugs.webkit.org/show_bug.cgi?id=111433
2576 Reviewed by Kentaro Hara.
2578 * assembler/ARMAssembler.h: Remove unreachable revertJump() after r143346.
2579 * assembler/MacroAssemblerARM.h:
2580 (JSC::MacroAssemblerARM::moveIntsToDouble): Remove unused scratch parameter instead of UNUSED_PARAM.
2581 (JSC::MacroAssemblerARM::branchConvertDoubleToInt32): Remove unused fpTemp parameter.
2582 (JSC::MacroAssemblerARM::revertJumpReplacementToPatchableBranchPtrWithPatch): Remove unused parameters.
2584 2013-03-06 Andreas Kling <akling@apple.com>
2586 Unused Structure property tables waste 14MB on Membuster.
2587 <http://webkit.org/b/110854>
2588 <rdar://problem/13292104>
2590 Reviewed by Geoffrey Garen.
2592 Turn PropertyTable into a GC object and have Structure drop unpinned tables when marking.
2593 14 MB progression on Membuster3.
2595 This time it should stick; I've been through all the tests with COLLECT_ON_EVERY_ALLOCATION.
2596 The issue with the last version was that Structure::m_offset could be used uninitialized
2597 when re-materializing a previously GC'd property table, causing some sanity checks to fail.
2600 * GNUmakefile.list.am:
2601 * JavaScriptCore.gypi:
2602 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
2603 * JavaScriptCore.xcodeproj/project.pbxproj:
2606 Added PropertyTable.cpp.
2608 * runtime/PropertyTable.cpp: Added.
2609 (JSC::PropertyTable::create):
2610 (JSC::PropertyTable::clone):
2611 (JSC::PropertyTable::PropertyTable):
2612 (JSC::PropertyTable::destroy):
2613 (JSC::PropertyTable::~PropertyTable):
2614 (JSC::PropertyTable::visitChildren):
2616 Moved marking of property table values here from Structure::visitChildren().
2618 * runtime/WriteBarrier.h:
2619 (JSC::WriteBarrierBase::get):
2621 Move m_cell to a local before using it multiple times. This avoids a multiple-access race when
2622 Structure::checkOffsetConsistency() is used in assertions on the main thread while a marking thread
2623 zaps the property table.
2625 * runtime/Structure.h:
2626 (JSC::Structure::materializePropertyMapIfNecessary):
2627 (JSC::Structure::materializePropertyMapIfNecessaryForPinning):
2628 * runtime/StructureInlines.h:
2629 (JSC::Structure::propertyTable):
2631 Added a getter for the Structure's PropertyTable that ASSERTs GC currently isn't active.
2632 Because GC can zap an unpinned property table at any time, it's not entirely safe to access it.
2633 Renamed the variable itself to m_propertyTableUnsafe to force call sites into explaining themselves.
2635 (JSC::Structure::putWillGrowOutOfLineStorage):
2636 (JSC::Structure::checkOffsetConsistency):
2638 Moved these out of Structure.h to break header dependency cycle between Structure/PropertyTable.
2640 * runtime/Structure.cpp:
2641 (JSC::Structure::visitChildren):
2643 Null out m_propertyTable if the table is unpinned. This'll cause the table to get GC'd.
2645 (JSC::Structure::takePropertyTableOrCloneIfPinned):
2647 Added for setting up the property table in a new transition, this code is now shared between
2648 addPropertyTransition() and nonPropertyTransition().
2650 * runtime/JSGlobalData.h:
2651 * runtime/JSGlobalData.cpp:
2652 (JSC::JSGlobalData::JSGlobalData):
2654 Add a global propertyTableStructure.
2656 * runtime/PropertyMapHashTable.h:
2658 (JSC::PropertyTable::createStructure):
2659 (JSC::PropertyTable::copy):
2661 Make PropertyTable a GC object.
2663 * runtime/Structure.cpp:
2664 (JSC::Structure::dumpStatistics):
2665 (JSC::Structure::materializePropertyMap):
2666 (JSC::Structure::despecifyDictionaryFunction):
2667 (JSC::Structure::addPropertyTransition):
2668 (JSC::Structure::changePrototypeTransition):
2669 (JSC::Structure::despecifyFunctionTransition):
2670 (JSC::Structure::attributeChangeTransition):
2671 (JSC::Structure::toDictionaryTransition):
2672 (JSC::Structure::sealTransition):
2673 (JSC::Structure::freezeTransition):
2674 (JSC::Structure::preventExtensionsTransition):
2675 (JSC::Structure::nonPropertyTransition):
2676 (JSC::Structure::isSealed):
2677 (JSC::Structure::isFrozen):
2678 (JSC::Structure::flattenDictionaryStructure):
2679 (JSC::Structure::pin):
2680 (JSC::Structure::copyPropertyTable):
2681 (JSC::Structure::copyPropertyTableForPinning):
2682 (JSC::Structure::get):
2683 (JSC::Structure::despecifyFunction):
2684 (JSC::Structure::despecifyAllFunctions):
2685 (JSC::Structure::putSpecificValue):
2686 (JSC::Structure::remove):
2687 (JSC::Structure::createPropertyMap):
2688 (JSC::Structure::getPropertyNamesFromStructure):
2689 (JSC::Structure::checkConsistency):
2691 2013-03-05 Filip Pizlo <fpizlo@apple.com>
2693 Get rid of the invert argument to SpeculativeJIT::jumpSlowForUnwantedArrayMode
2694 https://bugs.webkit.org/show_bug.cgi?id=105624
2696 Reviewed by Oliver Hunt.
2698 All callers pass invert = false, which is the default value of the argument. So, get
2699 rid of the argument and fold away all code that checks it.
2701 * dfg/DFGSpeculativeJIT.cpp:
2702 (JSC::DFG::SpeculativeJIT::jumpSlowForUnwantedArrayMode):
2703 * dfg/DFGSpeculativeJIT.h:
2706 2013-03-05 Filip Pizlo <fpizlo@apple.com>
2708 Unreviewed, fix an incorrect comment. The comment was a holdover from a work-in-progress version of this code.
2710 * dfg/DFGDCEPhase.cpp:
2711 (JSC::DFG::DCEPhase::run):
2713 2013-03-04 Filip Pizlo <fpizlo@apple.com>
2715 DFG DCE might eliminate checks unsoundly
2716 https://bugs.webkit.org/show_bug.cgi?id=109389
2718 Reviewed by Oliver Hunt.
2720 This gets rid of all eager reference counting, and does all dead code elimination
2721 in one phase - the DCEPhase. This phase also sets up the node reference counts,
2722 which are then used not just for DCE but also register allocation and stack slot
2725 Doing this required a number of surgical changes in places that previously relied
2726 on always having liveness information. For example, the structure check hoisting
2727 phase must now consult whether a VariableAccessData is profitable for unboxing to
2728 make sure that it doesn't try to do hoisting on set SetLocals. The arguments
2729 simplification phase employs its own light-weight liveness analysis. Both phases
2730 previously just used reference counts.
2732 The largest change is that now, dead nodes get turned into Phantoms. Those
2733 Phantoms will retain those child edges that are not proven. This ensures that any
2734 type checks performed by a dead node remain even after the node is killed. On the
2735 other hand, this Phantom conversion means that we need special handling for
2736 SetLocal. I decided to make the four forms of SetLocal explicit:
2738 MovHint(@a, rK): Just indicates that node @a contains the value that would have
2739 now been placed into virtual register rK. Does not actually cause @a to be
2740 stored into rK. This would have previously been a dead SetLocal with @a
2741 being live. MovHints are always dead.
2743 ZombieHint(rK): Indicates that at this point, register rK will contain a dead
2744 value and OSR should put Undefined into it. This would have previously been
2745 a dead SetLocal with @a being dead also. ZombieHints are always dead.
2747 MovHintAndCheck(@a, rK): Identical to MovHint except @a is also type checked,
2748 according to whatever UseKind the edge to @a has. The type check is always a
2749 forward exit. MovHintAndChecks are always live, since they are
2750 NodeMustGenerate. Previously this would have been a dead SetLocal with a
2751 live @a, and the check would have disappeared. This is one of the bugs that
2754 SetLocal(@a, rK): This still does exactly what it does now, if the SetLocal is
2757 Basically this patch makes it so that dead SetLocals eventually decay to MovHint,
2758 ZombieHint, or MovHintAndCheck depending on the situation. If the child @a is
2759 also dead, then you get a ZombieHint. If the child @a is live but the SetLocal
2760 has a type check and @a's type hasn't been proven to have that type then you get
2761 a MovHintAndCheck. Otherwise you get a MovHint.
2763 This is performance neutral.
2766 * GNUmakefile.list.am:
2767 * JavaScriptCore.xcodeproj/project.pbxproj:
2769 * dfg/DFGAbstractState.cpp:
2770 (JSC::DFG::AbstractState::executeEffects):
2771 (JSC::DFG::AbstractState::mergeStateAtTail):
2772 * dfg/DFGArgumentsSimplificationPhase.cpp:
2773 (JSC::DFG::ArgumentsSimplificationPhase::run):
2774 (ArgumentsSimplificationPhase):
2775 (JSC::DFG::ArgumentsSimplificationPhase::removeArgumentsReferencingPhantomChild):
2776 * dfg/DFGBasicBlock.h:
2778 * dfg/DFGBasicBlockInlines.h:
2780 * dfg/DFGByteCodeParser.cpp:
2781 (JSC::DFG::ByteCodeParser::addToGraph):
2782 (JSC::DFG::ByteCodeParser::insertPhiNode):
2783 (JSC::DFG::ByteCodeParser::emitFunctionChecks):
2784 * dfg/DFGCFAPhase.cpp:
2785 (JSC::DFG::CFAPhase::run):
2786 * dfg/DFGCFGSimplificationPhase.cpp:
2787 (JSC::DFG::CFGSimplificationPhase::run):
2788 (JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
2789 * dfg/DFGCPSRethreadingPhase.cpp:
2790 (JSC::DFG::CPSRethreadingPhase::run):
2791 (JSC::DFG::CPSRethreadingPhase::addPhiSilently):
2792 * dfg/DFGCSEPhase.cpp:
2793 (JSC::DFG::CSEPhase::eliminateIrrelevantPhantomChildren):
2794 (JSC::DFG::CSEPhase::setReplacement):
2795 (JSC::DFG::CSEPhase::performNodeCSE):
2796 * dfg/DFGCommon.cpp:
2797 (WTF::printInternal):
2801 * dfg/DFGConstantFoldingPhase.cpp:
2802 (JSC::DFG::ConstantFoldingPhase::foldConstants):
2803 (JSC::DFG::ConstantFoldingPhase::addStructureTransitionCheck):
2804 (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode):
2805 * dfg/DFGDCEPhase.cpp: Added.
2808 (JSC::DFG::DCEPhase::DCEPhase):
2809 (JSC::DFG::DCEPhase::run):
2810 (JSC::DFG::DCEPhase::findTypeCheckRoot):
2811 (JSC::DFG::DCEPhase::countEdge):
2812 (JSC::DFG::DCEPhase::eliminateIrrelevantPhantomChildren):
2813 (JSC::DFG::performDCE):
2814 * dfg/DFGDCEPhase.h: Added.
2816 * dfg/DFGDriver.cpp:
2817 (JSC::DFG::compile):
2818 * dfg/DFGFixupPhase.cpp:
2819 (JSC::DFG::FixupPhase::fixupNode):
2820 (JSC::DFG::FixupPhase::checkArray):
2821 (JSC::DFG::FixupPhase::blessArrayOperation):
2822 (JSC::DFG::FixupPhase::fixIntEdge):
2823 (JSC::DFG::FixupPhase::injectInt32ToDoubleNode):
2824 (JSC::DFG::FixupPhase::truncateConstantToInt32):
2826 (JSC::DFG::Graph::Graph):
2827 (JSC::DFG::Graph::dump):
2830 (JSC::DFG::Graph::changeChild):
2831 (JSC::DFG::Graph::changeEdge):
2832 (JSC::DFG::Graph::compareAndSwap):
2833 (JSC::DFG::Graph::clearAndDerefChild):
2834 (JSC::DFG::Graph::performSubstitution):
2835 (JSC::DFG::Graph::performSubstitutionForEdge):
2837 (JSC::DFG::Graph::substitute):
2838 * dfg/DFGInsertionSet.h:
2841 (JSC::DFG::Node::Node):
2842 (JSC::DFG::Node::convertToConstant):
2843 (JSC::DFG::Node::convertToGetLocalUnlinked):
2844 (JSC::DFG::Node::containsMovHint):
2846 (JSC::DFG::Node::hasVariableAccessData):
2847 (JSC::DFG::Node::willHaveCodeGenOrOSR):
2848 * dfg/DFGNodeType.h:
2850 * dfg/DFGPredictionPropagationPhase.cpp:
2851 (JSC::DFG::PredictionPropagationPhase::propagate):
2852 * dfg/DFGSpeculativeJIT.cpp:
2853 (JSC::DFG::SpeculativeJIT::convertLastOSRExitToForward):
2854 (JSC::DFG::SpeculativeJIT::compileMovHint):
2855 (JSC::DFG::SpeculativeJIT::compileMovHintAndCheck):
2857 (JSC::DFG::SpeculativeJIT::compileInlineStart):
2858 (JSC::DFG::SpeculativeJIT::compile):
2859 * dfg/DFGSpeculativeJIT.h:
2861 * dfg/DFGSpeculativeJIT32_64.cpp:
2862 (JSC::DFG::SpeculativeJIT::compile):
2863 * dfg/DFGSpeculativeJIT64.cpp:
2864 (JSC::DFG::SpeculativeJIT::compile):
2865 * dfg/DFGStructureCheckHoistingPhase.cpp:
2866 (JSC::DFG::StructureCheckHoistingPhase::run):
2867 (JSC::DFG::StructureCheckHoistingPhase::shouldConsiderForHoisting):
2868 (StructureCheckHoistingPhase):
2869 * dfg/DFGValidate.cpp:
2870 (JSC::DFG::Validate::validate):
2872 2013-03-05 Mark Hahnenberg <mhahnenberg@apple.com>
2874 Objective-C API: JSValue should implement init and return nil in exceptional cases
2875 https://bugs.webkit.org/show_bug.cgi?id=111487
2877 Reviewed by Darin Adler.
2880 (-[JSValue init]): We return nil here because there is no way to get the instance into a coherent state
2881 without a JSContext.
2882 (-[JSValue initWithValue:inContext:]): Similarly, we should also return nil here if either of the arguments is 0.
2884 2013-03-05 Sheriff Bot <webkit.review.bot@gmail.com>
2886 Unreviewed, rolling out r144708.
2887 http://trac.webkit.org/changeset/144708
2888 https://bugs.webkit.org/show_bug.cgi?id=111447
2890 random assertion crashes in inspector tests on qt+mac bots
2891 (Requested by kling on #webkit).
2894 * GNUmakefile.list.am:
2895 * JavaScriptCore.gypi:
2896 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
2897 * JavaScriptCore.xcodeproj/project.pbxproj:
2899 * runtime/JSGlobalData.cpp:
2900 (JSC::JSGlobalData::JSGlobalData):
2901 * runtime/JSGlobalData.h:
2903 * runtime/PropertyMapHashTable.h:
2905 (JSC::PropertyTable::PropertyTable):
2907 (JSC::PropertyTable::~PropertyTable):
2908 (JSC::PropertyTable::copy):
2909 * runtime/PropertyTable.cpp: Removed.
2910 * runtime/Structure.cpp:
2911 (JSC::Structure::dumpStatistics):
2912 (JSC::Structure::materializePropertyMap):
2913 (JSC::Structure::despecifyDictionaryFunction):
2914 (JSC::Structure::addPropertyTransition):
2915 (JSC::Structure::changePrototypeTransition):
2916 (JSC::Structure::despecifyFunctionTransition):
2917 (JSC::Structure::attributeChangeTransition):
2918 (JSC::Structure::toDictionaryTransition):
2919 (JSC::Structure::sealTransition):
2920 (JSC::Structure::freezeTransition):
2921 (JSC::Structure::preventExtensionsTransition):
2922 (JSC::Structure::nonPropertyTransition):
2923 (JSC::Structure::isSealed):
2924 (JSC::Structure::isFrozen):
2925 (JSC::Structure::flattenDictionaryStructure):
2926 (JSC::Structure::pin):
2927 (JSC::Structure::copyPropertyTable):
2928 (JSC::Structure::copyPropertyTableForPinning):
2929 (JSC::Structure::get):
2930 (JSC::Structure::despecifyFunction):
2931 (JSC::Structure::despecifyAllFunctions):
2932 (JSC::Structure::putSpecificValue):
2933 (JSC::Structure::remove):
2934 (JSC::Structure::createPropertyMap):
2935 (JSC::Structure::getPropertyNamesFromStructure):
2936 (JSC::Structure::visitChildren):
2937 (JSC::Structure::checkConsistency):
2938 * runtime/Structure.h:
2940 (JSC::Structure::putWillGrowOutOfLineStorage):
2941 (JSC::Structure::materializePropertyMapIfNecessary):
2942 (JSC::Structure::materializePropertyMapIfNecessaryForPinning):
2943 (JSC::Structure::checkOffsetConsistency):
2945 * runtime/StructureInlines.h:
2946 (JSC::Structure::get):
2947 * runtime/WriteBarrier.h:
2948 (JSC::WriteBarrierBase::get):
2950 2013-03-05 David Kilzer <ddkilzer@apple.com>
2952 BUILD FIX (r144698): Only enable SPEECH_SYNTHESIS for Mac
2953 <http://webkit.org/b/106742>
2955 Fixes the following build failures:
2957 Undefined symbols for architecture i386:
2958 "__ZTVN7WebCore25PlatformSpeechSynthesizerE", referenced from:
2959 __ZN7WebCore25PlatformSpeechSynthesizerC2EPNS_31PlatformSpeechSynthesizerClientE in PlatformSpeechSynthesizer.o
2960 NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
2961 "__ZN7WebCore25PlatformSpeechSynthesizer19initializeVoiceListEv", referenced from:
2962 __ZN7WebCore25PlatformSpeechSynthesizerC2EPNS_31PlatformSpeechSynthesizerClientE in PlatformSpeechSynthesizer.o
2963 ld: symbol(s) not found for architecture i386
2965 * Configurations/FeatureDefines.xcconfig:
2966 - Fix definition of ENABLE_ENCRYPTED_MEDIA_V2_macosx to match
2967 other FeatureDefines.xcconfig files.
2968 - Only set ENABLE_SPEECH_SYNTHESIS for the macosx platform.
2970 2013-03-04 Andreas Kling <akling@apple.com>
2972 Unused Structure property tables waste 14MB on Membuster.
2973 <http://webkit.org/b/110854>
2974 <rdar://problem/13292104>
2976 Reviewed by Geoffrey Garen.
2978 Turn PropertyTable into a GC object and have Structure drop unpinned tables when marking.
2979 14 MB progression on Membuster3.
2982 * GNUmakefile.list.am:
2983 * JavaScriptCore.gypi:
2984 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
2985 * JavaScriptCore.xcodeproj/project.pbxproj:
2988 Added PropertyTable.cpp.
2990 * runtime/PropertyTable.cpp: Added.
2991 (JSC::PropertyTable::create):
2992 (JSC::PropertyTable::clone):
2993 (JSC::PropertyTable::PropertyTable):
2994 (JSC::PropertyTable::destroy):
2995 (JSC::PropertyTable::~PropertyTable):
2996 (JSC::PropertyTable::visitChildren):
2998 Moved marking of property table values here from Structure::visitChildren().
3000 * runtime/WriteBarrier.h:
3001 (JSC::WriteBarrierBase::get):
3003 Move m_cell to a local before using it multiple times. This avoids a multiple-access race when
3004 Structure::checkOffsetConsistency() is used in assertions on the main thread while a marking thread
3005 zaps the property table.
3007 * runtime/Structure.h:
3008 (JSC::Structure::materializePropertyMapIfNecessary):
3009 (JSC::Structure::materializePropertyMapIfNecessaryForPinning):
3010 * runtime/StructureInlines.h:
3011 (JSC::Structure::propertyTable):
3013 Added a getter for the Structure's PropertyTable that ASSERTs GC currently isn't active.
3014 Because GC can zap an unpinned property table at any time, it's not entirely safe to access it.
3015 Renamed the variable itself to m_propertyTableUnsafe to force call sites into explaining themselves.
3017 (JSC::Structure::putWillGrowOutOfLineStorage):
3018 (JSC::Structure::checkOffsetConsistency):
3020 Moved these out of Structure.h to break header dependency cycle between Structure/PropertyTable.
3022 * runtime/Structure.cpp:
3023 (JSC::Structure::visitChildren):
3025 Null out m_propertyTable if the table is unpinned. This'll cause the table to get GC'd.
3027 * runtime/JSGlobalData.h:
3028 * runtime/JSGlobalData.cpp:
3029 (JSC::JSGlobalData::JSGlobalData):
3031 Add a global propertyTableStructure.
3033 * runtime/PropertyMapHashTable.h:
3035 (JSC::PropertyTable::createStructure):
3036 (JSC::PropertyTable::copy):
3038 Make PropertyTable a GC object.
3040 * runtime/Structure.cpp:
3041 (JSC::Structure::dumpStatistics):
3042 (JSC::Structure::materializePropertyMap):
3043 (JSC::Structure::despecifyDictionaryFunction):
3044 (JSC::Structure::addPropertyTransition):
3045 (JSC::Structure::changePrototypeTransition):
3046 (JSC::Structure::despecifyFunctionTransition):
3047 (JSC::Structure::attributeChangeTransition):
3048 (JSC::Structure::toDictionaryTransition):
3049 (JSC::Structure::sealTransition):
3050 (JSC::Structure::freezeTransition):
3051 (JSC::Structure::preventExtensionsTransition):
3052 (JSC::Structure::nonPropertyTransition):
3053 (JSC::Structure::isSealed):
3054 (JSC::Structure::isFrozen):
3055 (JSC::Structure::flattenDictionaryStructure):
3056 (JSC::Structure::pin):
3057 (JSC::Structure::copyPropertyTable):
3058 (JSC::Structure::copyPropertyTableForPinning):
3059 (JSC::Structure::get):
3060 (JSC::Structure::despecifyFunction):
3061 (JSC::Structure::despecifyAllFunctions):
3062 (JSC::Structure::putSpecificValue):
3063 (JSC::Structure::remove):
3064 (JSC::Structure::createPropertyMap):
3065 (JSC::Structure::getPropertyNamesFromStructure):
3066 (JSC::Structure::checkConsistency):
3068 2013-03-04 Chris Fleizach <cfleizach@apple.com>
3070 Support WebSpeech - Speech Synthesis
3071 https://bugs.webkit.org/show_bug.cgi?id=106742
3073 Reviewed by Simon Fraser.
3075 Enable speech synthesis for the Mac.
3077 * Configurations/FeatureDefines.xcconfig:
3079 2013-03-04 Mark Hahnenberg <mhahnenberg@apple.com>
3081 Remove contextInternalContext from JSContextInternal.h
3082 https://bugs.webkit.org/show_bug.cgi?id=111356
3084 Reviewed by Geoffrey Garen.
3086 We don't need it any more since we have globalContextRef in JSContext.
3089 * API/JSContextInternal.h:
3091 (+[JSValue valueWithBool:inContext:]):
3092 (+[JSValue valueWithDouble:inContext:]):
3093 (+[JSValue valueWithInt32:inContext:]):
3094 (+[JSValue valueWithUInt32:inContext:]):
3095 (+[JSValue valueWithNewObjectInContext:]):
3096 (+[JSValue valueWithNewArrayInContext:]):
3097 (+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]):
3098 (+[JSValue valueWithNewErrorFromMessage:inContext:]):
3099 (+[JSValue valueWithNullInContext:]):
3100 (+[JSValue valueWithUndefinedInContext:]):
3101 (-[JSValue toBool]):
3102 (-[JSValue toDouble]):
3103 (-[JSValue toNumber]):
3104 (-[JSValue toString]):
3105 (-[JSValue toDate]):
3106 (-[JSValue toArray]):
3107 (-[JSValue toDictionary]):
3108 (-[JSValue valueForProperty:]):
3109 (-[JSValue setValue:forProperty:]):
3110 (-[JSValue deleteProperty:]):
3111 (-[JSValue hasProperty:]):
3112 (-[JSValue valueAtIndex:]):
3113 (-[JSValue setValue:atIndex:]):
3114 (-[JSValue isUndefined]):
3115 (-[JSValue isNull]):
3116 (-[JSValue isBoolean]):
3117 (-[JSValue isNumber]):
3118 (-[JSValue isString]):
3119 (-[JSValue isObject]):
3120 (-[JSValue isEqualToObject:]):
3121 (-[JSValue isEqualWithTypeCoercionToObject:]):
3122 (-[JSValue isInstanceOf:]):
3123 (-[JSValue callWithArguments:]):
3124 (-[JSValue constructWithArguments:]):
3125 (-[JSValue invokeMethod:withArguments:]):
3127 (objectToValueWithoutCopy):
3129 (-[JSValue initWithValue:inContext:]):
3130 (-[JSValue dealloc]):
3131 (-[JSValue description]):
3132 * API/JSWrapperMap.mm:
3133 (createObjectWithCustomBrand):
3134 (-[JSObjCClassInfo allocateConstructorAndPrototypeWithSuperClassInfo:]):
3135 (-[JSObjCClassInfo wrapperForObject:]):
3136 (-[JSWrapperMap jsWrapperForObject:]):
3137 * API/ObjCCallbackFunction.mm:
3138 (ObjCCallbackFunction::call):
3139 (objCCallbackFunctionForInvocation):
3141 2013-03-04 Andreas Kling <akling@apple.com>
3143 Add simple vector traits for JSC::Identifier.
3144 <http://webkit.org/b/111323>
3146 Reviewed by Geoffrey Garen.
3148 Identifiers are really just Strings, giving them simple vector traits makes
3149 Vector move them with memcpy() instead of churning the refcounts.
3151 * runtime/Identifier.h:
3154 2013-03-04 Kunihiko Sakamoto <ksakamoto@chromium.org>
3156 Add build flag for FontLoader
3157 https://bugs.webkit.org/show_bug.cgi?id=111289
3159 Reviewed by Benjamin Poulain.
3161 Add ENABLE_FONT_LOAD_EVENTS build flag (disabled by default).
3163 * Configurations/FeatureDefines.xcconfig:
3165 2013-03-03 Andreas Kling <akling@apple.com>
3167 Shrink JSC::HashTable entries.
3168 <http://webkit.org/b/111275>
3169 <rdar://problem/13333511>
3171 Reviewed by Anders Carlsson.
3173 Move the Intrinsic value out of the function-specific part of the union,
3174 and store it next to m_attributes. Reduces the size of HashEntry by 8 bytes.
3176 990 kB progression on Membuster3. (PTUS: 797 kB)
3179 (JSC::HashEntry::initialize):
3180 (JSC::HashEntry::intrinsic):
3183 2013-03-01 David Kilzer <ddkilzer@apple.com>
3185 BUILD FIX: testapi should link to Foundation, not CoreFoundation
3187 * JavaScriptCore.xcodeproj/project.pbxproj: Change testapi to
3188 link to Foundation.framework instead of CoreFoundation.framework
3189 since it uses NS types.
3191 2013-03-01 Mark Hahnenberg <mhahnenberg@apple.com>
3193 Objective-C API: Passing JS functions to Objective-C callbacks causes JSValue to leak
3194 https://bugs.webkit.org/show_bug.cgi?id=107836
3196 Reviewed by Oliver Hunt.
3198 We've decided to remove support for this feature from the API because there's no way to automatically manage
3199 the memory for clients in a satisfactory manner. Clients can still pass JS functions to Objective-C methods,
3200 but the methods must accept plain JSValues instead of Objective-C blocks.
3202 We now ignore functions that are part of a protocol that inherits from JSExport that accept blocks as arguments.
3204 * API/JSBlockAdaptor.h: Removed.
3205 * API/JSBlockAdaptor.mm: Removed.
3206 * API/ObjCCallbackFunction.mm:
3207 (ArgumentTypeDelegate::typeBlock): Return nil to signal that we want to ignore this function when copying it
3208 to the object from the protocol.
3209 * API/tests/testapi.mm: Added a test to make sure that we ignore methods declared as part of a JSExport-ed protocol
3210 that have block arguments.
3211 (-[TestObject bogusCallback:]):
3212 * JavaScriptCore.gypi: Updated build files.
3213 * JavaScriptCore.xcodeproj/project.pbxproj:
3215 2013-03-01 Filip Pizlo <fpizlo@apple.com>
3217 DFG Branch(LogicalNot) peephole should not try to optimize and work-around the case where LogicalNot may be otherwise live
3218 https://bugs.webkit.org/show_bug.cgi?id=111209
3220 Reviewed by Oliver Hunt.
3222 Even if it is then everything will work just fine. It's not necessary to check the ref count here.
3224 * dfg/DFGFixupPhase.cpp:
3225 (JSC::DFG::FixupPhase::fixupNode):
3227 2013-03-01 Filip Pizlo <fpizlo@apple.com>
3229 DFG CSE phase shouldn't rely on ref count of nodes, since it doesn't have to
3230 https://bugs.webkit.org/show_bug.cgi?id=111205
3232 Reviewed by Oliver Hunt.
3234 I don't understand the intuition behind setLocalStoreElimination() validating that the SetLocal's ref count
3235 is 1. I believe this is a hold-over from when setLocalStoreElimination() would match one SetLocal to another,
3236 and then try to eliminate the first SetLocal. But that's not how it works now. Now, setLocalStoreElimination()
3237 is actually Flush elimination: it eliminates any Flush that anchors a SetLocal if it proves that every path
3238 from the SetLocal to the Flush is devoid of operations that may observe the local. It doesn't actually kill
3239 the SetLocal itself: if the SetLocal is live because of other things (other Flushes or GetLocals in other
3240 basic blocks), then the SetLocal will naturally still be alive because th Flush was only keeping the SetLocal
3241 alive by one count rather than being solely responsible for its liveness.
3243 * dfg/DFGCSEPhase.cpp:
3244 (JSC::DFG::CSEPhase::setLocalStoreElimination):
3245 (JSC::DFG::CSEPhase::eliminate):
3246 (JSC::DFG::CSEPhase::performNodeCSE):
3248 2013-03-01 Filip Pizlo <fpizlo@apple.com>
3250 Rename MovHint to MovHintEvent so I can create a NodeType called MovHint
3252 Rubber stamped by Mark Hahnenberg.
3254 This is similar to the SetLocal/SetLocalEvent naming scheme, where SetLocal is the
3255 NodeType and SetLocalEvent is the VariableEventKind.
3257 * dfg/DFGVariableEvent.cpp:
3258 (JSC::DFG::VariableEvent::dump):
3259 * dfg/DFGVariableEvent.h:
3260 (JSC::DFG::VariableEvent::movHint):
3261 (JSC::DFG::VariableEvent::id):
3262 (JSC::DFG::VariableEvent::operand):
3264 * dfg/DFGVariableEventStream.cpp:
3265 (JSC::DFG::VariableEventStream::reconstruct):
3267 2013-03-01 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
3269 [JSC] Fix sign comparison warning/error after r144340.
3270 https://bugs.webkit.org/show_bug.cgi?id=111164
3272 Reviewed by Mark Hahnenberg.
3274 gcc (both 4.2.1 and 4.7.2) complain about comparing signed and
3275 unsigned terms (clang accepts it just fine).
3277 Work around that by casting the 1 to an uintptr_t as well.
3280 (JSC::DFG::Edge::makeWord):
3282 2013-02-28 Filip Pizlo <fpizlo@apple.com>
3284 DFG CFA should not do liveness pruning
3285 https://bugs.webkit.org/show_bug.cgi?id=111119
3287 Reviewed by Mark Hahnenberg.
3289 It adds complexity and probably buys nothing. Moreover, I'm transitioning to having
3290 liveness only available at the bitter end of compilation, so this will stop working
3291 after https://bugs.webkit.org/show_bug.cgi?id=109389 anyway.
3293 * dfg/DFGAbstractState.cpp:
3294 (JSC::DFG::AbstractState::initialize):
3295 (JSC::DFG::AbstractState::mergeStateAtTail):
3297 2013-02-28 Filip Pizlo <fpizlo@apple.com>
3299 Don't try to emit profiling if you don't have the DFG JIT.
3301 Rubber stamped by Mark Hahnenberg.
3304 (JSC::JIT::shouldEmitProfiling):
3306 2013-02-28 Filip Pizlo <fpizlo@apple.com>
3308 DFG Phantom node should be honest about the fact that it can exit
3309 https://bugs.webkit.org/show_bug.cgi?id=111115
3311 Reviewed by Mark Hahnenberg.
3313 The chances of this having cause serious issues are low, since most clients of the
3314 NodeDoesNotExit flag run after CFA and CFA updates this properly. But one possible
3315 case of badness is if the ByteCodeParser inserted a Phantom with a type check in
3316 between a LogicalNot and a Branch; then that peephole optimization in Fixup might
3319 * dfg/DFGNodeType.h:
3322 2013-02-28 Mark Hahnenberg <mhahnenberg@apple.com>
3324 Add casts in DFGGPRInfo.h to suppress warnings
3325 https://bugs.webkit.org/show_bug.cgi?id=111104
3327 Reviewed by Filip Pizlo.
3329 With certain flags on, we get compiler warnings on ARM. We should do the proper casts to make these warnings go away.
3332 (JSC::DFG::GPRInfo::toIndex):
3333 (JSC::DFG::GPRInfo::debugName):
3335 2013-02-28 Filip Pizlo <fpizlo@apple.com>
3337 It should be easy to determine if a DFG node exits forward or backward when doing type checks
3338 https://bugs.webkit.org/show_bug.cgi?id=111102
3340 Reviewed by Mark Hahnenberg.
3342 This adds a NodeExitsForward flag, which tells you the exit directionality of
3343 type checks performed by the node. Even if you convert the node to a Phantom
3344 and use the Edge UseKind for type checks, you'll still get the same exit
3345 directionality that the original node would have wanted.
3347 * dfg/DFGArgumentsSimplificationPhase.cpp:
3348 (JSC::DFG::ArgumentsSimplificationPhase::run):
3349 * dfg/DFGArrayifySlowPathGenerator.h:
3350 (JSC::DFG::ArrayifySlowPathGenerator::ArrayifySlowPathGenerator):
3351 * dfg/DFGCFGSimplificationPhase.cpp:
3352 (JSC::DFG::CFGSimplificationPhase::run):
3353 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
3354 * dfg/DFGCPSRethreadingPhase.cpp:
3355 (JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocalFor):
3356 * dfg/DFGCSEPhase.cpp:
3357 (JSC::DFG::CSEPhase::setReplacement):
3358 (JSC::DFG::CSEPhase::eliminate):
3359 (JSC::DFG::CSEPhase::performNodeCSE):