2010-12-22 Laszlo Gombos Unreviewed build fix. [Symbian] Make sure OSAllocatorSymbian builds This patch only addresses the build problem. https://bugs.webkit.org/show_bug.cgi?id=51128 tracks the full (re)implementation of the Symbian allocator. * wtf/OSAllocatorSymbian.cpp: (WTF::OSAllocator::reserveUncommitted): (WTF::OSAllocator::reserveAndCommit): (WTF::OSAllocator::commit): 2010-12-22 Dan Bernstein Changed WebKitTools to Tools. * JavaScriptCore.vcproj/JavaScriptCore.sln: 2010-12-22 Dan Bernstein Rubber-stamped by Mark Rowe. Changed WebKitTools to Tools in script build phases. * JavaScriptCore.xcodeproj/project.pbxproj: 2010-12-22 Andrei Popescu Unreviewed build fix. Fix Chromium Linux shared library build. [Chromium] r74431 broke the Chromium Linux shared library build https://bugs.webkit.org/show_bug.cgi?id=51462 * JavaScriptCore.gyp/JavaScriptCore.gyp: * JavaScriptCore.gypi: 2010-12-21 Sheriff Bot Unreviewed, rolling out r74462. http://trac.webkit.org/changeset/74462 https://bugs.webkit.org/show_bug.cgi?id=51449 broke chromium win (Requested by tonyg-cr on #webkit). * JavaScriptCore.gypi: 2010-12-21 Tony Gentilcore Unreviewed build fix. [chromium] Build fix after r74431 https://bugs.webkit.org/show_bug.cgi?id=51447 * JavaScriptCore.gypi: 2010-12-21 Gavin Barraclough Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-12-21 Gavin Barraclough Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-12-21 Gavin Barraclough Speculative build fix. * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::underMemoryPressure): 2010-12-21 Gavin Barraclough Reviewed by Oliver Hunt. Bug 26276 - Need a mechanism to determine stack extent This patch adds accurate stack size calculation for: DARWIN, QNX, UNIX We still need to fix: WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE * wtf/StackBounds.cpp: (WTF::StackBounds::initialize): 2010-12-21 Gavin Barraclough Reviewed by Geoff Garen. CRASH running out of executable memory, loading io9.com https://bugs.webkit.org/show_bug.cgi?id=51443 The problem here is that each page uses a reasonable amount of memory, (~4Mb), and that when miultiple pages are open we keep all JIT code for all functions in all pages alive. Add a check to detect high memory pressure situations in the executable allocator (>50% of available memory allocated), and upon a top level entry into JSC (no code running on the stack) in this situation throw away all JIT code. * JavaScriptCore.exp: * debugger/Debugger.cpp: (JSC::Debugger::recompileAllJSFunctions): stop passing exec to recompile. * jit/ExecutableAllocator.h: * jit/ExecutableAllocatorFixedVMPool.cpp: (JSC::ExecutablePool::systemAlloc): Count allocations. (JSC::ExecutablePool::systemRelease): Count deallocations. (JSC::ExecutablePool::underMemoryPressure): Check memory pressure. * jit/ExecutableAllocatorPosix.cpp: (JSC::ExecutablePool::underMemoryPressure): Stub out; only meaningful with FixedVMPool. * jit/ExecutableAllocatorWin.cpp: (JSC::ExecutablePool::underMemoryPressure): Stub out; only meaningful with FixedVMPool. * runtime/Executable.cpp: (JSC::FunctionExecutable::recompile): Remove ExecState argument to recompile. * runtime/Executable.h: * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::recompileAllJSFunctions): throws away all JIT code. * runtime/JSGlobalData.h: * runtime/JSGlobalObject.h: (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): add check / call to throw away. 2010-12-21 Gavin Barraclough Reviewed by Geoff Garen. JIT executable memory excessive usage due to regex caching https://bugs.webkit.org/show_bug.cgi?id=51434 Reduce the amount of memory the RegExpCache can hold on to on iOS. Currently the RegExpCache can hold 256 RegExp objects. If each falls into a separate ExecutablePool, with a common size of 16Kb, this means we end up holding onto 4Mb of memory. Firstly, we can reduce this by simply reducing the size of the cache to 32 entries. Secondly, we can use a separate set of ExecutablePools for JIT code generated from RegExp objects. This helps in two ways (1) it increases the probability that RegExps in the cache share the same pool, and (2) it means that a RegExp can't end up holding on to a large ExecutablePool containing a translation of JS code. (A RegExp could end up keeping a larger RegExp alive that happened to be sharing the same pool, but large RegExp patterns are less common). * runtime/JSGlobalData.h: * runtime/RegExpCache.h: * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::compile): 2010-12-21 Gavin Barraclough Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 2010-12-21 Gavin Barraclough Eeeep! build fix! * wtf/OSAllocator.h: (WTF::OSAllocator::decommitAndRelease): 2010-12-21 Gavin Barraclough Ooops, fixed typo in comment. * wtf/OSAllocator.h: 2010-12-21 Geoffrey Garen Reviewed by Gavin Barraclough & Oliver Hunt. Added PageAllocationAligned, a cross-platform abstraction for memory allocations with arbitrary alignment requirements https://bugs.webkit.org/show_bug.cgi?id=51359 I think this patch fixes [5.0.1] WER crash in Heap::allocateBlock (1902752929), and some other leaks and crashes as well. * Android.mk: * CMakeLists.txt: * GNUmakefile.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: Updated build files. * runtime/AlignedMemoryAllocator.h: Removed. Supplanted by PageAllocationAligned. * runtime/Collector.cpp: (JSC::Heap::destroy): (JSC::Heap::allocateBlock): (JSC::Heap::freeBlock): (JSC::Heap::addWeakGCHandle): * runtime/Collector.h: Switched from AlignedMemoryAllocator to PageAllocationAligned. * runtime/GCHandle.cpp: * runtime/GCHandle.h: Ditto. * wtf/PageAllocation.h: (WTF::PageAllocation::PageAllocation): Removed aligned memory allocation functions. Supplanted by PageAllocationAligned. * wtf/PageAllocationAligned.cpp: Added. (WTF::PageAllocationAligned::allocate): (WTF::PageAllocationAligned::deallocate): * wtf/PageAllocationAligned.h: Added. (WTF::PageAllocationAligned::PageAllocationAligned): New cross-platform class for doing aligned memory allocation. This class properly matches allocation and deallocation library calls, fixing a long-standing bug in PageAllocation. * wtf/Platform.h: Removed some defunction VM platform defines. * wtf/wtf.pri: Updated build files. 2010-12-21 Oliver Hunt Reviewed by Gavin Barraclough. ASSERTION FAILED: base->index() == m_codeBlock->argumentsRegister() while loading taobao.com https://bugs.webkit.org/show_bug.cgi?id=49006 This problem was caused by having a parameter named 'arguments'. The fix is to treat parameters named 'arguments' as shadowing the actual arguments property, and so logically turn the function into one that doesn't "use" arguments. This required a bit of fiddling in the parser to ensure we correctly propagate the 'feature' of shadowing is set correctly. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::createArgumentsIfNecessary): Change assertion to an early return as we may now reference a property named 'arguments' without being in a function that has the ArgumentsFeature * parser/JSParser.cpp: (JSC::JSParser::Scope::Scope): (JSC::JSParser::Scope::declareParameter): (JSC::JSParser::Scope::shadowsArguments): (JSC::JSParser::parseProgram): (JSC::JSParser::parseFormalParameters): (JSC::JSParser::parseFunctionInfo): * parser/Nodes.h: (JSC::ScopeNode::usesArguments): 2010-12-21 Daniel Bates Reviewed by Eric Seidel and Darin Adler. Deallocate GregorianDateTime.timeZone (if allocated) when copying so that we don't leak memory. https://bugs.webkit.org/show_bug.cgi?id=51367 Inspired by a patch by George Staikos. * wtf/DateMath.cpp: (JSC::msToGregorianDateTime): Modified to set timeZone to nullptr since timeZone is now of type OwnPtrArray. * wtf/DateMath.h: Change timeZone to type OwnArrayPtr; Removed destructor since it is no longer needed. (JSC::GregorianDateTime::GregorianDateTime): Modified to use OwnPtrArray semantics for timeZone. (JSC::GregorianDateTime::operator tm): Ditto. (JSC::GregorianDateTime::copyFrom): Ditto. 2010-12-21 Sheriff Bot Unreviewed, rolling out r74402. http://trac.webkit.org/changeset/74402 https://bugs.webkit.org/show_bug.cgi?id=51402 This patch broke the Windows 7 Release Layout Tests (Requested by jessieberlin on #webkit). * wtf/StackBounds.cpp: (WTF::estimateStackBound): (WTF::StackBounds::initialize): 2010-12-21 Peter Varga Reviewed by Csaba Osztrogonác. Unify the name of parentheses in YARR: rename parenthesis to parentheses. * yarr/RegexCompiler.cpp: (JSC::Yarr::RegexPatternConstructor::atomParenthesesEnd): 2010-12-21 Laszlo Gombos Reviewed by Andreas Kling. [Qt] Set BUILDING_QT__ consistently https://bugs.webkit.org/show_bug.cgi?id=51341 * JavaScriptCore.pri: Remove the definition of BUILDING_QT__ as it is already defined in WebKit.pri. 2010-12-20 Gavin Barraclough Reviewed by Oliver Hunt. Bug 26276 - Need a mechanism to determine stack extent This patch adds accurate stack size calculation for: DARWIN, WINDOWS, QNX, UNIX We still need to fix: SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE * wtf/StackBounds.cpp: (WTF::StackBounds::initialize): 2010-12-20 Gavin Barraclough PPC build fix; stop using std::swap on PageAllocation/PageReservation, this was failing on some compilers since the lack of default construction for the m_executable/m_writable fields meant the value being swapped may not have been fully initialized. * wtf/PageAllocation.h: (WTF::PageAllocation::deallocate): * wtf/PageBlock.h: * wtf/PageReservation.h: (WTF::PageReservation::deallocate): 2010-12-20 Oliver Hunt Reviewed by Geoffrey Garen. |delete name| in strict mode code should be an early error https://bugs.webkit.org/show_bug.cgi?id=50431 Disallow the |delete IDENTIFIER| production in strict mode, and removed a bunch of now unnecessary code. * parser/JSParser.cpp: (JSC::JSParser::Scope::collectFreeVariables): (JSC::jsParse): (JSC::JSParser::parseProgram): (JSC::JSParser::parseUnaryExpression): * parser/JSParser.h: * parser/Parser.cpp: (JSC::Parser::parse): * parser/Parser.h: (JSC::Parser::parse): 2010-12-20 Gavin Barraclough Reviewed by Olver Hunt. Bug 51358 - Should check stack depth rather than using recursion limits in byte compilation The current implementation of recursion limit checking is not safe on smaller stacks. Switch to using a common mechanism, shared with the parser, to check recursion limits. Make bytecompiler use StackBounds. Empirical testing shows emitStrcat to have the largest footprint on the stack, at just under 1k on x86-64. Given this, the default recursion check (requiring 4k of available space to recurse) seems reasonable. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::emitNode): (JSC::BytecodeGenerator::emitNodeInConditionContext): * bytecompiler/NodesCodegen.cpp: (JSC::BinaryOpNode::emitStrcat): 2010-12-20 Tony Gentilcore Unreviewed build fix. Include pthread to fix chromium mac build (broken by r74360) https://bugs.webkit.org/show_bug.cgi?id=51356 * wtf/StackBounds.cpp: 2010-12-20 Xan Lopez Reviewed by Gustavo Noronha. * GNUmakefile.am: add missing files. 2010-12-18 Gavin Barraclough Reviewed by Oliver Hunt. Bug 26276 - Need a mechanism to determine stack extent This patch adds a class 'StackBounds', to hold information about the machine stack. The implementation of this class broadly adheres to the current implmentation of stack limit checking, and as such does not solve the problem of determining stack extent, but gives us a common place to do so. Currently two mechanism are provided to determine the stack origin (the point the stack is growing away from). currentThreadStackBase() in Collector provides a more accurate determination of the stack origin, so use this to calculate StackBounds::m_origin; WTFThreadData::approximatedStackStart is less accurate, and as such can be removed. Cache the StackBounds on WTFThreadData such that they need only be determined once per thread, and for non-API contexts cache this information in JSGlobalData, to save a thread-specific access. For the time being retain the estimate of stack size used by JSC's parser (128 * sizeof(void*) * 1024), with a view to replacing this with something more accurate in the near future. * parser/JSParser.cpp: (JSC::JSParser::canRecurse): (JSC::JSParser::JSParser): Change to use StackBounds. * runtime/Collector.cpp: (JSC::Heap::registerThread): (JSC::Heap::markCurrentThreadConservativelyInternal): Change to use StackBounds, cached on JSGlobalData. * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): * runtime/JSGlobalData.h: (JSC::JSGlobalData::stack): Add a cached copy of StackBounds. * wtf/StackBounds.cpp: Copied from JavaScriptCore/runtime/Collector.cpp. (WTF::estimateStackBound): (WTF::StackBounds::initialize): (WTF::getStackMax): Copy code from Collector.cpp to determine stack origin. * wtf/StackBounds.h: Added. (WTF::StackBounds::StackBounds): No argument constructor; returns a null StackBounds. (WTF::StackBounds::currentThreadStackBounds): Returns a StackBounds object representing the stack limits of the current thread. (WTF::StackBounds::origin): Returns to stack origin (the point the stack is growing away from; the highest extent of the stack on machines where the stack grows downwards. (WTF::StackBounds::recursionLimit): Returns a limit value that is 'a comfortable distance from the end of the stack'. Our concept of this is currently 1 page away from the end, however the default value may be tuned in the future, and clients may override passing a larger delta; should only be called on StackBounds object representing the stack of the thread this method is called on (checked by checkConsistency). (WTF::StackBounds::recursionCheck): Checks whether we are currently 'a comfortable distance from the end of the stack'. Our concept of this is currently 1 page away from the end, however the default value may be tuned in the future, and clients may override passing a larger delta to apply when checking, if they wish to do so. This method should only be called on StackBounds object representing the stack of the thread this method is called on (checked by checkConsistency). (WTF::StackBounds::current): Approximate current stack position. On machines where the stack is growing downwards this is the lowest address that might need conservative collection. (WTF::StackBounds::isGrowingDownward): True for all platforms other than WINCE, which has to check. (WTF::StackBounds::checkConsistency): This is called in methods that shoulds only be operating on a valid set of bounds; as such we expect m_origin != m_bounds (i.e. stack size != zero) - we're really testing that this object is not null (the constructor initializes both fields to zero). Also checks that current() is within the stack's bounds. * wtf/WTFThreadData.cpp: (WTF::WTFThreadData::WTFThreadData): * wtf/WTFThreadData.h: (WTF::WTFThreadData::stack): Add the StackBounds member variable. 2010-12-17 Geoffrey Garen Reviewed by Sam Weinig. Factored common page set management into a new PageBlock base class https://bugs.webkit.org/show_bug.cgi?id=51285 * Android.mk: * CMakeLists.txt: * GNUmakefile.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * interpreter/RegisterFile.h: (JSC::RegisterFile::RegisterFile): * jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::intializePageSize): * wtf/PageAllocation.cpp: Removed. * wtf/PageAllocation.h: (WTF::PageAllocation::deallocate): (WTF::PageAllocation::PageAllocation): * wtf/PageReservation.h: (WTF::PageReservation::commit): (WTF::PageReservation::decommit): (WTF::PageReservation::deallocate): (WTF::PageReservation::PageReservation): * wtf/wtf.pri: 2010-12-17 Michael Saboff Reviewed by Oliver Hunt. RegExp Jit'ed expression crashes clicking link on yelp.com https://bugs.webkit.org/show_bug.cgi?id=51284 When transitioning between an non-repeating beginning of line anchored expression and the remaining refactored repeating expression, we should not clear any residual datalabel in state's m_backtrack. It will be resolved and cleared in subsequent code when linkAlternativeBacktracks() is called for the repeating alternative(s). * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::BacktrackDestination::clear): (JSC::Yarr::RegexGenerator::TermGenerationState::clearBacktrack): 2010-12-17 Dan Bernstein Rubber-stamped by Mark Rowe. Updated for the renaming of WebKitTools to Tools * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: 2010-12-17 Ariya Hidayat Reviewed by Oliver Hunt. [JSC] parseAssignmentExpression should use TreeBuilder::CreatesAST https://bugs.webkit.org/show_bug.cgi?id=51268 * parser/JSParser.cpp: (JSC::JSParser::parseAssignmentExpression): 2010-12-17 Geoffrey Garen Reviewed by Oliver Hunt. Removed RChunk from PageAllocation/PageReservation, since it's now unused. https://bugs.webkit.org/show_bug.cgi?id=51276 * wtf/PageAllocation.h: (WTF::PageAllocation::PageAllocation): * wtf/PageReservation.h: (WTF::PageReservation::PageReservation): 2010-12-17 Oliver Hunt Reviewed by Gavin Barraclough. Incorrect encoding of some constants in ARMv7 JIT https://bugs.webkit.org/show_bug.cgi?id=51273 When using immediate encoding 3 we need to write the byte that holds a duplicated value. * assembler/ARMv7Assembler.h: (JSC::ARMThumbImmediate::makeEncodedImm): 2010-12-16 Evan Martin Reviewed by Darin Fisher. [chromium] useless warnings when building on Windows https://bugs.webkit.org/show_bug.cgi?id=50985 Disable some compiler warnings that aren't indicative of real problems. * JavaScriptCore.gyp/JavaScriptCore.gyp: 2010-12-16 Pratik Solanki Reviewed by Geoffrey Garen. https://bugs.webkit.org/show_bug.cgi?id=51166 ExecutableAllocator::cacheFlush should call sys_cache_control * jit/ExecutableAllocator.h: (JSC::ExecutableAllocator::cacheFlush): Use the more correct and forward looking API - sys_cache_control(kCacheFunctionPrepareForExecution,...). 2010-12-16 Ariya Hidayat Reviewed by Andreas Kling. [JSC] Const correctness in ASTBuilder and SyntaxChecker https://bugs.webkit.org/show_bug.cgi?id=51141 * parser/ASTBuilder.h: (JSC::ASTBuilder::getName): (JSC::ASTBuilder::getType): (JSC::ASTBuilder::isResolve): * parser/SyntaxChecker.h: (JSC::SyntaxChecker::operatorStackPop): 2010-12-15 Kenneth Russell Reviewed by James Robinson. Web Audio API: port FFTFrame to MKL https://bugs.webkit.org/show_bug.cgi?id=50986 Fixed bug in log2 emulation function provided for Windows port of Web Audio API. * wtf/MathExtras.h: (log2): 2010-12-14 Mark Rowe Reviewed by Sam Weinig. Reproducible crash inside WebCore::MediaPlayerPrivateQTKit::createQTMovie when loading