- Timestamp:
- Mar 5, 2010, 7:50:20 PM (15 years ago)
- Location:
- trunk/src/3rdparty/webkit/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.cpp
r561 r636 37 37 munmap(m_buffer, ((m_max - m_start) + m_maxGlobals) * sizeof(Register)); 38 38 #elif HAVE(VIRTUALALLOC) 39 40 41 39 42 #if PLATFORM(WINCE) 40 43 VirtualFree(m_buffer, DWORD(m_commitEnd) - DWORD(m_buffer), MEM_DECOMMIT); 41 44 #endif 42 45 VirtualFree(m_buffer, 0, MEM_RELEASE); 46 43 47 #else 44 48 fastFree(m_buffer); … … 51 55 while (madvise(m_start, (m_max - m_start) * sizeof(Register), MADV_FREE) == -1 && errno == EAGAIN) { } 52 56 #elif HAVE(VIRTUALALLOC) 57 58 59 60 53 61 VirtualFree(m_start, (m_max - m_start) * sizeof(Register), MEM_DECOMMIT); 54 62 m_commitEnd = m_start; 63 55 64 #endif 56 65 m_maxUsed = m_start; -
trunk/src/3rdparty/webkit/JavaScriptCore/interpreter/RegisterFile.h
r561 r636 42 42 #endif 43 43 44 45 46 47 48 44 49 namespace JSC { 45 50 … … 130 135 bool grow(Register* newEnd); 131 136 void shrink(Register* newEnd); 132 137 133 138 void setNumGlobals(size_t numGlobals) { m_numGlobals = numGlobals; } 134 139 int numGlobals() const { return m_numGlobals; } … … 136 141 137 142 Register* lastGlobal() const { return m_start - m_numGlobals; } 138 143 139 144 void markGlobals(MarkStack& markStack, Heap* heap) { heap->markConservatively(markStack, lastGlobal(), m_start); } 140 145 void markCallFrames(MarkStack& markStack, Heap* heap) { heap->markConservatively(markStack, m_start, m_end); } … … 185 190 } 186 191 #elif HAVE(VIRTUALALLOC) 192 193 194 195 196 197 198 199 200 201 202 203 204 205 187 206 m_buffer = static_cast<Register*>(VirtualAlloc(0, roundUpAllocationSize(bufferLength, commitSize), MEM_RESERVE, PAGE_READWRITE)); 188 207 if (!m_buffer) { … … 205 224 } 206 225 m_commitEnd = reinterpret_cast<Register*>(reinterpret_cast<char*>(m_buffer) + committedSize); 207 #else 208 /* 226 #endif 227 #else 228 /* 209 229 * If neither MMAP nor VIRTUALALLOC are available - use fastMalloc instead. 210 230 * … … 240 260 241 261 #if !HAVE(MMAP) && HAVE(VIRTUALALLOC) 262 263 264 265 266 267 268 269 270 271 272 242 273 if (newEnd > m_commitEnd) { 243 274 size_t size = roundUpAllocationSize(reinterpret_cast<char*>(newEnd) - reinterpret_cast<char*>(m_commitEnd), commitSize); … … 253 284 } 254 285 #endif 286 255 287 256 288 if (newEnd > m_maxUsed) -
trunk/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp
r561 r636 64 64 namespace JSC { 65 65 66 #if PLATFORM(DARWIN) || PLATFORM(WIN_OS) 66 #if PLATFORM(DARWIN) || PLATFORM(WIN_OS) 67 67 #define SYMBOL_STRING(name) "_" #name 68 68 #else … … 143 143 "ret" "\n" 144 144 ); 145 145 146 146 asm volatile ( 147 147 ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" … … 155 155 "ret" "\n" 156 156 ); 157 157 158 158 #elif COMPILER(GCC) && PLATFORM(X86_64) 159 159 … … 405 405 "ret" "\n" 406 406 ); 407 407 408 408 asm volatile ( 409 409 ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" … … 417 417 "ret" "\n" 418 418 ); 419 419 420 420 #elif COMPILER(GCC) && PLATFORM(X86_64) 421 421 … … 648 648 } 649 649 } 650 650 651 651 __declspec(naked) void ctiOpThrowNotCaught() 652 652 { … … 709 709 return; 710 710 } 711 711 712 712 JSCell* baseCell = asCell(baseValue); 713 713 Structure* structure = baseCell->structure(); … … 741 741 return; 742 742 } 743 743 744 744 stubInfo->initPutByIdReplace(structure); 745 745 … … 757 757 return; 758 758 } 759 759 760 760 JSGlobalData* globalData = &callFrame->globalData(); 761 761 … … 764 764 return; 765 765 } 766 766 767 767 if (isJSString(globalData, baseValue) && propertyName == callFrame->propertyNames().length) { 768 768 // The tradeoff of compiling an patched inline string length access routine does not seem … … 810 810 if (slotBaseObject->structure()->isDictionary()) 811 811 slotBaseObject->setStructure(Structure::fromDictionaryTransition(slotBaseObject->structure())); 812 812 813 813 stubInfo->initGetByIdProto(structure, slotBaseObject->structure()); 814 814 … … 840 840 extern "C" { 841 841 842 static void jscGeneratedNativeCode() 842 static void jscGeneratedNativeCode() 843 843 { 844 844 // When executing a JIT stub function (which might do an allocation), we hack the return address … … 850 850 851 851 struct StackHack { 852 ALWAYS_INLINE StackHack(JITStackFrame& stackFrame) 852 ALWAYS_INLINE StackHack(JITStackFrame& stackFrame) 853 853 : stackFrame(stackFrame) 854 854 , savedReturnAddress(*stackFrame.returnAddressSlot()) … … 857 857 } 858 858 859 ALWAYS_INLINE ~StackHack() 860 { 859 ALWAYS_INLINE ~StackHack() 860 { 861 861 *stackFrame.returnAddressSlot() = savedReturnAddress; 862 862 } … … 996 996 if (rightIsNumber && v1.getNumber(left)) 997 997 return JSValue::encode(jsNumber(stackFrame.globalData, left + right)); 998 998 999 999 CallFrame* callFrame = stackFrame.callFrame; 1000 1000 … … 1043 1043 { 1044 1044 STUB_INIT_STACK_FRAME(stackFrame); 1045 1045 1046 1046 JSGlobalData* globalData = stackFrame.globalData; 1047 1047 TimeoutChecker& timeoutChecker = globalData->timeoutChecker; … … 1051 1051 VM_THROW_EXCEPTION_AT_END(); 1052 1052 } 1053 1053 1054 1054 return timeoutChecker.ticksUntilNextCheck(); 1055 1055 } … … 1338 1338 ASSERT_NOT_REACHED(); 1339 1339 } 1340 1340 1341 1341 ASSERT(listIndex < POLYMORPHIC_LIST_CACHE_SIZE); 1342 1342 return prototypeStructureList; … … 1458 1458 // At least one of these checks must have failed to get to the slow case. 1459 1459 ASSERT(!value.isCell() || !baseVal.isCell() || !proto.isCell() 1460 || !value.isObject() || !baseVal.isObject() || !proto.isObject() 1460 || !value.isObject() || !baseVal.isObject() || !proto.isObject() 1461 1461 || (asObject(baseVal)->structure()->typeInfo().flags() & (ImplementsHasInstance | OverridesHasInstance)) != ImplementsHasInstance); 1462 1462 … … 1495 1495 1496 1496 CallFrame* callFrame = stackFrame.callFrame; 1497 1497 1498 1498 JSObject* baseObj = stackFrame.args[0].jsValue().toObject(callFrame); 1499 1499 … … 1600 1600 ExecutableBase* executable = callee->executable(); 1601 1601 JITCode& jitCode = executable->generatedJITCode(); 1602 1602 1603 1603 CodeBlock* codeBlock = 0; 1604 1604 if (!executable->isHostFunction()) … … 1866 1866 return JSValue::encode(result); 1867 1867 } 1868 1868 1869 1869 DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_val_string) 1870 1870 { 1871 1871 STUB_INIT_STACK_FRAME(stackFrame); 1872 1872 1873 1873 CallFrame* callFrame = stackFrame.callFrame; 1874 1874 JSGlobalData* globalData = stackFrame.globalData; 1875 1875 1876 1876 JSValue baseValue = stackFrame.args[0].jsValue(); 1877 1877 JSValue subscript = stackFrame.args[1].jsValue(); 1878 1878 1879 1879 JSValue result; 1880 1880 1881 1881 if (LIKELY(subscript.isUInt32())) { 1882 1882 uint32_t i = subscript.asUInt32(); … … 1892 1892 result = baseValue.get(callFrame, property); 1893 1893 } 1894 1895 CHECK_FOR_EXCEPTION_AT_END(); 1896 return JSValue::encode(result); 1897 } 1898 1894 1895 CHECK_FOR_EXCEPTION_AT_END(); 1896 return JSValue::encode(result); 1897 } 1898 1899 1899 DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_val_byte_array) 1900 1900 { 1901 1901 STUB_INIT_STACK_FRAME(stackFrame); 1902 1902 1903 1903 CallFrame* callFrame = stackFrame.callFrame; 1904 1904 JSGlobalData* globalData = stackFrame.globalData; 1905 1905 1906 1906 JSValue baseValue = stackFrame.args[0].jsValue(); 1907 1907 JSValue subscript = stackFrame.args[1].jsValue(); 1908 1908 1909 1909 JSValue result; 1910 1910 … … 1923 1923 result = baseValue.get(callFrame, property); 1924 1924 } 1925 1925 1926 1926 CHECK_FOR_EXCEPTION_AT_END(); 1927 1927 return JSValue::encode(result); … … 1997 1997 { 1998 1998 STUB_INIT_STACK_FRAME(stackFrame); 1999 1999 2000 2000 CallFrame* callFrame = stackFrame.callFrame; 2001 2001 JSGlobalData* globalData = stackFrame.globalData; 2002 2002 2003 2003 JSValue baseValue = stackFrame.args[0].jsValue(); 2004 2004 JSValue subscript = stackFrame.args[1].jsValue(); 2005 2005 JSValue value = stackFrame.args[2].jsValue(); 2006 2006 2007 2007 if (LIKELY(subscript.isUInt32())) { 2008 2008 uint32_t i = subscript.asUInt32(); 2009 2009 if (isJSByteArray(globalData, baseValue) && asByteArray(baseValue)->canAccessIndex(i)) { 2010 2010 JSByteArray* jsByteArray = asByteArray(baseValue); 2011 2011 2012 2012 // All fast byte array accesses are safe from exceptions so return immediately to avoid exception checks. 2013 2013 if (value.isInt32()) { … … 2015 2015 return; 2016 2016 } else { 2017 double dValue = 0; 2017 double dValue = 0; 2018 2018 if (value.getNumber(dValue)) { 2019 2019 jsByteArray->setIndex(i, dValue); … … 2033 2033 } 2034 2034 } 2035 2035 2036 2036 CHECK_FOR_EXCEPTION_AT_END(); 2037 2037 } … … 2059 2059 return result; 2060 2060 } 2061 2061 2062 2062 DEFINE_STUB_FUNCTION(int, op_load_varargs) 2063 2063 { … … 2080 2080 int32_t expectedParams = callFrame->callee()->jsExecutable()->parameterCount(); 2081 2081 int32_t inplaceArgs = min(providedParams, expectedParams); 2082 2082 2083 2083 Register* inplaceArgsDst = callFrame->registers() + argsOffset; 2084 2084 … … 2088 2088 Register* inplaceArgsSrc = callFrame->registers() - RegisterFile::CallFrameHeaderSize - expectedParams; 2089 2089 Register* inplaceArgsSrc2 = inplaceArgsSrc - providedParams - 1 + inplaceArgs; 2090 2090 2091 2091 // First step is to copy the "expected" parameters from their normal location relative to the callframe 2092 2092 while (inplaceArgsDst < inplaceArgsEnd) … … 2345 2345 start: 2346 2346 if (src2.isUndefined()) { 2347 return src1.isNull() || 2347 return src1.isNull() || 2348 2348 (src1.isCell() && asCell(src1)->structure()->typeInfo().masqueradesAsUndefined()) || 2349 2349 src1.isUndefined(); 2350 2350 } 2351 2351 2352 2352 if (src2.isNull()) { 2353 return src1.isUndefined() || 2353 return src1.isUndefined() || 2354 2354 (src1.isCell() && asCell(src1)->structure()->typeInfo().masqueradesAsUndefined()) || 2355 2355 src1.isNull(); … … 2387 2387 return d == 0.0; 2388 2388 } 2389 2389 2390 2390 if (src1.isUndefined()) 2391 2391 return src2.isCell() && asCell(src2)->structure()->typeInfo().masqueradesAsUndefined(); 2392 2392 2393 2393 if (src1.isNull()) 2394 2394 return src2.isCell() && asCell(src2)->structure()->typeInfo().masqueradesAsUndefined(); … … 2399 2399 if (src2.isInt32()) 2400 2400 return static_cast<JSString*>(cell1)->value().toDouble() == src2.asInt32(); 2401 2401 2402 2402 if (src2.isDouble()) 2403 2403 return static_cast<JSString*>(cell1)->value().toDouble() == src2.asDouble(); … … 2553 2553 JSFunction* func = function->make(callFrame, callFrame->scopeChain()); 2554 2554 2555 /* 2555 /* 2556 2556 The Identifier in a FunctionExpression can be referenced from inside 2557 2557 the FunctionExpression's FunctionBody to allow the function to call … … 2663 2663 2664 2664 Interpreter* interpreter = stackFrame.globalData->interpreter; 2665 2665 2666 2666 JSValue funcVal = stackFrame.args[0].jsValue(); 2667 2667 int registerOffset = stackFrame.args[1].int32(); -
trunk/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp
r561 r636 144 144 class Heap::Thread { 145 145 public: 146 Thread(pthread_t pthread, const PlatformThread& platThread, void* base) 146 Thread(pthread_t pthread, const PlatformThread& platThread, void* base) 147 147 : posixThread(pthread) 148 148 , platformThread(platThread) … … 188 188 } 189 189 #endif // PLATFORM(SYMBIAN) 190 190 191 191 memset(&primaryHeap, 0, sizeof(CollectorHeap)); 192 192 memset(&numberHeap, 0, sizeof(CollectorHeap));