Changeset 59811 in webkit for trunk/JavaScriptCore/runtime/JSFunction.cpp
- Timestamp:
- May 19, 2010, 7:38:01 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSFunction.cpp
r59801 r59811 44 44 ASSERT_CLASS_FITS_IN_CELL(JSFunction); 45 45 46 const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 };46 const ClassInfo JSFunction::info = { "Function", 0, 0, 0 }; 47 47 48 48 bool JSFunction::isHostFunctionNonInline() const … … 59 59 60 60 JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, PassRefPtr<NativeExecutable> thunk) 61 : Base( &exec->globalData(), structure, name)61 : Base(structure) 62 62 #if ENABLE(JIT) 63 63 , m_executable(thunk) … … 65 65 , m_scopeChain(NoScopeChain()) 66 66 { 67 putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); 67 68 #if ENABLE(JIT) 68 69 putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); … … 75 76 76 77 JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func) 77 : Base( &exec->globalData(), structure, name)78 : Base(structure) 78 79 #if ENABLE(JIT) 79 80 , m_executable(exec->globalData().getHostFunction(func)) … … 81 82 , m_scopeChain(NoScopeChain()) 82 83 { 84 putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); 83 85 #if ENABLE(JIT) 84 86 putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); … … 91 93 92 94 JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode) 93 : Base( &exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name())95 : Base(exec->lexicalGlobalObject()->functionStructure()) 94 96 , m_executable(executable) 95 97 , m_scopeChain(scopeChainNode) 96 98 { 99 const Identifier& name = static_cast<FunctionExecutable*>(m_executable.get())->name(); 100 putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); 97 101 } 98 102 … … 115 119 } 116 120 121 const UString& JSFunction::name(ExecState* exec) 122 { 123 return asString(getDirect(exec->globalData().propertyNames->name))->value(exec); 124 } 125 126 const UString JSFunction::displayName(ExecState* exec) 127 { 128 JSValue displayName = getDirect(exec->globalData().propertyNames->displayName); 129 130 if (displayName && isJSString(&exec->globalData(), displayName)) 131 return asString(displayName)->value(exec); 132 133 return UString::null(); 134 } 135 136 const UString JSFunction::calculatedDisplayName(ExecState* exec) 137 { 138 const UString explicitName = displayName(exec); 139 140 if (!explicitName.isEmpty()) 141 return explicitName; 142 143 return name(exec); 144 } 145 117 146 void JSFunction::markChildren(MarkStack& markStack) 118 147 {
Note:
See TracChangeset
for help on using the changeset viewer.