Changeset 43037 in webkit for trunk/JavaScriptCore
- Timestamp:
- Apr 29, 2009, 6:21:52 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSObjectRef.cpp
r40501 r43037 123 123 Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); 124 124 125 ArgListargs;125 MarkedArgumentBuffer args; 126 126 for (unsigned i = 0; i < parameterCount; i++) 127 127 args.append(jsString(exec, parameterNames[i]->ustring())); … … 146 146 JSObject* result; 147 147 if (argumentCount) { 148 ArgListargList;148 MarkedArgumentBuffer argList; 149 149 for (size_t i = 0; i < argumentCount; ++i) 150 150 argList.append(toJS(arguments[i])); … … 170 170 JSLock lock(exec); 171 171 172 ArgListargList;172 MarkedArgumentBuffer argList; 173 173 for (size_t i = 0; i < argumentCount; ++i) 174 174 argList.append(toJS(arguments[i])); … … 191 191 JSLock lock(exec); 192 192 193 ArgListargList;193 MarkedArgumentBuffer argList; 194 194 for (size_t i = 0; i < argumentCount; ++i) 195 195 argList.append(toJS(arguments[i])); … … 212 212 JSLock lock(exec); 213 213 214 ArgListargList;214 MarkedArgumentBuffer argList; 215 215 for (size_t i = 0; i < argumentCount; ++i) 216 216 argList.append(toJS(arguments[i])); … … 390 390 jsThisObject = exec->globalThisValue(); 391 391 392 ArgListargList;392 MarkedArgumentBuffer argList; 393 393 for (size_t i = 0; i < argumentCount; i++) 394 394 argList.append(toJS(arguments[i])); … … 429 429 return 0; 430 430 431 ArgListargList;431 MarkedArgumentBuffer argList; 432 432 for (size_t i = 0; i < argumentCount; i++) 433 433 argList.append(toJS(arguments[i])); -
trunk/JavaScriptCore/ChangeLog
r43008 r43037 1 2009-04-29 Oliver Hunt <[email protected]> 2 3 Reviewed by Gavin Barraclough. 4 5 Clean up ArgList to be a trivial type 6 7 Separate out old ArgList logic to handle buffering and marking arguments 8 into a distinct MarkedArgumentBuffer type. ArgList becomes a trivial 9 struct of a pointer and length. 10 11 * API/JSObjectRef.cpp: 12 (JSObjectMakeFunction): 13 (JSObjectMakeArray): 14 (JSObjectMakeDate): 15 (JSObjectMakeError): 16 (JSObjectMakeRegExp): 17 (JSObjectCallAsFunction): 18 (JSObjectCallAsConstructor): 19 * JavaScriptCore.exp: 20 * interpreter/CallFrame.h: 21 (JSC::ExecState::emptyList): 22 * runtime/ArgList.cpp: 23 (JSC::ArgList::getSlice): 24 (JSC::MarkedArgumentBuffer::markLists): 25 (JSC::MarkedArgumentBuffer::slowAppend): 26 * runtime/ArgList.h: 27 (JSC::MarkedArgumentBuffer::MarkedArgumentBuffer): 28 (JSC::MarkedArgumentBuffer::~MarkedArgumentBuffer): 29 (JSC::ArgList::ArgList): 30 (JSC::ArgList::at): 31 (JSC::ArgList::isEmpty): 32 (JSC::ArgList::size): 33 (JSC::ArgList::begin): 34 (JSC::ArgList::end): 35 * runtime/Arguments.cpp: 36 (JSC::Arguments::fillArgList): 37 * runtime/Arguments.h: 38 * runtime/ArrayPrototype.cpp: 39 (JSC::arrayProtoFuncConcat): 40 (JSC::arrayProtoFuncPush): 41 (JSC::arrayProtoFuncSort): 42 (JSC::arrayProtoFuncFilter): 43 (JSC::arrayProtoFuncMap): 44 (JSC::arrayProtoFuncEvery): 45 (JSC::arrayProtoFuncForEach): 46 (JSC::arrayProtoFuncSome): 47 (JSC::arrayProtoFuncReduce): 48 (JSC::arrayProtoFuncReduceRight): 49 * runtime/Collector.cpp: 50 (JSC::Heap::collect): 51 * runtime/Collector.h: 52 (JSC::Heap::markListSet): 53 * runtime/CommonIdentifiers.h: 54 * runtime/Error.cpp: 55 (JSC::Error::create): 56 * runtime/FunctionPrototype.cpp: 57 (JSC::functionProtoFuncApply): 58 * runtime/JSArray.cpp: 59 (JSC::JSArray::JSArray): 60 (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key): 61 (JSC::JSArray::fillArgList): 62 (JSC::constructArray): 63 * runtime/JSArray.h: 64 * runtime/JSGlobalData.cpp: 65 (JSC::JSGlobalData::JSGlobalData): 66 * runtime/JSGlobalData.h: 67 * runtime/JSObject.cpp: 68 (JSC::JSObject::put): 69 * runtime/StringConstructor.cpp: 70 (JSC::stringFromCharCodeSlowCase): 71 * runtime/StringPrototype.cpp: 72 (JSC::stringProtoFuncReplace): 73 (JSC::stringProtoFuncConcat): 74 (JSC::stringProtoFuncMatch): 75 1 76 2009-04-29 Laszlo Gombos <[email protected]> 2 77 -
trunk/JavaScriptCore/JavaScriptCore.exp
r42808 r43037 162 162 __ZN3JSC19initializeThreadingEv 163 163 __ZN3JSC20constructEmptyObjectEPNS_9ExecStateE 164 __ZN3JSC20MarkedArgumentBuffer10slowAppendENS_10JSValuePtrE 164 165 __ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_10JSValuePtrERKNS_7ArgListE 165 166 __ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE … … 204 205 __ZN3JSC6JSLockC1EPNS_9ExecStateE 205 206 __ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE 206 __ZN3JSC7ArgList10slowAppendENS_10JSValuePtrE207 207 __ZN3JSC7CStringD1Ev 208 208 __ZN3JSC7CStringaSERKS0_ -
trunk/JavaScriptCore/interpreter/CallFrame.h
r42537 r43037 81 81 82 82 const CommonIdentifiers& propertyNames() const { return *globalData().propertyNames; } 83 const ArgList& emptyList() const { return *globalData().emptyList; }83 const MarkedArgumentBuffer& emptyList() const { return *globalData().emptyList; } 84 84 Interpreter* interpreter() { return globalData().interpreter; } 85 85 Heap* heap() { return &globalData().heap; } -
trunk/JavaScriptCore/runtime/ArgList.cpp
r39670 r43037 31 31 void ArgList::getSlice(int startIndex, ArgList& result) const 32 32 { 33 ASSERT(!result.m_isReadOnly); 34 35 const_iterator start = min(begin() + startIndex, end()); 36 result.m_vector.appendRange(start, end()); 37 result.m_size = result.m_vector.size(); 38 result.m_buffer = result.m_vector.data(); 33 if (startIndex <= 0 || static_cast<unsigned>(startIndex) >= m_argCount) { 34 result = ArgList(m_args, 0); 35 return; 36 } 37 result = ArgList(m_args + startIndex, m_argCount - startIndex); 39 38 } 40 39 41 void ArgList::markLists(ListSet& markSet)40 void MarkedArgumentBuffer::markLists(ListSet& markSet) 42 41 { 43 42 ListSet::iterator end = markSet.end(); 44 43 for (ListSet::iterator it = markSet.begin(); it != end; ++it) { 45 ArgList* list = *it;44 MarkedArgumentBuffer* list = *it; 46 45 47 46 iterator end2 = list->end(); … … 52 51 } 53 52 54 void ArgList::slowAppend(JSValuePtr v)53 void MarkedArgumentBuffer::slowAppend(JSValuePtr v) 55 54 { 56 55 // As long as our size stays within our Vector's inline -
trunk/JavaScriptCore/runtime/ArgList.h
r42989 r43037 32 32 namespace JSC { 33 33 34 class ArgList: Noncopyable {34 class MarkedArgumentBuffer : Noncopyable { 35 35 private: 36 36 static const unsigned inlineCapacity = 8; 37 37 typedef Vector<Register, inlineCapacity> VectorType; 38 typedef HashSet< ArgList*> ListSet;38 typedef HashSet<MarkedArgumentBuffer*> ListSet; 39 39 40 40 public: … … 44 44 // Constructor for a read-write list, to which you may append values. 45 45 // FIXME: Remove all clients of this API, then remove this API. 46 ArgList()46 MarkedArgumentBuffer() 47 47 : m_markSet(0) 48 48 #ifndef NDEBUG … … 55 55 56 56 // Constructor for a read-only list whose data has already been allocated elsewhere. 57 ArgList(Register* buffer, size_t size)57 MarkedArgumentBuffer(Register* buffer, size_t size) 58 58 : m_buffer(buffer) 59 59 , m_size(size) … … 77 77 } 78 78 79 ~ ArgList()79 ~MarkedArgumentBuffer() 80 80 { 81 81 if (m_markSet) … … 115 115 } 116 116 117 void getSlice(int startIndex, ArgList& result) const;118 119 117 iterator begin() { return m_buffer; } 120 118 iterator end() { return m_buffer + m_size; } … … 157 155 }; 158 156 157 class ArgList { 158 public: 159 typedef JSValuePtr* iterator; 160 typedef const JSValuePtr* const_iterator; 161 162 ArgList() 163 : m_args(0) 164 , m_argCount(0) 165 { 166 } 167 168 ArgList(JSValuePtr* args, unsigned argCount) 169 : m_args(args) 170 , m_argCount(argCount) 171 { 172 } 173 174 ArgList(Register* args, int argCount) 175 : m_args(reinterpret_cast<JSValuePtr*>(args)) 176 , m_argCount(argCount) 177 { 178 ASSERT(argCount >= 0); 179 } 180 181 ArgList(const MarkedArgumentBuffer& args) 182 : m_args(reinterpret_cast<JSValuePtr*>(const_cast<Register*>(args.begin()))) 183 , m_argCount(args.size()) 184 { 185 } 186 187 JSValuePtr at(size_t idx) const 188 { 189 if (idx < m_argCount) 190 return m_args[idx]; 191 return jsUndefined(); 192 } 193 194 bool isEmpty() const { return !m_argCount; } 195 196 size_t size() const { return m_argCount; } 197 198 iterator begin() { return m_args; } 199 iterator end() { return m_args + m_argCount; } 200 201 const_iterator begin() const { return m_args; } 202 const_iterator end() const { return m_args + m_argCount; } 203 204 void getSlice(int startIndex, ArgList& result) const; 205 private: 206 JSValuePtr* m_args; 207 size_t m_argCount; 208 }; 209 159 210 } // namespace JSC 160 211 -
trunk/JavaScriptCore/runtime/Arguments.cpp
r42989 r43037 105 105 } 106 106 107 void Arguments::fillArgList(ExecState* exec, ArgList& args)107 void Arguments::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) 108 108 { 109 109 if (UNLIKELY(d->overrodeLength)) { -
trunk/JavaScriptCore/runtime/Arguments.h
r42337 r43037 64 64 virtual void mark(); 65 65 66 void fillArgList(ExecState*, ArgList&);66 void fillArgList(ExecState*, MarkedArgumentBuffer&); 67 67 68 68 uint32_t numProvidedArguments(ExecState* exec) const -
trunk/JavaScriptCore/runtime/ArrayPrototype.cpp
r42989 r43037 306 306 if (it == end) 307 307 break; 308 curArg = (*it) .jsValue();308 curArg = (*it); 309 309 ++it; 310 310 } … … 336 336 if (isJSArray(&exec->globalData(), thisValue) && args.size() == 1) { 337 337 JSArray* array = asArray(thisValue); 338 array->push(exec, args.begin()->jsValue());338 array->push(exec, *args.begin()); 339 339 return jsNumber(exec, array->length()); 340 340 } … … 478 478 compareResult = -1; 479 479 else if (callType != CallTypeNone) { 480 ArgListl;480 MarkedArgumentBuffer l; 481 481 l.append(jObj); 482 482 l.append(minObj); … … 620 620 JSValuePtr v = slot.getValue(exec, k); 621 621 622 ArgListeachArguments;622 MarkedArgumentBuffer eachArguments; 623 623 624 624 eachArguments.append(v); … … 673 673 JSValuePtr v = slot.getValue(exec, k); 674 674 675 ArgListeachArguments;675 MarkedArgumentBuffer eachArguments; 676 676 677 677 eachArguments.append(v); … … 730 730 continue; 731 731 732 ArgListeachArguments;732 MarkedArgumentBuffer eachArguments; 733 733 734 734 eachArguments.append(slot.getValue(exec, k)); … … 782 782 continue; 783 783 784 ArgListeachArguments;784 MarkedArgumentBuffer eachArguments; 785 785 eachArguments.append(slot.getValue(exec, k)); 786 786 eachArguments.append(jsNumber(exec, k)); … … 830 830 continue; 831 831 832 ArgListeachArguments;832 MarkedArgumentBuffer eachArguments; 833 833 eachArguments.append(slot.getValue(exec, k)); 834 834 eachArguments.append(jsNumber(exec, k)); … … 904 904 continue; 905 905 906 ArgListeachArguments;906 MarkedArgumentBuffer eachArguments; 907 907 eachArguments.append(rv); 908 908 eachArguments.append(prop); … … 973 973 continue; 974 974 975 ArgListeachArguments;975 MarkedArgumentBuffer eachArguments; 976 976 eachArguments.append(rv); 977 977 eachArguments.append(prop); -
trunk/JavaScriptCore/runtime/Collector.cpp
r42705 r43037 987 987 markProtectedObjects(); 988 988 if (m_markListSet && m_markListSet->size()) 989 ArgList::markLists(*m_markListSet);989 MarkedArgumentBuffer::markLists(*m_markListSet); 990 990 if (m_globalData->exception && !m_globalData->exception.marked()) 991 991 m_globalData->exception.mark(); -
trunk/JavaScriptCore/runtime/Collector.h
r39670 r43037 40 40 namespace JSC { 41 41 42 class ArgList;42 class MarkedArgumentBuffer; 43 43 class CollectorBlock; 44 44 class JSCell; … … 114 114 void markConservatively(void* start, void* end); 115 115 116 HashSet< ArgList*>& markListSet() { if (!m_markListSet) m_markListSet = new HashSet<ArgList*>; return *m_markListSet; }116 HashSet<MarkedArgumentBuffer*>& markListSet() { if (!m_markListSet) m_markListSet = new HashSet<MarkedArgumentBuffer*>; return *m_markListSet; } 117 117 118 118 JSGlobalData* globalData() const { return m_globalData; } … … 148 148 ProtectCountSet m_protectedValues; 149 149 150 HashSet< ArgList*>* m_markListSet;150 HashSet<MarkedArgumentBuffer*>* m_markListSet; 151 151 152 152 #if ENABLE(JSC_MULTIPLE_THREADS) -
trunk/JavaScriptCore/runtime/CommonIdentifiers.h
r42478 r43037 25 25 #include <wtf/Noncopyable.h> 26 26 27 // ArgListof property names, passed to a macro so we can do set them up various27 // MarkedArgumentBuffer of property names, passed to a macro so we can do set them up various 28 28 // ways without repeating the list. 29 29 #define JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \ -
trunk/JavaScriptCore/runtime/Error.cpp
r37938 r43037 73 73 } 74 74 75 ArgListargs;75 MarkedArgumentBuffer args; 76 76 if (message.isEmpty()) 77 77 args.append(jsString(exec, name)); -
trunk/JavaScriptCore/runtime/FunctionPrototype.cpp
r42989 r43037 109 109 JSValuePtr array = args.at(1); 110 110 111 ArgListapplyArgs;111 MarkedArgumentBuffer applyArgs; 112 112 if (!array.isUndefinedOrNull()) { 113 113 if (!array.isObject()) -
trunk/JavaScriptCore/runtime/JSArray.cpp
r42989 r43037 174 174 ArgList::const_iterator end = list.end(); 175 175 for (ArgList::const_iterator it = list.begin(); it != end; ++it, ++i) 176 storage->m_vector[i] = (*it).jsValue();176 storage->m_vector[i] = *it; 177 177 178 178 m_storage = storage; … … 791 791 compareResult = m_cachedCall->call().toNumber(m_cachedCall->newCallFrame()); 792 792 } else { 793 ArgListarguments;793 MarkedArgumentBuffer arguments; 794 794 arguments.append(va); 795 795 arguments.append(vb); … … 915 915 } 916 916 917 void JSArray::fillArgList(ExecState* exec, ArgList& args)917 void JSArray::fillArgList(ExecState* exec, MarkedArgumentBuffer& args) 918 918 { 919 919 unsigned fastAccessLength = min(m_storage->m_length, m_fastAccessCutoff); … … 1061 1061 JSArray* constructArray(ExecState* exec, JSValuePtr singleItemValue) 1062 1062 { 1063 ArgListvalues;1063 MarkedArgumentBuffer values; 1064 1064 values.append(singleItemValue); 1065 1065 return new (exec) JSArray(exec->lexicalGlobalObject()->arrayStructure(), values); -
trunk/JavaScriptCore/runtime/JSArray.h
r42989 r43037 76 76 } 77 77 78 void fillArgList(ExecState*, ArgList&);78 void fillArgList(ExecState*, MarkedArgumentBuffer&); 79 79 void copyToRegisters(ExecState*, Register*, uint32_t); 80 80 -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r41168 r43037 125 125 , identifierTable(createIdentifierTable()) 126 126 , propertyNames(new CommonIdentifiers(this)) 127 , emptyList(new ArgList)127 , emptyList(new MarkedArgumentBuffer) 128 128 , lexer(new Lexer(this)) 129 129 , parser(new Parser) -
trunk/JavaScriptCore/runtime/JSGlobalData.h
r41168 r43037 108 108 IdentifierTable* identifierTable; 109 109 CommonIdentifiers* propertyNames; 110 const ArgList* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark.110 const MarkedArgumentBuffer* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark. 111 111 SmallStrings smallStrings; 112 112 -
trunk/JavaScriptCore/runtime/JSObject.cpp
r40046 r43037 148 148 CallData callData; 149 149 CallType callType = setterFunc->getCallData(callData); 150 ArgListargs;150 MarkedArgumentBuffer args; 151 151 args.append(value); 152 152 call(exec, setterFunc, callType, callData, this, args); -
trunk/JavaScriptCore/runtime/StringConstructor.cpp
r42989 r43037 34 34 ArgList::const_iterator end = args.end(); 35 35 for (ArgList::const_iterator it = args.begin(); it != end; ++it) 36 *p++ = static_cast<UChar>((*it). jsValue().toUInt32(exec));36 *p++ = static_cast<UChar>((*it).toUInt32(exec)); 37 37 return jsString(exec, UString(buf, p - buf, false)); 38 38 } -
trunk/JavaScriptCore/runtime/StringPrototype.cpp
r42989 r43037 291 291 if (callType != CallTypeNone) { 292 292 int completeMatchStart = ovector[0]; 293 ArgListargs;293 MarkedArgumentBuffer args; 294 294 295 295 for (unsigned i = 0; i < reg->numSubpatterns() + 1; ++i) { … … 343 343 344 344 if (callType != CallTypeNone) { 345 ArgListargs;345 MarkedArgumentBuffer args; 346 346 args.append(jsSubstring(exec, source, matchPos, matchLen)); 347 347 args.append(jsNumber(exec, matchPos)); … … 410 410 ArgList::const_iterator end = args.end(); 411 411 for (ArgList::const_iterator it = args.begin(); it != end; ++it) 412 s += (*it). jsValue().toString(exec);412 s += (*it).toString(exec); 413 413 return jsString(exec, s); 414 414 } … … 487 487 488 488 // return array of matches 489 ArgListlist;489 MarkedArgumentBuffer list; 490 490 int lastIndex = 0; 491 491 while (pos >= 0) {
Note:
See TracChangeset
for help on using the changeset viewer.