~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to src/runtime.js

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-06-11 15:45:24 UTC
  • mfrom: (1.2.1) (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130611154524-rppb3w6tixlegv4n
Tags: 1.4.7~20130611~a1eb425-1
* New snapshot release
* Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
  // An allocation that cannot normally be free'd (except through sbrk, which once
62
62
  // called, takes control of STATICTOP)
63
63
  staticAlloc: function(size) {
 
64
    if (ASSERTIONS) size = '(assert(!staticSealed),' + size + ')'; // static area must not be sealed
64
65
    var ret = RuntimeGenerator.alloc(size, 'STATIC', INIT_HEAP);
65
 
    if (USE_TYPED_ARRAYS) ret += '; if (STATICTOP >= TOTAL_MEMORY) enlargeMemory();'
 
66
    return ret;
 
67
  },
 
68
 
 
69
  // allocation on the top of memory, adjusted dynamically by sbrk
 
70
  dynamicAlloc: function(size) {
 
71
    if (ASSERTIONS) size = '(assert(DYNAMICTOP > 0),' + size + ')'; // dynamic area must be ready
 
72
    var ret = RuntimeGenerator.alloc(size, 'DYNAMIC', INIT_HEAP);
 
73
    if (USE_TYPED_ARRAYS) ret += '; if (DYNAMICTOP >= TOTAL_MEMORY) enlargeMemory();'
66
74
    return ret;
67
75
  },
68
76
 
466
474
 
467
475
Runtime.stackAlloc = unInline('stackAlloc', ['size']);
468
476
Runtime.staticAlloc = unInline('staticAlloc', ['size']);
 
477
Runtime.dynamicAlloc = unInline('dynamicAlloc', ['size']);
469
478
Runtime.alignMemory = unInline('alignMemory', ['size', 'quantum']);
470
479
Runtime.makeBigInt = unInline('makeBigInt', ['low', 'high', 'unsigned']);
471
480
 
529
538
  return value;
530
539
}
531
540
 
 
541
// The address globals begin at. Very low in memory, for code size and optimization opportunities.
 
542
// Above 0 is static memory, starting with globals.
 
543
// Then the stack.
 
544
// Then 'dynamic' memory for sbrk.
 
545
Runtime.GLOBAL_BASE = Runtime.alignMemory(1);
 
546