Title: [153166] trunk/Source/_javascript_Core
- Revision
- 153166
- Author
- [email protected]
- Date
- 2013-07-24 21:00:24 -0700 (Wed, 24 Jul 2013)
Log Message
fourthTier: getCTIStub should be thread-safe
https://bugs.webkit.org/show_bug.cgi?id=116126
Reviewed by Dan Bernstein.
It's called from the compilation thread. Give it locks.
* jit/JITThunks.cpp:
(JSC::JITThunks::ctiStub):
(JSC::JITThunks::hostFunctionStub):
* jit/JITThunks.h:
(JITThunks):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (153165 => 153166)
--- trunk/Source/_javascript_Core/ChangeLog 2013-07-25 04:00:22 UTC (rev 153165)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-07-25 04:00:24 UTC (rev 153166)
@@ -1,5 +1,20 @@
2013-05-17 Filip Pizlo <[email protected]>
+ fourthTier: getCTIStub should be thread-safe
+ https://bugs.webkit.org/show_bug.cgi?id=116126
+
+ Reviewed by Dan Bernstein.
+
+ It's called from the compilation thread. Give it locks.
+
+ * jit/JITThunks.cpp:
+ (JSC::JITThunks::ctiStub):
+ (JSC::JITThunks::hostFunctionStub):
+ * jit/JITThunks.h:
+ (JITThunks):
+
+2013-05-17 Filip Pizlo <[email protected]>
+
fourthTier: Executable and CodeBlock should be aware of DFG::Plans that complete asynchronously
https://bugs.webkit.org/show_bug.cgi?id=116350
Modified: trunk/Source/_javascript_Core/jit/JITThunks.cpp (153165 => 153166)
--- trunk/Source/_javascript_Core/jit/JITThunks.cpp 2013-07-25 04:00:22 UTC (rev 153165)
+++ trunk/Source/_javascript_Core/jit/JITThunks.cpp 2013-07-25 04:00:24 UTC (rev 153166)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -63,14 +63,20 @@
MacroAssemblerCodeRef JITThunks::ctiStub(VM* vm, ThunkGenerator generator)
{
+ Locker locker(m_lock);
CTIStubMap::AddResult entry = m_ctiStubMap.add(generator, MacroAssemblerCodeRef());
- if (entry.isNewEntry)
+ if (entry.isNewEntry) {
+ // Compilation thread can only retrieve existing entries.
+ ASSERT(!isCompilationThread());
entry.iterator->value = generator(vm);
+ }
return entry.iterator->value;
}
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, NativeFunction constructor)
{
+ ASSERT(!isCompilationThread());
+
if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(std::make_pair(function, constructor)))
return nativeExecutable;
@@ -81,6 +87,8 @@
NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, ThunkGenerator generator, Intrinsic intrinsic)
{
+ ASSERT(!isCompilationThread());
+
if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(std::make_pair(function, &callHostFunctionAsConstructor)))
return nativeExecutable;
Modified: trunk/Source/_javascript_Core/jit/JITThunks.h (153165 => 153166)
--- trunk/Source/_javascript_Core/jit/JITThunks.h 2013-07-25 04:00:22 UTC (rev 153165)
+++ trunk/Source/_javascript_Core/jit/JITThunks.h 2013-07-25 04:00:24 UTC (rev 153166)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -40,6 +40,7 @@
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
+#include <wtf/ThreadingPrimitives.h>
namespace JSC {
@@ -62,10 +63,15 @@
void clearHostFunctionStubs();
private:
+ // Main thread can hold this lock for a while, so use an adaptive mutex.
+ typedef Mutex Lock;
+ typedef MutexLocker Locker;
+
typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap;
CTIStubMap m_ctiStubMap;
typedef HashMap<std::pair<NativeFunction, NativeFunction>, Weak<NativeExecutable> > HostFunctionStubMap;
OwnPtr<HostFunctionStubMap> m_hostFunctionStubMap;
+ Lock m_lock;
};
} // namespace JSC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes