Commit 285b5e22 authored by ggaren@apple.com's avatar ggaren@apple.com

Removed bitrotted TimeoutChecker code

https://bugs.webkit.org/show_bug.cgi?id=114336

Reviewed by Alexey Proskuryakov.

../JavaScriptCore: 

This mechanism hasn't worked for a while.

MarkL is working on a new version of this feature with a distinct
implementation.

* API/APIShims.h:
(JSC::APIEntryShim::~APIEntryShim):
(JSC::APIEntryShim::init):
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* dfg/DFGGPRInfo.h:
* jit/JIT.cpp:
* jit/JIT.h:
* jit/JITStubs.cpp:
* jit/JITStubs.h:
* jit/JSInterfaceJIT.h:
(JSInterfaceJIT):
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
* runtime/JSGlobalData.h:
* runtime/JSGlobalObject.cpp:
* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue):
(JSC::Walker::walk):
* runtime/TimeoutChecker.cpp: Removed.
* runtime/TimeoutChecker.h: Removed.

../WebCore: 

This mechanism hasn't worked for a while.

MarkL is working on a new version of this feature with a distinct
implementation.

* bindings/js/JSCallbackData.cpp:
(WebCore::JSCallbackData::invokeCallback):
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::commonJSGlobalData):
* bindings/js/JSErrorHandler.cpp:
(WebCore::JSErrorHandler::handleEvent):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSMutationCallback.cpp:
(WebCore::JSMutationCallback::call):
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::executeFunctionInContext):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::evaluateInWorld):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneBase::CloneBase):
(WebCore::CloneSerializer::serialize):
(WebCore::CloneDeserializer::deserialize):
* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::evaluate):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject evaluateWebScript:]):

../WebKit/blackberry: 

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::setTimeoutForJavaScriptExecution):

../WebKit/mac: 

This mechanism hasn't worked for a while.

MarkL is working on a new version of this feature with a distinct
implementation.

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::evaluate):

../WebKit/qt: 

* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::createDocumentLoader):

../WebKit2: 

This mechanism hasn't worked for a while.

MarkL is working on a new version of this feature with a distinct
implementation.

* WebProcess/Plugins/Netscape/NPJSObject.cpp:
(WebKit::NPJSObject::construct):
(WebKit::NPJSObject::invoke):
* WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
(WebKit::NPRuntimeObjectMap::evaluate):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148119 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7fad2f8a
......@@ -92,7 +92,6 @@ public:
~APIEntryShim()
{
m_globalData->timeoutChecker.stop();
m_globalData->apiLock().unlock();
}
......@@ -100,7 +99,6 @@ private:
void init()
{
m_globalData->apiLock().lock();
m_globalData->timeoutChecker.start();
}
};
......
......@@ -304,7 +304,6 @@ set(JavaScriptCore_SOURCES
runtime/StructureRareData.cpp
runtime/StructureChain.cpp
runtime/SymbolTable.cpp
runtime/TimeoutChecker.cpp
tools/CodeProfile.cpp
tools/CodeProfiling.cpp
......
2013-04-09 Geoffrey Garen <ggaren@apple.com>
Removed bitrotted TimeoutChecker code
https://bugs.webkit.org/show_bug.cgi?id=114336
Reviewed by Alexey Proskuryakov.
This mechanism hasn't worked for a while.
MarkL is working on a new version of this feature with a distinct
implementation.
* API/APIShims.h:
(JSC::APIEntryShim::~APIEntryShim):
(JSC::APIEntryShim::init):
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreExports.def:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.vcxproj/JavaScriptCoreExportGenerator/JavaScriptCoreExports.def.in:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* dfg/DFGGPRInfo.h:
* jit/JIT.cpp:
* jit/JIT.h:
* jit/JITStubs.cpp:
* jit/JITStubs.h:
* jit/JSInterfaceJIT.h:
(JSInterfaceJIT):
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
* runtime/JSGlobalData.h:
* runtime/JSGlobalObject.cpp:
* runtime/JSONObject.cpp:
(JSC::Stringifier::appendStringifiedValue):
(JSC::Walker::walk):
* runtime/TimeoutChecker.cpp: Removed.
* runtime/TimeoutChecker.h: Removed.
2013-04-10 Oliver Hunt <oliver@apple.com>
REGRESSION (r148073): WebKit Nightly r148082 crashes on launch in JSObjectSetPrivate
......@@ -782,8 +782,6 @@ javascriptcore_sources += \
Source/JavaScriptCore/runtime/SymbolTable.cpp \
Source/JavaScriptCore/runtime/SymbolTable.h \
Source/JavaScriptCore/runtime/Terminator.h \
Source/JavaScriptCore/runtime/TimeoutChecker.cpp \
Source/JavaScriptCore/runtime/TimeoutChecker.h \
Source/JavaScriptCore/runtime/Tracing.h \
Source/JavaScriptCore/runtime/TypedArrayDescriptor.h \
Source/JavaScriptCore/runtime/Uint16WithFraction.h \
......
......@@ -1373,14 +1373,6 @@
RelativePath="..\..\runtime\Terminator.h"
>
</File>
<File
RelativePath="..\..\runtime\TimeoutChecker.cpp"
>
</File>
<File
RelativePath="..\..\runtime\TimeoutChecker.h"
>
</File>
<File
RelativePath="..\..\runtime\TypedArrayDescriptor.h"
>
......
......@@ -189,7 +189,6 @@ EXPORTS
?destroy@OutOfLineBits@BitVector@WTF@@SAXPAV123@@Z
?detach@Debugger@JSC@@UAEXPAVJSGlobalObject@2@@Z
?detachThread@WTF@@YAXI@Z
?didTimeOut@TimeoutChecker@JSC@@QAE_NPAVExecState@2@@Z
?discardAllCode@JSGlobalData@JSC@@QAEXXZ
?displayName@JSFunction@JSC@@QAE?AVString@WTF@@PAVExecState@2@@Z
?dtoa@WTF@@YAXQADNAA_NAAHAAI@Z
......@@ -346,7 +345,6 @@ EXPORTS
?reserveAndCommit@OSAllocator@WTF@@SAPAXIW4Usage@12@_N11@Z
?reserveCapacity@StringBuilder@WTF@@QAEXI@Z
?reset@ParserArena@JSC@@QAEXXZ
?reset@TimeoutChecker@JSC@@QAEXXZ
?resetDateCache@JSGlobalData@JSC@@QAEXXZ
?resize@StringBuilder@WTF@@QAEXI@Z
?resizeOutOfLine@BitVector@WTF@@AAEXI@Z
......
......@@ -369,7 +369,6 @@
<ClCompile Include="..\runtime\StructureChain.cpp" />
<ClCompile Include="..\runtime\StructureRareData.cpp" />
<ClCompile Include="..\runtime\SymbolTable.cpp" />
<ClCompile Include="..\runtime\TimeoutChecker.cpp" />
<ClCompile Include="..\tools\CodeProfile.cpp" />
<ClCompile Include="..\tools\CodeProfiling.cpp" />
<ClCompile Include="..\yarr\YarrCanonicalizeUCS2.cpp" />
......@@ -753,7 +752,6 @@
<ClInclude Include="..\runtime\StructureTransitionTable.h" />
<ClInclude Include="..\runtime\SymbolTable.h" />
<ClInclude Include="..\runtime\Terminator.h" />
<ClInclude Include="..\runtime\TimeoutChecker.h" />
<ClInclude Include="..\runtime\Tracing.h" />
<ClInclude Include="..\runtime\TypedArrayDescriptor.h" />
<ClInclude Include="..\runtime\Uint16WithFraction.h" />
......
......@@ -714,9 +714,6 @@
<ClCompile Include="..\runtime\SymbolTable.cpp">
<Filter>runtime</Filter>
</ClCompile>
<ClCompile Include="..\runtime\TimeoutChecker.cpp">
<Filter>runtime</Filter>
</ClCompile>
<ClCompile Include="..\tools\CodeProfile.cpp">
<Filter>tools</Filter>
</ClCompile>
......@@ -1793,9 +1790,6 @@
<ClInclude Include="..\runtime\Terminator.h">
<Filter>runtime</Filter>
</ClInclude>
<ClInclude Include="..\runtime\TimeoutChecker.h">
<Filter>runtime</Filter>
</ClInclude>
<ClInclude Include="..\runtime\Tracing.h">
<Filter>runtime</Filter>
</ClInclude>
......
......@@ -189,7 +189,6 @@ EXPORTS
?destroy@OutOfLineBits@BitVector@WTF@@SAXPAV123@@Z
?detach@Debugger@JSC@@UAEXPAVJSGlobalObject@2@@Z
?detachThread@WTF@@YAXI@Z
?didTimeOut@TimeoutChecker@JSC@@QAE_NPAVExecState@2@@Z
?discardAllCode@JSGlobalData@JSC@@QAEXXZ
?displayName@JSFunction@JSC@@QAE?AVString@WTF@@PAVExecState@2@@Z
?dtoa@WTF@@YAXQADNAA_NAAHAAI@Z
......@@ -345,7 +344,6 @@ EXPORTS
?reserveAndCommit@OSAllocator@WTF@@SAPAXIW4Usage@12@_N11@Z
?reserveCapacity@StringBuilder@WTF@@QAEXI@Z
?reset@ParserArena@JSC@@QAEXXZ
?reset@TimeoutChecker@JSC@@QAEXXZ
?resetDateCache@JSGlobalData@JSC@@QAEXXZ
?resize@StringBuilder@WTF@@QAEXI@Z
?resizeOutOfLine@BitVector@WTF@@AAEXI@Z
......
......@@ -479,8 +479,6 @@
1497209114EB831500FEB1B7 /* PassWeak.h in Headers */ = {isa = PBXBuildFile; fileRef = 1497209014EB831500FEB1B7 /* PassWeak.h */; settings = {ATTRIBUTES = (Private, ); }; };
14A1563210966365006FA260 /* DateInstanceCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A1563010966365006FA260 /* DateInstanceCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
14A23D750F4E1ABB0023CDAD /* JITStubs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */; };
14A42E3F0F4F60EE00599099 /* TimeoutChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14A42E3D0F4F60EE00599099 /* TimeoutChecker.cpp */; };
14A42E400F4F60EE00599099 /* TimeoutChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
14ABDF600A437FEF00ECCA01 /* JSCallbackObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */; };
14B723B212D7DA46003BD5ED /* MachineStackMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14B7233F12D7D0DA003BD5ED /* MachineStackMarker.cpp */; };
14B723B812D7DA6F003BD5ED /* MachineStackMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 14B7234012D7D0DA003BD5ED /* MachineStackMarker.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -1337,8 +1335,6 @@
14A1563010966365006FA260 /* DateInstanceCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateInstanceCache.h; sourceTree = "<group>"; };
14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITStubs.cpp; sourceTree = "<group>"; };
14A396A60CD2933100B5B4FF /* SymbolTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = "<group>"; };
14A42E3D0F4F60EE00599099 /* TimeoutChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeoutChecker.cpp; sourceTree = "<group>"; };
14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeoutChecker.h; sourceTree = "<group>"; };
14A6581A0F4E36F4000150FD /* JITStubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubs.h; sourceTree = "<group>"; };
14ABB36E099C076400E2A24F /* JSCJSValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCJSValue.h; sourceTree = "<group>"; };
14ABB454099C2A0F00E2A24F /* JSType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSType.h; sourceTree = "<group>"; };
......@@ -2596,8 +2592,6 @@
0F919D2715856770004A4E7D /* SymbolTable.cpp */,
14A396A60CD2933100B5B4FF /* SymbolTable.h */,
97F6903A1169DF7F00A6BB46 /* Terminator.h */,
14A42E3D0F4F60EE00599099 /* TimeoutChecker.cpp */,
14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */,
5D53726D0E1C546B0021E549 /* Tracing.d */,
5D53726E0E1C54880021E549 /* Tracing.h */,
0FEB3ECB16237F4700AB67AD /* TypedArrayDescriptor.h */,
......@@ -3382,7 +3376,6 @@
971EDEA61169E0D3005E4262 /* Terminator.h in Headers */,
0F572D4F16879FDD00E57FBD /* ThunkGenerator.h in Headers */,
A7386556118697B400540279 /* ThunkGenerators.h in Headers */,
14A42E400F4F60EE00599099 /* TimeoutChecker.h in Headers */,
141448CD13A1783700F5BA1A /* TinyBloomFilter.h in Headers */,
5D53726F0E1C54880021E549 /* Tracing.h in Headers */,
0FEB3ECD16237F4D00AB67AD /* TypedArrayDescriptor.h in Headers */,
......@@ -4054,7 +4047,6 @@
0F919D2815856773004A4E7D /* SymbolTable.cpp in Sources */,
A7386555118697B400540279 /* ThunkGenerators.cpp in Sources */,
C25D709B16DE99F400FCA6BC /* JSManagedValue.mm in Sources */,
14A42E3F0F4F60EE00599099 /* TimeoutChecker.cpp in Sources */,
0FF4274A158EBE91004CB9FF /* udis86.c in Sources */,
0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */,
0FF42743158EBE91004CB9FF /* udis86_input.c in Sources */,
......
......@@ -323,7 +323,6 @@ SOURCES += \
runtime/Structure.cpp \
runtime/StructureRareData.cpp \
runtime/SymbolTable.cpp \
runtime/TimeoutChecker.cpp \
tools/CodeProfile.cpp \
tools/CodeProfiling.cpp \
yarr/YarrJIT.cpp \
......
......@@ -324,7 +324,6 @@ public:
// These registers match the baseline JIT.
static const GPRReg cachedResultRegister = X86Registers::eax;
static const GPRReg timeoutCheckRegister = X86Registers::r12;
static const GPRReg callFrameRegister = X86Registers::r13;
static const GPRReg tagTypeNumberRegister = X86Registers::r14;
static const GPRReg tagMaskRegister = X86Registers::r15;
......
......@@ -118,38 +118,6 @@ void JIT::emitOptimizationCheck(OptimizationCheckKind kind)
}
#endif
#if CPU(X86)
void JIT::emitTimeoutCheck()
{
Jump skipTimeout = branchSub32(NonZero, TrustedImm32(1), AbsoluteAddress(&m_globalData->m_timeoutCount));
JITStubCall stubCall(this, cti_timeout_check);
stubCall.addArgument(regT1, regT0); // save last result registers.
stubCall.call(regT0);
store32(regT0, &m_globalData->m_timeoutCount);
stubCall.getArgument(0, regT1, regT0); // reload last result registers.
skipTimeout.link(this);
}
#elif USE(JSVALUE32_64)
void JIT::emitTimeoutCheck()
{
Jump skipTimeout = branchSub32(NonZero, TrustedImm32(1), timeoutCheckRegister);
JITStubCall stubCall(this, cti_timeout_check);
stubCall.addArgument(regT1, regT0); // save last result registers.
stubCall.call(timeoutCheckRegister);
stubCall.getArgument(0, regT1, regT0); // reload last result registers.
skipTimeout.link(this);
}
#else
void JIT::emitTimeoutCheck()
{
Jump skipTimeout = branchSub32(NonZero, TrustedImm32(1), timeoutCheckRegister);
JITStubCall(this, cti_timeout_check).call(timeoutCheckRegister);
skipTimeout.link(this);
killLastResultRegister();
}
#endif
#define NEXT_OPCODE(name) \
m_bytecodeOffset += OPCODE_LENGTH(name); \
break;
......
......@@ -859,7 +859,6 @@ namespace JSC {
void emitOptimizationCheck(OptimizationCheckKind) { }
#endif
void emitTimeoutCheck();
#ifndef NDEBUG
void printBytecodeOperandTypes(unsigned src1, unsigned src2);
#endif
......
......@@ -471,7 +471,6 @@ SYMBOL_STRING(ctiTrampoline) ":" "\n"
"sw $28," STRINGIZE_VALUE_OF(PRESERVED_GP_OFFSET) "($29)" "\n"
#endif
"move $16,$6 # set callFrameRegister" "\n"
"li $17,512 # set timeoutCheckRegister" "\n"
"move $25,$4 # move executableAddress to t9" "\n"
"sw $5," STRINGIZE_VALUE_OF(REGISTER_FILE_OFFSET) "($29) # store JSStack to current stack" "\n"
"lw $9," STRINGIZE_VALUE_OF(STACK_LENGTH + 20) "($29) # load globalData from previous stack" "\n"
......@@ -1373,24 +1372,6 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_pre_inc)
return JSValue::encode(result);
}
DEFINE_STUB_FUNCTION(int, timeout_check)
{
STUB_INIT_STACK_FRAME(stackFrame);
JSGlobalData* globalData = stackFrame.globalData;
TimeoutChecker& timeoutChecker = globalData->timeoutChecker;
if (globalData->terminator.shouldTerminate()) {
globalData->exception = createTerminatedExecutionException(globalData);
VM_THROW_EXCEPTION_AT_END();
} else if (timeoutChecker.didTimeOut(stackFrame.callFrame)) {
globalData->exception = createInterruptedExecutionException(globalData);
VM_THROW_EXCEPTION_AT_END();
}
return timeoutChecker.ticksUntilNextCheck();
}
DEFINE_STUB_FUNCTION(void*, stack_check)
{
STUB_INIT_STACK_FRAME(stackFrame);
......
......@@ -406,7 +406,6 @@ int JIT_STUB cti_op_jgreater(STUB_ARGS_DECLARATION) WTF_INTERNAL;
int JIT_STUB cti_op_jgreatereq(STUB_ARGS_DECLARATION) WTF_INTERNAL;
int JIT_STUB cti_op_jtrue(STUB_ARGS_DECLARATION) WTF_INTERNAL;
void* JIT_STUB cti_op_load_varargs(STUB_ARGS_DECLARATION) WTF_INTERNAL;
int JIT_STUB cti_timeout_check(STUB_ARGS_DECLARATION) WTF_INTERNAL;
int JIT_STUB cti_has_property(STUB_ARGS_DECLARATION) WTF_INTERNAL;
void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION) WTF_INTERNAL;
void JIT_STUB cti_op_end(STUB_ARGS_DECLARATION) WTF_INTERNAL;
......
......@@ -67,7 +67,6 @@ namespace JSC {
static const RegisterID bucketCounterRegister = X86Registers::r10;
#endif
static const RegisterID timeoutCheckRegister = X86Registers::r12;
static const RegisterID callFrameRegister = X86Registers::r13;
static const RegisterID tagTypeNumberRegister = X86Registers::r14;
static const RegisterID tagMaskRegister = X86Registers::r15;
......@@ -118,7 +117,6 @@ namespace JSC {
// Update ctiTrampoline in JITStubs.cpp if these values are changed!
static const RegisterID callFrameRegister = ARMRegisters::r5;
static const RegisterID timeoutCheckRegister = ARMRegisters::r6;
static const FPRegisterID fpRegT0 = ARMRegisters::d0;
static const FPRegisterID fpRegT1 = ARMRegisters::d1;
......@@ -145,14 +143,12 @@ namespace JSC {
static const RegisterID regT3 = MIPSRegisters::s2;
static const RegisterID callFrameRegister = MIPSRegisters::s0;
static const RegisterID timeoutCheckRegister = MIPSRegisters::s1;
static const FPRegisterID fpRegT0 = MIPSRegisters::f4;
static const FPRegisterID fpRegT1 = MIPSRegisters::f6;
static const FPRegisterID fpRegT2 = MIPSRegisters::f8;
static const FPRegisterID fpRegT3 = MIPSRegisters::f10;
#elif CPU(SH4)
static const RegisterID timeoutCheckRegister = SH4Registers::r8;
static const RegisterID callFrameRegister = SH4Registers::fp;
static const RegisterID regT0 = SH4Registers::r0;
......
......@@ -179,9 +179,6 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, HeapType heapType)
#endif
#ifndef NDEBUG
, exclusiveThread(0)
#endif
#if CPU(X86) && ENABLE(JIT)
, m_timeoutCount(512)
#endif
, m_newStringsSinceLastHashCons(0)
#if ENABLE(ASSEMBLER)
......
......@@ -48,7 +48,6 @@
#include "Strong.h"
#include "Terminator.h"
#include "ThunkGenerators.h"
#include "TimeoutChecker.h"
#include "TypedArrayDescriptor.h"
#include "WeakRandom.h"
#include <wtf/BumpPointerAllocator.h>
......@@ -326,7 +325,6 @@ namespace JSC {
#endif
NativeExecutable* getHostFunction(NativeFunction, NativeFunction constructor);
TimeoutChecker timeoutChecker;
Terminator terminator;
JSValue exception;
......@@ -414,10 +412,6 @@ namespace JSC {
void setInitializingObjectClass(const ClassInfo*);
#endif
#if CPU(X86) && ENABLE(JIT)
unsigned m_timeoutCount;
#endif
unsigned m_newStringsSinceLastHashCons;
static const unsigned s_minNumberOfNewStringsToHashCons = 100;
......
......@@ -105,12 +105,6 @@ const GlobalObjectMethodTable JSGlobalObject::s_globalObjectMethodTable = { &all
@end
*/
// Default number of ticks before a timeout check should be done.
static const int initialTickCountThreshold = 255;
// Preferred number of milliseconds between each timeout check
static const int preferredScriptCheckTimeInterval = 1000;
JSGlobalObject::JSGlobalObject(JSGlobalData& globalData, Structure* structure, const GlobalObjectMethodTable* globalObjectMethodTable)
: Base(globalData, structure, 0)
, m_masqueradesAsUndefinedWatchpoint(adoptRef(new WatchpointSet(InitializedWatching)))
......
......@@ -420,21 +420,10 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder&
if (!holderStackWasEmpty)
return StringifySucceeded;
// If this is the outermost call, then loop to handle everything on the holder stack.
TimeoutChecker localTimeoutChecker(m_exec->globalData().timeoutChecker);
localTimeoutChecker.reset();
unsigned tickCount = localTimeoutChecker.ticksUntilNextCheck();
do {
while (m_holderStack.last().appendNextProperty(*this, builder)) {
if (m_exec->hadException())
return StringifyFailed;
if (!--tickCount) {
if (localTimeoutChecker.didTimeOut(m_exec)) {
throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
return StringifyFailed;
}
tickCount = localTimeoutChecker.ticksUntilNextCheck();
}
}
m_holderStack.removeLast();
} while (!m_holderStack.isEmpty());
......@@ -638,8 +627,7 @@ private:
CallData m_callData;
};
// We clamp recursion well beyond anything reasonable, but we also have a timeout check
// to guard against "infinite" execution by inserting arbitrarily large objects.
// We clamp recursion well beyond anything reasonable.
static const unsigned maximumFilterRecursion = 40000;
enum WalkerState { StateUnknown, ArrayStartState, ArrayStartVisitMember, ArrayEndVisitMember,
ObjectStartState, ObjectStartVisitMember, ObjectEndVisitMember };
......@@ -655,9 +643,6 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
JSValue inValue = unfiltered;
JSValue outValue = jsNull();
TimeoutChecker localTimeoutChecker(m_exec->globalData().timeoutChecker);
localTimeoutChecker.reset();
unsigned tickCount = localTimeoutChecker.ticksUntilNextCheck();
while (1) {
switch (state) {
arrayStartState:
......@@ -674,12 +659,6 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
}
arrayStartVisitMember:
case ArrayStartVisitMember: {
if (!--tickCount) {
if (localTimeoutChecker.didTimeOut(m_exec))
return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
tickCount = localTimeoutChecker.ticksUntilNextCheck();
}
JSArray* array = arrayStack.peek();
uint32_t index = indexStack.last();
if (index == array->length()) {
......@@ -733,12 +712,6 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
}
objectStartVisitMember:
case ObjectStartVisitMember: {
if (!--tickCount) {
if (localTimeoutChecker.didTimeOut(m_exec))
return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
tickCount = localTimeoutChecker.ticksUntilNextCheck();
}
JSObject* object = objectStack.peek();
uint32_t index = indexStack.last();
PropertyNameArray& properties = propertyStack.last();
......@@ -796,12 +769,6 @@ NEVER_INLINE JSValue Walker::walk(JSValue unfiltered)
state = stateStack.last();
stateStack.removeLast();
if (!--tickCount) {
if (localTimeoutChecker.didTimeOut(m_exec))
return throwError(m_exec, createInterruptedExecutionException(&m_exec->globalData()));
tickCount = localTimeoutChecker.ticksUntilNextCheck();
}
}
JSObject* finalHolder = constructEmptyObject(m_exec);
PutPropertySlot slot;
......
/*
* Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "TimeoutChecker.h"
#include "CallFrame.h"
#include "JSGlobalObject.h"
#include "Operations.h"
#if OS(DARWIN)
#include <mach/mach.h>
#elif OS(WINDOWS)
#include <windows.h>
#else
#include <wtf/CurrentTime.h>
#endif
using namespace std;
namespace JSC {
// Number of ticks before the first timeout check is done.
static const int ticksUntilFirstCheck = 1024;
// Number of milliseconds between each timeout check.
static const int intervalBetweenChecks = 1000;
// Returns the time the current thread has spent executing, in milliseconds.
static inline unsigned getCPUTime()
{
#if OS(DARWIN)
mach_msg_type_number_t infoCount = THREAD_BASIC_INFO_COUNT;
thread_basic_info_data_t info;
// Get thread information
mach_port_t threadPort = mach_thread_self();
thread_info(threadPort, THREAD_BASIC_INFO, reinterpret_cast<thread_info_t>(&info), &infoCount);
mach_port_deallocate(mach_task_self(), threadPort);
unsigned time = info.user_time.seconds * 1000 + info.user_time.microseconds / 1000;
time += info.system_time.seconds * 1000 + info.system_time.microseconds / 1000;
return time;
#elif OS(WINDOWS)
union {
FILETIME fileTime;
unsigned long long fileTimeAsLong;
} userTime, kernelTime;
// GetThreadTimes won't accept NULL arguments so we pass these even though
// they're not used.
FILETIME creationTime, exitTime;
GetThreadTimes(GetCurrentThread(), &creationTime, &exitTime, &kernelTime.fileTime, &userTime.fileTime);
return userTime.fileTimeAsLong / 10000 + kernelTime.fileTimeAsLong / 10000;
#elif OS(QNX)
struct timespec time;
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time))
CRASH();
return time.tv_sec * 1000.0 + time.tv_nsec / 1.0e6;
#else
// FIXME: We should return the time the current thread has spent executing.
// use a relative time from first call in order to avoid an overflow
static double firstTime = currentTime();
return static_cast<unsigned> ((currentTime() - firstTime) * 1000);
#endif
}
TimeoutChecker::TimeoutChecker()
: m_timeoutInterval(0)
, m_startCount(0)
{
reset();
}
void TimeoutChecker::reset()
{
m_ticksUntilNextCheck = ticksUntilFirstCheck;
m_timeAtLastCheck = 0;
m_timeExecuting = 0;
}
bool TimeoutChecker::didTimeOut(ExecState* exec)
{
unsigned currentTime = getCPUTime();
if (!m_timeAtLastCheck) {
// Suspicious amount of looping in a script -- start timing it
m_timeAtLastCheck = currentTime;
return false;
}
unsigned timeDiff = currentTime - m_timeAtLastCheck;
if (timeDiff == 0)
timeDiff = 1;
m_timeExecuting += timeDiff;
m_timeAtLastCheck = currentTime;
// Adjust the tick threshold so we get the next checkTimeout call in the
// interval specified in intervalBetweenChecks.