-JSFunction::JSFunction(ExecState* exec, FunctionExecutable* executable, ScopeChainNode* scopeChainNode)
- : Base(exec->globalData(), scopeChainNode->globalObject->functionStructure())
- , m_executable(exec->globalData(), this, executable)
- , m_scopeChain(exec->globalData(), this, scopeChainNode)
+JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+ : Base(exec->vm(), structure)
+ , m_executable()
+ , m_scope(exec->vm(), this, globalObject)
+ // We initialize blind so that changes to the prototype after function creation but before
+ // the optimizer kicks in don't disable optimizations. Once the optimizer kicks in, the
+ // watchpoint will start watching and any changes will both force deoptimization and disable
+ // future attempts to optimize. This is necessary because we are guaranteed that the
+ // allocation profile is changed exactly once prior to optimizations kicking in. We could be
+ // smarter and count the number of times the prototype is clobbered and only optimize if it
+ // was clobbered exactly once, but that seems like overkill. In almost all cases it will be
+ // clobbered once, and if it's clobbered more than once, that will probably only occur
+ // before we started optimizing, anyway.
+ , m_allocationProfileWatchpoint(InitializedBlind)