blob: d3ef1c6ed3ce1563919aee79a85a928c4cbd34ee [file] [log] [blame]
mhahnenberg@apple.comaa1f4ec2012-07-27 19:29:03 +000012012-07-27 Mark Hahnenberg <mhahnenberg@apple.com>
2
3 Increase inline storage for JSFinalObjects by one
4 https://bugs.webkit.org/show_bug.cgi?id=92526
5
6 Reviewed by Geoffrey Garen.
7
8 Now that we've removed the inheritorID from objects, we can increase our inline storage for JSFinalObjects on
9 64-bit platforms by 1.
10
11 * llint/LowLevelInterpreter.asm: Change the constant.
12 * runtime/PropertyOffset.h: Change the constant.
13 (JSC):
14
jer.noble@apple.com50ecb282012-07-27 16:31:07 +0000152012-07-27 Jer Noble <jer.noble@apple.com>
16
17 Support a rational time class for use by media elements.
18 https://bugs.webkit.org/show_bug.cgi?id=88787
19
20 Re-export WTF::MediaTime from JavaScriptCore.
21
22 Reviewed by Eric Carlson.
23
24 * JavaScriptCore.order:
25 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
26
fpizlo@apple.comd510fc22012-07-27 00:11:44 +0000272012-07-26 Filip Pizlo <fpizlo@apple.com>
28
29 JSObject::reallocateStorageIfNecessary is neither used nor defined
30 https://bugs.webkit.org/show_bug.cgi?id=92417
31
32 Reviewed by Mark Rowe.
33
34 * runtime/JSObject.h:
35 (JSObject):
36
mhahnenberg@apple.comb44a7f02012-07-26 23:27:53 +0000372012-07-26 Mark Hahnenberg <mhahnenberg@apple.com>
38
39 Allocate Structures in a separate part of the Heap
40 https://bugs.webkit.org/show_bug.cgi?id=92420
41
42 Reviewed by Filip Pizlo.
43
44 To fix our issue with destruction/finalization of Structures before their objects, we can move Structures to a separate
45 part of the Heap that will be swept after all other objects. This first patch will just be separating Structures
46 out into their own separate MarkedAllocator. Everything else will behave identically.
47
48 * heap/Heap.h: New function to allocate Structures in the Heap.
49 (Heap):
50 (JSC):
51 (JSC::Heap::allocateStructure):
52 * heap/MarkedAllocator.cpp: Pass whether or not we're allocated Structures to the MarkedBlock.
53 (JSC::MarkedAllocator::allocateBlock):
54 * heap/MarkedAllocator.h: Add tracking for whether or not we're allocating only Structures.
55 (JSC::MarkedAllocator::onlyContainsStructures):
56 (MarkedAllocator):
57 (JSC::MarkedAllocator::MarkedAllocator):
58 (JSC::MarkedAllocator::init):
59 * heap/MarkedBlock.cpp: Add tracking for whether or not we're allocating only Structures. We need this to be able to
60 distinguish the various MarkedBlock types in MarkedSpace::allocatorFor(MarkedBlock*).
61 (JSC::MarkedBlock::create):
62 (JSC::MarkedBlock::MarkedBlock):
63 * heap/MarkedBlock.h:
64 (MarkedBlock):
65 (JSC::MarkedBlock::onlyContainsStructures):
66 (JSC):
67 * heap/MarkedSpace.cpp: Include the new Structure allocator in all the places that all the other allocators are used/modified.
68 (JSC::MarkedSpace::MarkedSpace):
69 (JSC::MarkedSpace::resetAllocators):
70 (JSC::MarkedSpace::canonicalizeCellLivenessData):
71 (JSC::MarkedSpace::isPagedOut):
72 * heap/MarkedSpace.h: Add new MarkedAllocator just for Structures.
73 (MarkedSpace):
74 (JSC::MarkedSpace::allocatorFor):
75 (JSC::MarkedSpace::allocateStructure):
76 (JSC):
77 (JSC::MarkedSpace::forEachBlock):
78 * runtime/Structure.h: Move all of the functions that call allocateCell<Structure> down below the explicit template specialization
79 for allocateCell<Structure>. The new inline specialization for allocateCell directly calls the allocateStructure() function in the
80 Heap.
81 (Structure):
82 (JSC::Structure):
83 (JSC):
84 (JSC::Structure::create):
85 (JSC::Structure::createStructure):
86
fpizlo@apple.com2b1d81e2012-07-26 23:01:05 +0000872012-07-26 Filip Pizlo <fpizlo@apple.com>
88
89 JSArray has methods that are neither used nor defined
90 https://bugs.webkit.org/show_bug.cgi?id=92416
91
92 Reviewed by Simon Fraser.
93
94 * runtime/JSArray.h:
95 (JSArray):
96
zherczeg@webkit.org4a637582012-07-26 12:29:10 +0000972012-07-26 Zoltan Herczeg <zherczeg@webkit.org>
98
99 [Qt][ARM]ARMAssembler needs buildfix afert r123417
100 https://bugs.webkit.org/show_bug.cgi?id=92086
101
102 Reviewed by Csaba Osztrogonác.
103
104 The ARM implementation of this should be optimized code path
105 is covered by a non-optimized code path. This patch fixes this,
106 and adds a new function which returns with the offset range.
107
108 * assembler/ARMAssembler.h:
109 (JSC::ARMAssembler::readPointer):
110 (ARMAssembler):
111 (JSC::ARMAssembler::repatchInt32):
112 (JSC::ARMAssembler::repatchCompact):
113 * assembler/MacroAssemblerARM.h:
114 (MacroAssemblerARM):
115 (JSC::MacroAssemblerARM::isCompactPtrAlignedAddressOffset):
116 (JSC::MacroAssemblerARM::load32WithCompactAddressOffsetPatch):
117
mhahnenberg@apple.com9a75d6f2012-07-26 06:06:25 +00001182012-07-25 Mark Hahnenberg <mhahnenberg@apple.com>
119
120 Build fix for 32-bit after r123682
121
122 * runtime/JSObject.h: Need to pad out JSObjects on 32-bit so that they're the correct size since
123 we only removed one 4-byte word and we need to be 8-byte aligned.
124 (JSObject):
125
fpizlo@apple.com338a70dc2012-07-26 01:22:59 +00001262012-07-25 Filip Pizlo <fpizlo@apple.com>
127
128 JSC GC object copying APIs should allow for greater flexibility
129 https://bugs.webkit.org/show_bug.cgi?id=92316
130
131 Reviewed by Mark Hahnenberg.
132
133 It's now the case that visitChildren() methods can directly pin and allocate in new space during copying.
134 They can also do the copying and marking themselves. This new API is only used for JSObjects for now.
135
136 * JavaScriptCore.xcodeproj/project.pbxproj:
137 * heap/MarkStack.cpp:
138 (JSC::SlotVisitor::allocateNewSpaceSlow):
139 (JSC::SlotVisitor::allocateNewSpaceOrPin):
140 (JSC):
141 (JSC::SlotVisitor::copyAndAppend):
142 * heap/MarkStack.h:
143 (MarkStack):
144 (JSC::MarkStack::appendUnbarrieredValue):
145 (JSC):
146 * heap/SlotVisitor.h:
147 * heap/SlotVisitorInlineMethods.h: Added.
148 (JSC):
149 (JSC::SlotVisitor::checkIfShouldCopyAndPinOtherwise):
150 (JSC::SlotVisitor::allocateNewSpace):
151 * runtime/JSObject.cpp:
152 (JSC::JSObject::visitOutOfLineStorage):
153 (JSC):
154 (JSC::JSObject::visitChildren):
155 (JSC::JSFinalObject::visitChildren):
156 * runtime/JSObject.h:
157 (JSObject):
158
mhahnenberg@apple.com0e8fce12012-07-26 00:12:58 +00001592012-07-25 Mark Hahnenberg <mhahnenberg@apple.com>
160
161 Remove JSObject::m_inheritorID
162 https://bugs.webkit.org/show_bug.cgi?id=88378
163
164 Reviewed by Filip Pizlo.
165
166 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
167 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
168 Instead use a private named value in the object's property storage.
169
170 * dfg/DFGSpeculativeJIT.h:
171 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!
172 * jit/JITInlineMethods.h:
173 (JSC::JIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!
174 * llint/LowLevelInterpreter.asm: No need m_inheritorID to initialize!
175 * runtime/JSGlobalData.h:
176 (JSGlobalData): Added private name 'm_inheritorIDKey'.
177 * runtime/JSGlobalThis.cpp:
178 (JSC::JSGlobalThis::setUnwrappedObject): resetInheritorID is now passed a JSGlobalData&.
179 * runtime/JSObject.cpp:
180 (JSC::JSObject::visitChildren): No m_inheritorID to be marked.
181 (JSC::JSFinalObject::visitChildren): No m_inheritorID to be marked.
182 (JSC::JSObject::createInheritorID): Store the newly created inheritorID in the property map. Make sure
183 it's got the DontEnum attribute!!
184 * runtime/JSObject.h:
185 (JSObject):
186 (JSC::JSObject::resetInheritorID): Remove the inheritorID from property storage.
187 (JSC):
188 (JSC::JSObject::inheritorID): Read the inheritorID from property storage.
189
caio.oliveira@openbossa.org947a2282012-07-25 22:15:05 +00001902012-07-25 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
191
192 Create a specialized pair for use in HashMap iterators
193 https://bugs.webkit.org/show_bug.cgi?id=92137
194
195 Reviewed by Ryosuke Niwa.
196
197 Update a couple of sites that relied on the fact that "contents" of iterators were
198 std::pairs.
199
200 * profiler/Profile.cpp:
201 (JSC): This code kept a vector of the pairs that were the "contents" of the iterators. This
202 is changed to use a KeyValuePair. We make use HashCount's ValueType (which represents only
203 the key) to get the proper key parameter for KeyValuePair.
204 * tools/ProfileTreeNode.h:
205 (ProfileTreeNode): Use HashMap::ValueType to declare the type of the contents of the hash
206 instead of declaring it manually. This will make use of the new KeyValuePair.
207
paroga@webkit.orgcf6740e2012-07-25 07:42:03 +00002082012-07-25 Patrick Gansterer <paroga@webkit.org>
209
210 REGRESSION(r123505): Date.getYear() returns the same as Date.getFullYear()
211 https://bugs.webkit.org/show_bug.cgi?id=92218
212
213 Reviewed by Csaba Osztrogonác.
214
215 * runtime/DatePrototype.cpp:
216 (JSC::dateProtoFuncGetYear): Added the missing offset of 1900 to the return value.
217
fpizlo@apple.coma7f7dcd2012-07-24 19:47:18 +00002182012-07-24 Filip Pizlo <fpizlo@apple.com>
219
220 REGRESSION(r123417): It made tests assert/crash on 32 bit
221 https://bugs.webkit.org/show_bug.cgi?id=92088
222
223 Reviewed by Mark Hahnenberg.
224
225 The pointer arithmetic was wrong, because negative numbers are hard to think about.
226
227 * dfg/DFGRepatch.cpp:
228 (JSC::DFG::emitPutTransitionStub):
229 * dfg/DFGSpeculativeJIT.cpp:
230 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
231
paroga@webkit.orgf2de22c2012-07-24 19:03:57 +00002322012-07-24 Patrick Gansterer <paroga@webkit.org>
233
paroga@webkit.org683889f2012-07-24 19:25:30 +0000234 Store the full year in GregorianDateTime
235 https://bugs.webkit.org/show_bug.cgi?id=92067
236
237 Reviewed by Geoffrey Garen.
238
239 Use the full year instead of the offset from year 1900
240 for the year member variable of GregorianDateTime.
241
242 * runtime/DateConstructor.cpp:
243 (JSC::constructDate):
244 (JSC::dateUTC):
245 * runtime/DateConversion.cpp:
246 (JSC::formatDate):
247 (JSC::formatDateUTCVariant):
248 * runtime/DatePrototype.cpp:
249 (JSC::formatLocaleDate):
250 (JSC::fillStructuresUsingDateArgs):
251 (JSC::dateProtoFuncToISOString):
252 (JSC::dateProtoFuncGetFullYear):
253 (JSC::dateProtoFuncGetUTCFullYear):
254 (JSC::dateProtoFuncSetYear):
255 * runtime/JSDateMath.cpp:
256 (JSC::gregorianDateTimeToMS):
257 (JSC::msToGregorianDateTime):
258
2592012-07-24 Patrick Gansterer <paroga@webkit.org>
260
paroga@webkit.orgf2de22c2012-07-24 19:03:57 +0000261 [WIN] Build fix after r123417.
262
263 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
264
paroga@webkit.org175d46f2012-07-24 05:19:55 +00002652012-07-23 Patrick Gansterer <paroga@webkit.org>
266
267 Move GregorianDateTime from JSC to WTF namespace
268 https://bugs.webkit.org/show_bug.cgi?id=91948
269
270 Reviewed by Geoffrey Garen.
271
272 Moving GregorianDateTime into the WTF namespace allows us to us to
273 use it in WebCore too. The new class has the same behaviour as the
274 old struct. Only the unused timeZone member has been removed.
275
276 * runtime/DateConstructor.cpp:
277 * runtime/DateConversion.cpp:
278 * runtime/DateConversion.h:
279 * runtime/DateInstance.h:
280 * runtime/DatePrototype.cpp:
281 * runtime/JSDateMath.cpp:
282 * runtime/JSDateMath.h:
283
fpizlo@apple.com94a9c102012-07-23 22:38:30 +00002842012-07-23 Filip Pizlo <fpizlo@apple.com>
285
fpizlo@apple.com961a9562012-07-24 02:13:19 +0000286 Property storage should grow in reverse address direction, to support butterflies
287 https://bugs.webkit.org/show_bug.cgi?id=91788
288
289 Reviewed by Geoffrey Garen.
290
291 Changes property storage to grow to the left, and changes the property storage pointer to point
292 one 8-byte word (i.e. JSValue) to the right of the first value in the storage.
293
294 Also improved debug support somewhat, by adding a describe() function to the jsc command-line,
295 and a slow mode of object access in LLInt.
296
297 * assembler/ARMv7Assembler.h:
298 (JSC::ARMv7Assembler::repatchCompact):
299 * assembler/MacroAssemblerARMv7.h:
300 (MacroAssemblerARMv7):
301 (JSC::MacroAssemblerARMv7::isCompactPtrAlignedAddressOffset):
302 (JSC::MacroAssemblerARMv7::load32WithCompactAddressOffsetPatch):
303 * assembler/MacroAssemblerX86Common.h:
304 (JSC::MacroAssemblerX86Common::isCompactPtrAlignedAddressOffset):
305 (JSC::MacroAssemblerX86Common::repatchCompact):
306 * assembler/X86Assembler.h:
307 (JSC::X86Assembler::repatchCompact):
308 * bytecode/CodeBlock.cpp:
309 (JSC::dumpStructure):
310 * bytecode/GetByIdStatus.h:
311 (JSC::GetByIdStatus::GetByIdStatus):
312 * dfg/DFGOperations.cpp:
313 * dfg/DFGOperations.h:
314 * dfg/DFGRepatch.cpp:
315 (JSC::DFG::tryCacheGetByID):
316 (JSC::DFG::emitPutTransitionStub):
317 * dfg/DFGSpeculativeJIT.cpp:
318 (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
319 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
320 * dfg/DFGSpeculativeJIT.h:
321 (JSC::DFG::SpeculativeJIT::callOperation):
322 * dfg/DFGSpeculativeJIT32_64.cpp:
323 (JSC::DFG::SpeculativeJIT::compile):
324 * dfg/DFGSpeculativeJIT64.cpp:
325 (JSC::DFG::SpeculativeJIT::compile):
326 * heap/ConservativeRoots.cpp:
327 (JSC::ConservativeRoots::genericAddPointer):
328 * heap/CopiedSpace.h:
329 (CopiedSpace):
330 * heap/CopiedSpaceInlineMethods.h:
331 (JSC::CopiedSpace::pinIfNecessary):
332 (JSC):
333 * jit/JITPropertyAccess.cpp:
334 (JSC::JIT::compileGetDirectOffset):
335 * jit/JITPropertyAccess32_64.cpp:
336 (JSC::JIT::compileGetDirectOffset):
337 * jit/JITStubs.cpp:
338 (JSC::JITThunks::tryCacheGetByID):
339 * jsc.cpp:
340 (GlobalObject::finishCreation):
341 (functionDescribe):
342 * llint/LLIntCommon.h:
343 * llint/LLIntSlowPaths.cpp:
344 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
345 * llint/LowLevelInterpreter32_64.asm:
346 * llint/LowLevelInterpreter64.asm:
347 * runtime/JSObject.cpp:
348 (JSC::JSObject::visitChildren):
349 (JSC::JSFinalObject::visitChildren):
350 (JSC::JSObject::growOutOfLineStorage):
351 * runtime/JSObject.h:
352 (JSC::JSObject::getDirectLocation):
353 (JSC::JSObject::offsetForLocation):
354 * runtime/JSValue.h:
355 (JSValue):
356 * runtime/PropertyOffset.h:
357 (JSC::offsetInOutOfLineStorage):
358
3592012-07-23 Filip Pizlo <fpizlo@apple.com>
360
fpizlo@apple.com5128a712012-07-23 22:46:14 +0000361 DFG is too aggressive in performing the specific value optimization on loads
362 https://bugs.webkit.org/show_bug.cgi?id=92034
363
364 Reviewed by Mark Hahnenberg.
365
366 This ensures that we don't do optimizations based on a structure having a specific
367 value, if there is no way to detect that the value is despecified. This is the
368 case for dictionaries, since despecifying a value in a dictionary does not lead to
369 a transition and so cannot be caught by either structure checks or structure
370 transition watchpoints.
371
372 * bytecode/GetByIdStatus.cpp:
373 (JSC::GetByIdStatus::computeFromLLInt):
374 (JSC::GetByIdStatus::computeForChain):
375 (JSC::GetByIdStatus::computeFor):
376 * bytecode/ResolveGlobalStatus.cpp:
377 (JSC::computeForStructure):
378
3792012-07-23 Filip Pizlo <fpizlo@apple.com>
380
fpizlo@apple.com94a9c102012-07-23 22:38:30 +0000381 REGRESSION(r123169): It made fast/js/dfg-inline-arguments-use-from-uninlined-code.html fail on 32 bit platforms
382 https://bugs.webkit.org/show_bug.cgi?id=92002
383
384 Reviewed by Mark Hahnenberg.
385
386 In the process of changing the nature of local variable typing, I forgot to modify one of the places where
387 we glue the DFG's notion of variable prediction to the runtime's notion of variable tagging.
388
389 * dfg/DFGSpeculativeJIT.cpp:
390 (JSC::DFG::SpeculativeJIT::compile):
391
simon.fraser@apple.com8b810602012-07-23 21:03:45 +00003922012-07-23 Simon Fraser <simon.fraser@apple.com>
393
394 Part 2 of: Implement sticky positioning
395 https://bugs.webkit.org/show_bug.cgi?id=90046
396
397 Reviewed by Ojan Vafai.
398
399 Turn on ENABLE_CSS_STICKY_POSITION.
400
401 * Configurations/FeatureDefines.xcconfig:
402
paroga@webkit.orgf4635662012-07-23 20:53:35 +00004032012-07-23 Patrick Gansterer <paroga@webkit.org>
404
405 Move JSC::parseDate() from DateConversion to JSDateMath
406 https://bugs.webkit.org/show_bug.cgi?id=91982
407
408 Reviewed by Geoffrey Garen.
409
410 Moveing this function into the other files removes the dependency
411 on JSC spcific classes in DateConversion.{cpp|h}.
412
413 * runtime/DateConversion.cpp:
414 * runtime/DateConversion.h:
415 (JSC):
416 * runtime/JSDateMath.cpp:
417 (JSC::parseDate):
418 (JSC):
419 * runtime/JSDateMath.h:
420 (JSC):
421
simon.fraser@apple.com5cc8c732012-07-23 17:45:43 +00004222012-07-23 Simon Fraser <simon.fraser@apple.com>
423
424 Part 1 of: Implement sticky positioning
425 https://bugs.webkit.org/show_bug.cgi?id=90046
426
427 Reviewed by Ojan Vafai.
428
429 Add ENABLE_CSS_STICKY_POSITION, defaulting to off initially.
430
431 Sort the ENABLE_CSS lines in the file. Make sure all the flags
432 are in FEATURE_DEFINES.
433
434 * Configurations/FeatureDefines.xcconfig:
435
commit-queue@webkit.org1f562642012-07-23 15:49:29 +00004362012-07-23 Yong Li <yoli@rim.com>
437
438 [BlackBerry] Implement GCActivityCallback with platform timer
439 https://bugs.webkit.org/show_bug.cgi?id=90175
440
441 Reviewed by Rob Buis.
442
443 Use JSLock when performing GC to avoid assertions.
444
445 * runtime/GCActivityCallbackBlackBerry.cpp:
446 (JSC::DefaultGCActivityCallback::doWork):
447
tkent@chromium.orgd89d5452012-07-22 23:23:53 +00004482012-07-23 Kent Tamura <tkent@chromium.org>
449
450 Rename ENABLE_METER_TAG and ENABLE_PROGRESS_TAG to ENABLE_METER_ELEMENT and ENABLE_PROGRESS_ELEMENT respectively
451 https://bugs.webkit.org/show_bug.cgi?id=91941
452
453 Reviewed by Kentaro Hara.
454
455 A flag name for an elmement should be ENABLE_*_ELEMENT.
456
457 * Configurations/FeatureDefines.xcconfig:
458
tkent@chromium.org43921e62012-07-22 10:59:32 +00004592012-07-22 Kent Tamura <tkent@chromium.org>
460
461 Rename ENABLE_DETAILS to ENABLE_DETAILS_ELEMENT
462 https://bugs.webkit.org/show_bug.cgi?id=91928
463
464 Reviewed by Kentaro Hara.
465
466 A flag name for an elmement should be ENABLE_*_ELEMENT.
467
468 * Configurations/FeatureDefines.xcconfig:
469
paroga@webkit.org6a026682012-07-21 21:22:28 +00004702012-07-21 Patrick Gansterer <paroga@webkit.org>
471
472 [WIN] Use GetDateFormat and GetTimeFormat instead of strftime
473 https://bugs.webkit.org/show_bug.cgi?id=83436
474
475 Reviewed by Brent Fulgham.
476
477 The MS CRT implementation of strftime calls the same two functions.
478 Using them directly avoids the overhead of parsing the format string and removes
479 the dependency on strftime() for WinCE where this function does not exist.
480
481 * runtime/DatePrototype.cpp:
482 (JSC::formatLocaleDate):
483
tkent@chromium.org3d897372012-07-21 02:00:46 +00004842012-07-20 Kent Tamura <tkent@chromium.org>
485
486 Rename ENABLE_DATALIST to ENABLE_DATALIST_ELEMENT
487 https://bugs.webkit.org/show_bug.cgi?id=91846
488
489 Reviewed by Kentaro Hara.
490
491 A flag name for an elmement should be ENABLE_*_ELEMENT.
492
493 * Configurations/FeatureDefines.xcconfig:
494
commit-queue@webkit.org68c202c2012-07-20 20:09:02 +00004952012-07-20 Han Shen <shenhan@google.com>
496
497 [Chromium] Compilation fails under gcc 4.7
498 https://bugs.webkit.org/show_bug.cgi?id=90227
499
500 Reviewed by Tony Chang.
501
502 Disable warnings about c++0x compatibility in gcc newer than 4.6.
503
504 * JavaScriptCore.gyp/JavaScriptCore.gyp:
505
fpizlo@apple.com00528432012-07-20 03:50:02 +00005062012-07-18 Filip Pizlo <fpizlo@apple.com>
507
508 DFG cell checks should be hoisted
509 https://bugs.webkit.org/show_bug.cgi?id=91717
510
511 Reviewed by Geoffrey Garen.
512
513 The DFG has always had the policy of hoisting array and integer checks to
514 the point of variable assignment. Eventually, we added doubles and booleans
515 to the mix. But cells should really be part of this as well, particularly
516 for 32-bit where accessing a known-type variable is dramatically cheaper
517 than accessing a variable whose types is only predicted but otherwise
518 unproven.
519
520 This appears to be a definite speed-up for V8 on 32-bit, a possible speed-up
521 for Kraken, and a possible slow-down for V8 on 64-bit (around 0.2% if at
522 all). Any slow-downs can, and should, be addressed by making the hoisting
523 logic cognizant of variables that are never used in a manner that requires
524 type checks, and by sinking argument checks to the point(s) of first use.
525
526 To make this work I had to change some OSR machinery, and special-case the
527 type predictions of the 'this' argument for constructors. OSR exit normally
528 assumes that arguments are boxed, which happens to be true because the
529 type prediction used for check hoisting is LUB'd with the type of the
530 argument that was passed in - so either the arguments are always stored to
531 with the full tag+payload, or if only the payload is stored then the tag
532 matches whatever the caller would have set. But not so with the 'this'
533 argument for constructors, which is not initialized by the caller. We
534 could make this more precise by having argument types for OSR be inferred
535 using similar machinery to other locals, but I figured that for this patch
536 I should use the surgical fix.
537
538 * assembler/MacroAssemblerX86_64.h:
539 (JSC::MacroAssemblerX86_64::branchTestPtr):
540 (MacroAssemblerX86_64):
541 * assembler/X86Assembler.h:
542 (JSC::X86Assembler::testq_rm):
543 (X86Assembler):
544 * dfg/DFGAbstractState.cpp:
545 (JSC::DFG::AbstractState::initialize):
546 (JSC::DFG::AbstractState::execute):
547 * dfg/DFGDriver.cpp:
548 (JSC::DFG::compile):
549 * dfg/DFGGraph.h:
550 (JSC::DFG::Graph::isCreatedThisArgument):
551 (Graph):
552 * dfg/DFGSpeculativeJIT.cpp:
553 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
554 * dfg/DFGSpeculativeJIT32_64.cpp:
555 (JSC::DFG::SpeculativeJIT::compile):
556 * dfg/DFGSpeculativeJIT64.cpp:
557 (JSC::DFG::SpeculativeJIT::compile):
558 * dfg/DFGValueSource.h:
559 (JSC::DFG::ValueSource::forSpeculation):
560
fpizlo@apple.com26e27a62012-07-20 00:04:51 +00005612012-07-19 Filip Pizlo <fpizlo@apple.com>
562
563 Fast path of storage resize should be removed from property storage reallocation, since it is only useful for arrays
564 https://bugs.webkit.org/show_bug.cgi?id=91796
565
566 Reviewed by Geoffrey Garen.
567
568 * dfg/DFGRepatch.cpp:
569 (JSC::DFG::emitPutTransitionStub):
570 * dfg/DFGSpeculativeJIT.cpp:
571 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
572 * runtime/JSObject.cpp:
573 (JSC::JSObject::growOutOfLineStorage):
574
commit-queue@webkit.orge602eca2012-07-19 20:53:22 +00005752012-07-19 Mark Lam <mark.lam@apple.com>
576
577 Bug fixes and enhancements for OfflineASM annotation system.
578 https://bugs.webkit.org/show_bug.cgi?id=91690
579
580 Reviewed by Filip Pizlo.
581
582 * offlineasm/armv7.rb: added default handling of Instruction lower().
583 * offlineasm/asm.rb: added more support for annotations and more pretty printing.
584 * offlineasm/ast.rb: added more support for annotations.
585 * offlineasm/config.rb: added $preferredCommentStartColumn, simplified $enableInstrAnnotations.
586 * offlineasm/parser.rb: added more support for annotations.
587 * offlineasm/transform.rb: added more support for annotations.
588 * offlineasm/x86.rb: added default handling of Instruction lower().
589
paroga@webkit.orgcb7c1a12012-07-19 18:20:53 +00005902012-07-19 Patrick Gansterer <paroga@webkit.org>
591
592 [WIN] Fix compilation of JSGlobalData.h with ENABLE(DFG_JIT)
593 https://bugs.webkit.org/show_bug.cgi?id=91243
594
595 Reviewed by Geoffrey Garen.
596
597 Disable MSVC warning 4200 "zero-sized array in struct/union" for JSC::ScratchBuffer.
598
599 * runtime/JSGlobalData.h:
600 (JSC):
601
commit-queue@webkit.orgf06140e2012-07-19 15:45:26 +00006022012-07-19 Mark Lam <mark.lam@apple.com>
603
604 Fixed broken ENABLE_JIT=0 build.
605 https://bugs.webkit.org/show_bug.cgi?id=91725
606
607 Reviewed by Oliver Hunt.
608
609 * bytecode/Watchpoint.cpp:
610 * heap/JITStubRoutineSet.h:
611 (JSC):
612 (JITStubRoutineSet):
613 (JSC::JITStubRoutineSet::JITStubRoutineSet):
614 (JSC::JITStubRoutineSet::~JITStubRoutineSet):
615 (JSC::JITStubRoutineSet::add):
616 (JSC::JITStubRoutineSet::clearMarks):
617 (JSC::JITStubRoutineSet::mark):
618 (JSC::JITStubRoutineSet::deleteUnmarkedJettisonedStubRoutines):
619 (JSC::JITStubRoutineSet::traceMarkedStubRoutines):
620
kkristof@inf.u-szeged.hub203f612012-07-19 13:21:38 +00006212012-07-19 Kristóf Kosztyó <kkristof@inf.u-szeged.hu>
622
623 [Qt] Unreviewed buildfix after r123042.
624
625 * interpreter/Interpreter.cpp:
626 (JSC::Interpreter::dumpRegisters):
627
fpizlo@apple.com1ffdcff2012-07-19 00:30:34 +00006282012-07-18 Filip Pizlo <fpizlo@apple.com>
629
630 DFG should emit inline code for property storage (re)allocation
631 https://bugs.webkit.org/show_bug.cgi?id=91597
632
633 Reviewed by Oliver Hunt.
634
635 This adds two new ops to the DFG IR: AllocatePropertyStorage and
636 ReallocatePropertyStorage. It enables these to interact properly with
637 CSE so that a GetPropertyStorage on something for which we have
638 obviously done a (Re)AllocatePropertyStorage will result in the
639 GetPropertyStorage being eliminated. Other than that, the code
640 emitted for these ops is identical to the code we were emitting in
641 the corresponding PutById stub.
642
643 * dfg/DFGAbstractState.cpp:
644 (JSC::DFG::AbstractState::execute):
645 * dfg/DFGByteCodeParser.cpp:
646 (JSC::DFG::ByteCodeParser::parseBlock):
647 * dfg/DFGCSEPhase.cpp:
648 (JSC::DFG::CSEPhase::putStructureStoreElimination):
649 (JSC::DFG::CSEPhase::getPropertyStorageLoadElimination):
650 * dfg/DFGNode.h:
651 (JSC::DFG::Node::hasStructureTransitionData):
652 * dfg/DFGNodeType.h:
653 (DFG):
654 * dfg/DFGOperations.cpp:
655 * dfg/DFGOperations.h:
656 * dfg/DFGPredictionPropagationPhase.cpp:
657 (JSC::DFG::PredictionPropagationPhase::propagate):
658 * dfg/DFGSpeculativeJIT.cpp:
659 (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage):
660 (DFG):
661 (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage):
662 * dfg/DFGSpeculativeJIT.h:
663 (JSC::DFG::SpeculativeJIT::callOperation):
664 (SpeculativeJIT):
665 * dfg/DFGSpeculativeJIT32_64.cpp:
666 (JSC::DFG::SpeculativeJIT::compile):
667 * dfg/DFGSpeculativeJIT64.cpp:
668 (JSC::DFG::SpeculativeJIT::compile):
669 * runtime/Structure.cpp:
670 (JSC::nextOutOfLineStorageCapacity):
671 * runtime/Structure.h:
672 (JSC):
673
oliver@apple.coma08210b2012-07-18 23:26:06 +00006742012-07-16 Oliver Hunt <oliver@apple.com>
675
676 dumpCallFrame is broken in ToT
677 https://bugs.webkit.org/show_bug.cgi?id=91444
678
679 Reviewed by Gavin Barraclough.
680
681 Various changes have been made to the SF calling convention, but
682 dumpCallFrame has not been updated to reflect these changes.
683 That resulted in both bogus information, as well as numerous
684 assertions of sadness.
685
686 This patch makes dumpCallFrame actually work again and adds the
687 wonderful feature of telling you the name of the variable that a
688 register reflects, or what value it contains.
689
690 * bytecode/CodeBlock.cpp:
691 (JSC::CodeBlock::nameForRegister):
692 A really innefficient mechanism for finding the name of a local register.
693 This should only ever be used by debug code so this should be okay.
694 * bytecode/CodeBlock.h:
695 (CodeBlock):
696 * bytecompiler/BytecodeGenerator.cpp:
697 (JSC::BytecodeGenerator::generate):
698 Debug builds no longer throw away a functions symbol table, this allows
699 us to actually perform a register# to name mapping
700 * dfg/DFGJITCompiler.cpp:
701 (JSC::DFG::JITCompiler::link):
702 We weren't propogating the bytecode offset here leading to assertions
703 in debug builds when dumping bytecode of DFG compiled code.
704 * interpreter/Interpreter.cpp:
705 (JSC):
706 (JSC::Interpreter::dumpRegisters):
707 Rework to actually be correct.
708 (JSC::getCallerInfo):
709 Return the byteocde offset as well now, given we have to determine it
710 anyway.
711 (JSC::Interpreter::getStackTrace):
712 (JSC::Interpreter::retrieveCallerFromVMCode):
713 * interpreter/Interpreter.h:
714 (Interpreter):
715 * jsc.cpp:
716 (GlobalObject::finishCreation):
717 (functionDumpCallFrame):
718 Give debug builds of JSC a method for calling dumpCallFrame so we can
719 inspect a callframe without requiring us to break in a debugger.
720
fpizlo@apple.comc6429b82012-07-18 22:17:18 +00007212012-07-18 Filip Pizlo <fpizlo@apple.com>
722
723 DFG 32-bit PutById transition stub storage reallocation case copies the first pointer of each JSValue instead of the whole JSValue
724 https://bugs.webkit.org/show_bug.cgi?id=91599
725
726 Reviewed by Geoffrey Garen.
727
728 * dfg/DFGRepatch.cpp:
729 (JSC::DFG::emitPutTransitionStub):
730
fpizlo@apple.com07669e22012-07-17 23:11:23 +00007312012-07-17 Filip Pizlo <fpizlo@apple.com>
732
fpizlo@apple.com41c6f1e2012-07-18 04:42:55 +0000733 DFG 32-bit PutById transition stub passes the payload/tag arguments to a DFG operation in the wrong order
734 https://bugs.webkit.org/show_bug.cgi?id=91576
735
736 Reviewed by Gavin Barraclough.
737
738 * dfg/DFGRepatch.cpp:
739 (JSC::DFG::emitPutTransitionStub):
740
7412012-07-17 Filip Pizlo <fpizlo@apple.com>
742
fpizlo@apple.com07669e22012-07-17 23:11:23 +0000743 [Qt] REGRESSION(r122768, r122771): They broke jquery/data.html and inspector/elements/edit-dom-actions.html
744 https://bugs.webkit.org/show_bug.cgi?id=91476
745
746 Reviewed by Mark Hahnenberg.
747
748 The 32-bit repatching code was not correctly adapted to the new world where there may not always
749 be an available scratch register. Fixed it by ensuring that the scratch register we select does
750 not overlap with the value tag.
751
752 * dfg/DFGRepatch.cpp:
753 (JSC::DFG::generateProtoChainAccessStub):
754 (JSC::DFG::tryCacheGetByID):
755 (JSC::DFG::tryBuildGetByIDList):
756 (JSC::DFG::emitPutReplaceStub):
757
rgabor@webkit.org600a0c12012-07-17 07:59:57 +00007582012-07-17 Gabor Rapcsanyi <rgabor@webkit.org>
759
760 Unreviewed buildfix from Zoltan Herczeg after 122768.
761
762 * dfg/DFGCCallHelpers.h:
763 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
764 (CCallHelpers):
765
commit-queue@webkit.org7bf73302012-07-17 07:11:52 +00007662012-07-17 David Barr <davidbarr@chromium.org>
767
768 Introduce ENABLE_CSS_IMAGE_ORIENTATION compile flag
769 https://bugs.webkit.org/show_bug.cgi?id=89055
770
771 Reviewed by Kent Tamura.
772
773 The css3-images module is at candidate recommendation.
774 http://www.w3.org/TR/2012/CR-css3-images-20120417/#the-image-orientation
775
776 Add a configuration option for CSS image-orientation support, disabling it by default.
777
778 * Configurations/FeatureDefines.xcconfig:
779
fpizlo@apple.com68bef1d2012-07-17 01:43:56 +00007802012-07-16 Filip Pizlo <fpizlo@apple.com>
781
782 Unreviewed, roll out 122790 because it broke the Windows build. I'm not
783 sure what to do with exported symbols that are predicated on NDEBUG.
784
785 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
786 * bytecode/CodeBlock.cpp:
787 (JSC):
788 * bytecode/CodeBlock.h:
789 (CodeBlock):
790 * bytecompiler/BytecodeGenerator.cpp:
791 (JSC::BytecodeGenerator::generate):
792 * dfg/DFGJITCompiler.cpp:
793 (JSC::DFG::JITCompiler::link):
794 * interpreter/Interpreter.cpp:
795 (JSC):
796 (JSC::Interpreter::dumpRegisters):
797 (JSC::getCallerInfo):
798 (JSC::Interpreter::getStackTrace):
799 (JSC::Interpreter::retrieveCallerFromVMCode):
800 * interpreter/Interpreter.h:
801 (Interpreter):
802 * jsc.cpp:
803 (GlobalObject::finishCreation):
804
oliver@apple.com0acb42b2012-07-17 01:14:18 +00008052012-07-16 Oliver Hunt <oliver@apple.com>
806
807 dumpCallFrame is broken in ToT
808 https://bugs.webkit.org/show_bug.cgi?id=91444
809
810 Reviewed by Gavin Barraclough.
811
812 Various changes have been made to the SF calling convention, but
813 dumpCallFrame has not been updated to reflect these changes.
814 That resulted in both bogus information, as well as numerous
815 assertions of sadness.
816
817 This patch makes dumpCallFrame actually work again and adds the
818 wonderful feature of telling you the name of the variable that a
819 register reflects, or what value it contains.
820
821 * bytecode/CodeBlock.cpp:
822 (JSC::CodeBlock::nameForRegister):
823 A really innefficient mechanism for finding the name of a local register.
824 This should only ever be used by debug code so this should be okay.
825 * bytecode/CodeBlock.h:
826 (CodeBlock):
827 * bytecompiler/BytecodeGenerator.cpp:
828 (JSC::BytecodeGenerator::generate):
829 Debug builds no longer throw away a functions symbol table, this allows
830 us to actually perform a register# to name mapping
831 * dfg/DFGJITCompiler.cpp:
832 (JSC::DFG::JITCompiler::link):
833 We weren't propogating the bytecode offset here leading to assertions
834 in debug builds when dumping bytecode of DFG compiled code.
835 * interpreter/Interpreter.cpp:
836 (JSC):
837 (JSC::Interpreter::dumpRegisters):
838 Rework to actually be correct.
839 (JSC::getCallerInfo):
840 Return the byteocde offset as well now, given we have to determine it
841 anyway.
842 (JSC::Interpreter::getStackTrace):
843 (JSC::Interpreter::retrieveCallerFromVMCode):
844 * interpreter/Interpreter.h:
845 (Interpreter):
846 * jsc.cpp:
847 (GlobalObject::finishCreation):
848 (functionDumpCallFrame):
849 Give debug builds of JSC a method for calling dumpCallFrame so we can
850 inspect a callframe without requiring us to break in a debugger.
851
fpizlo@apple.comcd8b6662012-07-16 22:17:29 +00008522012-07-16 Filip Pizlo <fpizlo@apple.com>
853
854 Unreviewed, adding forgotten files.
855
856 * dfg/DFGRegisterSet.h: Added.
857 (DFG):
858 (RegisterSet):
859 (JSC::DFG::RegisterSet::RegisterSet):
860 (JSC::DFG::RegisterSet::asPOD):
861 (JSC::DFG::RegisterSet::copyInfo):
862 (JSC::DFG::RegisterSet::set):
863 (JSC::DFG::RegisterSet::setGPRByIndex):
864 (JSC::DFG::RegisterSet::clear):
865 (JSC::DFG::RegisterSet::get):
866 (JSC::DFG::RegisterSet::getGPRByIndex):
867 (JSC::DFG::RegisterSet::getFreeGPR):
868 (JSC::DFG::RegisterSet::setFPRByIndex):
869 (JSC::DFG::RegisterSet::getFPRByIndex):
870 (JSC::DFG::RegisterSet::setByIndex):
871 (JSC::DFG::RegisterSet::getByIndex):
872 (JSC::DFG::RegisterSet::numberOfSetGPRs):
873 (JSC::DFG::RegisterSet::numberOfSetFPRs):
874 (JSC::DFG::RegisterSet::numberOfSetRegisters):
875 (JSC::DFG::RegisterSet::setBit):
876 (JSC::DFG::RegisterSet::clearBit):
877 (JSC::DFG::RegisterSet::getBit):
878 * dfg/DFGScratchRegisterAllocator.h: Added.
879 (DFG):
880 (ScratchRegisterAllocator):
881 (JSC::DFG::ScratchRegisterAllocator::ScratchRegisterAllocator):
882 (JSC::DFG::ScratchRegisterAllocator::lock):
883 (JSC::DFG::ScratchRegisterAllocator::allocateScratch):
884 (JSC::DFG::ScratchRegisterAllocator::allocateScratchGPR):
885 (JSC::DFG::ScratchRegisterAllocator::allocateScratchFPR):
886 (JSC::DFG::ScratchRegisterAllocator::didReuseRegisters):
887 (JSC::DFG::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
888 (JSC::DFG::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
889 (JSC::DFG::ScratchRegisterAllocator::desiredScratchBufferSize):
890 (JSC::DFG::ScratchRegisterAllocator::preserveUsedRegistersToScratchBuffer):
891 (JSC::DFG::ScratchRegisterAllocator::restoreUsedRegistersFromScratchBuffer):
892
fpizlo@apple.com2f2052a2012-07-16 22:08:21 +00008932012-07-15 Filip Pizlo <fpizlo@apple.com>
894
895 DFG PutById transition should handle storage allocation, and inline it
896 https://bugs.webkit.org/show_bug.cgi?id=91337
897
898 Reviewed by Oliver Hunt.
899
900 This enables the patching of DFG PutById to handle the out-of-line storage
901 allocation case. Furthermore, it inlines out-of-line storage allocation (and
902 reallocation) into the generated stubs.
903
904 To do this, this patch adds the ability to store the relevant register
905 allocation state (i.e. the set of in-use registers) in the structure stub
906 info so that the stub generation code can more flexibly select scratch
907 registers: sometimes it needs none, sometimes one - or sometimes up to
908 three. Moreover, to make the stub generation register allocation simple and
909 maintainable, this patch introduces a reusable scratch register allocator
910 class. This register allocator understands that some registers are in use by
911 the main path code and so must be spilled as necessary, other registers are
912 locked for use in the stub itself and so cannot even be spilled, while still
913 others may be allocated for scratch purposes. A scratch register that is
914 used must be spilled. If a register is locked, it cannot be used as a
915 scratch register. If a register is used, it can be used as a scratch
916 register so long as it is spilled.
917
918 This is a sub-1% speed-up on V8 and neutral elsewhere.
919
920 * GNUmakefile.list.am:
921 * JavaScriptCore.xcodeproj/project.pbxproj:
922 * assembler/MacroAssemblerCodeRef.h:
923 (FunctionPtr):
924 (JSC::FunctionPtr::FunctionPtr):
925 * bytecode/StructureStubInfo.h:
926 * dfg/DFGCCallHelpers.h:
927 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
928 (CCallHelpers):
929 * dfg/DFGGPRInfo.h:
930 * dfg/DFGJITCompiler.cpp:
931 (JSC::DFG::JITCompiler::link):
932 * dfg/DFGJITCompiler.h:
933 (JSC::DFG::PropertyAccessRecord::PropertyAccessRecord):
934 (PropertyAccessRecord):
935 * dfg/DFGOperations.cpp:
936 * dfg/DFGOperations.h:
937 * dfg/DFGRegisterBank.h:
938 (JSC::DFG::RegisterBank::isInUse):
939 (RegisterBank):
940 * dfg/DFGRegisterSet.h: Added.
941 (DFG):
942 (RegisterSet):
943 (JSC::DFG::RegisterSet::RegisterSet):
944 (JSC::DFG::RegisterSet::asPOD):
945 (JSC::DFG::RegisterSet::copyInfo):
946 (JSC::DFG::RegisterSet::set):
947 (JSC::DFG::RegisterSet::setGPRByIndex):
948 (JSC::DFG::RegisterSet::clear):
949 (JSC::DFG::RegisterSet::get):
950 (JSC::DFG::RegisterSet::getGPRByIndex):
951 (JSC::DFG::RegisterSet::getFreeGPR):
952 (JSC::DFG::RegisterSet::setFPRByIndex):
953 (JSC::DFG::RegisterSet::getFPRByIndex):
954 (JSC::DFG::RegisterSet::setByIndex):
955 (JSC::DFG::RegisterSet::getByIndex):
956 (JSC::DFG::RegisterSet::numberOfSetGPRs):
957 (JSC::DFG::RegisterSet::numberOfSetFPRs):
958 (JSC::DFG::RegisterSet::numberOfSetRegisters):
959 (JSC::DFG::RegisterSet::setBit):
960 (JSC::DFG::RegisterSet::clearBit):
961 (JSC::DFG::RegisterSet::getBit):
962 * dfg/DFGRepatch.cpp:
963 (JSC::DFG::generateProtoChainAccessStub):
964 (JSC::DFG::tryCacheGetByID):
965 (JSC::DFG::tryBuildGetByIDList):
966 (JSC::DFG::emitPutReplaceStub):
967 (JSC::DFG::emitPutTransitionStub):
968 (JSC::DFG::tryCachePutByID):
969 (JSC::DFG::tryBuildPutByIdList):
970 * dfg/DFGScratchRegisterAllocator.h: Added.
971 (DFG):
972 (ScratchRegisterAllocator):
973 (JSC::DFG::ScratchRegisterAllocator::ScratchRegisterAllocator):
974 (JSC::DFG::ScratchRegisterAllocator::lock):
975 (JSC::DFG::ScratchRegisterAllocator::allocateScratch):
976 (JSC::DFG::ScratchRegisterAllocator::allocateScratchGPR):
977 (JSC::DFG::ScratchRegisterAllocator::allocateScratchFPR):
978 (JSC::DFG::ScratchRegisterAllocator::didReuseRegisters):
979 (JSC::DFG::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
980 (JSC::DFG::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
981 (JSC::DFG::ScratchRegisterAllocator::desiredScratchBufferSize):
982 (JSC::DFG::ScratchRegisterAllocator::preserveUsedRegistersToScratchBuffer):
983 (JSC::DFG::ScratchRegisterAllocator::restoreUsedRegistersFromScratchBuffer):
984 * dfg/DFGSpeculativeJIT.h:
985 (SpeculativeJIT):
986 (JSC::DFG::SpeculativeJIT::usedRegisters):
987 * dfg/DFGSpeculativeJIT32_64.cpp:
988 (JSC::DFG::SpeculativeJIT::cachedGetById):
989 (JSC::DFG::SpeculativeJIT::cachedPutById):
990 (JSC::DFG::SpeculativeJIT::compile):
991 * dfg/DFGSpeculativeJIT64.cpp:
992 (JSC::DFG::SpeculativeJIT::cachedGetById):
993 (JSC::DFG::SpeculativeJIT::cachedPutById):
994 (JSC::DFG::SpeculativeJIT::compile):
995 * heap/CopiedAllocator.h:
996 (CopiedAllocator):
997 (JSC::CopiedAllocator::fastPathShouldSucceed):
998 (JSC):
999
paroga@webkit.org24c86b82012-07-16 20:06:15 +000010002012-07-16 Patrick Gansterer <paroga@webkit.org>
1001
1002 Add dfg switch to create_jit_stubs script
1003 https://bugs.webkit.org/show_bug.cgi?id=91256
1004
1005 Reviewed by Geoffrey Garen.
1006
1007 * create_jit_stubs: Add a switch to enable or disable the generation of
1008 stub functions in #if ENABLE(DFG_JIT) conditions.
1009
rgabor@webkit.org58c69f82012-07-16 15:05:57 +000010102012-07-16 Gabor Rapcsanyi <rgabor@webkit.org>
1011
rgabor@webkit.org43ad3e52012-07-16 16:16:03 +00001012 Unreviewed buildfix after r122729. Typo fix.
1013
1014 * assembler/MacroAssemblerARM.h:
1015 (JSC::MacroAssemblerARM::add32):
1016
10172012-07-16 Gabor Rapcsanyi <rgabor@webkit.org>
1018
rgabor@webkit.org58c69f82012-07-16 15:05:57 +00001019 Unreviewed buildfix from Zoltan Herczeg after r122677.
1020 Implement missing add32 function to MacroAssemblerARM.
1021
1022 * assembler/MacroAssemblerARM.h:
1023 (JSC::MacroAssemblerARM::add32):
1024 (MacroAssemblerARM):
1025
fpizlo@apple.com327f2372012-07-15 04:02:16 +000010262012-07-14 Filip Pizlo <fpizlo@apple.com>
1027
fpizlo@apple.coma4eaa8a2012-07-15 05:23:58 +00001028 DFG PutByVal opcodes should accept more than 3 operands
1029 https://bugs.webkit.org/show_bug.cgi?id=91332
1030
1031 Reviewed by Oliver Hunt.
1032
1033 Turned PutByVal/PutByValAlias into var-arg nodes, so that we can give them
1034 4 or more operands in the future.
1035
1036 * dfg/DFGAbstractState.cpp:
1037 (JSC::DFG::AbstractState::execute):
1038 * dfg/DFGByteCodeParser.cpp:
1039 (JSC::DFG::ByteCodeParser::parseBlock):
1040 * dfg/DFGCSEPhase.cpp:
1041 (JSC::DFG::CSEPhase::getByValLoadElimination):
1042 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
1043 (JSC::DFG::CSEPhase::performNodeCSE):
1044 * dfg/DFGFixupPhase.cpp:
1045 (JSC::DFG::FixupPhase::fixupNode):
1046 (JSC::DFG::FixupPhase::fixDoubleEdge):
1047 * dfg/DFGGraph.h:
1048 (JSC::DFG::Graph::byValIsPure):
1049 (JSC::DFG::Graph::varArgNumChildren):
1050 (Graph):
1051 (JSC::DFG::Graph::numChildren):
1052 (JSC::DFG::Graph::varArgChild):
1053 (JSC::DFG::Graph::child):
1054 * dfg/DFGNodeType.h:
1055 (DFG):
1056 * dfg/DFGPredictionPropagationPhase.cpp:
1057 (JSC::DFG::PredictionPropagationPhase::propagate):
1058 * dfg/DFGSpeculativeJIT.cpp:
1059 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
1060 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
1061 * dfg/DFGSpeculativeJIT32_64.cpp:
1062 (JSC::DFG::SpeculativeJIT::compile):
1063 * dfg/DFGSpeculativeJIT64.cpp:
1064 (JSC::DFG::SpeculativeJIT::compile):
1065
10662012-07-14 Filip Pizlo <fpizlo@apple.com>
1067
fpizlo@apple.com327f2372012-07-15 04:02:16 +00001068 Rationalize and optimize storage allocation
1069 https://bugs.webkit.org/show_bug.cgi?id=91303
1070
1071 Reviewed by Oliver Hunt.
1072
1073 This implements a backwards bump allocator for copied space storage
1074 allocation, shown in pseudo-code below:
1075
1076 pointer bump(size) {
1077 pointer tmp = allocator->remaining;
1078 tmp -= size;
1079 if (tmp < 0)
1080 fail;
1081 allocator->remaining = tmp;
1082 return allocator->payloadEnd - tmp - size;
1083 }
1084
1085 The advantage of this allocator is that it:
1086
1087 - Only requires one comparison in the common case where size is known to
1088 not be huge, and this comparison can be done by checking the sign bit
1089 of the subtraction.
1090
1091 - Can be implemented even when only one register is available. This
1092 register is reused for both temporary storage during allocation and
1093 for the result.
1094
1095 - Preserves the behavior that memory in a block is filled in from lowest
1096 address to highest address, which allows for a cheap reallocation fast
1097 path.
1098
1099 - Is resilient against the block used for allocation being the last one
1100 in virtual memory, thereby otherwise leading to the risk of overflow
1101 in the bump pointer, despite only doing one branch.
1102
1103 In order to implement this allocator using the smallest possible chunk
1104 of code, I refactored the copied space code so that all of the allocation
1105 logic is in CopiedAllocator, and all of the state is in either
1106 CopiedBlock or CopiedAllocator. This should make changing the allocation
1107 fast path easier in the future.
1108
1109 In order to do this, I needed to add some new assembler support,
1110 particularly for various forms of add(address, register) and negPtr().
1111
1112 This is performance neutral. The purpose of this change is to facilitate
1113 further inlining of storage allocation without having to reserve
1114 additional registers or emit too much code.
1115
1116 * assembler/MacroAssembler.h:
1117 (JSC::MacroAssembler::addPtr):
1118 (MacroAssembler):
1119 (JSC::MacroAssembler::negPtr):
1120 * assembler/MacroAssemblerARMv7.h:
1121 (MacroAssemblerARMv7):
1122 (JSC::MacroAssemblerARMv7::add32):
1123 * assembler/MacroAssemblerX86.h:
1124 (JSC::MacroAssemblerX86::add32):
1125 (MacroAssemblerX86):
1126 * assembler/MacroAssemblerX86_64.h:
1127 (MacroAssemblerX86_64):
1128 (JSC::MacroAssemblerX86_64::addPtr):
1129 (JSC::MacroAssemblerX86_64::negPtr):
1130 * assembler/X86Assembler.h:
1131 (X86Assembler):
1132 (JSC::X86Assembler::addl_mr):
1133 (JSC::X86Assembler::addq_mr):
1134 (JSC::X86Assembler::negq_r):
1135 * heap/CopiedAllocator.h:
1136 (CopiedAllocator):
1137 (JSC::CopiedAllocator::isValid):
1138 (JSC::CopiedAllocator::CopiedAllocator):
1139 (JSC::CopiedAllocator::tryAllocate):
1140 (JSC):
1141 (JSC::CopiedAllocator::tryReallocate):
1142 (JSC::CopiedAllocator::forceAllocate):
1143 (JSC::CopiedAllocator::resetCurrentBlock):
1144 (JSC::CopiedAllocator::setCurrentBlock):
1145 (JSC::CopiedAllocator::currentCapacity):
1146 * heap/CopiedBlock.h:
1147 (CopiedBlock):
1148 (JSC::CopiedBlock::create):
1149 (JSC::CopiedBlock::zeroFillWilderness):
1150 (JSC::CopiedBlock::CopiedBlock):
1151 (JSC::CopiedBlock::payloadEnd):
1152 (JSC):
1153 (JSC::CopiedBlock::payloadCapacity):
1154 (JSC::CopiedBlock::data):
1155 (JSC::CopiedBlock::dataEnd):
1156 (JSC::CopiedBlock::dataSize):
1157 (JSC::CopiedBlock::wilderness):
1158 (JSC::CopiedBlock::wildernessEnd):
1159 (JSC::CopiedBlock::wildernessSize):
1160 (JSC::CopiedBlock::size):
1161 * heap/CopiedSpace.cpp:
1162 (JSC::CopiedSpace::tryAllocateSlowCase):
1163 (JSC::CopiedSpace::tryAllocateOversize):
1164 (JSC::CopiedSpace::tryReallocate):
1165 (JSC::CopiedSpace::doneFillingBlock):
1166 (JSC::CopiedSpace::doneCopying):
1167 * heap/CopiedSpace.h:
1168 (CopiedSpace):
1169 * heap/CopiedSpaceInlineMethods.h:
1170 (JSC::CopiedSpace::startedCopying):
1171 (JSC::CopiedSpace::allocateBlockForCopyingPhase):
1172 (JSC::CopiedSpace::allocateBlock):
1173 (JSC::CopiedSpace::tryAllocate):
1174 (JSC):
1175 * heap/MarkStack.cpp:
1176 (JSC::SlotVisitor::startCopying):
1177 (JSC::SlotVisitor::allocateNewSpace):
1178 (JSC::SlotVisitor::doneCopying):
1179 * heap/SlotVisitor.h:
1180 (JSC::SlotVisitor::SlotVisitor):
1181 * jit/JIT.h:
1182 * jit/JITInlineMethods.h:
1183 (JSC::JIT::emitAllocateBasicStorage):
1184 (JSC::JIT::emitAllocateJSArray):
1185
commit-queue@webkit.org782c20b2012-07-14 00:44:47 +000011862012-07-13 Mark Lam <mark.lam@apple.com>
1187
1188 OfflineASM Pretty printing and commenting enhancements.
1189 https://bugs.webkit.org/show_bug.cgi?id=91281
1190
1191 Reviewed by Filip Pizlo.
1192
1193 Added some minor pretty printing in the OfflineASM.
1194 Also added infrastruture for adding multiple types of comments and
1195 annotations with the ability to enable/disable them in the generated
1196 output as desired.
1197
1198 * GNUmakefile.list.am: add new file config.rb.
1199 * llint/LLIntOfflineAsmConfig.h:
1200 Added OFFLINE_ASM_BEGIN, OFFLINE_ASM_END, and OFFLINE_ASM_LOCAL_LABEL macros.
1201 This will allow us to redefine these for other backends later.
1202 * llint/LowLevelInterpreter32_64.asm:
1203 Add a small example of instruction annotations for now.
1204 * llint/LowLevelInterpreter64.asm:
1205 Add a small example of instruction annotations for now.
1206 * offlineasm/armv7.rb: Added handling of annotations.
1207 * offlineasm/asm.rb:
1208 Added machinery to dump the new comments and annotations.
1209 Also added some indentations to make the output a little prettier.
1210 * offlineasm/ast.rb: Added annotation field in class Instruction.
1211 * offlineasm/backends.rb:
1212 * offlineasm/config.rb: Added.
1213 Currently only contains commenting options. This file is meant to be
1214 a centralized place for build config values much like config.h for
1215 JavaScriptCore.
1216 * offlineasm/generate_offset_extractor.rb:
1217 * offlineasm/instructions.rb:
1218 * offlineasm/offsets.rb:
1219 * offlineasm/opt.rb:
1220 * offlineasm/parser.rb: Parse and record annotations.
1221 * offlineasm/registers.rb:
1222 * offlineasm/self_hash.rb:
1223 * offlineasm/settings.rb:
1224 * offlineasm/transform.rb:
1225 * offlineasm/x86.rb: Added handling of annotations.
1226
fpizlo@apple.com8ff7c5e72012-07-13 23:55:18 +000012272012-07-13 Filip Pizlo <fpizlo@apple.com>
1228
1229 ASSERTION FAILED: use.useKind() != DoubleUse
1230 https://bugs.webkit.org/show_bug.cgi?id=91082
1231
1232 Reviewed by Geoffrey Garen.
1233
1234 The implementation of Branch() was unwisely relying on register allocation state
1235 to decide what speculations to perform. That's never correct.
1236
1237 * dfg/DFGSpeculativeJIT32_64.cpp:
1238 (JSC::DFG::SpeculativeJIT::compile):
1239 * dfg/DFGSpeculativeJIT64.cpp:
1240 (JSC::DFG::SpeculativeJIT::compile):
1241
commit-queue@webkit.org2e002d12012-07-13 23:36:34 +000012422012-07-13 Sheriff Bot <webkit.review.bot@gmail.com>
1243
1244 Unreviewed, rolling out r122640.
1245 http://trac.webkit.org/changeset/122640
1246 https://bugs.webkit.org/show_bug.cgi?id=91298
1247
1248 LLInt apparently does not expect to mark these (Requested by
1249 olliej on #webkit).
1250
1251 * bytecode/CodeBlock.cpp:
1252 (JSC::CodeBlock::visitStructures):
1253 (JSC::CodeBlock::stronglyVisitStrongReferences):
1254
oliver@apple.comca095d52012-07-13 23:12:14 +000012552012-07-13 Oliver Hunt <oliver@apple.com>
1256
1257 LLInt fails to mark structures stored in the bytecode
1258 https://bugs.webkit.org/show_bug.cgi?id=91296
1259
1260 Reviewed by Geoffrey Garen.
1261
1262 LLInt stores structures in the bytecode, so we need to visit the appropriate
1263 instructions as we would if we were running in the classic interpreter.
1264 This requires adding additional checks for the LLInt specific opcodes, and
1265 the lint specific variants of operand ordering.
1266
1267 * bytecode/CodeBlock.cpp:
1268 (JSC::CodeBlock::visitStructures):
1269 (JSC::CodeBlock::stronglyVisitStrongReferences):
1270
commit-queue@webkit.orgf9b0ef22012-07-13 20:12:36 +000012712012-07-13 Yong Li <yoli@rim.com>
1272
1273 [BlackBerry] Implement GCActivityCallback with platform timer
1274 https://bugs.webkit.org/show_bug.cgi?id=90175
1275
1276 Reviewed by Rob Buis.
1277
1278 Implement GCActivityCallback and HeapTimer for BlackBerry port.
1279
1280 * heap/HeapTimer.cpp:
1281 (JSC):
1282 (JSC::HeapTimer::HeapTimer):
1283 (JSC::HeapTimer::~HeapTimer):
1284 (JSC::HeapTimer::timerDidFire):
1285 (JSC::HeapTimer::synchronize):
1286 (JSC::HeapTimer::invalidate):
1287 (JSC::HeapTimer::didStartVMShutdown):
1288 * heap/HeapTimer.h:
1289 (HeapTimer):
1290 * runtime/GCActivityCallbackBlackBerry.cpp:
1291 (JSC):
1292 (JSC::DefaultGCActivityCallback::doWork):
1293 (JSC::DefaultGCActivityCallback::didAllocate):
1294 (JSC::DefaultGCActivityCallback::willCollect):
1295 (JSC::DefaultGCActivityCallback::cancel):
1296
paroga@webkit.orgcc7dc5b2012-07-13 16:35:46 +000012972012-07-13 Patrick Gansterer <paroga@webkit.org>
1298
paroga@webkit.org4a3ecbd2012-07-13 16:53:20 +00001299 [WIN] Fix compilation of DFGRepatch.cpp
1300 https://bugs.webkit.org/show_bug.cgi?id=91241
1301
1302 Reviewed by Geoffrey Garen.
1303
1304 Use intptr_t instead of uintptr_t when calling CodeLocationCommon::dataLabelPtrAtOffset(int)
1305 to fix MSVC "unary minus operator applied to unsigned type, result still unsigned" warning.
1306
1307 * dfg/DFGRepatch.cpp:
1308 (JSC::DFG::dfgResetGetByID):
1309 (JSC::DFG::dfgResetPutByID):
1310
13112012-07-13 Patrick Gansterer <paroga@webkit.org>
1312
paroga@webkit.orgcc7dc5b2012-07-13 16:35:46 +00001313 Fix ARM_TRADITIONAL JIT for COMPILER(MSVC) and COMPILER(RVCT) after r121885
1314 https://bugs.webkit.org/show_bug.cgi?id=91238
1315
1316 Reviewed by Zoltan Herczeg.
1317
1318 r121885 changed the assembler instruction only for COMPILER(GCC).
1319 Use the same instructions for the other compilers too.
1320
1321 * jit/JITStubs.cpp:
1322 (JSC::ctiTrampoline):
1323 (JSC::ctiTrampolineEnd):
1324 (JSC::ctiVMThrowTrampoline):
1325
fpizlo@apple.comedcb7a92012-07-13 05:31:05 +000013262012-07-12 Filip Pizlo <fpizlo@apple.com>
1327
fpizlo@apple.comcf716122012-07-13 06:41:18 +00001328 DFG property access stubs should use structure transition watchpoints
1329 https://bugs.webkit.org/show_bug.cgi?id=91135
1330
1331 Reviewed by Geoffrey Garen.
1332
1333 This adds a Watchpoint subclass that will clear a structure stub (i.e.
1334 a property access stub) when fired. The DFG stub generation code now
1335 uses this optimization.
1336
1337 * CMakeLists.txt:
1338 * GNUmakefile.list.am:
1339 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1340 * JavaScriptCore.xcodeproj/project.pbxproj:
1341 * Target.pri:
1342 * bytecode/CodeBlock.cpp:
1343 (JSC):
1344 (JSC::CodeBlock::finalizeUnconditionally):
1345 (JSC::CodeBlock::resetStub):
1346 (JSC::CodeBlock::resetStubInternal):
1347 * bytecode/CodeBlock.h:
1348 (JSC):
1349 (CodeBlock):
1350 * bytecode/StructureStubClearingWatchpoint.cpp: Added.
1351 (JSC):
1352 (JSC::StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint):
1353 (JSC::StructureStubClearingWatchpoint::push):
1354 (JSC::StructureStubClearingWatchpoint::fireInternal):
1355 (JSC::WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo):
1356 (JSC::WatchpointsOnStructureStubInfo::addWatchpoint):
1357 (JSC::WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint):
1358 * bytecode/StructureStubClearingWatchpoint.h: Added.
1359 (JSC):
1360 (StructureStubClearingWatchpoint):
1361 (JSC::StructureStubClearingWatchpoint::StructureStubClearingWatchpoint):
1362 (WatchpointsOnStructureStubInfo):
1363 (JSC::WatchpointsOnStructureStubInfo::WatchpointsOnStructureStubInfo):
1364 (JSC::WatchpointsOnStructureStubInfo::codeBlock):
1365 (JSC::WatchpointsOnStructureStubInfo::stubInfo):
1366 * bytecode/StructureStubInfo.h:
1367 (JSC::StructureStubInfo::reset):
1368 (JSC::StructureStubInfo::addWatchpoint):
1369 (StructureStubInfo):
1370 * dfg/DFGRepatch.cpp:
1371 (JSC::DFG::addStructureTransitionCheck):
1372 (DFG):
1373 (JSC::DFG::generateProtoChainAccessStub):
1374 (JSC::DFG::emitPutTransitionStub):
1375 * jit/JumpReplacementWatchpoint.h:
1376
13772012-07-12 Filip Pizlo <fpizlo@apple.com>
1378
fpizlo@apple.comedcb7a92012-07-13 05:31:05 +00001379 DFG CFA may get overzealous in loops that have code that must exit
1380 https://bugs.webkit.org/show_bug.cgi?id=91188
1381
1382 Reviewed by Gavin Barraclough.
1383
1384 Ensure that if the CFA assumes that an operation must exit, then it will always exit
1385 no matter what happens after. That's necessary to preserve soundness.
1386
1387 Remove a broken fixup done by the DFG simplifier, where it was trying to say that the
1388 variable-at-head was the first access in the second block in the merge, if the first
1389 block did not read the variable. That's totally wrong, if the first block was in fact
1390 doing a phantom read. I removed that fixup and instead hardened the rest of the
1391 compiler.
1392
1393 * dfg/DFGAbstractState.cpp:
1394 (JSC::DFG::AbstractState::endBasicBlock):
1395 * dfg/DFGBasicBlock.h:
1396 (JSC::DFG::BasicBlock::BasicBlock):
1397 (BasicBlock):
1398 * dfg/DFGCFAPhase.cpp:
1399 (JSC::DFG::CFAPhase::performBlockCFA):
1400 * dfg/DFGCFGSimplificationPhase.cpp:
1401 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
1402 * dfg/DFGConstantFoldingPhase.cpp:
1403 (JSC::DFG::ConstantFoldingPhase::ConstantFoldingPhase):
1404 (JSC::DFG::ConstantFoldingPhase::run):
1405 (ConstantFoldingPhase):
1406 (JSC::DFG::ConstantFoldingPhase::foldConstants):
1407 (JSC::DFG::ConstantFoldingPhase::paintUnreachableCode):
1408 * dfg/DFGVariableEventStream.cpp:
1409 (JSC::DFG::VariableEventStream::reconstruct):
1410
allan.jensen@nokia.comb619bbf22012-07-12 15:34:35 +000014112012-07-12 Allan Sandfeld Jensen <allan.jensen@nokia.com>
1412
1413 [Qt] Implement MemoryUsageSupport
1414 https://bugs.webkit.org/show_bug.cgi?id=91094
1415
1416 Reviewed by Adam Barth.
1417
1418 Compile in MemoryStatistics so we can make use of the interface.
1419
1420 * Target.pri:
1421
ossy@webkit.org8db5d862012-07-12 07:53:08 +000014222012-07-12 Csaba Osztrogonác <ossy@webkit.org>
1423
1424 Remove dead code after r122392.
1425 https://bugs.webkit.org/show_bug.cgi?id=91049
1426
1427 Reviewed by Filip Pizlo.
1428
1429 * dfg/DFGSpeculativeJIT64.cpp:
1430 (JSC::DFG::SpeculativeJIT::emitCall):
1431
commit-queue@webkit.org55a950b2012-07-12 02:49:24 +000014322012-07-11 Adenilson Cavalcanti <cavalcantii@gmail.com>
1433
1434 Build fix + remove dead code
1435 https://bugs.webkit.org/show_bug.cgi?id=91039
1436
1437 Reviewed by Filip Pizlo.
1438
1439 An unused variable was breaking compilation (thanks to warnings being treated as errors).
1440
1441 * dfg/DFGSpeculativeJIT32_64.cpp:
1442 (JSC::DFG::SpeculativeJIT::emitCall):
1443
mrowe@apple.comc8887bf2012-07-12 02:01:25 +000014442012-07-11 Mark Rowe <mrowe@apple.com>
1445
1446 <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions.
1447
1448 Reviewed by Dan Bernstein.
1449
1450 The deployment target is already set to the version that we're targeting, and it's that setting
1451 which determines which functionality from the SDK is available to us.
1452
1453 * Configurations/Base.xcconfig:
1454
fpizlo@apple.com3d949152012-07-11 23:12:35 +000014552012-07-11 Filip Pizlo <fpizlo@apple.com>
1456
fpizlo@apple.com5e135772012-07-12 00:12:03 +00001457 DFG should have fast virtual calls
1458 https://bugs.webkit.org/show_bug.cgi?id=90924
1459
1460 Reviewed by Gavin Barraclough.
1461
1462 Implements virtual call support in the style of the old JIT, with the
1463 caveat that we still use the same slow path for both InternalFunction
1464 calls and JSFunction calls. Also rationalized the way that our
1465 CodeOrigin indices tie into exception checks (previously it was a
1466 strange one-to-one mapping with fairly limited assertions; now it's a
1467 one-to-many mapping for CodeOrigins to exception checks, respectively).
1468 I also took the opportunity to clean up
1469 CallLinkInfo::callReturnLocation, which previously was either a Call or
1470 a NearCall. Now it's just a NearCall. As well, exceptions during slow
1471 path call resolution are now handled by returning an exception throwing
1472 thunk rather than returning null. And finally, I made a few things
1473 public that were previously private-with-lots-of-friends, because I
1474 truly despise the thought of listing each thunk generating function as
1475 a friend of JSValue and friends.
1476
1477 * bytecode/CallLinkInfo.cpp:
1478 (JSC::CallLinkInfo::unlink):
1479 * bytecode/CallLinkInfo.h:
1480 (CallLinkInfo):
1481 * bytecode/CodeOrigin.h:
1482 (JSC::CodeOrigin::CodeOrigin):
1483 (JSC::CodeOrigin::isSet):
1484 * dfg/DFGAssemblyHelpers.h:
1485 (JSC::DFG::AssemblyHelpers::AssemblyHelpers):
1486 * dfg/DFGCCallHelpers.h:
1487 (JSC::DFG::CCallHelpers::CCallHelpers):
1488 * dfg/DFGGPRInfo.h:
1489 (GPRInfo):
1490 * dfg/DFGJITCompiler.cpp:
1491 (JSC::DFG::JITCompiler::link):
1492 (JSC::DFG::JITCompiler::compileFunction):
1493 * dfg/DFGJITCompiler.h:
1494 (JSC::DFG::CallBeginToken::CallBeginToken):
1495 (JSC::DFG::CallBeginToken::~CallBeginToken):
1496 (CallBeginToken):
1497 (JSC::DFG::CallBeginToken::set):
1498 (JSC::DFG::CallBeginToken::registerWithExceptionCheck):
1499 (JSC::DFG::CallBeginToken::codeOrigin):
1500 (JSC::DFG::CallExceptionRecord::CallExceptionRecord):
1501 (CallExceptionRecord):
1502 (JSC::DFG::JITCompiler::currentCodeOriginIndex):
1503 (JITCompiler):
1504 (JSC::DFG::JITCompiler::beginCall):
1505 (JSC::DFG::JITCompiler::notifyCall):
1506 (JSC::DFG::JITCompiler::prepareForExceptionCheck):
1507 (JSC::DFG::JITCompiler::addExceptionCheck):
1508 (JSC::DFG::JITCompiler::addFastExceptionCheck):
1509 * dfg/DFGOperations.cpp:
1510 * dfg/DFGRepatch.cpp:
1511 (JSC::DFG::dfgLinkFor):
1512 * dfg/DFGSpeculativeJIT.h:
1513 (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheck):
1514 * dfg/DFGSpeculativeJIT32_64.cpp:
1515 (JSC::DFG::SpeculativeJIT::emitCall):
1516 * dfg/DFGSpeculativeJIT64.cpp:
1517 (JSC::DFG::SpeculativeJIT::emitCall):
1518 * dfg/DFGThunks.cpp:
1519 (JSC::DFG::emitPointerValidation):
1520 (DFG):
1521 (JSC::DFG::throwExceptionFromCallSlowPathGenerator):
1522 (JSC::DFG::slowPathFor):
1523 (JSC::DFG::linkForThunkGenerator):
1524 (JSC::DFG::linkCallThunkGenerator):
1525 (JSC::DFG::linkConstructThunkGenerator):
1526 (JSC::DFG::virtualForThunkGenerator):
1527 (JSC::DFG::virtualCallThunkGenerator):
1528 (JSC::DFG::virtualConstructThunkGenerator):
1529 * dfg/DFGThunks.h:
1530 (DFG):
1531 * jit/JIT.cpp:
1532 (JSC::JIT::privateCompile):
1533 (JSC::JIT::linkFor):
1534 * runtime/Executable.h:
1535 (ExecutableBase):
1536 (JSC::ExecutableBase::offsetOfJITCodeFor):
1537 (JSC::ExecutableBase::offsetOfNumParametersFor):
1538 * runtime/JSValue.h:
1539 (JSValue):
1540
15412012-07-11 Filip Pizlo <fpizlo@apple.com>
1542
fpizlo@apple.com3a264a12012-07-11 23:33:20 +00001543 Accidentally used the wrong license (3-clause instead of 2-clause) in some
1544 files I just committed.
1545
1546 Rubber stamped by Oliver Hunt.
1547
1548 * bytecode/Watchpoint.cpp:
1549 * bytecode/Watchpoint.h:
1550 * jit/JumpReplacementWatchpoint.cpp:
1551 * jit/JumpReplacementWatchpoint.h:
1552
15532012-07-11 Filip Pizlo <fpizlo@apple.com>
1554
fpizlo@apple.com3d949152012-07-11 23:12:35 +00001555 Watchpoints and jump replacement should be decoupled
1556 https://bugs.webkit.org/show_bug.cgi?id=91016
1557
1558 Reviewed by Oliver Hunt.
1559
1560 * CMakeLists.txt:
1561 * GNUmakefile.list.am:
1562 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1563 * JavaScriptCore.xcodeproj/project.pbxproj:
1564 * Target.pri:
1565 * assembler/AbstractMacroAssembler.h:
1566 (JSC):
1567 (Label):
1568 * bytecode/CodeBlock.h:
1569 (JSC::CodeBlock::appendWatchpoint):
1570 (JSC::CodeBlock::watchpoint):
1571 (DFGData):
1572 * bytecode/Watchpoint.cpp:
1573 (JSC):
1574 * bytecode/Watchpoint.h:
1575 (JSC::Watchpoint::Watchpoint):
1576 (Watchpoint):
1577 (JSC::Watchpoint::fire):
1578 * dfg/DFGSpeculativeJIT.h:
1579 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
1580 * jit/JumpReplacementWatchpoint.cpp: Added.
1581 (JSC):
1582 (JSC::JumpReplacementWatchpoint::correctLabels):
1583 (JSC::JumpReplacementWatchpoint::fireInternal):
1584 * jit/JumpReplacementWatchpoint.h: Added.
1585 (JSC):
1586 (JumpReplacementWatchpoint):
1587 (JSC::JumpReplacementWatchpoint::JumpReplacementWatchpoint):
1588 (JSC::JumpReplacementWatchpoint::setDestination):
1589
kevino@webkit.org2b81ef22012-07-11 20:23:39 +000015902012-07-11 Kevin Ollivier <kevino@theolliviers.com>
1591
1592 [wx] Unreviewed build fix. Don't try to build udis86_itab.c since it's included by
1593 another file.
1594
1595 * wscript:
1596
commit-queue@webkit.orgd847b5c2012-07-11 19:48:29 +000015972012-07-11 Chao-ying Fu <fu@mips.com>
1598
1599 Add MIPS convertibleLoadPtr and other functions
1600 https://bugs.webkit.org/show_bug.cgi?id=90714
1601
1602 Reviewed by Oliver Hunt.
1603
1604 * assembler/MIPSAssembler.h:
1605 (JSC::MIPSAssembler::labelIgnoringWatchpoints):
1606 (MIPSAssembler):
1607 (JSC::MIPSAssembler::replaceWithLoad):
1608 (JSC::MIPSAssembler::replaceWithAddressComputation):
1609 * assembler/MacroAssemblerMIPS.h:
1610 (JSC::MacroAssemblerMIPS::convertibleLoadPtr):
1611 (MacroAssemblerMIPS):
1612
andersca@apple.come73df4c2012-07-11 19:41:03 +000016132012-07-11 Anders Carlsson <andersca@apple.com>
1614
1615 Add -Wtautological-compare and -Wsign-compare warning flags
1616 https://bugs.webkit.org/show_bug.cgi?id=90994
1617
1618 Reviewed by Mark Rowe.
1619
1620 * Configurations/Base.xcconfig:
1621
benjamin@webkit.orgea8276a2012-07-11 18:15:17 +000016222012-07-11 Benjamin Poulain <bpoulain@apple.com>
1623
1624 Simplify the copying of JSC ARMv7's LinkRecord
1625 https://bugs.webkit.org/show_bug.cgi?id=90930
1626
1627 Reviewed by Filip Pizlo.
1628
1629 The class LinkRecord is used by value everywhere in ARMv7Assembler. The compiler uses
1630 memmove() to move the objects.
1631
1632 The problem is memmove() is overkill for this object, moving the value can be done with
1633 3 load-store. This patch adds an operator= to the class doing more efficient copying.
1634 This reduces the link time by 19%.
1635
1636 * assembler/ARMv7Assembler.h:
1637 (JSC::ARMv7Assembler::LinkRecord::LinkRecord):
1638 (JSC::ARMv7Assembler::LinkRecord::operator=):
1639 (JSC::ARMv7Assembler::LinkRecord::from):
1640 (JSC::ARMv7Assembler::LinkRecord::setFrom):
1641 (JSC::ARMv7Assembler::LinkRecord::to):
1642 (JSC::ARMv7Assembler::LinkRecord::type):
1643 (JSC::ARMv7Assembler::LinkRecord::linkType):
1644 (JSC::ARMv7Assembler::LinkRecord::setLinkType):
1645 (JSC::ARMv7Assembler::LinkRecord::condition):
1646
wingo@igalia.com8d1d0d42012-07-11 17:50:15 +000016472012-07-11 Andy Wingo <wingo@igalia.com>
1648
1649 jsc: Parse options before creating global data
1650 https://bugs.webkit.org/show_bug.cgi?id=90975
1651
1652 Reviewed by Filip Pizlo.
1653
1654 This patch moves the options parsing in "jsc" before the creation
1655 of the JSGlobalData, so that --useJIT=no has a chance to take
1656 effect.
1657
1658 * jsc.cpp:
1659 (CommandLine::parseArguments): Refactor to be a class, and take
1660 argc and argv as constructor arguments.
1661 (jscmain): Move arg parsing before JSGlobalData creation.
1662
fpizlo@apple.com39c94a42012-07-10 09:18:47 +000016632012-07-10 Filip Pizlo <fpizlo@apple.com>
1664
ossy@webkit.orgb626a9e2012-07-10 09:36:13 +00001665 REGRESSION(r122166): It made 170 tests crash on 32 bit platforms
1666 https://bugs.webkit.org/show_bug.cgi?id=90852
1667
1668 Reviewed by Zoltan Herczeg.
1669
1670 If we can't use the range filter, we should still make sure that the
1671 address is remotely sane, otherwise the hashtables will assert.
1672
1673 * jit/JITStubRoutine.h:
1674 (JSC::JITStubRoutine::passesFilter):
1675
16762012-07-10 Filip Pizlo <fpizlo@apple.com>
1677
fpizlo@apple.com39c94a42012-07-10 09:18:47 +00001678 DFG recompilation heuristics should be based on count, not rate
1679 https://bugs.webkit.org/show_bug.cgi?id=90146
1680
1681 Reviewed by Oliver Hunt.
1682
1683 Rolling r121511 back in after fixing the DFG's interpretation of op_div
1684 profiling, with Gavin's rubber stamp.
1685
1686 This removes a bunch of code that was previously trying to prevent spurious
1687 reoptimizations if a large enough majority of executions of a code block did
1688 not result in OSR exit. It turns out that this code was purely harmful. This
1689 patch removes all of that logic and replaces it with a dead-simple
1690 heuristic: if you exit more than N times (where N is an exponential function
1691 of the number of times the code block has already been recompiled) then we
1692 will recompile.
1693
1694 This appears to be a broad ~1% win on many benchmarks large and small.
1695
1696 * bytecode/CodeBlock.cpp:
1697 (JSC::CodeBlock::CodeBlock):
1698 * bytecode/CodeBlock.h:
1699 (JSC::CodeBlock::couldTakeSpecialFastCase):
1700 (CodeBlock):
1701 (JSC::CodeBlock::osrExitCounter):
1702 (JSC::CodeBlock::countOSRExit):
1703 (JSC::CodeBlock::addressOfOSRExitCounter):
1704 (JSC::CodeBlock::offsetOfOSRExitCounter):
1705 (JSC::CodeBlock::adjustedExitCountThreshold):
1706 (JSC::CodeBlock::exitCountThresholdForReoptimization):
1707 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
1708 (JSC::CodeBlock::shouldReoptimizeNow):
1709 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
1710 * bytecode/ExecutionCounter.cpp:
1711 (JSC::ExecutionCounter::setThreshold):
1712 * bytecode/ExecutionCounter.h:
1713 (ExecutionCounter):
1714 (JSC::ExecutionCounter::clippedThreshold):
1715 * dfg/DFGByteCodeParser.cpp:
1716 (JSC::DFG::ByteCodeParser::makeDivSafe):
1717 * dfg/DFGJITCompiler.cpp:
1718 (JSC::DFG::JITCompiler::compileBody):
1719 * dfg/DFGOSRExit.cpp:
1720 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
1721 * dfg/DFGOSRExitCompiler.cpp:
1722 (JSC::DFG::OSRExitCompiler::handleExitCounts):
1723 * dfg/DFGOperations.cpp:
1724 * jit/JITStubs.cpp:
1725 (JSC::DEFINE_STUB_FUNCTION):
1726 * runtime/Options.h:
1727 (JSC):
1728
commit-queue@webkit.orge1bba8e2012-07-10 05:45:21 +000017292012-07-09 Matt Falkenhagen <falken@chromium.org>
1730
1731 Add ENABLE_DIALOG_ELEMENT and skeleton files
1732 https://bugs.webkit.org/show_bug.cgi?id=90521
1733
1734 Reviewed by Kent Tamura.
1735
1736 * Configurations/FeatureDefines.xcconfig:
1737
fpizlo@apple.com746b8c52012-07-09 23:26:54 +000017382012-07-09 Filip Pizlo <fpizlo@apple.com>
1739
fpizlo@apple.com629c1cd2012-07-10 01:50:44 +00001740 Unreviewed, roll out http://trac.webkit.org/changeset/121511
1741 It made in-browser V8v7 10% slower.
1742
1743 * bytecode/CodeBlock.cpp:
1744 (JSC::CodeBlock::CodeBlock):
1745 * bytecode/CodeBlock.h:
1746 (CodeBlock):
1747 (JSC::CodeBlock::countSpeculationSuccess):
1748 (JSC::CodeBlock::countSpeculationFailure):
1749 (JSC::CodeBlock::speculativeSuccessCounter):
1750 (JSC::CodeBlock::speculativeFailCounter):
1751 (JSC::CodeBlock::forcedOSRExitCounter):
1752 (JSC::CodeBlock::addressOfSpeculativeSuccessCounter):
1753 (JSC::CodeBlock::addressOfSpeculativeFailCounter):
1754 (JSC::CodeBlock::addressOfForcedOSRExitCounter):
1755 (JSC::CodeBlock::offsetOfSpeculativeSuccessCounter):
1756 (JSC::CodeBlock::offsetOfSpeculativeFailCounter):
1757 (JSC::CodeBlock::offsetOfForcedOSRExitCounter):
1758 (JSC::CodeBlock::largeFailCountThreshold):
1759 (JSC::CodeBlock::largeFailCountThresholdForLoop):
1760 (JSC::CodeBlock::shouldReoptimizeNow):
1761 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
1762 * bytecode/ExecutionCounter.cpp:
1763 (JSC::ExecutionCounter::setThreshold):
1764 * bytecode/ExecutionCounter.h:
1765 (ExecutionCounter):
1766 * dfg/DFGJITCompiler.cpp:
1767 (JSC::DFG::JITCompiler::compileBody):
1768 * dfg/DFGOSRExit.cpp:
1769 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
1770 * dfg/DFGOSRExitCompiler.cpp:
1771 (JSC::DFG::OSRExitCompiler::handleExitCounts):
1772 * dfg/DFGOperations.cpp:
1773 * jit/JITStubs.cpp:
1774 (JSC::DEFINE_STUB_FUNCTION):
1775 * runtime/Options.h:
1776 (JSC):
1777
17782012-07-09 Filip Pizlo <fpizlo@apple.com>
1779
fpizlo@apple.comcacd7dc2012-07-09 23:28:53 +00001780 DFG may get stuck in an infinite fix point if it constant folds a mispredicted node
1781 https://bugs.webkit.org/show_bug.cgi?id=90829
1782 <rdar://problem/11823843>
1783
1784 Reviewed by Oliver Hunt.
1785
1786 If a node is shown to have been mispredicted during CFA, then don't allow constant
1787 folding to make the graph even more degenerate. Instead, pull back on constant folding
1788 and allow the normal OSR machinery to fix our profiling so that a future recompilation
1789 doesn't see the same mistake.
1790
1791 * dfg/DFGAbstractState.cpp:
1792 (JSC::DFG::AbstractState::execute):
1793 * dfg/DFGAbstractState.h:
1794 (JSC::DFG::AbstractState::trySetConstant):
1795 (AbstractState):
1796 * dfg/DFGPhase.h:
1797 (JSC::DFG::Phase::name):
1798 (Phase):
1799 (JSC::DFG::runAndLog):
1800 (DFG):
1801 (JSC::DFG::runPhase):
1802
18032012-07-09 Filip Pizlo <fpizlo@apple.com>
1804
fpizlo@apple.com746b8c52012-07-09 23:26:54 +00001805 It should be possible to jettison JIT stub routines even if they are currently running
1806 https://bugs.webkit.org/show_bug.cgi?id=90731
1807
1808 Reviewed by Gavin Barraclough.
1809
1810 This gives the GC awareness of all JIT-generated stubs for inline caches. That
1811 means that if you want to delete a JIT-generated stub, you don't have to worry
1812 about whether or not it is currently running: if there is a chance that it might
1813 be, the GC will kindly defer deletion until non-running-ness is proved.
1814
1815 * CMakeLists.txt:
1816 * GNUmakefile.list.am:
1817 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1818 * JavaScriptCore.xcodeproj/project.pbxproj:
1819 * Target.pri:
1820 * bytecode/Instruction.h:
1821 (JSC):
1822 (PolymorphicStubInfo):
1823 (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
1824 (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
1825 * bytecode/PolymorphicPutByIdList.cpp:
1826 (JSC::PutByIdAccess::fromStructureStubInfo):
1827 * bytecode/PolymorphicPutByIdList.h:
1828 (JSC::PutByIdAccess::transition):
1829 (JSC::PutByIdAccess::replace):
1830 (JSC::PutByIdAccess::stubRoutine):
1831 (PutByIdAccess):
1832 (JSC::PolymorphicPutByIdList::currentSlowPathTarget):
1833 * bytecode/StructureStubInfo.h:
1834 (JSC::StructureStubInfo::reset):
1835 * dfg/DFGRepatch.cpp:
1836 (JSC::DFG::generateProtoChainAccessStub):
1837 (JSC::DFG::tryCacheGetByID):
1838 (JSC::DFG::tryBuildGetByIDList):
1839 (JSC::DFG::tryBuildGetByIDProtoList):
1840 (JSC::DFG::emitPutReplaceStub):
1841 (JSC::DFG::emitPutTransitionStub):
1842 (JSC::DFG::tryCachePutByID):
1843 (JSC::DFG::tryBuildPutByIdList):
1844 * heap/ConservativeRoots.cpp:
1845 (JSC):
1846 (DummyMarkHook):
1847 (JSC::DummyMarkHook::mark):
1848 (JSC::ConservativeRoots::add):
1849 (CompositeMarkHook):
1850 (JSC::CompositeMarkHook::CompositeMarkHook):
1851 (JSC::CompositeMarkHook::mark):
1852 * heap/ConservativeRoots.h:
1853 (JSC):
1854 (ConservativeRoots):
1855 * heap/Heap.cpp:
1856 (JSC::Heap::markRoots):
1857 (JSC::Heap::deleteUnmarkedCompiledCode):
1858 * heap/Heap.h:
1859 (JSC):
1860 (Heap):
1861 * heap/JITStubRoutineSet.cpp: Added.
1862 (JSC):
1863 (JSC::JITStubRoutineSet::JITStubRoutineSet):
1864 (JSC::JITStubRoutineSet::~JITStubRoutineSet):
1865 (JSC::JITStubRoutineSet::add):
1866 (JSC::JITStubRoutineSet::clearMarks):
1867 (JSC::JITStubRoutineSet::markSlow):
1868 (JSC::JITStubRoutineSet::deleteUnmarkedJettisonedStubRoutines):
1869 (JSC::JITStubRoutineSet::traceMarkedStubRoutines):
1870 * heap/JITStubRoutineSet.h: Added.
1871 (JSC):
1872 (JITStubRoutineSet):
1873 (JSC::JITStubRoutineSet::mark):
1874 * heap/MachineStackMarker.h:
1875 (JSC):
1876 * interpreter/RegisterFile.cpp:
1877 (JSC::RegisterFile::gatherConservativeRoots):
1878 * interpreter/RegisterFile.h:
1879 (JSC):
1880 * jit/ExecutableAllocator.cpp:
1881 (JSC::DemandExecutableAllocator::DemandExecutableAllocator):
1882 * jit/ExecutableAllocator.h:
1883 (JSC):
1884 * jit/ExecutableAllocatorFixedVMPool.cpp:
1885 (JSC):
1886 (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator):
1887 * jit/GCAwareJITStubRoutine.cpp: Added.
1888 (JSC):
1889 (JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine):
1890 (JSC::GCAwareJITStubRoutine::~GCAwareJITStubRoutine):
1891 (JSC::GCAwareJITStubRoutine::observeZeroRefCount):
1892 (JSC::GCAwareJITStubRoutine::deleteFromGC):
1893 (JSC::GCAwareJITStubRoutine::markRequiredObjectsInternal):
1894 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::MarkingGCAwareJITStubRoutineWithOneObject):
1895 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::~MarkingGCAwareJITStubRoutineWithOneObject):
1896 (JSC::MarkingGCAwareJITStubRoutineWithOneObject::markRequiredObjectsInternal):
1897 (JSC::createJITStubRoutine):
1898 * jit/GCAwareJITStubRoutine.h: Added.
1899 (JSC):
1900 (GCAwareJITStubRoutine):
1901 (JSC::GCAwareJITStubRoutine::markRequiredObjects):
1902 (MarkingGCAwareJITStubRoutineWithOneObject):
1903 * jit/JITPropertyAccess.cpp:
1904 (JSC::JIT::privateCompilePutByIdTransition):
1905 (JSC::JIT::privateCompilePatchGetArrayLength):
1906 (JSC::JIT::privateCompileGetByIdProto):
1907 (JSC::JIT::privateCompileGetByIdSelfList):
1908 (JSC::JIT::privateCompileGetByIdProtoList):
1909 (JSC::JIT::privateCompileGetByIdChainList):
1910 (JSC::JIT::privateCompileGetByIdChain):
1911 * jit/JITPropertyAccess32_64.cpp:
1912 (JSC::JIT::privateCompilePutByIdTransition):
1913 (JSC::JIT::privateCompilePatchGetArrayLength):
1914 (JSC::JIT::privateCompileGetByIdProto):
1915 (JSC::JIT::privateCompileGetByIdSelfList):
1916 (JSC::JIT::privateCompileGetByIdProtoList):
1917 (JSC::JIT::privateCompileGetByIdChainList):
1918 (JSC::JIT::privateCompileGetByIdChain):
1919 * jit/JITStubRoutine.cpp: Added.
1920 (JSC):
1921 (JSC::JITStubRoutine::~JITStubRoutine):
1922 (JSC::JITStubRoutine::observeZeroRefCount):
1923 * jit/JITStubRoutine.h: Added.
1924 (JSC):
1925 (JITStubRoutine):
1926 (JSC::JITStubRoutine::JITStubRoutine):
1927 (JSC::JITStubRoutine::createSelfManagedRoutine):
1928 (JSC::JITStubRoutine::code):
1929 (JSC::JITStubRoutine::asCodePtr):
1930 (JSC::JITStubRoutine::ref):
1931 (JSC::JITStubRoutine::deref):
1932 (JSC::JITStubRoutine::startAddress):
1933 (JSC::JITStubRoutine::endAddress):
1934 (JSC::JITStubRoutine::addressStep):
1935 (JSC::JITStubRoutine::canPerformRangeFilter):
1936 (JSC::JITStubRoutine::filteringStartAddress):
1937 (JSC::JITStubRoutine::filteringExtentSize):
1938 (JSC::JITStubRoutine::passesFilter):
1939 * jit/JITStubs.cpp:
1940 (JSC::DEFINE_STUB_FUNCTION):
1941 (JSC::getPolymorphicAccessStructureListSlot):
1942
commit-queue@webkit.orgfb3c9682012-07-09 15:39:09 +000019432012-07-09 Sheriff Bot <webkit.review.bot@gmail.com>
1944
1945 Unreviewed, rolling out r122107.
1946 http://trac.webkit.org/changeset/122107
1947 https://bugs.webkit.org/show_bug.cgi?id=90794
1948
1949 Build failure on Mac debug bots (Requested by falken_ on
1950 #webkit).
1951
1952 * Configurations/FeatureDefines.xcconfig:
1953
commit-queue@webkit.orgb46a45d2012-07-09 14:42:00 +000019542012-07-09 Matt Falkenhagen <falken@chromium.org>
1955
1956 Add ENABLE_DIALOG_ELEMENT and skeleton files
1957 https://bugs.webkit.org/show_bug.cgi?id=90521
1958
1959 Reviewed by Kent Tamura.
1960
1961 * Configurations/FeatureDefines.xcconfig:
1962
rniwa@webkit.orga5efe7e2012-07-09 06:19:54 +000019632012-07-08 Ryosuke Niwa <rniwa@webkit.org>
1964
1965 gcc build fix after r121925.
1966
1967 * runtime/JSObject.h:
1968 (JSC::JSFinalObject::finishCreation):
1969
zherczeg@webkit.orgadfdb1f2012-07-08 10:00:04 +000019702012-07-08 Zoltan Herczeg <zherczeg@webkit.org>
1971
1972 [Qt][ARM] Implementing missing macro assembler instructions after r121925
1973 https://bugs.webkit.org/show_bug.cgi?id=90657
1974
1975 Reviewed by Csaba Osztrogonác.
1976
1977 Implementing convertibleLoadPtr, replaceWithLoad and
1978 replaceWithAddressComputation.
1979
1980 * assembler/ARMAssembler.h:
1981 (JSC::ARMAssembler::replaceWithLoad):
1982 (ARMAssembler):
1983 (JSC::ARMAssembler::replaceWithAddressComputation):
1984 * assembler/MacroAssemblerARM.h:
1985 (JSC::MacroAssemblerARM::convertibleLoadPtr):
1986 (MacroAssemblerARM):
1987
fpizlo@apple.com18066da2012-07-07 00:43:21 +000019882012-07-06 Filip Pizlo <fpizlo@apple.com>
1989
1990 WebKit Version 5.1.7 (6534.57.2, r121935): Double-click no longer works on OpenStreetMap
1991 https://bugs.webkit.org/show_bug.cgi?id=90703
1992
1993 Reviewed by Michael Saboff.
1994
1995 It turns out that in my object model refactoring, I managed to fix get_by_pname in all
1996 execution engines except 64-bit baseline JIT.
1997
1998 * jit/JITPropertyAccess.cpp:
1999 (JSC::JIT::emit_op_get_by_pname):
2000
commit-queue@webkit.org650e3e62012-07-06 20:41:09 +000020012012-07-06 Pravin D <pravind.2k4@gmail.com>
2002
2003 Build Error on Qt Linux build
2004 https://bugs.webkit.org/show_bug.cgi?id=90699
2005
2006 Reviewed by Laszlo Gombos.
2007
2008 * parser/Parser.cpp:
2009 (JSC::::parseForStatement):
2010 Removed unused boolean variable as this was causing build error on Qt Linux.
2011
commit-queue@webkit.orgc182dfc2012-07-06 17:39:20 +000020122012-07-06 Nuno Lopes <nlopes@apple.com>
2013
2014 Fix build with recent clang.
2015 https://bugs.webkit.org/show_bug.cgi?id=90634
2016
2017 Reviewed by Oliver Hunt.
2018
2019 * jit/SpecializedThunkJIT.h:
2020 (JSC::SpecializedThunkJIT::SpecializedThunkJIT):
2021 (SpecializedThunkJIT):
2022 * jit/ThunkGenerators.cpp:
2023 (JSC::charCodeAtThunkGenerator):
2024 (JSC::charAtThunkGenerator):
2025 (JSC::fromCharCodeThunkGenerator):
2026 (JSC::sqrtThunkGenerator):
2027 (JSC::floorThunkGenerator):
2028 (JSC::ceilThunkGenerator):
2029 (JSC::roundThunkGenerator):
2030 (JSC::expThunkGenerator):
2031 (JSC::logThunkGenerator):
2032 (JSC::absThunkGenerator):
2033 (JSC::powThunkGenerator):
2034 * parser/ASTBuilder.h:
2035 (JSC::ASTBuilder::createAssignResolve):
2036 (JSC::ASTBuilder::createForLoop):
2037 (JSC::ASTBuilder::createForInLoop):
2038 (JSC::ASTBuilder::makeAssignNode):
2039 (JSC::ASTBuilder::makePrefixNode):
2040 (JSC::ASTBuilder::makePostfixNode):
2041 * parser/NodeConstructors.h:
2042 (JSC::PostfixErrorNode::PostfixErrorNode):
2043 (JSC::PrefixErrorNode::PrefixErrorNode):
2044 (JSC::AssignResolveNode::AssignResolveNode):
2045 (JSC::AssignErrorNode::AssignErrorNode):
2046 (JSC::ForNode::ForNode):
2047 (JSC::ForInNode::ForInNode):
2048 * parser/Nodes.h:
2049 (FunctionCallResolveNode):
2050 (PostfixErrorNode):
2051 (PrefixErrorNode):
2052 (ReadModifyResolveNode):
2053 (AssignResolveNode):
2054 (AssignErrorNode):
2055 (ForNode):
2056 (ForInNode):
2057 * parser/Parser.cpp:
2058 (JSC::::parseVarDeclarationList):
2059 (JSC::::parseForStatement):
2060 * parser/SyntaxChecker.h:
2061 (JSC::SyntaxChecker::createAssignResolve):
2062 (JSC::SyntaxChecker::createForLoop):
2063
zherczeg@webkit.orgb3b18db2012-07-06 08:42:29 +000020642012-07-06 Zoltan Herczeg <zherczeg@webkit.org>
2065
2066 [Qt][ARM] REGRESSION(r121885): It broke 30 jsc tests, 500+ layout tests
2067 https://bugs.webkit.org/show_bug.cgi?id=90656
2068
2069 Reviewed by Csaba Osztrogonác.
2070
2071 Typo fixes.
2072
2073 * assembler/MacroAssemblerARM.cpp:
2074 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
2075 Rename getOp2Byte() -> getOp2Half()
2076 * assembler/MacroAssemblerARMv7.h:
2077 (JSC::MacroAssemblerARMv7::convertibleLoadPtr):
2078 Add a necessary space.
2079 * jit/JITStubs.cpp:
2080 (JSC):
2081 Revert INLINE_ARM_FUNCTION macro.
2082
fpizlo@apple.come26c6d22012-07-06 07:01:35 +000020832012-07-05 Filip Pizlo <fpizlo@apple.com>
2084
2085 REGRESSION(r121925): It broke 5 sputnik tests on x86 platforms
2086 https://bugs.webkit.org/show_bug.cgi?id=90658
2087
2088 Reviewed by Zoltan Herczeg.
2089
2090 Under the new object model, out-of-line property accesses such as those
2091 in ResolveGlobal must account for the fact that the offset to the Kth
2092 property is represented by K + inlineStorageCapacity. Hence, the property
2093 loads in ResolveGlobal must have an additional -inlineStorageCapacity *
2094 sizeof(JSValue) offset.
2095
2096 * dfg/DFGSpeculativeJIT32_64.cpp:
2097 (JSC::DFG::SpeculativeJIT::compile):
2098
ossy@webkit.orgc5b75fd2012-07-06 04:52:26 +000020992012-07-05 Csaba Osztrogonác <ossy@webkit.org>
2100
2101 [Qt] Unreviewed 64 bit buildfix after r121925.
2102
2103 * bytecode/PutByIdStatus.cpp:
2104 (JSC::PutByIdStatus::computeFromLLInt):
2105
msaboff@apple.comb1b64c72012-07-06 00:04:05 +000021062012-07-05 Michael Saboff <msaboff@apple.com>
2107
2108 JSString::tryHashConstLock() fails to get exclusive lock
2109 https://bugs.webkit.org/show_bug.cgi?id=90639
2110
2111 Reviewed by Oliver Hunt.
2112
2113 Added check that the string is already locked even before compare and swap.
2114
2115 * heap/MarkStack.cpp:
2116 (JSC::JSString::tryHashConstLock):
2117
fpizlo@apple.comd68b1f82012-07-05 22:55:51 +000021182012-07-04 Filip Pizlo <fpizlo@apple.com>
2119
2120 Inline property storage should not be wasted when it is exhausted
2121 https://bugs.webkit.org/show_bug.cgi?id=90347
2122
2123 Reviewed by Gavin Barraclough.
2124
2125 Previously, if we switched an object from using inline storage to out-of-line
2126 storage, we would abandon the inline storage. This would have two main implications:
2127 (i) all accesses to the object, even for properties that were previously in inline
2128 storage, must now take an extra indirection; and (ii) we waste a non-trivial amount
2129 of space since we must allocate additional out-of-line storage to hold properties
2130 that would have fit in the inline storage. There's also the copying cost when
2131 switching to out-of-line storage - we must copy all inline properties into ouf-of-line
2132 storage.
2133
2134 This patch changes the way that object property storage works so that we can use both
2135 inline and out-of-line storage concurrently. This is accomplished by introducing a
2136 new notion of property offset. This PropertyOffset is a 32-bit signed integer and it
2137 behaves as follows:
2138
2139 offset == -1: invalid offset, indicating a property that does not exist.
2140
2141 0 <= offset <= inlineStorageCapacity: offset into inline storage.
2142
2143 inlineStorageCapacity < offset: offset into out-of-line storage.
2144
2145 Because non-final objects don't have inline storage, the only valid PropertyOffsets
2146 for those objects' properties are -1 or > inlineStorageCapacity.
2147
2148 This now means that the decision to use inline or out-of-line storage for an access is
2149 made based on the offset, rather than the structure. It also means that any access
2150 where the offset is a variable must have an extra branch, unless the type of the
2151 object is also known (if it's known to be a non-final object then we can just assert
2152 that the offset is >= inlineStorageCapacity).
2153
2154 This looks like a big Kraken speed-up and a slight V8 speed-up.
2155
2156 * GNUmakefile.list.am:
2157 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
2158 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2159 * JavaScriptCore.xcodeproj/project.pbxproj:
2160 * assembler/ARMv7Assembler.h:
2161 (ARMv7Assembler):
2162 (JSC::ARMv7Assembler::ldrWide8BitImmediate):
2163 (JSC::ARMv7Assembler::replaceWithLoad):
2164 (JSC::ARMv7Assembler::replaceWithAddressComputation):
2165 * assembler/AbstractMacroAssembler.h:
2166 (AbstractMacroAssembler):
2167 (ConvertibleLoadLabel):
2168 (JSC::AbstractMacroAssembler::ConvertibleLoadLabel::ConvertibleLoadLabel):
2169 (JSC::AbstractMacroAssembler::ConvertibleLoadLabel::isSet):
2170 (JSC::AbstractMacroAssembler::labelIgnoringWatchpoints):
2171 (JSC::AbstractMacroAssembler::replaceWithLoad):
2172 (JSC::AbstractMacroAssembler::replaceWithAddressComputation):
2173 * assembler/CodeLocation.h:
2174 (JSC):
2175 (CodeLocationCommon):
2176 (CodeLocationConvertibleLoad):
2177 (JSC::CodeLocationConvertibleLoad::CodeLocationConvertibleLoad):
2178 (JSC::CodeLocationCommon::convertibleLoadAtOffset):
2179 * assembler/LinkBuffer.cpp:
2180 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
2181 * assembler/LinkBuffer.h:
2182 (LinkBuffer):
2183 (JSC::LinkBuffer::locationOf):
2184 * assembler/MacroAssemblerARMv7.h:
2185 (MacroAssemblerARMv7):
2186 (JSC::MacroAssemblerARMv7::convertibleLoadPtr):
2187 * assembler/MacroAssemblerX86.h:
2188 (JSC::MacroAssemblerX86::convertibleLoadPtr):
2189 (MacroAssemblerX86):
2190 * assembler/MacroAssemblerX86_64.h:
2191 (JSC::MacroAssemblerX86_64::convertibleLoadPtr):
2192 (MacroAssemblerX86_64):
2193 * assembler/RepatchBuffer.h:
2194 (RepatchBuffer):
2195 (JSC::RepatchBuffer::replaceWithLoad):
2196 (JSC::RepatchBuffer::replaceWithAddressComputation):
2197 (JSC::RepatchBuffer::setLoadInstructionIsActive):
2198 * assembler/X86Assembler.h:
2199 (JSC::X86Assembler::replaceWithLoad):
2200 (X86Assembler):
2201 (JSC::X86Assembler::replaceWithAddressComputation):
2202 * bytecode/CodeBlock.cpp:
2203 (JSC::CodeBlock::printGetByIdOp):
2204 (JSC::CodeBlock::dump):
2205 (JSC::CodeBlock::finalizeUnconditionally):
2206 * bytecode/GetByIdStatus.cpp:
2207 (JSC::GetByIdStatus::computeFromLLInt):
2208 (JSC::GetByIdStatus::computeForChain):
2209 (JSC::GetByIdStatus::computeFor):
2210 * bytecode/GetByIdStatus.h:
2211 (JSC::GetByIdStatus::GetByIdStatus):
2212 (JSC::GetByIdStatus::offset):
2213 (GetByIdStatus):
2214 * bytecode/Opcode.h:
2215 (JSC):
2216 (JSC::padOpcodeName):
2217 * bytecode/PutByIdStatus.cpp:
2218 (JSC::PutByIdStatus::computeFromLLInt):
2219 (JSC::PutByIdStatus::computeFor):
2220 * bytecode/PutByIdStatus.h:
2221 (JSC::PutByIdStatus::PutByIdStatus):
2222 (JSC::PutByIdStatus::offset):
2223 (PutByIdStatus):
2224 * bytecode/ResolveGlobalStatus.cpp:
2225 (JSC):
2226 (JSC::computeForStructure):
2227 * bytecode/ResolveGlobalStatus.h:
2228 (JSC::ResolveGlobalStatus::ResolveGlobalStatus):
2229 (JSC::ResolveGlobalStatus::offset):
2230 (ResolveGlobalStatus):
2231 * bytecode/StructureSet.h:
2232 (StructureSet):
2233 * bytecode/StructureStubInfo.h:
2234 * dfg/DFGByteCodeParser.cpp:
2235 (ByteCodeParser):
2236 (JSC::DFG::ByteCodeParser::handleGetByOffset):
2237 (JSC::DFG::ByteCodeParser::handleGetById):
2238 (JSC::DFG::ByteCodeParser::parseBlock):
2239 * dfg/DFGCapabilities.h:
2240 (JSC::DFG::canCompileOpcode):
2241 * dfg/DFGJITCompiler.cpp:
2242 (JSC::DFG::JITCompiler::link):
2243 * dfg/DFGJITCompiler.h:
2244 (JSC::DFG::PropertyAccessRecord::PropertyAccessRecord):
2245 (PropertyAccessRecord):
2246 * dfg/DFGRepatch.cpp:
2247 (JSC::DFG::dfgRepatchByIdSelfAccess):
2248 (JSC::DFG::generateProtoChainAccessStub):
2249 (JSC::DFG::tryCacheGetByID):
2250 (JSC::DFG::tryBuildGetByIDList):
2251 (JSC::DFG::tryBuildGetByIDProtoList):
2252 (JSC::DFG::emitPutReplaceStub):
2253 (JSC::DFG::emitPutTransitionStub):
2254 (JSC::DFG::tryCachePutByID):
2255 (JSC::DFG::tryBuildPutByIdList):
2256 * dfg/DFGSpeculativeJIT.h:
2257 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
2258 * dfg/DFGSpeculativeJIT32_64.cpp:
2259 (JSC::DFG::SpeculativeJIT::cachedGetById):
2260 (JSC::DFG::SpeculativeJIT::cachedPutById):
2261 (JSC::DFG::SpeculativeJIT::compile):
2262 * dfg/DFGSpeculativeJIT64.cpp:
2263 (JSC::DFG::SpeculativeJIT::cachedGetById):
2264 (JSC::DFG::SpeculativeJIT::cachedPutById):
2265 (JSC::DFG::SpeculativeJIT::compile):
2266 * heap/MarkStack.cpp:
2267 (JSC::visitChildren):
2268 * interpreter/Interpreter.cpp:
2269 (JSC::Interpreter::tryCacheGetByID):
2270 (JSC::Interpreter::privateExecute):
2271 * jit/JIT.cpp:
2272 (JSC::JIT::privateCompileMainPass):
2273 (JSC::JIT::privateCompileSlowCases):
2274 (JSC::PropertyStubCompilationInfo::copyToStubInfo):
2275 * jit/JIT.h:
2276 (JSC::PropertyStubCompilationInfo::PropertyStubCompilationInfo):
2277 (JSC::JIT::compileGetByIdProto):
2278 (JSC::JIT::compileGetByIdSelfList):
2279 (JSC::JIT::compileGetByIdProtoList):
2280 (JSC::JIT::compileGetByIdChainList):
2281 (JSC::JIT::compileGetByIdChain):
2282 (JSC::JIT::compilePutByIdTransition):
2283 (JIT):
2284 * jit/JITInlineMethods.h:
2285 (JSC::JIT::emitAllocateBasicJSObject):
2286 * jit/JITOpcodes.cpp:
2287 (JSC::JIT::emit_op_resolve_global):
2288 * jit/JITOpcodes32_64.cpp:
2289 (JSC::JIT::emit_op_resolve_global):
2290 * jit/JITPropertyAccess.cpp:
2291 (JSC::JIT::compileGetDirectOffset):
2292 (JSC::JIT::emit_op_method_check):
2293 (JSC::JIT::compileGetByIdHotPath):
2294 (JSC::JIT::emit_op_put_by_id):
2295 (JSC::JIT::compilePutDirectOffset):
2296 (JSC::JIT::privateCompilePutByIdTransition):
2297 (JSC::JIT::patchGetByIdSelf):
2298 (JSC::JIT::patchPutByIdReplace):
2299 (JSC::JIT::privateCompileGetByIdProto):
2300 (JSC::JIT::privateCompileGetByIdSelfList):
2301 (JSC::JIT::privateCompileGetByIdProtoList):
2302 (JSC::JIT::privateCompileGetByIdChainList):
2303 (JSC::JIT::privateCompileGetByIdChain):
2304 * jit/JITPropertyAccess32_64.cpp:
2305 (JSC::JIT::emit_op_method_check):
2306 (JSC::JIT::compileGetByIdHotPath):
2307 (JSC::JIT::emit_op_put_by_id):
2308 (JSC::JIT::compilePutDirectOffset):
2309 (JSC::JIT::compileGetDirectOffset):
2310 (JSC::JIT::privateCompilePutByIdTransition):
2311 (JSC::JIT::patchGetByIdSelf):
2312 (JSC::JIT::patchPutByIdReplace):
2313 (JSC::JIT::privateCompileGetByIdProto):
2314 (JSC::JIT::privateCompileGetByIdSelfList):
2315 (JSC::JIT::privateCompileGetByIdProtoList):
2316 (JSC::JIT::privateCompileGetByIdChainList):
2317 (JSC::JIT::privateCompileGetByIdChain):
2318 (JSC::JIT::emit_op_get_by_pname):
2319 * jit/JITStubs.cpp:
2320 (JSC::JITThunks::tryCacheGetByID):
2321 (JSC::DEFINE_STUB_FUNCTION):
2322 * llint/LLIntSlowPaths.cpp:
2323 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
2324 * llint/LowLevelInterpreter.asm:
2325 * llint/LowLevelInterpreter32_64.asm:
2326 * llint/LowLevelInterpreter64.asm:
2327 * offlineasm/x86.rb:
2328 * runtime/JSGlobalObject.h:
2329 (JSGlobalObject):
2330 (JSC::JSGlobalObject::functionNameOffset):
2331 * runtime/JSObject.cpp:
2332 (JSC::JSObject::visitChildren):
2333 (JSC):
2334 (JSC::JSFinalObject::visitChildren):
2335 (JSC::JSObject::put):
2336 (JSC::JSObject::deleteProperty):
2337 (JSC::JSObject::getPropertySpecificValue):
2338 (JSC::JSObject::removeDirect):
2339 (JSC::JSObject::growOutOfLineStorage):
2340 (JSC::JSObject::getOwnPropertyDescriptor):
2341 * runtime/JSObject.h:
2342 (JSObject):
2343 (JSC::JSObject::getDirect):
2344 (JSC::JSObject::getDirectLocation):
2345 (JSC::JSObject::hasInlineStorage):
2346 (JSC::JSObject::inlineStorageUnsafe):
2347 (JSC::JSObject::inlineStorage):
2348 (JSC::JSObject::outOfLineStorage):
2349 (JSC::JSObject::locationForOffset):
2350 (JSC::JSObject::offsetForLocation):
2351 (JSC::JSObject::getDirectOffset):
2352 (JSC::JSObject::putDirectOffset):
2353 (JSC::JSObject::putUndefinedAtDirectOffset):
2354 (JSC::JSObject::addressOfOutOfLineStorage):
2355 (JSC::JSObject::finishCreation):
2356 (JSC::JSNonFinalObject::JSNonFinalObject):
2357 (JSC::JSNonFinalObject::finishCreation):
2358 (JSFinalObject):
2359 (JSC::JSFinalObject::finishCreation):
2360 (JSC::JSFinalObject::JSFinalObject):
2361 (JSC::JSObject::offsetOfOutOfLineStorage):
2362 (JSC::JSObject::setOutOfLineStorage):
2363 (JSC::JSObject::JSObject):
2364 (JSC):
2365 (JSC::JSCell::fastGetOwnProperty):
2366 (JSC::JSObject::putDirectInternal):
2367 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
2368 (JSC::JSObject::putDirectWithoutTransition):
2369 (JSC::offsetRelativeToPatchedStorage):
2370 (JSC::indexRelativeToBase):
2371 (JSC::offsetRelativeToBase):
2372 * runtime/JSPropertyNameIterator.cpp:
2373 (JSC::JSPropertyNameIterator::create):
2374 * runtime/JSPropertyNameIterator.h:
2375 (JSPropertyNameIterator):
2376 (JSC::JSPropertyNameIterator::getOffset):
2377 (JSC::JSPropertyNameIterator::finishCreation):
2378 * runtime/JSValue.cpp:
2379 (JSC::JSValue::putToPrimitive):
2380 * runtime/Operations.h:
2381 (JSC::normalizePrototypeChain):
2382 * runtime/Options.cpp:
2383 (JSC):
2384 (JSC::Options::initialize):
2385 * runtime/PropertyMapHashTable.h:
2386 (PropertyMapEntry):
2387 (JSC::PropertyMapEntry::PropertyMapEntry):
2388 (PropertyTable):
2389 (JSC::PropertyTable::PropertyTable):
2390 (JSC::PropertyTable::getDeletedOffset):
2391 (JSC::PropertyTable::addDeletedOffset):
2392 (JSC::PropertyTable::nextOffset):
2393 (JSC):
2394 (JSC::PropertyTable::sizeInMemory):
2395 * runtime/PropertyOffset.h: Added.
2396 (JSC):
2397 (JSC::checkOffset):
2398 (JSC::validateOffset):
2399 (JSC::isValidOffset):
2400 (JSC::isInlineOffset):
2401 (JSC::isOutOfLineOffset):
2402 (JSC::offsetInInlineStorage):
2403 (JSC::offsetInOutOfLineStorage):
2404 (JSC::offsetInRespectiveStorage):
2405 (JSC::numberOfOutOfLineSlotsForLastOffset):
2406 (JSC::numberOfSlotsForLastOffset):
2407 (JSC::nextPropertyOffsetFor):
2408 (JSC::firstPropertyOffsetFor):
2409 * runtime/PropertySlot.h:
2410 (JSC::PropertySlot::cachedOffset):
2411 (JSC::PropertySlot::setValue):
2412 (JSC::PropertySlot::setCacheableGetterSlot):
2413 (JSC::PropertySlot::clearOffset):
2414 * runtime/PutPropertySlot.h:
2415 (JSC::PutPropertySlot::setExistingProperty):
2416 (JSC::PutPropertySlot::setNewProperty):
2417 (JSC::PutPropertySlot::cachedOffset):
2418 (PutPropertySlot):
2419 * runtime/Structure.cpp:
2420 (JSC::Structure::Structure):
2421 (JSC::Structure::materializePropertyMap):
2422 (JSC::nextOutOfLineStorageCapacity):
2423 (JSC::Structure::growOutOfLineCapacity):
2424 (JSC::Structure::suggestedNewOutOfLineStorageCapacity):
2425 (JSC::Structure::addPropertyTransitionToExistingStructure):
2426 (JSC::Structure::addPropertyTransition):
2427 (JSC::Structure::removePropertyTransition):
2428 (JSC::Structure::flattenDictionaryStructure):
2429 (JSC::Structure::addPropertyWithoutTransition):
2430 (JSC::Structure::removePropertyWithoutTransition):
2431 (JSC::Structure::copyPropertyTableForPinning):
2432 (JSC::Structure::get):
2433 (JSC::Structure::putSpecificValue):
2434 (JSC::Structure::remove):
2435 * runtime/Structure.h:
2436 (Structure):
2437 (JSC::Structure::putWillGrowOutOfLineStorage):
2438 (JSC::Structure::previousID):
2439 (JSC::Structure::outOfLineCapacity):
2440 (JSC::Structure::outOfLineSizeForKnownFinalObject):
2441 (JSC::Structure::outOfLineSizeForKnownNonFinalObject):
2442 (JSC::Structure::outOfLineSize):
2443 (JSC::Structure::hasInlineStorage):
2444 (JSC::Structure::inlineCapacity):
2445 (JSC::Structure::inlineSizeForKnownFinalObject):
2446 (JSC::Structure::inlineSize):
2447 (JSC::Structure::totalStorageSize):
2448 (JSC::Structure::totalStorageCapacity):
2449 (JSC::Structure::firstValidOffset):
2450 (JSC::Structure::lastValidOffset):
2451 (JSC::Structure::isValidOffset):
2452 (JSC::Structure::isEmpty):
2453 (JSC::Structure::transitionCount):
2454 (JSC::Structure::get):
2455
oliver@apple.com5635b542012-07-05 20:36:37 +000024562012-07-05 Oliver Hunt <oliver@apple.com>
2457
2458 JSObjectCallAsFunction should thisConvert the provided thisObject
2459 https://bugs.webkit.org/show_bug.cgi?id=90628
2460
2461 Reviewed by Gavin Barraclough.
2462
2463 Perform this conversion on the provided this object.
2464
2465 * API/JSObjectRef.cpp:
2466 (JSObjectCallAsFunction):
2467
zherczeg@webkit.orgd6e661f2012-07-05 07:04:16 +000024682012-07-05 Zoltan Herczeg <zherczeg@webkit.org>
2469
zherczeg@webkit.orgda8c37d2012-07-05 07:53:51 +00002470 [Qt] Unreviewed buildfix after r121886. Typo fix.
2471
2472 * assembler/MacroAssemblerARM.cpp:
2473 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
2474
24752012-07-05 Zoltan Herczeg <zherczeg@webkit.org>
2476
zherczeg@webkit.orgd6e661f2012-07-05 07:04:16 +00002477 Port DFG JIT to traditional ARM
2478 https://bugs.webkit.org/show_bug.cgi?id=90198
2479
2480 Reviewed by Filip Pizlo.
2481
2482 This patch contains the macro assembler part of the
2483 DFG JIT support on ARM systems with fixed 32 bit instruction
2484 width. A large amount of old code was refactored, and the ARMv4
2485 or lower support is removed from the macro assembler.
2486
2487 Sunspider is improved by 8%, and V8 is 92%.
2488
2489 * assembler/ARMAssembler.cpp:
2490 (JSC::ARMAssembler::dataTransfer32):
2491 (JSC::ARMAssembler::baseIndexTransfer32):
2492 (JSC):
2493 (JSC::ARMAssembler::dataTransfer16):
2494 (JSC::ARMAssembler::baseIndexTransfer16):
2495 (JSC::ARMAssembler::dataTransferFloat):
2496 (JSC::ARMAssembler::baseIndexTransferFloat):
2497 (JSC::ARMAssembler::executableCopy):
2498 * assembler/ARMAssembler.h:
2499 (JSC::ARMAssembler::ARMAssembler):
2500 (JSC::ARMAssembler::emitInst):
2501 (JSC::ARMAssembler::vmov_f64_r):
2502 (ARMAssembler):
2503 (JSC::ARMAssembler::vabs_f64_r):
2504 (JSC::ARMAssembler::vneg_f64_r):
2505 (JSC::ARMAssembler::ldr_imm):
2506 (JSC::ARMAssembler::ldr_un_imm):
2507 (JSC::ARMAssembler::dtr_u):
2508 (JSC::ARMAssembler::dtr_ur):
2509 (JSC::ARMAssembler::dtr_d):
2510 (JSC::ARMAssembler::dtr_dr):
2511 (JSC::ARMAssembler::dtrh_u):
2512 (JSC::ARMAssembler::dtrh_ur):
2513 (JSC::ARMAssembler::dtrh_d):
2514 (JSC::ARMAssembler::dtrh_dr):
2515 (JSC::ARMAssembler::fdtr_u):
2516 (JSC::ARMAssembler::fdtr_d):
2517 (JSC::ARMAssembler::push_r):
2518 (JSC::ARMAssembler::pop_r):
2519 (JSC::ARMAssembler::poke_r):
2520 (JSC::ARMAssembler::peek_r):
2521 (JSC::ARMAssembler::vmov_vfp64_r):
2522 (JSC::ARMAssembler::vmov_arm64_r):
2523 (JSC::ARMAssembler::vmov_vfp32_r):
2524 (JSC::ARMAssembler::vmov_arm32_r):
2525 (JSC::ARMAssembler::vcvt_u32_f64_r):
2526 (JSC::ARMAssembler::vcvt_f64_f32_r):
2527 (JSC::ARMAssembler::vcvt_f32_f64_r):
2528 (JSC::ARMAssembler::clz_r):
2529 (JSC::ARMAssembler::bkpt):
2530 (JSC::ARMAssembler::bx):
2531 (JSC::ARMAssembler::blx):
2532 (JSC::ARMAssembler::labelIgnoringWatchpoints):
2533 (JSC::ARMAssembler::labelForWatchpoint):
2534 (JSC::ARMAssembler::label):
2535 (JSC::ARMAssembler::getLdrImmAddress):
2536 (JSC::ARMAssembler::replaceWithJump):
2537 (JSC::ARMAssembler::maxJumpReplacementSize):
2538 (JSC::ARMAssembler::getOp2Byte):
2539 (JSC::ARMAssembler::getOp2Half):
2540 (JSC::ARMAssembler::RM):
2541 (JSC::ARMAssembler::RS):
2542 (JSC::ARMAssembler::RD):
2543 (JSC::ARMAssembler::RN):
2544 * assembler/AssemblerBufferWithConstantPool.h:
2545 (JSC::AssemblerBufferWithConstantPool::ensureSpaceForAnyInstruction):
2546 * assembler/MacroAssemblerARM.cpp:
2547 (JSC::MacroAssemblerARM::load32WithUnalignedHalfWords):
2548 * assembler/MacroAssemblerARM.h:
2549 (JSC::MacroAssemblerARM::add32):
2550 (MacroAssemblerARM):
2551 (JSC::MacroAssemblerARM::and32):
2552 (JSC::MacroAssemblerARM::lshift32):
2553 (JSC::MacroAssemblerARM::mul32):
2554 (JSC::MacroAssemblerARM::neg32):
2555 (JSC::MacroAssemblerARM::rshift32):
2556 (JSC::MacroAssemblerARM::urshift32):
2557 (JSC::MacroAssemblerARM::xor32):
2558 (JSC::MacroAssemblerARM::load8):
2559 (JSC::MacroAssemblerARM::load8Signed):
2560 (JSC::MacroAssemblerARM::load16):
2561 (JSC::MacroAssemblerARM::load16Signed):
2562 (JSC::MacroAssemblerARM::load32):
2563 (JSC::MacroAssemblerARM::load32WithAddressOffsetPatch):
2564 (JSC::MacroAssemblerARM::store32WithAddressOffsetPatch):
2565 (JSC::MacroAssemblerARM::store8):
2566 (JSC::MacroAssemblerARM::store16):
2567 (JSC::MacroAssemblerARM::store32):
2568 (JSC::MacroAssemblerARM::move):
2569 (JSC::MacroAssemblerARM::jump):
2570 (JSC::MacroAssemblerARM::branchAdd32):
2571 (JSC::MacroAssemblerARM::mull32):
2572 (JSC::MacroAssemblerARM::branchMul32):
2573 (JSC::MacroAssemblerARM::nearCall):
2574 (JSC::MacroAssemblerARM::compare32):
2575 (JSC::MacroAssemblerARM::test32):
2576 (JSC::MacroAssemblerARM::sub32):
2577 (JSC::MacroAssemblerARM::call):
2578 (JSC::MacroAssemblerARM::loadFloat):
2579 (JSC::MacroAssemblerARM::loadDouble):
2580 (JSC::MacroAssemblerARM::storeFloat):
2581 (JSC::MacroAssemblerARM::storeDouble):
2582 (JSC::MacroAssemblerARM::moveDouble):
2583 (JSC::MacroAssemblerARM::addDouble):
2584 (JSC::MacroAssemblerARM::divDouble):
2585 (JSC::MacroAssemblerARM::subDouble):
2586 (JSC::MacroAssemblerARM::mulDouble):
2587 (JSC::MacroAssemblerARM::absDouble):
2588 (JSC::MacroAssemblerARM::negateDouble):
2589 (JSC::MacroAssemblerARM::convertInt32ToDouble):
2590 (JSC::MacroAssemblerARM::convertFloatToDouble):
2591 (JSC::MacroAssemblerARM::convertDoubleToFloat):
2592 (JSC::MacroAssemblerARM::branchTruncateDoubleToInt32):
2593 (JSC::MacroAssemblerARM::branchTruncateDoubleToUint32):
2594 (JSC::MacroAssemblerARM::truncateDoubleToInt32):
2595 (JSC::MacroAssemblerARM::truncateDoubleToUint32):
2596 (JSC::MacroAssemblerARM::branchConvertDoubleToInt32):
2597 (JSC::MacroAssemblerARM::branchDoubleNonZero):
2598 (JSC::MacroAssemblerARM::branchDoubleZeroOrNaN):
2599 (JSC::MacroAssemblerARM::invert):
2600 (JSC::MacroAssemblerARM::replaceWithJump):
2601 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
2602 (JSC::MacroAssemblerARM::call32):
2603 * assembler/SH4Assembler.h:
2604 (JSC::SH4Assembler::label):
2605 * dfg/DFGAssemblyHelpers.h:
2606 (JSC::DFG::AssemblyHelpers::debugCall):
2607 (JSC::DFG::AssemblyHelpers::boxDouble):
2608 (JSC::DFG::AssemblyHelpers::unboxDouble):
2609 * dfg/DFGCCallHelpers.h:
2610 (CCallHelpers):
2611 (JSC::DFG::CCallHelpers::setupArguments):
2612 * dfg/DFGFPRInfo.h:
2613 (DFG):
2614 * dfg/DFGGPRInfo.h:
2615 (DFG):
2616 (GPRInfo):
2617 * dfg/DFGOperations.cpp:
2618 (JSC):
2619 * dfg/DFGSpeculativeJIT.h:
2620 (SpeculativeJIT):
2621 (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheckSetResult):
2622 (JSC::DFG::SpeculativeJIT::appendCallSetResult):
2623 * jit/JITStubs.cpp:
2624 (JSC):
2625 * jit/JITStubs.h:
2626 (JITStackFrame):
2627 * jit/JSInterfaceJIT.h:
2628 (JSInterfaceJIT):
2629
commit-queue@webkit.orgd106bf22012-07-04 21:36:52 +000026302012-07-04 Anthony Scian <ascian@rim.com>
2631
2632 Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
2633 https://bugs.webkit.org/show_bug.cgi?id=40118
2634
2635 Reviewed by Yong Li.
2636
2637 Added member functions to expose function name, urlString, and line #.
2638 Refactored toString to make use of these member functions to reduce
2639 duplicated code for future maintenance.
2640
2641 Manually tested refactoring of toString by tracing thrown exceptions.
2642
2643 * interpreter/Interpreter.h:
2644 (JSC::StackFrame::toString):
2645 (JSC::StackFrame::friendlySourceURL):
2646 (JSC::StackFrame::friendlyFunctionName):
2647 (JSC::StackFrame::friendlyLineNumber):
2648
wingo@igalia.com17649d82012-07-04 20:32:26 +000026492012-07-04 Andy Wingo <wingo@igalia.com>
2650
2651 [GTK] Enable parallel GC
2652 https://bugs.webkit.org/show_bug.cgi?id=90568
2653
2654 Reviewed by Martin Robinson.
2655
2656 * runtime/Options.cpp: Include <algorithm.h> for std::min.
2657
commit-queue@webkit.org1fcb31a2012-07-04 16:16:01 +000026582012-07-04 John Mellor <johnme@chromium.org>
2659
2660 Text Autosizing: Add compile flag and runtime setting
2661 https://bugs.webkit.org/show_bug.cgi?id=87394
2662
2663 This patch renames Font Boosting to Text Autosizing.
2664
2665 Reviewed by Adam Barth.
2666
2667 * Configurations/FeatureDefines.xcconfig:
2668
msaboff@apple.comd08f3502012-07-03 22:57:00 +000026692012-07-03 Michael Saboff <msaboff@apple.com>
2670
2671 Enh: Hash Const JSString in Backing Stores to Save Memory
2672 https://bugs.webkit.org/show_bug.cgi?id=86024
2673
2674 Reviewed by Oliver Hunt.
2675
2676 During garbage collection, each marking thread keeps a HashMap of
2677 strings. While visiting via MarkStack::copyAndAppend(), we check to
2678 see if the string we are visiting is already in the HashMap. If not
2679 we add it. If so, we change the reference to the current string we're
2680 visiting to the prior string.
2681
2682 To reduce the performance impact of this change, two throttles have
2683 ben added. 1) We only try hash consting if a significant number of new
2684 strings have been created since the last hash const. Currently this is
2685 set at 100 strings. 2) If a string is unique at the end of a marking
2686 it will not be checked during further GC phases. In some cases this
2687 won't catch all duplicates, but we are trying to catch the growth of
2688 duplicate strings.
2689
2690 * heap/Heap.cpp:
2691 (JSC::Heap::markRoots):
2692 * heap/MarkStack.cpp:
2693 (JSC::MarkStackThreadSharedData::resetChildren):
2694 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
2695 (JSC::MarkStackThreadSharedData::reset):
2696 (JSC::MarkStack::setup): Check to see if enough strings have been created
2697 to hash const.
2698 (JSC::MarkStack::reset): Added call to clear m_uniqueStrings.
2699 (JSC::JSString::tryHashConstLock): New method to lock JSString for
2700 hash consting.
2701 (JSC::JSString::releaseHashConstLock): New unlock method.
2702 (JSC::JSString::shouldTryHashConst): Set of checks to see if we should
2703 try to hash const the string.
2704 (JSC::MarkStack::internalAppend): New method that performs the hash consting.
2705 (JSC::SlotVisitor::copyAndAppend): Changed to call the new hash
2706 consting internalAppend().
2707 * heap/MarkStack.h:
2708 (MarkStackThreadSharedData):
2709 (MarkStack):
2710 * runtime/JSGlobalData.cpp:
2711 (JSC::JSGlobalData::JSGlobalData):
2712 * runtime/JSGlobalData.h:
2713 (JSGlobalData):
2714 (JSC::JSGlobalData::haveEnoughNewStringsToHashConst):
2715 (JSC::JSGlobalData::resetNewStringsSinceLastHashConst):
2716 * runtime/JSString.h:
2717 (JSString): Changed from using bool flags to using an unsigned
2718 m_flags field. This works better with the weakCompareAndSwap in
2719 JSString::tryHashConstLock(). Changed the 8bitness setting and
2720 checking to use new accessors.
2721 (JSC::JSString::JSString):
2722 (JSC::JSString::finishCreation):
2723 (JSC::JSString::is8Bit): Updated for new m_flags.
2724 (JSC::JSString::setIs8Bit): New setter.
2725 New hash const flags accessors:
2726 (JSC::JSString::isHashConstSingleton):
2727 (JSC::JSString::clearHashConstSingleton):
2728 (JSC::JSString::setHashConstSingleton):
2729 (JSC::JSRopeString::finishCreation):
2730 (JSC::JSRopeString::append):
2731
tony@chromium.orga47ad862012-07-03 20:26:08 +000027322012-07-03 Tony Chang <tony@chromium.org>
2733
2734 [chromium] Unreviewed, update .gitignore to handle VS2010 files.
2735
2736 * JavaScriptCore.gyp/.gitignore:
2737
commit-queue@webkit.orgfbda60c2012-07-03 19:19:22 +000027382012-07-03 Mark Lam <mark.lam@apple.com>
2739
2740 Add ability to symbolically set and dump JSC VM options.
2741 See comments in runtime/Options.h for details on how the options work.
2742 https://bugs.webkit.org/show_bug.cgi?id=90420
2743
2744 Reviewed by Filip Pizlo.
2745
2746 * assembler/LinkBuffer.cpp:
2747 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
2748 * assembler/LinkBuffer.h:
2749 (JSC):
2750 * bytecode/CodeBlock.cpp:
2751 (JSC::CodeBlock::shouldOptimizeNow):
2752 * bytecode/CodeBlock.h:
2753 (JSC::CodeBlock::likelyToTakeSlowCase):
2754 (JSC::CodeBlock::couldTakeSlowCase):
2755 (JSC::CodeBlock::likelyToTakeSpecialFastCase):
2756 (JSC::CodeBlock::likelyToTakeDeepestSlowCase):
2757 (JSC::CodeBlock::likelyToTakeAnySlowCase):
2758 (JSC::CodeBlock::jitAfterWarmUp):
2759 (JSC::CodeBlock::jitSoon):
2760 (JSC::CodeBlock::reoptimizationRetryCounter):
2761 (JSC::CodeBlock::countReoptimization):
2762 (JSC::CodeBlock::counterValueForOptimizeAfterWarmUp):
2763 (JSC::CodeBlock::counterValueForOptimizeAfterLongWarmUp):
2764 (JSC::CodeBlock::optimizeSoon):
2765 (JSC::CodeBlock::exitCountThresholdForReoptimization):
2766 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
2767 * bytecode/ExecutionCounter.h:
2768 (JSC::ExecutionCounter::clippedThreshold):
2769 * dfg/DFGByteCodeParser.cpp:
2770 (JSC::DFG::ByteCodeParser::handleInlining):
2771 * dfg/DFGCapabilities.h:
2772 (JSC::DFG::mightCompileEval):
2773 (JSC::DFG::mightCompileProgram):
2774 (JSC::DFG::mightCompileFunctionForCall):
2775 (JSC::DFG::mightCompileFunctionForConstruct):
2776 (JSC::DFG::mightInlineFunctionForCall):
2777 (JSC::DFG::mightInlineFunctionForConstruct):
2778 * dfg/DFGCommon.h:
2779 (JSC::DFG::shouldShowDisassembly):
2780 * dfg/DFGDriver.cpp:
2781 (JSC::DFG::compile):
2782 * dfg/DFGOSRExit.cpp:
2783 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
2784 * dfg/DFGVariableAccessData.h:
2785 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
2786 * heap/MarkStack.cpp:
2787 (JSC::MarkStackSegmentAllocator::allocate):
2788 (JSC::MarkStackSegmentAllocator::shrinkReserve):
2789 (JSC::MarkStackArray::MarkStackArray):
2790 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
2791 (JSC::SlotVisitor::donateKnownParallel):
2792 (JSC::SlotVisitor::drain):
2793 (JSC::SlotVisitor::drainFromShared):
2794 * heap/MarkStack.h:
2795 (JSC::MarkStack::mergeOpaqueRootsIfProfitable):
2796 (JSC::MarkStack::addOpaqueRoot):
2797 * heap/SlotVisitor.h:
2798 (JSC::SlotVisitor::donate):
2799 * jit/JIT.cpp:
2800 (JSC::JIT::emitOptimizationCheck):
2801 * jsc.cpp:
2802 (printUsageStatement):
2803 (parseArguments):
2804 * runtime/InitializeThreading.cpp:
2805 (JSC::initializeThreadingOnce):
2806 * runtime/JSGlobalData.cpp:
2807 (JSC::enableAssembler):
2808 * runtime/JSGlobalObject.cpp:
2809 (JSC::JSGlobalObject::JSGlobalObject):
2810 * runtime/Options.cpp:
2811 (JSC):
2812 (JSC::overrideOptionWithHeuristic):
2813 (JSC::Options::initialize):
2814 (JSC::Options::setOption):
2815 (JSC::Options::dumpAllOptions):
2816 (JSC::Options::dumpOption):
2817 * runtime/Options.h:
2818 (JSC):
2819 (Options):
2820 (EntryInfo):
2821
commit-queue@webkit.org337179a2012-07-03 13:43:13 +000028222012-07-03 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> Joel Dillon <joel.dillon@codethink.co.uk>
2823
2824 [Qt][Win] Fix broken QtWebKit5.lib linking
2825 https://bugs.webkit.org/show_bug.cgi?id=88321
2826
2827 Reviewed by Kenneth Rohde Christiansen.
2828
2829 The goal is to have different ports build systems define STATICALLY_LINKED_WITH_WTF
2830 when building JavaScriptCore, if both are packaged in the same DLL, instead
2831 of relying on the code to handle this.
2832 The effects of BUILDING_* and STATICALLY_LINKED_WITH_* are currently the same
2833 except for a check in Source/JavaScriptCore/config.h.
2834
2835 Keeping the old way for the WX port as requested by the port's contributors.
2836 For non-Windows ports there is no difference between IMPORT and EXPORT, no
2837 change is needed.
2838
2839 * API/JSBase.h:
2840 JS symbols shouldn't be included by WTF objects anymore. Remove the export when BUILDING_WTF.
2841 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
2842 Make sure that JavaScriptCore uses import symbols of WTF for the Win port.
2843 * runtime/JSExportMacros.h:
2844
fpizlo@apple.comaedde2e2012-07-03 00:10:08 +000028452012-07-02 Filip Pizlo <fpizlo@apple.com>
2846
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +00002847 DFG OSR exit value recoveries should be computed lazily
2848 https://bugs.webkit.org/show_bug.cgi?id=82155
2849
2850 Reviewed by Gavin Barraclough.
2851
2852 This change aims to reduce one aspect of DFG compile times: the fact
2853 that we currently compute the value recoveries for each local and
2854 argument on every speculation check. We compile many speculation checks,
2855 so this can add up quick. The strategy that this change takes is to
2856 have the DFG save just enough information about how the compiler is
2857 choosing to represent state, that the DFG::OSRExitCompiler can reify
2858 the value recoveries lazily.
2859
2860 This appears to be an 0.3% SunSpider speed-up and is neutral elsewhere.
2861
2862 I also took the opportunity to fix the sampling regions profiler (it
2863 was missing an export macro) and to put in more sampling regions in
2864 the DFG (which are disabled so long as ENABLE(SAMPLING_REGIONS) is
2865 false).
2866
2867 * CMakeLists.txt:
2868 * GNUmakefile.list.am:
2869 * JavaScriptCore.xcodeproj/project.pbxproj:
2870 * Target.pri:
2871 * bytecode/CodeBlock.cpp:
2872 (JSC):
2873 (JSC::CodeBlock::shrinkDFGDataToFit):
2874 * bytecode/CodeBlock.h:
2875 (CodeBlock):
2876 (JSC::CodeBlock::minifiedDFG):
2877 (JSC::CodeBlock::variableEventStream):
2878 (DFGData):
2879 * bytecode/Operands.h:
2880 (JSC::Operands::hasOperand):
2881 (Operands):
2882 (JSC::Operands::size):
2883 (JSC::Operands::at):
2884 (JSC::Operands::operator[]):
2885 (JSC::Operands::isArgument):
2886 (JSC::Operands::isVariable):
2887 (JSC::Operands::argumentForIndex):
2888 (JSC::Operands::variableForIndex):
2889 (JSC::Operands::operandForIndex):
2890 (JSC):
2891 (JSC::dumpOperands):
2892 * bytecode/SamplingTool.h:
2893 (SamplingRegion):
2894 * dfg/DFGByteCodeParser.cpp:
2895 (JSC::DFG::parse):
2896 * dfg/DFGCFAPhase.cpp:
2897 (JSC::DFG::performCFA):
2898 * dfg/DFGCSEPhase.cpp:
2899 (JSC::DFG::performCSE):
2900 * dfg/DFGFixupPhase.cpp:
2901 (JSC::DFG::performFixup):
2902 * dfg/DFGGenerationInfo.h:
2903 (JSC::DFG::GenerationInfo::GenerationInfo):
2904 (JSC::DFG::GenerationInfo::initConstant):
2905 (JSC::DFG::GenerationInfo::initInteger):
2906 (JSC::DFG::GenerationInfo::initJSValue):
2907 (JSC::DFG::GenerationInfo::initCell):
2908 (JSC::DFG::GenerationInfo::initBoolean):
2909 (JSC::DFG::GenerationInfo::initDouble):
2910 (JSC::DFG::GenerationInfo::initStorage):
2911 (GenerationInfo):
2912 (JSC::DFG::GenerationInfo::noticeOSRBirth):
2913 (JSC::DFG::GenerationInfo::use):
2914 (JSC::DFG::GenerationInfo::spill):
2915 (JSC::DFG::GenerationInfo::setSpilled):
2916 (JSC::DFG::GenerationInfo::fillJSValue):
2917 (JSC::DFG::GenerationInfo::fillCell):
2918 (JSC::DFG::GenerationInfo::fillInteger):
2919 (JSC::DFG::GenerationInfo::fillBoolean):
2920 (JSC::DFG::GenerationInfo::fillDouble):
2921 (JSC::DFG::GenerationInfo::fillStorage):
2922 (JSC::DFG::GenerationInfo::appendFill):
2923 (JSC::DFG::GenerationInfo::appendSpill):
2924 * dfg/DFGJITCompiler.cpp:
2925 (JSC::DFG::JITCompiler::link):
2926 (JSC::DFG::JITCompiler::compile):
2927 (JSC::DFG::JITCompiler::compileFunction):
2928 * dfg/DFGMinifiedGraph.h: Added.
2929 (DFG):
2930 (MinifiedGraph):
2931 (JSC::DFG::MinifiedGraph::MinifiedGraph):
2932 (JSC::DFG::MinifiedGraph::at):
2933 (JSC::DFG::MinifiedGraph::append):
2934 (JSC::DFG::MinifiedGraph::prepareAndShrink):
2935 (JSC::DFG::MinifiedGraph::setOriginalGraphSize):
2936 (JSC::DFG::MinifiedGraph::originalGraphSize):
2937 * dfg/DFGMinifiedNode.cpp: Added.
2938 (DFG):
2939 (JSC::DFG::MinifiedNode::fromNode):
2940 * dfg/DFGMinifiedNode.h: Added.
2941 (DFG):
2942 (JSC::DFG::belongsInMinifiedGraph):
2943 (MinifiedNode):
2944 (JSC::DFG::MinifiedNode::MinifiedNode):
2945 (JSC::DFG::MinifiedNode::index):
2946 (JSC::DFG::MinifiedNode::op):
2947 (JSC::DFG::MinifiedNode::hasChild1):
2948 (JSC::DFG::MinifiedNode::child1):
2949 (JSC::DFG::MinifiedNode::hasConstant):
2950 (JSC::DFG::MinifiedNode::hasConstantNumber):
2951 (JSC::DFG::MinifiedNode::constantNumber):
2952 (JSC::DFG::MinifiedNode::hasWeakConstant):
2953 (JSC::DFG::MinifiedNode::weakConstant):
2954 (JSC::DFG::MinifiedNode::getIndex):
2955 (JSC::DFG::MinifiedNode::compareByNodeIndex):
2956 (JSC::DFG::MinifiedNode::hasChild):
2957 * dfg/DFGNode.h:
2958 (Node):
2959 * dfg/DFGOSRExit.cpp:
2960 (JSC::DFG::OSRExit::OSRExit):
2961 * dfg/DFGOSRExit.h:
2962 (OSRExit):
2963 * dfg/DFGOSRExitCompiler.cpp:
2964 * dfg/DFGOSRExitCompiler.h:
2965 (OSRExitCompiler):
2966 * dfg/DFGOSRExitCompiler32_64.cpp:
2967 (JSC::DFG::OSRExitCompiler::compileExit):
2968 * dfg/DFGOSRExitCompiler64.cpp:
2969 (JSC::DFG::OSRExitCompiler::compileExit):
2970 * dfg/DFGPredictionPropagationPhase.cpp:
2971 (JSC::DFG::performPredictionPropagation):
2972 * dfg/DFGRedundantPhiEliminationPhase.cpp:
2973 (JSC::DFG::performRedundantPhiElimination):
2974 * dfg/DFGSpeculativeJIT.cpp:
2975 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
2976 (DFG):
2977 (JSC::DFG::SpeculativeJIT::fillStorage):
2978 (JSC::DFG::SpeculativeJIT::noticeOSRBirth):
2979 (JSC::DFG::SpeculativeJIT::compileMovHint):
2980 (JSC::DFG::SpeculativeJIT::compile):
2981 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
2982 * dfg/DFGSpeculativeJIT.h:
2983 (DFG):
2984 (JSC::DFG::SpeculativeJIT::use):
2985 (SpeculativeJIT):
2986 (JSC::DFG::SpeculativeJIT::spill):
2987 (JSC::DFG::SpeculativeJIT::speculationCheck):
2988 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
2989 (JSC::DFG::SpeculativeJIT::recordSetLocal):
2990 * dfg/DFGSpeculativeJIT32_64.cpp:
2991 (JSC::DFG::SpeculativeJIT::fillInteger):
2992 (JSC::DFG::SpeculativeJIT::fillDouble):
2993 (JSC::DFG::SpeculativeJIT::fillJSValue):
2994 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
2995 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
2996 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
2997 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
2998 (JSC::DFG::SpeculativeJIT::compile):
2999 * dfg/DFGSpeculativeJIT64.cpp:
3000 (JSC::DFG::SpeculativeJIT::fillInteger):
3001 (JSC::DFG::SpeculativeJIT::fillDouble):
3002 (JSC::DFG::SpeculativeJIT::fillJSValue):
3003 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
3004 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
3005 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
3006 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
3007 (JSC::DFG::SpeculativeJIT::compile):
3008 * dfg/DFGValueRecoveryOverride.h: Added.
3009 (DFG):
3010 (ValueRecoveryOverride):
3011 (JSC::DFG::ValueRecoveryOverride::ValueRecoveryOverride):
3012 * dfg/DFGValueSource.cpp: Added.
3013 (DFG):
3014 (JSC::DFG::ValueSource::dump):
3015 * dfg/DFGValueSource.h: Added.
3016 (DFG):
3017 (JSC::DFG::dataFormatToValueSourceKind):
3018 (JSC::DFG::valueSourceKindToDataFormat):
3019 (JSC::DFG::isInRegisterFile):
3020 (ValueSource):
3021 (JSC::DFG::ValueSource::ValueSource):
3022 (JSC::DFG::ValueSource::forPrediction):
3023 (JSC::DFG::ValueSource::forDataFormat):
3024 (JSC::DFG::ValueSource::isSet):
3025 (JSC::DFG::ValueSource::kind):
3026 (JSC::DFG::ValueSource::isInRegisterFile):
3027 (JSC::DFG::ValueSource::dataFormat):
3028 (JSC::DFG::ValueSource::valueRecovery):
3029 (JSC::DFG::ValueSource::nodeIndex):
3030 (JSC::DFG::ValueSource::nodeIndexFromKind):
3031 (JSC::DFG::ValueSource::kindFromNodeIndex):
3032 * dfg/DFGVariableEvent.cpp: Added.
3033 (DFG):
3034 (JSC::DFG::VariableEvent::dump):
3035 (JSC::DFG::VariableEvent::dumpFillInfo):
3036 (JSC::DFG::VariableEvent::dumpSpillInfo):
3037 * dfg/DFGVariableEvent.h: Added.
3038 (DFG):
3039 (VariableEvent):
3040 (JSC::DFG::VariableEvent::VariableEvent):
3041 (JSC::DFG::VariableEvent::reset):
3042 (JSC::DFG::VariableEvent::fillGPR):
3043 (JSC::DFG::VariableEvent::fillPair):
3044 (JSC::DFG::VariableEvent::fillFPR):
3045 (JSC::DFG::VariableEvent::spill):
3046 (JSC::DFG::VariableEvent::death):
3047 (JSC::DFG::VariableEvent::setLocal):
3048 (JSC::DFG::VariableEvent::movHint):
3049 (JSC::DFG::VariableEvent::kind):
3050 (JSC::DFG::VariableEvent::nodeIndex):
3051 (JSC::DFG::VariableEvent::dataFormat):
3052 (JSC::DFG::VariableEvent::gpr):
3053 (JSC::DFG::VariableEvent::tagGPR):
3054 (JSC::DFG::VariableEvent::payloadGPR):
3055 (JSC::DFG::VariableEvent::fpr):
3056 (JSC::DFG::VariableEvent::virtualRegister):
3057 (JSC::DFG::VariableEvent::operand):
3058 (JSC::DFG::VariableEvent::variableRepresentation):
3059 * dfg/DFGVariableEventStream.cpp: Added.
3060 (DFG):
3061 (JSC::DFG::VariableEventStream::logEvent):
3062 (MinifiedGenerationInfo):
3063 (JSC::DFG::MinifiedGenerationInfo::MinifiedGenerationInfo):
3064 (JSC::DFG::MinifiedGenerationInfo::update):
3065 (JSC::DFG::VariableEventStream::reconstruct):
3066 * dfg/DFGVariableEventStream.h: Added.
3067 (DFG):
3068 (VariableEventStream):
3069 (JSC::DFG::VariableEventStream::appendAndLog):
3070 * dfg/DFGVirtualRegisterAllocationPhase.cpp:
3071 (JSC::DFG::performVirtualRegisterAllocation):
3072
30732012-07-02 Filip Pizlo <fpizlo@apple.com>
3074
fpizlo@apple.comaedde2e2012-07-03 00:10:08 +00003075 DFG::ArgumentsSimplificationPhase should assert that the PhantomArguments nodes it creates are not shouldGenerate()
3076 https://bugs.webkit.org/show_bug.cgi?id=90407
3077
3078 Reviewed by Mark Hahnenberg.
3079
3080 * dfg/DFGArgumentsSimplificationPhase.cpp:
3081 (JSC::DFG::ArgumentsSimplificationPhase::run):
3082
barraclough@apple.com15ab3352012-07-02 19:25:59 +000030832012-07-02 Gavin Barraclough <barraclough@apple.com>
3084
3085 Array.prototype.pop should throw if property is not configurable
3086 https://bugs.webkit.org/show_bug.cgi?id=75788
3087
3088 Rubber Stamped by Oliver Hunt.
3089
3090 No real bug here any more, but the error we throw sometimes has a misleading message.
3091
3092 * runtime/JSArray.cpp:
3093 (JSC::JSArray::pop):
3094
fpizlo@apple.com3aef57f2012-06-30 19:28:26 +000030952012-06-29 Filip Pizlo <fpizlo@apple.com>
3096
fpizlo@apple.com604d38a2012-07-01 03:54:49 +00003097 JSObject wastes too much memory on unused property slots
3098 https://bugs.webkit.org/show_bug.cgi?id=90255
3099
3100 Reviewed by Mark Hahnenberg.
3101
3102 Rolling back in after applying a simple fix: it appears that
3103 JSObject::setStructureAndReallocateStorageIfNecessary() was allocating more
3104 property storage than necessary. Fixing this appears to resolve the crash.
3105
3106 This does a few things:
3107
3108 - JSNonFinalObject no longer has inline property storage.
3109
3110 - Initial out-of-line property storage size is 4 slots for JSNonFinalObject,
3111 or 2x the inline storage for JSFinalObject.
3112
3113 - Property storage is only reallocated if it needs to be. Previously, we
3114 would reallocate the property storage on any transition where the original
3115 structure said shouldGrowProperyStorage(), but this led to spurious
3116 reallocations when doing transitionless property adds and there are
3117 deleted property slots available. That in turn led to crashes, because we
3118 would switch to out-of-line storage even if the capacity matched the
3119 criteria for inline storage.
3120
3121 - Inline JSFunction allocation is killed off because we don't have a good
3122 way of inlining property storage allocation. This didn't hurt performance.
3123 Killing off code is better than fixing it if that code wasn't doing any
3124 good.
3125
3126 This looks like a 1% progression on V8.
3127
3128 * interpreter/Interpreter.cpp:
3129 (JSC::Interpreter::privateExecute):
3130 * jit/JIT.cpp:
3131 (JSC::JIT::privateCompileSlowCases):
3132 * jit/JIT.h:
3133 * jit/JITInlineMethods.h:
3134 (JSC::JIT::emitAllocateBasicJSObject):
3135 (JSC):
3136 * jit/JITOpcodes.cpp:
3137 (JSC::JIT::emit_op_new_func):
3138 (JSC):
3139 (JSC::JIT::emit_op_new_func_exp):
3140 * runtime/JSFunction.cpp:
3141 (JSC::JSFunction::finishCreation):
3142 * runtime/JSObject.h:
3143 (JSC::JSObject::isUsingInlineStorage):
3144 (JSObject):
3145 (JSC::JSObject::finishCreation):
3146 (JSC):
3147 (JSC::JSNonFinalObject::hasInlineStorage):
3148 (JSNonFinalObject):
3149 (JSC::JSNonFinalObject::JSNonFinalObject):
3150 (JSC::JSNonFinalObject::finishCreation):
3151 (JSC::JSFinalObject::hasInlineStorage):
3152 (JSC::JSFinalObject::finishCreation):
3153 (JSC::JSObject::offsetOfInlineStorage):
3154 (JSC::JSObject::setPropertyStorage):
3155 (JSC::Structure::inlineStorageCapacity):
3156 (JSC::Structure::isUsingInlineStorage):
3157 (JSC::JSObject::putDirectInternal):
3158 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
3159 (JSC::JSObject::putDirectWithoutTransition):
3160 * runtime/Structure.cpp:
3161 (JSC::Structure::Structure):
3162 (JSC::nextPropertyStorageCapacity):
3163 (JSC):
3164 (JSC::Structure::growPropertyStorageCapacity):
3165 (JSC::Structure::suggestedNewPropertyStorageSize):
3166 * runtime/Structure.h:
3167 (JSC::Structure::putWillGrowPropertyStorage):
3168 (Structure):
3169
31702012-06-29 Filip Pizlo <fpizlo@apple.com>
3171
fpizlo@apple.com3aef57f2012-06-30 19:28:26 +00003172 Webkit crashes in DFG on Google Docs when creating a new document
3173 https://bugs.webkit.org/show_bug.cgi?id=90209
3174
3175 Reviewed by Gavin Barraclough.
3176
3177 Don't attempt to short-circuit Phantom(GetLocal) if the GetLocal is for a
3178 captured variable.
3179
3180 * dfg/DFGCFGSimplificationPhase.cpp:
3181 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
3182
zandobersek@gmail.com069a2d32012-06-30 12:09:15 +000031832012-06-30 Zan Dobersek <zandobersek@gmail.com>
3184
3185 Unreviewed, rolling out r121605.
3186 http://trac.webkit.org/changeset/121605
3187 https://bugs.webkit.org/show_bug.cgi?id=90336
3188
3189 Changes caused flaky crashes in sputnik/Unicode tests on Apple
3190 WK1 and GTK Linux builders
3191
3192 * interpreter/Interpreter.cpp:
3193 (JSC::Interpreter::privateExecute):
3194 * jit/JIT.cpp:
3195 (JSC::JIT::privateCompileSlowCases):
3196 * jit/JIT.h:
3197 * jit/JITInlineMethods.h:
3198 (JSC::JIT::emitAllocateBasicJSObject):
3199 (JSC::JIT::emitAllocateJSFinalObject):
3200 (JSC):
3201 (JSC::JIT::emitAllocateJSFunction):
3202 * jit/JITOpcodes.cpp:
3203 (JSC::JIT::emit_op_new_func):
3204 (JSC::JIT::emitSlow_op_new_func):
3205 (JSC):
3206 (JSC::JIT::emit_op_new_func_exp):
3207 (JSC::JIT::emitSlow_op_new_func_exp):
3208 * runtime/JSFunction.cpp:
3209 (JSC::JSFunction::finishCreation):
3210 * runtime/JSObject.h:
3211 (JSC::JSObject::isUsingInlineStorage):
3212 (JSObject):
3213 (JSC::JSObject::finishCreation):
3214 (JSC):
3215 (JSNonFinalObject):
3216 (JSC::JSNonFinalObject::JSNonFinalObject):
3217 (JSC::JSNonFinalObject::finishCreation):
3218 (JSFinalObject):
3219 (JSC::JSFinalObject::finishCreation):
3220 (JSC::JSObject::offsetOfInlineStorage):
3221 (JSC::JSObject::setPropertyStorage):
3222 (JSC::Structure::isUsingInlineStorage):
3223 (JSC::JSObject::putDirectInternal):
3224 (JSC::JSObject::putDirectWithoutTransition):
3225 (JSC::JSObject::transitionTo):
3226 * runtime/Structure.cpp:
3227 (JSC::Structure::Structure):
3228 (JSC):
3229 (JSC::Structure::growPropertyStorageCapacity):
3230 (JSC::Structure::suggestedNewPropertyStorageSize):
3231 * runtime/Structure.h:
3232 (JSC::Structure::shouldGrowPropertyStorage):
3233 (JSC::Structure::propertyStorageSize):
3234
mhahnenberg@apple.com3100b432012-06-30 01:14:09 +000032352012-06-29 Mark Hahnenberg <mhahnenberg@apple.com>
3236
3237 Remove warning about protected values when the Heap is being destroyed
3238 https://bugs.webkit.org/show_bug.cgi?id=90302
3239
3240 Reviewed by Geoffrey Garen.
3241
3242 Having to do book-keeping about whether values allocated from a certain
3243 VM are or are not protected makes the JSC API much more difficult to use
3244 correctly. Clients should be able to throw an entire VM away and not have
3245 to worry about unprotecting all of the values that they protected earlier.
3246
3247 * heap/Heap.cpp:
3248 (JSC::Heap::lastChanceToFinalize):
3249
fpizlo@apple.com9243e792012-06-30 00:25:01 +000032502012-06-29 Filip Pizlo <fpizlo@apple.com>
3251
3252 JSObject wastes too much memory on unused property slots
3253 https://bugs.webkit.org/show_bug.cgi?id=90255
3254
3255 Reviewed by Mark Hahnenberg.
3256
3257 This does a few things:
3258
3259 - JSNonFinalObject no longer has inline property storage.
3260
3261 - Initial out-of-line property storage size is 4 slots for JSNonFinalObject,
3262 or 2x the inline storage for JSFinalObject.
3263
3264 - Property storage is only reallocated if it needs to be. Previously, we
3265 would reallocate the property storage on any transition where the original
3266 structure said shouldGrowProperyStorage(), but this led to spurious
3267 reallocations when doing transitionless property adds and there are
3268 deleted property slots available. That in turn led to crashes, because we
3269 would switch to out-of-line storage even if the capacity matched the
3270 criteria for inline storage.
3271
3272 - Inline JSFunction allocation is killed off because we don't have a good
3273 way of inlining property storage allocation. This didn't hurt performance.
3274 Killing off code is better than fixing it if that code wasn't doing any
3275 good.
3276
3277 This looks like a 1% progression on V8.
3278
3279 * interpreter/Interpreter.cpp:
3280 (JSC::Interpreter::privateExecute):
3281 * jit/JIT.cpp:
3282 (JSC::JIT::privateCompileSlowCases):
3283 * jit/JIT.h:
3284 * jit/JITInlineMethods.h:
3285 (JSC::JIT::emitAllocateBasicJSObject):
3286 (JSC):
3287 * jit/JITOpcodes.cpp:
3288 (JSC::JIT::emit_op_new_func):
3289 (JSC):
3290 (JSC::JIT::emit_op_new_func_exp):
3291 * runtime/JSFunction.cpp:
3292 (JSC::JSFunction::finishCreation):
3293 * runtime/JSObject.h:
3294 (JSC::JSObject::isUsingInlineStorage):
3295 (JSObject):
3296 (JSC::JSObject::finishCreation):
3297 (JSC):
3298 (JSC::JSNonFinalObject::hasInlineStorage):
3299 (JSNonFinalObject):
3300 (JSC::JSNonFinalObject::JSNonFinalObject):
3301 (JSC::JSNonFinalObject::finishCreation):
3302 (JSC::JSFinalObject::hasInlineStorage):
3303 (JSC::JSFinalObject::finishCreation):
3304 (JSC::JSObject::offsetOfInlineStorage):
3305 (JSC::JSObject::setPropertyStorage):
3306 (JSC::Structure::inlineStorageCapacity):
3307 (JSC::Structure::isUsingInlineStorage):
3308 (JSC::JSObject::putDirectInternal):
3309 (JSC::JSObject::setStructureAndReallocateStorageIfNecessary):
3310 (JSC::JSObject::putDirectWithoutTransition):
3311 * runtime/Structure.cpp:
3312 (JSC::Structure::Structure):
3313 (JSC::nextPropertyStorageCapacity):
3314 (JSC):
3315 (JSC::Structure::growPropertyStorageCapacity):
3316 (JSC::Structure::suggestedNewPropertyStorageSize):
3317 * runtime/Structure.h:
3318 (JSC::Structure::putWillGrowPropertyStorage):
3319 (Structure):
3320
fpizlo@apple.com48a964b2012-06-29 02:40:14 +000033212012-06-28 Filip Pizlo <fpizlo@apple.com>
3322
3323 DFG recompilation heuristics should be based on count, not rate
3324 https://bugs.webkit.org/show_bug.cgi?id=90146
3325
3326 Reviewed by Oliver Hunt.
3327
3328 This removes a bunch of code that was previously trying to prevent spurious
3329 reoptimizations if a large enough majority of executions of a code block did
3330 not result in OSR exit. It turns out that this code was purely harmful. This
3331 patch removes all of that logic and replaces it with a dead-simple
3332 heuristic: if you exit more than N times (where N is an exponential function
3333 of the number of times the code block has already been recompiled) then we
3334 will recompile.
3335
3336 This appears to be a broad ~1% win on many benchmarks large and small.
3337
3338 * bytecode/CodeBlock.cpp:
3339 (JSC::CodeBlock::CodeBlock):
3340 * bytecode/CodeBlock.h:
3341 (JSC::CodeBlock::osrExitCounter):
3342 (JSC::CodeBlock::countOSRExit):
3343 (CodeBlock):
3344 (JSC::CodeBlock::addressOfOSRExitCounter):
3345 (JSC::CodeBlock::offsetOfOSRExitCounter):
3346 (JSC::CodeBlock::adjustedExitCountThreshold):
3347 (JSC::CodeBlock::exitCountThresholdForReoptimization):
3348 (JSC::CodeBlock::exitCountThresholdForReoptimizationFromLoop):
3349 (JSC::CodeBlock::shouldReoptimizeNow):
3350 (JSC::CodeBlock::shouldReoptimizeFromLoopNow):
3351 * bytecode/ExecutionCounter.cpp:
3352 (JSC::ExecutionCounter::setThreshold):
3353 * bytecode/ExecutionCounter.h:
3354 (ExecutionCounter):
3355 (JSC::ExecutionCounter::clippedThreshold):
3356 * dfg/DFGJITCompiler.cpp:
3357 (JSC::DFG::JITCompiler::compileBody):
3358 * dfg/DFGOSRExit.cpp:
3359 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
3360 * dfg/DFGOSRExitCompiler.cpp:
3361 (JSC::DFG::OSRExitCompiler::handleExitCounts):
3362 * dfg/DFGOperations.cpp:
3363 * jit/JITStubs.cpp:
3364 (JSC::DEFINE_STUB_FUNCTION):
3365 * runtime/Options.cpp:
3366 (Options):
3367 (JSC::Options::initializeOptions):
3368 * runtime/Options.h:
3369 (Options):
3370
commit-queue@webkit.org97ee82b2012-06-28 23:03:07 +000033712012-06-28 Mark Lam <mark.lam@apple.com>
3372
3373 Adding a commenting utility to record BytecodeGenerator comments
3374 with opcodes that are emitted. Presently, the comments can only
3375 be constant strings. Adding comments for opcodes is optional.
3376 If a comment is added, the comment will be printed following the
3377 opcode when CodeBlock::dump() is called.
3378
3379 This utility is disabled by default, and is only meant for VM
3380 development purposes. It should not be enabled for product builds.
3381
3382 To enable this utility, set ENABLE_BYTECODE_COMMENTS in CodeBlock.h
3383 to 1.
3384
3385 https://bugs.webkit.org/show_bug.cgi?id=90095
3386
3387 Reviewed by Geoffrey Garen.
3388
3389 * GNUmakefile.list.am:
3390 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3391 * JavaScriptCore.xcodeproj/project.pbxproj:
3392 * bytecode/CodeBlock.cpp:
3393 (JSC::CodeBlock::dumpBytecodeCommentAndNewLine): Dumps the comment.
3394 (JSC):
3395 (JSC::CodeBlock::printUnaryOp): Add comment dumps.
3396 (JSC::CodeBlock::printBinaryOp): Add comment dumps.
3397 (JSC::CodeBlock::printConditionalJump): Add comment dumps.
3398 (JSC::CodeBlock::printCallOp): Add comment dumps.
3399 (JSC::CodeBlock::printPutByIdOp): Add comment dumps.
3400 (JSC::CodeBlock::dump): Add comment dumps.
3401 (JSC::CodeBlock::CodeBlock):
3402 (JSC::CodeBlock::commentForBytecodeOffset):
3403 Finds the comment for an opcode if available.
3404 (JSC::CodeBlock::dumpBytecodeComments):
3405 For debugging whether comments are collected.
3406 It is not being called anywhere.
3407 * bytecode/CodeBlock.h:
3408 (CodeBlock):
3409 (JSC::CodeBlock::bytecodeComments):
3410 * bytecode/Comment.h: Added.
3411 (JSC):
3412 (Comment):
3413 * bytecompiler/BytecodeGenerator.cpp:
3414 (JSC::BytecodeGenerator::BytecodeGenerator):
3415 (JSC::BytecodeGenerator::emitOpcode): Calls emitComment().
3416 (JSC):
3417 (JSC::BytecodeGenerator::emitComment): Adds comment to CodeBlock.
3418 (JSC::BytecodeGenerator::prependComment):
3419 Registers a comment for emitComemnt() to use later.
3420 * bytecompiler/BytecodeGenerator.h:
3421 (BytecodeGenerator):
3422 (JSC::BytecodeGenerator::emitComment):
3423 (JSC::BytecodeGenerator::prependComment):
3424 These are inlined versions of these functions that nullify them
3425 when ENABLE_BYTECODE_COMMENTS is 0.
3426 (JSC::BytecodeGenerator::comments):
3427
oliver@apple.com41383bc2012-06-28 20:54:06 +000034282012-06-28 Oliver Hunt <oliver@apple.com>
3429
3430 32bit DFG incorrectly claims an fpr is fillable even if it has not been proven double
3431 https://bugs.webkit.org/show_bug.cgi?id=90127
3432
3433 Reviewed by Filip Pizlo.
3434
3435 The 32-bit version of fillSpeculateDouble doesn't handle Number->fpr loads
3436 correctly. This patch fixes this by killing the fill info in the GenerationInfo
3437 when the spillFormat doesn't guarantee the value is a double.
3438
3439 * dfg/DFGSpeculativeJIT32_64.cpp:
3440 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
3441
tkent@chromium.orgb53db042012-06-28 08:48:20 +000034422012-06-28 Kent Tamura <tkent@chromium.org>
3443
3444 Classify form control states by their owner forms
3445 https://bugs.webkit.org/show_bug.cgi?id=89950
3446
3447 Reviewed by Hajime Morita.
3448
3449 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3450 Expose WTF::StringBuilder::canShrink()
3451
msaboff@apple.comff141582012-06-28 01:14:20 +000034522012-06-27 Michael Saboff <msaboff@apple.com>
3453
3454 [Win] jscore-tests flakey
3455 https://bugs.webkit.org/show_bug.cgi?id=88118
3456
3457 Reviewed by Jessie Berlin.
3458
3459 jsDriver.pl on windows intermittently doesn't get the returned value from jsc,
3460 instead it gets 126. Added a new option to jsc (-x) which prints the exit
3461 code before exiting. jsDriver.pl uses this option on Windows and parses the
3462 exit code output for the exit code, removing it before comparing the actual
3463 and expected outputs. Filed a follow on "FIXME" defect:
3464 [WIN] Intermittent failure for jsc return value to propagate through jsDriver.pl
3465 https://bugs.webkit.org/show_bug.cgi?id=90119
3466
3467 * jsc.cpp:
3468 (CommandLine::CommandLine):
3469 (CommandLine):
3470 (printUsageStatement):
3471 (parseArguments):
3472 (jscmain):
3473 * tests/mozilla/jsDriver.pl:
3474 (execute_tests):
3475
commit-queue@webkit.orge12e2f32012-06-28 01:09:22 +000034762012-06-27 Sheriff Bot <webkit.review.bot@gmail.com>
3477
3478 Unreviewed, rolling out r121359.
3479 http://trac.webkit.org/changeset/121359
3480 https://bugs.webkit.org/show_bug.cgi?id=90115
3481
3482 Broke many inspector tests (Requested by jpfau on #webkit).
3483
3484 * interpreter/Interpreter.h:
3485 (JSC::StackFrame::toString):
3486
fpizlo@apple.com12c18392012-06-27 23:16:10 +000034872012-06-27 Filip Pizlo <fpizlo@apple.com>
3488
fpizlo@apple.comc01022e2012-06-28 00:49:55 +00003489 Javascript SHA-512 gives wrong hash on second and subsequent runs unless Web Inspector Javascript Debugging is on
3490 https://bugs.webkit.org/show_bug.cgi?id=90053
3491 <rdar://problem/11764613>
3492
3493 Reviewed by Mark Hahnenberg.
3494
3495 The problem is that the code was assuming that the recovery should be Undefined if the source of
3496 the SetLocal was !shouldGenerate(). But that's wrong, since the DFG optimizer may skip around a
3497 UInt32ToNumber node (hence making it !shouldGenerate()) and keep the source of that node alive.
3498 In that case we should base the recovery on the source of the UInt32ToNumber. The logic for this
3499 was already in place but the fast check for !shouldGenerate() broke it.
3500
3501 * dfg/DFGSpeculativeJIT.cpp:
3502 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
3503
35042012-06-27 Filip Pizlo <fpizlo@apple.com>
3505
fpizlo@apple.com12c18392012-06-27 23:16:10 +00003506 DFG disassembly should be easier to read
3507 https://bugs.webkit.org/show_bug.cgi?id=90106
3508
3509 Reviewed by Mark Hahnenberg.
3510
3511 Did a few things:
3512
3513 - Options::showDFGDisassembly now shows OSR exit disassembly as well.
3514
3515 - Phi node dumping doesn't attempt to do line wrapping since it just made the dump harder
3516 to read.
3517
3518 - DFG graph disassembly view shows a few additional node types that turn out to be
3519 essential for understanding OSR exits.
3520
3521 Put together, these changes reinforce the philosophy that anything needed for computing
3522 OSR exit is just as important as the machine code itself. Of course, we still don't take
3523 that philosophy to its full extreme - for example Phantom nodes are not dumped. We may
3524 revisit that in the future.
3525
3526 * assembler/LinkBuffer.cpp:
3527 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
3528 * assembler/LinkBuffer.h:
3529 (JSC):
3530 * dfg/DFGDisassembler.cpp:
3531 (JSC::DFG::Disassembler::dump):
3532 * dfg/DFGGraph.cpp:
3533 (JSC::DFG::Graph::dumpBlockHeader):
3534 * dfg/DFGNode.h:
3535 (JSC::DFG::Node::willHaveCodeGenOrOSR):
3536 * dfg/DFGOSRExitCompiler.cpp:
3537 * jit/JIT.cpp:
3538 (JSC::JIT::privateCompile):
3539
mhahnenberg@apple.come16f8092012-06-27 23:08:26 +000035402012-06-25 Mark Hahnenberg <mhahnenberg@apple.com>
3541
3542 JSLock should be per-JSGlobalData
3543 https://bugs.webkit.org/show_bug.cgi?id=89123
3544
3545 Reviewed by Geoffrey Garen.
3546
3547 * API/APIShims.h:
3548 (APIEntryShimWithoutLock):
3549 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Added an extra parameter to the constructor to
3550 determine whether we should ref the JSGlobalData or not. We want to ref all the time except for in the
3551 HeapTimer class because timerDidFire could run after somebody has started to tear down that particular
3552 JSGlobalData, so we wouldn't want to resurrect the ref count of that JSGlobalData from 0 back to 1 after
3553 its destruction has begun.
3554 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
3555 (JSC::APIEntryShim::APIEntryShim):
3556 (APIEntryShim):
3557 (JSC::APIEntryShim::~APIEntryShim):
3558 (JSC::APIEntryShim::init): Factored out common initialization code for the various APIEntryShim constructors.
3559 Also moved the timeoutChecker stop and start here because we need to start after we've grabbed the API lock
3560 and before we've released it, which can only done in APIEntryShim.
3561 (JSC::APICallbackShim::~APICallbackShim): We no longer need to synchronize here.
3562 * API/JSContextRef.cpp:
3563 (JSGlobalContextCreate):
3564 (JSGlobalContextCreateInGroup):
3565 (JSGlobalContextRelease):
3566 (JSContextCreateBacktrace):
3567 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3568 * heap/CopiedSpace.cpp:
3569 (JSC::CopiedSpace::tryAllocateSlowCase):
3570 * heap/Heap.cpp:
3571 (JSC::Heap::protect):
3572 (JSC::Heap::unprotect):
3573 (JSC::Heap::collect):
3574 (JSC::Heap::setActivityCallback):
3575 (JSC::Heap::activityCallback):
3576 (JSC::Heap::sweeper):
3577 * heap/Heap.h: Changed m_activityCallback and m_sweeper to be raw pointers rather than OwnPtrs because they
3578 are now responsible for their own lifetime. Also changed the order of declaration of the GCActivityCallback
3579 and the IncrementalSweeper to make sure they're the last things that get initialized during construction to
3580 prevent any issues with uninitialized memory in the JSGlobalData/Heap they might care about.
3581 (Heap):
3582 * heap/HeapTimer.cpp: Refactored to allow for thread-safe operation and shutdown.
3583 (JSC::HeapTimer::~HeapTimer):
3584 (JSC::HeapTimer::invalidate):
3585 (JSC):
3586 (JSC::HeapTimer::didStartVMShutdown): Called at the beginning of ~JSGlobalData. If we're on the same thread
3587 that the HeapTimer is running on, we kill the HeapTimer ourselves. If not, then we set some state in the
3588 HeapTimer and schedule it to fire immediately so that it can notice and kill itself.
3589 (JSC::HeapTimer::timerDidFire): We grab our mutex and check our JSGlobalData pointer. If it has been zero-ed
3590 out, then we know the VM has started to shutdown and we should kill ourselves. Otherwise, grab the APIEntryShim,
3591 but without ref-ing the JSGlobalData (we don't want to bring the JSGlobalData's ref-count from 0 to 1) in case
3592 we were interrupted between releasing our mutex and trying to grab the APILock.
3593 * heap/HeapTimer.h:
3594 (HeapTimer):
3595 * heap/IncrementalSweeper.cpp:
3596 (JSC::IncrementalSweeper::doWork): We no longer need the API shim here since HeapTimer::timerDidFire handles
3597 all of that for us.
3598 (JSC::IncrementalSweeper::create):
3599 * heap/IncrementalSweeper.h:
3600 (IncrementalSweeper):
3601 * heap/MarkedAllocator.cpp:
3602 (JSC::MarkedAllocator::allocateSlowCase):
3603 * heap/WeakBlock.cpp:
3604 (JSC::WeakBlock::reap):
3605 * jsc.cpp:
3606 (functionGC):
3607 (functionReleaseExecutableMemory):
3608 (jscmain):
3609 * runtime/Completion.cpp:
3610 (JSC::checkSyntax):
3611 (JSC::evaluate):
3612 * runtime/GCActivityCallback.h:
3613 (DefaultGCActivityCallback):
3614 (JSC::DefaultGCActivityCallback::create):
3615 * runtime/JSGlobalData.cpp:
3616 (JSC::JSGlobalData::JSGlobalData):
3617 (JSC::JSGlobalData::~JSGlobalData): Signals to the two HeapTimers (GCActivityCallback and IncrementalSweeper)
3618 that the VM has started shutting down. It then waits until the HeapTimer is done with whatever activity
3619 it needs to do before continuing with any further destruction. Also asserts that we do not currently hold the
3620 APILock because this could potentially cause deadlock when we try to signal to the HeapTimers using their mutexes.
3621 (JSC::JSGlobalData::sharedInstance): Protect the initialization for the shared instance with the GlobalJSLock.
3622 (JSC::JSGlobalData::sharedInstanceInternal):
3623 * runtime/JSGlobalData.h: Change to be ThreadSafeRefCounted so that we don't have to worry about refing and
3624 de-refing JSGlobalDatas on separate threads since we don't do it that often anyways.
3625 (JSGlobalData):
3626 (JSC::JSGlobalData::apiLock):
3627 * runtime/JSGlobalObject.cpp:
3628 (JSC::JSGlobalObject::~JSGlobalObject):
3629 (JSC::JSGlobalObject::init):
3630 * runtime/JSLock.cpp:
3631 (JSC):
3632 (JSC::GlobalJSLock::GlobalJSLock): For accessing the shared instance.
3633 (JSC::GlobalJSLock::~GlobalJSLock):
3634 (JSC::JSLockHolder::JSLockHolder): MutexLocker for JSLock. Also refs the JSGlobalData to keep it alive so that
3635 it can successfully unlock it later without it disappearing from underneath it.
3636 (JSC::JSLockHolder::~JSLockHolder):
3637 (JSC::JSLock::JSLock):
3638 (JSC::JSLock::~JSLock):
3639 (JSC::JSLock::lock): Uses the spin lock for guarding the lock count and owner thread fields. Uses the mutex for
3640 actually waiting for long periods.
3641 (JSC::JSLock::unlock):
3642 (JSC::JSLock::currentThreadIsHoldingLock):
3643 (JSC::JSLock::dropAllLocks):
3644 (JSC::JSLock::dropAllLocksUnconditionally):
3645 (JSC::JSLock::grabAllLocks):
3646 (JSC::JSLock::DropAllLocks::DropAllLocks):
3647 (JSC::JSLock::DropAllLocks::~DropAllLocks):
3648 * runtime/JSLock.h:
3649 (JSC):
3650 (GlobalJSLock):
3651 (JSLockHolder):
3652 (JSLock):
3653 (DropAllLocks):
3654 * runtime/WeakGCMap.h:
3655 (JSC::WeakGCMap::set):
3656 * testRegExp.cpp:
3657 (realMain):
3658
fpizlo@apple.coma8de6ba2012-06-27 21:25:23 +000036592012-06-27 Filip Pizlo <fpizlo@apple.com>
3660
fpizlo@apple.com4a4978b2012-06-27 21:45:08 +00003661 x86 disassembler confuses immediates with addresses
3662 https://bugs.webkit.org/show_bug.cgi?id=90099
3663
3664 Reviewed by Mark Hahnenberg.
3665
3666 Prepend "$" to immediates to disambiguate between immediates and addresses. This is in
3667 accordance with the gas and AT&T syntax.
3668
3669 * disassembler/udis86/udis86_syn-att.c:
3670 (gen_operand):
3671
36722012-06-27 Filip Pizlo <fpizlo@apple.com>
3673
fpizlo@apple.coma8de6ba2012-06-27 21:25:23 +00003674 Add a comment clarifying Options::showDisassembly versus Options::showDFGDisassembly.
3675
3676 Rubber stamped by Mark Hahnenberg.
3677
3678 * runtime/Options.cpp:
3679 (JSC::Options::initializeOptions):
3680
commit-queue@webkit.org50c978a2012-06-27 19:54:48 +000036812012-06-27 Anthony Scian <ascian@rim.com>
3682
3683 Web Inspector [JSC]: Implement ScriptCallStack::stackTrace
3684 https://bugs.webkit.org/show_bug.cgi?id=40118
3685
3686 Reviewed by Yong Li.
3687
3688 Added member functions to expose function name, urlString, and line #.
3689 Refactored toString to make use of these member functions to reduce
3690 duplicated code for future maintenance.
3691
3692 Manually tested refactoring of toString by tracing thrown exceptions.
3693
3694 * interpreter/Interpreter.h:
3695 (StackFrame):
3696 (JSC::StackFrame::toString):
3697 (JSC::StackFrame::friendlySourceURL):
3698 (JSC::StackFrame::friendlyFunctionName):
3699 (JSC::StackFrame::friendlyLineNumber):
3700
vestbo@webkit.org36e47da2012-06-27 13:02:03 +000037012012-06-27 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
3702
3703 [Qt] Remove redundant c++11 warning suppression code
3704
3705 This is already handled in default_post.
3706
3707 Reviewed by Tor Arne Vestbø.
3708
3709 * Target.pri:
3710
vestbo@webkit.orgcaf4d2f2012-06-27 11:30:42 +000037112012-06-26 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
3712
3713 [Qt] Add missing heades to HEADERS
3714
3715 For JavaScriptCore there aren't any Qt specific files, so we include all
3716 headers for easy editing in Qt Creator.
3717
3718 Reviewed by Simon Hausmann.
3719
3720 * Target.pri:
3721
dominicc@chromium.org5940f722012-06-27 09:44:31 +000037222012-06-26 Dominic Cooney <dominicc@chromium.org>
3723
3724 [Chromium] Remove unused build scripts and empty folders for JavaScriptCore w/ gyp
3725 https://bugs.webkit.org/show_bug.cgi?id=90029
3726
3727 Reviewed by Adam Barth.
3728
3729 * gyp: Removed.
3730 * gyp/generate-derived-sources.sh: Removed.
3731 * gyp/generate-dtrace-header.sh: Removed.
3732 * gyp/run-if-exists.sh: Removed.
3733 * gyp/update-info-plist.sh: Removed.
3734
ggaren@apple.com6b348072012-06-27 03:44:05 +000037352012-06-26 Geoffrey Garen <ggaren@apple.com>
3736
3737 Reduced (but did not eliminate) use of "berzerker GC"
3738 https://bugs.webkit.org/show_bug.cgi?id=89237
3739
3740 Reviewed by Gavin Barraclough.
3741
3742 (PART 2)
3743
3744 This part turns off "berzerker GC" and turns on incremental shrinking.
3745
3746 * heap/IncrementalSweeper.cpp:
3747 (JSC::IncrementalSweeper::doSweep): Free or shrink after sweeping to
3748 maintain the behavior we used to get from the occasional berzerker GC,
3749 which would run all finalizers and then free or shrink all blocks
3750 synchronously.
3751
3752 * heap/MarkedBlock.h:
3753 (JSC::MarkedBlock::needsSweeping): Sweep zapped blocks, too. It's always
3754 safe to sweep a zapped block (that's the point of zapping), and it's
3755 sometimes profitable. For example, consider this case: Block A does some
3756 allocation (transitioning Block A from Marked to FreeListed), then GC
3757 happens (transitioning Block A to Zapped), then all objects in Block A
3758 are free, then the incremental sweeper visits Block A. If we skipped
3759 Zapped blocks, we'd skip Block A, even though it would be profitable to
3760 run its destructors and free its memory.
3761
3762 * runtime/GCActivityCallback.cpp:
3763 (JSC::DefaultGCActivityCallback::doWork): Don't sweep eagerly; we'll do
3764 this incrementally.
3765
fpizlo@apple.com580d9d72012-06-27 01:34:01 +000037662012-06-26 Filip Pizlo <fpizlo@apple.com>
3767
3768 DFG PutByValAlias is too aggressive
3769 https://bugs.webkit.org/show_bug.cgi?id=90026
3770 <rdar://problem/11751830>
3771
3772 Reviewed by Gavin Barraclough.
3773
3774 For CSE on normal arrays, we now treat PutByVal as impure. This does not appear to affect
3775 performance by much.
3776
3777 For CSE on typed arrays, we fix PutByValAlias by making GetByVal speculate that the access
3778 is within bounds. This also has the effect of making our out-of-bounds handling consistent
3779 with WebCore.
3780
3781 * dfg/DFGCSEPhase.cpp:
3782 (JSC::DFG::CSEPhase::performNodeCSE):
3783 * dfg/DFGGraph.h:
3784 (JSC::DFG::Graph::byValIsPure):
3785 (JSC::DFG::Graph::clobbersWorld):
3786 * dfg/DFGNodeType.h:
3787 (DFG):
3788 * dfg/DFGSpeculativeJIT.cpp:
3789 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
3790 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
3791
commit-queue@webkit.org63a25eb2012-06-26 19:55:32 +000037922012-06-26 Yong Li <yoli@rim.com>
3793
3794 [BlackBerry] Add JSC statistics into about:memory
3795 https://bugs.webkit.org/show_bug.cgi?id=89779
3796
3797 Reviewed by Rob Buis.
3798
3799 Fix non-JIT build on BlackBerry broken by r121196.
3800
3801 * runtime/MemoryStatistics.cpp:
3802 (JSC::globalMemoryStatistics):
3803
fpizlo@apple.com6c89cd32012-06-26 19:42:05 +000038042012-06-25 Filip Pizlo <fpizlo@apple.com>
3805
3806 DFG::operationNewArray is unnecessarily slow, and may use the wrong array
3807 prototype when inlined
3808 https://bugs.webkit.org/show_bug.cgi?id=89821
3809
3810 Reviewed by Geoffrey Garen.
3811
3812 Fixes all array allocations to use the right structure, and hence the right prototype. Adds
3813 inlining of new Array(...) with a non-zero number of arguments. Optimizes allocations of
3814 empty arrays.
3815
3816 * dfg/DFGAbstractState.cpp:
3817 (JSC::DFG::AbstractState::execute):
3818 * dfg/DFGByteCodeParser.cpp:
3819 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
3820 * dfg/DFGCCallHelpers.h:
3821 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
3822 (CCallHelpers):
3823 * dfg/DFGNodeType.h:
3824 (DFG):
3825 * dfg/DFGOperations.cpp:
3826 * dfg/DFGOperations.h:
3827 * dfg/DFGPredictionPropagationPhase.cpp:
3828 (JSC::DFG::PredictionPropagationPhase::propagate):
3829 * dfg/DFGSpeculativeJIT.h:
3830 (JSC::DFG::SpeculativeJIT::callOperation):
3831 * dfg/DFGSpeculativeJIT32_64.cpp:
3832 (JSC::DFG::SpeculativeJIT::compile):
3833 * dfg/DFGSpeculativeJIT64.cpp:
3834 (JSC::DFG::SpeculativeJIT::compile):
3835 * runtime/JSArray.h:
3836 (JSC):
3837 (JSC::constructArray):
3838 * runtime/JSGlobalObject.h:
3839 (JSC):
3840 (JSC::constructArray):
3841
fpizlo@apple.com0b6ad50752012-06-26 09:22:45 +000038422012-06-26 Filip Pizlo <fpizlo@apple.com>
3843
3844 New fast/js/dfg-store-unexpected-value-into-argument-and-osr-exit.html fails on 32 bit
3845 https://bugs.webkit.org/show_bug.cgi?id=89953
3846
3847 Reviewed by Zoltan Herczeg.
3848
3849 DFG 32-bit JIT was confused about the difference between a predicted type and a
3850 proven type. This is easy to get confused about, since a local that is predicted int32
3851 almost always means that the local must be an int32 since speculations are hoisted to
3852 stores to locals. But that is less likely to be the case for arguments, where there is
3853 an additional least-upper-bounding step: any store to an argument with a weird type
3854 may force the argument to be any type.
3855
3856 This patch basically duplicates the functionality in DFGSpeculativeJIT64.cpp for
3857 GetLocal: the decision of whether to load a local as an int32 (or as an array, or as
3858 a boolean) is made based on the AbstractValue::m_type, which is a type proof, rather
3859 than the VariableAccessData::prediction(), which is a predicted type.
3860
3861 * dfg/DFGSpeculativeJIT32_64.cpp:
3862 (JSC::DFG::SpeculativeJIT::compile):
3863
fpizlo@apple.com41a1f0e2012-06-26 02:53:39 +000038642012-06-25 Filip Pizlo <fpizlo@apple.com>
3865
3866 JSC should try to make profiling deterministic because otherwise reproducing failures is
3867 nearly impossible
3868 https://bugs.webkit.org/show_bug.cgi?id=89940
3869
3870 Rubber stamped by Gavin Barraclough.
3871
3872 This rolls out the part of http://trac.webkit.org/changeset/121215 that introduced randomness
3873 into the system. Now, instead of randomizing the tier-up threshold, we always set it to an
3874 artificially low (and statically predetermined!) value. This gives most of the benefit of
3875 threshold randomization without actually making the system behave completely differently on
3876 each invocation.
3877
3878 * bytecode/ExecutionCounter.cpp:
3879 (JSC::ExecutionCounter::setThreshold):
3880 * runtime/Options.cpp:
3881 (Options):
3882 (JSC::Options::initializeOptions):
3883 * runtime/Options.h:
3884 (Options):
3885
fpizlo@apple.com3745dbc2012-06-26 02:14:07 +000038862012-06-22 Filip Pizlo <fpizlo@apple.com>
3887
3888 Value profiling should use tier-up threshold randomization to get more coverage
3889 https://bugs.webkit.org/show_bug.cgi?id=89802
3890
3891 Reviewed by Gavin Barraclough.
3892
3893 This patch causes both LLInt and Baseline JIT code to take the OSR slow path several
3894 times before actually doing OSR. If we take the OSR slow path before the execution
3895 count threshold is reached, then we just call CodeBlock::updateAllPredictions() to
3896 compute the current latest least-upper-bound SpecType of all values seen in each
3897 ValueProfile.
3898
3899 * bytecode/CodeBlock.cpp:
3900 (JSC::CodeBlock::stronglyVisitStrongReferences):
3901 (JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
3902 (JSC):
3903 (JSC::CodeBlock::updateAllPredictions):
3904 (JSC::CodeBlock::shouldOptimizeNow):
3905 * bytecode/CodeBlock.h:
3906 (JSC::CodeBlock::llintExecuteCounter):
3907 (JSC::CodeBlock::jitExecuteCounter):
3908 (CodeBlock):
3909 (JSC::CodeBlock::updateAllPredictions):
3910 * bytecode/ExecutionCounter.cpp:
3911 (JSC::ExecutionCounter::setThreshold):
3912 (JSC::ExecutionCounter::status):
3913 (JSC):
3914 * bytecode/ExecutionCounter.h:
3915 (JSC::ExecutionCounter::count):
3916 (ExecutionCounter):
3917 * dfg/DFGAbstractState.cpp:
3918 (JSC::DFG::AbstractState::execute):
3919 * dfg/DFGOperations.cpp:
3920 * dfg/DFGSpeculativeJIT.cpp:
3921 (JSC::DFG::SpeculativeJIT::compile):
3922 * jit/JITStubs.cpp:
3923 (JSC::DEFINE_STUB_FUNCTION):
3924 * llint/LLIntSlowPaths.cpp:
3925 (JSC::LLInt::jitCompileAndSetHeuristics):
3926 (JSC::LLInt::entryOSR):
3927 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
3928 * runtime/JSGlobalObject.cpp:
3929 (JSC::JSGlobalObject::JSGlobalObject):
3930 (JSC):
3931 * runtime/JSGlobalObject.h:
3932 (JSGlobalObject):
3933 (JSC::JSGlobalObject::weakRandomInteger):
3934 * runtime/Options.cpp:
3935 (Options):
3936 (JSC::Options::initializeOptions):
3937 * runtime/Options.h:
3938 (Options):
3939 * runtime/WeakRandom.h:
3940 (WeakRandom):
3941 (JSC::WeakRandom::seedUnsafe):
3942
commit-queue@webkit.orgd3790912012-06-26 00:08:19 +000039432012-06-25 Yong Li <yoli@rim.com>
3944
3945 [BlackBerry] Add JSC statistics into about:memory
3946 https://bugs.webkit.org/show_bug.cgi?id=89779
3947
3948 Reviewed by Rob Buis.
3949
3950 Add MemoryStatistics.cpp into build, and fill JITBytes for BlackBerry port.
3951
3952 * PlatformBlackBerry.cmake:
3953 * runtime/MemoryStatistics.cpp:
3954 (JSC::globalMemoryStatistics):
3955
zandobersek@gmail.coma6460e12012-06-23 13:41:40 +000039562012-06-23 Sheriff Bot <webkit.review.bot@gmail.com>
3957
3958 Unreviewed, rolling out r121058.
3959 http://trac.webkit.org/changeset/121058
3960 https://bugs.webkit.org/show_bug.cgi?id=89809
3961
3962 Patch causes plugins tests to crash in GTK debug builds
3963 (Requested by zdobersek on #webkit).
3964
3965 * API/APIShims.h:
3966 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock):
3967 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock):
3968 (APIEntryShimWithoutLock):
3969 (JSC::APIEntryShim::APIEntryShim):
3970 (APIEntryShim):
3971 (JSC::APICallbackShim::~APICallbackShim):
3972 * API/JSContextRef.cpp:
3973 (JSGlobalContextCreate):
3974 (JSGlobalContextCreateInGroup):
3975 (JSGlobalContextRelease):
3976 (JSContextCreateBacktrace):
3977 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
3978 * heap/CopiedSpace.cpp:
3979 (JSC::CopiedSpace::tryAllocateSlowCase):
3980 * heap/Heap.cpp:
3981 (JSC::Heap::protect):
3982 (JSC::Heap::unprotect):
3983 (JSC::Heap::collect):
3984 (JSC::Heap::setActivityCallback):
3985 (JSC::Heap::activityCallback):
3986 (JSC::Heap::sweeper):
3987 * heap/Heap.h:
3988 (Heap):
3989 * heap/HeapTimer.cpp:
3990 (JSC::HeapTimer::~HeapTimer):
3991 (JSC::HeapTimer::invalidate):
3992 (JSC::HeapTimer::timerDidFire):
3993 (JSC):
3994 * heap/HeapTimer.h:
3995 (HeapTimer):
3996 * heap/IncrementalSweeper.cpp:
3997 (JSC::IncrementalSweeper::doWork):
3998 (JSC::IncrementalSweeper::create):
3999 * heap/IncrementalSweeper.h:
4000 (IncrementalSweeper):
4001 * heap/MarkedAllocator.cpp:
4002 (JSC::MarkedAllocator::allocateSlowCase):
4003 * heap/WeakBlock.cpp:
4004 (JSC::WeakBlock::reap):
4005 * jsc.cpp:
4006 (functionGC):
4007 (functionReleaseExecutableMemory):
4008 (jscmain):
4009 * runtime/Completion.cpp:
4010 (JSC::checkSyntax):
4011 (JSC::evaluate):
4012 * runtime/GCActivityCallback.h:
4013 (DefaultGCActivityCallback):
4014 (JSC::DefaultGCActivityCallback::create):
4015 * runtime/JSGlobalData.cpp:
4016 (JSC::JSGlobalData::JSGlobalData):
4017 (JSC::JSGlobalData::~JSGlobalData):
4018 (JSC::JSGlobalData::sharedInstance):
4019 (JSC::JSGlobalData::sharedInstanceInternal):
4020 * runtime/JSGlobalData.h:
4021 (JSGlobalData):
4022 * runtime/JSGlobalObject.cpp:
4023 (JSC::JSGlobalObject::~JSGlobalObject):
4024 (JSC::JSGlobalObject::init):
4025 * runtime/JSLock.cpp:
4026 (JSC):
4027 (JSC::createJSLockCount):
4028 (JSC::JSLock::lockCount):
4029 (JSC::setLockCount):
4030 (JSC::JSLock::JSLock):
4031 (JSC::JSLock::lock):
4032 (JSC::JSLock::unlock):
4033 (JSC::JSLock::currentThreadIsHoldingLock):
4034 (JSC::JSLock::DropAllLocks::DropAllLocks):
4035 (JSC::JSLock::DropAllLocks::~DropAllLocks):
4036 * runtime/JSLock.h:
4037 (JSC):
4038 (JSLock):
4039 (JSC::JSLock::JSLock):
4040 (JSC::JSLock::~JSLock):
4041 (DropAllLocks):
4042 * runtime/WeakGCMap.h:
4043 (JSC::WeakGCMap::set):
4044 * testRegExp.cpp:
4045 (realMain):
4046
achicu@adobe.comcead7612012-06-23 01:23:48 +000040472012-06-22 Alexandru Chiculita <achicu@adobe.com>
4048
4049 [CSS Shaders] Re-enable the CSS Shaders compile time flag on Safari Mac
4050 https://bugs.webkit.org/show_bug.cgi?id=89781
4051
4052 Reviewed by Dean Jackson.
4053
4054 Added ENABLE_CSS_SHADERS flag as enabled by default on Safari for Mac.
4055
4056 * Configurations/FeatureDefines.xcconfig:
4057
fpizlo@apple.com16e2cbf2012-06-22 23:32:59 +000040582012-06-22 Filip Pizlo <fpizlo@apple.com>
4059
4060 DFG tier-up should happen in prologues, not epilogues
4061 https://bugs.webkit.org/show_bug.cgi?id=89752
4062
4063 Reviewed by Geoffrey Garen.
4064
4065 This change has two outcomes:
4066
4067 1) Slightly reduces the likelihood that a function will be optimized both
4068 standalone and via inlining. Previously, if you had a call sequence like foo()
4069 calls bar() exactly once, and nobody else calls bar(), then bar() would get
4070 optimized first (because it returns first) and then foo() gets optimized. If foo()
4071 can inline bar() then that means that bar() gets optimized twice. But now, if we
4072 optimize in prologues, then foo() will be optimized first. If it inlines bar(),
4073 that means that there will no longer be any calls to bar().
4074
4075 2) It lets us kill some code in JITStubs. Epilogue tier-up was very different from
4076 loop tier-up, since epilogue tier-up should not attempt OSR. But prologue tier-up
4077 requires OSR (albeit really easy OSR since it's the top of the compilation unit),
4078 so it becomes just like loop tier-up. As a result, we now have one optimization
4079 hook (cti_optimize) instead of two (cti_optimize_from_loop and
4080 cti_optimize_from_ret).
4081
4082 As a consequence of not having an optimization check in epilogues, the OSR exit
4083 code must now trigger reoptimization itself instead of just signaling the epilogue
4084 check to fire.
4085
4086 This also adds the ability to count the number of DFG compilations, which was
4087 useful for debugging this patch and might be useful for other things in the future.
4088
4089 * bytecode/CodeBlock.cpp:
4090 (JSC::CodeBlock::reoptimize):
4091 (JSC):
4092 * bytecode/CodeBlock.h:
4093 (CodeBlock):
4094 * dfg/DFGByteCodeParser.cpp:
4095 (JSC::DFG::ByteCodeParser::parseCodeBlock):
4096 * dfg/DFGDriver.cpp:
4097 (DFG):
4098 (JSC::DFG::getNumCompilations):
4099 (JSC::DFG::compile):
4100 * dfg/DFGDriver.h:
4101 (DFG):
4102 * dfg/DFGOSRExitCompiler.cpp:
4103 (JSC::DFG::OSRExitCompiler::handleExitCounts):
4104 * dfg/DFGOperations.cpp:
4105 * dfg/DFGOperations.h:
4106 * jit/JIT.cpp:
4107 (JSC::JIT::emitOptimizationCheck):
4108 * jit/JIT.h:
4109 * jit/JITCall32_64.cpp:
4110 (JSC::JIT::emit_op_ret):
4111 (JSC::JIT::emit_op_ret_object_or_this):
4112 * jit/JITOpcodes.cpp:
4113 (JSC::JIT::emit_op_ret):
4114 (JSC::JIT::emit_op_ret_object_or_this):
4115 (JSC::JIT::emit_op_enter):
4116 * jit/JITOpcodes32_64.cpp:
4117 (JSC::JIT::emit_op_enter):
4118 * jit/JITStubs.cpp:
4119 (JSC::DEFINE_STUB_FUNCTION):
4120 * jit/JITStubs.h:
4121
mhahnenberg@apple.com6d9f86d2012-06-22 21:42:46 +000041222012-06-20 Mark Hahnenberg <mhahnenberg@apple.com>
4123
4124 JSLock should be per-JSGlobalData
4125 https://bugs.webkit.org/show_bug.cgi?id=89123
4126
4127 Reviewed by Gavin Barraclough.
4128
4129 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
4130 * API/APIShims.h:
4131 (APIEntryShimWithoutLock):
4132 (JSC::APIEntryShimWithoutLock::APIEntryShimWithoutLock): Added an extra parameter to the constructor to
4133 determine whether we should ref the JSGlobalData or not. We want to ref all the time except for in the
4134 HeapTimer class because timerDidFire could run after somebody has started to tear down that particular
4135 JSGlobalData, so we wouldn't want to resurrect the ref count of that JSGlobalData from 0 back to 1 after
4136 its destruction has begun.
4137 (JSC::APIEntryShimWithoutLock::~APIEntryShimWithoutLock): Now derefs if it also refed.
4138 (JSC::APIEntryShim::APIEntryShim):
4139 (APIEntryShim):
4140 (JSC::APIEntryShim::~APIEntryShim):
4141 (JSC::APIEntryShim::init): Factored out common initialization code for the various APIEntryShim constructors.
4142 Also moved the timeoutChecker stop and start here because we need to start after we've grabbed the API lock
4143 and before we've released it, which can only done in APIEntryShim.
4144 (JSC::APICallbackShim::~APICallbackShim): We no longer need to synchronize here.
4145 * API/JSContextRef.cpp:
4146 (JSGlobalContextCreate):
4147 (JSGlobalContextCreateInGroup):
4148 (JSGlobalContextRelease):
4149 (JSContextCreateBacktrace):
4150 * heap/CopiedSpace.cpp:
4151 (JSC::CopiedSpace::tryAllocateSlowCase):
4152 * heap/Heap.cpp:
4153 (JSC::Heap::protect):
4154 (JSC::Heap::unprotect):
4155 (JSC::Heap::collect):
4156 (JSC::Heap::setActivityCallback):
4157 (JSC::Heap::activityCallback):
4158 (JSC::Heap::sweeper):
4159 * heap/Heap.h: Changed m_activityCallback and m_sweeper to be raw pointers rather than OwnPtrs because they
4160 are now responsible for their own lifetime. Also changed the order of declaration of the GCActivityCallback
4161 and the IncrementalSweeper to make sure they're the last things that get initialized during construction to
4162 prevent any issues with uninitialized memory in the JSGlobalData/Heap they might care about.
4163 (Heap):
4164 * heap/HeapTimer.cpp: Refactored to allow for thread-safe operation and shutdown.
4165 (JSC::HeapTimer::~HeapTimer):
4166 (JSC::HeapTimer::invalidate):
4167 (JSC):
4168 (JSC::HeapTimer::didStartVMShutdown): Called at the beginning of ~JSGlobalData. If we're on the same thread
4169 that the HeapTimer is running on, we kill the HeapTimer ourselves. If not, then we set some state in the
4170 HeapTimer and schedule it to fire immediately so that it can notice and kill itself.
4171 (JSC::HeapTimer::timerDidFire): We grab our mutex and check our JSGlobalData pointer. If it has been zero-ed
4172 out, then we know the VM has started to shutdown and we should kill ourselves. Otherwise, grab the APIEntryShim,
4173 but without ref-ing the JSGlobalData (we don't want to bring the JSGlobalData's ref-count from 0 to 1) in case
4174 we were interrupted between releasing our mutex and trying to grab the APILock.
4175 * heap/HeapTimer.h:
4176 (HeapTimer):
4177 * heap/IncrementalSweeper.cpp:
4178 (JSC::IncrementalSweeper::doWork): We no longer need the API shim here since HeapTimer::timerDidFire handles
4179 all of that for us.
4180 (JSC::IncrementalSweeper::create):
4181 * heap/IncrementalSweeper.h:
4182 (IncrementalSweeper):
4183 * heap/MarkedAllocator.cpp:
4184 (JSC::MarkedAllocator::allocateSlowCase):
4185 * heap/WeakBlock.cpp:
4186 (JSC::WeakBlock::reap):
4187 * jsc.cpp:
4188 (functionGC):
4189 (functionReleaseExecutableMemory):
4190 (jscmain):
4191 * runtime/Completion.cpp:
4192 (JSC::checkSyntax):
4193 (JSC::evaluate):
4194 * runtime/GCActivityCallback.h:
4195 (DefaultGCActivityCallback):
4196 (JSC::DefaultGCActivityCallback::create):
4197 * runtime/JSGlobalData.cpp:
4198 (JSC::JSGlobalData::JSGlobalData):
4199 (JSC::JSGlobalData::~JSGlobalData): Signals to the two HeapTimers (GCActivityCallback and IncrementalSweeper)
4200 that the VM has started shutting down. It then waits until the HeapTimer is done with whatever activity
4201 it needs to do before continuing with any further destruction. Also asserts that we do not currently hold the
4202 APILock because this could potentially cause deadlock when we try to signal to the HeapTimers using their mutexes.
4203 (JSC::JSGlobalData::sharedInstance): Protect the initialization for the shared instance with the GlobalJSLock.
4204 (JSC::JSGlobalData::sharedInstanceInternal):
4205 * runtime/JSGlobalData.h: Change to be ThreadSafeRefCounted so that we don't have to worry about refing and
4206 de-refing JSGlobalDatas on separate threads since we don't do it that often anyways.
4207 (JSGlobalData):
4208 (JSC::JSGlobalData::apiLock):
4209 * runtime/JSGlobalObject.cpp:
4210 (JSC::JSGlobalObject::~JSGlobalObject):
4211 (JSC::JSGlobalObject::init):
4212 * runtime/JSLock.cpp:
4213 (JSC):
4214 (JSC::GlobalJSLock::GlobalJSLock): For accessing the shared instance.
4215 (JSC::GlobalJSLock::~GlobalJSLock):
4216 (JSC::JSLockHolder::JSLockHolder): MutexLocker for JSLock. Also refs the JSGlobalData to keep it alive so that
4217 it can successfully unlock it later without it disappearing from underneath it.
4218 (JSC::JSLockHolder::~JSLockHolder):
4219 (JSC::JSLock::JSLock):
4220 (JSC::JSLock::~JSLock):
4221 (JSC::JSLock::lock): Uses the spin lock for guarding the lock count and owner thread fields. Uses the mutex for
4222 actually waiting for long periods.
4223 (JSC::JSLock::unlock):
4224 (JSC::JSLock::currentThreadIsHoldingLock):
4225 (JSC::JSLock::dropAllLocks):
4226 (JSC::JSLock::dropAllLocksUnconditionally):
4227 (JSC::JSLock::grabAllLocks):
4228 (JSC::JSLock::DropAllLocks::DropAllLocks):
4229 (JSC::JSLock::DropAllLocks::~DropAllLocks):
4230 * runtime/JSLock.h:
4231 (JSC):
4232 (GlobalJSLock):
4233 (JSLockHolder):
4234 (JSLock):
4235 (DropAllLocks):
4236 * runtime/WeakGCMap.h:
4237 (JSC::WeakGCMap::set):
4238 * testRegExp.cpp:
4239 (realMain):
4240
peter@chromium.org166f5bb2012-06-22 16:20:33 +000042412012-06-22 Peter Beverloo <peter@chromium.org>
4242
4243 [Chromium] Disable c++0x compatibility warnings in JavaScriptCore.gyp when building for Android
4244 https://bugs.webkit.org/show_bug.cgi?id=88853
4245
4246 Reviewed by Steve Block.
4247
4248 The Android exclusions were necessary to fix a gyp generation error, as
4249 the gcc_version variable wasn't being defined for Android. Remove these
4250 exceptions when Chromium is able to define the gcc_version variable.
4251
4252 * JavaScriptCore.gyp/JavaScriptCore.gyp:
4253
fpizlo@apple.com90011802012-06-22 01:33:30 +000042542012-06-21 Filip Pizlo <fpizlo@apple.com>
4255
4256 op_resolve_global should not prevent DFG inlining
4257 https://bugs.webkit.org/show_bug.cgi?id=89726
4258
4259 Reviewed by Gavin Barraclough.
4260
4261 * bytecode/CodeBlock.cpp:
4262 (JSC::CodeBlock::CodeBlock):
4263 (JSC::CodeBlock::shrinkToFit):
4264 * bytecode/GlobalResolveInfo.h:
4265 (JSC::GlobalResolveInfo::GlobalResolveInfo):
4266 (GlobalResolveInfo):
4267 * dfg/DFGByteCodeParser.cpp:
4268 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
4269 * dfg/DFGCapabilities.h:
4270 (JSC::DFG::canInlineOpcode):
4271 * dfg/DFGOperations.cpp:
4272 * dfg/DFGOperations.h:
4273 * dfg/DFGSpeculativeJIT.h:
4274 (JSC::DFG::SpeculativeJIT::callOperation):
4275 * dfg/DFGSpeculativeJIT32_64.cpp:
4276 (JSC::DFG::SpeculativeJIT::compile):
4277 * dfg/DFGSpeculativeJIT64.cpp:
4278 (JSC::DFG::SpeculativeJIT::compile):
4279
fpizlo@apple.com618044d2012-06-21 22:55:42 +000042802012-06-20 Filip Pizlo <fpizlo@apple.com>
4281
4282 DFG should inline 'new Array()'
4283 https://bugs.webkit.org/show_bug.cgi?id=89632
4284
4285 Reviewed by Geoffrey Garen.
4286
4287 This adds support for treating InternalFunction like intrinsics. The code
4288 to do so is actually quite clean, so I don't feel bad about perpetuating
4289 the InternalFunction vs. JSFunction-with-NativeExecutable dichotomy.
4290
4291 Currently this newfound power is only used to inline 'new Array()'.
4292
4293 * dfg/DFGByteCodeParser.cpp:
4294 (ByteCodeParser):
4295 (JSC::DFG::ByteCodeParser::handleCall):
4296 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
4297 (DFG):
4298 * dfg/DFGGraph.h:
4299 (JSC::DFG::Graph::isInternalFunctionConstant):
4300 (JSC::DFG::Graph::valueOfInternalFunctionConstant):
4301
mhahnenberg@apple.coma2373032012-06-21 22:38:39 +000043022012-06-21 Mark Hahnenberg <mhahnenberg@apple.com>
4303
4304 Adding copyrights to new files.
4305
4306 * heap/HeapTimer.cpp:
4307 * heap/HeapTimer.h:
4308 * heap/IncrementalSweeper.cpp:
4309 * heap/IncrementalSweeper.h:
4310
commit-queue@webkit.orgc8209e72012-06-21 17:34:26 +000043112012-06-21 Arnaud Renevier <arno@renevier.net>
4312
4313 make sure headers are included only once per file
4314 https://bugs.webkit.org/show_bug.cgi?id=88922
4315
4316 Reviewed by Alexey Proskuryakov.
4317
4318 * bytecode/CodeBlock.h:
4319 * heap/MachineStackMarker.cpp:
4320 * runtime/JSVariableObject.h:
4321
commit-queue@webkit.orgbff9a102012-06-21 15:46:40 +000043222012-06-21 Ryuan Choi <ryuan.choi@gmail.com>
4323
4324 [EFL][WK2] Make WebKit2/Efl headers and resources installable.
4325 https://bugs.webkit.org/show_bug.cgi?id=88207
4326
4327 Reviewed by Chang Shu.
4328
4329 * shell/CMakeLists.txt: Use ${EXEC_INSTALL_DIR} instead of hardcoding "bin"
4330
ggaren@apple.com4b67d0d2012-06-21 02:00:08 +000043312012-06-20 Geoffrey Garen <ggaren@apple.com>
4332
4333 Reduced (but did not eliminate) use of "berzerker GC"
4334 https://bugs.webkit.org/show_bug.cgi?id=89237
4335
4336 Reviewed by Gavin Barraclough.
4337
4338 (PART 1)
4339
4340 This patch turned out to be crashy, so I'm landing the non-crashy bits
4341 first.
4342
4343 This part is pre-requisite refactoring. I didn't actually turn off
4344 "berzerker GC" or turn on incremental shrinking.
4345
4346 * heap/MarkedAllocator.cpp:
4347 (JSC::MarkedAllocator::removeBlock): Make sure to clear the free list when
4348 we throw away the block we're currently allocating out of. Otherwise, we'll
4349 allocate out of a stale free list.
4350
4351 * heap/MarkedSpace.cpp:
4352 (JSC::Free::Free):
4353 (JSC::Free::operator()):
4354 (JSC::Free::returnValue): Refactored this functor to use a shared helper
4355 function, so we can share our implementation with the incremental sweeper.
4356
4357 Also changed to freeing individual blocks immediately instead of linking
4358 them into a list for later freeing. This makes the programming interface
4359 simpler, and it's slightly more efficient to boot.
4360
4361 (JSC::MarkedSpace::~MarkedSpace): Updated for rename.
4362
4363 (JSC::MarkedSpace::freeBlock):
4364 (JSC::MarkedSpace::freeOrShrinkBlock): New helper functions to share behavior
4365 with the incremental sweeper.
4366
4367 (JSC::MarkedSpace::shrink): Updated for new functor behavior.
4368
4369 * heap/MarkedSpace.h: Statically typed languages are awesome.
4370
fpizlo@apple.com8c462122012-06-20 21:07:33 +000043712012-06-20 Filip Pizlo <fpizlo@apple.com>
4372
fpizlo@apple.com3bcb2112012-06-21 01:38:49 +00004373 DFG should optimize ResolveGlobal
4374 https://bugs.webkit.org/show_bug.cgi?id=89617
4375
4376 Reviewed by Oliver Hunt.
4377
4378 This adds inlining of ResolveGlobal accesses that are known monomorphic. It also
4379 adds the specific function optimization to ResolveGlobal, when it is inlined. And,
4380 it makes internal functions act like specific functions, since that will be the
4381 most common use-case of this optimization.
4382
4383 This is only a slighy speed-up (sub 1%), since we don't yet do the obvious thing
4384 with this optimization, which is to completely inline common "globally resolved"
4385 function and constructor calls, like "new Array()".
4386
4387 * CMakeLists.txt:
4388 * GNUmakefile.list.am:
4389 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
4390 * JavaScriptCore.xcodeproj/project.pbxproj:
4391 * Target.pri:
4392 * bytecode/CodeBlock.cpp:
4393 (JSC::CodeBlock::globalResolveInfoForBytecodeOffset):
4394 * bytecode/CodeBlock.h:
4395 (CodeBlock):
4396 (JSC::CodeBlock::numberOfGlobalResolveInfos):
4397 * bytecode/GlobalResolveInfo.h:
4398 (JSC::getGlobalResolveInfoBytecodeOffset):
4399 (JSC):
4400 * bytecode/ResolveGlobalStatus.cpp: Added.
4401 (JSC):
4402 (JSC::computeForStructure):
4403 (JSC::computeForLLInt):
4404 (JSC::ResolveGlobalStatus::computeFor):
4405 * bytecode/ResolveGlobalStatus.h: Added.
4406 (JSC):
4407 (ResolveGlobalStatus):
4408 (JSC::ResolveGlobalStatus::ResolveGlobalStatus):
4409 (JSC::ResolveGlobalStatus::state):
4410 (JSC::ResolveGlobalStatus::isSet):
4411 (JSC::ResolveGlobalStatus::operator!):
4412 (JSC::ResolveGlobalStatus::isSimple):
4413 (JSC::ResolveGlobalStatus::takesSlowPath):
4414 (JSC::ResolveGlobalStatus::structure):
4415 (JSC::ResolveGlobalStatus::offset):
4416 (JSC::ResolveGlobalStatus::specificValue):
4417 * dfg/DFGByteCodeParser.cpp:
4418 (ByteCodeParser):
4419 (JSC::DFG::ByteCodeParser::handleGetByOffset):
4420 (DFG):
4421 (JSC::DFG::ByteCodeParser::handleGetById):
4422 (JSC::DFG::ByteCodeParser::parseBlock):
4423 * runtime/JSObject.cpp:
4424 (JSC::getCallableObjectSlow):
4425 (JSC):
4426 (JSC::JSObject::put):
4427 (JSC::JSObject::putDirectVirtual):
4428 (JSC::JSObject::putDirectAccessor):
4429 * runtime/JSObject.h:
4430 (JSC):
4431 (JSC::getCallableObject):
4432 (JSC::JSObject::putOwnDataProperty):
4433 (JSC::JSObject::putDirect):
4434 (JSC::JSObject::putDirectWithoutTransition):
4435
44362012-06-20 Filip Pizlo <fpizlo@apple.com>
4437
fpizlo@apple.com2e368f72012-06-20 23:55:18 +00004438 Functions on global objects should be specializable
4439 https://bugs.webkit.org/show_bug.cgi?id=89615
4440
4441 Reviewed by Oliver Hunt.
4442
4443 I tested to see if this brought back the bug in https://bugs.webkit.org/show_bug.cgi?id=33343,
4444 and it didn't. Bug 33343 was the reason why we disabled global object function specialization
4445 to begin with. So I'm guessing this is safe.
4446
4447 * runtime/JSGlobalObject.cpp:
4448 (JSC::JSGlobalObject::init):
4449
44502012-06-20 Filip Pizlo <fpizlo@apple.com>
4451
fpizlo@apple.com8c462122012-06-20 21:07:33 +00004452 build-webkit failure due to illegal 32-bit integer constants in code
4453 generated by offlineasm
4454 https://bugs.webkit.org/show_bug.cgi?id=89347
4455
4456 Reviewed by Geoffrey Garen.
4457
4458 The offending constants are the magic numbers used by offlineasm to find
4459 offsets in the generated machine code. Added code to turn them into what
4460 the C++ compiler will believe to be valid 32-bit values.
4461
4462 * offlineasm/offsets.rb:
4463
ggaren@apple.com30ef2b32012-06-20 18:24:02 +000044642012-06-19 Geoffrey Garen <ggaren@apple.com>
4465
4466 Made the incremental sweeper more aggressive
4467 https://bugs.webkit.org/show_bug.cgi?id=89527
4468
4469 Reviewed by Oliver Hunt.
4470
4471 This is a pre-requisite to getting rid of "berzerker GC" because we need
4472 the sweeper to reclaim memory in a timely fashion, or we'll see a memory
4473 footprint regression.
4474
4475 * heap/IncrementalSweeper.h:
4476 * heap/IncrementalSweeper.cpp:
4477 (JSC::IncrementalSweeper::scheduleTimer): Since the time slice is predictable,
4478 no need to use a data member to record it.
4479
4480 (JSC::IncrementalSweeper::doSweep): Sweep as many blocks as we can in a
4481 small time slice. This is better than sweeping only one block per timer
4482 fire because that strategy has a heavy timer overhead, and artificially
4483 delays memory reclamation.
4484
fpizlo@apple.com3d517672012-06-20 17:48:23 +000044852012-06-20 Filip Pizlo <fpizlo@apple.com>
4486
4487 DFG should be able to print disassembly interleaved with the IR
4488 https://bugs.webkit.org/show_bug.cgi?id=89551
4489
4490 Reviewed by Geoffrey Garen.
fpizlo@apple.come245b3f2012-06-20 17:51:07 +00004491
4492 This change also removes running Dominators unconditionally on every DFG
4493 compile. Dominators are designed to be computed on-demand, and currently
4494 the only demand is graph dumps.
fpizlo@apple.com3d517672012-06-20 17:48:23 +00004495
4496 * CMakeLists.txt:
4497 * GNUmakefile.list.am:
4498 * JavaScriptCore.xcodeproj/project.pbxproj:
4499 * Target.pri:
4500 * assembler/ARMv7Assembler.h:
4501 (JSC::ARMv7Assembler::labelIgnoringWatchpoints):
4502 (ARMv7Assembler):
4503 * assembler/AbstractMacroAssembler.h:
4504 (AbstractMacroAssembler):
4505 (JSC::AbstractMacroAssembler::labelIgnoringWatchpoints):
4506 * assembler/X86Assembler.h:
4507 (X86Assembler):
4508 (JSC::X86Assembler::labelIgnoringWatchpoints):
4509 * dfg/DFGCommon.h:
4510 (JSC::DFG::shouldShowDisassembly):
4511 (DFG):
4512 * dfg/DFGDisassembler.cpp: Added.
4513 (DFG):
4514 (JSC::DFG::Disassembler::Disassembler):
4515 (JSC::DFG::Disassembler::dump):
4516 (JSC::DFG::Disassembler::dumpDisassembly):
4517 * dfg/DFGDisassembler.h: Added.
4518 (DFG):
4519 (Disassembler):
4520 (JSC::DFG::Disassembler::setStartOfCode):
4521 (JSC::DFG::Disassembler::setForBlock):
4522 (JSC::DFG::Disassembler::setForNode):
4523 (JSC::DFG::Disassembler::setEndOfMainPath):
4524 (JSC::DFG::Disassembler::setEndOfCode):
4525 * dfg/DFGDriver.cpp:
4526 (JSC::DFG::compile):
4527 * dfg/DFGGraph.cpp:
4528 (JSC::DFG::Graph::dumpCodeOrigin):
4529 (JSC::DFG::Graph::amountOfNodeWhiteSpace):
4530 (DFG):
4531 (JSC::DFG::Graph::printNodeWhiteSpace):
4532 (JSC::DFG::Graph::dump):
4533 (JSC::DFG::Graph::dumpBlockHeader):
4534 * dfg/DFGGraph.h:
4535 * dfg/DFGJITCompiler.cpp:
4536 (JSC::DFG::JITCompiler::JITCompiler):
4537 (DFG):
4538 (JSC::DFG::JITCompiler::compile):
4539 (JSC::DFG::JITCompiler::compileFunction):
4540 * dfg/DFGJITCompiler.h:
4541 (JITCompiler):
4542 (JSC::DFG::JITCompiler::setStartOfCode):
4543 (JSC::DFG::JITCompiler::setForBlock):
4544 (JSC::DFG::JITCompiler::setForNode):
4545 (JSC::DFG::JITCompiler::setEndOfMainPath):
4546 (JSC::DFG::JITCompiler::setEndOfCode):
4547 * dfg/DFGNode.h:
4548 (Node):
4549 (JSC::DFG::Node::willHaveCodeGen):
4550 * dfg/DFGNodeFlags.cpp:
4551 (JSC::DFG::nodeFlagsAsString):
4552 * dfg/DFGSpeculativeJIT.cpp:
4553 (JSC::DFG::SpeculativeJIT::compile):
4554 * dfg/DFGSpeculativeJIT.h:
4555 (SpeculativeJIT):
4556 * runtime/Options.cpp:
4557 (Options):
4558 (JSC::Options::initializeOptions):
4559 * runtime/Options.h:
4560 (Options):
4561
fpizlo@apple.com2adf5272012-06-20 01:33:30 +000045622012-06-19 Filip Pizlo <fpizlo@apple.com>
4563
4564 JSC should be able to show disassembly for all generated JIT code
4565 https://bugs.webkit.org/show_bug.cgi?id=89536
4566
4567 Reviewed by Gavin Barraclough.
4568
4569 Now instead of doing linkBuffer.finalizeCode(), you do
4570 FINALIZE_CODE(linkBuffer, (... explanation ...)). FINALIZE_CODE() then
4571 prints your explanation and the disassembled code, if
4572 Options::showDisassembly is set to true.
4573
4574 * CMakeLists.txt:
4575 * GNUmakefile.list.am:
4576 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4577 * JavaScriptCore.xcodeproj/project.pbxproj:
4578 * Target.pri:
4579 * assembler/LinkBuffer.cpp: Added.
4580 (JSC):
4581 (JSC::LinkBuffer::finalizeCodeWithoutDisassembly):
4582 (JSC::LinkBuffer::finalizeCodeWithDisassembly):
4583 (JSC::LinkBuffer::linkCode):
4584 (JSC::LinkBuffer::performFinalization):
4585 (JSC::LinkBuffer::dumpLinkStatistics):
4586 (JSC::LinkBuffer::dumpCode):
4587 * assembler/LinkBuffer.h:
4588 (LinkBuffer):
4589 (JSC):
4590 * assembler/MacroAssemblerCodeRef.h:
4591 (JSC::MacroAssemblerCodeRef::tryToDisassemble):
4592 (MacroAssemblerCodeRef):
4593 * dfg/DFGJITCompiler.cpp:
4594 (JSC::DFG::JITCompiler::compile):
4595 (JSC::DFG::JITCompiler::compileFunction):
4596 * dfg/DFGOSRExitCompiler.cpp:
4597 * dfg/DFGRepatch.cpp:
4598 (JSC::DFG::generateProtoChainAccessStub):
4599 (JSC::DFG::tryCacheGetByID):
4600 (JSC::DFG::tryBuildGetByIDList):
4601 (JSC::DFG::emitPutReplaceStub):
4602 (JSC::DFG::emitPutTransitionStub):
4603 * dfg/DFGThunks.cpp:
4604 (JSC::DFG::osrExitGenerationThunkGenerator):
4605 * disassembler/Disassembler.h:
4606 (JSC):
4607 (JSC::tryToDisassemble):
4608 * disassembler/UDis86Disassembler.cpp:
4609 (JSC::tryToDisassemble):
4610 * jit/JIT.cpp:
4611 (JSC::JIT::privateCompile):
4612 * jit/JITCode.h:
4613 (JSC::JITCode::tryToDisassemble):
4614 * jit/JITOpcodes.cpp:
4615 (JSC::JIT::privateCompileCTIMachineTrampolines):
4616 * jit/JITOpcodes32_64.cpp:
4617 (JSC::JIT::privateCompileCTIMachineTrampolines):
4618 (JSC::JIT::privateCompileCTINativeCall):
4619 * jit/JITPropertyAccess.cpp:
4620 (JSC::JIT::stringGetByValStubGenerator):
4621 (JSC::JIT::privateCompilePutByIdTransition):
4622 (JSC::JIT::privateCompilePatchGetArrayLength):
4623 (JSC::JIT::privateCompileGetByIdProto):
4624 (JSC::JIT::privateCompileGetByIdSelfList):
4625 (JSC::JIT::privateCompileGetByIdProtoList):
4626 (JSC::JIT::privateCompileGetByIdChainList):
4627 (JSC::JIT::privateCompileGetByIdChain):
4628 * jit/JITPropertyAccess32_64.cpp:
4629 (JSC::JIT::stringGetByValStubGenerator):
4630 (JSC::JIT::privateCompilePutByIdTransition):
4631 (JSC::JIT::privateCompilePatchGetArrayLength):
4632 (JSC::JIT::privateCompileGetByIdProto):
4633 (JSC::JIT::privateCompileGetByIdSelfList):
4634 (JSC::JIT::privateCompileGetByIdProtoList):
4635 (JSC::JIT::privateCompileGetByIdChainList):
4636 (JSC::JIT::privateCompileGetByIdChain):
4637 * jit/SpecializedThunkJIT.h:
4638 (JSC::SpecializedThunkJIT::finalize):
4639 * jit/ThunkGenerators.cpp:
4640 (JSC::charCodeAtThunkGenerator):
4641 (JSC::charAtThunkGenerator):
4642 (JSC::fromCharCodeThunkGenerator):
4643 (JSC::sqrtThunkGenerator):
4644 (JSC::floorThunkGenerator):
4645 (JSC::ceilThunkGenerator):
4646 (JSC::roundThunkGenerator):
4647 (JSC::expThunkGenerator):
4648 (JSC::logThunkGenerator):
4649 (JSC::absThunkGenerator):
4650 (JSC::powThunkGenerator):
4651 * llint/LLIntThunks.cpp:
4652 (JSC::LLInt::generateThunkWithJumpTo):
4653 (JSC::LLInt::functionForCallEntryThunkGenerator):
4654 (JSC::LLInt::functionForConstructEntryThunkGenerator):
4655 (JSC::LLInt::functionForCallArityCheckThunkGenerator):
4656 (JSC::LLInt::functionForConstructArityCheckThunkGenerator):
4657 (JSC::LLInt::evalEntryThunkGenerator):
4658 (JSC::LLInt::programEntryThunkGenerator):
4659 * runtime/Options.cpp:
4660 (Options):
4661 (JSC::Options::initializeOptions):
4662 * runtime/Options.h:
4663 (Options):
4664 * yarr/YarrJIT.cpp:
4665 (JSC::Yarr::YarrGenerator::compile):
4666
mhahnenberg@apple.com7ffd08d2012-06-20 00:20:30 +000046672012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
4668
4669 [Qt][Mac] REGRESSION(r120742): It broke the build
4670 https://bugs.webkit.org/show_bug.cgi?id=89516
4671
4672 Reviewed by Geoffrey Garen.
4673
4674 Removing GCActivityCallbackCF.cpp because it doesn't mesh well with cross-platform
4675 code on Darwin (e.g. Qt). We now use plain ol' vanilla ifdefs to handle platforms
4676 without CF support. These if-defs will probably disappear in the future when we
4677 use cross-platform timers in HeapTimer.
4678
4679 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4680 * JavaScriptCore.xcodeproj/project.pbxproj:
4681 * runtime/GCActivityCallback.cpp:
4682 (JSC):
4683 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4684 (JSC::DefaultGCActivityCallback::doWork):
4685 (JSC::DefaultGCActivityCallback::scheduleTimer):
4686 (JSC::DefaultGCActivityCallback::cancelTimer):
4687 (JSC::DefaultGCActivityCallback::didAllocate):
4688 (JSC::DefaultGCActivityCallback::willCollect):
4689 (JSC::DefaultGCActivityCallback::cancel):
4690 * runtime/GCActivityCallbackCF.cpp: Removed.
4691
fpizlo@apple.com152abff2012-06-19 23:10:12 +000046922012-06-19 Filip Pizlo <fpizlo@apple.com>
4693
4694 DFG CFA forgets to notify subsequent phases of found constants if it proves LogicalNot to be a constant
4695 https://bugs.webkit.org/show_bug.cgi?id=89511
4696 <rdar://problem/11700089>
4697
4698 Reviewed by Geoffrey Garen.
4699
4700 * dfg/DFGAbstractState.cpp:
4701 (JSC::DFG::AbstractState::execute):
4702
commit-queue@webkit.orgb6833002012-06-19 21:06:08 +000047032012-06-19 Mark Lam <mark.lam@apple.com>
4704
4705 CodeBlock::needsCallReturnIndices() is no longer needed.
4706 https://bugs.webkit.org/show_bug.cgi?id=89490
4707
4708 Reviewed by Geoffrey Garen.
4709
4710 * bytecode/CodeBlock.h:
4711 (JSC::CodeBlock::needsCallReturnIndices): removed.
4712 * dfg/DFGJITCompiler.cpp:
4713 (JSC::DFG::JITCompiler::link):
4714 * jit/JIT.cpp:
4715 (JSC::JIT::privateCompile):
4716
fpizlo@apple.com861ea7b2012-06-19 20:05:06 +000047172012-06-19 Filip Pizlo <fpizlo@apple.com>
4718
4719 Unreviewed, try to fix Windows build.
4720
4721 * JavaScriptCore.vcproj/JavaScriptCore/copy-files.cmd:
4722
fpizlo@apple.com01c2a192012-06-19 19:42:55 +000047232012-06-17 Filip Pizlo <fpizlo@apple.com>
4724
4725 It should be possible to look at disassembly
4726 https://bugs.webkit.org/show_bug.cgi?id=89319
4727
4728 Reviewed by Sam Weinig.
4729
4730 This imports the udis86 disassembler library. The library is placed
4731 behind an abstraction in disassembler/Disassembler.h, so that we can
4732 in the future use other disassemblers (for other platforms) whenever
4733 appropriate. As a first step, the disassembler is being invoked for
4734 DFG verbose dumps.
4735
4736 If we ever want to merge a new version of udis86 in the future, I've
4737 made notes about changes I made to the library in
4738 disassembler/udis86/differences.txt.
4739
4740 * CMakeLists.txt:
4741 * DerivedSources.make:
4742 * GNUmakefile.list.am:
4743 * JavaScriptCore.pri:
4744 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4745 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
4746 * JavaScriptCore.xcodeproj/project.pbxproj:
4747 * dfg/DFGJITCompiler.cpp:
4748 (JSC::DFG::JITCompiler::compile):
4749 (JSC::DFG::JITCompiler::compileFunction):
4750 * disassembler: Added.
4751 * disassembler/Disassembler.h: Added.
4752 (JSC):
4753 (JSC::tryToDisassemble):
4754 * disassembler/UDis86Disassembler.cpp: Added.
4755 (JSC):
4756 (JSC::tryToDisassemble):
4757 * disassembler/udis86: Added.
4758 * disassembler/udis86/differences.txt: Added.
4759 * disassembler/udis86/itab.py: Added.
4760 (UdItabGenerator):
4761 (UdItabGenerator.__init__):
4762 (UdItabGenerator.toGroupId):
4763 (UdItabGenerator.genLookupTable):
4764 (UdItabGenerator.genLookupTableList):
4765 (UdItabGenerator.genInsnTable):
4766 (genItabH):
4767 (genItabH.UD_ITAB_H):
4768 (genItabC):
4769 (genItab):
4770 (main):
4771 * disassembler/udis86/optable.xml: Added.
4772 * disassembler/udis86/ud_opcode.py: Added.
4773 (UdOpcodeTables):
4774 (UdOpcodeTables.sizeOfTable):
4775 (UdOpcodeTables.nameOfTable):
4776 (UdOpcodeTables.updateTable):
4777 (UdOpcodeTables.Insn):
4778 (UdOpcodeTables.Insn.__init__):
4779 (UdOpcodeTables.Insn.__init__.opcode):
4780 (UdOpcodeTables.parse):
4781 (UdOpcodeTables.addInsnDef):
4782 (UdOpcodeTables.print_table):
4783 (UdOpcodeTables.print_tree):
4784 * disassembler/udis86/ud_optable.py: Added.
4785 (UdOptableXmlParser):
4786 (UdOptableXmlParser.parseDef):
4787 (UdOptableXmlParser.parse):
4788 (printFn):
4789 (parse):
4790 (main):
4791 * disassembler/udis86/udis86.c: Added.
4792 (ud_init):
4793 (ud_disassemble):
4794 (ud_set_mode):
4795 (ud_set_vendor):
4796 (ud_set_pc):
4797 (ud):
4798 (ud_insn_asm):
4799 (ud_insn_off):
4800 (ud_insn_hex):
4801 (ud_insn_ptr):
4802 (ud_insn_len):
4803 * disassembler/udis86/udis86.h: Added.
4804 * disassembler/udis86/udis86_decode.c: Added.
4805 (eff_adr_mode):
4806 (ud_lookup_mnemonic):
4807 (decode_prefixes):
4808 (modrm):
4809 (resolve_operand_size):
4810 (resolve_mnemonic):
4811 (decode_a):
4812 (decode_gpr):
4813 (resolve_gpr64):
4814 (resolve_gpr32):
4815 (resolve_reg):
4816 (decode_imm):
4817 (decode_modrm_reg):
4818 (decode_modrm_rm):
4819 (decode_o):
4820 (decode_operand):
4821 (decode_operands):
4822 (clear_insn):
4823 (resolve_mode):
4824 (gen_hex):
4825 (decode_insn):
4826 (decode_3dnow):
4827 (decode_ssepfx):
4828 (decode_ext):
4829 (decode_opcode):
4830 (ud_decode):
4831 * disassembler/udis86/udis86_decode.h: Added.
4832 (ud_itab_entry_operand):
4833 (ud_itab_entry):
4834 (ud_lookup_table_list_entry):
4835 (sse_pfx_idx):
4836 (mode_idx):
4837 (modrm_mod_idx):
4838 (vendor_idx):
4839 (is_group_ptr):
4840 (group_idx):
4841 * disassembler/udis86/udis86_extern.h: Added.
4842 * disassembler/udis86/udis86_input.c: Added.
4843 (inp_buff_hook):
4844 (inp_file_hook):
4845 (ud):
4846 (ud_set_user_opaque_data):
4847 (ud_get_user_opaque_data):
4848 (ud_set_input_buffer):
4849 (ud_set_input_file):
4850 (ud_input_skip):
4851 (ud_input_end):
4852 (ud_inp_next):
4853 (ud_inp_back):
4854 (ud_inp_peek):
4855 (ud_inp_move):
4856 (ud_inp_uint8):
4857 (ud_inp_uint16):
4858 (ud_inp_uint32):
4859 (ud_inp_uint64):
4860 * disassembler/udis86/udis86_input.h: Added.
4861 * disassembler/udis86/udis86_itab_holder.c: Added.
4862 * disassembler/udis86/udis86_syn-att.c: Added.
4863 (opr_cast):
4864 (gen_operand):
4865 (ud_translate_att):
4866 * disassembler/udis86/udis86_syn-intel.c: Added.
4867 (opr_cast):
4868 (gen_operand):
4869 (ud_translate_intel):
4870 * disassembler/udis86/udis86_syn.c: Added.
4871 * disassembler/udis86/udis86_syn.h: Added.
4872 (mkasm):
4873 * disassembler/udis86/udis86_types.h: Added.
4874 (ud_operand):
4875 (ud):
4876 * jit/JITCode.h:
4877 (JITCode):
4878 (JSC::JITCode::tryToDisassemble):
4879
mhahnenberg@apple.coma7ec41b2012-06-19 19:17:31 +000048802012-06-19 Mark Hahnenberg <mhahnenberg@apple.com>
4881
4882 GCActivityCallback and IncrementalSweeper should share code
4883 https://bugs.webkit.org/show_bug.cgi?id=89400
4884
4885 Reviewed by Geoffrey Garen.
4886
4887 A lot of functionality is duplicated between GCActivityCallback and IncrementalSweeper.
4888 We should extract the common functionality out into a separate class that both of them
4889 can inherit from. This refactoring will be an even greater boon when we add the ability
4890 to shut these two agents down in a thread-safe fashion
4891
4892 * CMakeLists.txt:
4893 * GNUmakefile.list.am:
4894 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4895 * JavaScriptCore.xcodeproj/project.pbxproj:
4896 * Target.pri:
4897 * heap/Heap.cpp:
4898 (JSC::Heap::Heap): Move initialization down so that the JSGlobalData has a valid Heap when
4899 we're initializing the GCActivityCallback and the IncrementalSweeper.
4900 * heap/Heap.h:
4901 (Heap):
4902 * heap/HeapTimer.cpp: Added.
4903 (JSC):
4904 (JSC::HeapTimer::HeapTimer): Initialize the various base class data that
4905 DefaultGCActivityCallback::commonConstructor() used to do.
4906 (JSC::HeapTimer::~HeapTimer): Call to invalidate().
4907 (JSC::HeapTimer::synchronize): Same functionality as the old DefaultGCActivityCallback::synchronize().
4908 Virtual so that non-CF subclasses can override.
4909 (JSC::HeapTimer::invalidate): Tears down the runloop timer to prevent any future firing.
4910 (JSC::HeapTimer::timerDidFire): Callback to pass to the timer function. Casts and calls the virtual doWork().
4911 * heap/HeapTimer.h: Added. This is the class that serves as the common base class for
4912 both GCActivityCallback and IncrementalSweeper. It handles setting up and tearing down run loops and synchronizing
4913 across threads for its subclasses.
4914 (JSC):
4915 (HeapTimer):
4916 * heap/IncrementalSweeper.cpp: Changes to accomodate the extraction of common functionality
4917 between IncrementalSweeper and GCActivityCallback into a common ancestor.
4918 (JSC):
4919 (JSC::IncrementalSweeper::doWork):
4920 (JSC::IncrementalSweeper::IncrementalSweeper):
4921 (JSC::IncrementalSweeper::cancelTimer):
4922 (JSC::IncrementalSweeper::create):
4923 * heap/IncrementalSweeper.h:
4924 (IncrementalSweeper):
4925 * runtime/GCActivityCallback.cpp:
4926 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4927 (JSC::DefaultGCActivityCallback::doWork):
4928 * runtime/GCActivityCallback.h:
4929 (GCActivityCallback):
4930 (JSC::GCActivityCallback::willCollect):
4931 (JSC::GCActivityCallback::GCActivityCallback):
4932 (JSC):
4933 (DefaultGCActivityCallback): Remove the platform data struct. The platform data should be kept in
4934 the class itself so as to be accessible by doWork(). Most of the platform data for CF is kept in
4935 HeapTimer anyways, so we only need the m_delay field now.
4936 * runtime/GCActivityCallbackBlackBerry.cpp:
4937 (JSC):
4938 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4939 (JSC::DefaultGCActivityCallback::doWork):
4940 (JSC::DefaultGCActivityCallback::didAllocate):
4941 * runtime/GCActivityCallbackCF.cpp:
4942 (JSC):
4943 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
4944 (JSC::DefaultGCActivityCallback::doWork):
4945 (JSC::DefaultGCActivityCallback::scheduleTimer):
4946 (JSC::DefaultGCActivityCallback::cancelTimer):
4947 (JSC::DefaultGCActivityCallback::didAllocate):
4948 (JSC::DefaultGCActivityCallback::willCollect):
4949 (JSC::DefaultGCActivityCallback::cancel):
4950
4951
commit-queue@webkit.orgf5584612012-06-19 09:13:52 +000049522012-06-19 Mike West <mkwst@chromium.org>
4953
4954 Introduce ENABLE_CSP_NEXT configuration flag.
4955 https://bugs.webkit.org/show_bug.cgi?id=89300
4956
4957 Reviewed by Adam Barth.
4958
4959 The 1.0 draft of the Content Security Policy spec is just about to
4960 move to Last Call. We'll hide work on the upcoming 1.1 spec behind
4961 this ENABLE flag, disabled by default.
4962
4963 Spec: https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html
4964
4965 * Configurations/FeatureDefines.xcconfig:
4966
commit-queue@webkit.org3e0a1a02012-06-19 06:07:28 +000049672012-06-18 Mark Lam <mark.lam@apple.com>
4968
4969 Changed JSC to always record line number information so that error.stack
4970 and window.onerror() can report proper line numbers.
4971 https://bugs.webkit.org/show_bug.cgi?id=89410
4972
4973 Reviewed by Geoffrey Garen.
4974
4975 * bytecode/CodeBlock.cpp:
4976 (JSC::CodeBlock::CodeBlock):
4977 (JSC::CodeBlock::lineNumberForBytecodeOffset):
4978 (JSC::CodeBlock::shrinkToFit): m_lineInfo is now available unconditionally.
4979
4980 * bytecode/CodeBlock.h:
4981 (JSC::CodeBlock::addLineInfo):
4982 (JSC::CodeBlock::hasLineInfo): Unused. Now removed.
4983 (JSC::CodeBlock::needsCallReturnIndices):
4984 (CodeBlock):
4985 (RareData): Hoisted m_lineInfo out of m_rareData. m_lineInfo is now
4986 filled in unconditionally.
4987
4988 * bytecompiler/BytecodeGenerator.h:
4989 (JSC::BytecodeGenerator::addLineInfo):
4990
aestes@apple.comf6d51392012-06-19 03:32:30 +000049912012-06-18 Andy Estes <aestes@apple.com>
4992
aestes@apple.com6cc46942012-06-19 03:34:03 +00004993 Fix r120663, which didn't land the change that was reviewed.
4994
49952012-06-18 Andy Estes <aestes@apple.com>
4996
aestes@apple.comf6d51392012-06-19 03:32:30 +00004997 [JSC] In JSGlobalData.cpp, enableAssembler() sometimes leaks two CF objects
4998 https://bugs.webkit.org/show_bug.cgi?id=89415
4999
5000 Reviewed by Sam Weinig.
5001
5002 In the case where canUseJIT was a non-NULL CFBooleanRef,
5003 enableAssembler() would leak both canUseJITKey and canUseJIT by
5004 returning before calling CFRelease. Fix this by using RetainPtr.
5005
5006 * runtime/JSGlobalData.cpp:
5007 (JSC::enableAssembler):
5008
ggaren@apple.com2318dbc2012-06-18 04:35:21 +000050092012-06-17 Geoffrey Garen <ggaren@apple.com>
5010
5011 GC copy phase spends needless cycles zero-filling blocks
5012 https://bugs.webkit.org/show_bug.cgi?id=89128
5013
5014 Reviewed by Gavin Barraclough.
5015
5016 We only need to zero-fill when we're allocating memory that might not
5017 get fully initialized before GC.
5018
5019 * heap/CopiedBlock.h:
5020 (JSC::CopiedBlock::createNoZeroFill):
5021 (JSC::CopiedBlock::create): Added a way to create without zero-filling.
5022 This is our optimization.
5023
5024 (JSC::CopiedBlock::zeroFillToEnd):
5025 (JSC::CopiedBlock::CopiedBlock): Split zero-filling out from creation,
5026 so we can sometimes create without zero-filling.
5027
5028 * heap/CopiedSpace.cpp:
5029 (JSC::CopiedSpace::init):
5030 (JSC::CopiedSpace::tryAllocateSlowCase):
5031 (JSC::CopiedSpace::doneCopying): Renamed addNewBlock to allocateBlock()
5032 to clarify that the new block is always newly-allocated.
5033
5034 (JSC::CopiedSpace::doneFillingBlock): Make sure to zero-fill to the end
5035 of a block that might be used in the future for allocation. (Most of the
5036 time, this is a no-op, since we've already filled the block completely.)
5037
5038 (JSC::CopiedSpace::getFreshBlock): Removed this function because the
5039 abstraction of "allocation must succeed" is no longer useful.
5040
5041 * heap/CopiedSpace.h: Updated declarations to match.
5042
5043 * heap/CopiedSpaceInlineMethods.h:
5044 (JSC::CopiedSpace::allocateBlockForCopyingPhase): New function, which
5045 knows that it can skip zero-filling.
5046
5047 Added tighter scoping to our lock, to improve parallelism.
5048
5049 (JSC::CopiedSpace::allocateBlock): Folded getFreshBlock functionality
5050 into this function, for simplicity.
5051
5052 * heap/MarkStack.cpp:
5053 (JSC::SlotVisitor::startCopying):
5054 (JSC::SlotVisitor::allocateNewSpace): Use our new zero-fill-free helper
5055 function for great good.
5056
fpizlo@apple.com73df57b2012-06-18 01:59:18 +000050572012-06-17 Filip Pizlo <fpizlo@apple.com>
5058
5059 DFG should attempt to use structure watchpoints for all inlined get_by_id's and put_by_id's
5060 https://bugs.webkit.org/show_bug.cgi?id=89316
5061
5062 Reviewed by Oliver Hunt.
5063
5064 * dfg/DFGByteCodeParser.cpp:
5065 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
5066 (ByteCodeParser):
5067 (JSC::DFG::ByteCodeParser::handleGetById):
5068 (JSC::DFG::ByteCodeParser::parseBlock):
5069
commit-queue@webkit.orgf8968a72012-06-15 22:24:21 +000050702012-06-15 Yong Li <yoli@rim.com>
5071
5072 [BlackBerry] Put platform-specific GC policy in GCActivityCallback
5073 https://bugs.webkit.org/show_bug.cgi?id=89236
5074
5075 Reviewed by Rob Buis.
5076
5077 Add GCActivityCallbackBlackBerry.cpp and implement platform-specific
5078 low memory GC policy there.
5079
5080 * PlatformBlackBerry.cmake:
5081 * heap/Heap.h:
5082 (JSC::Heap::isSafeToCollect): Added.
5083 * runtime/GCActivityCallbackBlackBerry.cpp: Added.
5084 (JSC):
5085 (JSC::DefaultGCActivityCallbackPlatformData::DefaultGCActivityCallbackPlatformData):
5086 (DefaultGCActivityCallbackPlatformData):
5087 (JSC::DefaultGCActivityCallback::DefaultGCActivityCallback):
5088 (JSC::DefaultGCActivityCallback::~DefaultGCActivityCallback):
5089 (JSC::DefaultGCActivityCallback::didAllocate):
5090 (JSC::DefaultGCActivityCallback::willCollect):
5091 (JSC::DefaultGCActivityCallback::synchronize):
5092 (JSC::DefaultGCActivityCallback::cancel):
5093
fpizlo@apple.com666a2d52012-06-15 22:21:44 +000050942012-06-15 Filip Pizlo <fpizlo@apple.com>
5095
5096 DFG should be able to set watchpoints on structure transitions in the
5097 method check prototype chain
5098 https://bugs.webkit.org/show_bug.cgi?id=89058
5099
5100 Adding the same assertion to 32-bit that I added to 64-bit. This change
5101 does not affect correctness but it's a good thing for assertion coverage.
5102
5103 * dfg/DFGSpeculativeJIT32_64.cpp:
5104 (JSC::DFG::SpeculativeJIT::compile):
5105
fpizlo@apple.comb75911b2012-06-13 20:53:52 +000051062012-06-13 Filip Pizlo <fpizlo@apple.com>
5107
fpizlo@apple.com04e41152012-06-15 22:14:53 +00005108 DFG should be able to set watchpoints on structure transitions in the
5109 method check prototype chain
5110 https://bugs.webkit.org/show_bug.cgi?id=89058
5111
5112 Reviewed by Gavin Barraclough.
5113
5114 This adds the ability to set watchpoints on Structures, and then does
5115 the most modest thing we can do with this ability: the DFG now sets
5116 watchpoints on structure transitions in the prototype chain of method
5117 checks.
5118
5119 This appears to be a >1% speed-up on V8.
5120
5121 * bytecode/PutByIdStatus.cpp:
5122 (JSC::PutByIdStatus::computeFromLLInt):
5123 (JSC::PutByIdStatus::computeFor):
5124 * bytecode/StructureSet.h:
5125 (JSC::StructureSet::containsOnly):
5126 (StructureSet):
5127 * bytecode/Watchpoint.cpp:
5128 (JSC::WatchpointSet::WatchpointSet):
5129 (JSC::InlineWatchpointSet::add):
5130 (JSC):
5131 (JSC::InlineWatchpointSet::inflateSlow):
5132 (JSC::InlineWatchpointSet::freeFat):
5133 * bytecode/Watchpoint.h:
5134 (WatchpointSet):
5135 (JSC):
5136 (InlineWatchpointSet):
5137 (JSC::InlineWatchpointSet::InlineWatchpointSet):
5138 (JSC::InlineWatchpointSet::~InlineWatchpointSet):
5139 (JSC::InlineWatchpointSet::hasBeenInvalidated):
5140 (JSC::InlineWatchpointSet::isStillValid):
5141 (JSC::InlineWatchpointSet::startWatching):
5142 (JSC::InlineWatchpointSet::notifyWrite):
5143 (JSC::InlineWatchpointSet::isFat):
5144 (JSC::InlineWatchpointSet::fat):
5145 (JSC::InlineWatchpointSet::inflate):
5146 * dfg/DFGAbstractState.cpp:
5147 (JSC::DFG::AbstractState::execute):
5148 * dfg/DFGByteCodeParser.cpp:
5149 (JSC::DFG::ByteCodeParser::addStructureTransitionCheck):
5150 (ByteCodeParser):
5151 (JSC::DFG::ByteCodeParser::parseBlock):
5152 * dfg/DFGCSEPhase.cpp:
5153 (JSC::DFG::CSEPhase::structureTransitionWatchpointElimination):
5154 (CSEPhase):
5155 (JSC::DFG::CSEPhase::performNodeCSE):
5156 * dfg/DFGCommon.h:
5157 * dfg/DFGGraph.cpp:
5158 (JSC::DFG::Graph::dump):
5159 * dfg/DFGGraph.h:
5160 (JSC::DFG::Graph::isCellConstant):
5161 * dfg/DFGJITCompiler.h:
5162 (JSC::DFG::JITCompiler::addWeakReferences):
5163 (JITCompiler):
5164 * dfg/DFGNode.h:
5165 (JSC::DFG::Node::hasStructure):
5166 (Node):
5167 (JSC::DFG::Node::structure):
5168 * dfg/DFGNodeType.h:
5169 (DFG):
5170 * dfg/DFGPredictionPropagationPhase.cpp:
5171 (JSC::DFG::PredictionPropagationPhase::propagate):
5172 * dfg/DFGRepatch.cpp:
5173 (JSC::DFG::emitPutTransitionStub):
5174 * dfg/DFGSpeculativeJIT64.cpp:
5175 (JSC::DFG::SpeculativeJIT::compile):
5176 * jit/JITStubs.cpp:
5177 (JSC::JITThunks::tryCachePutByID):
5178 * llint/LLIntSlowPaths.cpp:
5179 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
5180 * runtime/Structure.cpp:
5181 (JSC::Structure::Structure):
5182 * runtime/Structure.h:
5183 (JSC::Structure::transitionWatchpointSetHasBeenInvalidated):
5184 (Structure):
5185 (JSC::Structure::transitionWatchpointSetIsStillValid):
5186 (JSC::Structure::addTransitionWatchpoint):
5187 (JSC::Structure::notifyTransitionFromThisStructure):
5188 (JSC::JSCell::setStructure):
5189 * runtime/SymbolTable.cpp:
5190 (JSC::SymbolTableEntry::attemptToWatch):
5191
51922012-06-13 Filip Pizlo <fpizlo@apple.com>
5193
fpizlo@apple.comb75911b2012-06-13 20:53:52 +00005194 DFG should be able to set watchpoints on global variables
5195 https://bugs.webkit.org/show_bug.cgi?id=88692
5196
5197 Reviewed by Geoffrey Garen.
5198
5199 Rolling back in after fixing Windows build issues, and implementing
5200 branchTest8 for the Qt port's strange assemblers.
5201
5202 This implements global variable constant folding by allowing the optimizing
5203 compiler to set a "watchpoint" on globals that it wishes to constant fold.
5204 If the watchpoint fires, then an OSR exit is forced by overwriting the
5205 machine code that the optimizing compiler generated with a jump.
5206
5207 As such, this patch is adding quite a bit of stuff:
5208
5209 - Jump replacement on those hardware targets supported by the optimizing
5210 JIT. It is now possible to patch in a jump instruction over any recorded
5211 watchpoint label. The jump must be "local" in the sense that it must be
5212 within the range of the largest jump distance supported by a one
5213 instruction jump.
5214
5215 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
5216 that records the location where a jump must be inserted and the
5217 destination to which it should jump. Watchpoints can be added to a
5218 WatchpointSet. The WatchpointSet can be fired all at once, which plants
5219 all jumps. WatchpointSet also remembers if it had ever been invalidated,
5220 which allows for monotonicity: we typically don't want to optimize using
5221 watchpoints on something for which watchpoints had previously fired. The
5222 act of notifying a WatchpointSet has a trivial fast path in case no
5223 Watchpoints are registered (one-byte load+branch).
5224
5225 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
5226 except that you don't have to emit branches. But, you need to know what
5227 WatchpointSet to add the resulting Watchpoint to. Not everything that
5228 you could write a speculationCheck() for will have a WatchpointSet that
5229 would get notified if the condition you were speculating against became
5230 invalid.
5231
5232 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
5233 do so without incurring any space overhead for those entries that don't
5234 have WatchpointSets.
5235
5236 - The bytecode generator infers all global function variables to be
5237 watchable, and makes all stores perform the WatchpointSet's write check,
5238 and marks all loads as being potentially watchable (i.e. you can compile
5239 them to a watchpoint and a constant).
5240
5241 Put together, this allows for fully sleazy inlining of calls to globally
5242 declared functions. The inline prologue will no longer contain the load of
5243 the function, or any checks of the function you're calling. I.e. it's
5244 pretty much like the kind of inlining you would see in Java or C++.
5245 Furthermore, the watchpointing functionality is built to be fairly general,
5246 and should allow setting watchpoints on all sorts of interesting things
5247 in the future.
5248
5249 The sleazy inlining means that we will now sometimes inline in code paths
5250 that have never executed. Previously, to inline we would have either had
5251 to have executed the call (to read the call's inline cache) or have
5252 executed the method check (to read the method check's inline cache). Now,
5253 we might inline when the callee is a watched global variable. This
5254 revealed some humorous bugs. First, constant folding disagreed with CFA
5255 over what kinds of operations can clobber (example: code path A is dead
5256 but stores a String into variable X, all other code paths store 0 into
5257 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
5258 clobbering constant, but constant folding thought it was clobbering
5259 because it saw the String prediction). Second, inlining would crash if
5260 the inline callee had not been compiled. This patch fixes both bugs,
5261 since otherwise run-javascriptcore-tests would report regressions.
5262
5263 * CMakeLists.txt:
5264 * GNUmakefile.list.am:
5265 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
5266 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5267 * JavaScriptCore.xcodeproj/project.pbxproj:
5268 * Target.pri:
5269 * assembler/ARMv7Assembler.h:
5270 (ARMv7Assembler):
5271 (JSC::ARMv7Assembler::ARMv7Assembler):
5272 (JSC::ARMv7Assembler::labelForWatchpoint):
5273 (JSC::ARMv7Assembler::label):
5274 (JSC::ARMv7Assembler::replaceWithJump):
5275 (JSC::ARMv7Assembler::maxJumpReplacementSize):
5276 * assembler/AbstractMacroAssembler.h:
5277 (JSC):
5278 (AbstractMacroAssembler):
5279 (Label):
5280 (JSC::AbstractMacroAssembler::watchpointLabel):
5281 (JSC::AbstractMacroAssembler::readPointer):
5282 * assembler/AssemblerBuffer.h:
5283 * assembler/MacroAssemblerARM.h:
5284 (JSC::MacroAssemblerARM::branchTest8):
5285 (MacroAssemblerARM):
5286 (JSC::MacroAssemblerARM::replaceWithJump):
5287 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
5288 * assembler/MacroAssemblerARMv7.h:
5289 (JSC::MacroAssemblerARMv7::load8Signed):
5290 (JSC::MacroAssemblerARMv7::load16Signed):
5291 (MacroAssemblerARMv7):
5292 (JSC::MacroAssemblerARMv7::replaceWithJump):
5293 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
5294 (JSC::MacroAssemblerARMv7::branchTest8):
5295 (JSC::MacroAssemblerARMv7::jump):
5296 (JSC::MacroAssemblerARMv7::makeBranch):
5297 * assembler/MacroAssemblerMIPS.h:
5298 (JSC::MacroAssemblerMIPS::branchTest8):
5299 (MacroAssemblerMIPS):
5300 (JSC::MacroAssemblerMIPS::replaceWithJump):
5301 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
5302 * assembler/MacroAssemblerSH4.h:
5303 (JSC::MacroAssemblerSH4::branchTest8):
5304 (MacroAssemblerSH4):
5305 (JSC::MacroAssemblerSH4::replaceWithJump):
5306 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
5307 * assembler/MacroAssemblerX86.h:
5308 (MacroAssemblerX86):
5309 (JSC::MacroAssemblerX86::branchTest8):
5310 * assembler/MacroAssemblerX86Common.h:
5311 (JSC::MacroAssemblerX86Common::replaceWithJump):
5312 (MacroAssemblerX86Common):
5313 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
5314 * assembler/MacroAssemblerX86_64.h:
5315 (MacroAssemblerX86_64):
5316 (JSC::MacroAssemblerX86_64::branchTest8):
5317 * assembler/X86Assembler.h:
5318 (JSC::X86Assembler::X86Assembler):
5319 (X86Assembler):
5320 (JSC::X86Assembler::cmpb_im):
5321 (JSC::X86Assembler::testb_im):
5322 (JSC::X86Assembler::labelForWatchpoint):
5323 (JSC::X86Assembler::label):
5324 (JSC::X86Assembler::replaceWithJump):
5325 (JSC::X86Assembler::maxJumpReplacementSize):
5326 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
5327 * bytecode/CodeBlock.cpp:
5328 (JSC):
5329 (JSC::CodeBlock::printGetByIdCacheStatus):
5330 (JSC::CodeBlock::dump):
5331 * bytecode/CodeBlock.h:
5332 (JSC::CodeBlock::appendOSRExit):
5333 (JSC::CodeBlock::appendSpeculationRecovery):
5334 (CodeBlock):
5335 (JSC::CodeBlock::appendWatchpoint):
5336 (JSC::CodeBlock::numberOfWatchpoints):
5337 (JSC::CodeBlock::watchpoint):
5338 (DFGData):
5339 * bytecode/DFGExitProfile.h:
5340 (JSC::DFG::exitKindToString):
5341 (JSC::DFG::exitKindIsCountable):
5342 * bytecode/GetByIdStatus.cpp:
5343 (JSC::GetByIdStatus::computeForChain):
5344 * bytecode/Instruction.h:
5345 (Instruction):
5346 (JSC::Instruction::Instruction):
5347 * bytecode/Opcode.h:
5348 (JSC):
5349 (JSC::padOpcodeName):
5350 * bytecode/Watchpoint.cpp: Added.
5351 (JSC):
5352 (JSC::Watchpoint::~Watchpoint):
5353 (JSC::Watchpoint::correctLabels):
5354 (JSC::Watchpoint::fire):
5355 (JSC::WatchpointSet::WatchpointSet):
5356 (JSC::WatchpointSet::~WatchpointSet):
5357 (JSC::WatchpointSet::add):
5358 (JSC::WatchpointSet::notifyWriteSlow):
5359 (JSC::WatchpointSet::fireAllWatchpoints):
5360 * bytecode/Watchpoint.h: Added.
5361 (JSC):
5362 (Watchpoint):
5363 (JSC::Watchpoint::Watchpoint):
5364 (JSC::Watchpoint::setDestination):
5365 (WatchpointSet):
5366 (JSC::WatchpointSet::isStillValid):
5367 (JSC::WatchpointSet::hasBeenInvalidated):
5368 (JSC::WatchpointSet::startWatching):
5369 (JSC::WatchpointSet::notifyWrite):
5370 (JSC::WatchpointSet::addressOfIsWatched):
5371 * bytecompiler/BytecodeGenerator.cpp:
5372 (JSC::ResolveResult::checkValidity):
5373 (JSC::BytecodeGenerator::addGlobalVar):
5374 (JSC::BytecodeGenerator::BytecodeGenerator):
5375 (JSC::BytecodeGenerator::resolve):
5376 (JSC::BytecodeGenerator::emitResolve):
5377 (JSC::BytecodeGenerator::emitResolveWithBase):
5378 (JSC::BytecodeGenerator::emitResolveWithThis):
5379 (JSC::BytecodeGenerator::emitGetStaticVar):
5380 (JSC::BytecodeGenerator::emitPutStaticVar):
5381 * bytecompiler/BytecodeGenerator.h:
5382 (BytecodeGenerator):
5383 * bytecompiler/NodesCodegen.cpp:
5384 (JSC::FunctionCallResolveNode::emitBytecode):
5385 (JSC::PostfixResolveNode::emitBytecode):
5386 (JSC::PrefixResolveNode::emitBytecode):
5387 (JSC::ReadModifyResolveNode::emitBytecode):
5388 (JSC::AssignResolveNode::emitBytecode):
5389 (JSC::ConstDeclNode::emitCodeSingle):
5390 * dfg/DFGAbstractState.cpp:
5391 (JSC::DFG::AbstractState::execute):
5392 (JSC::DFG::AbstractState::clobberStructures):
5393 * dfg/DFGAbstractState.h:
5394 (AbstractState):
5395 (JSC::DFG::AbstractState::didClobber):
5396 * dfg/DFGByteCodeParser.cpp:
5397 (JSC::DFG::ByteCodeParser::handleInlining):
5398 (JSC::DFG::ByteCodeParser::parseBlock):
5399 * dfg/DFGCCallHelpers.h:
5400 (CCallHelpers):
5401 (JSC::DFG::CCallHelpers::setupArguments):
5402 * dfg/DFGCSEPhase.cpp:
5403 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
5404 (CSEPhase):
5405 (JSC::DFG::CSEPhase::globalVarStoreElimination):
5406 (JSC::DFG::CSEPhase::performNodeCSE):
5407 * dfg/DFGCapabilities.h:
5408 (JSC::DFG::canCompileOpcode):
5409 * dfg/DFGConstantFoldingPhase.cpp:
5410 (JSC::DFG::ConstantFoldingPhase::run):
5411 * dfg/DFGCorrectableJumpPoint.h:
5412 (JSC::DFG::CorrectableJumpPoint::isSet):
5413 (CorrectableJumpPoint):
5414 * dfg/DFGJITCompiler.cpp:
5415 (JSC::DFG::JITCompiler::linkOSRExits):
5416 (JSC::DFG::JITCompiler::link):
5417 * dfg/DFGNode.h:
5418 (JSC::DFG::Node::hasIdentifierNumberForCheck):
5419 (Node):
5420 (JSC::DFG::Node::identifierNumberForCheck):
5421 (JSC::DFG::Node::hasRegisterPointer):
5422 * dfg/DFGNodeType.h:
5423 (DFG):
5424 * dfg/DFGOSRExit.cpp:
5425 (JSC::DFG::OSRExit::OSRExit):
5426 * dfg/DFGOSRExit.h:
5427 (OSRExit):
5428 * dfg/DFGOperations.cpp:
5429 * dfg/DFGOperations.h:
5430 * dfg/DFGPredictionPropagationPhase.cpp:
5431 (JSC::DFG::PredictionPropagationPhase::propagate):
5432 * dfg/DFGSpeculativeJIT.h:
5433 (JSC::DFG::SpeculativeJIT::callOperation):
5434 (JSC::DFG::SpeculativeJIT::appendCall):
5435 (SpeculativeJIT):
5436 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
5437 * dfg/DFGSpeculativeJIT32_64.cpp:
5438 (JSC::DFG::SpeculativeJIT::compile):
5439 * dfg/DFGSpeculativeJIT64.cpp:
5440 (JSC::DFG::SpeculativeJIT::compile):
5441 * interpreter/Interpreter.cpp:
5442 (JSC::Interpreter::privateExecute):
5443 * jit/JIT.cpp:
5444 (JSC::JIT::privateCompileMainPass):
5445 (JSC::JIT::privateCompileSlowCases):
5446 * jit/JIT.h:
5447 * jit/JITPropertyAccess.cpp:
5448 (JSC::JIT::emit_op_put_global_var_check):
5449 (JSC):
5450 (JSC::JIT::emitSlow_op_put_global_var_check):
5451 * jit/JITPropertyAccess32_64.cpp:
5452 (JSC::JIT::emit_op_put_global_var_check):
5453 (JSC):
5454 (JSC::JIT::emitSlow_op_put_global_var_check):
5455 * jit/JITStubs.cpp:
5456 (JSC::DEFINE_STUB_FUNCTION):
5457 (JSC):
5458 * jit/JITStubs.h:
5459 * llint/LLIntSlowPaths.cpp:
5460 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
5461 (LLInt):
5462 * llint/LLIntSlowPaths.h:
5463 (LLInt):
5464 * llint/LowLevelInterpreter32_64.asm:
5465 * llint/LowLevelInterpreter64.asm:
5466 * runtime/JSObject.cpp:
5467 (JSC::JSObject::removeDirect):
5468 * runtime/JSObject.h:
5469 (JSObject):
5470 * runtime/JSSymbolTableObject.h:
5471 (JSC::symbolTableGet):
5472 (JSC::symbolTablePut):
5473 (JSC::symbolTablePutWithAttributes):
5474 * runtime/SymbolTable.cpp: Added.
5475 (JSC):
5476 (JSC::SymbolTableEntry::copySlow):
5477 (JSC::SymbolTableEntry::freeFatEntrySlow):
5478 (JSC::SymbolTableEntry::couldBeWatched):
5479 (JSC::SymbolTableEntry::attemptToWatch):
5480 (JSC::SymbolTableEntry::addressOfIsWatched):
5481 (JSC::SymbolTableEntry::addWatchpoint):
5482 (JSC::SymbolTableEntry::notifyWriteSlow):
5483 (JSC::SymbolTableEntry::inflateSlow):
5484 * runtime/SymbolTable.h:
5485 (JSC):
5486 (SymbolTableEntry):
5487 (Fast):
5488 (JSC::SymbolTableEntry::Fast::Fast):
5489 (JSC::SymbolTableEntry::Fast::isNull):
5490 (JSC::SymbolTableEntry::Fast::getIndex):
5491 (JSC::SymbolTableEntry::Fast::isReadOnly):
5492 (JSC::SymbolTableEntry::Fast::getAttributes):
5493 (JSC::SymbolTableEntry::Fast::isFat):
5494 (JSC::SymbolTableEntry::SymbolTableEntry):
5495 (JSC::SymbolTableEntry::~SymbolTableEntry):
5496 (JSC::SymbolTableEntry::operator=):
5497 (JSC::SymbolTableEntry::isNull):
5498 (JSC::SymbolTableEntry::getIndex):
5499 (JSC::SymbolTableEntry::getFast):
5500 (JSC::SymbolTableEntry::getAttributes):
5501 (JSC::SymbolTableEntry::isReadOnly):
5502 (JSC::SymbolTableEntry::watchpointSet):
5503 (JSC::SymbolTableEntry::notifyWrite):
5504 (FatEntry):
5505 (JSC::SymbolTableEntry::FatEntry::FatEntry):
5506 (JSC::SymbolTableEntry::isFat):
5507 (JSC::SymbolTableEntry::fatEntry):
5508 (JSC::SymbolTableEntry::inflate):
5509 (JSC::SymbolTableEntry::bits):
5510 (JSC::SymbolTableEntry::freeFatEntry):
5511 (JSC::SymbolTableEntry::pack):
5512 (JSC::SymbolTableEntry::isValidIndex):
5513
zandobersek@gmail.com88d53732012-06-13 09:38:42 +000055142012-06-13 Sheriff Bot <webkit.review.bot@gmail.com>
5515
5516 Unreviewed, rolling out r120172.
5517 http://trac.webkit.org/changeset/120172
5518 https://bugs.webkit.org/show_bug.cgi?id=88976
5519
5520 The patch causes compilation failures on Gtk, Qt and Apple Win
5521 bots (Requested by zdobersek on #webkit).
5522
5523 * CMakeLists.txt:
5524 * GNUmakefile.list.am:
5525 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
5526 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5527 * JavaScriptCore.xcodeproj/project.pbxproj:
5528 * Target.pri:
5529 * assembler/ARMv7Assembler.h:
5530 (JSC::ARMv7Assembler::nop):
5531 (JSC::ARMv7Assembler::label):
5532 (JSC::ARMv7Assembler::readPointer):
5533 (ARMv7Assembler):
5534 * assembler/AbstractMacroAssembler.h:
5535 (JSC):
5536 (AbstractMacroAssembler):
5537 (Label):
5538 * assembler/AssemblerBuffer.h:
5539 * assembler/MacroAssemblerARM.h:
5540 * assembler/MacroAssemblerARMv7.h:
5541 (JSC::MacroAssemblerARMv7::nop):
5542 (JSC::MacroAssemblerARMv7::jump):
5543 (JSC::MacroAssemblerARMv7::makeBranch):
5544 * assembler/MacroAssemblerMIPS.h:
5545 * assembler/MacroAssemblerSH4.h:
5546 * assembler/MacroAssemblerX86.h:
5547 (MacroAssemblerX86):
5548 (JSC::MacroAssemblerX86::moveWithPatch):
5549 * assembler/MacroAssemblerX86Common.h:
5550 * assembler/MacroAssemblerX86_64.h:
5551 (JSC::MacroAssemblerX86_64::branchTest8):
5552 * assembler/X86Assembler.h:
5553 (JSC::X86Assembler::cmpb_im):
5554 (JSC::X86Assembler::codeSize):
5555 (JSC::X86Assembler::label):
5556 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
5557 * bytecode/CodeBlock.cpp:
5558 (JSC::CodeBlock::dump):
5559 * bytecode/CodeBlock.h:
5560 (JSC::CodeBlock::appendOSRExit):
5561 (JSC::CodeBlock::appendSpeculationRecovery):
5562 (DFGData):
5563 * bytecode/DFGExitProfile.h:
5564 (JSC::DFG::exitKindToString):
5565 (JSC::DFG::exitKindIsCountable):
5566 * bytecode/Instruction.h:
5567 * bytecode/Opcode.h:
5568 (JSC):
5569 (JSC::padOpcodeName):
5570 * bytecode/Watchpoint.cpp: Removed.
5571 * bytecode/Watchpoint.h: Removed.
5572 * bytecompiler/BytecodeGenerator.cpp:
5573 (JSC::ResolveResult::checkValidity):
5574 (JSC::BytecodeGenerator::addGlobalVar):
5575 (JSC::BytecodeGenerator::BytecodeGenerator):
5576 (JSC::BytecodeGenerator::resolve):
5577 (JSC::BytecodeGenerator::emitResolve):
5578 (JSC::BytecodeGenerator::emitResolveWithBase):
5579 (JSC::BytecodeGenerator::emitResolveWithThis):
5580 (JSC::BytecodeGenerator::emitGetStaticVar):
5581 (JSC::BytecodeGenerator::emitPutStaticVar):
5582 * bytecompiler/BytecodeGenerator.h:
5583 (BytecodeGenerator):
5584 * bytecompiler/NodesCodegen.cpp:
5585 (JSC::FunctionCallResolveNode::emitBytecode):
5586 (JSC::PostfixResolveNode::emitBytecode):
5587 (JSC::PrefixResolveNode::emitBytecode):
5588 (JSC::ReadModifyResolveNode::emitBytecode):
5589 (JSC::AssignResolveNode::emitBytecode):
5590 (JSC::ConstDeclNode::emitCodeSingle):
5591 * dfg/DFGAbstractState.cpp:
5592 (JSC::DFG::AbstractState::execute):
5593 (JSC::DFG::AbstractState::clobberStructures):
5594 * dfg/DFGAbstractState.h:
5595 (AbstractState):
5596 * dfg/DFGByteCodeParser.cpp:
5597 (JSC::DFG::ByteCodeParser::handleInlining):
5598 (JSC::DFG::ByteCodeParser::parseBlock):
5599 * dfg/DFGCCallHelpers.h:
5600 (JSC::DFG::CCallHelpers::setupArguments):
5601 * dfg/DFGCSEPhase.cpp:
5602 (JSC::DFG::CSEPhase::globalVarStoreElimination):
5603 (JSC::DFG::CSEPhase::performNodeCSE):
5604 * dfg/DFGCapabilities.h:
5605 (JSC::DFG::canCompileOpcode):
5606 * dfg/DFGConstantFoldingPhase.cpp:
5607 (JSC::DFG::ConstantFoldingPhase::run):
5608 * dfg/DFGCorrectableJumpPoint.h:
5609 * dfg/DFGJITCompiler.cpp:
5610 (JSC::DFG::JITCompiler::linkOSRExits):
5611 (JSC::DFG::JITCompiler::link):
5612 * dfg/DFGNode.h:
5613 (JSC::DFG::Node::hasRegisterPointer):
5614 * dfg/DFGNodeType.h:
5615 (DFG):
5616 * dfg/DFGOSRExit.cpp:
5617 (JSC::DFG::OSRExit::OSRExit):
5618 * dfg/DFGOSRExit.h:
5619 (OSRExit):
5620 * dfg/DFGOperations.cpp:
5621 * dfg/DFGOperations.h:
5622 * dfg/DFGPredictionPropagationPhase.cpp:
5623 (JSC::DFG::PredictionPropagationPhase::propagate):
5624 * dfg/DFGSpeculativeJIT.h:
5625 (JSC::DFG::SpeculativeJIT::callOperation):
5626 (JSC::DFG::SpeculativeJIT::appendCallSetResult):
5627 (JSC::DFG::SpeculativeJIT::speculationCheck):
5628 * dfg/DFGSpeculativeJIT32_64.cpp:
5629 (JSC::DFG::SpeculativeJIT::compile):
5630 * dfg/DFGSpeculativeJIT64.cpp:
5631 (JSC::DFG::SpeculativeJIT::compile):
5632 * jit/JIT.cpp:
5633 (JSC::JIT::privateCompileMainPass):
5634 (JSC::JIT::privateCompileSlowCases):
5635 * jit/JIT.h:
5636 * jit/JITPropertyAccess.cpp:
5637 * jit/JITPropertyAccess32_64.cpp:
5638 * jit/JITStubs.cpp:
5639 * jit/JITStubs.h:
5640 * llint/LLIntSlowPaths.cpp:
5641 * llint/LLIntSlowPaths.h:
5642 (LLInt):
5643 * llint/LowLevelInterpreter32_64.asm:
5644 * llint/LowLevelInterpreter64.asm:
5645 * runtime/JSObject.cpp:
5646 (JSC::JSObject::removeDirect):
5647 * runtime/JSObject.h:
5648 (JSObject):
5649 * runtime/JSSymbolTableObject.h:
5650 (JSC::symbolTableGet):
5651 (JSC::symbolTablePut):
5652 (JSC::symbolTablePutWithAttributes):
5653 * runtime/SymbolTable.cpp: Removed.
5654 * runtime/SymbolTable.h:
5655 (JSC):
5656 (JSC::SymbolTableEntry::isNull):
5657 (JSC::SymbolTableEntry::getIndex):
5658 (SymbolTableEntry):
5659 (JSC::SymbolTableEntry::getAttributes):
5660 (JSC::SymbolTableEntry::isReadOnly):
5661 (JSC::SymbolTableEntry::pack):
5662 (JSC::SymbolTableEntry::isValidIndex):
5663
fpizlo@apple.com3bdd4c92012-06-13 04:56:22 +000056642012-06-12 Filip Pizlo <fpizlo@apple.com>
5665
fpizlo@apple.comb6c5eeb2012-06-13 08:20:39 +00005666 DFG should be able to set watchpoints on global variables
5667 https://bugs.webkit.org/show_bug.cgi?id=88692
5668
5669 Reviewed by Geoffrey Garen.
5670
5671 This implements global variable constant folding by allowing the optimizing
5672 compiler to set a "watchpoint" on globals that it wishes to constant fold.
5673 If the watchpoint fires, then an OSR exit is forced by overwriting the
5674 machine code that the optimizing compiler generated with a jump.
5675
5676 As such, this patch is adding quite a bit of stuff:
5677
5678 - Jump replacement on those hardware targets supported by the optimizing
5679 JIT. It is now possible to patch in a jump instruction over any recorded
5680 watchpoint label. The jump must be "local" in the sense that it must be
5681 within the range of the largest jump distance supported by a one
5682 instruction jump.
5683
5684 - WatchpointSets and Watchpoints. A Watchpoint is a doubly-linked list node
5685 that records the location where a jump must be inserted and the
5686 destination to which it should jump. Watchpoints can be added to a
5687 WatchpointSet. The WatchpointSet can be fired all at once, which plants
5688 all jumps. WatchpointSet also remembers if it had ever been invalidated,
5689 which allows for monotonicity: we typically don't want to optimize using
5690 watchpoints on something for which watchpoints had previously fired. The
5691 act of notifying a WatchpointSet has a trivial fast path in case no
5692 Watchpoints are registered (one-byte load+branch).
5693
5694 - SpeculativeJIT::speculationWatchpoint(). It's like speculationCheck(),
5695 except that you don't have to emit branches. But, you need to know what
5696 WatchpointSet to add the resulting Watchpoint to. Not everything that
5697 you could write a speculationCheck() for will have a WatchpointSet that
5698 would get notified if the condition you were speculating against became
5699 invalid.
5700
5701 - SymbolTableEntry now has the ability to refer to a WatchpointSet. It can
5702 do so without incurring any space overhead for those entries that don't
5703 have WatchpointSets.
5704
5705 - The bytecode generator infers all global function variables to be
5706 watchable, and makes all stores perform the WatchpointSet's write check,
5707 and marks all loads as being potentially watchable (i.e. you can compile
5708 them to a watchpoint and a constant).
5709
5710 Put together, this allows for fully sleazy inlining of calls to globally
5711 declared functions. The inline prologue will no longer contain the load of
5712 the function, or any checks of the function you're calling. I.e. it's
5713 pretty much like the kind of inlining you would see in Java or C++.
5714 Furthermore, the watchpointing functionality is built to be fairly general,
5715 and should allow setting watchpoints on all sorts of interesting things
5716 in the future.
5717
5718 The sleazy inlining means that we will now sometimes inline in code paths
5719 that have never executed. Previously, to inline we would have either had
5720 to have executed the call (to read the call's inline cache) or have
5721 executed the method check (to read the method check's inline cache). Now,
5722 we might inline when the callee is a watched global variable. This
5723 revealed some humorous bugs. First, constant folding disagreed with CFA
5724 over what kinds of operations can clobber (example: code path A is dead
5725 but stores a String into variable X, all other code paths store 0 into
5726 X, and then you do CompareEq(X, 0) - CFA will say that this is a non-
5727 clobbering constant, but constant folding thought it was clobbering
5728 because it saw the String prediction). Second, inlining would crash if
5729 the inline callee had not been compiled. This patch fixes both bugs,
5730 since otherwise run-javascriptcore-tests would report regressions.
5731
5732 * CMakeLists.txt:
5733 * GNUmakefile.list.am:
5734 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
5735 * JavaScriptCore.xcodeproj/project.pbxproj:
5736 * Target.pri:
5737 * assembler/ARMv7Assembler.h:
5738 (ARMv7Assembler):
5739 (JSC::ARMv7Assembler::ARMv7Assembler):
5740 (JSC::ARMv7Assembler::labelForWatchpoint):
5741 (JSC::ARMv7Assembler::label):
5742 (JSC::ARMv7Assembler::replaceWithJump):
5743 (JSC::ARMv7Assembler::maxJumpReplacementSize):
5744 * assembler/AbstractMacroAssembler.h:
5745 (JSC):
5746 (AbstractMacroAssembler):
5747 (Label):
5748 (JSC::AbstractMacroAssembler::watchpointLabel):
5749 * assembler/AssemblerBuffer.h:
5750 * assembler/MacroAssemblerARM.h:
5751 (JSC::MacroAssemblerARM::replaceWithJump):
5752 (MacroAssemblerARM):
5753 (JSC::MacroAssemblerARM::maxJumpReplacementSize):
5754 * assembler/MacroAssemblerARMv7.h:
5755 (MacroAssemblerARMv7):
5756 (JSC::MacroAssemblerARMv7::replaceWithJump):
5757 (JSC::MacroAssemblerARMv7::maxJumpReplacementSize):
5758 (JSC::MacroAssemblerARMv7::branchTest8):
5759 (JSC::MacroAssemblerARMv7::jump):
5760 (JSC::MacroAssemblerARMv7::makeBranch):
5761 * assembler/MacroAssemblerMIPS.h:
5762 (JSC::MacroAssemblerMIPS::replaceWithJump):
5763 (MacroAssemblerMIPS):
5764 (JSC::MacroAssemblerMIPS::maxJumpReplacementSize):
5765 * assembler/MacroAssemblerSH4.h:
5766 (JSC::MacroAssemblerSH4::replaceWithJump):
5767 (MacroAssemblerSH4):
5768 (JSC::MacroAssemblerSH4::maxJumpReplacementSize):
5769 * assembler/MacroAssemblerX86.h:
5770 (MacroAssemblerX86):
5771 (JSC::MacroAssemblerX86::branchTest8):
5772 * assembler/MacroAssemblerX86Common.h:
5773 (JSC::MacroAssemblerX86Common::replaceWithJump):
5774 (MacroAssemblerX86Common):
5775 (JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
5776 * assembler/MacroAssemblerX86_64.h:
5777 (MacroAssemblerX86_64):
5778 (JSC::MacroAssemblerX86_64::branchTest8):
5779 * assembler/X86Assembler.h:
5780 (JSC::X86Assembler::X86Assembler):
5781 (X86Assembler):
5782 (JSC::X86Assembler::cmpb_im):
5783 (JSC::X86Assembler::testb_im):
5784 (JSC::X86Assembler::labelForWatchpoint):
5785 (JSC::X86Assembler::label):
5786 (JSC::X86Assembler::replaceWithJump):
5787 (JSC::X86Assembler::maxJumpReplacementSize):
5788 (JSC::X86Assembler::X86InstructionFormatter::memoryModRM):
5789 * bytecode/CodeBlock.cpp:
5790 (JSC::CodeBlock::dump):
5791 * bytecode/CodeBlock.h:
5792 (JSC::CodeBlock::appendOSRExit):
5793 (JSC::CodeBlock::appendSpeculationRecovery):
5794 (CodeBlock):
5795 (JSC::CodeBlock::appendWatchpoint):
5796 (JSC::CodeBlock::numberOfWatchpoints):
5797 (JSC::CodeBlock::watchpoint):
5798 (DFGData):
5799 * bytecode/DFGExitProfile.h:
5800 (JSC::DFG::exitKindToString):
5801 (JSC::DFG::exitKindIsCountable):
5802 * bytecode/Instruction.h:
5803 (Instruction):
5804 (JSC::Instruction::Instruction):
5805 * bytecode/Opcode.h:
5806 (JSC):
5807 (JSC::padOpcodeName):
5808 * bytecode/Watchpoint.cpp: Added.
5809 (JSC):
5810 (JSC::Watchpoint::~Watchpoint):
5811 (JSC::Watchpoint::correctLabels):
5812 (JSC::Watchpoint::fire):
5813 (JSC::WatchpointSet::WatchpointSet):
5814 (JSC::WatchpointSet::~WatchpointSet):
5815 (JSC::WatchpointSet::add):
5816 (JSC::WatchpointSet::notifyWriteSlow):
5817 (JSC::WatchpointSet::fireAllWatchpoints):
5818 * bytecode/Watchpoint.h: Added.
5819 (JSC):
5820 (Watchpoint):
5821 (JSC::Watchpoint::Watchpoint):
5822 (JSC::Watchpoint::setDestination):
5823 (WatchpointSet):
5824 (JSC::WatchpointSet::isStillValid):
5825 (JSC::WatchpointSet::hasBeenInvalidated):
5826 (JSC::WatchpointSet::startWatching):
5827 (JSC::WatchpointSet::notifyWrite):
5828 (JSC::WatchpointSet::addressOfIsWatched):
5829 * bytecompiler/BytecodeGenerator.cpp:
5830 (JSC::ResolveResult::checkValidity):
5831 (JSC::BytecodeGenerator::addGlobalVar):
5832 (JSC::BytecodeGenerator::BytecodeGenerator):
5833 (JSC::BytecodeGenerator::resolve):
5834 (JSC::BytecodeGenerator::emitResolve):
5835 (JSC::BytecodeGenerator::emitResolveWithBase):
5836 (JSC::BytecodeGenerator::emitResolveWithThis):
5837 (JSC::BytecodeGenerator::emitGetStaticVar):
5838 (JSC::BytecodeGenerator::emitPutStaticVar):
5839 * bytecompiler/BytecodeGenerator.h:
5840 (BytecodeGenerator):
5841 * bytecompiler/NodesCodegen.cpp:
5842 (JSC::FunctionCallResolveNode::emitBytecode):
5843 (JSC::PostfixResolveNode::emitBytecode):
5844 (JSC::PrefixResolveNode::emitBytecode):
5845 (JSC::ReadModifyResolveNode::emitBytecode):
5846 (JSC::AssignResolveNode::emitBytecode):
5847 (JSC::ConstDeclNode::emitCodeSingle):
5848 * dfg/DFGAbstractState.cpp:
5849 (JSC::DFG::AbstractState::execute):
5850 (JSC::DFG::AbstractState::clobberStructures):
5851 * dfg/DFGAbstractState.h:
5852 (AbstractState):
5853 (JSC::DFG::AbstractState::didClobber):
5854 * dfg/DFGByteCodeParser.cpp:
5855 (JSC::DFG::ByteCodeParser::handleInlining):
5856 (JSC::DFG::ByteCodeParser::parseBlock):
5857 * dfg/DFGCCallHelpers.h:
5858 (CCallHelpers):
5859 (JSC::DFG::CCallHelpers::setupArguments):
5860 * dfg/DFGCSEPhase.cpp:
5861 (JSC::DFG::CSEPhase::globalVarWatchpointElimination):
5862 (CSEPhase):
5863 (JSC::DFG::CSEPhase::globalVarStoreElimination):
5864 (JSC::DFG::CSEPhase::performNodeCSE):
5865 * dfg/DFGCapabilities.h:
5866 (JSC::DFG::canCompileOpcode):
5867 * dfg/DFGConstantFoldingPhase.cpp:
5868 (JSC::DFG::ConstantFoldingPhase::run):
5869 * dfg/DFGCorrectableJumpPoint.h:
5870 (JSC::DFG::CorrectableJumpPoint::isSet):
5871 (CorrectableJumpPoint):
5872 * dfg/DFGJITCompiler.cpp:
5873 (JSC::DFG::JITCompiler::linkOSRExits):
5874 (JSC::DFG::JITCompiler::link):
5875 * dfg/DFGNode.h:
5876 (JSC::DFG::Node::hasIdentifierNumberForCheck):
5877 (Node):
5878 (JSC::DFG::Node::identifierNumberForCheck):
5879 (JSC::DFG::Node::hasRegisterPointer):
5880 * dfg/DFGNodeType.h:
5881 (DFG):
5882 * dfg/DFGOSRExit.cpp:
5883 (JSC::DFG::OSRExit::OSRExit):
5884 * dfg/DFGOSRExit.h:
5885 (OSRExit):
5886 * dfg/DFGOperations.cpp:
5887 * dfg/DFGOperations.h:
5888 * dfg/DFGPredictionPropagationPhase.cpp:
5889 (JSC::DFG::PredictionPropagationPhase::propagate):
5890 * dfg/DFGSpeculativeJIT.h:
5891 (JSC::DFG::SpeculativeJIT::callOperation):
5892 (JSC::DFG::SpeculativeJIT::appendCall):
5893 (SpeculativeJIT):
5894 (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
5895 * dfg/DFGSpeculativeJIT32_64.cpp:
5896 (JSC::DFG::SpeculativeJIT::compile):
5897 * dfg/DFGSpeculativeJIT64.cpp:
5898 (JSC::DFG::SpeculativeJIT::compile):
5899 * jit/JIT.cpp:
5900 (JSC::JIT::privateCompileMainPass):
5901 (JSC::JIT::privateCompileSlowCases):
5902 * jit/JIT.h:
5903 * jit/JITPropertyAccess.cpp:
5904 (JSC::JIT::emit_op_put_global_var_check):
5905 (JSC):
5906 (JSC::JIT::emitSlow_op_put_global_var_check):
5907 * jit/JITPropertyAccess32_64.cpp:
5908 (JSC::JIT::emit_op_put_global_var_check):
5909 (JSC):
5910 (JSC::JIT::emitSlow_op_put_global_var_check):
5911 * jit/JITStubs.cpp:
5912 (JSC::JITThunks::JITThunks):
5913 (JSC::DEFINE_STUB_FUNCTION):
5914 (JSC):
5915 * jit/JITStubs.h:
5916 * llint/LLIntSlowPaths.cpp:
5917 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
5918 (LLInt):
5919 * llint/LLIntSlowPaths.h:
5920 (LLInt):
5921 * llint/LowLevelInterpreter32_64.asm:
5922 * llint/LowLevelInterpreter64.asm:
5923 * runtime/JSObject.cpp:
5924 (JSC::JSObject::removeDirect):
5925 * runtime/JSObject.h:
5926 (JSObject):
5927 * runtime/JSSymbolTableObject.h:
5928 (JSC::symbolTableGet):
5929 (JSC::symbolTablePut):
5930 (JSC::symbolTablePutWithAttributes):
5931 * runtime/SymbolTable.cpp: Added.
5932 (JSC):
5933 (JSC::SymbolTableEntry::copySlow):
5934 (JSC::SymbolTableEntry::freeFatEntrySlow):
5935 (JSC::SymbolTableEntry::couldBeWatched):
5936 (JSC::SymbolTableEntry::attemptToWatch):
5937 (JSC::SymbolTableEntry::addressOfIsWatched):
5938 (JSC::SymbolTableEntry::addWatchpoint):
5939 (JSC::SymbolTableEntry::notifyWriteSlow):
5940 (JSC::SymbolTableEntry::inflateSlow):
5941 * runtime/SymbolTable.h:
5942 (JSC):
5943 (SymbolTableEntry):
5944 (Fast):
5945 (JSC::SymbolTableEntry::Fast::Fast):
5946 (JSC::SymbolTableEntry::Fast::isNull):
5947 (JSC::SymbolTableEntry::Fast::getIndex):
5948 (JSC::SymbolTableEntry::Fast::isReadOnly):
5949 (JSC::SymbolTableEntry::Fast::getAttributes):
5950 (JSC::SymbolTableEntry::Fast::isFat):
5951 (JSC::SymbolTableEntry::SymbolTableEntry):
5952 (JSC::SymbolTableEntry::~SymbolTableEntry):
5953 (JSC::SymbolTableEntry::operator=):
5954 (JSC::SymbolTableEntry::isNull):
5955 (JSC::SymbolTableEntry::getIndex):
5956 (JSC::SymbolTableEntry::getFast):
5957 (JSC::SymbolTableEntry::getAttributes):
5958 (JSC::SymbolTableEntry::isReadOnly):
5959 (JSC::SymbolTableEntry::watchpointSet):
5960 (JSC::SymbolTableEntry::notifyWrite):
5961 (FatEntry):
5962 (JSC::SymbolTableEntry::FatEntry::FatEntry):
5963 (JSC::SymbolTableEntry::isFat):
5964 (JSC::SymbolTableEntry::fatEntry):
5965 (JSC::SymbolTableEntry::inflate):
5966 (JSC::SymbolTableEntry::bits):
5967 (JSC::SymbolTableEntry::freeFatEntry):
5968 (JSC::SymbolTableEntry::pack):
5969 (JSC::SymbolTableEntry::isValidIndex):
5970
59712012-06-12 Filip Pizlo <fpizlo@apple.com>
5972
fpizlo@apple.com3bdd4c92012-06-13 04:56:22 +00005973 Unreviewed build fix for ARMv7 debug builds.
5974
5975 * jit/JITStubs.cpp:
5976 (JSC::JITThunks::JITThunks):
5977
ggaren@apple.com3c89f392012-06-13 02:50:50 +000059782012-06-12 Geoffrey Garen <ggaren@apple.com>
5979
5980 Build fix for case-sensitive file systems: use the right case.
5981
5982 * heap/ListableHandler.h:
5983
ggaren@apple.com639160c2012-06-13 02:06:50 +000059842012-06-11 Geoffrey Garen <ggaren@apple.com>
5985
5986 GC should be 1.7X faster
5987 https://bugs.webkit.org/show_bug.cgi?id=88840
5988
5989 Reviewed by Oliver Hunt.
5990
5991 I profiled, and removed anything that showed up as a concurrency
5992 bottleneck. Then, I added 3 threads to our max thread count, since we
5993 can scale up to more threads now.
5994
5995 * heap/BlockAllocator.cpp:
5996 (JSC::BlockAllocator::BlockAllocator):
5997 (JSC::BlockAllocator::~BlockAllocator):
5998 (JSC::BlockAllocator::releaseFreeBlocks):
5999 (JSC::BlockAllocator::waitForRelativeTimeWhileHoldingLock):
6000 (JSC::BlockAllocator::waitForRelativeTime):
6001 (JSC::BlockAllocator::blockFreeingThreadMain):
6002 * heap/BlockAllocator.h:
6003 (BlockAllocator):
6004 (JSC::BlockAllocator::allocate):
6005 (JSC::BlockAllocator::deallocate): Use a spin lock for the common case
6006 where we're just popping a linked list. (A pthread mutex would sleep our
6007 thread even if the lock were only contended for a microsecond.)
6008
6009 Scope the lock to avoid holding it while allocating VM, since that's a
6010 slow activity and it doesn't modify any of our data structures.
6011
6012 We still use a pthread mutex to handle our condition variable since we
6013 have to, and it's not a hot path.
6014
6015 * heap/CopiedSpace.cpp:
6016 (JSC::CopiedSpace::CopiedSpace):
6017 (JSC::CopiedSpace::doneFillingBlock):
6018 * heap/CopiedSpace.h:
6019 (JSC::CopiedSpace::CopiedSpace): Use a spin lock for the to space lock,
6020 since it just guards linked list and hash table manipulation.
6021
6022 * heap/MarkStack.cpp:
6023 (JSC::MarkStackSegmentAllocator::MarkStackSegmentAllocator):
6024 (JSC::MarkStackSegmentAllocator::allocate):
6025 (JSC::MarkStackSegmentAllocator::release):
6026 (JSC::MarkStackSegmentAllocator::shrinkReserve): Use a spin lock, since
6027 we're just managing a linked list.
6028
6029 (JSC::MarkStackArray::donateSomeCellsTo): Changed donation to be proportional
6030 to our current stack size. This fixes cases where we used to donate too
6031 much. Interestingly, donating too much was starving the donor (when it
6032 ran out of work later) *and* the recipient (since it had to wait on a
6033 long donation operation to complete before it could acquire the lock).
6034
6035 In the worst case, we're still guaranteed to donate N cells in roughly log N time.
6036
6037 This change also fixes cases where we used to donate too little, since
6038 we would always keep a fixed minimum number of cells. In the worst case,
6039 with N marking threads, would could have N large object graph roots in
6040 our stack for the duration of GC, and scale to only 1 thread.
6041
6042 It's an interesting observation that a single object in the mark stack
6043 might represent an arbitrarily large object graph -- and only the act
6044 of marking can find out.
6045
6046 (JSC::MarkStackArray::stealSomeCellsFrom): Steal in proportion to idle
6047 threads. Once again, this fixes cases where constants could cause us
6048 to steal too much or too little.
6049
6050 (JSC::SlotVisitor::donateKnownParallel): Always wake up other threads
6051 if they're idle. We can afford to do this because we're conservative
6052 about when we donate.
6053
6054 (JSC::SlotVisitor::drainFromShared):
6055 * heap/MarkStack.h:
6056 (MarkStackSegmentAllocator):
6057 (MarkStackArray):
6058 (JSC):
6059 * heap/SlotVisitor.h: Merged the "should I donate?" decision into a
6060 single function, for simplicity.
6061
6062 * runtime/Options.cpp:
6063 (minimumNumberOfScansBetweenRebalance): Reduced the delay before donation
6064 a lot. We can afford to do this because, in the common case, donation is
6065 a single branch that decides not to donate.
6066
6067 (cpusToUse): Use more CPUs now, since we scale better now.
6068
6069 * runtime/Options.h:
6070 (Options): Removed now-unused variables.
6071
fpizlo@apple.com53ef1042012-06-13 01:29:07 +000060722012-06-12 Filip Pizlo <fpizlo@apple.com>
6073
6074 REGRESSION(120121): inspector tests crash in DFG
6075 https://bugs.webkit.org/show_bug.cgi?id=88941
6076
6077 Reviewed by Geoffrey Garen.
6078
6079 The CFG simplifier has two different ways of fixing up GetLocal, Phantom, and Flush. If we've
6080 already fixed up the node one way, we shouldn't try the other way. The reason why we shouldn't
6081 is that the second way depends on the node referring to other nodes in the to-be-jettisoned
6082 block. After fixup they potentially will refer to nodes in the block being merged to.
6083
6084 * dfg/DFGCFGSimplificationPhase.cpp:
6085 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
6086 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
6087
leo.yang@torchmobile.com.cneac79cd2012-06-13 00:23:49 +000060882012-06-12 Leo Yang <leo.yang@torchmobile.com.cn>
6089
6090 Dynamic hash table in DOMObjectHashTableMap is wrong in multiple threads
6091 https://bugs.webkit.org/show_bug.cgi?id=87334
6092
6093 Reviewed by Geoffrey Garen.
6094
6095 Add a copy member function to JSC::HasTable. This function will copy all data
6096 members except for *table* which contains thread specific data that prevents
6097 up copying it. When you want to copy a JSC::HashTable that was constructed
6098 on another thread you should call JSC::HashTable::copy().
6099
6100 * runtime/Lookup.h:
6101 (JSC::HashTable::copy):
6102 (HashTable):
6103
fpizlo@apple.comdfd92802012-06-12 21:15:43 +000061042012-06-12 Filip Pizlo <fpizlo@apple.com>
6105
fpizlo@apple.com888325a2012-06-12 23:16:51 +00006106 DFG should not ASSERT if you have a double use of a variable that is not revealed to be a double
6107 until after CFG simplification
6108 https://bugs.webkit.org/show_bug.cgi?id=88927
6109 <rdar://problem/11513971>
6110
6111 Reviewed by Geoffrey Garen.
6112
6113 Speculation fixup needs to run if simplification did things, because simplification can change
6114 predictions - particularly if you had a control flow path that stored weird things into a
6115 variable, but that path got axed by the simplifier.
6116
6117 Running fixup in the fixpoint requires making it idempotent, which it previously wasn't. Only
6118 one place needed to be changed, namely the un-MustGenerate-ion of ValueToInt32.
6119
6120 * dfg/DFGDriver.cpp:
6121 (JSC::DFG::compile):
6122 * dfg/DFGFixupPhase.cpp:
6123 (JSC::DFG::FixupPhase::fixupNode):
6124
61252012-06-12 Filip Pizlo <fpizlo@apple.com>
6126
fpizlo@apple.comdfd92802012-06-12 21:15:43 +00006127 REGRESSION (r119779): Javascript TypeError: 'undefined' is not an object
6128 https://bugs.webkit.org/show_bug.cgi?id=88783
6129 <rdar://problem/11640299>
6130
6131 Reviewed by Geoffrey Garen.
6132
6133 If you don't keep alive the base of an object access over the various checks
6134 you do for the prototype chain, you're going to have a bad time.
6135
6136 * dfg/DFGByteCodeParser.cpp:
6137 (JSC::DFG::ByteCodeParser::handleGetById):
6138
commit-queue@webkit.orgce7e7ef2012-06-12 07:08:14 +000061392012-06-12 Hojong Han <hojong.han@samsung.com>
6140
6141 Property names of the built-in object cannot be retrieved
6142 after trying to delete one of its properties
6143 https://bugs.webkit.org/show_bug.cgi?id=86461
6144
6145 Reviewed by Gavin Barraclough.
6146
6147 * runtime/JSObject.cpp:
6148 (JSC::getClassPropertyNames):
6149 (JSC::JSObject::getOwnPropertyNames):
6150
gyuyoung.kim@samsung.com7a201592012-06-12 00:58:24 +000061512012-06-11 Gyuyoung Kim <gyuyoung.kim@samsung.com>
6152
6153 [CMAKE][EFL] Remove duplicated executable output path
6154 https://bugs.webkit.org/show_bug.cgi?id=88765
6155
6156 Reviewed by Daniel Bates.
6157
6158 CMake files for EFL port have redefined executable output path. However, EFL port doesn't
6159 need to define again because it is already defined in top-level CMake file.
6160
6161 * shell/CMakeLists.txt:
6162
carlosgc@webkit.orgf4fbe002012-06-11 15:31:19 +000061632012-06-11 Carlos Garcia Campos <cgarcia@igalia.com>
6164
6165 Unreviewed. Fix make distcheck issues.
6166
6167 * GNUmakefile.list.am: Remove non existent header file.
6168
paroga@webkit.org7a01e282012-06-10 12:25:57 +000061692012-06-10 Patrick Gansterer <paroga@webkit.org>
6170
paroga@webkit.orga601a8b2012-06-10 12:49:32 +00006171 Unreviewed. Build fix for !ENABLE(JIT) after r119844 and r119925.
6172
6173 * runtime/Executable.h:
6174 (ExecutableBase):
6175 (JSC::ExecutableBase::clearCodeVirtual):
6176
61772012-06-10 Patrick Gansterer <paroga@webkit.org>
6178
paroga@webkit.org7a01e282012-06-10 12:25:57 +00006179 Unreviewed. Build fix for !ENABLE(JIT) after r119844.
6180
6181 * runtime/Executable.h:
6182 (ExecutableBase):
6183 (JSC):
6184
dominicc@chromium.org2a95e332012-06-10 06:31:14 +000061852012-06-09 Dominic Cooney <dominicc@chromium.org>
6186
6187 [Chromium] Remove JavaScriptCore dependencies from gyp
6188 https://bugs.webkit.org/show_bug.cgi?id=88510
6189
6190 Reviewed by Adam Barth.
6191
6192 Chromium doesn't support JSC any more and there doesn't seem to be
6193 a strong interest in using GYP as the common build system in other
6194 ports.
6195
6196 * JavaScriptCore.gyp/JavaScriptCore.gyp: WebCore still depends on YARR interpreter.
6197 * JavaScriptCore.gypi: Only include YARR source.
6198 * gyp/JavaScriptCore.gyp: Removed.
6199 * gyp/gtk.gyp: Removed.
6200
ggaren@apple.com642da3e2012-06-09 17:34:30 +000062012012-06-09 Geoffrey Garen <ggaren@apple.com>
6202
6203 Unreviewed, rolling back in part2 of r118646.
6204
6205 This patch removes eager finalization.
6206
6207 Weak pointer finalization should be lazy
6208 https://bugs.webkit.org/show_bug.cgi?id=87599
6209
6210 Reviewed by Sam Weinig.
6211
6212 * heap/Heap.cpp:
6213 (JSC::Heap::collect): Don't finalize eagerly -- we'll do it lazily.
6214
6215 * heap/MarkedBlock.cpp:
6216 (JSC::MarkedBlock::sweep): Do sweep weak sets when sweeping a block,
6217 since we won't get another chance.
6218
6219 * heap/MarkedBlock.h:
6220 (JSC::MarkedBlock::sweepWeakSet):
6221 * heap/MarkedSpace.cpp:
6222 (MarkedSpace::WeakSetSweep):
6223 * heap/MarkedSpace.h:
6224 (JSC::MarkedSpace::sweepWeakSets): Removed now-unused code.
6225
commit-queue@webkit.org5deb7492012-06-09 09:05:22 +000062262012-06-09 Sukolsak Sakshuwong <sukolsak@google.com>
6227
6228 Add UNDO_MANAGER flag
6229 https://bugs.webkit.org/show_bug.cgi?id=87908
6230
6231 Reviewed by Tony Chang.
6232
6233 * Configurations/FeatureDefines.xcconfig:
6234
ggaren@apple.com642da3e2012-06-09 17:34:30 +000062352012-06-08 Geoffrey Garen <ggaren@apple.com>
ggaren@apple.com218a16a2012-06-08 23:57:58 +00006236
6237 Unreviewed, rolling back in part1 of r118646.
6238
6239 This patch includes everything necessary for lazy finalization, but
6240 keeps eager finalization enabled for the time being.
6241
6242 Weak pointer finalization should be lazy
6243 https://bugs.webkit.org/show_bug.cgi?id=87599
6244
6245 Reviewed by Sam Weinig.
6246
6247 * heap/MarkedBlock.cpp:
6248 * heap/MarkedBlock.h:
6249 (JSC::MarkedBlock::resetAllocator):
6250 * heap/MarkedSpace.cpp:
6251 (JSC::MarkedSpace::resetAllocators):
6252 * heap/MarkedSpace.h:
6253 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
6254 It will happen automatically when a weak set is swept. It's simpler to
6255 have only one canonical way for this to happen, and it wasn't buying
6256 us anything to do it eagerly.
6257 * heap/WeakBlock.cpp:
6258 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
6259 the sweep would be a no-op. If even one finalizer is pending, we need to
6260 run it, since we won't get another chance.
6261 * heap/WeakSet.cpp:
6262 (JSC::WeakSet::sweep): This loop can be simpler now that
6263 WeakBlock::sweep() does what we mean.
6264 Reset our allocator after a sweep because this is the optimal time to
6265 start trying to recycle old weak pointers.
6266 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
6267 allocator because we've swept already, and forcing a new sweep would be
6268 wasteful.
6269 * heap/WeakSet.h:
6270 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
6271 because the shrink may have removed the block the allocator was going to
6272 allocate out of.
6273
barraclough@apple.com9dd771c2012-06-08 21:30:35 +000062742012-06-08 Gavin Barraclough <barraclough@apple.com>
6275
6276 Unreviewed roll out r119795.
6277
6278 This broke jquery/core.html
6279
6280 * dfg/DFGSpeculativeJIT.h:
6281 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
6282 * jit/JITInlineMethods.h:
6283 (JSC::JIT::emitAllocateBasicJSObject):
6284 * llint/LowLevelInterpreter.asm:
6285 * runtime/JSGlobalData.h:
6286 (JSGlobalData):
6287 * runtime/JSGlobalThis.cpp:
6288 (JSC::JSGlobalThis::setUnwrappedObject):
6289 * runtime/JSObject.cpp:
6290 (JSC::JSObject::visitChildren):
6291 (JSC::JSObject::createInheritorID):
6292 * runtime/JSObject.h:
6293 (JSObject):
6294 (JSC::JSObject::resetInheritorID):
6295 (JSC):
6296 (JSC::JSObject::offsetOfInheritorID):
6297 (JSC::JSObject::inheritorID):
6298
fpizlo@apple.com0bcbc112012-06-08 20:02:57 +000062992012-06-08 Filip Pizlo <fpizlo@apple.com>
6300
6301 PredictedType should be called SpeculatedType
6302 https://bugs.webkit.org/show_bug.cgi?id=88477
6303
6304 Unreviewed, fix a renaming goof from http://trac.webkit.org/changeset/119660.
6305 I accidentally renamed ByteCodeParser::getPrediction to
6306 ByteCodeParser::getSpeculation. That was not the intent. This changes it
6307 back.
6308
6309 * dfg/DFGByteCodeParser.cpp:
6310 (JSC::DFG::ByteCodeParser::addCall):
6311 (JSC::DFG::ByteCodeParser::getPredictionWithoutOSRExit):
6312 (JSC::DFG::ByteCodeParser::getPrediction):
6313 (JSC::DFG::ByteCodeParser::handleCall):
6314 (JSC::DFG::ByteCodeParser::parseBlock):
6315
wingo@igalia.com332e9bf2012-06-08 19:57:40 +000063162012-06-08 Andy Wingo <wingo@igalia.com>
6317
6318 Explictly mark stubs called by JIT as being internal
6319 https://bugs.webkit.org/show_bug.cgi?id=88552
6320
6321 Reviewed by Filip Pizlo.
6322
6323 * dfg/DFGOSRExitCompiler.h:
6324 * dfg/DFGOperations.cpp:
6325 * dfg/DFGOperations.h:
6326 * jit/HostCallReturnValue.h:
6327 * jit/JITStubs.cpp:
6328 * jit/JITStubs.h:
6329 * jit/ThunkGenerators.cpp:
6330 * llint/LLIntSlowPaths.h: Mark a bunch of stubs as being
6331 WTF_INTERNAL. Change most calls to SYMBOL_STRING_RELOCATION to
6332 LOCAL_REFERENCE, or GLOBAL_REFERENCE in the case of the wrappers
6333 to truly global symbols.
6334 * offlineasm/asm.rb: Generate LOCAL_REFERENCE instead of
6335 SYMBOL_STRING_RELOCATION.
6336
fpizlo@apple.comf4a2ac32012-06-08 20:04:47 +000063372012-06-08 Geoffrey Garen <ggaren@apple.com>
6338
ggaren@apple.comd7147572012-06-08 18:17:16 +00006339 Don't rely on weak pointers for eager CodeBlock finalization
6340 https://bugs.webkit.org/show_bug.cgi?id=88465
6341
6342 Reviewed by Gavin Barraclough.
6343
6344 This is incompatible with lazy weak pointer finalization.
6345
6346 I considered just making CodeBlock finalization lazy-friendly, but it
6347 turns out that the heap is already way up in CodeBlock's business when
6348 it comes to finalization, so I decided to finish the job and move full
6349 responsibility for CodeBlock finalization into the heap.
6350
6351 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Maybe this
6352 will build.
6353
6354 * debugger/Debugger.cpp: Updated for rename.
6355
6356 * heap/Heap.cpp:
6357 (JSC::Heap::deleteAllCompiledCode): Renamed for consistency. Fixed a bug
6358 where we would not delete code for a code block that had been previously
6359 jettisoned. I don't know if this happens in practice -- I mostly did
6360 this to improve consistency with deleteUnmarkedCompiledCode.
6361
6362 (JSC::Heap::deleteUnmarkedCompiledCode): New function, responsible for
6363 eager finalization of unmarked code blocks.
6364
6365 (JSC::Heap::collect): Updated for rename. Updated to call
6366 deleteUnmarkedCompiledCode(), which takes care of jettisoned DFG code
6367 blocks too.
6368
6369 (JSC::Heap::addCompiledCode): Renamed, since this points to all code
6370 now, not just functions.
6371
6372 * heap/Heap.h:
6373 (Heap): Keep track of all user code, not just functions. This is a
6374 negligible additional overhead, since most code is function code.
6375
6376 * runtime/Executable.cpp:
6377 (JSC::*::finalize): Removed these functions, since we don't rely on
6378 weak pointer finalization anymore.
6379
6380 (JSC::FunctionExecutable::FunctionExecutable): Moved linked-list stuff
6381 into base class so all executables can be in the list.
6382
6383 (JSC::EvalExecutable::clearCode):
6384 (JSC::ProgramExecutable::clearCode):
6385 (JSC::FunctionExecutable::clearCode): All we need to do is delete our
6386 CodeBlock -- that will delete all of its internal data structures.
6387
6388 (JSC::FunctionExecutable::clearCodeIfNotCompiling): Factored out a helper
6389 function to improve clarity.
6390
6391 * runtime/Executable.h:
6392 (JSC::ExecutableBase): Moved linked-list stuff
6393 into base class so all executables can be in the list.
6394
6395 (JSC::NativeExecutable::create):
6396 (NativeExecutable):
6397 (ScriptExecutable):
6398 (JSC::ScriptExecutable::finishCreation):
6399 (JSC::EvalExecutable::create):
6400 (EvalExecutable):
6401 (JSC::ProgramExecutable::create):
6402 (ProgramExecutable):
6403 (FunctionExecutable):
6404 (JSC::FunctionExecutable::create): Don't use a finalizer -- the heap
6405 will call us back to destroy our code block.
6406
6407 (JSC::FunctionExecutable::discardCode): Renamed to clearCodeIfNotCompiling()
6408 for clarity.
6409
6410 (JSC::FunctionExecutable::isCompiling): New helper function, for clarity.
6411
6412 (JSC::ScriptExecutable::clearCodeVirtual): New helper function, since
6413 the heap needs to make polymorphic calls to clear code.
6414
6415 * runtime/JSGlobalData.cpp:
6416 (JSC::StackPreservingRecompiler::operator()):
6417 * runtime/JSGlobalObject.cpp:
6418 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for
6419 renames.
6420
fpizlo@apple.comfd598b92012-06-08 01:31:21 +000064212012-06-07 Filip Pizlo <fpizlo@apple.com>
6422
6423 DFG should inline prototype chain accesses, and do the right things if the
6424 specific function optimization is available
6425 https://bugs.webkit.org/show_bug.cgi?id=88594
6426
6427 Reviewed by Gavin Barraclough.
6428
6429 Looks like a 3% win on V8.
6430
6431 * bytecode/CodeBlock.h:
6432 (JSC::Structure::prototypeForLookup):
6433 (JSC):
6434 * bytecode/GetByIdStatus.cpp:
6435 (JSC::GetByIdStatus::computeFromLLInt):
6436 (JSC):
6437 (JSC::GetByIdStatus::computeForChain):
6438 (JSC::GetByIdStatus::computeFor):
6439 * bytecode/GetByIdStatus.h:
6440 (JSC::GetByIdStatus::GetByIdStatus):
6441 (JSC::GetByIdStatus::isSimple):
6442 (JSC::GetByIdStatus::chain):
6443 (JSC::GetByIdStatus::specificValue):
6444 (GetByIdStatus):
6445 * bytecode/StructureSet.h:
6446 (StructureSet):
6447 (JSC::StructureSet::singletonStructure):
6448 * bytecode/StructureStubInfo.h:
6449 (JSC::StructureStubInfo::initGetByIdProto):
6450 (JSC::StructureStubInfo::initGetByIdChain):
6451 * dfg/DFGByteCodeParser.cpp:
6452 (JSC::DFG::ByteCodeParser::handleGetById):
6453 * dfg/DFGRepatch.cpp:
6454 (JSC::DFG::tryCacheGetByID):
6455 * jit/JITStubs.cpp:
6456 (JSC::JITThunks::tryCacheGetByID):
6457 * runtime/JSGlobalObject.h:
6458 (JSC::Structure::prototypeForLookup):
6459 (JSC):
6460 * runtime/Structure.h:
6461 (Structure):
6462
barraclough@apple.com48386932012-06-08 00:29:27 +000064632012-06-07 Gavin Barraclough <barraclough@apple.com>
6464
barraclough@apple.com64b74e02012-06-08 04:25:58 +00006465 Remove JSObject::m_inheritorID
6466 https://bugs.webkit.org/show_bug.cgi?id=88378
6467
6468 Reviewed by Geoff Garen.
6469
6470 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
6471 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
6472 Instead use a private named value in the object's property storage.
6473
6474 * dfg/DFGSpeculativeJIT.h:
6475 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
6476 - No need m_inheritorID to initialize!
6477 * jit/JITInlineMethods.h:
6478 (JSC::JIT::emitAllocateBasicJSObject):
6479 - No need m_inheritorID to initialize!
6480 * llint/LowLevelInterpreter.asm:
6481 - No need m_inheritorID to initialize!
6482 * runtime/JSGlobalData.h:
6483 (JSGlobalData):
6484 - Added private name 'm_inheritorIDKey'.
6485 * runtime/JSGlobalThis.cpp:
6486 (JSC::JSGlobalThis::setUnwrappedObject):
6487 - resetInheritorID is now passed a JSGlobalData&.
6488 * runtime/JSObject.cpp:
6489 (JSC::JSObject::visitChildren):
6490 - No m_inheritorID to be marked.
6491 (JSC::JSObject::createInheritorID):
6492 - Store the newly created inheritorID in the property map.
6493 * runtime/JSObject.h:
6494 (JSC::JSObject::resetInheritorID):
6495 - Remove the inheritorID from property storage.
6496 (JSC::JSObject::inheritorID):
6497 - Read the inheritorID from property storage.
6498
64992012-06-07 Gavin Barraclough <barraclough@apple.com>
6500
barraclough@apple.com48386932012-06-08 00:29:27 +00006501 Math.pow on iOS does not support denormal numbers.
6502 https://bugs.webkit.org/show_bug.cgi?id=88592
6503
6504 Reviewed by Filip Pizlo.
6505
6506 Import an implementation from fdlibm, detect cases where it is safe to use the system
6507 implementation & where we should fall back to fdlibm.
6508
6509 * runtime/MathObject.cpp:
6510 (JSC::isDenormal):
6511 (JSC::isEdgeCase):
6512 (JSC::mathPow):
6513 - On iOS, detect cases where denormal support may be required & use fdlibm in these cases.
6514 (JSC::mathProtoFuncPow):
6515 - Changed to use mathPow.
6516 (JSC::fdlibmScalbn):
6517 (JSC::fdlibmPow):
6518 - These functions imported from fdlibm; original style retained to ease future merging.
6519
paroga@webkit.orga334f732012-06-07 23:24:14 +000065202012-06-07 Patrick Gansterer <paroga@webkit.org>
6521
6522 Unreviewed. Build fix for !ENABLE(JIT) after r119441.
6523
6524 * interpreter/Interpreter.cpp:
6525 (JSC::Interpreter::privateExecute):
6526
wingo@igalia.comb8305a82012-06-07 16:05:19 +000065272012-06-07 Andy Wingo <wingo@igalia.com>
6528
6529 Unreviewed build fix after r119593.
6530
6531 * llint/LLIntOfflineAsmConfig.h (OFFLINE_ASM_GLOBAL_LABEL): Fix
6532 uses of "name" to be "label", the macro's parameter. Otherwise we
6533 serialize mentions of the literal symbol "name" into the objcode.
6534 Causes a build error using GNU ld (not gold).
6535
rniwa@webkit.org475cf8d2012-06-07 02:47:14 +000065362012-06-06 Ryosuke Niwa <rniwa@webkit.org>
6537
6538 Chromium build fix attempt. Why do we need to list these files in gyp!?
6539
6540 * JavaScriptCore.gypi:
6541
fpizlo@apple.comd5547492012-06-07 00:23:36 +000065422012-06-06 Filip Pizlo <fpizlo@apple.com>
6543
fpizlo@apple.com62336162012-06-07 01:35:59 +00006544 PredictedType should be called SpeculatedType
6545 https://bugs.webkit.org/show_bug.cgi?id=88477
6546
6547 Rubber stamped by Gavin Barraclough.
6548
6549 * CMakeLists.txt:
6550 * GNUmakefile.list.am:
6551 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6552 * JavaScriptCore.xcodeproj/project.pbxproj:
6553 * Target.pri:
6554 * bytecode/CodeBlock.cpp:
6555 (JSC::CodeBlock::shouldOptimizeNow):
6556 (JSC::CodeBlock::dumpValueProfiles):
6557 * bytecode/CodeBlock.h:
6558 (JSC::CodeBlock::valueProfilePredictionForBytecodeOffset):
6559 * bytecode/LazyOperandValueProfile.cpp:
6560 (JSC::LazyOperandValueProfileParser::prediction):
6561 * bytecode/LazyOperandValueProfile.h:
6562 (LazyOperandValueProfileParser):
6563 * bytecode/PredictedType.cpp: Removed.
6564 * bytecode/PredictedType.h: Removed.
6565 * bytecode/SpeculatedType.cpp: Copied from Source/JavaScriptCore/bytecode/PredictedType.cpp.
6566 (JSC::speculationToString):
6567 (JSC::speculationToAbbreviatedString):
6568 (JSC::speculationFromClassInfo):
6569 (JSC::speculationFromStructure):
6570 (JSC::speculationFromCell):
6571 (JSC::speculationFromValue):
6572 * bytecode/SpeculatedType.h: Copied from Source/JavaScriptCore/bytecode/PredictedType.h.
6573 (JSC):
6574 (JSC::isAnySpeculation):
6575 (JSC::isCellSpeculation):
6576 (JSC::isObjectSpeculation):
6577 (JSC::isFinalObjectSpeculation):
6578 (JSC::isFinalObjectOrOtherSpeculation):
6579 (JSC::isFixedIndexedStorageObjectSpeculation):
6580 (JSC::isStringSpeculation):
6581 (JSC::isArraySpeculation):
6582 (JSC::isFunctionSpeculation):
6583 (JSC::isInt8ArraySpeculation):
6584 (JSC::isInt16ArraySpeculation):
6585 (JSC::isInt32ArraySpeculation):
6586 (JSC::isUint8ArraySpeculation):
6587 (JSC::isUint8ClampedArraySpeculation):
6588 (JSC::isUint16ArraySpeculation):
6589 (JSC::isUint32ArraySpeculation):
6590 (JSC::isFloat32ArraySpeculation):
6591 (JSC::isFloat64ArraySpeculation):
6592 (JSC::isArgumentsSpeculation):
6593 (JSC::isActionableIntMutableArraySpeculation):
6594 (JSC::isActionableFloatMutableArraySpeculation):
6595 (JSC::isActionableTypedMutableArraySpeculation):
6596 (JSC::isActionableMutableArraySpeculation):
6597 (JSC::isActionableArraySpeculation):
6598 (JSC::isArrayOrOtherSpeculation):
6599 (JSC::isMyArgumentsSpeculation):
6600 (JSC::isInt32Speculation):
6601 (JSC::isDoubleRealSpeculation):
6602 (JSC::isDoubleSpeculation):
6603 (JSC::isNumberSpeculation):
6604 (JSC::isBooleanSpeculation):
6605 (JSC::isOtherSpeculation):
6606 (JSC::isEmptySpeculation):
6607 (JSC::mergeSpeculations):
6608 (JSC::mergeSpeculation):
6609 * bytecode/StructureSet.h:
6610 (JSC::StructureSet::speculationFromStructures):
6611 * bytecode/ValueProfile.h:
6612 (JSC::ValueProfileBase::ValueProfileBase):
6613 (JSC::ValueProfileBase::dump):
6614 (JSC::ValueProfileBase::computeUpdatedPrediction):
6615 (ValueProfileBase):
6616 * dfg/DFGAbstractState.cpp:
6617 (JSC::DFG::AbstractState::initialize):
6618 (JSC::DFG::AbstractState::execute):
6619 (JSC::DFG::AbstractState::mergeStateAtTail):
6620 * dfg/DFGAbstractState.h:
6621 (JSC::DFG::AbstractState::speculateInt32Unary):
6622 (JSC::DFG::AbstractState::speculateNumberUnary):
6623 (JSC::DFG::AbstractState::speculateBooleanUnary):
6624 (JSC::DFG::AbstractState::speculateInt32Binary):
6625 (JSC::DFG::AbstractState::speculateNumberBinary):
6626 * dfg/DFGAbstractValue.h:
6627 (JSC::DFG::StructureAbstractValue::filter):
6628 (JSC::DFG::StructureAbstractValue::speculationFromStructures):
6629 (JSC::DFG::AbstractValue::AbstractValue):
6630 (JSC::DFG::AbstractValue::clear):
6631 (JSC::DFG::AbstractValue::isClear):
6632 (JSC::DFG::AbstractValue::makeTop):
6633 (JSC::DFG::AbstractValue::clobberStructures):
6634 (JSC::DFG::AbstractValue::isTop):
6635 (JSC::DFG::AbstractValue::set):
6636 (JSC::DFG::AbstractValue::merge):
6637 (JSC::DFG::AbstractValue::filter):
6638 (JSC::DFG::AbstractValue::validateIgnoringValue):
6639 (JSC::DFG::AbstractValue::validate):
6640 (JSC::DFG::AbstractValue::checkConsistency):
6641 (JSC::DFG::AbstractValue::dump):
6642 (AbstractValue):
6643 * dfg/DFGArgumentPosition.h:
6644 (JSC::DFG::ArgumentPosition::ArgumentPosition):
6645 (JSC::DFG::ArgumentPosition::mergeArgumentAwareness):
6646 (JSC::DFG::ArgumentPosition::prediction):
6647 (ArgumentPosition):
6648 * dfg/DFGArgumentsSimplificationPhase.cpp:
6649 (JSC::DFG::ArgumentsSimplificationPhase::run):
6650 * dfg/DFGByteCodeParser.cpp:
6651 (ByteCodeParser):
6652 (JSC::DFG::ByteCodeParser::injectLazyOperandSpeculation):
6653 (JSC::DFG::ByteCodeParser::getLocal):
6654 (JSC::DFG::ByteCodeParser::getArgument):
6655 (JSC::DFG::ByteCodeParser::addCall):
6656 (JSC::DFG::ByteCodeParser::getSpeculationWithoutOSRExit):
6657 (JSC::DFG::ByteCodeParser::getSpeculation):
6658 (InlineStackEntry):
6659 (JSC::DFG::ByteCodeParser::handleCall):
6660 (JSC::DFG::ByteCodeParser::handleIntrinsic):
6661 (JSC::DFG::ByteCodeParser::handleGetById):
6662 (JSC::DFG::ByteCodeParser::parseBlock):
6663 (JSC::DFG::ByteCodeParser::fixVariableAccessSpeculations):
6664 (JSC::DFG::ByteCodeParser::parse):
6665 * dfg/DFGCSEPhase.cpp:
6666 (JSC::DFG::CSEPhase::getIndexedPropertyStorageLoadElimination):
6667 (JSC::DFG::CSEPhase::performNodeCSE):
6668 * dfg/DFGConstantFoldingPhase.cpp:
6669 (JSC::DFG::ConstantFoldingPhase::run):
6670 * dfg/DFGFixupPhase.cpp:
6671 (JSC::DFG::FixupPhase::fixupNode):
6672 (JSC::DFG::FixupPhase::fixDoubleEdge):
6673 * dfg/DFGGraph.cpp:
6674 (JSC::DFG::Graph::nameOfVariableAccessData):
6675 (JSC::DFG::Graph::dump):
6676 (JSC::DFG::Graph::predictArgumentTypes):
6677 * dfg/DFGGraph.h:
6678 (JSC::DFG::Graph::getJSConstantSpeculation):
6679 (JSC::DFG::Graph::isPredictedNumerical):
6680 (JSC::DFG::Graph::byValIsPure):
6681 * dfg/DFGJITCompiler.h:
6682 (JSC::DFG::JITCompiler::getSpeculation):
6683 * dfg/DFGNode.h:
6684 (JSC::DFG::Node::Node):
6685 (JSC::DFG::Node::getHeapPrediction):
6686 (JSC::DFG::Node::predictHeap):
6687 (JSC::DFG::Node::prediction):
6688 (JSC::DFG::Node::predict):
6689 (JSC::DFG::Node::shouldSpeculateInteger):
6690 (JSC::DFG::Node::shouldSpeculateDouble):
6691 (JSC::DFG::Node::shouldSpeculateNumber):
6692 (JSC::DFG::Node::shouldSpeculateBoolean):
6693 (JSC::DFG::Node::shouldSpeculateFinalObject):
6694 (JSC::DFG::Node::shouldSpeculateFinalObjectOrOther):
6695 (JSC::DFG::Node::shouldSpeculateArray):
6696 (JSC::DFG::Node::shouldSpeculateArguments):
6697 (JSC::DFG::Node::shouldSpeculateInt8Array):
6698 (JSC::DFG::Node::shouldSpeculateInt16Array):
6699 (JSC::DFG::Node::shouldSpeculateInt32Array):
6700 (JSC::DFG::Node::shouldSpeculateUint8Array):
6701 (JSC::DFG::Node::shouldSpeculateUint8ClampedArray):
6702 (JSC::DFG::Node::shouldSpeculateUint16Array):
6703 (JSC::DFG::Node::shouldSpeculateUint32Array):
6704 (JSC::DFG::Node::shouldSpeculateFloat32Array):
6705 (JSC::DFG::Node::shouldSpeculateFloat64Array):
6706 (JSC::DFG::Node::shouldSpeculateArrayOrOther):
6707 (JSC::DFG::Node::shouldSpeculateObject):
6708 (JSC::DFG::Node::shouldSpeculateCell):
6709 (Node):
6710 * dfg/DFGPredictionPropagationPhase.cpp:
6711 (JSC::DFG::PredictionPropagationPhase::setPrediction):
6712 (JSC::DFG::PredictionPropagationPhase::mergePrediction):
6713 (JSC::DFG::PredictionPropagationPhase::propagate):
6714 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
6715 * dfg/DFGSpeculativeJIT.cpp:
6716 (JSC::DFG::SpeculativeJIT::fillStorage):
6717 (JSC::DFG::SpeculativeJIT::writeBarrier):
6718 (JSC::DFG::GPRTemporary::GPRTemporary):
6719 (JSC::DFG::FPRTemporary::FPRTemporary):
6720 (JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
6721 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
6722 (JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
6723 (JSC::DFG::SpeculativeJIT::compile):
6724 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
6725 (JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
6726 (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
6727 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
6728 (JSC::DFG::SpeculativeJIT::compileDoubleAsInt32):
6729 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
6730 (JSC::DFG::SpeculativeJIT::compileGetTypedArrayLength):
6731 (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
6732 (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
6733 (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
6734 (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
6735 (JSC::DFG::SpeculativeJIT::compileInstanceOf):
6736 (JSC::DFG::SpeculativeJIT::compileAdd):
6737 (JSC::DFG::SpeculativeJIT::compileArithSub):
6738 (JSC::DFG::SpeculativeJIT::compileArithNegate):
6739 (JSC::DFG::SpeculativeJIT::compileArithMul):
6740 (JSC::DFG::SpeculativeJIT::compileArithMod):
6741 (JSC::DFG::SpeculativeJIT::compare):
6742 (JSC::DFG::SpeculativeJIT::compileStrictEq):
6743 (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
6744 (JSC::DFG::SpeculativeJIT::compileGetByValOnArguments):
6745 (JSC::DFG::SpeculativeJIT::compileGetArgumentsLength):
6746 (JSC::DFG::SpeculativeJIT::compileRegExpExec):
6747 * dfg/DFGSpeculativeJIT.h:
6748 (DFG):
6749 (JSC::DFG::ValueSource::forSpeculation):
6750 (SpeculativeJIT):
6751 (GPRTemporary):
6752 (FPRTemporary):
6753 (JSC::DFG::SpecDoubleOperand::SpecDoubleOperand):
6754 (JSC::DFG::SpecDoubleOperand::~SpecDoubleOperand):
6755 (JSC::DFG::SpecDoubleOperand::fpr):
6756 (JSC::DFG::SpecCellOperand::SpecCellOperand):
6757 (JSC::DFG::SpecCellOperand::~SpecCellOperand):
6758 (JSC::DFG::SpecCellOperand::gpr):
6759 (JSC::DFG::SpecBooleanOperand::SpecBooleanOperand):
6760 (JSC::DFG::SpecBooleanOperand::~SpecBooleanOperand):
6761 (JSC::DFG::SpecBooleanOperand::gpr):
6762 * dfg/DFGSpeculativeJIT32_64.cpp:
6763 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
6764 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
6765 (JSC::DFG::SpeculativeJIT::fillSpecCell):
6766 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
6767 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
6768 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
6769 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
6770 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
6771 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
6772 (JSC::DFG::SpeculativeJIT::emitBranch):
6773 (JSC::DFG::SpeculativeJIT::compile):
6774 * dfg/DFGSpeculativeJIT64.cpp:
6775 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
6776 (JSC::DFG::SpeculativeJIT::fillSpecDouble):
6777 (JSC::DFG::SpeculativeJIT::fillSpecCell):
6778 (JSC::DFG::SpeculativeJIT::fillSpecBoolean):
6779 (JSC::DFG::SpeculativeJIT::compileObjectEquality):
6780 (JSC::DFG::SpeculativeJIT::compileObjectToObjectOrOtherEquality):
6781 (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectToObjectOrOtherEquality):
6782 (JSC::DFG::SpeculativeJIT::compileDoubleCompare):
6783 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
6784 (JSC::DFG::SpeculativeJIT::emitBranch):
6785 (JSC::DFG::SpeculativeJIT::compile):
6786 * dfg/DFGVariableAccessData.h:
6787 (JSC::DFG::VariableAccessData::VariableAccessData):
6788 (JSC::DFG::VariableAccessData::predict):
6789 (JSC::DFG::VariableAccessData::nonUnifiedPrediction):
6790 (JSC::DFG::VariableAccessData::prediction):
6791 (JSC::DFG::VariableAccessData::argumentAwarePrediction):
6792 (JSC::DFG::VariableAccessData::mergeArgumentAwarePrediction):
6793 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote):
6794 (JSC::DFG::VariableAccessData::makePredictionForDoubleFormat):
6795 (VariableAccessData):
6796
67972012-06-06 Filip Pizlo <fpizlo@apple.com>
6798
fpizlo@apple.com26af9b62012-06-07 00:49:34 +00006799 Global object variable accesses should not require an extra load
6800 https://bugs.webkit.org/show_bug.cgi?id=88385
6801
6802 Reviewed by Gavin Barraclough and Geoffrey Garen.
6803
6804 Previously, if you wanted to access a global variable, you'd first have
6805 to load the register array from the appropriate global object and then
6806 either load or store at an offset to the register array. This is because
6807 JSGlobalObject inherited from JSVariableObject, and JSVariableObject is
6808 designed with the pessimistic assumption that its register array may
6809 point into the call stack. This is never the case for global objects.
6810 Hence, even though the global object may add more registers at any time,
6811 it does not need to store them in a contiguous array. It can use a
6812 SegmentedVector or similar.
6813
6814 This patch refactors global objects and variable objects as follows:
6815
6816 - The functionality to track variables in an indexable array using a
6817 SymbolTable to map names to indices is moved into JSSymbolTableObject,
6818 which is now a supertype of JSVariableObject. JSVariableObject is now
6819 just a holder for a registers array and implements the registerAt()
6820 method that is left abstract in JSSymbolTableObject. Because all users
6821 of JSVariableObject know whether they are a JSStaticScopeObject,
6822 JSActivation, or JSGlobalObject, this "abstract" method is not virtual;
6823 instead the utility methods that would call registerAt() are now
6824 template functions that require you to know statically what subtype of
6825 JSSymbolTableObject you're using (JSVariableObject or something else),
6826 so that registerAt() can be statically bound.
6827
6828 - A new class is added called JSSegmentedVariableObject, which only
6829 differs from JSVariableObject in how it allocates registers. It uses a
6830 SegmentedVector instead of manually managing a pointer to a contiguous
6831 slab of registers. This changes the interface somewhat; for example
6832 with JSVariableObject if you wanted to add a register you had to do
6833 it yourself since the JSVariableObject didn't know how the registers
6834 array ought to be allocated. With JSSegmentedVariableObject you can
6835 just call addRegisters(). JSSegmentedVariableObject preserves the
6836 invariant that once you get a pointer into a register, that pointer
6837 will continue to be valid so long as the JSSegmentedVariableObject is
6838 alive. This allows the JITs and interpreters to skip the extra load.
6839
6840 - JSGlobalObject now inherits from JSSegmentedVariableObject. For now
6841 (and possibly forever) it is the only subtype of this new class.
6842
6843 - The bytecode format is changed so that get_global_var and
6844 put_global_var have a pointer to the register directly rather than
6845 having an index. A convenience method is provided in
6846 JSSegmentedVariableObject to get the index given a a pointer, which is
6847 used for assertions and debug dumps.
6848
6849 This appears to be a 1% across the board win.
6850
6851 * CMakeLists.txt:
6852 * GNUmakefile.list.am:
6853 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
6854 * JavaScriptCore.xcodeproj/project.pbxproj:
6855 * Target.pri:
6856 * bytecode/CodeBlock.cpp:
6857 (JSC::CodeBlock::dump):
6858 * bytecode/Instruction.h:
6859 (Instruction):
6860 (JSC::Instruction::Instruction):
6861 * bytecompiler/BytecodeGenerator.cpp:
6862 (JSC::ResolveResult::registerPointer):
6863 (JSC):
6864 (JSC::BytecodeGenerator::BytecodeGenerator):
6865 (JSC::BytecodeGenerator::retrieveLastUnaryOp):
6866 (JSC::BytecodeGenerator::resolve):
6867 (JSC::BytecodeGenerator::resolveConstDecl):
6868 (JSC::BytecodeGenerator::emitGetStaticVar):
6869 (JSC::BytecodeGenerator::emitPutStaticVar):
6870 * bytecompiler/BytecodeGenerator.h:
6871 (ResolveResult):
6872 (BytecodeGenerator):
6873 * dfg/DFGAssemblyHelpers.h:
6874 (AssemblyHelpers):
6875 * dfg/DFGByteCodeParser.cpp:
6876 (JSC::DFG::ByteCodeParser::parseBlock):
6877 * dfg/DFGCSEPhase.cpp:
6878 (JSC::DFG::CSEPhase::globalVarLoadElimination):
6879 (JSC::DFG::CSEPhase::globalVarStoreElimination):
6880 (JSC::DFG::CSEPhase::performNodeCSE):
6881 * dfg/DFGGraph.cpp:
6882 (JSC::DFG::Graph::dump):
6883 * dfg/DFGGraph.h:
6884 (JSC::DFG::Graph::globalObjectFor):
6885 (Graph):
6886 * dfg/DFGNode.h:
6887 (JSC::DFG::Node::hasVarNumber):
6888 (Node):
6889 (JSC::DFG::Node::hasRegisterPointer):
6890 (JSC::DFG::Node::registerPointer):
6891 * dfg/DFGSpeculativeJIT32_64.cpp:
6892 (JSC::DFG::SpeculativeJIT::compile):
6893 * dfg/DFGSpeculativeJIT64.cpp:
6894 (JSC::DFG::SpeculativeJIT::compile):
6895 * heap/Heap.h:
6896 (Heap):
6897 (JSC::Heap::isWriteBarrierEnabled):
6898 (JSC):
6899 * interpreter/Interpreter.cpp:
6900 (JSC::Interpreter::execute):
6901 (JSC::Interpreter::privateExecute):
6902 * jit/JITPropertyAccess.cpp:
6903 (JSC::JIT::emit_op_get_global_var):
6904 (JSC::JIT::emit_op_put_global_var):
6905 * jit/JITPropertyAccess32_64.cpp:
6906 (JSC::JIT::emit_op_get_global_var):
6907 (JSC::JIT::emit_op_put_global_var):
6908 * llint/LowLevelInterpreter32_64.asm:
6909 * llint/LowLevelInterpreter64.asm:
6910 * runtime/JSGlobalObject.cpp:
6911 (JSC):
6912 (JSC::JSGlobalObject::put):
6913 (JSC::JSGlobalObject::putDirectVirtual):
6914 (JSC::JSGlobalObject::defineOwnProperty):
6915 (JSC::JSGlobalObject::visitChildren):
6916 (JSC::JSGlobalObject::addStaticGlobals):
6917 (JSC::JSGlobalObject::getOwnPropertySlot):
6918 (JSC::JSGlobalObject::getOwnPropertyDescriptor):
6919 * runtime/JSGlobalObject.h:
6920 (JSGlobalObject):
6921 (JSC::JSGlobalObject::JSGlobalObject):
6922 (JSC):
6923 (JSC::JSGlobalObject::hasOwnPropertyForWrite):
6924 * runtime/JSSegmentedVariableObject.cpp: Added.
6925 (JSC):
6926 (JSC::JSSegmentedVariableObject::findRegisterIndex):
6927 (JSC::JSSegmentedVariableObject::addRegisters):
6928 (JSC::JSSegmentedVariableObject::visitChildren):
6929 * runtime/JSSegmentedVariableObject.h: Added.
6930 (JSC):
6931 (JSSegmentedVariableObject):
6932 (JSC::JSSegmentedVariableObject::registerAt):
6933 (JSC::JSSegmentedVariableObject::assertRegisterIsInThisObject):
6934 (JSC::JSSegmentedVariableObject::JSSegmentedVariableObject):
6935 (JSC::JSSegmentedVariableObject::finishCreation):
6936 * runtime/JSStaticScopeObject.cpp:
6937 (JSC::JSStaticScopeObject::put):
6938 (JSC::JSStaticScopeObject::putDirectVirtual):
6939 (JSC::JSStaticScopeObject::getOwnPropertySlot):
6940 * runtime/JSSymbolTableObject.cpp: Added.
6941 (JSC):
6942 (JSC::JSSymbolTableObject::destroy):
6943 (JSC::JSSymbolTableObject::deleteProperty):
6944 (JSC::JSSymbolTableObject::getOwnPropertyNames):
6945 (JSC::JSSymbolTableObject::putDirectVirtual):
6946 (JSC::JSSymbolTableObject::isDynamicScope):
6947 * runtime/JSSymbolTableObject.h: Added.
6948 (JSC):
6949 (JSSymbolTableObject):
6950 (JSC::JSSymbolTableObject::symbolTable):
6951 (JSC::JSSymbolTableObject::JSSymbolTableObject):
6952 (JSC::JSSymbolTableObject::finishCreation):
6953 (JSC::symbolTableGet):
6954 (JSC::symbolTablePut):
6955 (JSC::symbolTablePutWithAttributes):
6956 * runtime/JSVariableObject.cpp:
6957 (JSC):
6958 * runtime/JSVariableObject.h:
6959 (JSVariableObject):
6960 (JSC::JSVariableObject::JSVariableObject):
6961 (JSC::JSVariableObject::finishCreation):
6962 (JSC):
6963 * runtime/WriteBarrier.h:
6964
69652012-06-06 Filip Pizlo <fpizlo@apple.com>
6966
fpizlo@apple.comd5547492012-06-07 00:23:36 +00006967 DFG arguments access slow path should not crash if the arguments haven't been created
6968 https://bugs.webkit.org/show_bug.cgi?id=88471
6969
6970 Reviewed by Gavin Barraclough.
6971
6972 * dfg/DFGCCallHelpers.h:
6973 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
6974 (CCallHelpers):
6975 * dfg/DFGOperations.cpp:
6976 * dfg/DFGOperations.h:
6977 * dfg/DFGSpeculativeJIT.h:
6978 (JSC::DFG::SpeculativeJIT::callOperation):
6979 * dfg/DFGSpeculativeJIT32_64.cpp:
6980 (JSC::DFG::SpeculativeJIT::compile):
6981 * dfg/DFGSpeculativeJIT64.cpp:
6982 (JSC::DFG::SpeculativeJIT::compile):
6983
msaboff@apple.com9d9eab62012-06-06 23:11:09 +000069842012-06-06 Michael Saboff <msaboff@apple.com>
6985
6986 ENH: Add Logging to GC Marking Phase
6987 https://bugs.webkit.org/show_bug.cgi?id=88364
6988
6989 Reviewed by Filip Pizlo.
6990
6991 Log GC marking to stderr or a file. The logging in controlled
6992 with the define ENABLE_OBJECT_MARK_LOGGING in wtf/Platform.h.
6993 If DATA_LOG_TO_FILE in wtf/DataLog.cpp is set to 1, output is
6994 logged to a file otherwise it is logged to stderr.
6995
6996 When logging is enabled, the GC is built single threaded since the
6997 log output from the various threads isn't buffered and output in a
6998 thread safe manner.
6999
7000 * heap/Heap.cpp:
7001 (JSC::Heap::markRoots):
7002 * heap/MarkStack.cpp:
7003 (JSC::MarkStackThreadSharedData::resetChildren):
7004 (JSC::MarkStackThreadSharedData::childVisitCount):
7005 (JSC::MarkStackThreadSharedData::markingThreadMain):
7006 (JSC::MarkStackThreadSharedData::markingThreadStartFunc):
7007 (JSC::MarkStackThreadSharedData::MarkStackThreadSharedData):
7008 (JSC::MarkStackThreadSharedData::reset):
7009 * heap/MarkStack.h:
7010 (MarkStackThreadSharedData):
7011 (MarkStack):
7012 (JSC::MarkStack::sharedData):
7013 (JSC::MarkStack::resetChildCount):
7014 (JSC::MarkStack::childCount):
7015 (JSC::MarkStack::incrementChildCount):
7016 * runtime/JSArray.cpp:
7017 (JSC::JSArray::visitChildren):
7018 * runtime/JSCell.cpp:
7019 (JSC::JSCell::className):
7020 * runtime/JSCell.h:
7021 (JSCell):
7022 (JSC::JSCell::visitChildren):
7023 * runtime/JSString.cpp:
7024 (JSC::JSString::visitChildren):
7025 * runtime/JSString.h:
7026 (JSString):
7027 * runtime/Structure.h:
7028 (JSC::MarkStack::internalAppend):
7029
barraclough@apple.com799e44e2012-06-06 22:09:44 +000070302012-06-06 Gavin Barraclough <barraclough@apple.com>
7031
7032 Assigning to a static property should not change iteration order
7033 https://bugs.webkit.org/show_bug.cgi?id=88401
7034
7035 Reviewed by Geoff Garen.
7036
7037 A specific iteration order is not defined by the spec, but test-262 somewhat tenuously
7038 requires that it is at least stable, e.g. ch10/10.4/10.4.2/S10.4.2_A1.1_T1.js
7039
7040 Whilst it is not clear that this behavior really arises from the specification, it
7041 would seem like common sense to conform to this.
7042
7043 The problem here is that we allow properties in the structure to shadow those in the
7044 static table, and we iterate the properties in the structure first - which means that
7045 as values of existing properties are modified, their iteration order changes too.
7046
7047 The easy fix is to iterate the properties from the static table first. This has a
7048 further benefit, since it will mean that user added properties will come after those
7049 present in the static table (respected the expected insertion-order).
7050
7051 * runtime/JSObject.cpp:
7052 (JSC::JSObject::getOwnPropertyNames):
7053 - Iterate static properties first.
7054
wingo@igalia.combe8ecb92012-06-06 09:39:04 +000070552012-06-06 Andy Wingo <wingo@igalia.com>
7056
wingo@igalia.comc2fb5ba2012-06-06 18:59:35 +00007057 Ensure consistent order of evaluation in LLInt slow paths
7058 https://bugs.webkit.org/show_bug.cgi?id=88409
7059
7060 Reviewed by Geoffrey Garen.
7061
7062 * llint/LLIntSlowPaths.cpp:
7063 (slow_path_mul)
7064 (slow_path_sub)
7065 (slow_path_div)
7066 (slow_path_mod)
7067 (slow_path_lshift)
7068 (slow_path_rshift)
7069 (slow_path_urshift)
7070 (slow_path_bitand)
7071 (slow_path_bitor)
7072 (slow_path_bitxor): Avoid calling toNumber, toInt32, or toUInt32
7073 multiple times without intervening sequence points. Fixes
7074 fast/js/exception-sequencing-binops.html with GCC 4.7 on x86-64
7075 Linux, which reordered evaluation of the arguments to fmod.
7076
70772012-06-06 Andy Wingo <wingo@igalia.com>
7078
wingo@igalia.com4990fe82012-06-06 16:00:38 +00007079 [GTK] Enable the LLInt
7080 https://bugs.webkit.org/show_bug.cgi?id=88315
7081
7082 Reviewed by Filip Pizlo.
7083
7084 * GNUmakefile.am: Add rules to generate LLIntDesiredOffsets.h and
7085 LLIntAssembly.h.
7086 * GNUmakefile.list.am: Add offlineasm and llint files to the
7087 dist. Add LLInt source files to the build.
7088 * llint/LowLevelInterpreter.asm (crash): Generate a store of
7089 0xbbadbeef to a register, not to a constant. Otherwise, gas was
7090 failing to assemble result.
7091 * offlineasm/asm.rb (labelReference): Generate a
7092 SYMBOL_STRING_RELOCATION instead of a SYMBOL_STRING, so that we go
7093 through the PLT on ELF systems.
7094
70952012-06-06 Andy Wingo <wingo@igalia.com>
7096
wingo@igalia.combe8ecb92012-06-06 09:39:04 +00007097 REGRESSION (r106478): None of the Paper.js JavaScript examples work
7098 https://bugs.webkit.org/show_bug.cgi?id=87158
7099
7100 Reviewed by Michael Saboff.
7101
7102 * bytecompiler/BytecodeGenerator.cpp:
7103 (JSC::BytecodeGenerator::resolve): If we have to bail out to
7104 dynamicResolve(), only skip static scopes from the head of the
7105 scope chain. Before, we were also skipping activations with
7106 direct eval as well, which was incorrect.
7107
mitz@apple.com115e6642012-06-06 07:37:05 +000071082012-06-06 Dan Bernstein <mitz@apple.com>
7109
7110 Reverted r119567, the fix for <http://webkit.org/b/88378>, because it broke the 32-bit build.
7111
7112 * dfg/DFGSpeculativeJIT.h:
7113 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
7114 * jit/JITInlineMethods.h:
7115 (JSC::JIT::emitAllocateBasicJSObject):
7116 * llint/LowLevelInterpreter.asm:
7117 * runtime/JSGlobalData.h:
7118 (JSGlobalData):
7119 * runtime/JSGlobalThis.cpp:
7120 (JSC::JSGlobalThis::setUnwrappedObject):
7121 * runtime/JSObject.cpp:
7122 (JSC::JSObject::visitChildren):
7123 (JSC::JSObject::createInheritorID):
7124 * runtime/JSObject.h:
7125 (JSObject):
7126 (JSC::JSObject::resetInheritorID):
7127 (JSC):
7128 (JSC::JSObject::offsetOfInheritorID):
7129 (JSC::JSObject::inheritorID):
7130
yuqiang.xian@intel.come8adde62012-06-06 05:25:54 +000071312012-06-05 Yuqiang Xian <yuqiang.xian@intel.com>
7132
7133 Improve Math.round and Math.floor intrinsic
7134 https://bugs.webkit.org/show_bug.cgi?id=88314
7135
7136 Reviewed by Filip Pizlo.
7137
7138 Currently we call a native function from the JIT code to complete the
7139 "round" and "floor" operations. We could inline some fast paths
7140 especially for those positive values on the platforms where floating
7141 point truncation is supported.
7142 This brings 3% gain on Kraken, especially 32% on audio-oscillator,
7143 and slight win on SunSpider, measured on IA32.
7144
7145 * jit/ThunkGenerators.cpp:
7146 (JSC::floorThunkGenerator):
7147 (JSC):
7148 (JSC::roundThunkGenerator):
7149
barraclough@apple.comc48fc1b2012-06-06 05:08:45 +000071502012-06-05 Gavin Barraclough <barraclough@apple.com>
7151
7152 Remove JSObject::m_inheritorID
7153 https://bugs.webkit.org/show_bug.cgi?id=88378
7154
7155 Reviewed by Geoff Garen.
7156
7157 This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
7158 and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
7159 Instead use a private named value in the object's property storage.
7160
7161 * dfg/DFGSpeculativeJIT.h:
7162 (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject):
7163 - No need m_inheritorID to initialize!
7164 * jit/JITInlineMethods.h:
7165 (JSC::JIT::emitAllocateBasicJSObject):
7166 - No need m_inheritorID to initialize!
7167 * llint/LowLevelInterpreter.asm:
7168 - No need m_inheritorID to initialize!
7169 * runtime/JSGlobalData.h:
7170 (JSGlobalData):
7171 - Added private name 'm_inheritorIDKey'.
7172 * runtime/JSGlobalThis.cpp:
7173 (JSC::JSGlobalThis::setUnwrappedObject):
7174 - resetInheritorID is now passed a JSGlobalData&.
7175 * runtime/JSObject.cpp:
7176 (JSC::JSObject::visitChildren):
7177 - No m_inheritorID to be marked.
7178 (JSC::JSObject::createInheritorID):
7179 - Store the newly created inheritorID in the property map.
7180 * runtime/JSObject.h:
7181 (JSC::JSObject::resetInheritorID):
7182 - Remove the inheritorID from property storage.
7183 (JSC::JSObject::inheritorID):
7184 - Read the inheritorID from property storage.
7185
fpizlo@apple.come7bee132012-06-05 21:32:18 +000071862012-06-05 Filip Pizlo <fpizlo@apple.com>
7187
7188 DFG CFG simplification should not attempt to deref nodes inside of an unreachable subgraph
7189 https://bugs.webkit.org/show_bug.cgi?id=88362
7190
7191 Reviewed by Gavin Barraclough.
7192
7193 * dfg/DFGCFGSimplificationPhase.cpp:
7194 (JSC::DFG::CFGSimplificationPhase::fixPhis):
7195 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
7196
mhahnenberg@apple.com47c9c532012-06-05 20:38:21 +000071972012-06-05 Mark Hahnenberg <mhahnenberg@apple.com>
7198
7199 Entry into JSC should CRASH() if the Heap is busy
7200 https://bugs.webkit.org/show_bug.cgi?id=88355
7201
7202 Reviewed by Geoffrey Garen.
7203
7204 Interpreter::execute() returns jsNull() right now if we try to enter it while
7205 the Heap is busy (e.g. with a collection), which is okay, but some code paths
7206 that call Interpreter::execute() allocate objects before checking if the Heap
7207 is busy. Attempting to execute JS code while the Heap is busy should not be
7208 allowed and should be enforced by a release-mode CRASH() to prevent vague,
7209 unhelpful backtraces later on if somebody makes a mistake. Normally, recursively
7210 executing JS code is okay, e.g. for evals, but it should not occur during a
7211 Heap allocation or collection because the Heap is not guaranteed to be in a
7212 consistent state (especially during collections). We are protected from
7213 executing JS on the same Heap concurrently on two separate threads because
7214 they must each take a JSLock first. However, we are not protected from reentrant
7215 execution of JS on the same thread because JSLock allows reentrancy. Therefore,
7216 we should fail early if we detect an entrance into JS code while the Heap is busy.
7217
7218 * heap/Heap.cpp: Changed Heap::collect so that it sets the m_operationInProgress field
7219 at the beginning of collection and then unsets it at the end so that it is set at all
7220 times throughout the duration of a collection rather than sporadically during various
7221 phases. There is no reason to unset during a collection because our collector does
7222 not currently support running additional JS between the phases of a collection.
7223 (JSC::Heap::getConservativeRegisterRoots):
7224 (JSC::Heap::markRoots):
7225 (JSC::Heap::collect):
7226 * interpreter/Interpreter.cpp:
7227 (JSC::Interpreter::execute): Crash if the Heap is busy.
7228 * runtime/Completion.cpp: Crash if the Heap is busy. We do it here before we call
7229 Interpreter::execute() because we do some allocation prior to calling execute() which
7230 could cause Heap corruption if, for example, that allocation caused a collection.
7231 (JSC::evaluate):
7232
commit-queue@webkit.org3401b2d2012-06-05 11:32:22 +000072332012-06-05 Dongwoo Im <dw.im@samsung.com>
7234
7235 Add 'isProtocolHandlerRegistered' and 'unregisterProtocolHandler'.
7236 https://bugs.webkit.org/show_bug.cgi?id=73176
7237
7238 Reviewed by Adam Barth.
7239
7240 Two more APIs are added in Custom Scheme Handler specification.
7241 http://dev.w3.org/html5/spec/Overview.html#custom-handlers
7242 One is 'isProtocolHandlerRegistered' to query whether the specific URL
7243 is registered or not.
7244 The other is 'unregisterProtocolHandler' to remove the registered URL.
7245
7246 * Configurations/FeatureDefines.xcconfig: Add a macro 'ENABLE_CUSTOM_SCHEME_HANDLER'.
7247
fpizlo@apple.com9cce18d2012-06-05 06:40:48 +000072482012-06-04 Filip Pizlo <fpizlo@apple.com>
7249
7250 DFG CFG simplification should correct the variables at the head of the predecessor block
7251 https://bugs.webkit.org/show_bug.cgi?id=88284
7252
7253 Reviewed by Geoffrey Garen.
7254
7255 * dfg/DFGCFGSimplificationPhase.cpp:
7256 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
7257
ggaren@apple.com825cc102012-06-05 03:17:15 +000072582012-06-04 Geoffrey Garen <ggaren@apple.com>
7259
7260 Unreviewed.
7261
7262 Rolled out r119364 because it's still causing crashes (when running
7263 v8-earley in release builds of DRT)
7264
7265 This time for sure!
7266
7267 * heap/Heap.cpp:
7268 (JSC::Heap::collect):
7269 * heap/MarkedBlock.cpp:
7270 (JSC::MarkedBlock::sweep):
7271 * heap/MarkedBlock.h:
7272 (JSC::MarkedBlock::resetAllocator):
7273 (JSC):
7274 * heap/MarkedSpace.cpp:
7275 (JSC::ResetAllocator::operator()):
7276 (JSC):
7277 (JSC::MarkedSpace::resetAllocators):
7278 (JSC::MarkedSpace::sweepWeakSets):
7279 * heap/MarkedSpace.h:
7280 (MarkedSpace):
7281 * heap/WeakBlock.cpp:
7282 (JSC::WeakBlock::sweep):
7283 * heap/WeakSet.cpp:
7284 (JSC::WeakSet::sweep):
7285 (JSC::WeakSet::tryFindAllocator):
7286 * heap/WeakSet.h:
7287 (JSC::WeakSet::shrink):
7288
fpizlo@apple.com9cd38a62012-06-05 00:28:49 +000072892012-06-04 Filip Pizlo <fpizlo@apple.com>
7290
7291 DFG arguments simplification should have rationalized handling of TearOffArguments
7292 https://bugs.webkit.org/show_bug.cgi?id=88206
7293
7294 Reviewed by Geoffrey Garen.
7295
7296 - Accesses to the unmodified arguments register ought to have the same effect on
7297 alias/escape analysis of arguments as accesses to the mutable arguments register.
7298
7299 - The existence of TearOffArguments should not get in the way of arguments aliasing.
7300
7301 - TearOffArguments should be eliminated if CreateArguments is eliminated.
7302
7303 * dfg/DFGArgumentsSimplificationPhase.cpp:
7304 (JSC::DFG::ArgumentsSimplificationPhase::run):
7305 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
7306
barraclough@apple.com282d26a2012-06-05 00:00:17 +000073072012-06-04 Gavin Barraclough <barraclough@apple.com>
7308
7309 Remove enabledProfilerReference
7310 https://bugs.webkit.org/show_bug.cgi?id=88258
7311
7312 Reviewed by Michael Saboff.
7313
7314 Make the enabled profiler a member of JSGlobalData, and switch code that accesses it to do so directly
7315 via the JSGlobalData, rather than holding a Profiler** reference to it. Do not pass the Profiler**
7316 reference to JIT code. This patch does not change the stack layout on entry into JIT code (passing an
7317 unused void* instead), since this is an intrusive change better handled in a separate patch.
7318
7319 * interpreter/Interpreter.cpp:
7320 (JSC::Interpreter::throwException):
7321 (JSC::Interpreter::execute):
7322 (JSC::Interpreter::executeCall):
7323 (JSC::Interpreter::executeConstruct):
7324 (JSC::Interpreter::privateExecute):
7325 * jit/JITCode.h:
7326 (JSC::JITCode::execute):
7327 - Don't pass Profiler** to JIT code.
7328 * jit/JITOpcodes.cpp:
7329 (JSC::JIT::emit_op_profile_will_call):
7330 (JSC::JIT::emit_op_profile_did_call):
7331 * jit/JITOpcodes32_64.cpp:
7332 (JSC::JIT::emit_op_profile_will_call):
7333 (JSC::JIT::emit_op_profile_did_call):
7334 * jit/JITStubs.cpp:
7335 (JSC):
7336 (JSC::ctiTrampoline):
7337 (JSC::ctiVMThrowTrampoline):
7338 (JSC::ctiOpThrowNotCaught):
7339 (JSC::JITThunks::JITThunks):
7340 (JSC::DEFINE_STUB_FUNCTION):
7341 - For ARM_THUMB2, rename ENABLE_PROFILER_REFERENCE_OFFSET to FIRST_STACK_ARGUMENT (which is how it is being used).
7342 - For MIPS, remove ENABLE_PROFILER_REFERENCE_OFFSET.
7343 * jit/JITStubs.h:
7344 (JITStackFrame):
7345 (JSC):
7346 - Renamed enabledProfilerReference to unusedX.
7347 * llint/LLIntSlowPaths.cpp:
7348 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
7349 * llint/LowLevelInterpreter.asm:
7350 * profiler/Profiler.cpp:
7351 (JSC):
7352 (JSC::Profiler::startProfiling):
7353 (JSC::Profiler::stopProfiling):
7354 * profiler/Profiler.h:
7355 (Profiler):
7356 - Removed s_sharedEnabledProfilerReference, enabledProfilerReference().
7357 * runtime/JSGlobalData.cpp:
7358 (JSC::JSGlobalData::JSGlobalData):
7359 * runtime/JSGlobalData.h:
7360 (JSC):
7361 (JSC::JSGlobalData::enabledProfiler):
7362 (JSGlobalData):
7363 - Added m_enabledProfiler, enabledProfiler().
7364 * runtime/JSGlobalObject.cpp:
7365 (JSC::JSGlobalObject::~JSGlobalObject):
7366
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +000073672012-06-04 Filip Pizlo <fpizlo@apple.com>
7368
fpizlo@apple.com477ce382012-06-04 23:32:57 +00007369 get_argument_by_val should be profiled everywhere
7370 https://bugs.webkit.org/show_bug.cgi?id=88205
7371
7372 Reviewed by Geoffrey Garen.
7373
7374 * jit/JITOpcodes32_64.cpp:
7375 (JSC::JIT::emitSlow_op_get_argument_by_val):
7376 * llint/LLIntSlowPaths.cpp:
7377 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
7378
73792012-06-04 Filip Pizlo <fpizlo@apple.com>
7380
fpizlo@apple.com3d579cc2012-06-04 23:27:34 +00007381 DFG arguments simplification takes unkindly to direct accesses to the arguments register
7382 https://bugs.webkit.org/show_bug.cgi?id=88261
7383
7384 Reviewed by Geoffrey Garen.
7385
7386 Fixed arguments simplification for direct accesses to the arguments register, which may
7387 arise if CSE had not run. Fixed CSE so that it does run prior to arguments simplification,
7388 by making it a full-fledged member of the fixpoint. Fixed other issues in arguments
7389 simplification, like realizing that it needs to bail if there is a direct assignment to
7390 the arguments register, and failing to turn CreateArguments into PhantomArguments. Also
7391 fixed CSE's handling of store elimination of captured locals in the presence of a
7392 GetMyArgumentByVal (or one of its friends), and fixed CSE to correctly fixup variables at
7393 tail if the Flush it removes is the last operation on a local in a basic block.
7394
7395 * bytecode/CodeBlock.cpp:
7396 (JSC::CodeBlock::dump):
7397 * dfg/DFGArgumentsSimplificationPhase.cpp:
7398 (JSC::DFG::ArgumentsSimplificationPhase::run):
7399 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
7400 * dfg/DFGCSEPhase.cpp:
7401 (JSC::DFG::CSEPhase::run):
7402 (JSC::DFG::CSEPhase::setLocalStoreElimination):
7403 (JSC::DFG::CSEPhase::performNodeCSE):
7404 (CSEPhase):
7405 * dfg/DFGDriver.cpp:
7406 (JSC::DFG::compile):
7407
andersca@apple.comea6c6b22012-06-04 21:56:32 +000074082012-06-04 Anders Carlsson <andersca@apple.com>
7409
7410 Fix a struct/class mismatch.
7411
7412 * heap/Handle.h:
7413 (Handle):
7414
ddkilzer@apple.comba58a612012-06-04 14:55:26 +000074152012-06-04 David Kilzer <ddkilzer@apple.com>
7416
7417 BUILD FIX: FeatureDefines.xcconfig should match across projects
7418
7419 * Configurations/FeatureDefines.xcconfig:
7420 - Add missing ENABLE_LEGACY_CSS_VENDOR_PREFIXES.
7421
ggaren@apple.com02dec622012-06-03 21:16:55 +000074222012-06-02 Geoffrey Garen <ggaren@apple.com>
7423
7424 Weak pointer finalization should be lazy
7425 https://bugs.webkit.org/show_bug.cgi?id=87599
7426
7427 Reviewed by Sam Weinig.
7428
7429 This time for sure!
7430
7431 * heap/Heap.cpp:
7432 (JSC::Heap::collect): Don't sweep eagerly -- we'll sweep lazily instead.
7433
7434 * heap/MarkedBlock.cpp:
7435 (JSC::MarkedBlock::sweep): Sweep our weak set before we sweep our other
7436 destructors -- this is our last chance to run weak set finalizers before
7437 we recycle our memory.
7438
7439 * heap/MarkedBlock.h:
7440 (JSC::MarkedBlock::resetAllocator):
7441 * heap/MarkedSpace.cpp:
7442 (JSC::MarkedSpace::resetAllocators):
7443 * heap/MarkedSpace.h:
7444 (JSC::MarkedSpace::resetAllocators): Don't force allocator reset anymore.
7445 It will happen automatically when a weak set is swept. It's simpler to
7446 have only one canonical way for this to happen, and it wasn't buying
7447 us anything to do it eagerly.
7448
7449 * heap/WeakBlock.cpp:
7450 (JSC::WeakBlock::sweep): Don't short-circuit a sweep unless we know
7451 the sweep would be a no-op. If even one finalizer is pending, we need to
7452 run it, since we won't get another chance.
7453
7454 * heap/WeakSet.cpp:
7455 (JSC::WeakSet::sweep): This loop can be simpler now that
7456 WeakBlock::sweep() does what we mean.
7457
7458 Reset our allocator after a sweep because this is the optimal time to
7459 start trying to recycle old weak pointers.
7460
7461 (JSC::WeakSet::tryFindAllocator): Don't sweep when searching for an
7462 allocator because we've swept already, and forcing a new sweep would be
7463 wasteful.
7464
7465 * heap/WeakSet.h:
7466 (JSC::WeakSet::shrink): Be sure to reset our allocator after a shrink
7467 because the shrink may have removed the block the allocator was going to
7468 allocate out of.
7469
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +000074702012-06-02 Filip Pizlo <fpizlo@apple.com>
7471
fpizlo@apple.come0c200c2012-06-03 00:41:08 +00007472 If the DFG bytecode parser detects that op_method_check has gone polymorphic, it
7473 shouldn't revert all the way to GetById/GetByIdFlush
7474 https://bugs.webkit.org/show_bug.cgi?id=88176
7475
7476 Reviewed by Geoffrey Garen.
7477
7478 Refactored the code so that the op_method_check case of the parser gracefully falls
7479 through to all of the goodness of the normal op_get_by_id case.
7480
7481 * dfg/DFGByteCodeParser.cpp:
7482 (ByteCodeParser):
7483 (JSC::DFG::ByteCodeParser::handleGetById):
7484 (DFG):
7485 (JSC::DFG::ByteCodeParser::parseBlock):
7486
74872012-06-02 Filip Pizlo <fpizlo@apple.com>
7488
fpizlo@apple.comb80bc2a32012-06-02 22:58:48 +00007489 DFG CSE should be able to eliminate unnecessary flushes of arguments and captured variables
7490 https://bugs.webkit.org/show_bug.cgi?id=87929
7491
7492 Reviewed by Geoffrey Garen.
7493
7494 Slight speed-up on V8. Big win (up to 50%) on programs that inline very small functions.
7495
7496 This required a bunch of changes:
7497
7498 - The obvious change is making CSE essentially ignore whether or not the set of
7499 operations between the Flush and the SetLocal can exit, and instead focus on whether or
7500 not that set of operations can clobber the world or access local variables. This code
7501 is now refactored to return a set of flags indicating any of these events, and the CSE
7502 decides what to do based on those flags. If the set of operations is non-clobbering
7503 and non-accessing, then the Flush is turned into a Phantom on the child of the
7504 SetLocal. This expands the liveness of the relevant variable but virtually guarantees
7505 that it will be register allocated and not flushed to the stack. So, yeah, this patch
7506 is a lot of work to save a few stores to the stack.
7507
7508 - Previously, CheckArgumentsNotCreated was optimized "lazily" in that you only knew if
7509 it was a no-op if you were holding onto a CFA abstract state. But this would make the
7510 CSE act pessimistically, since it doesn't use the CFA. Hence, this patch changes the
7511 constant folding phase into something more broad; it now fixes up
7512 CheckArgumentsNotCreated nodes by turning them into phantoms if it knows that they are
7513 no-ops.
7514
7515 - Arguments simplification was previously relying on this very strange PhantomArguments
7516 node, which had two different meanings: for normal execution it meant the empty value
7517 but for OSR exit it meant that the arguments should be reified. This produces problems
7518 when set SetLocals to the captured arguments registers are CSE'd away, since we'd be
7519 triggering reification of arguments without having initialized the arguments registers
7520 to empty. The cleanest solution was to fix PhantomArguments to have one meaning:
7521 namely, arguments reification on OSR exit. Hence, this patch changes arguments
7522 simplification to change SetLocal of CreateArguments on the arguments registers to be
7523 a SetLocal of Empty.
7524
7525 - Argument value recoveries were previously derived from the value source of the
7526 arguments at the InlineStart. But that relies on all SetLocals to arguments having
7527 been flushed. It's possible that we could have elided the SetLocal to the arguments
7528 at the callsite because there were subsequent SetLocals to the arguments inside of the
7529 callee, in which case the InlineStart would get the wrong information. Hence, this
7530 patch changes argument value recovery computation to operate over the ArgumentPositions
7531 directly.
7532
7533 - But that doesn't actually work, because previously, there was no way to link an
7534 InlineStart back to the corresponding ArgumentPositions, at least not without some
7535 ugliness. So this patch instates the rule that the m_argumentPositions vector consists
7536 of disjoint subsequences such that each subsequence corresponds to an inline callsite
7537 and can be identified by its first index, and within each subsequence are the
7538 ArgumentPositions of all of the arguments ordered by argument index. This required
7539 flipping the order in which ArgumentPositions are added to the vector, and giving
7540 InlineStart an operand that indicates the start of that inline callsite's
7541 ArgumentPosition subsequence.
7542
7543 - This patch also revealed a nasty bug in the reification of arguments in inline call
7544 frames on OSR exit. Since the reification was happening after the values of virtual
7545 registers were recovered, the value recoveries of the inline arguments were wrong.
7546 Hence using operationCreateInlinedArguments is wrong. For example a value recovery
7547 might say that you have to box a double, but if we had already boxed it then boxing
7548 it a second time will result in garbage. The specific case of this bug was this patch
7549 uncovered was that now it is possible for an inline call frame to not have any valid
7550 value recoveries for any inline arguments, if the optimization elides all argument
7551 flushes, while at the same time optimizing away arguments creation. Then OSR exit
7552 would try to recover the arguments using the inline call frame, which had bogus
7553 information, and humorous crashes would ensue. This patch fixes this issue by moving
7554 arguments reification to after call frame reification, so that arguments reification
7555 can always use operationCreateArguments instead of operationCreateInlinedArguments.
7556
7557 - This patch may turn a Flush into a Phantom. That's kind of the whole point. But that
7558 broke forward speculation checks, which knew to look for a Flush prior to a SetLocal
7559 but didn't know that there could alternatively be a Phantom in place of the Flush.
7560 This patch fixes that by augmenting the forward speculation check logic.
7561
7562 - Finally, in the process of having fun with all of the above, I realized that my DFG
7563 validation was not actually running on every phase like I had originally designed it
7564 to. In fact it was only running just after bytecode parsing. I initially tried to
7565 make it run in every phase but found that this causes some tests to timeout
7566 (specifically the evil fuzzing ones), so I decided on a compromise where: (i) in
7567 release mode validation never runs, (ii) in debug mode validation will run just
7568 after parsing and just before the backend, and (iii) it's possible with a simple
7569 switch to enable validation to run on every phase.
7570
7571 Luckily all of the above issues were already covered by the 77 or so DFG-specific
7572 layout tests. Hence, this patch does not introduce any new tests despite being so
7573 meaty.
7574
7575 * dfg/DFGAbstractState.cpp:
7576 (JSC::DFG::AbstractState::execute):
7577 * dfg/DFGArgumentPosition.h:
7578 (JSC::DFG::ArgumentPosition::prediction):
7579 (JSC::DFG::ArgumentPosition::doubleFormatState):
7580 (JSC::DFG::ArgumentPosition::shouldUseDoubleFormat):
7581 (ArgumentPosition):
7582 * dfg/DFGArgumentsSimplificationPhase.cpp:
7583 (JSC::DFG::ArgumentsSimplificationPhase::run):
7584 * dfg/DFGByteCodeParser.cpp:
7585 (JSC::DFG::ByteCodeParser::handleInlining):
7586 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
7587 * dfg/DFGCSEPhase.cpp:
7588 (JSC::DFG::CSEPhase::SetLocalStoreEliminationResult::SetLocalStoreEliminationResult):
7589 (SetLocalStoreEliminationResult):
7590 (JSC::DFG::CSEPhase::setLocalStoreElimination):
7591 (JSC::DFG::CSEPhase::performNodeCSE):
7592 * dfg/DFGCommon.h:
7593 * dfg/DFGConstantFoldingPhase.cpp:
7594 (JSC::DFG::ConstantFoldingPhase::run):
7595 * dfg/DFGDriver.cpp:
7596 (JSC::DFG::compile):
7597 * dfg/DFGNode.h:
7598 (Node):
7599 (JSC::DFG::Node::hasArgumentPositionStart):
7600 (JSC::DFG::Node::argumentPositionStart):
7601 * dfg/DFGOSRExitCompiler32_64.cpp:
7602 (JSC::DFG::OSRExitCompiler::compileExit):
7603 * dfg/DFGOSRExitCompiler64.cpp:
7604 (JSC::DFG::OSRExitCompiler::compileExit):
7605 * dfg/DFGPhase.cpp:
7606 (DFG):
7607 * dfg/DFGPhase.h:
7608 (Phase):
7609 * dfg/DFGSpeculativeJIT.cpp:
7610 (JSC::DFG::SpeculativeJIT::compile):
7611 * dfg/DFGSpeculativeJIT.h:
7612 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
7613 * dfg/DFGSpeculativeJIT32_64.cpp:
7614 (JSC::DFG::SpeculativeJIT::compile):
7615 * dfg/DFGSpeculativeJIT64.cpp:
7616 (JSC::DFG::SpeculativeJIT::compile):
7617
ggaren@apple.com32eb24b2012-06-02 22:49:05 +000076182012-06-02 Geoffrey Garen <ggaren@apple.com>
7619
7620 DOM string cache should hash pointers, not characters
7621 https://bugs.webkit.org/show_bug.cgi?id=88175
7622
7623 Reviewed by Phil Pizlo and Sam Weinig.
7624
7625 * heap/Weak.h:
7626 (JSC::weakAdd):
7627 (JSC::weakRemove): Made these function templates slightly more generic
7628 to accommodate new client types.
7629
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +000076302012-06-01 Filip Pizlo <fpizlo@apple.com>
7631
fpizlo@apple.coma4754892012-06-02 00:22:31 +00007632 DFG CFA should know that PutByVal can clobber the world
7633 https://bugs.webkit.org/show_bug.cgi?id=88155
7634
7635 Reviewed by Gavin Barraclough.
7636
7637 * dfg/DFGAbstractState.cpp:
7638 (JSC::DFG::AbstractState::execute):
7639
76402012-06-01 Filip Pizlo <fpizlo@apple.com>
7641
fpizlo@apple.com8e537cd2012-06-01 23:54:36 +00007642 DFG CFA should mark basic blocks as having constants if local accesses yield constants
7643 https://bugs.webkit.org/show_bug.cgi?id=88153
7644
7645 Reviewed by Gavin Barraclough.
7646
7647 * dfg/DFGAbstractState.cpp:
7648 (JSC::DFG::AbstractState::execute):
7649
76502012-06-01 Filip Pizlo <fpizlo@apple.com>
7651
fpizlo@apple.comacc9dd22012-06-01 23:47:28 +00007652 DFG arguments simplification phase uses a node.codeOrigin after appending a node
7653 https://bugs.webkit.org/show_bug.cgi?id=88151
7654
7655 Reviewed by Geoffrey Garen.
7656
7657 The right thing to do is to save the CodeOrigin before appending to the graph.
7658
7659 * dfg/DFGArgumentsSimplificationPhase.cpp:
7660 (JSC::DFG::ArgumentsSimplificationPhase::run):
7661
76622012-06-01 Filip Pizlo <fpizlo@apple.com>
7663
fpizlo@apple.com4f337c22012-06-01 23:18:59 +00007664 DFG should not emit unnecessary speculation checks when performing an int32 to double conversion on
7665 a value that is proved to be a number, predicted to be an int32, but not proved to be an int32
7666 https://bugs.webkit.org/show_bug.cgi?id=88146
7667
7668 Reviewed by Gavin Barraclough.
7669
7670 * dfg/DFGSpeculativeJIT.cpp:
7671 (JSC::DFG::SpeculativeJIT::compileInt32ToDouble):
7672
76732012-06-01 Filip Pizlo <fpizlo@apple.com>
7674
fpizlo@apple.comafc07412012-06-01 22:44:43 +00007675 DFG constant folding search for the last local access skips the immediately previous local access
7676 https://bugs.webkit.org/show_bug.cgi?id=88141
7677
7678 Reviewed by Michael Saboff.
7679
7680 If you use a loop in the style of:
7681
7682 for (i = start; i--;)
7683
7684 then you need to remember that the first value of 'i' that the loop body will see is 'start - 1'.
7685 Hence the following is probably wrong:
7686
7687 for (i = start - 1; i--;)
7688
7689 * dfg/DFGConstantFoldingPhase.cpp:
7690 (JSC::DFG::ConstantFoldingPhase::run):
7691
76922012-06-01 Filip Pizlo <fpizlo@apple.com>
7693
fpizlo@apple.comcc5b61b2012-06-01 21:32:45 +00007694 DFG constant folding should be OK with GetLocal of captured variables having a constant
7695 https://bugs.webkit.org/show_bug.cgi?id=88137
7696
7697 Reviewed by Gavin Barraclough.
7698
7699 * dfg/DFGConstantFoldingPhase.cpp:
7700 (JSC::DFG::ConstantFoldingPhase::run):
7701
mhahnenberg@apple.com016c5782012-06-01 00:02:09 +000077022012-05-31 Mark Hahnenberg <mhahnenberg@apple.com>
7703
7704 JSGlobalObject does not mark m_privateNameStructure
7705 https://bugs.webkit.org/show_bug.cgi?id=88023
7706
7707 Rubber stamped by Gavin Barraclough.
7708
7709 * runtime/JSGlobalObject.cpp:
7710 (JSC::JSGlobalObject::visitChildren): We need to mark this so it doesn't get
7711 inadvertently garbage collected.
7712
arv@chromium.org31fddbc2012-05-31 18:00:03 +000077132012-05-31 Erik Arvidsson <arv@chromium.org>
7714
7715 Make DOM Exceptions Errors
7716 https://bugs.webkit.org/show_bug.cgi?id=85078
7717
7718 Reviewed by Oliver Hunt.
7719
7720 WebIDL mandates that exceptions should have Error.prototype on its prototype chain.
7721
7722 For JSC we have access to the Error.prototype from the binding code.
7723
7724 For V8 we set a field in the WrapperTypeInfo and when the constructor function is created we
7725 set the prototype as needed.
7726
7727 Updated test: fast/dom/DOMException/prototype-object.html
7728
7729 * JavaScriptCore.xcodeproj/project.pbxproj:
7730 * runtime/JSGlobalObject.cpp:
7731 (JSC::JSGlobalObject::reset):
7732 * runtime/JSGlobalObject.h:
7733 (JSC):
7734 (JSGlobalObject):
7735 (JSC::JSGlobalObject::errorPrototype):
7736
wingo@igalia.com8de6a8a2012-05-31 17:28:21 +000077372012-05-31 Andy Wingo <wingo@igalia.com>
7738
7739 Fix reference to unset variable in debug mode
7740 https://bugs.webkit.org/show_bug.cgi?id=87981
7741
7742 Reviewed by Geoffrey Garen.
7743
7744 * runtime/JSONObject.cpp (Stringifier::Holder::Holder):
7745 Initialize m_size in debug mode, as we check it later in an assert.
7746
mhahnenberg@apple.comeb39abc2012-05-31 03:04:00 +000077472012-05-30 Mark Hahnenberg <mhahnenberg@apple.com>
7748
7749 Heap should sweep incrementally
7750 https://bugs.webkit.org/show_bug.cgi?id=85429
7751
7752 We shouldn't have to wait for the opportunistic GC timer to fire in order
7753 to call object destructors. Instead, we should incrementally sweep some
7754 subset of the blocks requiring sweeping periodically. We tie this sweeping
7755 to a timer rather than to collections because we want to reclaim this memory
7756 even if we stop allocating. This way, our memory usage scales smoothly with
7757 actual use, regardless of whether we've recently done an opportunistic GC or not.
7758
7759 Reviewed by Geoffrey Garen.
7760
7761 * CMakeLists.txt:
7762 * GNUmakefile.list.am:
7763 * JavaScriptCore.gypi:
7764 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
7765 * JavaScriptCore.xcodeproj/project.pbxproj:
7766 * Target.pri:
7767 * heap/Heap.cpp:
7768 (JSC::Heap::Heap):
7769 (JSC::Heap::collect): We no longer sweep during a full sweep. We only shrink now,
7770 which we will switch over to being done during incremental sweeping too as soon as
7771 all finalizers can be run lazily (and, by extension, incrementally).
7772 (JSC::Heap::sweeper):
7773 (JSC):
7774 * heap/Heap.h:
7775 (JSC):
7776 (Heap):
7777 * heap/IncrementalSweeper.cpp: Added.
7778 (JSC):
7779 (JSC::IncrementalSweeper::timerDidFire): The IncrementalSweeper works very similarly to
7780 GCActivityCallback. It is tied to a run-loop based timer that fires periodically based
7781 on how long the previous sweep increment took to run. The IncrementalSweeper doesn't do
7782 anything if the platform doesn't support CoreFoundation.
7783 (JSC::IncrementalSweeper::IncrementalSweeper):
7784 (JSC::IncrementalSweeper::~IncrementalSweeper):
7785 (JSC::IncrementalSweeper::create):
7786 (JSC::IncrementalSweeper::scheduleTimer):
7787 (JSC::IncrementalSweeper::cancelTimer):
7788 (JSC::IncrementalSweeper::doSweep): Iterates over the snapshot of the MarkedSpace taken
7789 during the last collection, checking to see which blocks need sweeping. If it successfully
7790 gets to the end of the blocks that need sweeping then it cancels the timer.
7791 (JSC::IncrementalSweeper::startSweeping): We take a snapshot of the Heap and store it in
7792 a Vector that the incremental sweep will iterate over. We also reset our index into this Vector.
7793 * heap/IncrementalSweeper.h: Added.
7794 (JSC):
7795 (IncrementalSweeper):
7796 * heap/MarkedBlock.h:
7797 (JSC::MarkedBlock::needsSweeping): If a block is in the Marked state it needs sweeping
7798 to be usable and to run any destructors that need to be run.
7799
paroga@webkit.orgecd0fb62012-05-31 01:38:17 +000078002012-05-30 Patrick Gansterer <paroga@webkit.org>
7801
7802 [WINCE] Fix JSString after r115516.
7803 https://bugs.webkit.org/show_bug.cgi?id=87892
7804
7805 Reviewed by Geoffrey Garen.
7806
7807 r115516 splitted JSString into two classes, with addition nested classes.
7808 Add a workaround for the WinCE compiler since it can't resolve the friend class
7809 declerations corretly and denies the access to protected members of JSString.
7810
7811 * runtime/JSString.h:
7812 (JSC::JSRopeString::RopeBuilder::append):
7813 (JSC::JSRopeString::append):
7814 (JSRopeString):
7815
oliver@apple.com3c996382012-05-30 23:47:27 +000078162012-05-30 Oliver Hunt <oliver@apple.com>
7817
7818 Really provide error information with the inspector disabled
7819 https://bugs.webkit.org/show_bug.cgi?id=87910
7820
7821 Reviewed by Filip Pizlo.
7822
7823 Don't bother checking for anything other than pre-existing error info.
7824 In the absence of complete line number information you'll only get the
7825 line a function starts on, but at least it's something.
7826
7827 * interpreter/Interpreter.cpp:
7828 (JSC::Interpreter::throwException):
7829
fpizlo@apple.com074918c2012-05-30 20:18:00 +000078302012-05-30 Filip Pizlo <fpizlo@apple.com>
7831
fpizlo@apple.com5673fe62012-05-30 23:09:45 +00007832 LLInt broken on x86-32 with JIT turned off
7833 https://bugs.webkit.org/show_bug.cgi?id=87906
7834
7835 Reviewed by Geoffrey Garen.
7836
7837 Fixed the code to not clobber registers that contain important things, like the call frame.
7838
7839 * llint/LowLevelInterpreter32_64.asm:
7840
78412012-05-30 Filip Pizlo <fpizlo@apple.com>
7842
fpizlo@apple.com074918c2012-05-30 20:18:00 +00007843 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
7844 https://bugs.webkit.org/show_bug.cgi?id=87887
7845
fpizlo@apple.comd55e8152012-05-30 21:04:23 +00007846 Reviewed by Darin Adler.
7847
7848 Better fix - we now never call SourceProvider::asID() if SourceProvider* is 0.
7849
7850 * parser/Nodes.h:
7851 (JSC::ScopeNode::sourceID):
7852 * parser/SourceCode.h:
7853 (JSC::SourceCode::providerID):
7854 (SourceCode):
7855 * parser/SourceProvider.h:
7856 (SourceProvider):
7857 (JSC::SourceProvider::asID):
7858 * runtime/Executable.h:
7859 (JSC::ScriptExecutable::sourceID):
7860
78612012-05-30 Filip Pizlo <fpizlo@apple.com>
7862
7863 ScriptDebugServer wants sourceIDs that are non-zero because that's what HashMaps want, so JSC should placate it
7864 https://bugs.webkit.org/show_bug.cgi?id=87887
7865
fpizlo@apple.com074918c2012-05-30 20:18:00 +00007866 Reviewed by Geoffrey Garen.
7867
7868 * parser/SourceProvider.h:
7869 (JSC::SourceProvider::asID):
7870
oliver@apple.comc55314a2012-05-30 19:45:20 +000078712012-05-30 Oliver Hunt <oliver@apple.com>
7872
7873 DFG does not correctly handle exceptions caught in the LLInt
7874 https://bugs.webkit.org/show_bug.cgi?id=87885
7875
7876 Reviewed by Filip Pizlo.
7877
7878 Make the DFG use genericThrow, rather than reimplementing a small portion of it.
7879 Also make the LLInt slow paths validate that their PC is correct.
7880
7881 * dfg/DFGOperations.cpp:
7882 * llint/LLIntSlowPaths.cpp:
7883 (LLInt):
7884
fpizlo@apple.com75824e82012-05-30 17:02:49 +000078852012-05-29 Filip Pizlo <fpizlo@apple.com>
7886
7887 DFG CFA should infer types and values of captured variables
7888 https://bugs.webkit.org/show_bug.cgi?id=87813
7889
7890 Reviewed by Gavin Barraclough.
7891
7892 Slight speed-up in V8/earley-boyer (~1%).
7893
7894 * bytecode/CodeBlock.h:
7895 (JSC::CodeBlock::argumentsAreCaptured):
7896 (JSC::CodeBlock::argumentIsCaptured):
7897 (CodeBlock):
7898 * dfg/DFGAbstractState.cpp:
7899 (DFG):
7900 (JSC::DFG::AbstractState::beginBasicBlock):
7901 (JSC::DFG::AbstractState::initialize):
7902 (JSC::DFG::AbstractState::endBasicBlock):
7903 (JSC::DFG::AbstractState::execute):
7904 (JSC::DFG::AbstractState::clobberWorld):
7905 (JSC::DFG::AbstractState::clobberStructures):
7906 (JSC::DFG::AbstractState::mergeStateAtTail):
7907 (JSC::DFG::AbstractState::merge):
7908 (JSC::DFG::AbstractState::mergeToSuccessors):
7909 * dfg/DFGAbstractState.h:
7910 (JSC::DFG::AbstractState::variables):
7911 (AbstractState):
7912 * dfg/DFGSpeculativeJIT32_64.cpp:
7913 (JSC::DFG::SpeculativeJIT::compile):
7914 * dfg/DFGSpeculativeJIT64.cpp:
7915 (JSC::DFG::SpeculativeJIT::compile):
7916
paroga@webkit.orge373ab72012-05-30 16:44:03 +000079172012-05-30 Patrick Gansterer <paroga@webkit.org>
7918
7919 Unreviewed. Build fix for !ENABLE(JIT) after r117823.
7920
7921 * bytecode/CodeBlock.cpp:
7922 (JSC::CodeBlock::dump):
7923
commit-queue@webkit.org4ac40e0d2012-05-30 07:17:05 +000079242012-05-30 Sheriff Bot <webkit.review.bot@gmail.com>
7925
7926 Unreviewed, rolling out r118868.
7927 http://trac.webkit.org/changeset/118868
7928 https://bugs.webkit.org/show_bug.cgi?id=87828
7929
7930 introduced ~20 crashes on Mac and Qt bots (Requested by pizlo_
7931 on #webkit).
7932
7933 * heap/Heap.cpp:
7934 (JSC::Heap::collect):
7935 * heap/MarkedBlock.cpp:
7936 (JSC::MarkedBlock::sweep):
7937 * heap/MarkedBlock.h:
7938 (JSC::MarkedBlock::sweepWeakSet):
7939 (JSC):
7940 * heap/MarkedSpace.cpp:
7941 (JSC::SweepWeakSet::operator()):
7942 (JSC):
7943 (JSC::MarkedSpace::sweepWeakSets):
7944 * heap/MarkedSpace.h:
7945 (MarkedSpace):
7946
ggaren@apple.com15344ae2012-05-30 01:05:35 +000079472012-05-29 Geoffrey Garen <ggaren@apple.com>
7948
7949 Rolled back in r118646, now that
7950 https://bugs.webkit.org/show_bug.cgi?id=87784 is fixed.
7951
7952 http://trac.webkit.org/changeset/118646
7953 https://bugs.webkit.org/show_bug.cgi?id=87599
7954
7955 * heap/Heap.cpp:
7956 (JSC::Heap::collect):
7957 * heap/MarkedBlock.cpp:
7958 (JSC::MarkedBlock::sweep):
7959 * heap/MarkedBlock.h:
7960 (JSC):
7961 * heap/MarkedSpace.cpp:
7962 (JSC):
7963 * heap/MarkedSpace.h:
7964 (MarkedSpace):
7965
fpizlo@apple.com4c0875e2012-05-29 23:43:16 +000079662012-05-29 Filip Pizlo <fpizlo@apple.com>
7967
7968 DFG should keep captured variables alive until the (inline) return.
7969 https://bugs.webkit.org/show_bug.cgi?id=87205
7970
7971 Reviewed by Gavin Barraclough.
7972
7973 Changes the way we do flushing for captured variables and arguments. Instead of flushing
7974 each SetLocal immediately, we flush at kill points. So a SetLocal will cause a Flush of
7975 whatever was live in the variable previously, and a return will cause a Flush of all
7976 captured variables and all arguments.
7977
7978 * dfg/DFGByteCodeParser.cpp:
7979 (JSC::DFG::ByteCodeParser::setDirect):
7980 (JSC::DFG::ByteCodeParser::set):
7981 (JSC::DFG::ByteCodeParser::setLocal):
7982 (JSC::DFG::ByteCodeParser::getArgument):
7983 (JSC::DFG::ByteCodeParser::setArgument):
7984 (JSC::DFG::ByteCodeParser::findArgumentPositionForArgument):
7985 (ByteCodeParser):
7986 (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
7987 (JSC::DFG::ByteCodeParser::findArgumentPosition):
7988 (JSC::DFG::ByteCodeParser::flush):
7989 (JSC::DFG::ByteCodeParser::flushDirect):
7990 (JSC::DFG::ByteCodeParser::flushArgumentsAndCapturedVariables):
7991 (JSC::DFG::ByteCodeParser::handleInlining):
7992 (JSC::DFG::ByteCodeParser::parseBlock):
7993 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
7994 * dfg/DFGCSEPhase.cpp:
7995 (JSC::DFG::CSEPhase::setLocalStoreElimination):
7996 (JSC::DFG::CSEPhase::performNodeCSE):
7997 * dfg/DFGSpeculativeJIT.cpp:
7998 (JSC::DFG::SpeculativeJIT::compile):
7999 * dfg/DFGSpeculativeJIT.h:
8000 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
8001
ggaren@apple.com7cc57362012-05-29 23:40:26 +000080022012-05-29 Geoffrey Garen <ggaren@apple.com>
8003
8004 WeakGCMap should be lazy-finalization-safe
8005 https://bugs.webkit.org/show_bug.cgi?id=87784
8006
8007 Reviewed by Darin Adler.
8008
8009 * runtime/WeakGCMap.h:
8010 (JSC::WeakGCMap::get): Since this is a map of raw WeakImpl pointers, and
8011 not Weak<T>, we need to verify manually that the WeakImpl is live before
8012 we return its payload.
8013
mhahnenberg@apple.com7ea7e8f2012-05-29 18:38:14 +000080142012-05-29 Mark Hahnenberg <mhahnenberg@apple.com>
8015
8016 CopiedSpace::doneCopying could start another collection
8017 https://bugs.webkit.org/show_bug.cgi?id=86538
8018
8019 Reviewed by Geoffrey Garen.
8020
8021 It's possible that if we don't have anything at the head of to-space
8022 after a collection and the BlockAllocator doesn't have any fresh blocks
8023 to give us right now we could start another collection while still in
8024 the middle of the first collection when we call CopiedSpace::addNewBlock().
8025
8026 One way to resolve this would be to have Heap::shouldCollect() check that
8027 m_operationInProgress is NoOperation. This would prevent the path in
8028 getFreshBlock() that starts the collection if we're already in the middle of one.
8029
8030 I could not come up with a test case to reproduce this crash on ToT.
8031
8032 * heap/Heap.h:
8033 (JSC::Heap::shouldCollect): We shouldn't collect if we're already in the middle
8034 of a collection, i.e. the current operation should be NoOperation.
8035
commit-queue@webkit.orgd5058402012-05-29 14:44:38 +000080362012-05-29 David Barr <davidbarr@chromium.org>
8037
8038 Introduce ENABLE_CSS_IMAGE_RESOLUTION compile flag
8039 https://bugs.webkit.org/show_bug.cgi?id=87685
8040
8041 Reviewed by Eric Seidel.
8042
8043 Add a configuration option for CSS image-resolution support, disabling it by default.
8044
8045 * Configurations/FeatureDefines.xcconfig:
8046
commit-queue@webkit.org10c0df22012-05-29 03:24:49 +000080472012-05-28 Sheriff Bot <webkit.review.bot@gmail.com>
8048
8049 Unreviewed, rolling out r118646.
8050 http://trac.webkit.org/changeset/118646
8051 https://bugs.webkit.org/show_bug.cgi?id=87691
8052
8053 broke V8 raytrace benchmark (Requested by pizlo_ on #webkit).
8054
8055 * heap/Heap.cpp:
8056 (JSC::Heap::collect):
8057 * heap/MarkedBlock.cpp:
8058 (JSC::MarkedBlock::sweep):
8059 * heap/MarkedBlock.h:
8060 (JSC::MarkedBlock::sweepWeakSet):
8061 (JSC):
8062 * heap/MarkedSpace.cpp:
8063 (JSC::SweepWeakSet::operator()):
8064 (JSC):
8065 (JSC::MarkedSpace::sweepWeakSets):
8066 * heap/MarkedSpace.h:
8067 (MarkedSpace):
8068
fpizlo@apple.com26ece8e2012-05-29 02:43:30 +000080692012-05-28 Filip Pizlo <fpizlo@apple.com>
8070
8071 DFG should not generate code for code that the CFA proves to be unreachable
8072 https://bugs.webkit.org/show_bug.cgi?id=87682
8073
8074 Reviewed by Sam Weinig.
8075
8076 This also fixes a small performance bug where CFA was not marking blocks
8077 as having constants (and hence not triggering constant folding) if the only
8078 constants were on GetLocals.
8079
8080 And fixing that bug revealed another bug: constant folding was assuming that
8081 a GetLocal must be the first access to a local in a basic block. This isn't
8082 true. The first access may be a Flush. This patch fixes that issue using the
8083 safest approach possible, since we don't need to be clever for something that
8084 only happens in one of our benchmarks.
8085
8086 * dfg/DFGAbstractState.cpp:
8087 (JSC::DFG::AbstractState::execute):
8088 * dfg/DFGConstantFoldingPhase.cpp:
8089 (JSC::DFG::ConstantFoldingPhase::run):
8090 * dfg/DFGJITCompiler.h:
8091 (JSC::DFG::JITCompiler::noticeOSREntry):
8092 * dfg/DFGSpeculativeJIT.cpp:
8093 (JSC::DFG::SpeculativeJIT::compile):
8094
carlosgc@webkit.orgb69727c2012-05-28 10:21:31 +000080952012-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
8096
8097 Unreviewed. Fix make distcheck.
8098
8099 * GNUmakefile.list.am: Add missing header file.
8100
ggaren@apple.comb816d752012-05-28 04:56:01 +000081012012-05-27 Geoffrey Garen <ggaren@apple.com>
8102
8103 Weak pointer finalization should be lazy
8104 https://bugs.webkit.org/show_bug.cgi?id=87599
8105
8106 Reviewed by Darin Adler.
8107
8108 * heap/Heap.cpp:
8109 (JSC::Heap::collect): Don't force immediate finalization -- it will
8110 happen lazily.
8111
8112 * heap/MarkedBlock.cpp:
8113 (JSC::MarkedBlock::sweep): Sweep a block's weak set when sweeping the
8114 block. The weak set may not have been swept yet, and this is our last
8115 chance to run weak finalizers before we recycle the memory they reference.
8116
8117 * heap/MarkedBlock.h:
8118 * heap/MarkedSpace.cpp:
8119 (JSC::MarkedBlock::sweepWeakSets):
8120 * heap/MarkedSpace.h:
8121 (JSC::MarkedSpace::sweepWeakSets): Nixed sweepWeakSets because it's unused
8122 now.
8123
ggaren@apple.com72da8112012-05-26 22:40:46 +000081242012-05-26 Geoffrey Garen <ggaren@apple.com>
8125
8126 WebKit should be lazy-finalization-safe (esp. the DOM) v2
8127 https://bugs.webkit.org/show_bug.cgi?id=87581
8128
8129 Reviewed by Oliver Hunt.
8130
8131 * heap/MarkedBlock.cpp:
8132 (JSC::MarkedBlock::callDestructor):
8133 * heap/WeakBlock.h:
8134 * heap/WeakSetInlines.h:
8135 (JSC::WeakBlock::finalize): Since we don't guarantee destruction order,
8136 it's not valid to access GC pointers like the Structure pointer during
8137 finalization. We NULL out the structure pointer in debug builds to try
8138 to make this programming mistake more obvious.
8139
8140 * API/JSCallbackConstructor.cpp:
8141 (JSC::JSCallbackConstructor::destroy):
8142 * API/JSCallbackObject.cpp:
8143 (JSC::::destroy):
8144 (JSC::JSCallbackObjectData::finalize):
8145 * runtime/Arguments.cpp:
8146 (JSC::Arguments::destroy):
8147 * runtime/DateInstance.cpp:
8148 (JSC::DateInstance::destroy):
8149 * runtime/Error.cpp:
8150 (JSC::StrictModeTypeErrorFunction::destroy):
8151 * runtime/Executable.cpp:
8152 (JSC::ExecutableBase::destroy):
8153 (JSC::NativeExecutable::destroy):
8154 (JSC::ScriptExecutable::destroy):
8155 (JSC::EvalExecutable::destroy):
8156 (JSC::ProgramExecutable::destroy):
8157 (JSC::FunctionExecutable::destroy):
8158 * runtime/JSGlobalObject.cpp:
8159 (JSC::JSGlobalObject::destroy):
8160 * runtime/JSPropertyNameIterator.cpp:
8161 (JSC::JSPropertyNameIterator::destroy):
8162 * runtime/JSStaticScopeObject.cpp:
8163 (JSC::JSStaticScopeObject::destroy):
8164 * runtime/JSString.cpp:
8165 (JSC::JSString::destroy):
8166 * runtime/JSVariableObject.cpp:
8167 (JSC::JSVariableObject::destroy):
8168 * runtime/NameInstance.cpp:
8169 (JSC::NameInstance::destroy):
8170 * runtime/RegExp.cpp:
8171 (JSC::RegExp::destroy):
8172 * runtime/RegExpConstructor.cpp:
8173 (JSC::RegExpConstructor::destroy):
8174 * runtime/Structure.cpp:
8175 (JSC::Structure::destroy):
8176 * runtime/StructureChain.cpp:
8177 (JSC::StructureChain::destroy): Use static_cast instead of jsCast because
8178 jsCast does Structure-based validation, and our Structure is not guaranteed
8179 to be alive when we get finalized.
8180
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +000081812012-05-22 Filip Pizlo <fpizlo@apple.com>
8182
fpizlo@apple.com190f5252012-05-25 23:00:26 +00008183 DFG CSE should eliminate redundant WeakJSConstants
8184 https://bugs.webkit.org/show_bug.cgi?id=87179
8185
8186 Reviewed by Gavin Barraclough.
8187
8188 Merged r118141 from dfgopt.
8189
8190 * dfg/DFGCSEPhase.cpp:
8191 (JSC::DFG::CSEPhase::weakConstantCSE):
8192 (CSEPhase):
8193 (JSC::DFG::CSEPhase::performNodeCSE):
8194 * dfg/DFGNode.h:
8195 (JSC::DFG::Node::weakConstant):
8196
81972012-05-22 Filip Pizlo <fpizlo@apple.com>
8198
fpizlo@apple.com7e0f6502012-05-25 22:45:57 +00008199 DFG CSE should do redundant store elimination
8200 https://bugs.webkit.org/show_bug.cgi?id=87161
8201
8202 Reviewed by Oliver Hunt.
8203
8204 Merge r118138 from dfgopt.
8205
8206 This patch adds redundant store elimination. For example, consider this
8207 code:
8208
8209 o.x = 42;
8210 o.x = 84;
8211
8212 If o.x is speculated to be a well-behaved field, the first assignment is
8213 unnecessary, since the second just overwrites it. We would like to
8214 eliminate the first assignment in these cases. The need for this
8215 optimization arises mostly from stores that our runtime requires. For
8216 example:
8217
8218 o = {f:1, g:2, h:3};
8219
8220 This will have four assignments to the structure for the newly created
8221 object - one assignment for the empty structure, one for {f}, one for
8222 {f, g}, and one for {f, g, h}. We would like to only have the last of
8223 those assigments in this case.
8224
8225 Intriguingly, doing so for captured variables breaks the way arguments
8226 simplification used to work. Consider that prior to either arguments
8227 simplification or store elimination we will have IR that looks like:
8228
8229 a: SetLocal(r0, Empty)
8230 b: SetLocal(r1, Empty)
8231 c: GetLocal(r0)
8232 d: CreateArguments(@c)
8233 e: SetLocal(r0, @d)
8234 f: SetLocal(r1, @d)
8235
8236 Then redundant store elimination will eliminate the stores that
8237 initialize the arguments registers to Empty, but then arguments
8238 simplification eliminates the stores that initialize the arguments to
8239 the newly created arguments - and at this point we no longer have any
8240 stores to the arguments register, leading to hilarious crashes. This
8241 patch therefore changes arguments simplification to replace
8242 CreateArguments with JSConstant(Empty) rather than eliminating the
8243 SetLocals. But this revealed bugs where arguments simplification was
8244 being overzealous, so I fixed those bugs.
8245
8246 This is a minor speed-up on V8/early and a handful of other tests.
8247
8248 * bytecode/CodeBlock.h:
8249 (JSC::CodeBlock::uncheckedActivationRegister):
8250 * dfg/DFGAbstractState.cpp:
8251 (JSC::DFG::AbstractState::execute):
8252 * dfg/DFGArgumentsSimplificationPhase.cpp:
8253 (JSC::DFG::ArgumentsSimplificationPhase::run):
8254 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
8255 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
8256 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
8257 * dfg/DFGCSEPhase.cpp:
8258 (JSC::DFG::CSEPhase::globalVarStoreElimination):
8259 (CSEPhase):
8260 (JSC::DFG::CSEPhase::putStructureStoreElimination):
8261 (JSC::DFG::CSEPhase::putByOffsetStoreElimination):
8262 (JSC::DFG::CSEPhase::setLocalStoreElimination):
8263 (JSC::DFG::CSEPhase::setReplacement):
8264 (JSC::DFG::CSEPhase::eliminate):
8265 (JSC::DFG::CSEPhase::performNodeCSE):
8266 * dfg/DFGGraph.h:
8267 (JSC::DFG::Graph::uncheckedActivationRegisterFor):
8268 (Graph):
8269 * dfg/DFGNode.h:
8270 (JSC::DFG::Node::isPhantomArguments):
8271 (Node):
8272 (JSC::DFG::Node::hasConstant):
8273 (JSC::DFG::Node::valueOfJSConstant):
8274 (JSC::DFG::Node::hasStructureTransitionData):
8275 * dfg/DFGNodeType.h:
8276 (DFG):
8277 * dfg/DFGPredictionPropagationPhase.cpp:
8278 (JSC::DFG::PredictionPropagationPhase::propagate):
8279 * dfg/DFGSpeculativeJIT.cpp:
8280 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
8281 * dfg/DFGSpeculativeJIT32_64.cpp:
8282 (JSC::DFG::SpeculativeJIT::compile):
8283 * dfg/DFGSpeculativeJIT64.cpp:
8284 (JSC::DFG::SpeculativeJIT::compile):
8285
fpizlo@apple.com016fd682012-05-25 20:19:55 +000082862012-05-21 Filip Pizlo <fpizlo@apple.com>
8287
8288 DFG ConvertThis should just be a CheckStructure if the structure is known
8289 https://bugs.webkit.org/show_bug.cgi?id=87057
8290
8291 Reviewed by Gavin Barraclough.
8292
8293 Merged r118021 from dfgopt.
8294
8295 This gives ValueProfile the ability to track singleton values - i.e. profiling
8296 sites that always see the same value.
8297
8298 That is then used to profile the structure in op_convert_this.
8299
8300 This is then used to optimize op_convert_this into a CheckStructure if the
8301 structure is always the same.
8302
8303 That then results in better CSE in inlined code that uses 'this', since
8304 previously we couldn't CSE accesses on 'this' from different inline call frames.
8305
8306 Also fixed a bug where we were unnecessarily flushing 'this'.
8307
8308 * bytecode/CodeBlock.cpp:
8309 (JSC::CodeBlock::dump):
8310 (JSC::CodeBlock::stronglyVisitStrongReferences):
8311 * bytecode/LazyOperandValueProfile.cpp:
8312 (JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
8313 * bytecode/LazyOperandValueProfile.h:
8314 (CompressedLazyOperandValueProfileHolder):
8315 * bytecode/Opcode.h:
8316 (JSC):
8317 (JSC::padOpcodeName):
8318 * bytecode/ValueProfile.h:
8319 (JSC::ValueProfileBase::ValueProfileBase):
8320 (JSC::ValueProfileBase::dump):
8321 (JSC::ValueProfileBase::computeUpdatedPrediction):
8322 (ValueProfileBase):
8323 * bytecompiler/BytecodeGenerator.cpp:
8324 (JSC::BytecodeGenerator::BytecodeGenerator):
8325 * dfg/DFGByteCodeParser.cpp:
8326 (JSC::DFG::ByteCodeParser::setArgument):
8327 (JSC::DFG::ByteCodeParser::parseBlock):
8328 * jit/JITOpcodes.cpp:
8329 (JSC::JIT::emit_op_convert_this):
8330 (JSC::JIT::emitSlow_op_convert_this):
8331 * jit/JITOpcodes32_64.cpp:
8332 (JSC::JIT::emit_op_convert_this):
8333 (JSC::JIT::emitSlow_op_convert_this):
8334 * llint/LLIntSlowPaths.cpp:
8335 (JSC::LLInt::LLINT_SLOW_PATH_DECL):
8336 * llint/LowLevelInterpreter32_64.asm:
8337 * llint/LowLevelInterpreter64.asm:
8338 * runtime/JSValue.h:
8339 (JSValue):
8340 * runtime/Structure.h:
8341 (JSC::JSValue::structureOrUndefined):
8342 (JSC):
8343
timothy_horton@apple.com3f03ac12012-05-25 06:53:27 +000083442012-05-24 Tim Horton <timothy_horton@apple.com>
8345
8346 Add feature defines for web-facing parts of CSS Regions and Exclusions
8347 https://bugs.webkit.org/show_bug.cgi?id=87442
8348 <rdar://problem/10887709>
8349
8350 Reviewed by Dan Bernstein.
8351
8352 * Configurations/FeatureDefines.xcconfig:
8353
ggaren@apple.com9e1789f2012-05-25 06:52:00 +000083542012-05-24 Geoffrey Garen <ggaren@apple.com>
8355
8356 WebKit should be lazy-finalization-safe (esp. the DOM)
8357 https://bugs.webkit.org/show_bug.cgi?id=87456
8358
8359 Reviewed by Filip Pizlo.
8360
8361 Lazy finalization adds one twist to weak pointer use:
8362
8363 A HashMap of weak pointers may contain logically null entries.
8364 (Weak pointers behave as-if null once their payloads die.)
8365 Insertion must not assume that a pre-existing entry is
8366 necessarily valid, and iteration must not assume that all
8367 entries can be dereferenced.
8368
8369 (Previously, I thought that it also added a second twist:
8370
8371 A demand-allocated weak pointer may replace a dead payload
8372 before the payload's finalizer runs. In that case, when the
8373 payload's finalizer runs, the payload has already been
8374 overwritten, and the finalizer should not clear the payload,
8375 which now points to something new.
8376
8377 But that's not the case here, since we cancel the old payload's
8378 finalizer when we over-write it. I've added ASSERTs to verify this
8379 assumption, in case it ever changes.)
8380
8381 * API/JSClassRef.cpp:
8382 (OpaqueJSClass::prototype): No need to specify null; that's the default.
8383
8384 * API/JSWeakObjectMapRefPrivate.cpp: Use remove, since take() is gone.
8385
8386 * heap/PassWeak.h:
8387 (WeakImplAccessor::was): This is no longer a debug-only function, since
8388 it's required to reason about lazily finalized pointers.
8389
8390 * heap/Weak.h:
8391 (JSC::weakAdd):
8392 (JSC::weakRemove):
8393 (JSC::weakClear): Added these helper functions for the common idioms of
8394 what clients want to do in their weak pointer finalizers.
8395
8396 * jit/JITStubs.cpp:
8397 (JSC::JITThunks::hostFunctionStub): Use the new idioms. Otherwise, we
8398 would return NULL for a "zombie" executable weak pointer that was waiting
8399 for finalization (item (2)), and finalizing a dead executable weak pointer
8400 would potentially destroy a new, live one (item (1)).
8401
8402 * runtime/RegExpCache.cpp:
8403 (JSC::RegExpCache::lookupOrCreate):
8404 (JSC::RegExpCache::finalize): Ditto.
8405
8406 (JSC::RegExpCache::invalidateCode): Check for null while iterating. (See
8407 item (2).)
8408
8409 * runtime/Structure.cpp:
8410 (JSC::StructureTransitionTable::contains):
8411 (JSC::StructureTransitionTable::add): Use get and set instead of add and
8412 contains, since add and contains are not compatible with lazy finalization.
8413
8414 * runtime/WeakGCMap.h:
8415 (WeakGCMap):
8416 (JSC::WeakGCMap::clear):
8417 (JSC::WeakGCMap::remove): Removed a bunch of code that was incompatible with
8418 lazy finalization because I didn't feel like making it compatible, and I had
8419 no way to test it.
8420
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +000084212012-05-24 Filip Pizlo <fpizlo@apple.com>
8422
fpizlo@apple.com9d899a42012-05-25 05:41:03 +00008423 REGRESSION (r118013-r118031): Loops/Reloads under www.yahoo.com, quits after three tries with error
8424 https://bugs.webkit.org/show_bug.cgi?id=87327
8425
8426 Reviewed by Geoffrey Garen.
8427
8428 If you use AbstractValue::filter(StructureSet) to test subset relationships between TOP and a
8429 set containing >=2 elements, you're going to have a bad time.
8430
8431 That's because AbstractValue considers a set with >=2 elements to be equivalent to TOP, in order
8432 to save space and speed up convergence. So filtering has no effect in this case, which made
8433 the code think that the abstract value was proving that the structure check was unnecessary.
8434 The correct thing to do is to use isSubsetOf() on the StructureAbstractValue, which does the
8435 right thingies for TOP and >=2 elements.
8436
8437 * dfg/DFGAbstractState.cpp:
8438 (JSC::DFG::AbstractState::execute):
8439 * dfg/DFGSpeculativeJIT32_64.cpp:
8440 (JSC::DFG::SpeculativeJIT::compile):
8441 * dfg/DFGSpeculativeJIT64.cpp:
8442 (JSC::DFG::SpeculativeJIT::compile):
8443
84442012-05-24 Filip Pizlo <fpizlo@apple.com>
8445
fpizlo@apple.com0b9b37a2012-05-25 03:29:18 +00008446 new test fast/js/dfg-arguments-mixed-alias.html fails on JSVALUE32_64
8447 https://bugs.webkit.org/show_bug.cgi?id=87378
8448
8449 Reviewed by Gavin Barraclough.
8450
8451 - Captured variable tracking forgot did not consistently handle arguments, leading to OSR
8452 badness.
8453
8454 - Nodes capable of exiting were tracked in a non-monotonic way, leading to compiler errors.
8455
8456 * dfg/DFGByteCodeParser.cpp:
8457 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
8458 * dfg/DFGCSEPhase.cpp:
8459 (JSC::DFG::CSEPhase::CSEPhase):
8460 (CSEPhase):
8461 (JSC::DFG::performCSE):
8462 * dfg/DFGCSEPhase.h:
8463 (DFG):
8464 * dfg/DFGCommon.h:
8465 * dfg/DFGDriver.cpp:
8466 (JSC::DFG::compile):
8467 * dfg/DFGGraph.cpp:
8468 (JSC::DFG::Graph::resetExitStates):
8469 (DFG):
8470 * dfg/DFGGraph.h:
8471 (Graph):
8472 * dfg/DFGPhase.h:
8473 (DFG):
8474 (JSC::DFG::runPhase):
8475
ggaren@apple.com39281e22012-05-24 21:18:10 +000084762012-05-24 Geoffrey Garen <ggaren@apple.com>
8477
8478 Made WeakSet per-block instead of per-heap
8479 https://bugs.webkit.org/show_bug.cgi?id=87401
8480
8481 Reviewed by Oliver Hunt.
8482
8483 This allows us fast access to the set of all weak pointers for a block,
8484 which is a step toward lazy finalization.
8485
8486 No performance change.
8487
8488 * heap/Heap.cpp:
8489 (JSC::Heap::Heap):
8490 (JSC::Heap::lastChanceToFinalize): Removed the per-heap weak set, since
8491 it's per-block now.
8492
8493 (JSC::Heap::markRoots): Delegate weak set visiting to the marked space,
8494 since it knows how to iterate all blocks.
8495
8496 (JSC::Heap::collect): Moved the reaping outside of markRoots, since it
8497 doesn't mark anything.
8498
8499 Make sure to reset allocators after shrinking, since shrinking may
8500 deallocate the current allocator.
8501
8502 * heap/Heap.h:
8503 (Heap): No more per-heap weak set, since it's per-block now.
8504
8505 * heap/MarkedBlock.cpp:
8506 (JSC::MarkedBlock::MarkedBlock):
8507 * heap/MarkedBlock.h:
8508 (MarkedBlock):
8509 (JSC::MarkedBlock::lastChanceToFinalize): Migrated finalization logic
8510 here from the heap, so the heap doesn't need to know about our internal
8511 data structures like our weak set.
8512
8513 (JSC::MarkedBlock::heap):
8514 (JSC::MarkedBlock::weakSet):
8515 (JSC::MarkedBlock::shrink):
8516 (JSC::MarkedBlock::resetAllocator):
8517 (JSC::MarkedBlock::visitWeakSet):
8518 (JSC::MarkedBlock::reapWeakSet):
8519 (JSC::MarkedBlock::sweepWeakSet):
8520 * heap/MarkedSpace.cpp:
8521 (JSC::VisitWeakSet::VisitWeakSet):
8522 (JSC::VisitWeakSet::operator()):
8523 (VisitWeakSet):
8524 (JSC):
8525 (JSC::ReapWeakSet::operator()):
8526 (JSC::SweepWeakSet::operator()):
8527 (JSC::LastChanceToFinalize::operator()):
8528 (JSC::MarkedSpace::lastChanceToFinalize):
8529 (JSC::ResetAllocator::operator()):
8530 (JSC::MarkedSpace::resetAllocators):
8531 (JSC::MarkedSpace::visitWeakSets):
8532 (JSC::MarkedSpace::reapWeakSets):
8533 (JSC::MarkedSpace::sweepWeakSets):
8534 (JSC::Shrink::operator()):
8535 (JSC::MarkedSpace::shrink):
8536 * heap/MarkedSpace.h:
8537 (MarkedSpace): Make sure to account for our weak sets when sweeping,
8538 shrinking, etc.
8539
8540 * heap/WeakSet.cpp:
8541 (JSC):
8542 * heap/WeakSet.h:
8543 (WeakSet):
8544 (JSC::WeakSet::heap):
8545 (JSC):
8546 (JSC::WeakSet::lastChanceToFinalize):
8547 (JSC::WeakSet::visit):
8548 (JSC::WeakSet::reap):
8549 (JSC::WeakSet::shrink):
8550 (JSC::WeakSet::resetAllocator): Inlined some things since they're called
8551 once per block now instead of once per heap.
8552
8553 * heap/WeakSetInlines.h:
8554 (JSC::WeakSet::allocate): Use the per-block weak set since there is no
8555 per-heap weak set anymore.
8556
barraclough@apple.comefdbf472012-05-24 21:14:07 +000085572012-05-24 Gavin Barraclough <barraclough@apple.com>
8558
barraclough@apple.com8ca6a7a2012-05-24 21:17:38 +00008559 Fix arm build
8560
8561 Rubber stamped by Geoff Garen
8562
8563 * dfg/DFGGPRInfo.h:
8564 (GPRInfo):
8565
85662012-05-24 Gavin Barraclough <barraclough@apple.com>
8567
barraclough@apple.comefdbf472012-05-24 21:14:07 +00008568 Move cacheFlush from ExecutableAllocator to Assembler classes
8569 https://bugs.webkit.org/show_bug.cgi?id=87420
8570
8571 Reviewed by Oliver Hunt.
8572
8573 Makes more sense there, & remove a pile of #ifdefs.
8574
8575 * assembler/ARMAssembler.cpp:
8576 (JSC):
8577 (JSC::ARMAssembler::cacheFlush):
8578 * assembler/ARMAssembler.h:
8579 (ARMAssembler):
8580 (JSC::ARMAssembler::cacheFlush):
8581 * assembler/ARMv7Assembler.h:
8582 (JSC::ARMv7Assembler::relinkJump):
8583 (JSC::ARMv7Assembler::cacheFlush):
8584 (ARMv7Assembler):
8585 (JSC::ARMv7Assembler::setInt32):
8586 (JSC::ARMv7Assembler::setUInt7ForLoad):
8587 * assembler/AbstractMacroAssembler.h:
8588 (JSC::AbstractMacroAssembler::cacheFlush):
8589 * assembler/LinkBuffer.h:
8590 (JSC::LinkBuffer::performFinalization):
8591 * assembler/MIPSAssembler.h:
8592 (JSC::MIPSAssembler::relinkJump):
8593 (JSC::MIPSAssembler::relinkCall):
8594 (JSC::MIPSAssembler::repatchInt32):
8595 (JSC::MIPSAssembler::cacheFlush):
8596 (MIPSAssembler):
8597 * assembler/SH4Assembler.h:
8598 (JSC::SH4Assembler::repatchCompact):
8599 (JSC::SH4Assembler::cacheFlush):
8600 (SH4Assembler):
8601 * assembler/X86Assembler.h:
8602 (X86Assembler):
8603 (JSC::X86Assembler::cacheFlush):
8604 * jit/ExecutableAllocator.cpp:
8605 (JSC):
8606 * jit/ExecutableAllocator.h:
8607 (ExecutableAllocator):
8608
commit-queue@webkit.org2c8bcde2012-05-24 20:01:53 +000086092012-05-24 John Mellor <johnme@chromium.org>
8610
8611 Font Boosting: Add compile flag and runtime setting
8612 https://bugs.webkit.org/show_bug.cgi?id=87394
8613
8614 Reviewed by Adam Barth.
8615
8616 Add ENABLE_FONT_BOOSTING.
8617
8618 * Configurations/FeatureDefines.xcconfig:
8619
commit-queue@webkit.orgd553c622012-05-24 10:50:40 +000086202012-05-24 Allan Sandfeld Jensen <allan.jensen@nokia.com>
8621
8622 cti_vm_throw gets kicked out by gcc 4.6 -flto
8623 https://bugs.webkit.org/show_bug.cgi?id=56088
8624
8625 Reviewed by Darin Adler.
8626
8627 Add REFERENCED_FROM_ASM to functions only referenced from assembler.
8628
8629 * dfg/DFGOperations.cpp:
8630 * jit/HostCallReturnValue.h:
8631 * jit/JITStubs.h:
8632 * jit/ThunkGenerators.cpp:
8633
fpizlo@apple.com36f14462012-05-24 07:35:05 +000086342012-05-24 Filip Pizlo <fpizlo@apple.com>
8635
8636 Incorrect merge of r117542 from dfg opt branch in r118323 is leading to fast/js/dfg-arguments-osr-exit.html failing
8637 https://bugs.webkit.org/show_bug.cgi?id=87350
8638
8639 Reviewed by Maciej Stachowiak.
8640
8641 The dfgopt branch introduced the notion of a local variable being killed because it was aliased
8642 to the Arguments object as in cases like:
8643
8644 var a = arguments;
8645 return a.length;
8646
8647 This required changes to OSR exit handling - if the variable is dead but aliased to arguments, then
8648 OSR exit should reify the arguments. But meanwhile, in tip of tree we introduced special handling for
8649 dead variables on OSR exit. When the two were merged in r118323, the structure of the if/else branches
8650 ended up being such that we would treat dead arguments variables as totally dead as opposed to treating
8651 them as variables that need arguments reification.
8652
8653 This fixes the structure of the relevant if/else block so that variables that are dead-but-arguments
8654 end up being treated as reified arguments objects, while variables that are dead but not aliased to
8655 arguments are treated as tip of tree would have treated them (initialize to Undefined).
8656
8657 * dfg/DFGSpeculativeJIT.cpp:
8658 (JSC::DFG::SpeculativeJIT::compile):
8659
ossy@webkit.orgbc0d6372012-05-24 07:05:31 +000086602012-05-24 Csaba Osztrogonác <ossy@webkit.org>
8661
8662 Unreviewed 32 bit buildfix after r118325.
8663
8664 * dfg/DFGSpeculativeJIT32_64.cpp:
8665 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal): Use ASSERT_UNUSED instead ASSERT.
8666
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +000086672012-05-23 Filip Pizlo <fpizlo@apple.com>
8668
fpizlo@apple.comb3ac2422012-05-24 07:00:24 +00008669 DFG operationTearOffActivation should return after handling the null activation case
8670 https://bugs.webkit.org/show_bug.cgi?id=87348
8671 <rdar://problem/11522295>
8672
8673 Reviewed by Oliver Hunt.
8674
8675 * dfg/DFGOperations.cpp:
8676
86772012-05-23 Filip Pizlo <fpizlo@apple.com>
8678
fpizlo@apple.comd96eb4e2012-05-24 06:58:52 +00008679 Unreviewed, merge the arguments fix in r118138 to get bots green.
8680
8681 * dfg/DFGArgumentsSimplificationPhase.cpp:
8682 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
8683
fpizlo@apple.comb9c94622012-05-24 05:51:05 +000086842012-05-20 Filip Pizlo <fpizlo@apple.com>
8685
fpizlo@apple.com91b2c682012-05-24 06:24:36 +00008686 DFG CFA should record if a node can OSR exit
8687 https://bugs.webkit.org/show_bug.cgi?id=86905
8688
8689 Reviewed by Oliver Hunt.
8690
8691 Merged r117931 from dfgopt.
8692
8693 Adds a NodeFlag that denotes nodes that are known to not have OSR exits.
8694 This ought to aid any backwards analyses that need to know when a
8695 backward flow merge might happen due to a side exit.
8696
8697 Also added assertions into speculationCheck() that ensure that we did not
8698 mark a node as non-exiting and then promptly compile in an exit. This
8699 helped catch some minor bugs where we were doing unnecessary speculation
8700 checks.
8701
8702 This is a perf-neutral change. The speculation checks that this removes
8703 were not on hot paths of major benchmarks.
8704
8705 * bytecode/PredictedType.h:
8706 (JSC):
8707 (JSC::isAnyPrediction):
8708 * dfg/DFGAbstractState.cpp:
8709 (JSC::DFG::AbstractState::execute):
8710 * dfg/DFGAbstractState.h:
8711 (JSC::DFG::AbstractState::speculateInt32Unary):
8712 (AbstractState):
8713 (JSC::DFG::AbstractState::speculateNumberUnary):
8714 (JSC::DFG::AbstractState::speculateBooleanUnary):
8715 (JSC::DFG::AbstractState::speculateInt32Binary):
8716 (JSC::DFG::AbstractState::speculateNumberBinary):
8717 * dfg/DFGNode.h:
8718 (JSC::DFG::Node::mergeFlags):
8719 (JSC::DFG::Node::filterFlags):
8720 (Node):
8721 (JSC::DFG::Node::setCanExit):
8722 (JSC::DFG::Node::canExit):
8723 * dfg/DFGNodeFlags.cpp:
8724 (JSC::DFG::nodeFlagsAsString):
8725 * dfg/DFGNodeFlags.h:
8726 (DFG):
8727 * dfg/DFGSpeculativeJIT.cpp:
8728 (JSC::DFG::SpeculativeJIT::SpeculativeJIT):
8729 (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
8730 (JSC::DFG::SpeculativeJIT::compileValueToInt32):
8731 * dfg/DFGSpeculativeJIT.h:
8732 (JSC::DFG::SpeculativeJIT::speculationCheck):
8733 (JSC::DFG::SpeculativeJIT::forwardSpeculationCheck):
8734 (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
8735 (SpeculativeJIT):
8736 * dfg/DFGSpeculativeJIT32_64.cpp:
8737 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
8738 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
8739 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
8740 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
8741 (JSC::DFG::SpeculativeJIT::compile):
8742 * dfg/DFGSpeculativeJIT64.cpp:
8743 (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
8744 (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
8745 (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
8746 (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
8747 (JSC::DFG::SpeculativeJIT::compile):
8748
87492012-05-20 Filip Pizlo <fpizlo@apple.com>
8750
fpizlo@apple.comb9c94622012-05-24 05:51:05 +00008751 DFG should not do unnecessary indirections when storing to objects
8752 https://bugs.webkit.org/show_bug.cgi?id=86959
8753
8754 Reviewed by Oliver Hunt.
8755
8756 Merged r117819 from dfgopt.
8757
8758 * dfg/DFGByteCodeParser.cpp:
8759 (JSC::DFG::ByteCodeParser::parseBlock):
8760 * dfg/DFGCSEPhase.cpp:
8761 (JSC::DFG::CSEPhase::getByOffsetLoadElimination):
8762 * dfg/DFGSpeculativeJIT32_64.cpp:
8763 (JSC::DFG::SpeculativeJIT::compile):
8764 * dfg/DFGSpeculativeJIT64.cpp:
8765 (JSC::DFG::SpeculativeJIT::compile):
8766
fpizlo@apple.com9a548f12012-05-24 05:33:09 +000087672012-05-17 Filip Pizlo <fpizlo@apple.com>
8768
8769 DFG should optimize aliased uses of the Arguments object of the current call frame
8770 https://bugs.webkit.org/show_bug.cgi?id=86552
8771
8772 Reviewed by Geoff Garen.
8773
8774 Merged r117542 and r117543 from dfgopt.
8775
8776 Performs must-alias and escape analysis on uses of CreateArguments, and if
8777 a variable is must-aliased to CreateArguments and does not escape, then we
8778 turn all uses of that variable into direct arguments accesses.
8779
8780 36% speed-up on V8/earley leading to a 2.3% speed-up overall in V8.
8781
8782 * bytecode/CodeBlock.h:
8783 (JSC::CodeBlock::uncheckedArgumentsRegister):
8784 * bytecode/ValueRecovery.h:
8785 (JSC::ValueRecovery::argumentsThatWereNotCreated):
8786 (ValueRecovery):
8787 (JSC::ValueRecovery::dump):
8788 * dfg/DFGAbstractState.cpp:
8789 (JSC::DFG::AbstractState::execute):
8790 * dfg/DFGAdjacencyList.h:
8791 (AdjacencyList):
8792 (JSC::DFG::AdjacencyList::removeEdgeFromBag):
8793 * dfg/DFGArgumentsSimplificationPhase.cpp:
8794 (JSC::DFG::ArgumentsSimplificationPhase::run):
8795 (ArgumentsSimplificationPhase):
8796 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse):
8797 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses):
8798 (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse):
8799 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize):
8800 (JSC::DFG::ArgumentsSimplificationPhase::removeArgumentsReferencingPhantomChild):
8801 * dfg/DFGAssemblyHelpers.h:
8802 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
8803 (AssemblyHelpers):
8804 * dfg/DFGByteCodeParser.cpp:
8805 (JSC::DFG::ByteCodeParser::parseBlock):
8806 * dfg/DFGCFGSimplificationPhase.cpp:
8807 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
8808 * dfg/DFGGPRInfo.h:
8809 (GPRInfo):
8810 * dfg/DFGGraph.cpp:
8811 (JSC::DFG::Graph::collectGarbage):
8812 (DFG):
8813 * dfg/DFGGraph.h:
8814 (Graph):
8815 (JSC::DFG::Graph::executableFor):
8816 (JSC::DFG::Graph::argumentsRegisterFor):
8817 (JSC::DFG::Graph::uncheckedArgumentsRegisterFor):
8818 (JSC::DFG::Graph::clobbersWorld):
8819 * dfg/DFGNode.h:
8820 (JSC::DFG::Node::hasHeapPrediction):
8821 * dfg/DFGNodeType.h:
8822 (DFG):
8823 * dfg/DFGOSRExitCompiler.cpp:
8824 * dfg/DFGOSRExitCompiler.h:
8825 (JSC::DFG::OSRExitCompiler::OSRExitCompiler):
8826 (OSRExitCompiler):
8827 * dfg/DFGOSRExitCompiler32_64.cpp:
8828 (JSC::DFG::OSRExitCompiler::compileExit):
8829 * dfg/DFGOSRExitCompiler64.cpp:
8830 (JSC::DFG::OSRExitCompiler::compileExit):
8831 * dfg/DFGOperations.cpp:
8832 * dfg/DFGPredictionPropagationPhase.cpp:
8833 (JSC::DFG::PredictionPropagationPhase::propagate):
8834 * dfg/DFGSpeculativeJIT.cpp:
8835 (JSC::DFG::ValueSource::dump):
8836 (JSC::DFG::SpeculativeJIT::compile):
8837 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
8838 * dfg/DFGSpeculativeJIT.h:
8839 * dfg/DFGSpeculativeJIT32_64.cpp:
8840 (JSC::DFG::SpeculativeJIT::compile):
8841 * dfg/DFGSpeculativeJIT64.cpp:
8842 (JSC::DFG::SpeculativeJIT::compile):
8843 * dfg/DFGVariableAccessData.h:
8844 (JSC::DFG::VariableAccessData::VariableAccessData):
8845 (JSC::DFG::VariableAccessData::mergeIsArgumentsAlias):
8846 (VariableAccessData):
8847 (JSC::DFG::VariableAccessData::isArgumentsAlias):
8848 * jit/JITOpcodes.cpp:
8849 (JSC::JIT::emitSlow_op_get_argument_by_val):
8850
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +000088512012-05-23 Filip Pizlo <fpizlo@apple.com>
8852
fpizlo@apple.comae3413b2012-05-24 02:34:09 +00008853 DFGCapabilities should not try to get an arguments register from code blocks that don't have one
8854 https://bugs.webkit.org/show_bug.cgi?id=87332
8855
8856 Reviewed by Andy Estes.
8857
8858 * dfg/DFGCapabilities.h:
8859 (JSC::DFG::canInlineOpcode):
8860
88612012-05-23 Filip Pizlo <fpizlo@apple.com>
8862
fpizlo@apple.comdb7ba192012-05-24 02:28:52 +00008863 DFG should have sparse conditional constant propagation
8864 https://bugs.webkit.org/show_bug.cgi?id=86580
8865
8866 Reviewed by Oliver Hunt.
8867
8868 Merged r117370 from dfgopt.
8869
8870 This enhances CFA so that if it suspects at any point during the fixpoint that a
8871 branch will only go one way, then it only propagates in that one way.
8872
8873 This vastly increases the opportunities for CFG simplification. For example, it
8874 enables us to evaporate this loop:
8875
8876 for (var i = 0; i < 1; ++i) doThings(i);
8877
8878 As a result, it uncovered loads of bugs in the CFG simplifier. In particular:
8879
8880 - Phi fixup was assuming that all Phis worth fixing up are shouldGenerate().
8881 That's not true; we also fixup Phis that are dead.
8882
8883 - GetLocal fixup was assuming that it's only necessary to rewire links to a
8884 GetLocal, and that the GetLocal's own links don't need to be rewired. Untrue,
8885 because the GetLocal may not be rewirable (first block has no GetLocal for r42
8886 but second block does have a GetLocal), in which case it will refer to a Phi
8887 in the second block. We need it to refer to a Phi from the first block to
8888 ensure that subsequent transformations work.
8889
8890 - Tail operand fixup was ignoring the fact that Phis in successors may contain
8891 references to the children of our tail variables. Hence, successor Phi child
8892 substitution needs to use the original second block variable table as its
8893 prior, rather than trying to reconstruct the prior later (since by that point
8894 the children of the second block's tail variables will have been fixed up, so
8895 we will not know what the prior would have been).
8896
8897 * dfg/DFGAbstractState.cpp:
8898 (JSC::DFG::AbstractState::beginBasicBlock):
8899 (JSC::DFG::AbstractState::endBasicBlock):
8900 (JSC::DFG::AbstractState::reset):
8901 (JSC::DFG::AbstractState::execute):
8902 (JSC::DFG::AbstractState::mergeToSuccessors):
8903 * dfg/DFGAbstractState.h:
8904 (JSC::DFG::AbstractState::branchDirectionToString):
8905 (AbstractState):
8906 * dfg/DFGCFGSimplificationPhase.cpp:
8907 (JSC::DFG::CFGSimplificationPhase::run):
8908 (JSC::DFG::CFGSimplificationPhase::removePotentiallyDeadPhiReference):
8909 (JSC::DFG::CFGSimplificationPhase::OperandSubstitution::OperandSubstitution):
8910 (OperandSubstitution):
8911 (JSC::DFG::CFGSimplificationPhase::skipGetLocal):
8912 (JSC::DFG::CFGSimplificationPhase::recordPossibleIncomingReference):
8913 (CFGSimplificationPhase):
8914 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
8915 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
8916 * dfg/DFGGraph.h:
8917 (JSC::DFG::Graph::changeEdge):
8918
ojan@chromium.org959e4a22012-05-24 02:03:04 +000089192012-05-23 Ojan Vafai <ojan@chromium.org>
8920
8921 add back the ability to disable flexbox
8922 https://bugs.webkit.org/show_bug.cgi?id=87147
8923
8924 Reviewed by Tony Chang.
8925
8926 * Configurations/FeatureDefines.xcconfig:
8927
fpizlo@apple.com9b928722012-05-24 00:18:55 +000089282012-05-23 Filip Pizlo <fpizlo@apple.com>
8929
fpizlo@apple.com16faaea2012-05-24 01:04:55 +00008930 Unreviewed, fix Windows build.
8931
8932 * bytecode/CodeBlock.h:
8933 * dfg/DFGCapabilities.h:
8934 (JSC::DFG::canCompileOpcode):
8935 (JSC::DFG::canCompileOpcodes):
8936 * dfg/DFGCommon.h:
8937 (DFG):
8938
89392012-05-23 Filip Pizlo <fpizlo@apple.com>
8940
fpizlo@apple.com9b928722012-05-24 00:18:55 +00008941 DFG should optimize inlined uses of arguments.length and arguments[i]
8942 https://bugs.webkit.org/show_bug.cgi?id=86327
8943
8944 Reviewed by Gavin Barraclough.
8945
8946 Merged r117017 from dfgopt.
8947
8948 Turns inlined uses of arguments.length into a constant.
8949
8950 Turns inlined uses of arguments[constant] into a direct reference to the
8951 argument.
8952
8953 Big win on micro-benchmarks. Not yet a win on V8 because the hot uses of
8954 arguments.length and arguments[i] are aliased. I'll leave the aliasing
8955 optimizations to a later patch.
8956
8957 * CMakeLists.txt:
8958 * GNUmakefile.list.am:
8959 * JavaScriptCore.xcodeproj/project.pbxproj:
8960 * Target.pri:
8961 * bytecode/DFGExitProfile.h:
8962 (FrequentExitSite):
8963 (JSC::DFG::FrequentExitSite::FrequentExitSite):
8964 (JSC::DFG::QueryableExitProfile::hasExitSite):
8965 (QueryableExitProfile):
8966 * dfg/DFGAbstractState.cpp:
8967 (JSC::DFG::AbstractState::execute):
8968 * dfg/DFGArgumentsSimplificationPhase.cpp: Added.
8969 (DFG):
8970 (ArgumentsSimplificationPhase):
8971 (JSC::DFG::ArgumentsSimplificationPhase::ArgumentsSimplificationPhase):
8972 (JSC::DFG::ArgumentsSimplificationPhase::run):
8973 (JSC::DFG::performArgumentsSimplification):
8974 * dfg/DFGArgumentsSimplificationPhase.h: Added.
8975 (DFG):
8976 * dfg/DFGAssemblyHelpers.cpp:
8977 (JSC::DFG::AssemblyHelpers::executableFor):
8978 (DFG):
8979 * dfg/DFGAssemblyHelpers.h:
8980 (AssemblyHelpers):
8981 * dfg/DFGByteCodeParser.cpp:
8982 (JSC::DFG::ByteCodeParser::parseBlock):
8983 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
8984 * dfg/DFGCSEPhase.cpp:
8985 (JSC::DFG::CSEPhase::getLocalLoadElimination):
8986 (JSC::DFG::CSEPhase::performNodeCSE):
8987 * dfg/DFGDriver.cpp:
8988 (JSC::DFG::compile):
8989 * dfg/DFGGraph.h:
8990 (JSC::DFG::Graph::Graph):
8991 (JSC::DFG::Graph::executableFor):
8992 (Graph):
8993 (JSC::DFG::Graph::clobbersWorld):
8994 * dfg/DFGNode.h:
8995 (JSC::DFG::Node::convertToConstant):
8996 (JSC::DFG::Node::convertToGetLocalUnlinked):
8997 (Node):
8998 (JSC::DFG::Node::unlinkedLocal):
8999 * dfg/DFGNodeType.h:
9000 (DFG):
9001 * dfg/DFGOSRExit.cpp:
9002 (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
9003 * dfg/DFGPredictionPropagationPhase.cpp:
9004 (JSC::DFG::PredictionPropagationPhase::propagate):
9005 * dfg/DFGSpeculativeJIT32_64.cpp:
9006 (JSC::DFG::SpeculativeJIT::compile):
9007 * dfg/DFGSpeculativeJIT64.cpp:
9008 (JSC::DFG::SpeculativeJIT::compile):
9009
fpizlo@apple.com5e3852d2012-05-24 00:05:21 +000090102012-05-13 Filip Pizlo <fpizlo@apple.com>
9011
9012 DFG should be able to optimize foo.apply(bar, arguments)
9013 https://bugs.webkit.org/show_bug.cgi?id=86306
9014
9015 Reviewed by Gavin Barraclough.
9016
9017 Merge r116912 from dfgopt.
9018
9019 Enables compilation of op_jneq_ptr and some forms of op_call_varargs.
9020
9021 Also includes a bunch of bug fixes that were made necessary by the increased
9022 pressure on the CFG simplifier.
9023
9024 This is a 1-2% win on V8.
9025
9026 * bytecode/CodeBlock.cpp:
9027 (JSC::CodeBlock::printCallOp):
9028 (JSC::CodeBlock::CodeBlock):
9029 (JSC::ProgramCodeBlock::canCompileWithDFGInternal):
9030 (JSC::EvalCodeBlock::canCompileWithDFGInternal):
9031 (JSC::FunctionCodeBlock::canCompileWithDFGInternal):
9032 * bytecode/CodeBlock.h:
9033 (CodeBlock):
9034 (JSC::CodeBlock::canCompileWithDFG):
9035 (JSC::CodeBlock::canCompileWithDFGState):
9036 (ProgramCodeBlock):
9037 (EvalCodeBlock):
9038 (FunctionCodeBlock):
9039 * dfg/DFGAbstractState.cpp:
9040 (JSC::DFG::AbstractState::execute):
9041 * dfg/DFGByteCodeParser.cpp:
9042 (JSC::DFG::ByteCodeParser::parseBlock):
9043 (JSC::DFG::ByteCodeParser::processPhiStack):
9044 (JSC::DFG::ByteCodeParser::parse):
9045 * dfg/DFGCFGSimplificationPhase.cpp:
9046 (JSC::DFG::CFGSimplificationPhase::run):
9047 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
9048 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
9049 (JSC::DFG::CFGSimplificationPhase::mergeBlocks):
9050 * dfg/DFGCSEPhase.cpp:
9051 (JSC::DFG::CSEPhase::getLocalLoadElimination):
9052 (CSEPhase):
9053 (JSC::DFG::CSEPhase::setReplacement):
9054 (JSC::DFG::CSEPhase::performNodeCSE):
9055 * dfg/DFGCapabilities.cpp:
9056 (JSC::DFG::debugFail):
9057 (DFG):
9058 (JSC::DFG::canHandleOpcodes):
9059 (JSC::DFG::canCompileOpcodes):
9060 (JSC::DFG::canInlineOpcodes):
9061 * dfg/DFGCapabilities.h:
9062 (JSC::DFG::canCompileOpcode):
9063 (JSC::DFG::canInlineOpcode):
9064 (DFG):
9065 (JSC::DFG::canCompileOpcodes):
9066 (JSC::DFG::canCompileEval):
9067 (JSC::DFG::canCompileProgram):
9068 (JSC::DFG::canCompileFunctionForCall):
9069 (JSC::DFG::canCompileFunctionForConstruct):
9070 * dfg/DFGCommon.h:
9071 * dfg/DFGGraph.cpp:
9072 (JSC::DFG::Graph::dump):
9073 * dfg/DFGNodeType.h:
9074 (DFG):
9075 * dfg/DFGPredictionPropagationPhase.cpp:
9076 (JSC::DFG::PredictionPropagationPhase::propagate):
9077 * dfg/DFGSpeculativeJIT32_64.cpp:
9078 (JSC::DFG::SpeculativeJIT::compile):
9079 * dfg/DFGSpeculativeJIT64.cpp:
9080 (JSC::DFG::SpeculativeJIT::emitCall):
9081 (JSC::DFG::SpeculativeJIT::compile):
9082 * dfg/DFGValidate.cpp:
9083 (Validate):
9084 (JSC::DFG::Validate::validate):
9085 (JSC::DFG::Validate::checkOperand):
9086 (JSC::DFG::Validate::reportValidationContext):
9087 * jit/JIT.cpp:
9088 (JSC::JIT::emitOptimizationCheck):
9089 (JSC::JIT::privateCompileSlowCases):
9090 (JSC::JIT::privateCompile):
9091 * jit/JIT.h:
9092 * jit/JITArithmetic.cpp:
9093 (JSC::JIT::compileBinaryArithOp):
9094 * jit/JITPropertyAccess.cpp:
9095 (JSC::JIT::privateCompilePutByIdTransition):
9096 * jit/JITPropertyAccess32_64.cpp:
9097 (JSC::JIT::privateCompilePutByIdTransition):
9098 * tools/CodeProfile.cpp:
9099 (JSC::CodeProfile::sample):
9100
ggaren@apple.com7070d422012-05-23 23:55:27 +000091012012-05-23 Geoffrey Garen <ggaren@apple.com>
9102
9103 Refactored WeakBlock to use malloc, clarify behavior
9104 https://bugs.webkit.org/show_bug.cgi?id=87318
9105
9106 Reviewed by Filip Pizlo.
9107
9108 We want to use malloc so we can make these smaller than 4KB,
9109 since an individual MarkedBlock will usually have fewer than
9110 4KB worth of weak pointers.
9111
9112 * heap/Heap.cpp:
9113 (JSC::Heap::markRoots): Renamed visitLiveWeakImpls to visit, since
9114 we no longer need to distinguish from "visitDeadWeakImpls".
9115
9116 Renamed "visitDeadWeakImpls" to "reap" because we're not actually
9117 doing any visiting -- we're just tagging things as dead.
9118
9119 * heap/WeakBlock.cpp:
9120 (JSC::WeakBlock::create):
9121 (JSC::WeakBlock::destroy):
9122 (JSC::WeakBlock::WeakBlock): Malloc!
9123
9124 (JSC::WeakBlock::visit):
9125 (JSC::WeakBlock::reap): Renamed as above.
9126
9127 * heap/WeakBlock.h:
9128 (WeakBlock): Reduced to 3KB, as explained above.
9129
9130 * heap/WeakSet.cpp:
9131 (JSC::WeakSet::visit):
9132 (JSC::WeakSet::reap):
9133 * heap/WeakSet.h:
9134 (WeakSet): Updated for renames, and to match WebKit style.
9135
fpizlo@apple.com11e2f372012-05-23 22:25:21 +000091362012-05-23 Filip Pizlo <fpizlo@apple.com>
9137
fpizlo@apple.combc96e8f2012-05-23 23:12:59 +00009138 Use after free in JSC::DFG::ByteCodeParser::processPhiStack
9139 https://bugs.webkit.org/show_bug.cgi?id=87312
9140 <rdar://problem/11518848>
9141
9142 Reviewed by Oliver Hunt.
9143
9144 * dfg/DFGByteCodeParser.cpp:
9145 (JSC::DFG::ByteCodeParser::processPhiStack):
9146 (JSC::DFG::ByteCodeParser::parse):
9147
91482012-05-23 Filip Pizlo <fpizlo@apple.com>
9149
fpizlo@apple.com11e2f372012-05-23 22:25:21 +00009150 It should be possible to make C function calls from DFG code on ARM in debug mode
9151 https://bugs.webkit.org/show_bug.cgi?id=87313
9152
9153 Reviewed by Gavin Barraclough.
9154
9155 * dfg/DFGSpeculativeJIT.h:
9156 (SpeculativeJIT):
9157
fpizlo@apple.comc6446112012-05-23 20:52:42 +000091582012-05-11 Filip Pizlo <fpizlo@apple.com>
9159
9160 DFG should be able to inline functions that use arguments reflectively
9161 https://bugs.webkit.org/show_bug.cgi?id=86132
9162
9163 Reviewed by Oliver Hunt.
9164
9165 Merged r116838 from dfgopt.
9166
9167 This turns on inlining of functions that use arguments reflectively, but it
9168 does not do any of the obvious optimizations that this exposes. I'll save that
9169 for another patch - the important thing for now is that this contains all of
9170 the plumbing necessary to make this kind of inlining sound even in bizarro
9171 cases like an inline callee escaping the arguments object to parts of the
9172 inline caller where the arguments are otherwise dead. Or even more fun cases
9173 like where you've inlined to an inline stack that is three-deep, and the
9174 function on top of the inline stack reflectively accesses the arguments of a
9175 function that is in the middle of the inline stack. Any subsequent
9176 optimizations that we do for the obvious cases of arguments usage in inline
9177 functions will have to take care not to break the baseline functionality that
9178 this patch plumbs together.
9179
9180 * bytecode/CodeBlock.cpp:
9181 (JSC::CodeBlock::printCallOp):
9182 (JSC::CodeBlock::dump):
9183 * bytecode/CodeBlock.h:
9184 * dfg/DFGAssemblyHelpers.h:
9185 (JSC::DFG::AssemblyHelpers::argumentsRegisterFor):
9186 (AssemblyHelpers):
9187 * dfg/DFGByteCodeParser.cpp:
9188 (InlineStackEntry):
9189 (JSC::DFG::ByteCodeParser::handleCall):
9190 (JSC::DFG::ByteCodeParser::handleInlining):
9191 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
9192 (JSC::DFG::ByteCodeParser::parse):
9193 * dfg/DFGCCallHelpers.h:
9194 (JSC::DFG::CCallHelpers::setupArgumentsWithExecState):
9195 (CCallHelpers):
9196 * dfg/DFGCapabilities.h:
9197 (JSC::DFG::canInlineOpcode):
9198 * dfg/DFGDriver.cpp:
9199 (JSC::DFG::compile):
9200 * dfg/DFGFixupPhase.cpp:
9201 (JSC::DFG::FixupPhase::fixupNode):
9202 * dfg/DFGOperations.cpp:
9203 * dfg/DFGOperations.h:
9204 * dfg/DFGSpeculativeJIT.h:
9205 (JSC::DFG::SpeculativeJIT::callOperation):
9206 * dfg/DFGSpeculativeJIT32_64.cpp:
9207 (JSC::DFG::SpeculativeJIT::compile):
9208 * dfg/DFGSpeculativeJIT64.cpp:
9209 (JSC::DFG::SpeculativeJIT::compile):
9210 * interpreter/CallFrame.cpp:
9211 (JSC):
9212 (JSC::CallFrame::someCodeBlockForPossiblyInlinedCode):
9213 * interpreter/CallFrame.h:
9214 (ExecState):
9215 (JSC::ExecState::someCodeBlockForPossiblyInlinedCode):
9216 * interpreter/Interpreter.cpp:
9217 (JSC::Interpreter::retrieveArgumentsFromVMCode):
9218 * runtime/Arguments.cpp:
9219 (JSC::Arguments::tearOff):
9220 (JSC):
9221 (JSC::Arguments::tearOffForInlineCallFrame):
9222 * runtime/Arguments.h:
9223 (Arguments):
9224 (JSC::Arguments::create):
9225 (JSC::Arguments::finishCreation):
9226 (JSC):
9227
fpizlo@apple.comfe244b02012-05-23 20:51:21 +000092282012-05-23 Filip Pizlo <fpizlo@apple.com>
9229
9230 Every OSR exit on ARM results in a crash
9231 https://bugs.webkit.org/show_bug.cgi?id=87307
9232
9233 Reviewed by Geoffrey Garen.
9234
9235 * dfg/DFGThunks.cpp:
9236 (JSC::DFG::osrExitGenerationThunkGenerator):
9237
ggaren@apple.com96fa0e72012-05-23 20:47:46 +000092382012-05-23 Geoffrey Garen <ggaren@apple.com>
9239
9240 Refactored heap tear-down to use normal value semantics (i.e., destructors)
9241 https://bugs.webkit.org/show_bug.cgi?id=87302
9242
9243 Reviewed by Oliver Hunt.
9244
9245 This is a step toward incremental DOM finalization.
9246
9247 * heap/CopiedSpace.cpp:
9248 (JSC::CopiedSpace::~CopiedSpace):
9249 * heap/CopiedSpace.h:
9250 (CopiedSpace): Just use our destructor, instead of relying on the heap
9251 to send us a special message at a special time.
9252
9253 * heap/Heap.cpp:
9254 (JSC::Heap::Heap): Use OwnPtr for m_markListSet because this is not Sparta.
9255
9256 (JSC::Heap::~Heap): No need for delete or freeAllBlocks because normal
9257 destructors do this work automatically now.
9258
9259 (JSC::Heap::lastChanceToFinalize): Just call lastChanceToFinalize on our
9260 sub-objects, and assume it does the right thing. This improves encapsulation,
9261 so we can add items requiring finalization to our sub-objects.
9262
9263 * heap/Heap.h: Moved m_blockAllocator to get the right destruction order.
9264
9265 * heap/MarkedSpace.cpp:
9266 (Take):
9267 (JSC):
9268 (JSC::Take::Take):
9269 (JSC::Take::operator()):
9270 (JSC::Take::returnValue): Moved to the top of the file so it can be used
9271 in another function.
9272
9273 (JSC::MarkedSpace::~MarkedSpace): Delete all outstanding memory, like a good
9274 destructor should.
9275
9276 (JSC::MarkedSpace::lastChanceToFinalize): Moved some code here from the heap,
9277 since it pertains to our internal implementation details.
9278
9279 * heap/MarkedSpace.h:
9280 (MarkedSpace):
9281 * heap/WeakBlock.cpp:
9282 (JSC::WeakBlock::lastChanceToFinalize):
9283 * heap/WeakBlock.h:
9284 (WeakBlock):
9285 * heap/WeakSet.cpp:
9286 (JSC::WeakSet::lastChanceToFinalize):
9287 * heap/WeakSet.h:
9288 (WeakSet): Stop using a special freeAllBlocks() callback and just implement
9289 lastChanceToFinalize.
9290
ggaren@apple.comd6376d22012-05-23 18:29:55 +000092912011-05-22 Geoffrey Garen <ggaren@apple.com>
9292
9293 Encapsulated some calculations for whether portions of the heap are empty
9294 https://bugs.webkit.org/show_bug.cgi?id=87210
9295
9296 Reviewed by Gavin Barraclough.
9297
9298 This is a step toward incremental DOM finalization.
9299
9300 * heap/Heap.cpp:
9301 (JSC::Heap::~Heap): Explicitly call freeAllBlocks() instead of relying
9302 implicitly on all blocks thinking they're empty. In future, we may
9303 choose to tear down the heap without first setting all data structures
9304 to "empty".
9305
9306 * heap/MarkedBlock.h:
9307 (JSC::MarkedBlock::isEmpty):
9308 (JSC::MarkedBlock::gatherDirtyCells): Renamed markCountIsZero to isEmpty,
9309 in preparation for making it check for outstanding finalizers in addition
9310 to marked cells.
9311
9312 * heap/MarkedSpace.cpp:
9313 (Take):
9314 (JSC::Take::Take):
9315 (JSC::Take::operator()):
9316 (JSC::Take::returnValue):
9317 (JSC::MarkedSpace::shrink):
9318 (JSC::MarkedSpace::freeAllBlocks): Refactored the "Take" functor to support
9319 a conditional isEmpty check, so it dould be shared by shrink() and freeAllBlocks().
9320
9321 * heap/WeakBlock.cpp:
9322 (JSC::WeakBlock::WeakBlock):
9323 (JSC::WeakBlock::visitLiveWeakImpls):
9324 (JSC::WeakBlock::visitDeadWeakImpls):
9325 * heap/WeakBlock.h:
9326 (WeakBlock):
9327 (JSC::WeakBlock::isEmpty):
9328 * heap/WeakSet.cpp:
9329 (JSC::WeakSet::sweep):
9330 (JSC::WeakSet::shrink): Use isEmpty(), in preparation for changes in
9331 its implementation.
9332
vestbo@webkit.orgb1f6e922012-05-23 10:50:53 +000093332012-05-23 Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
9334
9335 [Qt] Remove references to $$QT_SOURCE_TREE
9336
9337 With a modularized Qt, it's ambigious. What we really want is qtbase,
9338 which qtcore is a proxy for (we assume it will always live in qtbase).
9339
9340 Reviewed by Tor Arne Vestbø.
9341
9342 * JavaScriptCore.pri:
9343 * Target.pri:
9344
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +000093452012-05-09 Filip Pizlo <fpizlo@apple.com>
9346
9347 DFG should allow inlining in case of certain arity mismatches
9348 https://bugs.webkit.org/show_bug.cgi?id=86059
9349
9350 Reviewed by Geoff Garen.
fpizlo@apple.comb92907c2012-05-23 07:55:12 +00009351
9352 Merge r116620 from dfgopt.
fpizlo@apple.comb6b454cd2012-05-23 07:53:44 +00009353
9354 * dfg/DFGByteCodeParser.cpp:
9355 (JSC::DFG::ByteCodeParser::handleInlining):
9356
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +000093572012-05-08 Filip Pizlo <fpizlo@apple.com>
9358
fpizlo@apple.com1688cc12012-05-23 07:29:02 +00009359 DFG variable capture analysis should work even if the variables arose through inlining
9360 https://bugs.webkit.org/show_bug.cgi?id=85945
9361
9362 Reviewed by Oliver Hunt.
9363
9364 Merged r116555 from dfgopt.
9365
9366 This just changes how the DFG queries whether a variable is captured. It does not
9367 change any user-visible behavior.
9368
9369 As part of this change, I further solidified the policy that the CFA behaves in an
9370 undefined way for captured locals and queries about their values will not yield
9371 reliable results. This will likely be changed in the future, but for now it makes
9372 sense.
9373
9374 One fun part about this change is that it recognizes that the same variable may
9375 be both captured and not, at the same time, because their live interval spans
9376 inlining boundaries. This only happens in the case of arguments to functions that
9377 capture their arguments, and this change treats them with just the right touch of
9378 conservatism: they will be treated as if captured by the caller as well as the
9379 callee.
9380
9381 Finally, this also adds captured variable reasoning to the InlineCallFrame, which
9382 I thought might be useful for later tooling.
9383
9384 This is perf-neutral, since it does it does not make the DFG take advantage of this
9385 new functionality in any way. In particular, it is still the case that the DFG will
9386 not inline functions that use arguments reflectively or that create activations.
9387
9388 * bytecode/CodeBlock.h:
9389 (CodeBlock):
9390 (JSC::CodeBlock::needsActivation):
9391 (JSC::CodeBlock::argumentIsCaptured):
9392 (JSC::CodeBlock::localIsCaptured):
9393 (JSC::CodeBlock::isCaptured):
9394 * bytecode/CodeOrigin.h:
9395 (InlineCallFrame):
9396 * dfg/DFGAbstractState.cpp:
9397 (JSC::DFG::AbstractState::initialize):
9398 (JSC::DFG::AbstractState::endBasicBlock):
9399 (JSC::DFG::AbstractState::execute):
9400 (JSC::DFG::AbstractState::merge):
9401 * dfg/DFGByteCodeParser.cpp:
9402 (JSC::DFG::ByteCodeParser::newVariableAccessData):
9403 (JSC::DFG::ByteCodeParser::getLocal):
9404 (JSC::DFG::ByteCodeParser::setLocal):
9405 (JSC::DFG::ByteCodeParser::getArgument):
9406 (JSC::DFG::ByteCodeParser::setArgument):
9407 (JSC::DFG::ByteCodeParser::flushArgument):
9408 (JSC::DFG::ByteCodeParser::parseBlock):
9409 (JSC::DFG::ByteCodeParser::processPhiStack):
9410 (JSC::DFG::ByteCodeParser::fixVariableAccessPredictions):
9411 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
9412 * dfg/DFGCFGSimplificationPhase.cpp:
9413 (CFGSimplificationPhase):
9414 (JSC::DFG::CFGSimplificationPhase::keepOperandAlive):
9415 (JSC::DFG::CFGSimplificationPhase::fixPossibleGetLocal):
9416 (JSC::DFG::CFGSimplificationPhase::fixTailOperand):
9417 * dfg/DFGCommon.h:
9418 * dfg/DFGFixupPhase.cpp:
9419 (JSC::DFG::FixupPhase::fixupNode):
9420 * dfg/DFGGraph.cpp:
9421 (JSC::DFG::Graph::nameOfVariableAccessData):
9422 * dfg/DFGGraph.h:
9423 (JSC::DFG::Graph::needsActivation):
9424 (JSC::DFG::Graph::usesArguments):
9425 * dfg/DFGPredictionPropagationPhase.cpp:
9426 (JSC::DFG::PredictionPropagationPhase::doRoundOfDoubleVoting):
9427 * dfg/DFGSpeculativeJIT.cpp:
9428 (JSC::DFG::SpeculativeJIT::compile):
9429 * dfg/DFGSpeculativeJIT32_64.cpp:
9430 (JSC::DFG::SpeculativeJIT::compile):
9431 * dfg/DFGSpeculativeJIT64.cpp:
9432 (JSC::DFG::SpeculativeJIT::compile):
9433 * dfg/DFGVariableAccessData.h:
9434 (JSC::DFG::VariableAccessData::VariableAccessData):
9435 (JSC::DFG::VariableAccessData::mergeIsCaptured):
9436 (VariableAccessData):
9437 (JSC::DFG::VariableAccessData::isCaptured):
9438
94392012-05-08 Filip Pizlo <fpizlo@apple.com>
9440
fpizlo@apple.com6d4456e2012-05-23 03:48:52 +00009441 DFG should support op_get_argument_by_val and op_get_arguments_length
9442 https://bugs.webkit.org/show_bug.cgi?id=85911
9443
9444 Reviewed by Oliver Hunt.
9445
9446 Merged r116467 from dfgopt.
9447
9448 This adds a simple and relatively conservative implementation of op_get_argument_by_val
9449 and op_get_arguments_length. We can optimize these later. For now it's great to have
9450 the additional coverage.
9451
9452 This patch appears to be perf-neutral.
9453
9454 * dfg/DFGAbstractState.cpp:
9455 (JSC::DFG::AbstractState::execute):
9456 * dfg/DFGAssemblyHelpers.h:
9457 (JSC::DFG::AssemblyHelpers::addressFor):
9458 (JSC::DFG::AssemblyHelpers::tagFor):
9459 (JSC::DFG::AssemblyHelpers::payloadFor):
9460 * dfg/DFGByteCodeParser.cpp:
9461 (JSC::DFG::ByteCodeParser::parseBlock):
9462 * dfg/DFGCapabilities.h:
9463 (JSC::DFG::canCompileOpcode):
9464 (JSC::DFG::canInlineOpcode):
9465 * dfg/DFGNode.h:
9466 (JSC::DFG::Node::hasHeapPrediction):
9467 * dfg/DFGNodeType.h:
9468 (DFG):
9469 * dfg/DFGOperations.cpp:
9470 * dfg/DFGOperations.h:
9471 * dfg/DFGPredictionPropagationPhase.cpp:
9472 (JSC::DFG::PredictionPropagationPhase::propagate):
9473 * dfg/DFGSpeculativeJIT.h:
9474 (JSC::DFG::SpeculativeJIT::callOperation):
9475 (SpeculativeJIT):
9476 * dfg/DFGSpeculativeJIT32_64.cpp:
9477 (JSC::DFG::SpeculativeJIT::compile):
9478 * dfg/DFGSpeculativeJIT64.cpp:
9479 (JSC::DFG::SpeculativeJIT::compile):
9480 * jit/JITOpcodes.cpp:
9481 (JSC::JIT::emit_op_get_argument_by_val):
9482 * jit/JITOpcodes32_64.cpp:
9483 (JSC::JIT::emit_op_get_argument_by_val):
9484 * llint/LowLevelInterpreter32_64.asm:
9485 * llint/LowLevelInterpreter64.asm:
9486
fpizlo@apple.com15c03c72012-05-23 02:34:13 +000094872012-05-07 Filip Pizlo <fpizlo@apple.com>
9488
9489 DFG should support op_tear_off_arguments
9490 https://bugs.webkit.org/show_bug.cgi?id=85847
9491
9492 Reviewed by Michael Saboff.
9493
9494 Merged r116378 from dfgopt.
9495
9496 * dfg/DFGAbstractState.cpp:
9497 (JSC::DFG::AbstractState::execute):
9498 * dfg/DFGByteCodeParser.cpp:
9499 (JSC::DFG::ByteCodeParser::parseBlock):
9500 * dfg/DFGCapabilities.h:
9501 (JSC::DFG::canCompileOpcode):
9502 (JSC::DFG::canInlineOpcode):
9503 * dfg/DFGNodeType.h:
9504 (DFG):
9505 * dfg/DFGOperations.cpp:
9506 * dfg/DFGOperations.h:
9507 * dfg/DFGPredictionPropagationPhase.cpp:
9508 (JSC::DFG::PredictionPropagationPhase::propagate):
9509 * dfg/DFGSpeculativeJIT.h:
9510 (SpeculativeJIT):
9511 (JSC::DFG::SpeculativeJIT::callOperation):
9512 * dfg/DFGSpeculativeJIT32_64.cpp:
9513 (JSC::DFG::SpeculativeJIT::compile):
9514 * dfg/DFGSpeculativeJIT64.cpp:
9515 (JSC::DFG::SpeculativeJIT::compile):
9516
mhahnenberg@apple.com3041bc12012-05-23 01:28:03 +000095172012-05-22 Mark Hahnenberg <mhahnenberg@apple.com>
9518
9519 CopiedSpace::contains doesn't check for oversize blocks
9520 https://bugs.webkit.org/show_bug.cgi?id=87180
9521
9522 Reviewed by Geoffrey Garen.
9523
9524 When doing a conservative scan we use CopiedSpace::contains to determine if a particular
9525 address points into the CopiedSpace. Currently contains() only checks if the address
9526 points to a block in to-space, which means that pointers to oversize blocks may not get scanned.
9527
9528 * heap/CopiedSpace.cpp:
9529 (JSC::CopiedSpace::tryAllocateOversize):
9530 (JSC::CopiedSpace::tryReallocateOversize):
9531 (JSC::CopiedSpace::doneFillingBlock):
9532 (JSC::CopiedSpace::doneCopying):
9533 * heap/CopiedSpace.h: Refactored CopiedSpace so that all blocks (oversize and to-space) are
9534 in a single hash set and bloom filter for membership testing.
9535 (CopiedSpace):
9536 * heap/CopiedSpaceInlineMethods.h:
9537 (JSC::CopiedSpace::contains): We check for the normal block first. Since the oversize blocks are
9538 only page aligned, rather than block aligned, we have to re-mask the ptr to check if it's in
9539 CopiedSpace. Also added a helper function of the same name that takes a CopiedBlock* and checks
9540 if it's in CopiedSpace so that check isn't typed out twice.
9541 (JSC):
9542 (JSC::CopiedSpace::startedCopying):
9543 (JSC::CopiedSpace::addNewBlock):
9544
ggaren@apple.coma68a6502012-05-22 23:59:51 +000095452012-05-22 Geoffrey Garen <ggaren@apple.com>
9546
9547 CopiedBlock and MarkedBlock should have proper value semantics (i.e., destructors)
9548 https://bugs.webkit.org/show_bug.cgi?id=87172
9549
9550 Reviewed by Oliver Hunt and Phil Pizlo.
9551
9552 This enables MarkedBlock to own non-trivial sub-objects that require
9553 destruction. It also fixes a FIXME about casting a CopiedBlock to a
9554 MarkedBlock at destroy time.
9555
9556 CopiedBlock and MarkedBlock now accept an allocation chunk at create
9557 time and return it at destroy time. Their client is expected to
9558 allocate, recycle, and destroy these chunks.
9559
9560 * heap/BlockAllocator.cpp:
9561 (JSC::BlockAllocator::releaseFreeBlocks):
9562 (JSC::BlockAllocator::blockFreeingThreadMain): Don't call MarkedBlock::destroy
9563 because we expect that to be called before a block is put on our free
9564 list now. Do manually deallocate our allocation chunk because that's
9565 our job now.
9566
9567 * heap/BlockAllocator.h:
9568 (BlockAllocator):
9569 (JSC::BlockAllocator::allocate): Allocate never fails now. This is a
9570 cleaner abstraction because only one object does all the VM allocation
9571 and deallocation. Caching is an implementation detail.
9572
9573 (JSC::BlockAllocator::deallocate): We take an allocation chunk argument
9574 instead of a block because we now expect the block to have been destroyed
9575 before we recycle its memory. For convenience, we still use the HeapBlock
9576 class as our linked list node. This is OK because HeapBlock is a POD type.
9577
9578 * heap/CopiedBlock.h:
9579 (CopiedBlock):
9580 (JSC::CopiedBlock::create):
9581 (JSC::CopiedBlock::destroy):
9582 (JSC::CopiedBlock::CopiedBlock): Added proper create and destroy functions,
9583 to match MarkedBlock.
9584
9585 * heap/CopiedSpace.cpp:
9586 (JSC::CopiedSpace::tryAllocateOversize):
9587 (JSC::CopiedSpace::tryReallocateOversize):
9588 (JSC::CopiedSpace::doneCopying):
9589 (JSC::CopiedSpace::getFreshBlock):
9590 (JSC::CopiedSpace::freeAllBlocks):
9591 * heap/CopiedSpaceInlineMethods.h:
9592 (JSC::CopiedSpace::recycleBlock): Make sure to call destroy before
9593 returning a block to the BlockAllocator. Otherwise, our destructors
9594 won't run. (If we get this wrong now, we'll get a compile error.)
9595
9596 * heap/HeapBlock.h:
9597 (JSC::HeapBlock::HeapBlock): const!
9598
9599 * heap/MarkedAllocator.cpp:
9600 (JSC::MarkedAllocator::allocateBlock): No need to distinguish between
9601 create and recycle -- MarkedBlock always accepts memory allocated by
9602 its client now.
9603
9604 * heap/MarkedBlock.cpp:
9605 (JSC::MarkedBlock::create): Don't allocate memory -- we assume that we're
9606 passed already-allocated memory, to clarify the responsibility for VM
9607 recycling.
9608
9609 (JSC::MarkedBlock::destroy): Do run our destructor before giving back
9610 our VM -- that is the whole point of this patch.
9611
9612 (JSC::MarkedBlock::MarkedBlock):
9613 * heap/MarkedBlock.h:
9614 (MarkedBlock):
9615 * heap/MarkedSpace.cpp: const!
9616
9617 (JSC::MarkedSpace::freeBlocks): Make sure to call destroy before
9618 returning a block to the BlockAllocator. Otherwise, our destructors
9619 won't run. (If we get this wrong now, we'll get a compile error.)
9620
simon.fraser@apple.com9bd2c702012-05-22 20:37:14 +00009621== Rolled over to ChangeLog-2012-05-22 ==