diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime')
-rw-r--r-- | Source/JavaScriptCore/runtime/GCActivityCallback.cpp | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSArray.h | 37 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSExportMacros.h | 4 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSGlobalObject.cpp | 9 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSGlobalObject.h | 41 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/MemoryStatistics.cpp | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/Options.cpp | 12 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/Options.h | 6 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/WeakRandom.h | 3 |
9 files changed, 75 insertions, 41 deletions
diff --git a/Source/JavaScriptCore/runtime/GCActivityCallback.cpp b/Source/JavaScriptCore/runtime/GCActivityCallback.cpp index 794d1545e..c2fca8c01 100644 --- a/Source/JavaScriptCore/runtime/GCActivityCallback.cpp +++ b/Source/JavaScriptCore/runtime/GCActivityCallback.cpp @@ -75,7 +75,7 @@ void DefaultGCActivityCallback::doWork() return; } #endif - heap->collectAllGarbage(); + heap->collect(Heap::DoNotSweep); } void DefaultGCActivityCallback::scheduleTimer(double newDelay) diff --git a/Source/JavaScriptCore/runtime/JSArray.h b/Source/JavaScriptCore/runtime/JSArray.h index c1a3a632b..52c591324 100644 --- a/Source/JavaScriptCore/runtime/JSArray.h +++ b/Source/JavaScriptCore/runtime/JSArray.h @@ -380,7 +380,42 @@ namespace JSC { return size; } + + inline JSArray* constructArray(ExecState* exec, Structure* arrayStructure, const ArgList& values) + { + JSGlobalData& globalData = exec->globalData(); + unsigned length = values.size(); + JSArray* array = JSArray::tryCreateUninitialized(globalData, arrayStructure, length); + + // FIXME: we should probably throw an out of memory error here, but + // when making this change we should check that all clients of this + // function will correctly handle an exception being thrown from here. + if (!array) + CRASH(); + + for (unsigned i = 0; i < length; ++i) + array->initializeIndex(globalData, i, values.at(i)); + array->completeInitialization(length); + return array; + } - } // namespace JSC + inline JSArray* constructArray(ExecState* exec, Structure* arrayStructure, const JSValue* values, unsigned length) + { + JSGlobalData& globalData = exec->globalData(); + JSArray* array = JSArray::tryCreateUninitialized(globalData, arrayStructure, length); + + // FIXME: we should probably throw an out of memory error here, but + // when making this change we should check that all clients of this + // function will correctly handle an exception being thrown from here. + if (!array) + CRASH(); + + for (unsigned i = 0; i < length; ++i) + array->initializeIndex(globalData, i, values[i]); + array->completeInitialization(length); + return array; + } + +} // namespace JSC #endif // JSArray_h diff --git a/Source/JavaScriptCore/runtime/JSExportMacros.h b/Source/JavaScriptCore/runtime/JSExportMacros.h index 19e2c286f..884805f86 100644 --- a/Source/JavaScriptCore/runtime/JSExportMacros.h +++ b/Source/JavaScriptCore/runtime/JSExportMacros.h @@ -36,7 +36,7 @@ // See note in wtf/Platform.h for more info on EXPORT_MACROS. #if USE(EXPORT_MACROS) -#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore) +#if defined(BUILDING_JavaScriptCore) #define JS_EXPORT_PRIVATE WTF_EXPORT #else #define JS_EXPORT_PRIVATE WTF_IMPORT @@ -50,7 +50,7 @@ #if !PLATFORM(CHROMIUM) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) -#if defined(BUILDING_JavaScriptCore) || defined(STATICALLY_LINKED_WITH_JavaScriptCore) +#if defined(BUILDING_JavaScriptCore) #define JS_EXPORTDATA __declspec(dllexport) #else #define JS_EXPORTDATA __declspec(dllimport) diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index d38570dfb..d19db4fd8 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -112,6 +112,15 @@ template <typename T> static inline void visitIfNeeded(SlotVisitor& visitor, Wri visitor.append(v); } +JSGlobalObject::JSGlobalObject(JSGlobalData& globalData, Structure* structure, const GlobalObjectMethodTable* globalObjectMethodTable) + : JSSegmentedVariableObject(globalData, structure, &m_symbolTable) + , m_globalScopeChain() + , m_weakRandom(Options::forceWeakRandomSeed ? Options::forcedWeakRandomSeed : static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0))) + , m_evalEnabled(true) + , m_globalObjectMethodTable(globalObjectMethodTable ? globalObjectMethodTable : &s_globalObjectMethodTable) +{ +} + JSGlobalObject::~JSGlobalObject() { ASSERT(JSLock::currentThreadIsHoldingLock()); diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h index 2396142b1..1dcfc63cc 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h @@ -175,14 +175,7 @@ namespace JSC { static JS_EXPORTDATA const ClassInfo s_info; protected: - explicit JSGlobalObject(JSGlobalData& globalData, Structure* structure, const GlobalObjectMethodTable* globalObjectMethodTable = 0) - : JSSegmentedVariableObject(globalData, structure, &m_symbolTable) - , m_globalScopeChain() - , m_weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0))) - , m_evalEnabled(true) - , m_globalObjectMethodTable(globalObjectMethodTable ? globalObjectMethodTable : &s_globalObjectMethodTable) - { - } + JS_EXPORT_PRIVATE explicit JSGlobalObject(JSGlobalData&, Structure*, const GlobalObjectMethodTable* = 0); void finishCreation(JSGlobalData& globalData) { @@ -328,6 +321,7 @@ namespace JSC { } double weakRandomNumber() { return m_weakRandom.get(); } + unsigned weakRandomInteger() { return m_weakRandom.getUint32(); } protected: static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSSegmentedVariableObject::StructureFlags; @@ -451,23 +445,10 @@ namespace JSC { { return constructEmptyArray(exec, exec->lexicalGlobalObject(), initialLength); } - + inline JSArray* constructArray(ExecState* exec, JSGlobalObject* globalObject, const ArgList& values) { - JSGlobalData& globalData = exec->globalData(); - unsigned length = values.size(); - JSArray* array = JSArray::tryCreateUninitialized(globalData, globalObject->arrayStructure(), length); - - // FIXME: we should probably throw an out of memory error here, but - // when making this change we should check that all clients of this - // function will correctly handle an exception being thrown from here. - if (!array) - CRASH(); - - for (unsigned i = 0; i < length; ++i) - array->initializeIndex(globalData, i, values.at(i)); - array->completeInitialization(length); - return array; + return constructArray(exec, globalObject->arrayStructure(), values); } inline JSArray* constructArray(ExecState* exec, const ArgList& values) @@ -477,19 +458,7 @@ namespace JSC { inline JSArray* constructArray(ExecState* exec, JSGlobalObject* globalObject, const JSValue* values, unsigned length) { - JSGlobalData& globalData = exec->globalData(); - JSArray* array = JSArray::tryCreateUninitialized(globalData, globalObject->arrayStructure(), length); - - // FIXME: we should probably throw an out of memory error here, but - // when making this change we should check that all clients of this - // function will correctly handle an exception being thrown from here. - if (!array) - CRASH(); - - for (unsigned i = 0; i < length; ++i) - array->initializeIndex(globalData, i, values[i]); - array->completeInitialization(length); - return array; + return constructArray(exec, globalObject->arrayStructure(), values, length); } inline JSArray* constructArray(ExecState* exec, const JSValue* values, unsigned length) diff --git a/Source/JavaScriptCore/runtime/MemoryStatistics.cpp b/Source/JavaScriptCore/runtime/MemoryStatistics.cpp index 86101f559..14b1c7d06 100644 --- a/Source/JavaScriptCore/runtime/MemoryStatistics.cpp +++ b/Source/JavaScriptCore/runtime/MemoryStatistics.cpp @@ -37,7 +37,7 @@ GlobalMemoryStatistics globalMemoryStatistics() GlobalMemoryStatistics stats; stats.stackBytes = RegisterFile::committedByteCount(); -#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED) +#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED) || (PLATFORM(BLACKBERRY) && ENABLE(JIT)) stats.JITBytes = ExecutableAllocator::committedByteCount(); #else stats.JITBytes = 0; diff --git a/Source/JavaScriptCore/runtime/Options.cpp b/Source/JavaScriptCore/runtime/Options.cpp index 7b6da6536..894ca8cc0 100644 --- a/Source/JavaScriptCore/runtime/Options.cpp +++ b/Source/JavaScriptCore/runtime/Options.cpp @@ -67,6 +67,9 @@ int32_t thresholdForOptimizeSoon; int32_t executionCounterIncrementForLoop; int32_t executionCounterIncrementForReturn; +bool randomizeExecutionCountsBetweenCheckpoints; +int32_t maximumExecutionCountsBetweenCheckpoints; + unsigned desiredSpeculativeSuccessFailRatio; double likelyToTakeSlowCaseThreshold; @@ -95,6 +98,9 @@ unsigned gcMarkStackSegmentSize; unsigned numberOfGCMarkers; unsigned opaqueRootMergeThreshold; +bool forceWeakRandomSeed; +unsigned forcedWeakRandomSeed; + #if ENABLE(RUN_TIME_HEURISTICS) static bool parse(const char* string, bool& value) { @@ -184,6 +190,9 @@ void initializeOptions() SET(executionCounterIncrementForLoop, 1); SET(executionCounterIncrementForReturn, 15); + + SET(randomizeExecutionCountsBetweenCheckpoints, false); + SET(maximumExecutionCountsBetweenCheckpoints, 1000); SET(desiredSpeculativeSuccessFailRatio, 6); @@ -227,6 +236,9 @@ void initializeOptions() ASSERT((static_cast<int64_t>(thresholdForOptimizeAfterLongWarmUp) << reoptimizationRetryCounterMax) > 0); ASSERT((static_cast<int64_t>(thresholdForOptimizeAfterLongWarmUp) << reoptimizationRetryCounterMax) <= static_cast<int64_t>(std::numeric_limits<int32_t>::max())); + + SET(forceWeakRandomSeed, false); + SET(forcedWeakRandomSeed, 0); } } } // namespace JSC::Options diff --git a/Source/JavaScriptCore/runtime/Options.h b/Source/JavaScriptCore/runtime/Options.h index 0adb59e9b..1bce5b944 100644 --- a/Source/JavaScriptCore/runtime/Options.h +++ b/Source/JavaScriptCore/runtime/Options.h @@ -53,6 +53,9 @@ extern int32_t thresholdForOptimizeNextInvocation; extern int32_t executionCounterIncrementForLoop; extern int32_t executionCounterIncrementForReturn; +extern bool randomizeExecutionCountsBetweenCheckpoints; +extern int32_t maximumExecutionCountsBetweenCheckpoints; + extern unsigned desiredSpeculativeSuccessFailRatio; extern double likelyToTakeSlowCaseThreshold; @@ -81,6 +84,9 @@ extern unsigned gcMarkStackSegmentSize; JS_EXPORTDATA extern unsigned numberOfGCMarkers; JS_EXPORTDATA extern unsigned opaqueRootMergeThreshold; +extern bool forceWeakRandomSeed; +extern unsigned forcedWeakRandomSeed; + void initializeOptions(); } } // namespace JSC::Options diff --git a/Source/JavaScriptCore/runtime/WeakRandom.h b/Source/JavaScriptCore/runtime/WeakRandom.h index 6083980d2..3cd1016d3 100644 --- a/Source/JavaScriptCore/runtime/WeakRandom.h +++ b/Source/JavaScriptCore/runtime/WeakRandom.h @@ -62,6 +62,9 @@ public: , m_high(seed) { } + + // Returns the seed provided that you've never called get() or getUint32(). + unsigned seedUnsafe() const { return m_high; } double get() { |