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

« back to all changes in this revision

Viewing changes to src/relooper/emscripten/glue.js

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
  var TBUFFER_SIZE = 10*1024*1024;
7
7
  var tbuffer = _malloc(TBUFFER_SIZE);
8
8
 
 
9
  var VBUFFER_SIZE = 256;
 
10
  var vbuffer = _malloc(VBUFFER_SIZE);
 
11
 
9
12
  var RelooperGlue = {};
10
13
  RelooperGlue['init'] = function() {
11
14
    this.r = _rl_new_relooper();
12
15
  },
13
 
  RelooperGlue['addBlock'] = function(text) {
 
16
  RelooperGlue['addBlock'] = function(text, branchVar) {
14
17
    assert(this.r);
15
18
    assert(text.length+1 < TBUFFER_SIZE);
16
19
    writeStringToMemory(text, tbuffer);
17
 
    var b = _rl_new_block(tbuffer);
 
20
    if (branchVar) {
 
21
      assert(branchVar.length+1 < VBUFFER_SIZE);
 
22
      writeStringToMemory(branchVar, vbuffer);
 
23
    }
 
24
    var b = _rl_new_block(tbuffer, branchVar ? vbuffer : 0);
18
25
    _rl_relooper_add_block(this.r, b);
19
26
    return b;
20
27
  };