Changeset 33038 in webkit for trunk/JavaScriptCore/API
- Timestamp:
- May 12, 2008, 12:12:31 AM (17 years ago)
- Location:
- trunk/JavaScriptCore/API
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSBase.cpp
r32808 r33038 85 85 86 86 JSLock lock; 87 88 // It might seem that we have a context passed to this function, and can use toJS(ctx)->heap(), but the parameter is likely to be NULL. 89 // The performance difference should be negligible anyway. 90 Heap* heap = Heap::threadHeap(); 91 if (!heap->isBusy()) 92 heap->collect(); 87 if (!Collector::isBusy()) 88 Collector::collect(); 93 89 // FIXME: Perhaps we should trigger a second mark and sweep 94 90 // once the garbage collector is done if this is called when -
trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h
r32807 r33038 467 467 if (StaticFunctionEntry* entry = staticFunctions->get(propertyName.ustring().rep())) { 468 468 if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { 469 JSObject* o = new (exec)JSCallbackFunction(exec, callAsFunction, propertyName);469 JSObject* o = new JSCallbackFunction(exec, callAsFunction, propertyName); 470 470 thisObj->putDirect(propertyName, o, entry->attributes); 471 471 return o; -
trunk/JavaScriptCore/API/JSClassRef.cpp
r32807 r33038 163 163 if (!parentPrototype) 164 164 parentPrototype = exec->dynamicGlobalObject()->objectPrototype(); 165 cachedPrototype = new (exec)JSCallbackObject<JSObject>(exec, prototypeClass, parentPrototype, this); // set ourself as the object's private data, so it can clear our reference on destruction165 cachedPrototype = new JSCallbackObject<JSObject>(exec, prototypeClass, parentPrototype, this); // set ourself as the object's private data, so it can clear our reference on destruction 166 166 } 167 167 return cachedPrototype; -
trunk/JavaScriptCore/API/JSObjectRef.cpp
r32807 r33038 75 75 76 76 if (!jsClass) 77 return toRef(new (exec)JSObject(exec->lexicalGlobalObject()->objectPrototype())); // slightly more efficient77 return toRef(new JSObject(exec->lexicalGlobalObject()->objectPrototype())); // slightly more efficient 78 78 79 79 JSValue* jsPrototype = jsClass->prototype(ctx); … … 81 81 jsPrototype = exec->lexicalGlobalObject()->objectPrototype(); 82 82 83 return toRef(new (exec)JSCallbackObject<JSObject>(exec, jsClass, jsPrototype, data));83 return toRef(new JSCallbackObject<JSObject>(exec, jsClass, jsPrototype, data)); 84 84 } 85 85 … … 90 90 Identifier nameID = name ? Identifier(toJS(name)) : Identifier("anonymous"); 91 91 92 return toRef(new (exec)JSCallbackFunction(exec, callAsFunction, nameID));92 return toRef(new JSCallbackFunction(exec, callAsFunction, nameID)); 93 93 } 94 94 … … 102 102 : exec->dynamicGlobalObject()->objectPrototype(); 103 103 104 JSCallbackConstructor* constructor = new (exec)JSCallbackConstructor(exec, jsClass, callAsConstructor);104 JSCallbackConstructor* constructor = new JSCallbackConstructor(exec, jsClass, callAsConstructor); 105 105 constructor->putDirect(exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly); 106 106 return toRef(constructor); … … 119 119 List args; 120 120 for (unsigned i = 0; i < parameterCount; i++) 121 args.append(jsString( exec,UString(toJS(parameterNames[i]))));122 args.append(jsString( exec,UString(bodyRep)));121 args.append(jsString(UString(toJS(parameterNames[i])))); 122 args.append(jsString(UString(bodyRep))); 123 123 124 124 JSObject* result = exec->dynamicGlobalObject()->functionConstructor()->construct(exec, args, nameID, UString(sourceURLRep), startingLineNumber); -
trunk/JavaScriptCore/API/JSValueRef.cpp
r32807 r33038 177 177 } 178 178 179 JSValueRef JSValueMakeNumber(JSContextRef ctx, double value)180 { 181 JSLock lock; 182 return toRef(jsNumber( toJS(ctx),value));183 } 184 185 JSValueRef JSValueMakeString(JSContextRef ctx, JSStringRef string)179 JSValueRef JSValueMakeNumber(JSContextRef, double value) 180 { 181 JSLock lock; 182 return toRef(jsNumber(value)); 183 } 184 185 JSValueRef JSValueMakeString(JSContextRef, JSStringRef string) 186 186 { 187 187 JSLock lock; 188 188 UString::Rep* rep = toJS(string); 189 return toRef(jsString( toJS(ctx),UString(rep)));189 return toRef(jsString(UString(rep))); 190 190 } 191 191
Note:
See TracChangeset
for help on using the changeset viewer.