Changeset 63675 in webkit
- Timestamp:
- Jul 19, 2010 10:19:16 AM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r63651 r63675 1 2010-07-16 Darin Adler <darin@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Use OwnPtr for CodeBlock objects 6 https://bugs.webkit.org/show_bug.cgi?id=42490 7 8 * runtime/Executable.cpp: 9 (JSC::EvalExecutable::EvalExecutable): Moved this here and made it non-inline. 10 Eliminated the code that used to initialize the raw pointer since it's now 11 an OwnPtr. 12 (JSC::EvalExecutable::~EvalExecutable): Removed the explicit delete here. 13 (JSC::ProgramExecutable::ProgramExecutable): Ditto. 14 (JSC::ProgramExecutable::~ProgramExecutable): Ditto. 15 (JSC::FunctionExecutable::FunctionExecutable): Ditto. 16 (JSC::FunctionExecutable::~FunctionExecutable): Ditto. 17 (JSC::EvalExecutable::compileInternal): Added use of adoptPtr and get. 18 (JSC::ProgramExecutable::compileInternal): Ditto. 19 (JSC::FunctionExecutable::compileForCallInternal): Ditto. 20 (JSC::FunctionExecutable::compileForConstructInternal): Ditto. 21 (JSC::FunctionExecutable::recompile): Use clear instead of delete followed 22 by assignment of 0. 23 24 * runtime/Executable.h: Moved constructors to the cpp file and changed 25 raw pointers to OwnPtr. 26 1 27 2010-07-19 Lucas De Marchi <lucas.demarchi@profusion.mobi> 2 28 -
trunk/JavaScriptCore/runtime/Executable.cpp
r63267 r63675 46 46 } 47 47 48 EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source) 49 : ScriptExecutable(exec, source) 50 { 51 } 52 48 53 EvalExecutable::~EvalExecutable() 49 54 { 50 delete m_evalCodeBlock; 55 } 56 57 ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source) 58 : ScriptExecutable(exec, source) 59 { 51 60 } 52 61 53 62 ProgramExecutable::~ProgramExecutable() 54 63 { 55 delete m_programCodeBlock; 64 } 65 66 FunctionExecutable::FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) 67 : ScriptExecutable(globalData, source) 68 , m_numVariables(0) 69 , m_forceUsesArguments(forceUsesArguments) 70 , m_parameters(parameters) 71 , m_name(name) 72 , m_symbolTable(0) 73 { 74 m_firstLine = firstLine; 75 m_lastLine = lastLine; 76 } 77 78 FunctionExecutable::FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) 79 : ScriptExecutable(exec, source) 80 , m_numVariables(0) 81 , m_forceUsesArguments(forceUsesArguments) 82 , m_parameters(parameters) 83 , m_name(name) 84 , m_symbolTable(0) 85 { 86 m_firstLine = firstLine; 87 m_lastLine = lastLine; 56 88 } 57 89 58 90 FunctionExecutable::~FunctionExecutable() 59 91 { 60 delete m_codeBlockForCall;61 delete m_codeBlockForConstruct;62 92 } 63 93 … … 78 108 79 109 ASSERT(!m_evalCodeBlock); 80 m_evalCodeBlock = new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth());81 OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock )));110 m_evalCodeBlock = adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth())); 111 OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get()))); 82 112 generator->generate(); 83 113 … … 86 116 #if ENABLE(JIT) 87 117 if (exec->globalData().canUseJIT()) { 88 m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_evalCodeBlock );118 m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_evalCodeBlock.get()); 89 119 #if !ENABLE(OPCODE_SAMPLING) 90 120 if (!BytecodeGenerator::dumpsGeneratedCode()) … … 126 156 JSGlobalObject* globalObject = scopeChain.globalObject(); 127 157 128 m_programCodeBlock = new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider());129 OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock )));158 m_programCodeBlock = adoptPtr(new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider())); 159 OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock.get()))); 130 160 generator->generate(); 131 161 … … 134 164 #if ENABLE(JIT) 135 165 if (exec->globalData().canUseJIT()) { 136 m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_programCodeBlock );166 m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_programCodeBlock.get()); 137 167 #if !ENABLE(OPCODE_SAMPLING) 138 168 if (!BytecodeGenerator::dumpsGeneratedCode()) … … 163 193 164 194 ASSERT(!m_codeBlockForCall); 165 m_codeBlockForCall = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), false);166 OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall )));195 m_codeBlockForCall = adoptPtr(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), false)); 196 OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall.get()))); 167 197 generator->generate(); 168 198 m_numParametersForCall = m_codeBlockForCall->m_numParameters; … … 175 205 #if ENABLE(JIT) 176 206 if (exec->globalData().canUseJIT()) { 177 m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_codeBlockForCall , &m_jitCodeForCallWithArityCheck);207 m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, m_codeBlockForCall.get(), &m_jitCodeForCallWithArityCheck); 178 208 #if !ENABLE(OPCODE_SAMPLING) 179 209 if (!BytecodeGenerator::dumpsGeneratedCode()) … … 204 234 205 235 ASSERT(!m_codeBlockForConstruct); 206 m_codeBlockForConstruct = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), true);207 OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct )));236 m_codeBlockForConstruct = adoptPtr(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), true)); 237 OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct.get()))); 208 238 generator->generate(); 209 239 m_numParametersForConstruct = m_codeBlockForConstruct->m_numParameters; … … 216 246 #if ENABLE(JIT) 217 247 if (exec->globalData().canUseJIT()) { 218 m_jitCodeForConstruct = JIT::compile(scopeChainNode->globalData, m_codeBlockForConstruct , &m_jitCodeForConstructWithArityCheck);248 m_jitCodeForConstruct = JIT::compile(scopeChainNode->globalData, m_codeBlockForConstruct.get(), &m_jitCodeForConstructWithArityCheck); 219 249 #if !ENABLE(OPCODE_SAMPLING) 220 250 if (!BytecodeGenerator::dumpsGeneratedCode()) … … 299 329 void FunctionExecutable::recompile(ExecState*) 300 330 { 301 delete m_codeBlockForCall; 302 m_codeBlockForCall = 0; 303 delete m_codeBlockForConstruct; 304 m_codeBlockForConstruct = 0; 331 m_codeBlockForCall.clear(); 332 m_codeBlockForConstruct.clear(); 305 333 m_numParametersForCall = NUM_PARAMETERS_NOT_COMPILED; 306 334 m_numParametersForConstruct = NUM_PARAMETERS_NOT_COMPILED; -
trunk/JavaScriptCore/runtime/Executable.h
r63404 r63675 221 221 222 222 private: 223 EvalExecutable(ExecState* exec, const SourceCode& source) 224 : ScriptExecutable(exec, source) 225 , m_evalCodeBlock(0) 226 { 227 } 223 EvalExecutable(ExecState*, const SourceCode&); 228 224 229 225 JSObject* compileInternal(ExecState*, ScopeChainNode*); … … 231 227 virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); 232 228 233 EvalCodeBlock*m_evalCodeBlock;229 OwnPtr<EvalCodeBlock> m_evalCodeBlock; 234 230 }; 235 231 … … 268 264 269 265 private: 270 ProgramExecutable(ExecState* exec, const SourceCode& source) 271 : ScriptExecutable(exec, source) 272 , m_programCodeBlock(0) 273 { 274 } 266 ProgramExecutable(ExecState*, const SourceCode&); 275 267 276 268 JSObject* compileInternal(ExecState*, ScopeChainNode*); … … 278 270 virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); 279 271 280 ProgramCodeBlock*m_programCodeBlock;272 OwnPtr<ProgramCodeBlock> m_programCodeBlock; 281 273 }; 282 274 … … 359 351 360 352 void recompile(ExecState*); 361 void markAggregate(MarkStack& markStack);353 void markAggregate(MarkStack&); 362 354 static PassRefPtr<FunctionExecutable> fromGlobalCode(const Identifier&, ExecState*, Debugger*, const SourceCode&, JSObject** exception); 363 355 364 356 private: 365 FunctionExecutable(JSGlobalData* globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) 366 : ScriptExecutable(globalData, source) 367 , m_numVariables(0) 368 , m_forceUsesArguments(forceUsesArguments) 369 , m_parameters(parameters) 370 , m_codeBlockForCall(0) 371 , m_codeBlockForConstruct(0) 372 , m_name(name) 373 , m_symbolTable(0) 374 { 375 m_firstLine = firstLine; 376 m_lastLine = lastLine; 377 } 378 379 FunctionExecutable(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, int firstLine, int lastLine) 380 : ScriptExecutable(exec, source) 381 , m_numVariables(0) 382 , m_forceUsesArguments(forceUsesArguments) 383 , m_parameters(parameters) 384 , m_codeBlockForCall(0) 385 , m_codeBlockForConstruct(0) 386 , m_name(name) 387 , m_symbolTable(0) 388 { 389 m_firstLine = firstLine; 390 m_lastLine = lastLine; 391 } 357 FunctionExecutable(JSGlobalData*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, int firstLine, int lastLine); 358 FunctionExecutable(ExecState*, const Identifier& name, const SourceCode&, bool forceUsesArguments, FunctionParameters*, int firstLine, int lastLine); 392 359 393 360 JSObject* compileForCallInternal(ExecState*, ScopeChainNode*); … … 400 367 401 368 RefPtr<FunctionParameters> m_parameters; 402 FunctionCodeBlock*m_codeBlockForCall;403 FunctionCodeBlock*m_codeBlockForConstruct;369 OwnPtr<FunctionCodeBlock> m_codeBlockForCall; 370 OwnPtr<FunctionCodeBlock> m_codeBlockForConstruct; 404 371 Identifier m_name; 405 372 SharedSymbolTable* m_symbolTable;
Note: See TracChangeset
for help on using the changeset viewer.