Bladeren bron

Merge branch 'release/1.7' into intl-icu

Doug Ilijev 8 jaren geleden
bovenliggende
commit
5ed25cc847
2 gewijzigde bestanden met toevoegingen van 29 en 1 verwijderingen
  1. 4 1
      lib/Runtime/ByteCode/ByteCodeEmitter.cpp
  2. 25 0
      pal/src/map/virtual.cpp

+ 4 - 1
lib/Runtime/ByteCode/ByteCodeEmitter.cpp

@@ -1929,7 +1929,10 @@ void ByteCodeGenerator::LoadAllConstants(FuncInfo *funcInfo)
         byteCodeFunction->MapAndSetEnvRegister(funcInfo->GetEnvRegister());
         if (funcInfo->GetIsTopLevelEventHandler())
         {
-            byteCodeFunction->MapAndSetThisRegisterForEventHandler(funcInfo->GetThisSymbol()->GetLocation());
+            if (funcInfo->GetThisSymbol())
+            {
+                byteCodeFunction->MapAndSetThisRegisterForEventHandler(funcInfo->GetThisSymbol()->GetLocation());
+            }
             // The environment is the namespace hierarchy starting with "this".
             Assert(!funcInfo->RegIsConst(funcInfo->GetEnvRegister()));
             thisLoadedFromParams = true;

+ 25 - 0
pal/src/map/virtual.cpp

@@ -57,6 +57,7 @@ typedef struct FREE_BLOCK {
 #endif  // MMAP_IGNORES_HINT
 
 // The first node in our list of allocated blocks.
+static PCMI pVirtualMemoryLastFound;
 static PCMI pVirtualMemory;
 
 #if MMAP_IGNORES_HINT
@@ -126,6 +127,7 @@ VIRTUALInitialize( void )
     InternalInitializeCriticalSection(&virtual_realloc);
 
     pVirtualMemory = NULL;
+    pVirtualMemoryLastFound = NULL;
 
     return TRUE;
 }
@@ -165,6 +167,7 @@ void VIRTUALCleanup()
         InternalFree(pTempEntry );
     }
     pVirtualMemory = NULL;
+    pVirtualMemoryLastFound = NULL;
 
 #if MMAP_IGNORES_HINT
     // Clean up the free list.
@@ -534,6 +537,19 @@ static PCMI VIRTUALFindRegionInformation( IN UINT_PTR address )
 
     pEntry = pVirtualMemory;
 
+    if (pVirtualMemoryLastFound && pVirtualMemoryLastFound->startBoundary <= address)
+    {
+        pEntry = pVirtualMemoryLastFound;
+        if (pEntry->startBoundary == address)
+        {
+            return pEntry;
+        }
+    }
+    else
+    {
+        pEntry = pVirtualMemory;
+    }
+
     while( pEntry )
     {
         if ( pEntry->startBoundary > address )
@@ -549,6 +565,8 @@ static PCMI VIRTUALFindRegionInformation( IN UINT_PTR address )
 
         pEntry = pEntry->pNext;
     }
+
+    if (pEntry) pVirtualMemoryLastFound = pEntry;
     return pEntry;
 }
 
@@ -613,6 +631,11 @@ static BOOL VIRTUALReleaseMemory( PCMI pMemoryToBeReleased )
         }
     }
 
+    if (pVirtualMemoryLastFound->startBoundary >= pMemoryToBeReleased->startBoundary)
+    {
+        pVirtualMemoryLastFound = NULL;
+    }
+
 #if MMAP_IGNORES_HINT
     // We've removed the block from our allocated list. Add it to the
     // free list.
@@ -2002,6 +2025,7 @@ VirtualProtect(
     MemSize = (((UINT_PTR)(dwSize) + ((UINT_PTR)(lpAddress) & VIRTUAL_PAGE_MASK)
                 + VIRTUAL_PAGE_MASK) & ~VIRTUAL_PAGE_MASK);
 
+#if DEBUG
     if ( VIRTUALContainsInvalidProtectionFlags( flNewProtect ) )
     {
         ASSERT( "flProtect can be one of PAGE_NOACCESS, PAGE_READONLY, "
@@ -2017,6 +2041,7 @@ VirtualProtect(
         SetLastError( ERROR_NOACCESS );
         goto ExitVirtualProtect;
     }
+#endif
 
     pEntry = VIRTUALFindRegionInformation( StartBoundary );
     if ( NULL != pEntry )