Changeset 59339 in webkit for trunk/JavaScriptCore/runtime/Executable.h
- Timestamp:
- May 12, 2010, 9:01:56 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Executable.h
r58469 r59339 37 37 class Debugger; 38 38 class EvalCodeBlock; 39 class FunctionCodeBlock; 39 40 class ProgramCodeBlock; 40 41 class ScopeChainNode; … … 51 52 public: 52 53 ExecutableBase(int numParameters) 53 : m_numParameters(numParameters) 54 : m_numParametersForCall(numParameters) 55 , m_numParametersForConstruct(numParameters) 54 56 { 55 57 } … … 57 59 virtual ~ExecutableBase() {} 58 60 59 bool isHostFunction() const { return m_numParameters == NUM_PARAMETERS_IS_HOST; } 61 bool isHostFunction() const 62 { 63 ASSERT((m_numParametersForCall == NUM_PARAMETERS_IS_HOST) == (m_numParametersForConstruct == NUM_PARAMETERS_IS_HOST)); 64 return m_numParametersForCall == NUM_PARAMETERS_IS_HOST; 65 } 60 66 61 67 protected: 62 int m_numParameters; 68 int m_numParametersForCall; 69 int m_numParametersForConstruct; 63 70 64 71 #if ENABLE(JIT) 65 72 public: 66 JITCode& generatedJITCode() 67 { 68 ASSERT(m_jitCode); 69 return m_jitCode; 70 } 71 72 ExecutablePool* getExecutablePool() 73 { 74 return m_jitCode.getExecutablePool(); 73 JITCode& generatedJITCodeForCall() 74 { 75 ASSERT(m_jitCodeForCall); 76 return m_jitCodeForCall; 77 } 78 79 JITCode& generatedJITCodeForConstruct() 80 { 81 ASSERT(m_jitCodeForConstruct); 82 return m_jitCodeForConstruct; 75 83 } 76 84 77 85 protected: 78 JITCode m_jitCode; 86 JITCode m_jitCodeForCall; 87 JITCode m_jitCodeForConstruct; 79 88 #endif 80 89 }; … … 86 95 : ExecutableBase(NUM_PARAMETERS_IS_HOST) 87 96 { 88 m_jitCode = exec->globalData().jitStubs.ctiNativeCallThunk()->m_jitCode; 97 m_jitCodeForCall = exec->globalData().jitStubs.ctiNativeCallThunk()->m_jitCodeForCall; 98 m_jitCodeForConstruct = exec->globalData().jitStubs.ctiNativeCallThunk()->m_jitCodeForCall; // FIXME: this thunk should have a construct form 89 99 } 90 100 NativeExecutable(JITCode thunk) 91 101 : ExecutableBase(NUM_PARAMETERS_IS_HOST) 92 102 { 93 m_jitCode = thunk; 103 m_jitCodeForCall = thunk; 104 m_jitCodeForConstruct = thunk; 94 105 } 95 106 … … 193 204 JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode) 194 205 { 195 if (!m_jitCode )206 if (!m_jitCodeForCall) 196 207 generateJITCode(exec, scopeChainNode); 197 return m_jitCode ;208 return m_jitCodeForCall; 198 209 } 199 210 … … 239 250 JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode) 240 251 { 241 if (!m_jitCode )252 if (!m_jitCodeForCall) 242 253 generateJITCode(exec, scopeChainNode); 243 return m_jitCode ;254 return m_jitCodeForCall; 244 255 } 245 256 … … 269 280 } 270 281 271 CodeBlock& bytecode(ExecState* exec, ScopeChainNode* scopeChainNode)282 FunctionCodeBlock& bytecodeForCall(ExecState* exec, ScopeChainNode* scopeChainNode) 272 283 { 273 284 ASSERT(scopeChainNode); 274 if (!m_codeBlock) 275 compile(exec, scopeChainNode); 276 return *m_codeBlock; 277 } 278 279 bool isGenerated() const 280 { 281 return m_codeBlock; 282 } 283 284 CodeBlock& generatedBytecode() 285 { 286 ASSERT(m_codeBlock); 287 return *m_codeBlock; 285 if (!m_codeBlockForCall) 286 compileForCall(exec, scopeChainNode); 287 return *m_codeBlockForCall; 288 } 289 290 bool isGeneratedForCall() const 291 { 292 return m_codeBlockForCall; 293 } 294 295 FunctionCodeBlock& generatedBytecodeForCall() 296 { 297 ASSERT(m_codeBlockForCall); 298 return *m_codeBlockForCall; 299 } 300 301 FunctionCodeBlock& bytecodeForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode) 302 { 303 ASSERT(scopeChainNode); 304 if (!m_codeBlockForConstruct) 305 compileForConstruct(exec, scopeChainNode); 306 return *m_codeBlockForConstruct; 307 } 308 309 bool isGeneratedForConstruct() const 310 { 311 return m_codeBlockForConstruct; 312 } 313 314 FunctionCodeBlock& generatedBytecodeForConstruct() 315 { 316 ASSERT(m_codeBlockForConstruct); 317 return *m_codeBlockForConstruct; 288 318 } 289 319 … … 292 322 size_t variableCount() const { return m_numVariables; } 293 323 UString paramString() const; 324 SharedSymbolTable* symbolTable() const { return m_symbolTable; } 294 325 295 326 void recompile(ExecState*); … … 303 334 , m_forceUsesArguments(forceUsesArguments) 304 335 , m_parameters(parameters) 305 , m_codeBlock(0) 336 , m_codeBlockForCall(0) 337 , m_codeBlockForConstruct(0) 306 338 , m_name(name) 307 339 , m_numVariables(0) 340 , m_symbolTable(0) 308 341 { 309 342 m_firstLine = firstLine; … … 315 348 , m_forceUsesArguments(forceUsesArguments) 316 349 , m_parameters(parameters) 317 , m_codeBlock(0) 350 , m_codeBlockForCall(0) 351 , m_codeBlockForConstruct(0) 318 352 , m_name(name) 319 353 , m_numVariables(0) 354 , m_symbolTable(0) 320 355 { 321 356 m_firstLine = firstLine; … … 323 358 } 324 359 325 void compile(ExecState*, ScopeChainNode*); 360 void compileForCall(ExecState*, ScopeChainNode*); 361 void compileForConstruct(ExecState*, ScopeChainNode*); 326 362 327 363 bool m_forceUsesArguments; 328 364 RefPtr<FunctionParameters> m_parameters; 329 CodeBlock* m_codeBlock; 365 FunctionCodeBlock* m_codeBlockForCall; 366 FunctionCodeBlock* m_codeBlockForConstruct; 330 367 Identifier m_name; 331 368 size_t m_numVariables; 369 SharedSymbolTable* m_symbolTable; 332 370 333 371 #if ENABLE(JIT) 334 372 public: 335 JITCode& jitCode(ExecState* exec, ScopeChainNode* scopeChainNode) 336 { 337 if (!m_jitCode) 338 generateJITCode(exec, scopeChainNode); 339 return m_jitCode; 340 } 341 342 private: 343 void generateJITCode(ExecState*, ScopeChainNode*); 373 JITCode& jitCodeForCall(ExecState* exec, ScopeChainNode* scopeChainNode) 374 { 375 if (!m_jitCodeForCall) 376 generateJITCodeForCall(exec, scopeChainNode); 377 return m_jitCodeForCall; 378 } 379 380 JITCode& jitCodeForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode) 381 { 382 if (!m_jitCodeForConstruct) 383 generateJITCodeForConstruct(exec, scopeChainNode); 384 return m_jitCodeForConstruct; 385 } 386 387 private: 388 void generateJITCodeForCall(ExecState*, ScopeChainNode*); 389 void generateJITCodeForConstruct(ExecState*, ScopeChainNode*); 344 390 #endif 345 391 };
Note:
See TracChangeset
for help on using the changeset viewer.