From: Apple Date: Fri, 21 Nov 2008 18:54:32 +0000 (+0000) Subject: JavaScriptCore-466.1.3.tar.gz X-Git-Tag: iphone-22^0 X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/commitdiff_plain/8537cb5c39a1e4bc9c6727383b9ac29b72019dfa JavaScriptCore-466.1.3.tar.gz --- diff --git a/bindings/make_testbindings b/bindings/make_testbindings old mode 100755 new mode 100644 diff --git a/kjs/JSLock.cpp b/kjs/JSLock.cpp index 4439c48..ce55df3 100644 --- a/kjs/JSLock.cpp +++ b/kjs/JSLock.cpp @@ -149,20 +149,19 @@ int JSLock::lockCount() extern "C" { #endif -int JSLockDropAllLocks(void) +static JSLock::DropAllLocks* sLockDropper = NULL; + +void JSLockDropAllLocks(void) { - KJS::JSLock::lock(); - int lockCount = KJS::JSLock::lockCount(); - for (int i = 0; i < lockCount; i++) - KJS::JSLock::unlock(); - return lockCount - 1; + ASSERT(sLockDropper == NULL); + sLockDropper = new JSLock::DropAllLocks(); } -void JSLockRecoverAllLocks(int lockCount) +void JSLockRecoverAllLocks(void) { - ASSERT(KJS::JSLock::lockCount() == 0); - for (int i = 0; i < lockCount; i++) - KJS::JSLock::lock(); + ASSERT(sLockDropper != NULL); + delete sLockDropper; + sLockDropper = NULL; } static pthread_t javaScriptCollectionThread = 0; diff --git a/kjs/JSLockC.h b/kjs/JSLockC.h index b3c181d..787698d 100644 --- a/kjs/JSLockC.h +++ b/kjs/JSLockC.h @@ -8,8 +8,8 @@ extern "C" { #endif -int JSLockDropAllLocks(void); -void JSLockRecoverAllLocks(int lockCount); +void JSLockDropAllLocks(void); +void JSLockRecoverAllLocks(void); void JSSetJavaScriptCollectionThread (pthread_t thread); pthread_t JSJavaScriptCollectionThread (void); diff --git a/kjs/create_hash_table b/kjs/create_hash_table old mode 100755 new mode 100644 diff --git a/kjs/lexer.cpp b/kjs/lexer.cpp index c4d327f..dd4fcc4 100644 --- a/kjs/lexer.cpp +++ b/kjs/lexer.cpp @@ -1,7 +1,7 @@ // -*- c-basic-offset: 2 -*- /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2006, 2007 Apple Inc. All Rights Reserved. + * Copyright (C) 2006, 2007, 2008 Apple Inc. All Rights Reserved. * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) * * This library is free software; you can redistribute it and/or @@ -96,38 +96,41 @@ Lexer::Lexer() void Lexer::setCode(int startingLineNumber, const KJS::UChar *c, unsigned int len) { - yylineno = 1 + startingLineNumber; - restrKeyword = false; - delimited = false; - eatNextIdentifier = false; - stackToken = -1; - lastToken = -1; - pos = 0; - code = c; - length = len; - skipLF = false; - skipCR = false; - error = false; - atLineStart = true; - - // read first characters - current = (length > 0) ? code[0].uc : -1; - next1 = (length > 1) ? code[1].uc : -1; - next2 = (length > 2) ? code[2].uc : -1; - next3 = (length > 3) ? code[3].uc : -1; + yylineno = 1 + startingLineNumber; + restrKeyword = false; + delimited = false; + eatNextIdentifier = false; + stackToken = -1; + lastToken = -1; + pos = 0; + code = c; + length = len; + skipLF = false; + skipCR = false; + error = false; + atLineStart = true; + + // read first characters + shift(4); } -void Lexer::shift(unsigned int p) +void Lexer::shift(unsigned p) { - // Here would be a good place to strip Cf characters, but that has caused compatibility problems: - // . - while (p--) { - pos++; - current = next1; - next1 = next2; - next2 = next3; - next3 = (pos + 3 < length) ? code[pos + 3].uc : -1; - } + // ECMA-262 calls for stripping Cf characters here, but we only do this for BOM, + // see . + + while (p--) { + current = next1; + next1 = next2; + next2 = next3; + do { + if (pos >= length) { + next3 = -1; + break; + } + next3 = code[pos++].uc; + } while (next3 == 0xFEFF); + } } // called on each new line diff --git a/make-generated-sources.sh b/make-generated-sources.sh old mode 100755 new mode 100644 diff --git a/pcre/dftables b/pcre/dftables old mode 100755 new mode 100644 diff --git a/wtf/FastMalloc.cpp b/wtf/FastMalloc.cpp index b44035c..f5f54f5 100644 --- a/wtf/FastMalloc.cpp +++ b/wtf/FastMalloc.cpp @@ -1338,9 +1338,7 @@ void TCMalloc_PageHeap::IncrementalScavenge(Length n) { scavenge_counter_ -= n; if (scavenge_counter_ >= 0) return; // Not yet time to scavenge - // If there is nothing to release, wait for so many pages before - // scavenging again. With 4K pages, this comes to 16MB of memory. - static const size_t kDefaultReleaseDelay = 1 << 8; + static const size_t kDefaultReleaseDelay = 64; // Find index of free list to scavenge size_t index = scavenge_index_ + 1; @@ -1355,7 +1353,7 @@ void TCMalloc_PageHeap::IncrementalScavenge(Length n) { static_cast(s->length << kPageShift)); DLL_Prepend(&slist->returned, s); - scavenge_counter_ = std::max(64UL, std::min(kDefaultReleaseDelay, kDefaultReleaseDelay - (free_pages_ / kDefaultReleaseDelay))); + scavenge_counter_ = std::max(16UL, std::min(kDefaultReleaseDelay, kDefaultReleaseDelay - (free_pages_ / kDefaultReleaseDelay))); if (index == kMaxPages && !DLL_IsEmpty(&slist->normal)) scavenge_index_ = index - 1; diff --git a/wtf/OwnPtrWin.cpp b/wtf/OwnPtrWin.cpp old mode 100755 new mode 100644