Changeset 34372 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Jun 4, 2008, 10:36:55 PM (17 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/CallData.h
r33979 r34372 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 29 #ifndef CallData_h 30 30 #define CallData_h -
trunk/JavaScriptCore/kjs/JSNotAnObject.cpp
r33979 r34372 34 34 35 35 namespace KJS { 36 // JSValue methods37 JSValue *JSNotAnObject::toPrimitive(ExecState* exec, JSType) const38 {39 UNUSED_PARAM(exec);40 ASSERT(exec->hadException() && exec->exception() == m_exception);41 return m_exception;42 }43 44 bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue*&)45 {46 UNUSED_PARAM(exec);47 ASSERT(exec->hadException() && exec->exception() == m_exception);48 return false;49 }50 51 bool JSNotAnObject::toBoolean(ExecState* exec) const52 {53 UNUSED_PARAM(exec);54 ASSERT(exec->hadException() && exec->exception() == m_exception);55 return false;56 }57 58 double JSNotAnObject::toNumber(ExecState* exec) const59 {60 UNUSED_PARAM(exec);61 ASSERT(exec->hadException() && exec->exception() == m_exception);62 return NaN;63 }64 36 65 UString JSNotAnObject::toString(ExecState* exec) const 66 { 67 UNUSED_PARAM(exec); 68 ASSERT(exec->hadException() && exec->exception() == m_exception); 69 return ""; 70 } 71 72 JSObject *JSNotAnObject::toObject(ExecState* exec) const 73 { 74 UNUSED_PARAM(exec); 75 ASSERT(exec->hadException() && exec->exception() == m_exception); 76 return m_exception; 77 } 78 79 // marking 80 void JSNotAnObject::mark() 81 { 82 JSCell::mark(); 83 if (!m_exception->marked()) 84 m_exception->mark(); 85 } 86 87 bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, const Identifier&, PropertySlot&) 88 { 89 UNUSED_PARAM(exec); 90 ASSERT(exec->hadException() && exec->exception() == m_exception); 91 return false; 92 } 93 94 bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, unsigned, PropertySlot&) 95 { 96 UNUSED_PARAM(exec); 97 ASSERT(exec->hadException() && exec->exception() == m_exception); 98 return false; 99 } 100 101 void JSNotAnObject::put(ExecState* exec, const Identifier& , JSValue*) 102 { 103 UNUSED_PARAM(exec); 104 ASSERT(exec->hadException() && exec->exception() == m_exception); 105 } 106 107 void JSNotAnObject::put(ExecState* exec, unsigned, JSValue*) 108 { 109 UNUSED_PARAM(exec); 110 ASSERT(exec->hadException() && exec->exception() == m_exception); 111 } 112 113 bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier &) 114 { 115 UNUSED_PARAM(exec); 116 ASSERT(exec->hadException() && exec->exception() == m_exception); 117 return false; 118 } 119 120 bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned) 121 { 122 UNUSED_PARAM(exec); 123 ASSERT(exec->hadException() && exec->exception() == m_exception); 124 return false; 125 } 126 127 JSValue *JSNotAnObject::defaultValue(ExecState* exec, JSType) const 128 { 129 UNUSED_PARAM(exec); 130 ASSERT(exec->hadException() && exec->exception() == m_exception); 131 return m_exception; 132 } 133 134 JSObject* JSNotAnObject::construct(ExecState* exec, const List&) 135 { 136 UNUSED_PARAM(exec); 137 ASSERT(exec->hadException() && exec->exception() == m_exception); 138 return m_exception; 139 } 140 141 JSObject* JSNotAnObject::construct(ExecState* exec, const List&, const Identifier&, const UString&, int) 142 { 143 UNUSED_PARAM(exec); 144 ASSERT(exec->hadException() && exec->exception() == m_exception); 145 return m_exception; 146 } 147 148 JSValue* JSNotAnObject::callAsFunction(ExecState* exec, JSObject *, const List &) 149 { 150 UNUSED_PARAM(exec); 151 ASSERT(exec->hadException() && exec->exception() == m_exception); 152 return m_exception; 153 } 154 155 void JSNotAnObject::getPropertyNames(ExecState* exec, PropertyNameArray&) 156 { 157 UNUSED_PARAM(exec); 158 ASSERT(exec->hadException() && exec->exception() == m_exception); 159 } 160 37 // JSValue methods 38 JSValue* JSNotAnObject::toPrimitive(ExecState* exec, JSType) const 39 { 40 UNUSED_PARAM(exec); 41 ASSERT(exec->hadException() && exec->exception() == m_exception); 42 return m_exception; 161 43 } 44 45 bool JSNotAnObject::getPrimitiveNumber(ExecState* exec, double&, JSValue*&) 46 { 47 UNUSED_PARAM(exec); 48 ASSERT(exec->hadException() && exec->exception() == m_exception); 49 return false; 50 } 51 52 bool JSNotAnObject::toBoolean(ExecState* exec) const 53 { 54 UNUSED_PARAM(exec); 55 ASSERT(exec->hadException() && exec->exception() == m_exception); 56 return false; 57 } 58 59 double JSNotAnObject::toNumber(ExecState* exec) const 60 { 61 UNUSED_PARAM(exec); 62 ASSERT(exec->hadException() && exec->exception() == m_exception); 63 return NaN; 64 } 65 66 UString JSNotAnObject::toString(ExecState* exec) const 67 { 68 UNUSED_PARAM(exec); 69 ASSERT(exec->hadException() && exec->exception() == m_exception); 70 return ""; 71 } 72 73 JSObject* JSNotAnObject::toObject(ExecState* exec) const 74 { 75 UNUSED_PARAM(exec); 76 ASSERT(exec->hadException() && exec->exception() == m_exception); 77 return m_exception; 78 } 79 80 // Marking 81 void JSNotAnObject::mark() 82 { 83 JSCell::mark(); 84 if (!m_exception->marked()) 85 m_exception->mark(); 86 } 87 88 // JSObject methods 89 bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, const Identifier&, PropertySlot&) 90 { 91 UNUSED_PARAM(exec); 92 ASSERT(exec->hadException() && exec->exception() == m_exception); 93 return false; 94 } 95 96 bool JSNotAnObject::getOwnPropertySlot(ExecState* exec, unsigned, PropertySlot&) 97 { 98 UNUSED_PARAM(exec); 99 ASSERT(exec->hadException() && exec->exception() == m_exception); 100 return false; 101 } 102 103 void JSNotAnObject::put(ExecState* exec, const Identifier& , JSValue*) 104 { 105 UNUSED_PARAM(exec); 106 ASSERT(exec->hadException() && exec->exception() == m_exception); 107 } 108 109 void JSNotAnObject::put(ExecState* exec, unsigned, JSValue*) 110 { 111 UNUSED_PARAM(exec); 112 ASSERT(exec->hadException() && exec->exception() == m_exception); 113 } 114 115 bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier&) 116 { 117 UNUSED_PARAM(exec); 118 ASSERT(exec->hadException() && exec->exception() == m_exception); 119 return false; 120 } 121 122 bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned) 123 { 124 UNUSED_PARAM(exec); 125 ASSERT(exec->hadException() && exec->exception() == m_exception); 126 return false; 127 } 128 129 JSValue* JSNotAnObject::defaultValue(ExecState* exec, JSType) const 130 { 131 UNUSED_PARAM(exec); 132 ASSERT(exec->hadException() && exec->exception() == m_exception); 133 return m_exception; 134 } 135 136 JSObject* JSNotAnObject::construct(ExecState* exec, const List&) 137 { 138 UNUSED_PARAM(exec); 139 ASSERT(exec->hadException() && exec->exception() == m_exception); 140 return m_exception; 141 } 142 143 JSObject* JSNotAnObject::construct(ExecState* exec, const List&, const Identifier&, const UString&, int) 144 { 145 UNUSED_PARAM(exec); 146 ASSERT(exec->hadException() && exec->exception() == m_exception); 147 return m_exception; 148 } 149 150 JSValue* JSNotAnObject::callAsFunction(ExecState* exec, JSObject*, const List&) 151 { 152 UNUSED_PARAM(exec); 153 ASSERT(exec->hadException() && exec->exception() == m_exception); 154 return m_exception; 155 } 156 157 void JSNotAnObject::getPropertyNames(ExecState* exec, PropertyNameArray&) 158 { 159 UNUSED_PARAM(exec); 160 ASSERT(exec->hadException() && exec->exception() == m_exception); 161 } 162 163 } // namespace KJS -
trunk/JavaScriptCore/kjs/JSNotAnObject.h
r33979 r34372 33 33 34 34 namespace KJS { 35 35 36 36 // This unholy class is used to allow us to avoid multiple exception checks 37 37 // in certain SquirrelFish opcodes -- effectively it just silently consumes … … 45 45 46 46 // JSValue methods 47 virtual JSValue *toPrimitive(ExecState* exec, JSType preferredType = UnspecifiedType) const;48 virtual bool getPrimitiveNumber(ExecState* exec, double& number, JSValue*& value);49 virtual bool toBoolean(ExecState* exec) const;50 virtual double toNumber(ExecState* exec) const;51 virtual UString toString(ExecState* exec) const;52 virtual JSObject *toObject(ExecState* exec) const;53 54 // marking47 virtual JSValue* toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const; 48 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*&); 49 virtual bool toBoolean(ExecState*) const; 50 virtual double toNumber(ExecState*) const; 51 virtual UString toString(ExecState*) const; 52 virtual JSObject* toObject(ExecState*) const; 53 54 // Marking 55 55 virtual void mark(); 56 56 57 virtual bool getOwnPropertySlot(ExecState* , const Identifier&, PropertySlot&); 58 virtual bool getOwnPropertySlot(ExecState* , unsigned index, PropertySlot&); 57 // JSObject methods 58 virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); 59 virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); 59 60 60 virtual void put(ExecState*, const Identifier& propertyName, JSValue* value);61 virtual void put(ExecState*, unsigned propertyName, JSValue* value);61 virtual void put(ExecState*, const Identifier& propertyName, JSValue*); 62 virtual void put(ExecState*, unsigned propertyName, JSValue*); 62 63 63 virtual bool deleteProperty(ExecState* exec, const Identifier &propertyName);64 virtual bool deleteProperty(ExecState* exec, unsigned propertyName);64 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 65 virtual bool deleteProperty(ExecState*, unsigned propertyName); 65 66 66 virtual JSValue *defaultValue(ExecState* exec, JSType hint) const;67 virtual JSValue* defaultValue(ExecState*, JSType hint) const; 67 68 68 virtual JSObject* construct(ExecState* exec, const List& args);69 virtual JSObject* construct(ExecState* exec, const List& args, const Identifier& functionName, const UString& sourceURL, int lineNumber);70 71 virtual JSValue *callAsFunction(ExecState* exec, JSObject *thisObj, const List &args);69 virtual JSObject* construct(ExecState*, const List&); 70 virtual JSObject* construct(ExecState*, const List&, const Identifier& functionName, const UString& sourceURL, int lineNumber); 71 72 virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List&); 72 73 73 74 virtual void getPropertyNames(ExecState*, PropertyNameArray&); … … 76 77 JSObject* m_exception; 77 78 }; 78 }79 79 80 #endif 80 } // namespace KJS 81 82 #endif // JSNotAnObject_h -
trunk/JavaScriptCore/kjs/JSVariableObject.h
r34355 r34372 55 55 56 56 JSValue*& valueAt(int index) const { return registers()[index].u.jsValue; } 57 57 58 protected: 58 59 // Subclasses of JSVariableObject can subclass this struct to add data -
trunk/JavaScriptCore/kjs/LocalStorageEntry.h
r32259 r34372 23 23 */ 24 24 25 #ifndef KJS_LOCAL_STORAGE_H26 #define KJS_LOCAL_STORAGE_H25 #ifndef LocalStorageEntry_h 26 #define LocalStorageEntry_h 27 27 28 28 #include <wtf/Forward.h> … … 30 30 31 31 namespace KJS { 32 32 33 class JSValue; 33 34 … … 48 49 49 50 typedef Vector<LocalStorageEntry, 32> LocalStorage; 50 } 51 52 } // namespace KJS 51 53 52 54 namespace WTF { 55 53 56 template<> struct VectorTraits<KJS::LocalStorageEntry> : VectorTraitsBase<true, KJS::LocalStorageEntry> { }; 54 }55 57 56 #endif // KJS_LOCAL_STORAGE_H 58 } // namespace WTF 59 60 #endif // LocalStorageEntry_h -
trunk/JavaScriptCore/kjs/PropertyNameArray.h
r33979 r34372 20 20 */ 21 21 22 #ifndef KJS_PROPERTY_NAME_ARRAY_H23 #define KJS_PROPERTY_NAME_ARRAY_H22 #ifndef PropertyNameArray_h 23 #define PropertyNameArray_h 24 24 25 25 #include "identifier.h" … … 37 37 void add(UString::Rep*); 38 38 void addKnownUnique(UString::Rep* identifier) { m_vector.append(identifier); } 39 39 40 const_iterator begin() const { return m_vector.begin(); } 40 41 const_iterator end() const { return m_vector.end(); } 42 41 43 size_t size() const { return m_vector.size(); } 42 44 … … 45 47 46 48 Identifier* releaseIdentifiers() { return size() ? m_vector.releaseBuffer() : 0; } 49 47 50 private: 48 51 typedef HashSet<UString::Rep*, PtrHash<UString::Rep*> > IdentifierSet; … … 54 57 } // namespace KJS 55 58 56 57 #endif // KJS_PROPERTY_NAME_ARRAY_H 59 #endif // PropertyNameArray_h -
trunk/JavaScriptCore/kjs/SourceProvider.h
r33979 r34372 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 29 #ifndef SourceProvider_h 30 30 #define SourceProvider_h … … 37 37 class SourceProvider : public RefCounted<SourceProvider> { 38 38 public: 39 virtual ~SourceProvider() { }39 virtual ~SourceProvider() { } 40 40 virtual UString getRange(int start, int end) const = 0; 41 41 virtual const UChar* data() const = 0; … … 52 52 53 53 private: 54 UStringSourceProvider(const UString& source) : m_source(source) {} 54 UStringSourceProvider(const UString& source) 55 : m_source(source) 56 { 57 } 58 55 59 UString m_source; 56 60 }; 57 61 58 } 62 } // namespace KJS 59 63 60 64 #endif // SourceProvider_h -
trunk/JavaScriptCore/kjs/SourceRange.h
r33979 r34372 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 29 #ifndef SourceRange_h 30 30 #define SourceRange_h … … 37 37 class SourceRange { 38 38 public: 39 SourceRange(PassRefPtr<SourceProvider> provider, int start, int end) 39 SourceRange(PassRefPtr<SourceProvider> provider, int start, int end) 40 40 : m_sourceProvider(provider) 41 41 , m_startChar(start) … … 43 43 { 44 44 } 45 SourceRange() {}46 45 47 UString toString() const { if (!m_sourceProvider) return UString(); return m_sourceProvider->getRange(m_startChar, m_endChar); } 46 SourceRange() 47 { 48 } 49 50 UString toString() const 51 { 52 if (!m_sourceProvider) 53 return UString(); 54 return m_sourceProvider->getRange(m_startChar, m_endChar); 55 } 48 56 49 57 private: … … 53 61 }; 54 62 55 } 63 } // namespace KJS 56 64 57 65 #endif // SourceRange_h -
trunk/JavaScriptCore/kjs/scope_chain.h
r34007 r34372 45 45 JSObject* globalThis; 46 46 int refCount; 47 47 48 48 void deref() { if (--refCount == 0) release(); } 49 49 void ref() { ++refCount; } … … 119 119 class ScopeChainIterator { 120 120 public: 121 ScopeChainIterator(const ScopeChainNode* node) : m_node(node) {} 121 ScopeChainIterator(const ScopeChainNode* node) 122 : m_node(node) 123 { 124 } 122 125 123 126 JSObject* const & operator*() const { return m_node->object; } … … 188 191 void print() const { _node->print(); } 189 192 #endif 190 193 191 194 private: 192 195 ScopeChainNode* _node; -
trunk/JavaScriptCore/kjs/value.cpp
r34355 r34372 81 81 static const double D32 = 4294967296.0; 82 82 83 void *JSCell::operator new(size_t size)83 void* JSCell::operator new(size_t size) 84 84 { 85 85 return Collector::allocate(size); … … 102 102 103 103 // ECMA 9.4 104 double JSValue::toInteger(ExecState *exec) const104 double JSValue::toInteger(ExecState* exec) const 105 105 { 106 106 int32_t i; … … 111 111 } 112 112 113 double JSValue::toIntegerPreserveNaN(ExecState *exec) const113 double JSValue::toIntegerPreserveNaN(ExecState* exec) const 114 114 { 115 115 int32_t i; … … 172 172 } 173 173 174 bool JSCell::getNumber(double &numericValue) const174 bool JSCell::getNumber(double& numericValue) const 175 175 { 176 176 if (!isNumber()) 177 177 return false; 178 numericValue = static_cast<const NumberImp 178 numericValue = static_cast<const NumberImp*>(this)->value(); 179 179 return true; 180 180 } … … 182 182 double JSCell::getNumber() const 183 183 { 184 return isNumber() ? static_cast<const NumberImp 185 } 186 187 bool JSCell::getString(UString 184 return isNumber() ? static_cast<const NumberImp*>(this)->value() : NaN; 185 } 186 187 bool JSCell::getString(UString&stringValue) const 188 188 { 189 189 if (!isString()) 190 190 return false; 191 stringValue = static_cast<const StringImp 191 stringValue = static_cast<const StringImp*>(this)->value(); 192 192 return true; 193 193 } … … 195 195 UString JSCell::getString() const 196 196 { 197 return isString() ? static_cast<const StringImp 198 } 199 200 JSObject 201 { 202 return isObject() ? static_cast<JSObject 203 } 204 205 const JSObject *JSCell::getObject() const206 { 207 return isObject() ? static_cast<const JSObject 197 return isString() ? static_cast<const StringImp*>(this)->value() : UString(); 198 } 199 200 JSObject*JSCell::getObject() 201 { 202 return isObject() ? static_cast<JSObject*>(this) : 0; 203 } 204 205 const JSObject* JSCell::getObject() const 206 { 207 return isObject() ? static_cast<const JSObject*>(this) : 0; 208 208 } 209 209 -
trunk/JavaScriptCore/kjs/value.h
r34355 r34372 53 53 friend class JSCell; // so it can derive from this class 54 54 friend class Collector; // so it can call asCell() 55 56 55 private: 57 56 JSValue(); … … 68 67 bool isString() const; 69 68 bool isObject() const; 70 bool isObject(const ClassInfo 69 bool isObject(const ClassInfo*) const; 71 70 72 71 // Extracting the value. … … 78 77 bool getString(UString&) const; 79 78 UString getString() const; // null string if not a string 80 JSObject *getObject(); // NULL if not an object81 const JSObject *getObject() const; // NULL if not an object79 JSObject* getObject(); // NULL if not an object 80 const JSObject* getObject() const; // NULL if not an object 82 81 83 82 CallType getCallData(CallData&); … … 90 89 91 90 // Basic conversions. 92 JSValue* toPrimitive(ExecState* exec, JSType preferredType = UnspecifiedType) const;93 bool getPrimitiveNumber(ExecState* exec, double& number, JSValue*& value);94 95 bool toBoolean(ExecState *exec) const;91 JSValue* toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const; 92 bool getPrimitiveNumber(ExecState*, double& number, JSValue*&); 93 94 bool toBoolean(ExecState*) const; 96 95 97 96 // toNumber conversion is expected to be side effect free if an exception has 98 97 // been set in the ExecState already. 99 double toNumber(ExecState *exec) const;98 double toNumber(ExecState*) const; 100 99 JSValue* toJSNumber(ExecState*) const; // Fast path for when you expect that the value is an immediate number. 101 UString toString(ExecState *exec) const;102 JSObject* toObject(ExecState *exec) const;100 UString toString(ExecState*) const; 101 JSObject* toObject(ExecState*) const; 103 102 104 103 // Integer conversions. … … 138 137 139 138 // Implementation details. 140 JSCell *asCell();141 const JSCell *asCell() const;139 JSCell* asCell(); 140 const JSCell* asCell() const; 142 141 }; 143 142 … … 152 151 JSCell(); 153 152 virtual ~JSCell(); 153 154 154 public: 155 155 // Querying the type. … … 158 158 bool isString() const; 159 159 bool isObject() const; 160 bool isObject(const ClassInfo 160 bool isObject(const ClassInfo*) const; 161 161 162 162 // Extracting the value. … … 165 165 bool getString(UString&) const; 166 166 UString getString() const; // null string if not a string 167 JSObject *getObject(); // NULL if not an object168 const JSObject *getObject() const; // NULL if not an object167 JSObject* getObject(); // NULL if not an object 168 const JSObject* getObject() const; // NULL if not an object 169 169 170 170 virtual CallType getCallData(CallData&); … … 177 177 178 178 // Basic conversions. 179 virtual JSValue *toPrimitive(ExecState *exec, JSType preferredType = UnspecifiedType) const = 0;180 virtual bool getPrimitiveNumber(ExecState* exec, double& number, JSValue*& value) = 0;181 virtual bool toBoolean(ExecState *exec) const = 0;182 virtual double toNumber(ExecState *exec) const = 0;183 virtual UString toString(ExecState *exec) const = 0;184 virtual JSObject *toObject(ExecState *exec) const = 0;179 virtual JSValue* toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const = 0; 180 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*&) = 0; 181 virtual bool toBoolean(ExecState*) const = 0; 182 virtual double toNumber(ExecState*) const = 0; 183 virtual UString toString(ExecState*) const = 0; 184 virtual JSObject* toObject(ExecState*) const = 0; 185 185 186 186 // Garbage collection. 187 void *operator new(size_t);187 void* operator new(size_t); 188 188 virtual void mark(); 189 189 bool marked() const; … … 200 200 201 201 class NumberImp : public JSCell { 202 friend JSValue* jsNumberCell(double); 203 202 friend JSValue* jsNumberCell(double); 204 203 public: 205 double value() const { return val; }206 207 virtual JSType type() const;208 209 virtual JSValue* toPrimitive(ExecState*, JSType preferred = UnspecifiedType) const;210 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);211 virtual bool toBoolean(ExecState* exec) const;212 virtual double toNumber(ExecState* exec) const;213 virtual UString toString(ExecState* exec) const;214 virtual JSObject* toObject(ExecState* exec) const;204 double value() const { return val; } 205 206 virtual JSType type() const; 207 208 virtual JSValue* toPrimitive(ExecState*, JSType preferred = UnspecifiedType) const; 209 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value); 210 virtual bool toBoolean(ExecState*) const; 211 virtual double toNumber(ExecState*) const; 212 virtual UString toString(ExecState*) const; 213 virtual JSObject* toObject(ExecState*) const; 215 214 virtual JSObject* toThisObject(ExecState*) const; 216 215 217 void* operator new(size_t size)218 {216 void* operator new(size_t size) 217 { 219 218 #ifdef JAVASCRIPTCORE_BUILDING_ALL_IN_ONE_FILE 220 return Collector::inlineAllocateNumber(size);219 return Collector::inlineAllocateNumber(size); 221 220 #else 222 return Collector::allocateNumber(size);221 return Collector::allocateNumber(size); 223 222 #endif 224 }223 } 225 224 226 225 private: 227 NumberImp(double v) : val(v) { } 228 229 virtual bool getUInt32(uint32_t&) const; 230 virtual bool getTruncatedInt32(int32_t&) const; 231 virtual bool getTruncatedUInt32(uint32_t&) const; 232 233 double val; 226 NumberImp(double v) 227 : val(v) 228 { 229 } 230 231 virtual bool getUInt32(uint32_t&) const; 232 virtual bool getTruncatedInt32(int32_t&) const; 233 virtual bool getTruncatedUInt32(uint32_t&) const; 234 235 double val; 234 236 }; 235 237 236 JSCell *jsString(const UString&); // returns empty string if passed null string237 JSCell *jsString(const char* = ""); // returns empty string if passed 0238 JSCell* jsString(const UString&); // returns empty string if passed null string 239 JSCell* jsString(const char* = ""); // returns empty string if passed 0 238 240 239 241 // should be used for strings that are owned by an object that will 240 242 // likely outlive the JSValue this makes, such as the parse tree or a 241 243 // DOM object that contains a UString 242 JSCell *jsOwnedString(const UString&);244 JSCell* jsOwnedString(const UString&); 243 245 244 246 extern const double NaN; … … 252 254 } 253 255 254 ALWAYS_INLINE JSValue *jsUndefined()256 ALWAYS_INLINE JSValue* jsUndefined() 255 257 { 256 258 return JSImmediate::undefinedImmediate(); 257 259 } 258 260 259 inline JSValue *jsNull()261 inline JSValue* jsNull() 260 262 { 261 263 return JSImmediate::nullImmediate(); 262 264 } 263 265 264 inline JSValue *jsNaN()266 inline JSValue* jsNaN() 265 267 { 266 268 return jsNumberCell(NaN); 267 269 } 268 270 269 inline JSValue *jsBoolean(bool b)271 inline JSValue* jsBoolean(bool b) 270 272 { 271 273 return b ? JSImmediate::trueImmediate() : JSImmediate::falseImmediate(); … … 608 610 } 609 611 610 } // namespace 612 } // namespace KJS 611 613 612 614 #endif // KJS_VALUE_H
Note:
See TracChangeset
for help on using the changeset viewer.