Changeset 43220 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- May 5, 2009, 4:34:23 AM (16 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/ArgList.h
r43122 r43220 1 1 /* 2 2 * Copyright (C) 1999-2001 Harri Porten ([email protected]) 3 * Copyright (C) 2003, 2007, 2008 Apple Computer, Inc.3 * Copyright (C) 2003, 2007, 2008, 2009 Apple Computer, Inc. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 156 156 157 157 class ArgList { 158 friend class JIT; 158 159 public: 159 160 typedef JSValue* iterator; -
trunk/JavaScriptCore/runtime/ArrayPrototype.cpp
r43153 r43220 73 73 return false; 74 74 75 CodeBlock& codeBlock = callData.js.functionBody->bytecode(callData.js.scopeChain);76 75 #if ENABLE(JIT) 77 76 // If the JIT is enabled then we need to preserve the invariant that every 78 77 // function with a CodeBlock also has JIT code. 79 if (!codeBlock.jitCode()) 80 JIT::compile(callData.js.scopeChain->globalData, &codeBlock); 78 callData.js.functionBody->jitCode(callData.js.scopeChain); 79 CodeBlock& codeBlock = callData.js.functionBody->generatedBytecode(); 80 #else 81 CodeBlock& codeBlock = callData.js.functionBody->bytecode(callData.js.scopeChain); 81 82 #endif 82 83 -
trunk/JavaScriptCore/runtime/BooleanPrototype.cpp
r43122 r43220 42 42 setInternalValue(jsBoolean(false)); 43 43 44 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum);45 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum);44 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, booleanProtoFuncToString), DontEnum); 45 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, booleanProtoFuncValueOf), DontEnum); 46 46 } 47 47 -
trunk/JavaScriptCore/runtime/DateConstructor.cpp
r43122 r43220 57 57 putDirectWithoutTransition(exec->propertyNames().prototype, datePrototype, DontEnum|DontDelete|ReadOnly); 58 58 59 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum);60 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum);61 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum);59 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().parse, dateParse), DontEnum); 60 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 7, exec->propertyNames().UTC, dateUTC), DontEnum); 61 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().now, dateNow), DontEnum); 62 62 63 63 putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 7), ReadOnly | DontEnum | DontDelete); -
trunk/JavaScriptCore/runtime/ErrorPrototype.cpp
r43122 r43220 42 42 putDirectWithoutTransition(exec->propertyNames().message, jsNontrivialString(exec, "Unknown error"), DontEnum); 43 43 44 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum);44 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, errorProtoFuncToString), DontEnum); 45 45 } 46 46 -
trunk/JavaScriptCore/runtime/FunctionPrototype.cpp
r43122 r43220 44 44 } 45 45 46 void FunctionPrototype::addFunctionProperties(ExecState* exec, Structure* prototypeFunctionStructure, PrototypeFunction** callFunction, PrototypeFunction** applyFunction)46 void FunctionPrototype::addFunctionProperties(ExecState* exec, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction) 47 47 { 48 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);49 *applyFunction = new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply);48 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum); 49 *applyFunction = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply); 50 50 putDirectFunctionWithoutTransition(exec, *applyFunction, DontEnum); 51 *callFunction = new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall);51 *callFunction = new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().call, functionProtoFuncCall); 52 52 putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum); 53 53 } … … 87 87 if (thisValue.isObject(&JSFunction::info)) { 88 88 JSFunction* function = asFunction(thisValue); 89 UString functionBody = function->body()->toSourceString(); 90 insertSemicolonIfNeeded(functionBody); 91 return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + function->body()->paramString() + ") " + functionBody); 89 if (!function->isHostFunction()) { 90 UString functionBody = function->body()->toSourceString(); 91 insertSemicolonIfNeeded(functionBody); 92 return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + function->body()->paramString() + ") " + functionBody); 93 } 92 94 } 93 95 -
trunk/JavaScriptCore/runtime/FunctionPrototype.h
r43122 r43220 23 23 24 24 #include "InternalFunction.h" 25 #include "NativeFunctionWrapper.h" 25 26 26 27 namespace JSC { … … 31 32 public: 32 33 FunctionPrototype(ExecState*, PassRefPtr<Structure>); 33 void addFunctionProperties(ExecState*, Structure* prototypeFunctionStructure, PrototypeFunction** callFunction, PrototypeFunction** applyFunction);34 void addFunctionProperties(ExecState*, Structure* prototypeFunctionStructure, NativeFunctionWrapper** callFunction, NativeFunctionWrapper** applyFunction); 34 35 35 36 static PassRefPtr<Structure> createStructure(JSValue proto) -
trunk/JavaScriptCore/runtime/JSFunction.cpp
r43122 r43220 46 46 const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 }; 47 47 48 JSFunction::JSFunction(ExecState* exec, PassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func) 49 : Base(&exec->globalData(), structure, name) 50 #if ENABLE(JIT) 51 , m_body(exec->globalData().nativeFunctionThunk()) 52 #else 53 , m_body(0) 54 #endif 55 { 56 #if ENABLE(JIT) 57 setNativeFunction(func); 58 putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum); 59 #else 60 UNUSED_PARAM(length); 61 UNUSED_PARAM(func); 62 ASSERT_NOT_REACHED(); 63 #endif 64 } 65 48 66 JSFunction::JSFunction(ExecState* exec, const Identifier& name, FunctionBodyNode* body, ScopeChainNode* scopeChainNode) 49 67 : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), name) 50 68 , m_body(body) 51 , m_scopeChain(scopeChainNode) 52 { 69 { 70 setScopeChain(scopeChainNode); 53 71 } 54 72 … … 59 77 // are based on a check for the this pointer value for this JSFunction - which will no longer be valid once 60 78 // this memory is freed and may be reused (potentially for another, different JSFunction). 61 if (m_body && m_body->isGenerated()) 62 m_body->generatedBytecode().unlinkCallers(); 79 if (!isHostFunction()) { 80 if (m_body && m_body->isGenerated()) 81 m_body->generatedBytecode().unlinkCallers(); 82 scopeChain().~ScopeChain(); 83 } 84 63 85 #endif 64 86 } … … 67 89 { 68 90 Base::mark(); 69 m_body->mark(); 70 m_scopeChain.mark(); 91 if (!isHostFunction()) { 92 m_body->mark(); 93 scopeChain().mark(); 94 } 71 95 } 72 96 73 97 CallType JSFunction::getCallData(CallData& callData) 74 98 { 99 if (isHostFunction()) { 100 callData.native.function = nativeFunction(); 101 return CallTypeHost; 102 } 75 103 callData.js.functionBody = m_body.get(); 76 callData.js.scopeChain = m_scopeChain.node();104 callData.js.scopeChain = scopeChain().node(); 77 105 return CallTypeJS; 78 106 } … … 80 108 JSValue JSFunction::call(ExecState* exec, JSValue thisValue, const ArgList& args) 81 109 { 82 return exec->interpreter()->execute(m_body.get(), exec, this, thisValue.toThisObject(exec), args, m_scopeChain.node(), exec->exceptionSlot()); 110 ASSERT(!isHostFunction()); 111 return exec->interpreter()->execute(m_body.get(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot()); 83 112 } 84 113 … … 86 115 { 87 116 JSFunction* thisObj = asFunction(slot.slotBase()); 117 ASSERT(!thisObj->isHostFunction()); 88 118 return exec->interpreter()->retrieveArguments(exec, thisObj); 89 119 } … … 92 122 { 93 123 JSFunction* thisObj = asFunction(slot.slotBase()); 124 ASSERT(!thisObj->isHostFunction()); 94 125 return exec->interpreter()->retrieveCaller(exec, thisObj); 95 126 } … … 98 129 { 99 130 JSFunction* thisObj = asFunction(slot.slotBase()); 131 ASSERT(!thisObj->isHostFunction()); 100 132 return jsNumber(exec, thisObj->m_body->parameterCount()); 101 133 } … … 103 135 bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 104 136 { 137 if (isHostFunction()) 138 return Base::getOwnPropertySlot(exec, propertyName, slot); 139 105 140 if (propertyName == exec->propertyNames().prototype) { 106 141 JSValue* location = getDirectLocation(propertyName); 107 142 108 143 if (!location) { 109 JSObject* prototype = new (exec) JSObject( m_scopeChain.globalObject()->emptyObjectStructure());144 JSObject* prototype = new (exec) JSObject(scopeChain().globalObject()->emptyObjectStructure()); 110 145 prototype->putDirect(exec->propertyNames().constructor, this, DontEnum); 111 146 putDirect(exec->propertyNames().prototype, prototype, DontDelete); … … 136 171 void JSFunction::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) 137 172 { 173 if (isHostFunction()) { 174 Base::put(exec, propertyName, value, slot); 175 return; 176 } 138 177 if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length) 139 178 return; … … 143 182 bool JSFunction::deleteProperty(ExecState* exec, const Identifier& propertyName) 144 183 { 184 if (isHostFunction()) 185 return Base::deleteProperty(exec, propertyName); 145 186 if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length) 146 187 return false; … … 151 192 ConstructType JSFunction::getConstructData(ConstructData& constructData) 152 193 { 194 if (isHostFunction()) 195 return ConstructTypeNone; 153 196 constructData.js.functionBody = m_body.get(); 154 constructData.js.scopeChain = m_scopeChain.node();197 constructData.js.scopeChain = scopeChain().node(); 155 198 return ConstructTypeJS; 156 199 } … … 158 201 JSObject* JSFunction::construct(ExecState* exec, const ArgList& args) 159 202 { 203 ASSERT(!isHostFunction()); 160 204 Structure* structure; 161 205 JSValue prototype = get(exec, exec->propertyNames().prototype); … … 166 210 JSObject* thisObj = new (exec) JSObject(structure); 167 211 168 JSValue result = exec->interpreter()->execute(m_body.get(), exec, this, thisObj, args, m_scopeChain.node(), exec->exceptionSlot());212 JSValue result = exec->interpreter()->execute(m_body.get(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot()); 169 213 if (exec->hadException() || !result.isObject()) 170 214 return thisObj; -
trunk/JavaScriptCore/runtime/JSFunction.h
r43122 r43220 47 47 JSFunction(PassRefPtr<Structure> structure) 48 48 : InternalFunction(structure) 49 , m_scopeChain(NoScopeChain())50 49 { 50 clearScopeChain(); 51 51 } 52 52 53 53 public: 54 JSFunction(ExecState*, PassRefPtr<Structure>, int length, const Identifier&, NativeFunction); 54 55 JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*); 55 56 ~JSFunction(); … … 62 63 JSValue call(ExecState*, JSValue thisValue, const ArgList&); 63 64 64 void setScope(const ScopeChain& scopeChain) { m_scopeChain = scopeChain; }65 ScopeChain& scope() { return m_scopeChain; }65 void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); } 66 ScopeChain& scope() { return scopeChain(); } 66 67 67 68 void setBody(FunctionBodyNode* body) { m_body = body; } … … 78 79 } 79 80 81 #if ENABLE(JIT) 82 bool isHostFunction() const { return m_body && m_body->isHostFunction(); } 83 #else 84 bool isHostFunction() const { return false; } 85 #endif 80 86 private: 81 87 virtual const ClassInfo* classInfo() const { return &info; } … … 89 95 90 96 RefPtr<FunctionBodyNode> m_body; 91 ScopeChain m_scopeChain; 97 ScopeChain& scopeChain() 98 { 99 ASSERT(!isHostFunction()); 100 return *reinterpret_cast<ScopeChain*>(m_data); 101 } 102 void clearScopeChain() 103 { 104 ASSERT(!isHostFunction()); 105 new (m_data) ScopeChain(NoScopeChain()); 106 } 107 void setScopeChain(ScopeChainNode* sc) 108 { 109 ASSERT(!isHostFunction()); 110 new (m_data) ScopeChain(sc); 111 } 112 void setScopeChain(const ScopeChain& sc) 113 { 114 ASSERT(!isHostFunction()); 115 *reinterpret_cast<ScopeChain*>(m_data) = sc; 116 } 117 NativeFunction nativeFunction() 118 { 119 return *reinterpret_cast<NativeFunction*>(m_data); 120 } 121 void setNativeFunction(NativeFunction func) 122 { 123 *reinterpret_cast<NativeFunction*>(m_data) = func; 124 } 125 unsigned char m_data[sizeof(void*)]; 92 126 }; 93 127 -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r43153 r43220 39 39 #include "JSByteArray.h" 40 40 #include "JSClassRef.h" 41 #include "JSFunction.h" 41 42 #include "JSLock.h" 42 43 #include "JSNotAnObject.h" … … 162 163 regExpConstructorTable->deleteTable(); 163 164 stringTable->deleteTable(); 165 #if ENABLE(JIT) 166 lazyNativeFunctionThunk.clear(); 167 #endif 168 164 169 delete arrayTable; 165 170 delete dateTable; … … 227 232 } 228 233 234 void JSGlobalData::createNativeThunk() 235 { 236 #if ENABLE(JIT) 237 lazyNativeFunctionThunk = FunctionBodyNode::createNativeThunk(this); 238 #endif 239 } 240 229 241 // FIXME: We can also detect forms like v1 < v2 ? -1 : 0, reverse comparison, etc. 230 242 const Vector<Instruction>& JSGlobalData::numericCompareFunction(ExecState* exec) … … 245 257 } 246 258 259 247 260 } // namespace JSC -
trunk/JavaScriptCore/runtime/JSGlobalData.h
r43122 r43220 47 47 class ArgList; 48 48 class CommonIdentifiers; 49 class FunctionBodyNode; 49 50 class Heap; 50 51 class IdentifierTable; … … 120 121 #if ENABLE(JIT) 121 122 JITStubs jitStubs; 123 FunctionBodyNode* nativeFunctionThunk() { 124 if (!lazyNativeFunctionThunk) 125 createNativeThunk(); 126 return lazyNativeFunctionThunk.get(); 127 } 128 RefPtr<FunctionBodyNode> lazyNativeFunctionThunk; 122 129 #endif 123 130 TimeoutChecker timeoutChecker; … … 148 155 JSGlobalData(bool isShared, const VPtrSet&); 149 156 static JSGlobalData*& sharedInstanceInternal(); 157 void createNativeThunk(); 150 158 }; 151 159 } // namespace JSC -
trunk/JavaScriptCore/runtime/JSGlobalObject.cpp
r43122 r43220 204 204 d()->functionPrototype = new (exec) FunctionPrototype(exec, FunctionPrototype::createStructure(jsNull())); // The real prototype will be set once ObjectPrototype is created. 205 205 d()->prototypeFunctionStructure = PrototypeFunction::createStructure(d()->functionPrototype); 206 PrototypeFunction* callFunction = 0;207 PrototypeFunction* applyFunction = 0;206 NativeFunctionWrapper* callFunction = 0; 207 NativeFunctionWrapper* applyFunction = 0; 208 208 d()->functionPrototype->addFunctionProperties(exec, d()->prototypeFunctionStructure.get(), &callFunction, &applyFunction); 209 209 d()->callFunction = callFunction; … … 325 325 d()->evalFunction = new (exec) GlobalEvalFunction(exec, GlobalEvalFunction::createStructure(d()->functionPrototype), 1, exec->propertyNames().eval, globalFuncEval, this); 326 326 putDirectFunctionWithoutTransition(exec, d()->evalFunction, DontEnum); 327 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);328 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);329 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);330 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);331 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);332 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);333 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);334 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);335 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);336 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);327 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum); 328 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum); 329 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum); 330 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum); 331 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum); 332 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum); 333 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum); 334 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum); 335 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum); 336 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum); 337 337 #ifndef NDEBUG 338 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "jscprint"), globalFuncJSCPrint), DontEnum);338 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, d()->prototypeFunctionStructure.get(), 1, Identifier(exec, "jscprint"), globalFuncJSCPrint), DontEnum); 339 339 #endif 340 340 -
trunk/JavaScriptCore/runtime/JSGlobalObject.h
r43122 r43220 25 25 #include "JSGlobalData.h" 26 26 #include "JSVariableObject.h" 27 #include "NativeFunctionWrapper.h" 27 28 #include "NumberPrototype.h" 28 29 #include "StringPrototype.h" … … 108 109 109 110 GlobalEvalFunction* evalFunction; 110 PrototypeFunction* callFunction;111 PrototypeFunction* applyFunction;111 NativeFunctionWrapper* callFunction; 112 NativeFunctionWrapper* applyFunction; 112 113 113 114 ObjectPrototype* objectPrototype; -
trunk/JavaScriptCore/runtime/Lookup.cpp
r43122 r43220 70 70 71 71 if (!location) { 72 PrototypeFunction* function = new (exec) PrototypeFunction(exec, entry->functionLength(), propertyName, entry->function());72 InternalFunction* function = new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), entry->functionLength(), propertyName, entry->function()); 73 73 thisObj->putDirect(propertyName, function, entry->attributes()); 74 74 location = thisObj->getDirectLocation(propertyName); -
trunk/JavaScriptCore/runtime/Lookup.h
r43122 r43220 24 24 #include "CallFrame.h" 25 25 #include "Identifier.h" 26 #include "JSFunction.h"27 26 #include "JSGlobalObject.h" 28 27 #include "JSObject.h" -
trunk/JavaScriptCore/runtime/NumberPrototype.cpp
r43122 r43220 52 52 // The constructor will be added later, after NumberConstructor has been constructed 53 53 54 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum);55 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum);56 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum);57 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum);58 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum);59 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum);54 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toString, numberProtoFuncToString), DontEnum); 55 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, numberProtoFuncToLocaleString), DontEnum); 56 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, numberProtoFuncValueOf), DontEnum); 57 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toFixed, numberProtoFuncToFixed), DontEnum); 58 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toExponential, numberProtoFuncToExponential), DontEnum); 59 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().toPrecision, numberProtoFuncToPrecision), DontEnum); 60 60 } 61 61 -
trunk/JavaScriptCore/runtime/ObjectPrototype.cpp
r43122 r43220 43 43 : JSObject(stucture) 44 44 { 45 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum);46 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum);47 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum);48 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum);49 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum);50 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum);45 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, objectProtoFuncToString), DontEnum); 46 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toLocaleString, objectProtoFuncToLocaleString), DontEnum); 47 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().valueOf, objectProtoFuncValueOf), DontEnum); 48 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().hasOwnProperty, objectProtoFuncHasOwnProperty), DontEnum); 49 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().propertyIsEnumerable, objectProtoFuncPropertyIsEnumerable), DontEnum); 50 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().isPrototypeOf, objectProtoFuncIsPrototypeOf), DontEnum); 51 51 52 52 // Mozilla extensions 53 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum);54 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum);55 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum);56 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum);53 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineGetter__, objectProtoFuncDefineGetter), DontEnum); 54 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().__defineSetter__, objectProtoFuncDefineSetter), DontEnum); 55 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupGetter__, objectProtoFuncLookupGetter), DontEnum); 56 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().__lookupSetter__, objectProtoFuncLookupSetter), DontEnum); 57 57 } 58 58 -
trunk/JavaScriptCore/runtime/RegExpPrototype.cpp
r43122 r43220 48 48 : JSObject(structure) 49 49 { 50 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum);51 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum);52 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum);53 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum);50 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().compile, regExpProtoFuncCompile), DontEnum); 51 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().exec, regExpProtoFuncExec), DontEnum); 52 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().test, regExpProtoFuncTest), DontEnum); 53 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 0, exec->propertyNames().toString, regExpProtoFuncToString), DontEnum); 54 54 } 55 55 -
trunk/JavaScriptCore/runtime/StringConstructor.cpp
r43122 r43220 54 54 55 55 // ECMA 15.5.3.2 fromCharCode() 56 putDirectFunctionWithoutTransition(exec, new (exec) PrototypeFunction(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum);56 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().fromCharCode, stringFromCharCode), DontEnum); 57 57 58 58 // no. of arguments for constructor
Note:
See TracChangeset
for help on using the changeset viewer.