Changeset 103243 in webkit
- Timestamp:
- Dec 19, 2011 9:45:13 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 112 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCallbackConstructor.h
r103083 r103243 38 38 static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback) 39 39 { 40 JSCallbackConstructor* constructor = new ( allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback);40 JSCallbackConstructor* constructor = new (NotNull, allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback); 41 41 constructor->finishCreation(globalObject, classRef); 42 42 return constructor; -
trunk/Source/JavaScriptCore/API/JSCallbackFunction.h
r97097 r103243 42 42 static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name) 43 43 { 44 JSCallbackFunction* function = new ( allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(globalObject, callback);44 JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(globalObject, callback); 45 45 function->finishCreation(exec->globalData(), name); 46 46 return function; -
trunk/Source/JavaScriptCore/API/JSCallbackObject.h
r103083 r103243 120 120 JSCallbackObject(ExecState*, Structure*, JSClassRef, void* data); 121 121 JSCallbackObject(JSGlobalData&, JSClassRef, Structure*); 122 // We'd like to use the placement version of operator new defined in JSCell, but123 // we can't because Parent is a template argument, so we just duplicate the same124 // functionality here.125 void* operator new(size_t, void* ptr) { return ptr; }126 122 127 123 void finishCreation(ExecState*); … … 134 130 { 135 131 ASSERT_UNUSED(globalObject, !structure->globalObject() || structure->globalObject() == globalObject); 136 JSCallbackObject* callbackObject = new ( allocateCell<JSCallbackObject>(*exec->heap())) JSCallbackObject(exec, structure, classRef, data);132 JSCallbackObject* callbackObject = new (NotNull, allocateCell<JSCallbackObject>(*exec->heap())) JSCallbackObject(exec, structure, classRef, data); 137 133 callbackObject->finishCreation(exec); 138 134 return callbackObject; … … 140 136 static JSCallbackObject* create(JSGlobalData& globalData, JSClassRef classRef, Structure* structure) 141 137 { 142 JSCallbackObject* callbackObject = new ( allocateCell<JSCallbackObject>(globalData.heap)) JSCallbackObject(globalData, classRef, structure);138 JSCallbackObject* callbackObject = new (NotNull, allocateCell<JSCallbackObject>(globalData.heap)) JSCallbackObject(globalData, classRef, structure); 143 139 callbackObject->finishCreation(globalData); 144 140 return callbackObject; -
trunk/Source/JavaScriptCore/ChangeLog
r103240 r103243 1 2011-12-15 Geoffrey Garen <ggaren@apple.com> 2 3 Placement new does an unnecessary NULL check 4 https://bugs.webkit.org/show_bug.cgi?id=74676 5 6 Reviewed by Sam Weinig. 7 8 We can define our own version, which skips the NULL check. 9 10 Not a measurable speedup, but code inspection shows better code generated, 11 and I believe this is a step toward turning off -fomit-frame-pointer. 12 13 * API/JSCallbackConstructor.h: 14 (JSC::JSCallbackConstructor::create): 15 * API/JSCallbackFunction.h: 16 (JSC::JSCallbackFunction::create): Use the NotNull version of placement 17 new to skip the NULL check. 18 19 * API/JSCallbackObject.h: Removed a conflicting, unnecessaray placement new. 20 21 (JSC::JSCallbackObject::create): 22 * debugger/DebuggerActivation.h: 23 (JSC::DebuggerActivation::create): 24 * heap/HandleHeap.cpp: 25 (JSC::HandleHeap::grow): 26 * heap/HandleHeap.h: 27 (JSC::HandleHeap::allocate): 28 * heap/MarkedBlock.cpp: 29 (JSC::MarkedBlock::create): 30 (JSC::MarkedBlock::recycle): 31 * jit/JITCode.h: 32 (JSC::JITCode::clear): 33 * jsc.cpp: 34 (GlobalObject::create): 35 * profiler/CallIdentifier.h: 36 * runtime/Arguments.h: 37 (JSC::Arguments::create): 38 * runtime/ArrayConstructor.h: 39 (JSC::ArrayConstructor::create): 40 * runtime/ArrayPrototype.h: 41 (JSC::ArrayPrototype::create): 42 * runtime/BooleanConstructor.h: 43 (JSC::BooleanConstructor::create): 44 * runtime/BooleanObject.h: 45 (JSC::BooleanObject::create): 46 * runtime/BooleanPrototype.h: 47 (JSC::BooleanPrototype::create): 48 * runtime/DateConstructor.h: 49 (JSC::DateConstructor::create): 50 * runtime/DateInstance.h: 51 (JSC::DateInstance::create): 52 * runtime/DatePrototype.h: 53 (JSC::DatePrototype::create): 54 * runtime/Error.h: 55 (JSC::StrictModeTypeErrorFunction::create): 56 * runtime/ErrorConstructor.h: 57 (JSC::ErrorConstructor::create): 58 * runtime/ErrorInstance.h: 59 (JSC::ErrorInstance::create): 60 * runtime/ErrorPrototype.h: 61 (JSC::ErrorPrototype::create): 62 * runtime/ExceptionHelpers.h: 63 (JSC::InterruptedExecutionError::create): 64 (JSC::TerminatedExecutionError::create): 65 * runtime/Executable.h: 66 (JSC::NativeExecutable::create): 67 (JSC::EvalExecutable::create): 68 (JSC::ProgramExecutable::create): 69 (JSC::FunctionExecutable::create): 70 * runtime/FunctionConstructor.h: 71 (JSC::FunctionConstructor::create): 72 * runtime/FunctionPrototype.h: 73 (JSC::FunctionPrototype::create): 74 * runtime/GetterSetter.h: 75 (JSC::GetterSetter::create): 76 * runtime/JSAPIValueWrapper.h: 77 (JSC::JSAPIValueWrapper::create): 78 * runtime/JSActivation.h: 79 (JSC::JSActivation::create): 80 * runtime/JSArray.h: 81 (JSC::JSArray::create): 82 * runtime/JSBoundFunction.cpp: 83 (JSC::JSBoundFunction::create): 84 * runtime/JSByteArray.h: 85 (JSC::JSByteArray::create): Use the NotNull version of placement 86 new to skip the NULL check. 87 88 * runtime/JSCell.h: Removed a conflicting, unnecessaray placement new. 89 90 * runtime/JSFunction.cpp: 91 (JSC::JSFunction::create): 92 * runtime/JSFunction.h: 93 (JSC::JSFunction::create): 94 * runtime/JSGlobalObject.h: 95 (JSC::JSGlobalObject::create): 96 * runtime/JSGlobalThis.h: 97 (JSC::JSGlobalThis::create): 98 * runtime/JSNotAnObject.h: 99 (JSC::JSNotAnObject::create): 100 * runtime/JSONObject.h: 101 (JSC::JSONObject::create): 102 * runtime/JSObject.h: 103 (JSC::JSFinalObject::create): 104 * runtime/JSPropertyNameIterator.cpp: 105 (JSC::JSPropertyNameIterator::create): 106 * runtime/JSPropertyNameIterator.h: 107 (JSC::JSPropertyNameIterator::create): 108 * runtime/JSStaticScopeObject.h: 109 (JSC::JSStaticScopeObject::create): 110 * runtime/JSString.cpp: 111 (JSC::StringObject::create): 112 * runtime/JSString.h: 113 (JSC::RopeBuilder::createNull): 114 (JSC::RopeBuilder::create): 115 (JSC::RopeBuilder::createHasOtherOwner): 116 * runtime/MathObject.h: 117 (JSC::MathObject::create): 118 * runtime/NativeErrorConstructor.h: 119 (JSC::NativeErrorConstructor::create): 120 * runtime/NativeErrorPrototype.h: 121 (JSC::NativeErrorPrototype::create): 122 * runtime/NumberConstructor.h: 123 (JSC::NumberConstructor::create): 124 * runtime/NumberObject.h: 125 (JSC::NumberObject::create): 126 * runtime/NumberPrototype.h: 127 (JSC::NumberPrototype::create): 128 * runtime/ObjectConstructor.h: 129 (JSC::ObjectConstructor::create): 130 * runtime/ObjectPrototype.h: 131 (JSC::ObjectPrototype::create): 132 * runtime/RegExp.cpp: 133 (JSC::RegExp::createWithoutCaching): 134 * runtime/RegExpConstructor.h: 135 (JSC::RegExpConstructor::create): 136 * runtime/RegExpMatchesArray.h: 137 (JSC::RegExpMatchesArray::create): 138 * runtime/RegExpObject.h: 139 (JSC::RegExpObject::create): 140 * runtime/RegExpPrototype.h: 141 (JSC::RegExpPrototype::create): 142 * runtime/ScopeChain.h: 143 (JSC::ScopeChainNode::create): 144 * runtime/StrictEvalActivation.h: 145 (JSC::StrictEvalActivation::create): 146 * runtime/StringConstructor.h: 147 (JSC::StringConstructor::create): 148 * runtime/StringObject.h: 149 (JSC::StringObject::create): 150 * runtime/StringPrototype.h: 151 (JSC::StringPrototype::create): 152 * runtime/Structure.h: 153 (JSC::Structure::create): 154 (JSC::Structure::createStructure): 155 * runtime/StructureChain.h: 156 (JSC::StructureChain::create): 157 * testRegExp.cpp: 158 (GlobalObject::create): 159 * wtf/BitVector.cpp: 160 (WTF::BitVector::OutOfLineBits::create): Use the NotNull version of placement 161 new to skip the NULL check. 162 163 * wtf/BumpPointerAllocator.h: 164 (WTF::BumpPointerPool::create): Standardized spacing to make grep easier. 165 166 * wtf/ByteArray.cpp: 167 (WTF::ByteArray::create): 168 * wtf/Deque.h: 169 (WTF::::append): 170 (WTF::::prepend): Use NotNull, as above. 171 172 * wtf/FastAllocBase.h: Added a placement new, since this class would otherwise 173 hide the name of the global placement new. 174 175 (WTF::fastNew): Standardized spacing. Most of these functions don't need 176 NotNull, since they check for NULL, and the optimizer can see that. 177 178 * wtf/HashTable.h: 179 * wtf/HashTraits.h: 180 (WTF::SimpleClassHashTraits::constructDeletedValue): 181 * wtf/MetaAllocator.cpp: 182 (WTF::MetaAllocator::allocFreeSpaceNode): NotNull, as above. 183 184 * wtf/StdLibExtras.h: 185 (throw): This is our NotNull placement new. Declaring that we throw is 186 the C++ way to say that operator new will not return NULL. 187 188 * wtf/ThreadSpecific.h: 189 (WTF::T): 190 * wtf/Vector.h: 191 (WTF::::append): 192 (WTF::::tryAppend): 193 (WTF::::uncheckedAppend): 194 (WTF::::insert): 195 * wtf/text/AtomicStringHash.h: 196 * wtf/text/StringImpl.cpp: 197 (WTF::StringImpl::createUninitialized): 198 (WTF::StringImpl::reallocate): 199 * wtf/text/StringImpl.h: 200 (WTF::StringImpl::tryCreateUninitialized): 201 * wtf/text/StringStatics.cpp: 202 (WTF::AtomicString::init): Use NotNull, as above. 203 204 * yarr/YarrInterpreter.cpp: 205 (JSC::Yarr::Interpreter::allocDisjunctionContext): 206 (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext): 207 (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): Standardized 208 spacing for easy grep. 209 1 210 2011-12-19 Eric Carlson <eric.carlson@apple.com> 2 211 -
trunk/Source/JavaScriptCore/debugger/DebuggerActivation.h
r103083 r103243 37 37 static DebuggerActivation* create(JSGlobalData& globalData, JSObject* object) 38 38 { 39 DebuggerActivation* activation = new ( allocateCell<DebuggerActivation>(globalData.heap)) DebuggerActivation(globalData);39 DebuggerActivation* activation = new (NotNull, allocateCell<DebuggerActivation>(globalData.heap)) DebuggerActivation(globalData); 40 40 activation->finishCreation(globalData, object); 41 41 return activation; -
trunk/Source/JavaScriptCore/heap/HandleHeap.cpp
r95901 r103243 57 57 for (int i = m_blockStack.blockLength - 1; i >= 0; --i) { 58 58 Node* node = &block[i]; 59 new ( node) Node(this);59 new (NotNull, node) Node(this); 60 60 m_freeList.push(node); 61 61 } -
trunk/Source/JavaScriptCore/heap/HandleHeap.h
r95901 r103243 159 159 160 160 Node* node = m_freeList.pop(); 161 new ( node) Node(this);161 new (NotNull, node) Node(this); 162 162 m_immediateList.push(node); 163 163 return toHandle(node); -
trunk/Source/JavaScriptCore/heap/MarkedBlock.cpp
r103083 r103243 38 38 if (!static_cast<bool>(allocation)) 39 39 CRASH(); 40 return new ( allocation.base()) MarkedBlock(allocation, heap, cellSize);40 return new (NotNull, allocation.base()) MarkedBlock(allocation, heap, cellSize); 41 41 } 42 42 43 43 MarkedBlock* MarkedBlock::recycle(MarkedBlock* block, size_t cellSize) 44 44 { 45 return new ( block) MarkedBlock(block->m_allocation, block->m_heap, cellSize);45 return new (NotNull, block) MarkedBlock(block->m_allocation, block->m_heap, cellSize); 46 46 } 47 47 -
trunk/Source/JavaScriptCore/jit/JITCode.h
r99787 r103243 148 148 { 149 149 m_ref.~CodeRef(); 150 new ( &m_ref) CodeRef();150 new (NotNull, &m_ref) CodeRef(); 151 151 } 152 152 -
trunk/Source/JavaScriptCore/jsc.cpp
r102953 r103243 157 157 static GlobalObject* create(JSGlobalData& globalData, Structure* structure, const Vector<UString>& arguments) 158 158 { 159 GlobalObject* object = new ( allocateCell<GlobalObject>(globalData.heap)) GlobalObject(globalData, structure);159 GlobalObject* object = new (NotNull, allocateCell<GlobalObject>(globalData.heap)) GlobalObject(globalData, structure); 160 160 object->finishCreation(globalData, arguments); 161 161 return object; -
trunk/Source/JavaScriptCore/profiler/CallIdentifier.h
r95901 r103243 88 88 static void constructDeletedValue(JSC::CallIdentifier& slot) 89 89 { 90 new ( &slot) JSC::CallIdentifier(JSC::UString(), JSC::UString(), std::numeric_limits<unsigned>::max());90 new (NotNull, &slot) JSC::CallIdentifier(JSC::UString(), JSC::UString(), std::numeric_limits<unsigned>::max()); 91 91 } 92 92 static bool isDeletedValue(const JSC::CallIdentifier& value) -
trunk/Source/JavaScriptCore/runtime/Arguments.h
r102545 r103243 60 60 static Arguments* create(JSGlobalData& globalData, CallFrame* callFrame) 61 61 { 62 Arguments* arguments = new ( allocateCell<Arguments>(globalData.heap)) Arguments(callFrame);62 Arguments* arguments = new (NotNull, allocateCell<Arguments>(globalData.heap)) Arguments(callFrame); 63 63 arguments->finishCreation(callFrame); 64 64 return arguments; -
trunk/Source/JavaScriptCore/runtime/ArrayConstructor.h
r99754 r103243 34 34 static ArrayConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype) 35 35 { 36 ArrayConstructor* constructor = new ( allocateCell<ArrayConstructor>(*exec->heap())) ArrayConstructor(globalObject, structure);36 ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(*exec->heap())) ArrayConstructor(globalObject, structure); 37 37 constructor->finishCreation(exec, arrayPrototype); 38 38 return constructor; -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h
r99754 r103243 36 36 static ArrayPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 37 37 { 38 ArrayPrototype* prototype = new ( allocateCell<ArrayPrototype>(*exec->heap())) ArrayPrototype(globalObject, structure);38 ArrayPrototype* prototype = new (NotNull, allocateCell<ArrayPrototype>(*exec->heap())) ArrayPrototype(globalObject, structure); 39 39 prototype->finishCreation(globalObject); 40 40 return prototype; -
trunk/Source/JavaScriptCore/runtime/BooleanConstructor.h
r98203 r103243 34 34 static BooleanConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype) 35 35 { 36 BooleanConstructor* constructor = new ( allocateCell<BooleanConstructor>(*exec->heap())) BooleanConstructor(globalObject, structure);36 BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(*exec->heap())) BooleanConstructor(globalObject, structure); 37 37 constructor->finishCreation(exec, booleanPrototype); 38 38 return constructor; -
trunk/Source/JavaScriptCore/runtime/BooleanObject.h
r94929 r103243 36 36 static BooleanObject* create(JSGlobalData& globalData, Structure* structure) 37 37 { 38 BooleanObject* boolean = new ( allocateCell<BooleanObject>(globalData.heap)) BooleanObject(globalData, structure);38 BooleanObject* boolean = new (NotNull, allocateCell<BooleanObject>(globalData.heap)) BooleanObject(globalData, structure); 39 39 boolean->finishCreation(globalData); 40 40 return boolean; -
trunk/Source/JavaScriptCore/runtime/BooleanPrototype.h
r99754 r103243 32 32 static BooleanPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 33 33 { 34 BooleanPrototype* prototype = new ( allocateCell<BooleanPrototype>(*exec->heap())) BooleanPrototype(exec, structure);34 BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(*exec->heap())) BooleanPrototype(exec, structure); 35 35 prototype->finishCreation(exec, globalObject); 36 36 return prototype; -
trunk/Source/JavaScriptCore/runtime/DateConstructor.h
r99754 r103243 34 34 static DateConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype) 35 35 { 36 DateConstructor* constructor = new ( allocateCell<DateConstructor>(*exec->heap())) DateConstructor(globalObject, structure);36 DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(*exec->heap())) DateConstructor(globalObject, structure); 37 37 constructor->finishCreation(exec, datePrototype); 38 38 return constructor; -
trunk/Source/JavaScriptCore/runtime/DateInstance.h
r103083 r103243 43 43 static DateInstance* create(ExecState* exec, Structure* structure, double date) 44 44 { 45 DateInstance* instance = new ( allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);45 DateInstance* instance = new (NotNull, allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure); 46 46 instance->finishCreation(exec->globalData(), date); 47 47 return instance; … … 50 50 static DateInstance* create(ExecState* exec, Structure* structure) 51 51 { 52 DateInstance* instance = new ( allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);52 DateInstance* instance = new (NotNull, allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure); 53 53 instance->finishCreation(exec->globalData()); 54 54 return instance; -
trunk/Source/JavaScriptCore/runtime/DatePrototype.h
r99754 r103243 37 37 static DatePrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 38 38 { 39 DatePrototype* prototype = new ( allocateCell<DatePrototype>(*exec->heap())) DatePrototype(exec, structure);39 DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(*exec->heap())) DatePrototype(exec, structure); 40 40 prototype->finishCreation(exec, globalObject); 41 41 return prototype; -
trunk/Source/JavaScriptCore/runtime/Error.h
r103083 r103243 90 90 static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message) 91 91 { 92 StrictModeTypeErrorFunction* function = new ( allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message);92 StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message); 93 93 function->finishCreation(exec->globalData(), exec->globalData().propertyNames->emptyIdentifier); 94 94 return function; -
trunk/Source/JavaScriptCore/runtime/ErrorConstructor.h
r98203 r103243 35 35 static ErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype) 36 36 { 37 ErrorConstructor* constructor = new ( allocateCell<ErrorConstructor>(*exec->heap())) ErrorConstructor(globalObject, structure);37 ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(*exec->heap())) ErrorConstructor(globalObject, structure); 38 38 constructor->finishCreation(exec, errorPrototype); 39 39 return constructor; -
trunk/Source/JavaScriptCore/runtime/ErrorInstance.h
r98747 r103243 39 39 static ErrorInstance* create(JSGlobalData& globalData, Structure* structure, const UString& message) 40 40 { 41 ErrorInstance* instance = new ( allocateCell<ErrorInstance>(globalData.heap)) ErrorInstance(globalData, structure);41 ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(globalData.heap)) ErrorInstance(globalData, structure); 42 42 instance->finishCreation(globalData, message); 43 43 return instance; … … 46 46 { 47 47 if (message.isUndefined()) { 48 ErrorInstance* instance = new ( allocateCell<ErrorInstance>(*exec->heap())) ErrorInstance(exec->globalData(), structure);48 ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(*exec->heap())) ErrorInstance(exec->globalData(), structure); 49 49 instance->finishCreation(exec->globalData(), UString("", 0)); 50 50 return instance; -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.h
r99754 r103243 34 34 static ErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 35 35 { 36 ErrorPrototype* prototype = new ( allocateCell<ErrorPrototype>(*exec->heap())) ErrorPrototype(exec, structure);36 ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(*exec->heap())) ErrorPrototype(exec, structure); 37 37 prototype->finishCreation(exec, globalObject); 38 38 return prototype; -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.h
r98932 r103243 70 70 static InterruptedExecutionError* create(JSGlobalData& globalData) 71 71 { 72 InterruptedExecutionError* error = new ( allocateCell<InterruptedExecutionError>(globalData.heap)) InterruptedExecutionError(globalData);72 InterruptedExecutionError* error = new (NotNull, allocateCell<InterruptedExecutionError>(globalData.heap)) InterruptedExecutionError(globalData); 73 73 error->finishCreation(globalData); 74 74 return error; … … 97 97 static TerminatedExecutionError* create(JSGlobalData& globalData) 98 98 { 99 TerminatedExecutionError* error = new ( allocateCell<TerminatedExecutionError>(globalData.heap)) TerminatedExecutionError(globalData);99 TerminatedExecutionError* error = new (NotNull, allocateCell<TerminatedExecutionError>(globalData.heap)) TerminatedExecutionError(globalData); 100 100 error->finishCreation(globalData); 101 101 return error; -
trunk/Source/JavaScriptCore/runtime/Executable.h
r103083 r103243 187 187 NativeExecutable* executable; 188 188 if (!callThunk) { 189 executable = new ( allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor);189 executable = new (NotNull, allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor); 190 190 executable->finishCreation(globalData, JITCode(), JITCode(), intrinsic); 191 191 } else { 192 executable = new ( allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor);192 executable = new (NotNull, allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor); 193 193 executable->finishCreation(globalData, JITCode::HostFunction(callThunk), JITCode::HostFunction(constructThunk), intrinsic); 194 194 } … … 202 202 { 203 203 ASSERT(!globalData.canUseJIT()); 204 NativeExecutable* executable = new ( allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor);204 NativeExecutable* executable = new (NotNull, allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor); 205 205 executable->finishCreation(globalData); 206 206 globalData.heap.addFinalizer(executable, &finalize); … … 349 349 static EvalExecutable* create(ExecState* exec, const SourceCode& source, bool isInStrictContext) 350 350 { 351 EvalExecutable* executable = new ( allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext);351 EvalExecutable* executable = new (NotNull, allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext); 352 352 executable->finishCreation(exec->globalData()); 353 353 exec->globalData().heap.addFinalizer(executable, &finalize); … … 390 390 static ProgramExecutable* create(ExecState* exec, const SourceCode& source) 391 391 { 392 ProgramExecutable* executable = new ( allocateCell<ProgramExecutable>(*exec->heap())) ProgramExecutable(exec, source);392 ProgramExecutable* executable = new (NotNull, allocateCell<ProgramExecutable>(*exec->heap())) ProgramExecutable(exec, source); 393 393 executable->finishCreation(exec->globalData()); 394 394 exec->globalData().heap.addFinalizer(executable, &finalize); … … 459 459 static FunctionExecutable* create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine) 460 460 { 461 FunctionExecutable* executable = new ( allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext);461 FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext); 462 462 executable->finishCreation(exec->globalData(), name, firstLine, lastLine); 463 463 exec->globalData().heap.addFinalizer(executable, &finalize); … … 467 467 static FunctionExecutable* create(JSGlobalData& globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine) 468 468 { 469 FunctionExecutable* executable = new ( allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext);469 FunctionExecutable* executable = new (NotNull, allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext); 470 470 executable->finishCreation(globalData, name, firstLine, lastLine); 471 471 globalData.heap.addFinalizer(executable, &finalize); -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.h
r99167 r103243 38 38 static FunctionConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* functionPrototype) 39 39 { 40 FunctionConstructor* constructor = new ( allocateCell<FunctionConstructor>(*exec->heap())) FunctionConstructor(globalObject, structure);40 FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(*exec->heap())) FunctionConstructor(globalObject, structure); 41 41 constructor->finishCreation(exec, functionPrototype); 42 42 return constructor; -
trunk/Source/JavaScriptCore/runtime/FunctionPrototype.h
r97097 r103243 32 32 static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 33 33 { 34 FunctionPrototype* prototype = new ( allocateCell<FunctionPrototype>(*exec->heap())) FunctionPrototype(globalObject, structure);34 FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(*exec->heap())) FunctionPrototype(globalObject, structure); 35 35 prototype->finishCreation(exec, exec->propertyNames().nullIdentifier); 36 36 return prototype; -
trunk/Source/JavaScriptCore/runtime/GetterSetter.h
r96346 r103243 49 49 static GetterSetter* create(ExecState* exec) 50 50 { 51 GetterSetter* getterSetter = new ( allocateCell<GetterSetter>(*exec->heap())) GetterSetter(exec);51 GetterSetter* getterSetter = new (NotNull, allocateCell<GetterSetter>(*exec->heap())) GetterSetter(exec); 52 52 getterSetter->finishCreation(exec->globalData()); 53 53 return getterSetter; -
trunk/Source/JavaScriptCore/runtime/JSAPIValueWrapper.h
r97620 r103243 47 47 static JSAPIValueWrapper* create(ExecState* exec, JSValue value) 48 48 { 49 JSAPIValueWrapper* wrapper = new ( allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec);49 JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec); 50 50 wrapper->finishCreation(exec, value); 51 51 return wrapper; -
trunk/Source/JavaScriptCore/runtime/JSActivation.h
r102545 r103243 49 49 static JSActivation* create(JSGlobalData& globalData, CallFrame* callFrame, FunctionExecutable* funcExec) 50 50 { 51 JSActivation* activation = new ( allocateCell<JSActivation>(globalData.heap)) JSActivation(callFrame, funcExec);51 JSActivation* activation = new (NotNull, allocateCell<JSActivation>(globalData.heap)) JSActivation(callFrame, funcExec); 52 52 activation->finishCreation(callFrame); 53 53 return activation; -
trunk/Source/JavaScriptCore/runtime/JSArray.h
r103083 r103243 77 77 static JSArray* create(JSGlobalData& globalData, Structure* structure) 78 78 { 79 JSArray* array = new ( allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure);79 JSArray* array = new (NotNull, allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure); 80 80 array->finishCreation(globalData); 81 81 return array; … … 84 84 static JSArray* create(JSGlobalData& globalData, Structure* structure, unsigned initialLength, ArrayCreationMode createMode) 85 85 { 86 JSArray* array = new ( allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure);86 JSArray* array = new (NotNull, allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure); 87 87 array->finishCreation(globalData, initialLength, createMode); 88 88 return array; … … 91 91 static JSArray* create(JSGlobalData& globalData, Structure* structure, const ArgList& initialValues) 92 92 { 93 JSArray* array = new ( allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure);93 JSArray* array = new (NotNull, allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure); 94 94 array->finishCreation(globalData, initialValues); 95 95 return array; … … 98 98 static JSArray* create(JSGlobalData& globalData, Structure* structure, const JSValue* values, size_t length) 99 99 { 100 JSArray* array = new ( allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure);100 JSArray* array = new (NotNull, allocateCell<JSArray>(globalData.heap)) JSArray(globalData, structure); 101 101 array->finishCreation(globalData, values, length); 102 102 return array; -
trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp
r103083 r103243 83 83 84 84 NativeExecutable* executable = exec->globalData().getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor); 85 JSBoundFunction* function = new ( allocateCell<JSBoundFunction>(*exec->heap())) JSBoundFunction(exec, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);85 JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(*exec->heap())) JSBoundFunction(exec, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs); 86 86 87 87 function->finishCreation(exec, executable, length, name); -
trunk/Source/JavaScriptCore/runtime/JSByteArray.h
r103083 r103243 82 82 static JSByteArray* create(ExecState* exec, Structure* structure, ByteArray* storage) 83 83 { 84 JSByteArray* array = new ( allocateCell<JSByteArray>(*exec->heap())) JSByteArray(exec, structure, storage);84 JSByteArray* array = new (NotNull, allocateCell<JSByteArray>(*exec->heap())) JSByteArray(exec, structure, storage); 85 85 array->finishCreation(exec); 86 86 return array; -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r103083 r103243 66 66 JSCell(CreatingEarlyCellTag); 67 67 68 public:69 void* operator new(size_t, void* placementNewDestination) { return placementNewDestination; } // Used for initialization after GC allocation.70 71 68 protected: 72 69 JSCell(JSGlobalData&, Structure*); -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r103083 r103243 61 61 { 62 62 NativeExecutable* executable = exec->globalData().getHostFunction(nativeFunction, nativeConstructor); 63 JSFunction* function = new ( allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, globalObject, globalObject->functionStructure());63 JSFunction* function = new (NotNull, allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, globalObject, globalObject->functionStructure()); 64 64 // Can't do this during initialization because getHostFunction might do a GC allocation. 65 65 function->finishCreation(exec, executable, length, name); … … 69 69 JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const Identifier& name, NativeExecutable* nativeExecutable) 70 70 { 71 JSFunction* function = new ( allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, globalObject, globalObject->functionStructure());71 JSFunction* function = new (NotNull, allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, globalObject, globalObject->functionStructure()); 72 72 function->finishCreation(exec, nativeExecutable, length, name); 73 73 return function; -
trunk/Source/JavaScriptCore/runtime/JSFunction.h
r103083 r103243 59 59 static JSFunction* create(ExecState* exec, FunctionExecutable* executable, ScopeChainNode* scopeChain) 60 60 { 61 JSFunction* function = new ( allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, executable, scopeChain);61 JSFunction* function = new (NotNull, allocateCell<JSFunction>(*exec->heap())) JSFunction(exec, executable, scopeChain); 62 62 ASSERT(function->structure()->globalObject()); 63 63 function->finishCreation(exec, executable, scopeChain); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r103083 r103243 161 161 static JSGlobalObject* create(JSGlobalData& globalData, Structure* structure) 162 162 { 163 JSGlobalObject* globalObject = new ( allocateCell<JSGlobalObject>(globalData.heap)) JSGlobalObject(globalData, structure);163 JSGlobalObject* globalObject = new (NotNull, allocateCell<JSGlobalObject>(globalData.heap)) JSGlobalObject(globalData, structure); 164 164 globalObject->finishCreation(globalData); 165 165 return globalObject; -
trunk/Source/JavaScriptCore/runtime/JSGlobalThis.h
r98909 r103243 37 37 static JSGlobalThis* create(JSGlobalData& globalData, Structure* structure) 38 38 { 39 JSGlobalThis* globalThis = new ( allocateCell<JSGlobalThis>(globalData.heap)) JSGlobalThis(globalData, structure);39 JSGlobalThis* globalThis = new (NotNull, allocateCell<JSGlobalThis>(globalData.heap)) JSGlobalThis(globalData, structure); 40 40 globalThis->finishCreation(globalData); 41 41 return globalThis; -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h
r99754 r103243 49 49 static JSNotAnObject* create(ExecState* exec) 50 50 { 51 JSNotAnObject* object = new ( allocateCell<JSNotAnObject>(*exec->heap())) JSNotAnObject(exec);51 JSNotAnObject* object = new (NotNull, allocateCell<JSNotAnObject>(*exec->heap())) JSNotAnObject(exec); 52 52 object->finishCreation(exec->globalData()); 53 53 return object; -
trunk/Source/JavaScriptCore/runtime/JSONObject.h
r99754 r103243 39 39 static JSONObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 40 40 { 41 JSONObject* object = new ( allocateCell<JSONObject>(*exec->heap())) JSONObject(globalObject, structure);41 JSONObject* object = new (NotNull, allocateCell<JSONObject>(*exec->heap())) JSONObject(globalObject, structure); 42 42 object->finishCreation(globalObject); 43 43 return object; -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r103083 r103243 346 346 static JSFinalObject* create(ExecState* exec, Structure* structure) 347 347 { 348 JSFinalObject* finalObject = new ( allocateCell<JSFinalObject>(*exec->heap())) JSFinalObject(exec->globalData(), structure);348 JSFinalObject* finalObject = new (NotNull, allocateCell<JSFinalObject>(*exec->heap())) JSFinalObject(exec->globalData(), structure); 349 349 finalObject->finishCreation(exec->globalData()); 350 350 return finalObject; -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
r103083 r103243 59 59 numCacheableSlots = o->structure()->propertyStorageSize(); 60 60 61 JSPropertyNameIterator* jsPropertyNameIterator = new ( allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots);61 JSPropertyNameIterator* jsPropertyNameIterator = new (NotNull, allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots); 62 62 jsPropertyNameIterator->finishCreation(exec, propertyNames.data()); 63 63 -
trunk/Source/JavaScriptCore/runtime/JSPropertyNameIterator.h
r103083 r103243 49 49 static JSPropertyNameIterator* create(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot) 50 50 { 51 JSPropertyNameIterator* iterator = new ( allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNameArrayData, numCacheableSlot);51 JSPropertyNameIterator* iterator = new (NotNull, allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNameArrayData, numCacheableSlot); 52 52 iterator->finishCreation(exec, propertyNameArrayData); 53 53 return iterator; -
trunk/Source/JavaScriptCore/runtime/JSStaticScopeObject.h
r103083 r103243 37 37 static JSStaticScopeObject* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes) 38 38 { 39 JSStaticScopeObject* scopeObject = new ( allocateCell<JSStaticScopeObject>(*exec->heap())) JSStaticScopeObject(exec);39 JSStaticScopeObject* scopeObject = new (NotNull, allocateCell<JSStaticScopeObject>(*exec->heap())) JSStaticScopeObject(exec); 40 40 scopeObject->finishCreation(exec, identifier, value, attributes); 41 41 return scopeObject; -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r103083 r103243 245 245 inline StringObject* StringObject::create(ExecState* exec, JSGlobalObject* globalObject, JSString* string) 246 246 { 247 StringObject* object = new ( allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), globalObject->stringObjectStructure());247 StringObject* object = new (NotNull, allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), globalObject->stringObjectStructure()); 248 248 object->finishCreation(exec->globalData(), string); 249 249 return object; -
trunk/Source/JavaScriptCore/runtime/JSString.h
r103083 r103243 164 164 static JSString* createNull(JSGlobalData& globalData) 165 165 { 166 JSString* newString = new ( allocateCell<JSString>(globalData.heap)) JSString(globalData);166 JSString* newString = new (NotNull, allocateCell<JSString>(globalData.heap)) JSString(globalData); 167 167 newString->finishCreation(globalData); 168 168 return newString; … … 175 175 size_t length = value->length(); 176 176 size_t cost = value->cost(); 177 JSString* newString = new ( allocateCell<JSString>(globalData.heap)) JSString(globalData, value);177 JSString* newString = new (NotNull, allocateCell<JSString>(globalData.heap)) JSString(globalData, value); 178 178 newString->finishCreation(globalData, length, cost); 179 179 return newString; … … 181 181 static JSString* create(JSGlobalData& globalData, JSString* s1, JSString* s2) 182 182 { 183 JSString* newString = new ( allocateCell<JSString>(globalData.heap)) JSString(globalData);183 JSString* newString = new (NotNull, allocateCell<JSString>(globalData.heap)) JSString(globalData); 184 184 newString->finishCreation(globalData, s1, s2); 185 185 return newString; … … 187 187 static JSString* create(JSGlobalData& globalData, JSString* s1, JSString* s2, JSString* s3) 188 188 { 189 JSString* newString = new ( allocateCell<JSString>(globalData.heap)) JSString(globalData);189 JSString* newString = new (NotNull, allocateCell<JSString>(globalData.heap)) JSString(globalData); 190 190 newString->finishCreation(globalData, s1, s2, s3); 191 191 return newString; … … 195 195 ASSERT(value); 196 196 size_t length = value->length(); 197 JSString* newString = new ( allocateCell<JSString>(globalData.heap)) JSString(globalData, value);197 JSString* newString = new (NotNull, allocateCell<JSString>(globalData.heap)) JSString(globalData, value); 198 198 newString->finishCreation(globalData, length); 199 199 return newString; -
trunk/Source/JavaScriptCore/runtime/MathObject.h
r99754 r103243 35 35 static MathObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 36 36 { 37 MathObject* object = new ( allocateCell<MathObject>(*exec->heap())) MathObject(globalObject, structure);37 MathObject* object = new (NotNull, allocateCell<MathObject>(*exec->heap())) MathObject(globalObject, structure); 38 38 object->finishCreation(exec, globalObject); 39 39 return object; -
trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.h
r98203 r103243 37 37 static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& name) 38 38 { 39 NativeErrorConstructor* constructor = new ( allocateCell<NativeErrorConstructor>(*exec->heap())) NativeErrorConstructor(globalObject, structure);39 NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(*exec->heap())) NativeErrorConstructor(globalObject, structure); 40 40 constructor->finishCreation(exec, globalObject, prototypeStructure, name); 41 41 return constructor; -
trunk/Source/JavaScriptCore/runtime/NativeErrorPrototype.h
r95108 r103243 36 36 static NativeErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& name, NativeErrorConstructor* constructor) 37 37 { 38 NativeErrorPrototype* prototype = new ( allocateCell<NativeErrorPrototype>(*exec->heap())) NativeErrorPrototype(exec, structure);38 NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(*exec->heap())) NativeErrorPrototype(exec, structure); 39 39 prototype->finishCreation(exec, globalObject, name, constructor); 40 40 return prototype; -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.h
r99754 r103243 34 34 static NumberConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, NumberPrototype* numberPrototype) 35 35 { 36 NumberConstructor* constructor = new ( allocateCell<NumberConstructor>(*exec->heap())) NumberConstructor(globalObject, structure);36 NumberConstructor* constructor = new (NotNull, allocateCell<NumberConstructor>(*exec->heap())) NumberConstructor(globalObject, structure); 37 37 constructor->finishCreation(exec, numberPrototype); 38 38 return constructor; -
trunk/Source/JavaScriptCore/runtime/NumberObject.h
r96673 r103243 36 36 static NumberObject* create(JSGlobalData& globalData, Structure* structure) 37 37 { 38 NumberObject* number = new ( allocateCell<NumberObject>(globalData.heap)) NumberObject(globalData, structure);38 NumberObject* number = new (NotNull, allocateCell<NumberObject>(globalData.heap)) NumberObject(globalData, structure); 39 39 number->finishCreation(globalData); 40 40 return number; -
trunk/Source/JavaScriptCore/runtime/NumberPrototype.h
r99754 r103243 32 32 static NumberPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 33 33 { 34 NumberPrototype* prototype = new ( allocateCell<NumberPrototype>(*exec->heap())) NumberPrototype(exec, structure);34 NumberPrototype* prototype = new (NotNull, allocateCell<NumberPrototype>(*exec->heap())) NumberPrototype(exec, structure); 35 35 prototype->finishCreation(exec, globalObject); 36 36 return prototype; -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.h
r99754 r103243 34 34 static ObjectConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ObjectPrototype* objectPrototype) 35 35 { 36 ObjectConstructor* constructor = new ( allocateCell<ObjectConstructor>(*exec->heap())) ObjectConstructor(globalObject, structure);36 ObjectConstructor* constructor = new (NotNull, allocateCell<ObjectConstructor>(*exec->heap())) ObjectConstructor(globalObject, structure); 37 37 constructor->finishCreation(exec, objectPrototype); 38 38 return constructor; -
trunk/Source/JavaScriptCore/runtime/ObjectPrototype.h
r99754 r103243 32 32 static ObjectPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) 33 33 { 34 ObjectPrototype* prototype = new ( allocateCell<ObjectPrototype>(*exec->heap())) ObjectPrototype(exec, structure);34 ObjectPrototype* prototype = new (NotNull, allocateCell<ObjectPrototype>(*exec->heap())) ObjectPrototype(exec, structure); 35 35 prototype->finishCreation(exec->globalData(), globalObject); 36 36 return prototype; -
trunk/Source/JavaScriptCore/runtime/RegExp.cpp
r103083 r103243 260 260 RegExp* RegExp::createWithoutCaching(JSGlobalData& globalData, const UString& patternString, RegExpFlags flags) 261 261 { 262 RegExp* regExp = new ( allocateCell<RegExp>(globalData.heap)) RegExp(globalData, patternString, flags);262 RegExp* regExp = new (NotNull, allocateCell<RegExp>(globalData.heap)) RegExp(globalData, patternString, flags); 263 263 regExp->finishCreation(globalData); 264 264 return regExp; -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.h
r103083 r103243 62 62 static RegExpConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExpPrototype* regExpPrototype) 63 63 { 64 RegExpConstructor* constructor = new ( allocateCell<RegExpConstructor>(*exec->heap())) RegExpConstructor(globalObject, structure);64 RegExpConstructor* constructor = new (NotNull, allocateCell<RegExpConstructor>(*exec->heap())) RegExpConstructor(globalObject, structure); 65 65 constructor->finishCreation(exec, regExpPrototype); 66 66 return constructor; -
trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
r103083 r103243 34 34 static RegExpMatchesArray* create(ExecState* exec, RegExpConstructorPrivate* ctorPrivate) 35 35 { 36 RegExpMatchesArray* regExp = new ( allocateCell<RegExpMatchesArray>(*exec->heap())) RegExpMatchesArray(exec);36 RegExpMatchesArray* regExp = new (NotNull, allocateCell<RegExpMatchesArray>(*exec->heap())) RegExpMatchesArray(exec); 37 37 regExp->finishCreation(exec->globalData(), ctorPrivate); 38 38 return regExp; -
trunk/Source/JavaScriptCore/runtime/RegExpObject.h
r103083 r103243 33 33 static RegExpObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp) 34 34 { 35 RegExpObject* object = new ( allocateCell<RegExpObject>(*exec->heap())) RegExpObject(globalObject, structure, regExp);35 RegExpObject* object = new (NotNull, allocateCell<RegExpObject>(*exec->heap())) RegExpObject(globalObject, structure, regExp); 36 36 object->finishCreation(globalObject); 37 37 return object; … … 40 40 static RegExpObject* create(JSGlobalData& globalData, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp) 41 41 { 42 RegExpObject* object = new ( allocateCell<RegExpObject>(globalData.heap)) RegExpObject(globalObject, structure, regExp);42 RegExpObject* object = new (NotNull, allocateCell<RegExpObject>(globalData.heap)) RegExpObject(globalObject, structure, regExp); 43 43 object->finishCreation(globalObject); 44 44 return object; -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.h
r99754 r103243 33 33 static RegExpPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp) 34 34 { 35 RegExpPrototype* prototype = new ( allocateCell<RegExpPrototype>(*exec->heap())) RegExpPrototype(globalObject, structure, regExp);35 RegExpPrototype* prototype = new (NotNull, allocateCell<RegExpPrototype>(*exec->heap())) RegExpPrototype(globalObject, structure, regExp); 36 36 prototype->finishCreation(globalObject); 37 37 return prototype; -
trunk/Source/JavaScriptCore/runtime/ScopeChain.h
r103083 r103243 58 58 static ScopeChainNode* create(ExecState* exec, ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 59 59 { 60 ScopeChainNode* node = new ( allocateCell<ScopeChainNode>(*exec->heap())) ScopeChainNode(next, object, globalData, globalObject, globalThis);60 ScopeChainNode* node = new (NotNull, allocateCell<ScopeChainNode>(*exec->heap())) ScopeChainNode(next, object, globalData, globalObject, globalThis); 61 61 node->finishCreation(globalData, globalObject); 62 62 return node; … … 64 64 static ScopeChainNode* create(ScopeChainNode* next, JSObject* object, JSGlobalData* globalData, JSGlobalObject* globalObject, JSObject* globalThis) 65 65 { 66 ScopeChainNode* node = new ( allocateCell<ScopeChainNode>(globalData->heap)) ScopeChainNode(next, object, globalData, globalObject, globalThis);66 ScopeChainNode* node = new (NotNull, allocateCell<ScopeChainNode>(globalData->heap)) ScopeChainNode(next, object, globalData, globalObject, globalThis); 67 67 node->finishCreation(globalData, globalObject); 68 68 return node; -
trunk/Source/JavaScriptCore/runtime/StrictEvalActivation.h
r98593 r103243 37 37 static StrictEvalActivation* create(ExecState* exec) 38 38 { 39 StrictEvalActivation* activation = new ( allocateCell<StrictEvalActivation>(*exec->heap())) StrictEvalActivation(exec);39 StrictEvalActivation* activation = new (NotNull, allocateCell<StrictEvalActivation>(*exec->heap())) StrictEvalActivation(exec); 40 40 activation->finishCreation(exec->globalData()); 41 41 return activation; -
trunk/Source/JavaScriptCore/runtime/StringConstructor.h
r99754 r103243 34 34 static StringConstructor* create(ExecState* exec, JSGlobalObject* globalObject , Structure* structure, StringPrototype* stringPrototype) 35 35 { 36 StringConstructor* constructor = new ( allocateCell<StringConstructor>(*exec->heap())) StringConstructor(globalObject, structure);36 StringConstructor* constructor = new (NotNull, allocateCell<StringConstructor>(*exec->heap())) StringConstructor(globalObject, structure); 37 37 constructor->finishCreation(exec, stringPrototype); 38 38 return constructor; -
trunk/Source/JavaScriptCore/runtime/StringObject.h
r103083 r103243 34 34 { 35 35 JSString* string = jsEmptyString(exec); 36 StringObject* object = new ( allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), structure);36 StringObject* object = new (NotNull, allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), structure); 37 37 object->finishCreation(exec->globalData(), string); 38 38 return object; … … 40 40 static StringObject* create(ExecState* exec, Structure* structure, JSString* string) 41 41 { 42 StringObject* object = new ( allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), structure);42 StringObject* object = new (NotNull, allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), structure); 43 43 object->finishCreation(exec->globalData(), string); 44 44 return object; -
trunk/Source/JavaScriptCore/runtime/StringPrototype.h
r99754 r103243 38 38 { 39 39 JSString* empty = jsEmptyString(exec); 40 StringPrototype* prototype = new ( allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, structure);40 StringPrototype* prototype = new (NotNull, allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, structure); 41 41 prototype->finishCreation(exec, globalObject, empty); 42 42 return prototype; -
trunk/Source/JavaScriptCore/runtime/Structure.h
r103083 r103243 61 61 ASSERT(globalData.structureStructure); 62 62 ASSERT(classInfo); 63 Structure* structure = new ( allocateCell<Structure>(globalData.heap)) Structure(globalData, globalObject, prototype, typeInfo, classInfo);63 Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, globalObject, prototype, typeInfo, classInfo); 64 64 structure->finishCreation(globalData); 65 65 return structure; … … 189 189 { 190 190 ASSERT(!globalData.structureStructure); 191 Structure* structure = new ( allocateCell<Structure>(globalData.heap)) Structure(globalData);191 Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData); 192 192 structure->finishCreation(globalData, CreatingEarlyCell); 193 193 return structure; … … 204 204 { 205 205 ASSERT(globalData.structureStructure); 206 Structure* newStructure = new ( allocateCell<Structure>(globalData.heap)) Structure(globalData, structure);206 Structure* newStructure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, structure); 207 207 newStructure->finishCreation(globalData); 208 208 return newStructure; -
trunk/Source/JavaScriptCore/runtime/StructureChain.h
r103083 r103243 48 48 static StructureChain* create(JSGlobalData& globalData, Structure* head) 49 49 { 50 StructureChain* chain = new ( allocateCell<StructureChain>(globalData.heap)) StructureChain(globalData, globalData.structureChainStructure.get());50 StructureChain* chain = new (NotNull, allocateCell<StructureChain>(globalData.heap)) StructureChain(globalData, globalData.structureChainStructure.get()); 51 51 chain->finishCreation(globalData, head); 52 52 return chain; -
trunk/Source/JavaScriptCore/testRegExp.cpp
r102917 r103243 118 118 static GlobalObject* create(JSGlobalData& globalData, Structure* structure, const Vector<UString>& arguments) 119 119 { 120 return new ( allocateCell<GlobalObject>(globalData.heap)) GlobalObject(globalData, structure, arguments);120 return new (NotNull, allocateCell<GlobalObject>(globalData.heap)) GlobalObject(globalData, structure, arguments); 121 121 } 122 122 -
trunk/Source/JavaScriptCore/wtf/BitVector.cpp
r101639 r103243 77 77 numBits = (numBits + bitsInPointer() - 1) & ~(bitsInPointer() - 1); 78 78 size_t size = sizeof(OutOfLineBits) + sizeof(uintptr_t) * (numBits / bitsInPointer()); 79 OutOfLineBits* result = new ( fastMalloc(size)) OutOfLineBits(numBits);79 OutOfLineBits* result = new (NotNull, fastMalloc(size)) OutOfLineBits(numBits); 80 80 return result; 81 81 } -
trunk/Source/JavaScriptCore/wtf/BumpPointerAllocator.h
r95901 r103243 122 122 PageAllocation allocation = PageAllocation::allocate(poolSize); 123 123 if (!!allocation) 124 return new (allocation) BumpPointerPool(allocation);124 return new (allocation) BumpPointerPool(allocation); 125 125 return 0; 126 126 } -
trunk/Source/JavaScriptCore/wtf/ByteArray.cpp
r97876 r103243 35 35 unsigned char* buffer = new unsigned char[size + OBJECT_OFFSETOF(ByteArray, m_data)]; 36 36 ASSERT((reinterpret_cast<size_t>(buffer) & 3) == 0); 37 return adoptRef(new ( buffer) ByteArray(size));37 return adoptRef(new (NotNull, buffer) ByteArray(size)); 38 38 } 39 39 -
trunk/Source/JavaScriptCore/wtf/Deque.h
r99929 r103243 455 455 checkValidity(); 456 456 expandCapacityIfNeeded(); 457 new ( &m_buffer.buffer()[m_end]) T(value);457 new (NotNull, &m_buffer.buffer()[m_end]) T(value); 458 458 if (m_end == m_buffer.capacity() - 1) 459 459 m_end = 0; … … 472 472 else 473 473 --m_start; 474 new ( &m_buffer.buffer()[m_start]) T(value);474 new (NotNull, &m_buffer.buffer()[m_start]) T(value); 475 475 checkValidity(); 476 476 } -
trunk/Source/JavaScriptCore/wtf/FastAllocBase.h
r95901 r103243 91 91 #include "Assertions.h" 92 92 #include "FastMalloc.h" 93 #include "StdLibExtras.h" 93 94 #include "TypeTraits.h" 94 95 … … 123 124 ::WTF::fastFree(p); \ 124 125 } \ 126 void* operator new(size_t, NotNullTag, void* location) \ 127 { \ 128 ASSERT(location); \ 129 return location; \ 130 } \ 125 131 private: \ 126 132 typedef int ThisIsHereToForceASemicolonAfterThisMacro … … 139 145 140 146 fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew); 141 return ::new (p) T;147 return ::new (p) T; 142 148 } 143 149 … … 151 157 152 158 fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew); 153 return ::new (p) T(arg1);159 return ::new (p) T(arg1); 154 160 } 155 161 … … 163 169 164 170 fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew); 165 return ::new (p) T(arg1, arg2);171 return ::new (p) T(arg1, arg2); 166 172 } 167 173 … … 175 181 176 182 fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew); 177 return ::new (p) T(arg1, arg2, arg3);183 return ::new (p) T(arg1, arg2, arg3); 178 184 } 179 185 … … 187 193 188 194 fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew); 189 return ::new (p) T(arg1, arg2, arg3, arg4);195 return ::new (p) T(arg1, arg2, arg3, arg4); 190 196 } 191 197 … … 199 205 200 206 fastMallocMatchValidateMalloc(p, Internal::AllocTypeFastNew); 201 return ::new (p) T(arg1, arg2, arg3, arg4, arg5);207 return ::new (p) T(arg1, arg2, arg3, arg4, arg5); 202 208 } 203 209 … … 245 251 246 252 for (T* pObject = p, *pObjectEnd = pObject + count; pObject != pObjectEnd; ++pObject) 247 ::new (pObject) T;253 ::new (pObject) T; 248 254 249 255 return p; … … 287 293 288 294 for (T* pT = a.t, *pTEnd = pT + count; pT != pTEnd; ++pT) 289 ::new (pT) T;295 ::new (pT) T; 290 296 291 297 return a.t; -
trunk/Source/JavaScriptCore/wtf/HashTable.h
r102483 r103243 642 642 template<typename Traits, typename Value> static void initialize(Value& bucket) 643 643 { 644 new ( &bucket) Value(Traits::emptyValue());644 new (NotNull, &bucket) Value(Traits::emptyValue()); 645 645 } 646 646 }; -
trunk/Source/JavaScriptCore/wtf/HashTraits.h
r102410 r103243 23 23 24 24 #include "HashFunctions.h" 25 #include "StdLibExtras.h" 25 26 #include "TypeTraits.h" 26 27 #include <utility> … … 106 107 template<typename T> struct SimpleClassHashTraits : GenericHashTraits<T> { 107 108 static const bool emptyValueIsZero = true; 108 static void constructDeletedValue(T& slot) { new ( &slot) T(HashTableDeletedValue); }109 static void constructDeletedValue(T& slot) { new (NotNull, &slot) T(HashTableDeletedValue); } 109 110 static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); } 110 111 }; -
trunk/Source/JavaScriptCore/wtf/MetaAllocator.cpp
r96936 r103243 398 398 m_mallocBalance++; 399 399 #endif 400 return new ( fastMalloc(sizeof(FreeSpaceNode))) FreeSpaceNode(0, 0);400 return new (NotNull, fastMalloc(sizeof(FreeSpaceNode))) FreeSpaceNode(0, 0); 401 401 } 402 402 -
trunk/Source/JavaScriptCore/wtf/StdLibExtras.h
r97675 r103243 276 276 } // namespace WTF 277 277 278 // This version of placement new omits a 0 check. 279 enum NotNullTag { NotNull }; 280 inline void* operator new(size_t, NotNullTag, void* location) 281 { 282 ASSERT(location); 283 return location; 284 } 285 278 286 using WTF::binarySearch; 279 287 using WTF::bitwise_cast; -
trunk/Source/JavaScriptCore/wtf/ThreadSpecific.h
r101483 r103243 254 254 ptr = static_cast<T*>(fastZeroedMalloc(sizeof(T))); 255 255 set(ptr); 256 new ( ptr) T;256 new (NotNull, ptr) T; 257 257 } 258 258 return ptr; -
trunk/Source/JavaScriptCore/wtf/Vector.h
r99733 r103243 75 75 { 76 76 for (T* cur = begin; cur != end; ++cur) 77 new ( cur) T;77 new (NotNull, cur) T; 78 78 } 79 79 }; … … 97 97 { 98 98 while (src != srcEnd) { 99 new ( dst) T(*src);99 new (NotNull, dst) T(*src); 100 100 #if COMPILER(SUNCC) && __SUNPRO_CC <= 0x590 101 101 const_cast<T*>(src)->~T(); // Work around obscure SunCC 12 compiler bug. … … 116 116 --srcEnd; 117 117 --dstEnd; 118 new ( dstEnd) T(*srcEnd);118 new (NotNull, dstEnd) T(*srcEnd); 119 119 srcEnd->~T(); 120 120 } … … 145 145 { 146 146 while (src != srcEnd) { 147 new ( dst) T(*src);147 new (NotNull, dst) T(*src); 148 148 ++dst; 149 149 ++src; … … 170 170 { 171 171 while (dst != dstEnd) { 172 new ( dst) T(val);172 new (NotNull, dst) T(val); 173 173 ++dst; 174 174 } … … 928 928 T* dest = end(); 929 929 for (size_t i = 0; i < dataSize; ++i) 930 new ( &dest[i]) T(data[i]);930 new (NotNull, &dest[i]) T(data[i]); 931 931 m_size = newSize; 932 932 } … … 946 946 T* dest = end(); 947 947 for (size_t i = 0; i < dataSize; ++i) 948 new ( &dest[i]) T(data[i]);948 new (NotNull, &dest[i]) T(data[i]); 949 949 m_size = newSize; 950 950 return true; … … 968 968 // however, because it subverts implicit conversions, so a better 969 969 // one is needed. 970 new ( end()) T(static_cast<T>(*ptr));970 new (NotNull, end()) T(static_cast<T>(*ptr)); 971 971 #else 972 new ( end()) T(*ptr);972 new (NotNull, end()) T(*ptr); 973 973 #endif 974 974 ++m_size; … … 983 983 ASSERT(size() < capacity()); 984 984 const U* ptr = &val; 985 new ( end()) T(*ptr);985 new (NotNull, end()) T(*ptr); 986 986 ++m_size; 987 987 } … … 1011 1011 TypeOperations::moveOverlapping(spot, end(), spot + dataSize); 1012 1012 for (size_t i = 0; i < dataSize; ++i) 1013 new ( &spot[i]) T(data[i]);1013 new (NotNull, &spot[i]) T(data[i]); 1014 1014 m_size = newSize; 1015 1015 } … … 1027 1027 T* spot = begin() + position; 1028 1028 TypeOperations::moveOverlapping(spot, end(), spot + 1); 1029 new ( spot) T(*data);1029 new (NotNull, spot) T(*data); 1030 1030 ++m_size; 1031 1031 } -
trunk/Source/JavaScriptCore/wtf/text/AtomicStringHash.h
r95901 r103243 52 52 template<> struct HashTraits<WTF::AtomicString> : GenericHashTraits<WTF::AtomicString> { 53 53 static const bool emptyValueIsZero = true; 54 static void constructDeletedValue(WTF::AtomicString& slot) { new ( &slot) WTF::AtomicString(HashTableDeletedValue); }54 static void constructDeletedValue(WTF::AtomicString& slot) { new (NotNull, &slot) WTF::AtomicString(HashTableDeletedValue); } 55 55 static bool isDeletedValue(const WTF::AtomicString& slot) { return slot.isHashTableDeletedValue(); } 56 56 }; -
trunk/Source/JavaScriptCore/wtf/text/StringImpl.cpp
r102631 r103243 90 90 91 91 data = reinterpret_cast<LChar*>(string + 1); 92 return adoptRef(new ( string) StringImpl(length, Force8BitConstructor));92 return adoptRef(new (NotNull, string) StringImpl(length, Force8BitConstructor)); 93 93 } 94 94 … … 109 109 110 110 data = reinterpret_cast<UChar*>(string + 1); 111 return adoptRef(new ( string) StringImpl(length));111 return adoptRef(new (NotNull, string) StringImpl(length)); 112 112 } 113 113 … … 131 131 132 132 data = reinterpret_cast<LChar*>(string + 1); 133 return adoptRef(new ( string) StringImpl(length, Force8BitConstructor));133 return adoptRef(new (NotNull, string) StringImpl(length, Force8BitConstructor)); 134 134 } 135 135 … … 153 153 154 154 data = reinterpret_cast<UChar*>(string + 1); 155 return adoptRef(new ( string) StringImpl(length));155 return adoptRef(new (NotNull, string) StringImpl(length)); 156 156 } 157 157 -
trunk/Source/JavaScriptCore/wtf/text/StringImpl.h
r102692 r103243 248 248 249 249 if (sizeof(T) == sizeof(char)) 250 return adoptRef(new (resultImpl) StringImpl(length, Force8BitConstructor));251 252 return adoptRef(new (resultImpl) StringImpl(length));250 return adoptRef(new (NotNull, resultImpl) StringImpl(length, Force8BitConstructor)); 251 252 return adoptRef(new (NotNull, resultImpl) StringImpl(length)); 253 253 } 254 254 -
trunk/Source/JavaScriptCore/wtf/text/StringStatics.cpp
r102849 r103243 69 69 70 70 // Use placement new to initialize the globals. 71 new ( (void*)&nullAtom) AtomicString;72 new ( (void*)&emptyAtom) AtomicString("");73 new ( (void*)&textAtom) AtomicString("#text");74 new ( (void*)&commentAtom) AtomicString("#comment");75 new ( (void*)&starAtom) AtomicString("*");76 new ( (void*)&xmlAtom) AtomicString("xml");77 new ( (void*)&xmlnsAtom) AtomicString("xmlns");71 new (NotNull, (void*)&nullAtom) AtomicString; 72 new (NotNull, (void*)&emptyAtom) AtomicString(""); 73 new (NotNull, (void*)&textAtom) AtomicString("#text"); 74 new (NotNull, (void*)&commentAtom) AtomicString("#comment"); 75 new (NotNull, (void*)&starAtom) AtomicString("*"); 76 new (NotNull, (void*)&xmlAtom) AtomicString("xml"); 77 new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns"); 78 78 79 79 initialized = true; -
trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
r100523 r103243 111 111 if (!allocatorPool) 112 112 CRASH(); 113 return new (allocatorPool->alloc(size)) DisjunctionContext();113 return new (allocatorPool->alloc(size)) DisjunctionContext(); 114 114 } 115 115 … … 132 132 } 133 133 134 new (getDisjunctionContext(term)) DisjunctionContext();134 new (getDisjunctionContext(term)) DisjunctionContext(); 135 135 } 136 136 … … 161 161 if (!allocatorPool) 162 162 CRASH(); 163 return new (allocatorPool->alloc(size)) ParenthesesDisjunctionContext(output, term);163 return new (allocatorPool->alloc(size)) ParenthesesDisjunctionContext(output, term); 164 164 } 165 165 -
trunk/Source/WebCore/ChangeLog
r103242 r103243 1 2011-12-15 Geoffrey Garen <ggaren@apple.com> 2 3 Placement new does an unnecessary NULL check 4 https://bugs.webkit.org/show_bug.cgi?id=74676 5 6 Reviewed by Sam Weinig. 7 8 * bindings/js/JSImageConstructor.h: 9 (WebCore::JSImageConstructor::create): 10 * bindings/scripts/CodeGeneratorJS.pm: 11 (GenerateHeader): 12 (GenerateConstructorDeclaration): 13 * bridge/c/CRuntimeObject.h: 14 (JSC::Bindings::CRuntimeObject::create): 15 * bridge/c/c_instance.cpp: 16 (JSC::Bindings::CRuntimeMethod::create): 17 * bridge/jni/jsc/JavaInstanceJSC.cpp: 18 (JavaRuntimeMethod::create): 19 * bridge/jni/jsc/JavaRuntimeObject.h: 20 (JSC::Bindings::JavaRuntimeObject::create): 21 * bridge/objc/ObjCRuntimeObject.h: 22 (JSC::Bindings::ObjCRuntimeObject::create): 23 * bridge/objc/objc_instance.mm: 24 (ObjCRuntimeMethod::create): 25 * bridge/objc/objc_runtime.h: 26 (JSC::Bindings::ObjcFallbackObjectImp::create): 27 * bridge/runtime_array.h: 28 (JSC::RuntimeArray::create): 29 * bridge/runtime_method.h: 30 (JSC::RuntimeMethod::create): 31 * bridge/runtime_object.h: 32 (JSC::Bindings::RuntimeObject::create): 33 * dom/Document.h: 34 (WebCore::FormElementKeyHashTraits::constructDeletedValue): Use NotNull 35 placement new, as in JavaScriptCore. 36 37 * platform/PODArena.h: 38 (WebCore::PODArena::allocateObject): No need to check for NULL explicitly, 39 since that's the built-in behavior of placement new. 40 41 * platform/graphics/FontCache.cpp: 42 (WebCore::FontDataCacheKeyTraits::constructDeletedValue): 43 * platform/graphics/IntRectHash.h: 44 * platform/graphics/IntSizeHash.h: More NotNull. 45 46 * rendering/RenderObject.h: Declaring that we throw is the C++ way to say 47 that operator new will not return NULL. 48 1 49 2011-12-19 Eric Carlson <eric.carlson@apple.com> 2 50 -
trunk/Source/WebCore/bindings/js/JSImageConstructor.h
r98203 r103243 32 32 static JSImageConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject) 33 33 { 34 JSImageConstructor* constructor = new ( JSC::allocateCell<JSImageConstructor>(*exec->heap())) JSImageConstructor(structure, globalObject);34 JSImageConstructor* constructor = new (NotNull, JSC::allocateCell<JSImageConstructor>(*exec->heap())) JSImageConstructor(structure, globalObject); 35 35 constructor->finishCreation(exec, globalObject); 36 36 return constructor; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r103221 r103243 746 746 push(@headerContent, " static $className* create(JSC::JSGlobalData& globalData, JSC::Structure* structure, PassRefPtr<$implType> impl, JSDOMWindowShell* windowShell)\n"); 747 747 push(@headerContent, " {\n"); 748 push(@headerContent, " $className* ptr = new ( JSC::allocateCell<$className>(globalData.heap)) ${className}(globalData, structure, impl, windowShell);\n");748 push(@headerContent, " $className* ptr = new (NotNull, JSC::allocateCell<$className>(globalData.heap)) ${className}(globalData, structure, impl, windowShell);\n"); 749 749 push(@headerContent, " ptr->finishCreation(globalData, windowShell);\n"); 750 750 push(@headerContent, " return ptr;\n"); … … 753 753 push(@headerContent, " static $className* create(JSC::JSGlobalData& globalData, JSC::Structure* structure, PassRefPtr<$implType> impl)\n"); 754 754 push(@headerContent, " {\n"); 755 push(@headerContent, " $className* ptr = new ( JSC::allocateCell<$className>(globalData.heap)) ${className}(globalData, structure, impl);\n");755 push(@headerContent, " $className* ptr = new (NotNull, JSC::allocateCell<$className>(globalData.heap)) ${className}(globalData, structure, impl);\n"); 756 756 push(@headerContent, " ptr->finishCreation(globalData);\n"); 757 757 push(@headerContent, " return ptr;\n"); … … 761 761 push(@headerContent, " static $className* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl)\n"); 762 762 push(@headerContent, " {\n"); 763 push(@headerContent, " $className* ptr = new ( JSC::allocateCell<$className>(globalObject->globalData().heap)) $className(structure, globalObject, impl);\n");763 push(@headerContent, " $className* ptr = new (NotNull, JSC::allocateCell<$className>(globalObject->globalData().heap)) $className(structure, globalObject, impl);\n"); 764 764 push(@headerContent, " ptr->finishCreation(globalObject->globalData());\n"); 765 765 push(@headerContent, " return ptr;\n"); … … 1066 1066 push(@headerContent, " static ${className}Prototype* create(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)\n"); 1067 1067 push(@headerContent, " {\n"); 1068 push(@headerContent, " ${className}Prototype* ptr = new ( JSC::allocateCell<${className}Prototype>(globalData.heap)) ${className}Prototype(globalData, globalObject, structure);\n");1068 push(@headerContent, " ${className}Prototype* ptr = new (NotNull, JSC::allocateCell<${className}Prototype>(globalData.heap)) ${className}Prototype(globalData, globalObject, structure);\n"); 1069 1069 push(@headerContent, " ptr->finishCreation(globalData);\n"); 1070 1070 push(@headerContent, " return ptr;\n"); … … 3327 3327 push(@$outputArray, " static $constructorClassName* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject)\n"); 3328 3328 push(@$outputArray, " {\n"); 3329 push(@$outputArray, " $constructorClassName* ptr = new ( JSC::allocateCell<$constructorClassName>(*exec->heap())) $constructorClassName(structure, globalObject);\n");3329 push(@$outputArray, " $constructorClassName* ptr = new (NotNull, JSC::allocateCell<$constructorClassName>(*exec->heap())) $constructorClassName(structure, globalObject);\n"); 3330 3330 push(@$outputArray, " ptr->finishCreation(exec, globalObject);\n"); 3331 3331 push(@$outputArray, " return ptr;\n"); … … 3362 3362 static JS${interfaceName}NamedConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject) 3363 3363 { 3364 JS${interfaceName}NamedConstructor* constructor = new ( JSC::allocateCell<JS${interfaceName}NamedConstructor>(*exec->heap())) JS${interfaceName}NamedConstructor(structure, globalObject);3364 JS${interfaceName}NamedConstructor* constructor = new (NotNull, JSC::allocateCell<JS${interfaceName}NamedConstructor>(*exec->heap())) JS${interfaceName}NamedConstructor(structure, globalObject); 3365 3365 constructor->finishCreation(exec, globalObject); 3366 3366 return constructor; -
trunk/Source/WebCore/bridge/c/CRuntimeObject.h
r103083 r103243 46 46 // We need to pass in the right global object for "i". 47 47 Structure* domStructure = WebCore::deprecatedGetDOMStructure<CRuntimeObject>(exec); 48 CRuntimeObject* object = new ( allocateCell<CRuntimeObject>(*exec->heap())) CRuntimeObject(exec, globalObject, domStructure, instance);48 CRuntimeObject* object = new (NotNull, allocateCell<CRuntimeObject>(*exec->heap())) CRuntimeObject(exec, globalObject, domStructure, instance); 49 49 object->finishCreation(globalObject); 50 50 return object; -
trunk/Source/WebCore/bridge/c/c_instance.cpp
r95936 r103243 119 119 // We need to pass in the right global object for "i". 120 120 Structure* domStructure = WebCore::deprecatedGetDOMStructure<CRuntimeMethod>(exec); 121 CRuntimeMethod* method = new ( allocateCell<CRuntimeMethod>(*exec->heap())) CRuntimeMethod(globalObject, domStructure, list);121 CRuntimeMethod* method = new (NotNull, allocateCell<CRuntimeMethod>(*exec->heap())) CRuntimeMethod(globalObject, domStructure, list); 122 122 method->finishCreation(exec->globalData(), name); 123 123 return method; -
trunk/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
r95936 r103243 124 124 // We need to pass in the right global object for "i". 125 125 Structure* domStructure = WebCore::deprecatedGetDOMStructure<JavaRuntimeMethod>(exec); 126 JavaRuntimeMethod* method = new ( allocateCell<JavaRuntimeMethod>(*exec->heap())) JavaRuntimeMethod(globalObject, domStructure, list);126 JavaRuntimeMethod* method = new (NotNull, allocateCell<JavaRuntimeMethod>(*exec->heap())) JavaRuntimeMethod(globalObject, domStructure, list); 127 127 method->finishCreation(exec->globalData(), name); 128 128 return method; -
trunk/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.h
r103083 r103243 44 44 // We need to pass in the right global object for "i". 45 45 Structure* domStructure = WebCore::deprecatedGetDOMStructure<JavaRuntimeObject>(exec); 46 JavaRuntimeObject* object = new ( allocateCell<JavaRuntimeObject>(*exec->heap())) JavaRuntimeObject(exec, globalObject, domStructure, javaInstance);46 JavaRuntimeObject* object = new (NotNull, allocateCell<JavaRuntimeObject>(*exec->heap())) JavaRuntimeObject(exec, globalObject, domStructure, javaInstance); 47 47 object->finishCreation(globalObject); 48 48 return object; -
trunk/Source/WebCore/bridge/objc/ObjCRuntimeObject.h
r103083 r103243 43 43 // We need to pass in the right global object for "i". 44 44 Structure* structure = WebCore::deprecatedGetDOMStructure<ObjCRuntimeObject>(exec); 45 ObjCRuntimeObject* object = new ( allocateCell<ObjCRuntimeObject>(*exec->heap())) ObjCRuntimeObject(exec, globalObject, inst, structure);45 ObjCRuntimeObject* object = new (NotNull, allocateCell<ObjCRuntimeObject>(*exec->heap())) ObjCRuntimeObject(exec, globalObject, inst, structure); 46 46 object->finishCreation(globalObject); 47 47 return object; -
trunk/Source/WebCore/bridge/objc/objc_instance.mm
r102691 r103243 187 187 // We need to pass in the right global object for "i". 188 188 Structure* domStructure = WebCore::deprecatedGetDOMStructure<ObjCRuntimeMethod>(exec); 189 ObjCRuntimeMethod* method = new ( allocateCell<ObjCRuntimeMethod>(*exec->heap())) ObjCRuntimeMethod(globalObject, domStructure, list);189 ObjCRuntimeMethod* method = new (NotNull, allocateCell<ObjCRuntimeMethod>(*exec->heap())) ObjCRuntimeMethod(globalObject, domStructure, list); 190 190 method->finishCreation(exec->globalData(), name); 191 191 return method; -
trunk/Source/WebCore/bridge/objc/objc_runtime.h
r103083 r103243 99 99 // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object 100 100 Structure* domStructure = WebCore::deprecatedGetDOMStructure<ObjcFallbackObjectImp>(exec); 101 ObjcFallbackObjectImp* fallbackObject = new ( allocateCell<ObjcFallbackObjectImp>(*exec->heap())) ObjcFallbackObjectImp(globalObject, domStructure, instance, propertyName);101 ObjcFallbackObjectImp* fallbackObject = new (NotNull, allocateCell<ObjcFallbackObjectImp>(*exec->heap())) ObjcFallbackObjectImp(globalObject, domStructure, instance, propertyName); 102 102 fallbackObject->finishCreation(globalObject); 103 103 return fallbackObject; -
trunk/Source/WebCore/bridge/runtime_array.h
r103083 r103243 42 42 // We need to pass in the right global object for "array". 43 43 Structure* domStructure = WebCore::deprecatedGetDOMStructure<RuntimeArray>(exec); 44 RuntimeArray* runtimeArray = new ( allocateCell<RuntimeArray>(*exec->heap())) RuntimeArray(exec, domStructure);44 RuntimeArray* runtimeArray = new (NotNull, allocateCell<RuntimeArray>(*exec->heap())) RuntimeArray(exec, domStructure); 45 45 runtimeArray->finishCreation(exec->globalData(), array); 46 46 return runtimeArray; -
trunk/Source/WebCore/bridge/runtime_method.h
r103083 r103243 42 42 static RuntimeMethod* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const Identifier& name, Bindings::MethodList& methodList) 43 43 { 44 RuntimeMethod* method = new ( allocateCell<RuntimeMethod>(*exec->heap())) RuntimeMethod(globalObject, structure, methodList);44 RuntimeMethod* method = new (NotNull, allocateCell<RuntimeMethod>(*exec->heap())) RuntimeMethod(globalObject, structure, methodList); 45 45 method->finishCreation(exec->globalData(), name); 46 46 return method; -
trunk/Source/WebCore/bridge/runtime_object.h
r103083 r103243 39 39 static RuntimeObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<Instance> instance) 40 40 { 41 RuntimeObject* object = new ( allocateCell<RuntimeObject>(*exec->heap())) RuntimeObject(exec, globalObject, structure, instance);41 RuntimeObject* object = new (NotNull, allocateCell<RuntimeObject>(*exec->heap())) RuntimeObject(exec, globalObject, structure, instance); 42 42 object->finishCreation(globalObject); 43 43 return object; -
trunk/Source/WebCore/dom/Document.h
r103166 r103243 202 202 203 203 struct FormElementKeyHashTraits : WTF::GenericHashTraits<FormElementKey> { 204 static void constructDeletedValue(FormElementKey& slot) { new ( &slot) FormElementKey(WTF::HashTableDeletedValue); }204 static void constructDeletedValue(FormElementKey& slot) { new (NotNull, &slot) FormElementKey(WTF::HashTableDeletedValue); } 205 205 static bool isDeletedValue(const FormElementKey& value) { return value.isHashTableDeletedValue(); } 206 206 }; -
trunk/Source/WebCore/platform/PODArena.h
r103030 r103243 87 87 template<class T> T* allocateObject() 88 88 { 89 void* ptr = allocateBase<T>(); 90 if (ptr) { 91 // Use placement operator new to allocate a T at this location. 92 new(ptr) T(); 93 } 94 return static_cast<T*>(ptr); 89 return new (allocateBase<T>()) T(); 95 90 } 96 91 … … 98 93 template<class T, class Argument1Type> T* allocateObject(const Argument1Type& argument1) 99 94 { 100 void* ptr = allocateBase<T>(); 101 if (ptr) { 102 // Use placement operator new to allocate a T at this location. 103 new(ptr) T(argument1); 104 } 105 return static_cast<T*>(ptr); 95 return new (allocateBase<T>()) T(argument1); 106 96 } 107 97 -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r96342 r103243 241 241 static void constructDeletedValue(FontPlatformData& slot) 242 242 { 243 new ( &slot) FontPlatformData(HashTableDeletedValue);243 new (NotNull, &slot) FontPlatformData(HashTableDeletedValue); 244 244 } 245 245 static bool isDeletedValue(const FontPlatformData& value) -
trunk/Source/WebCore/platform/graphics/IntRectHash.h
r95901 r103243 51 51 static const bool emptyValueIsZero = true; 52 52 static const bool needsDestruction = false; 53 static void constructDeletedValue(WebCore::IntRect& slot) { new ( &slot) WebCore::IntRect(-1, -1, -1, -1); }53 static void constructDeletedValue(WebCore::IntRect& slot) { new (NotNull, &slot) WebCore::IntRect(-1, -1, -1, -1); } 54 54 static bool isDeletedValue(const WebCore::IntRect& value) { return value.x() == -1 && value.y() == -1 && value.width() == -1 && value.height() == -1; } 55 55 }; -
trunk/Source/WebCore/platform/graphics/IntSizeHash.h
r76660 r103243 37 37 static const bool emptyValueIsZero = true; 38 38 static const bool needsDestruction = false; 39 static void constructDeletedValue(WebCore::IntSize& slot) { new ( &slot) WebCore::IntSize(-1, -1); }39 static void constructDeletedValue(WebCore::IntSize& slot) { new (NotNull, &slot) WebCore::IntSize(-1, -1); } 40 40 static bool isDeletedValue(const WebCore::IntSize& value) { return value.width() == -1 && value.height() == -1; } 41 41 }; -
trunk/Source/WebCore/rendering/BidiRun.cpp
r96880 r103243 54 54 } 55 55 56 void* BidiRun::operator new(size_t sz, RenderArena* renderArena) throw()56 void* BidiRun::operator new(size_t sz, RenderArena* renderArena) 57 57 { 58 58 #ifndef NDEBUG -
trunk/Source/WebCore/rendering/BidiRun.h
r95901 r103243 46 46 47 47 // Overloaded new operator. 48 void* operator new(size_t, RenderArena*) throw();48 void* operator new(size_t, RenderArena*); 49 49 50 50 // Overridden to prevent the normal delete from being called. -
trunk/Source/WebCore/rendering/InlineBox.cpp
r101342 r103243 87 87 } 88 88 89 void* InlineBox::operator new(size_t sz, RenderArena* renderArena) throw()89 void* InlineBox::operator new(size_t sz, RenderArena* renderArena) 90 90 { 91 91 return renderArena->allocate(sz); -
trunk/Source/WebCore/rendering/InlineBox.h
r101342 r103243 125 125 126 126 // Overloaded new operator. 127 void* operator new(size_t, RenderArena*) throw();127 void* operator new(size_t, RenderArena*); 128 128 129 129 // Overridden to prevent the normal delete from being called. -
trunk/Source/WebCore/rendering/LayoutState.cpp
r97888 r103243 167 167 } 168 168 169 void* LayoutState::operator new(size_t sz, RenderArena* renderArena) throw()169 void* LayoutState::operator new(size_t sz, RenderArena* renderArena) 170 170 { 171 171 return renderArena->allocate(sz); -
trunk/Source/WebCore/rendering/LayoutState.h
r95648 r103243 61 61 62 62 // Overloaded new operator. 63 void* operator new(size_t, RenderArena*) throw();63 void* operator new(size_t, RenderArena*); 64 64 65 65 // Overridden to prevent the normal delete from being called. -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r103170 r103243 124 124 const int MinimumHeightWhileResizing = 40; 125 125 126 void* ClipRects::operator new(size_t sz, RenderArena* renderArena) throw()126 void* ClipRects::operator new(size_t sz, RenderArena* renderArena) 127 127 { 128 128 return renderArena->allocate(sz); … … 1073 1073 } 1074 1074 1075 void* RenderLayer::operator new(size_t sz, RenderArena* renderArena) throw()1075 void* RenderLayer::operator new(size_t sz, RenderArena* renderArena) 1076 1076 { 1077 1077 return renderArena->allocate(sz); -
trunk/Source/WebCore/rendering/RenderLayer.h
r103170 r103243 178 178 179 179 // Overloaded new operator. 180 void* operator new(size_t, RenderArena*) throw();180 void* operator new(size_t, RenderArena*); 181 181 182 182 // Overridden to prevent the normal delete from being called. … … 528 528 // Overloaded new operator. Derived classes must override operator new 529 529 // in order to allocate out of the RenderArena. 530 void* operator new(size_t, RenderArena*) throw();530 void* operator new(size_t, RenderArena*); 531 531 532 532 // Overridden to prevent the normal delete from being called. -
trunk/Source/WebCore/rendering/RenderObject.cpp
r103020 r103243 99 99 bool RenderObject::s_affectsParentBlock = false; 100 100 101 void* RenderObject::operator new(size_t sz, RenderArena* renderArena) throw()101 void* RenderObject::operator new(size_t sz, RenderArena* renderArena) 102 102 { 103 103 return renderArena->allocate(sz); -
trunk/Source/WebCore/rendering/RenderObject.h
r103056 r103243 266 266 // Overloaded new operator. Derived classes must override operator new 267 267 // in order to allocate out of the RenderArena. 268 void* operator new(size_t, RenderArena*) throw();268 void* operator new(size_t, RenderArena*); 269 269 270 270 // Overridden to prevent the normal delete from being called.
Note: See TracChangeset
for help on using the changeset viewer.