| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) | 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) |
| 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
| 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reser
ved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reser
ved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 JSString* jsNontrivialString(ExecState*, const char*); | 53 JSString* jsNontrivialString(ExecState*, const char*); |
| 54 | 54 |
| 55 // Should be used for strings that are owned by an object that will | 55 // Should be used for strings that are owned by an object that will |
| 56 // likely outlive the JSValue this makes, such as the parse tree or a | 56 // likely outlive the JSValue this makes, such as the parse tree or a |
| 57 // DOM object that contains a UString | 57 // DOM object that contains a UString |
| 58 JSString* jsOwnedString(JSGlobalData*, const UString&); | 58 JSString* jsOwnedString(JSGlobalData*, const UString&); |
| 59 JSString* jsOwnedString(ExecState*, const UString&); | 59 JSString* jsOwnedString(ExecState*, const UString&); |
| 60 | 60 |
| 61 class JSString : public JSCell { | 61 class JSString : public JSCell { |
| 62 friend class JIT; | 62 friend class JIT; |
| 63 friend class Interpreter; | 63 friend class VPtrSet; |
| 64 | 64 |
| 65 public: | 65 public: |
| 66 JSString(JSGlobalData* globalData, const UString& value) | 66 JSString(JSGlobalData* globalData, const UString& value) |
| 67 : JSCell(globalData->stringStructure.get()) | 67 : JSCell(globalData->stringStructure.get()) |
| 68 , m_value(value) | 68 , m_value(value) |
| 69 { | 69 { |
| 70 Heap::heap(this)->reportExtraMemoryCost(value.cost()); | 70 Heap::heap(this)->reportExtraMemoryCost(value.cost()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 enum HasOtherOwnerType { HasOtherOwner }; | 73 enum HasOtherOwnerType { HasOtherOwner }; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, unsigned
propertyName, PropertySlot& slot) | 195 ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, unsigned
propertyName, PropertySlot& slot) |
| 196 { | 196 { |
| 197 if (propertyName < static_cast<unsigned>(m_value.size())) { | 197 if (propertyName < static_cast<unsigned>(m_value.size())) { |
| 198 slot.setValue(jsSingleCharacterSubstring(exec, m_value, propertyName
)); | 198 slot.setValue(jsSingleCharacterSubstring(exec, m_value, propertyName
)); |
| 199 return true; | 199 return true; |
| 200 } | 200 } |
| 201 | 201 |
| 202 return false; | 202 return false; |
| 203 } | 203 } |
| 204 | 204 |
| 205 inline bool isJSString(JSGlobalData* globalData, JSValuePtr v) { return v.is
Cell() && v.asCell()->vptr() == globalData->jsStringVPtr; } |
| 206 |
| 205 // --- JSValue inlines ---------------------------- | 207 // --- JSValue inlines ---------------------------- |
| 206 | 208 |
| 207 inline JSString* JSValuePtr::toThisJSString(ExecState* exec) | 209 inline JSString* JSValuePtr::toThisJSString(ExecState* exec) |
| 208 { | 210 { |
| 209 return JSImmediate::isImmediate(asValue()) ? jsString(exec, JSImmediate:
:toString(asValue())) : asCell()->toThisJSString(exec); | 211 return JSImmediate::isImmediate(asValue()) ? jsString(exec, JSImmediate:
:toString(asValue())) : asCell()->toThisJSString(exec); |
| 210 } | 212 } |
| 211 | 213 |
| 212 } // namespace JSC | 214 } // namespace JSC |
| 213 | 215 |
| 214 #endif // JSString_h | 216 #endif // JSString_h |
| 215 | 217 |
| 216 | 218 |
| 217 | 219 |
| OLD | NEW |