Changeset 34964 in webkit for trunk/JavaScriptCore/VM/Machine.cpp
- Timestamp:
- Jul 2, 2008, 5:47:00 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/Machine.cpp
r34947 r34964 46 46 #include "RegExpPrototype.h" 47 47 #include "Register.h" 48 #include "collector.h" 48 49 #include "debugger.h" 49 50 #include "operations.h" … … 476 477 { 477 478 privateExecute(InitializeAndReturn); 479 480 // Bizarrely, calling fastMalloc here is faster than allocating space on the stack. 481 void* storage = fastMalloc(sizeof(CollectorBlock)); 482 483 JSArray* jsArray = new (storage) JSArray(jsNull(), 0); 484 m_jsArrayVptr = jsArray->vptr(); 485 jsArray->~JSCell(); 486 487 JSString* jsString = new (storage) JSString(""); 488 m_jsStringVptr = jsString->vptr(); 489 jsString->~JSCell(); 490 491 fastFree(storage); 478 492 } 479 493 … … 1835 1849 1836 1850 bool isUInt32 = JSImmediate::getUInt32(subscript, i); 1837 if (LIKELY(isUInt32)) 1838 result = baseValue->get(exec, i); 1839 else { 1851 if (LIKELY(isUInt32)) { 1852 if (isJSArray(baseValue)) { 1853 JSArray* jsArray = static_cast<JSArray*>(baseValue); 1854 if (jsArray->canGetIndex(i)) 1855 result = jsArray->getIndex(i); 1856 else 1857 result = jsArray->JSArray::get(exec, i); 1858 } else if (isJSString(baseValue) && static_cast<JSString*>(baseValue)->canGetIndex(i)) 1859 result = static_cast<JSString*>(baseValue)->getIndex(exec, i); 1860 else 1861 result = baseValue->get(exec, i); 1862 } else { 1840 1863 Identifier property(exec, subscript->toString(exec)); 1841 1864 result = baseValue->get(exec, property); … … 1868 1891 1869 1892 bool isUInt32 = JSImmediate::getUInt32(subscript, i); 1870 if (LIKELY(isUInt32)) 1871 baseValue->put(exec, i, r[value].u.jsValue); 1872 else { 1893 if (LIKELY(isUInt32)) { 1894 if (isJSArray(baseValue)) { 1895 JSArray* jsArray = static_cast<JSArray*>(baseValue); 1896 if (jsArray->canSetIndex(i)) 1897 jsArray->setIndex(i, r[value].u.jsValue); 1898 else 1899 jsArray->JSArray::put(exec, i, r[value].u.jsValue); 1900 } else 1901 baseValue->put(exec, i, r[value].u.jsValue); 1902 } else { 1873 1903 Identifier property(exec, subscript->toString(exec)); 1874 1904 if (!exec->hadException()) // Don't put to an object if toString threw an exception.
Note:
See TracChangeset
for help on using the changeset viewer.