| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #ifndef JSByteArray_h | 26 #ifndef JSByteArray_h |
| 27 #define JSByteArray_h | 27 #define JSByteArray_h |
| 28 | 28 |
| 29 #include "JSObject.h" | 29 #include "JSObject.h" |
| 30 | 30 |
| 31 #include <wtf/ByteArray.h> | 31 #include <wtf/ByteArray.h> |
| 32 | 32 |
| 33 namespace JSC { | 33 namespace JSC { |
| 34 | 34 |
| 35 class JSByteArray : public JSObject { | 35 class JSByteArray : public JSObject { |
| 36 friend class Interpreter; | 36 friend class VPtrSet; |
| 37 public: | 37 public: |
| 38 bool canAccessIndex(unsigned i) { return i < m_storage->length(); } | 38 bool canAccessIndex(unsigned i) { return i < m_storage->length(); } |
| 39 JSValuePtr getIndex(ExecState* exec, unsigned i) | 39 JSValuePtr getIndex(ExecState* exec, unsigned i) |
| 40 { | 40 { |
| 41 ASSERT(canAccessIndex(i)); | 41 ASSERT(canAccessIndex(i)); |
| 42 return jsNumber(exec, m_storage->data()[i]); | 42 return jsNumber(exec, m_storage->data()[i]); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void setIndex(unsigned i, int value) | 45 void setIndex(unsigned i, int value) |
| 46 { | 46 { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 RefPtr<WTF::ByteArray> m_storage; | 101 RefPtr<WTF::ByteArray> m_storage; |
| 102 const ClassInfo* m_classInfo; | 102 const ClassInfo* m_classInfo; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 JSByteArray* asByteArray(JSValuePtr value); | 105 JSByteArray* asByteArray(JSValuePtr value); |
| 106 inline JSByteArray* asByteArray(JSValuePtr value) | 106 inline JSByteArray* asByteArray(JSValuePtr value) |
| 107 { | 107 { |
| 108 return static_cast<JSByteArray*>(asCell(value)); | 108 return static_cast<JSByteArray*>(asCell(value)); |
| 109 } | 109 } |
| 110 } | |
| 111 | 110 |
| 112 #endif | 111 inline bool isJSByteArray(JSGlobalData* globalData, JSValuePtr v) { return v
.isCell() && v.asCell()->vptr() == globalData->jsByteArrayVPtr; } |
| 112 |
| 113 } // namespace JSC |
| 114 |
| 115 #endif // JSByteArray_h |
| OLD | NEW |