jitcraft/Spaces-inl.h
changeset 12 75e385f68b7e
parent 11 a350c2cc736a
child 49 a92afa7484fd
     1.1 --- a/jitcraft/Spaces-inl.h	Fri Jun 29 19:35:17 2012 -0700
     1.2 +++ b/jitcraft/Spaces-inl.h	Sat Jun 30 19:38:53 2012 -0700
     1.3 @@ -20,7 +20,27 @@
     1.4  
     1.5  namespace jc {
     1.6  
     1.7 -Address
     1.8 +inline Address
     1.9 +HeapStack::allocate(size_t nbytes)
    1.10 +{
    1.11 +    nbytes = Align(nbytes, kObjectAlignment);
    1.12 +
    1.13 +    if (pos_ + nbytes > end_)
    1.14 +        return NULL;
    1.15 +
    1.16 +    Address ptr = pos_;
    1.17 +    pos_ += nbytes;
    1.18 +    return ptr;
    1.19 +}
    1.20 +
    1.21 +inline void
    1.22 +HeapStack::unwind(Address to)
    1.23 +{
    1.24 +    assert(to <= pos_ && to >= buffer_);
    1.25 +    pos_ = to;
    1.26 +}
    1.27 +
    1.28 +inline Address
    1.29  HeapChunk::allocate(size_t nbytes)
    1.30  {
    1.31      if (cursor_ + nbytes > end_)
    1.32 @@ -31,7 +51,7 @@
    1.33      return address;
    1.34  }
    1.35  
    1.36 -Address
    1.37 +inline Address
    1.38  OldSpace::allocate(size_t nbytes)
    1.39  {
    1.40      assert(IsAligned(nbytes, kObjectAlignment));