aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/library.js b/src/library.js
index 2a4a5e7d..1747155f 100644
--- a/src/library.js
+++ b/src/library.js
@@ -2111,15 +2111,12 @@ LibraryManager.library = {
// TODO: We could in theory slice off the top of the HEAP when
// sbrk gets a negative increment in |bytes|...
var self = _sbrk;
- if (!self.STATICTOP) {
- STATICTOP = alignMemoryPage(STATICTOP);
- self.STATICTOP = STATICTOP;
- self.DATASIZE = 0;
- } else {
- assert(self.STATICTOP == STATICTOP, "No one should touch the heap!");
+ if (!self.called) {
+ STATICTOP = alignMemoryPage(STATICTOP); // make sure we start out aligned
+ self.called = true;
}
- var ret = STATICTOP + self.DATASIZE;
- self.DATASIZE += alignMemoryPage(bytes);
+ var ret = STATICTOP;
+ if (bytes != 0) Runtime.staticAlloc(bytes);
return ret; // Previous break location.
},
open64: 'open',
@@ -4323,6 +4320,16 @@ LibraryManager.library = {
_fputs(str, _stdout); // XXX stderr etc.
},
+ _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEi__deps: ['fputs', '$libcxx'],
+ _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEi: function(stream, num) {
+ _fputs(allocate(intArrayFromString(num.toString()), 'i8', ALLOC_STACK), _stdout);
+ },
+
+ _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRS3_S4_E__deps: ['fputc', '$libcxx'],
+ _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRS3_S4_E: function(stream, x) {
+ _fputc('\n'.charCodeAt(0), _stdout);
+ },
+
// glibc
_ZNSt8ios_base4InitC1Ev: function() {