|
Lines 43-49
namespace JSC {
JavaScriptCore/runtime/JSFunction.cpp_sec1
|
| 43 |
|
43 |
|
| 44 |
ASSERT_CLASS_FITS_IN_CELL(JSFunction); |
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 |
bool JSFunction::isHostFunctionNonInline() const |
48 |
bool JSFunction::isHostFunctionNonInline() const |
| 49 |
{ |
49 |
{ |
|
Lines 58-69
JSFunction::JSFunction(NonNullPassRefPtr
JavaScriptCore/runtime/JSFunction.cpp_sec2
|
| 58 |
} |
58 |
} |
| 59 |
|
59 |
|
| 60 |
JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, PassRefPtr<NativeExecutable> thunk) |
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 |
#if ENABLE(JIT) |
62 |
#if ENABLE(JIT) |
| 63 |
, m_executable(thunk) |
63 |
, m_executable(thunk) |
| 64 |
#endif |
64 |
#endif |
| 65 |
, m_scopeChain(NoScopeChain()) |
65 |
, m_scopeChain(NoScopeChain()) |
| 66 |
{ |
66 |
{ |
|
|
67 |
putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); |
| 67 |
#if ENABLE(JIT) |
68 |
#if ENABLE(JIT) |
| 68 |
putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); |
69 |
putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); |
| 69 |
#else |
70 |
#else |
|
Lines 74-85
JSFunction::JSFunction(ExecState* exec,
JavaScriptCore/runtime/JSFunction.cpp_sec3
|
| 74 |
} |
75 |
} |
| 75 |
|
76 |
|
| 76 |
JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func) |
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 |
#if ENABLE(JIT) |
79 |
#if ENABLE(JIT) |
| 79 |
, m_executable(exec->globalData().getHostFunction(func)) |
80 |
, m_executable(exec->globalData().getHostFunction(func)) |
| 80 |
#endif |
81 |
#endif |
| 81 |
, m_scopeChain(NoScopeChain()) |
82 |
, m_scopeChain(NoScopeChain()) |
| 82 |
{ |
83 |
{ |
|
|
84 |
putDirect(exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name.ustring()), DontDelete | ReadOnly | DontEnum); |
| 83 |
#if ENABLE(JIT) |
85 |
#if ENABLE(JIT) |
| 84 |
putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); |
86 |
putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); |
| 85 |
#else |
87 |
#else |
|
Lines 90-99
JSFunction::JSFunction(ExecState* exec,
JavaScriptCore/runtime/JSFunction.cpp_sec4
|
| 90 |
} |
92 |
} |
| 91 |
|
93 |
|
| 92 |
JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode) |
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 |
, m_executable(executable) |
96 |
, m_executable(executable) |
| 95 |
, m_scopeChain(scopeChainNode) |
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 |
|
| 99 |
JSFunction::~JSFunction() |
103 |
JSFunction::~JSFunction() |
|
Lines 114-119
JSFunction::~JSFunction()
JavaScriptCore/runtime/JSFunction.cpp_sec5
|
| 114 |
} |
118 |
} |
| 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 |
void JSFunction::markChildren(MarkStack& markStack) |
146 |
void JSFunction::markChildren(MarkStack& markStack) |
| 118 |
{ |
147 |
{ |
| 119 |
Base::markChildren(markStack); |
148 |
Base::markChildren(markStack); |