Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (212691 => 212692)
--- trunk/Source/_javascript_Core/ChangeLog 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,3 +1,54 @@
+2017-02-20 Mark Lam <mark....@apple.com>
+
+ [Re-landing] CachedCall should let GC know to keep its arguments alive.
+ https://bugs.webkit.org/show_bug.cgi?id=168567
+ <rdar://problem/30475767>
+
+ Reviewed by Saam Barati.
+
+ We fix this by having CachedCall use a MarkedArgumentBuffer to store its
+ arguments instead of a Vector.
+
+ Also declared CachedCall, MarkedArgumentBuffer, and ProtoCallFrame as
+ WTF_FORBID_HEAP_ALLOCATION because they rely on being stack allocated for
+ correctness.
+
+ Update: the original patch has a bug in MarkedArgumentBuffer::expandCapacity()
+ where it was copying and calling addMarkSet() on values in m_buffer beyond m_size
+ (up to m_capacity). As a result, depending on the pre-existing values in
+ m_inlineBuffer, this may result in a computed Heap pointer that is wrong, and
+ subsequently, manifest as a crash. This is likely to be the cause of the PLT
+ regression.
+
+ I don't have a new test for this fix because the issue relies on sufficiently bad
+ values randomly showing up in m_inlineBuffer when we do an ensureCapacity() which
+ calls expandCapacity().
+
+ * interpreter/CachedCall.h:
+ (JSC::CachedCall::CachedCall):
+ (JSC::CachedCall::call):
+ (JSC::CachedCall::clearArguments):
+ (JSC::CachedCall::appendArgument):
+ (JSC::CachedCall::setArgument): Deleted.
+ * interpreter/CallFrame.h:
+ (JSC::ExecState::emptyList):
+ * interpreter/Interpreter.cpp:
+ (JSC::Interpreter::prepareForRepeatCall):
+ * interpreter/Interpreter.h:
+ * interpreter/ProtoCallFrame.h:
+ * runtime/ArgList.cpp:
+ (JSC::MarkedArgumentBuffer::slowEnsureCapacity):
+ (JSC::MarkedArgumentBuffer::expandCapacity):
+ (JSC::MarkedArgumentBuffer::slowAppend):
+ * runtime/ArgList.h:
+ (JSC::MarkedArgumentBuffer::append):
+ (JSC::MarkedArgumentBuffer::ensureCapacity):
+ * runtime/StringPrototype.cpp:
+ (JSC::replaceUsingRegExpSearch):
+ * runtime/VM.cpp:
+ (JSC::VM::VM):
+ * runtime/VM.h:
+
2017-02-20 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r212618.
Modified: trunk/Source/_javascript_Core/interpreter/CachedCall.h (212691 => 212692)
--- trunk/Source/_javascript_Core/interpreter/CachedCall.h 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/interpreter/CachedCall.h 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,10 +33,12 @@
#include "ProtoCallFrame.h"
#include "VMEntryScope.h"
#include "VMInlines.h"
+#include <wtf/ForbidHeapAllocation.h>
namespace JSC {
class CachedCall {
- WTF_MAKE_NONCOPYABLE(CachedCall); WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(CachedCall);
+ WTF_FORBID_HEAP_ALLOCATION;
public:
CachedCall(CallFrame* callFrame, JSFunction* function, int argumentCount)
: m_valid(false)
@@ -49,8 +51,8 @@
ASSERT(!function->isHostFunctionNonInline());
if (UNLIKELY(vm.isSafeToRecurseSoft())) {
- m_arguments.resize(argumentCount);
- m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, &m_protoCallFrame, function, argumentCount + 1, function->scope(), m_arguments.data());
+ m_arguments.ensureCapacity(argumentCount);
+ m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, &m_protoCallFrame, function, argumentCount + 1, function->scope(), m_arguments);
} else
throwStackOverflowError(callFrame, scope);
m_valid = !scope.exception();
@@ -59,11 +61,14 @@
JSValue call()
{
ASSERT(m_valid);
+ ASSERT(m_arguments.size() == static_cast<size_t>(m_protoCallFrame.argumentCount()));
return m_interpreter->execute(m_closure);
}
void setThis(JSValue v) { m_protoCallFrame.setThisValue(v); }
- void setArgument(int n, JSValue v) { m_protoCallFrame.setArgument(n, v); }
+ void clearArguments() { m_arguments.clear(); }
+ void appendArgument(JSValue v) { m_arguments.append(v); }
+
private:
bool m_valid;
Interpreter* m_interpreter;
@@ -70,7 +75,7 @@
VM& m_vm;
VMEntryScope m_entryScope;
ProtoCallFrame m_protoCallFrame;
- Vector<JSValue> m_arguments;
+ MarkedArgumentBuffer m_arguments;
CallFrameClosure m_closure;
};
}
Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (212691 => 212692)
--- trunk/Source/_javascript_Core/interpreter/CallFrame.h 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1999-2001 Harri Porten (por...@kde.org)
* Copyright (C) 2001 Peter Kelly (p...@post.com)
- * Copyright (C) 2003, 2007-2008, 2011, 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -119,7 +119,7 @@
AtomicStringTable* atomicStringTable() const { return vm().atomicStringTable(); }
const CommonIdentifiers& propertyNames() const { return *vm().propertyNames; }
- const MarkedArgumentBuffer& emptyList() const { return *vm().emptyList; }
+ const ArgList& emptyList() const { return *vm().emptyList; }
Interpreter* interpreter() { return vm().interpreter; }
Heap* heap() { return &vm().heap; }
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (212691 => 212692)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2010, 2012-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All rights reserved.
* Copyright (C) 2008 Cameron Zwarich <cwzwar...@uwaterloo.ca>
*
* Redistribution and use in source and binary forms, with or without
@@ -1005,7 +1005,7 @@
return checkedReturn(asObject(result));
}
-CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, ProtoCallFrame* protoCallFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope, JSValue* args)
+CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* functionExecutable, CallFrame* callFrame, ProtoCallFrame* protoCallFrame, JSFunction* function, int argumentCountIncludingThis, JSScope* scope, const ArgList& args)
{
VM& vm = *scope->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -1025,7 +1025,7 @@
size_t argsCount = argumentCountIncludingThis;
- protoCallFrame->init(newCodeBlock, function, jsUndefined(), argsCount, args);
+ protoCallFrame->init(newCodeBlock, function, jsUndefined(), argsCount, args.data());
// Return the successful closure:
CallFrameClosure result = { callFrame, protoCallFrame, function, functionExecutable, &vm, scope, newCodeBlock->numParameters(), argumentCountIncludingThis };
return result;
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.h (212691 => 212692)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.h 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.h 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2013, 2015-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All rights reserved.
* Copyright (C) 2012 Research In Motion Limited. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -154,7 +154,7 @@
private:
enum ExecutionFlag { Normal, InitializeAndReturn };
- CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, ProtoCallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*, JSValue*);
+ CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, ProtoCallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*, const ArgList&);
JSValue execute(CallFrameClosure&);
Modified: trunk/Source/_javascript_Core/interpreter/ProtoCallFrame.h (212691 => 212692)
--- trunk/Source/_javascript_Core/interpreter/ProtoCallFrame.h 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/interpreter/ProtoCallFrame.h 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,10 +26,13 @@
#pragma once
#include "Register.h"
+#include <wtf/ForbidHeapAllocation.h>
namespace JSC {
struct JS_EXPORT_PRIVATE ProtoCallFrame {
+ WTF_FORBID_HEAP_ALLOCATION;
+public:
Register codeBlockValue;
Register calleeValue;
Register argCountAndCodeOriginValue;
Modified: trunk/Source/_javascript_Core/runtime/ArgList.cpp (212691 => 212692)
--- trunk/Source/_javascript_Core/runtime/ArgList.cpp 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/runtime/ArgList.cpp 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -63,12 +63,24 @@
}
}
+void MarkedArgumentBuffer::slowEnsureCapacity(size_t requestedCapacity)
+{
+ int newCapacity = Checked<int>(requestedCapacity).unsafeGet();
+ expandCapacity(newCapacity);
+}
+
void MarkedArgumentBuffer::expandCapacity()
{
int newCapacity = (Checked<int>(m_capacity) * 2).unsafeGet();
+ expandCapacity(newCapacity);
+}
+
+void MarkedArgumentBuffer::expandCapacity(int newCapacity)
+{
+ ASSERT(m_capacity < newCapacity);
size_t size = (Checked<size_t>(newCapacity) * sizeof(EncodedJSValue)).unsafeGet();
EncodedJSValue* newBuffer = static_cast<EncodedJSValue*>(fastMalloc(size));
- for (int i = 0; i < m_capacity; ++i) {
+ for (int i = 0; i < m_size; ++i) {
newBuffer[i] = m_buffer[i];
addMarkSet(JSValue::decode(m_buffer[i]));
}
@@ -82,7 +94,8 @@
void MarkedArgumentBuffer::slowAppend(JSValue v)
{
- if (m_size >= m_capacity)
+ ASSERT(m_size <= m_capacity);
+ if (m_size == m_capacity)
expandCapacity();
slotFor(m_size) = JSValue::encode(v);
Modified: trunk/Source/_javascript_Core/runtime/ArgList.h (212691 => 212692)
--- trunk/Source/_javascript_Core/runtime/ArgList.h 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/runtime/ArgList.h 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2001 Harri Porten (por...@kde.org)
- * Copyright (C) 2003, 2007, 2008, 2009, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,6 +22,7 @@
#pragma once
#include "CallFrame.h"
+#include <wtf/ForbidHeapAllocation.h>
#include <wtf/HashSet.h>
namespace JSC {
@@ -28,6 +29,7 @@
class MarkedArgumentBuffer {
WTF_MAKE_NONCOPYABLE(MarkedArgumentBuffer);
+ WTF_FORBID_HEAP_ALLOCATION;
friend class VM;
friend class ArgList;
@@ -73,7 +75,8 @@
void append(JSValue v)
{
- if (m_size >= m_capacity || mallocBase())
+ ASSERT(m_size <= m_capacity);
+ if (m_size == m_capacity || mallocBase())
return slowAppend(v);
slotFor(m_size) = JSValue::encode(v);
@@ -94,8 +97,16 @@
static void markLists(SlotVisitor&, ListSet&);
+ void ensureCapacity(size_t requestedCapacity)
+ {
+ if (requestedCapacity > static_cast<size_t>(m_capacity))
+ slowEnsureCapacity(requestedCapacity);
+ }
+
private:
void expandCapacity();
+ void expandCapacity(int newCapacity);
+ void slowEnsureCapacity(size_t requestedCapacity);
void addMarkSet(JSValue);
Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (212691 => 212692)
--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999-2001 Harri Porten (por...@kde.org)
- * Copyright (C) 2004-2008, 2013, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
* Copyright (C) 2009 Torch Mobile, Inc.
* Copyright (C) 2015 Jordan Harband (ljh...@gmail.com)
*
@@ -539,18 +539,19 @@
OUT_OF_MEMORY(exec, scope);
unsigned i = 0;
+ cachedCall.clearArguments();
for (; i < regExp->numSubpatterns() + 1; ++i) {
int matchStart = ovector[i * 2];
int matchLen = ovector[i * 2 + 1] - matchStart;
if (matchStart < 0)
- cachedCall.setArgument(i, jsUndefined());
+ cachedCall.appendArgument(jsUndefined());
else
- cachedCall.setArgument(i, jsSubstring(&vm, source, matchStart, matchLen));
+ cachedCall.appendArgument(jsSubstring(&vm, source, matchStart, matchLen));
}
- cachedCall.setArgument(i++, jsNumber(result.start));
- cachedCall.setArgument(i++, string);
+ cachedCall.appendArgument(jsNumber(result.start));
+ cachedCall.appendArgument(string);
cachedCall.setThis(jsUndefined());
JSValue jsResult = cachedCall.call();
@@ -578,18 +579,19 @@
OUT_OF_MEMORY(exec, scope);
unsigned i = 0;
+ cachedCall.clearArguments();
for (; i < regExp->numSubpatterns() + 1; ++i) {
int matchStart = ovector[i * 2];
int matchLen = ovector[i * 2 + 1] - matchStart;
if (matchStart < 0)
- cachedCall.setArgument(i, jsUndefined());
+ cachedCall.appendArgument(jsUndefined());
else
- cachedCall.setArgument(i, jsSubstring(&vm, source, matchStart, matchLen));
+ cachedCall.appendArgument(jsSubstring(&vm, source, matchStart, matchLen));
}
- cachedCall.setArgument(i++, jsNumber(result.start));
- cachedCall.setArgument(i++, string);
+ cachedCall.appendArgument(jsNumber(result.start));
+ cachedCall.appendArgument(string);
cachedCall.setThis(jsUndefined());
JSValue jsResult = cachedCall.call();
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (212691 => 212692)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2017-02-21 01:51:05 UTC (rev 212692)
@@ -180,7 +180,7 @@
, topJSWebAssemblyInstance(nullptr)
, m_atomicStringTable(vmType == Default ? wtfThreadData().atomicStringTable() : new AtomicStringTable)
, propertyNames(nullptr)
- , emptyList(new MarkedArgumentBuffer)
+ , emptyList(new ArgList)
, machineCodeBytesPerBytecodeWordForBaselineJIT(std::make_unique<SimpleStats>())
, customGetterSetterFunctionMap(*this)
, stringCache(*this)
Modified: trunk/Source/_javascript_Core/runtime/VM.h (212691 => 212692)
--- trunk/Source/_javascript_Core/runtime/VM.h 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/_javascript_Core/runtime/VM.h 2017-02-21 01:51:05 UTC (rev 212692)
@@ -385,7 +385,7 @@
WTF::SymbolRegistry m_symbolRegistry;
TemplateRegistryKeyTable m_templateRegistryKeytable;
CommonIdentifiers* propertyNames;
- const MarkedArgumentBuffer* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark.
+ const ArgList* emptyList;
SmallStrings smallStrings;
NumericStrings numericStrings;
DateInstanceCache dateInstanceCache;
Modified: trunk/Source/WTF/ChangeLog (212691 => 212692)
--- trunk/Source/WTF/ChangeLog 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/WTF/ChangeLog 2017-02-21 01:51:05 UTC (rev 212692)
@@ -1,3 +1,22 @@
+2017-02-20 Mark Lam <mark....@apple.com>
+
+ [Re-landing] CachedCall should let GC know to keep its arguments alive.
+ https://bugs.webkit.org/show_bug.cgi?id=168567
+ <rdar://problem/30475767>
+
+ Reviewed by Saam Barati.
+
+ Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
+ a class declared with it is malloced.
+
+ While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
+ being embedded in another class that is heap allocated, it does at minimum
+ document the intent and gives the users of this class a chance to do the
+ right thing.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/ForbidHeapAllocation.h: Added.
+
2017-02-20 Ryan Haddad <ryanhad...@apple.com>
Unreviewed, rolling out r212685.
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (212691 => 212692)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-02-21 01:48:10 UTC (rev 212691)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-02-21 01:51:05 UTC (rev 212692)
@@ -368,6 +368,7 @@
E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4A0AD3C1A96253C00536DF6 /* WorkQueueCocoa.cpp */; };
EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */ = {isa = PBXBuildFile; fileRef = EB95E1EF161A72410089A2F5 /* ByteOrder.h */; };
FE8225311B2A1E5B00BA68FD /* NakedPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8225301B2A1E5B00BA68FD /* NakedPtr.h */; };
+ FE86A8751E59440200111BBF /* ForbidHeapAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = FE86A8741E59440200111BBF /* ForbidHeapAllocation.h */; };
FE8925B01D00DAEC0046907E /* Indenter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8925AF1D00DAEC0046907E /* Indenter.h */; };
FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; };
@@ -751,6 +752,7 @@
EB95E1EF161A72410089A2F5 /* ByteOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteOrder.h; sourceTree = "<group>"; };
F72BBDB107FA424886178B9E /* SymbolImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolImpl.cpp; sourceTree = "<group>"; };
FE8225301B2A1E5B00BA68FD /* NakedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NakedPtr.h; sourceTree = "<group>"; };
+ FE86A8741E59440200111BBF /* ForbidHeapAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForbidHeapAllocation.h; sourceTree = "<group>"; };
FE8925AF1D00DAEC0046907E /* Indenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Indenter.h; sourceTree = "<group>"; };
FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; };
@@ -962,6 +964,7 @@
0F9D335B165DBA73005AD387 /* FilePrintStream.cpp */,
0F9D335C165DBA73005AD387 /* FilePrintStream.h */,
0F2B66A517B6B4F700A7AE3F /* FlipBytes.h */,
+ FE86A8741E59440200111BBF /* ForbidHeapAllocation.h */,
A8A472A6151A825A004123FF /* Forward.h */,
83F2BADE1CF9524E003E99C3 /* Function.h */,
1A1D8B9D1731879800141DA4 /* FunctionDispatcher.cpp */,
@@ -1418,6 +1421,7 @@
83F2BADF1CF9524E003E99C3 /* Function.h in Headers */,
1A1D8B9C173186CE00141DA4 /* FunctionDispatcher.h in Headers */,
A8A473CA151A825B004123FF /* GetPtr.h in Headers */,
+ FE86A8751E59440200111BBF /* ForbidHeapAllocation.h in Headers */,
0FEC84AF1BD825310080FF74 /* GraphNodeWorklist.h in Headers */,
2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */,
A8A473D3151A825B004123FF /* HashCountedSet.h in Headers */,
Added: trunk/Source/WTF/wtf/ForbidHeapAllocation.h (0 => 212692)
--- trunk/Source/WTF/wtf/ForbidHeapAllocation.h (rev 0)
+++ trunk/Source/WTF/wtf/ForbidHeapAllocation.h 2017-02-21 01:51:05 UTC (rev 212692)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 INC. OR
+ * 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.
+ */
+
+#pragma once
+
+#define WTF_FORBID_HEAP_ALLOCATION \
+private: \
+ void* operator new(size_t, void*) = delete; \
+ void* operator new[](size_t, void*) = delete; \
+ void* operator new(size_t) = delete; \
+ void operator delete(void*) = delete; \
+ void* operator new[](size_t size) = delete; \
+ void operator delete[](void*) = delete; \
+ void* operator new(size_t, NotNullTag, void* location) = delete; \
+ typedef int __thisIsHereToForceASemicolonAfterThisForbidHeapAllocationMacro