Revert "Avoid some operator new null checks"
authorMike Danes <onemihaid@hotmail.com>
Thu, 19 Oct 2017 18:48:20 +0000 (21:48 +0300)
committerMike Danes <onemihaid@hotmail.com>
Thu, 19 Oct 2017 18:49:06 +0000 (21:49 +0300)
This reverts commit ecb0c3d94c9a4eb619e466a6239255ca91b14f52.

It is incomplete and kind of exotic so it should be evaluated on its own.

src/jit/compiler.hpp
src/jit/jit.h

index 07b264e..190cc2e 100644 (file)
@@ -872,13 +872,7 @@ void* GenTree::operator new(size_t sz, Compiler* comp, genTreeOps oper)
 #endif // MEASURE_NODE_SIZE
 
     assert(size >= sz);
-    void* mem = comp->compGetMem(size, CMK_ASTNode);
-#ifdef _MSC_VER
-    // MSVC assumes that a user defined operator new may return nullptr and inserts
-    // a null check before invoking the constructor. This can be avoided using __assume.
-    __assume(mem != nullptr);
-#endif
-    return mem;
+    return comp->compGetMem(size, CMK_ASTNode);
 }
 
 // GenTree constructor
index a30039f..a48a001 100644 (file)
@@ -872,24 +872,12 @@ public:
 
 inline void* __cdecl operator new(size_t n, CompAllocator* alloc)
 {
-    void* mem = alloc->Alloc(n);
-#ifdef _MSC_VER
-    // MSVC assumes that a user defined operator new may return nullptr and inserts
-    // a null check before invoking the constructor. This can be avoided using __assume.
-    __assume(mem != nullptr);
-#endif
-    return mem;
+    return alloc->Alloc(n);
 }
 
 inline void* __cdecl operator new[](size_t n, CompAllocator* alloc)
 {
-    void* mem = alloc->Alloc(n);
-#ifdef _MSC_VER
-    // MSVC assumes that a user defined operator new may return nullptr and inserts
-    // a null check before invoking the constructor. This can be avoided using __assume.
-    __assume(mem != nullptr);
-#endif
-    return mem;
+    return alloc->Alloc(n);
 }
 
 // A CompAllocator wrapper that implements IAllocator and allows zero-length