Permalink
Browse files

Used two special variables for Function.caller stack instead of consi…

…ng, as suggested by Marijn. This reduces consing considerably
  • Loading branch information...
1 parent bb3c8bc commit 14940874c09a436889fb229b8fcfd737121c5d75 @vsedach vsedach committed with marijnh Sep 25, 2012
Showing with 5 additions and 5 deletions.
  1. +3 −2 runtime.lisp
  2. +2 −3 translate.lisp
View
@@ -172,7 +172,8 @@
(.func "decodeURIComponent" (str)
(with-uri-err (url-encode:url-decode (to-string str) "")))))
-(defvar *Function.caller-stack* '(:null :null))
+(defvar *current-caller* :null)
+(defvar *current-callee* :null)
(add-to-lib *stdlib*
(flet ((defprops (obj props)
@@ -254,7 +255,7 @@
(declare (ignore this))
(apply proc self (append args args-inner)))
(max 0 (- arity (length args))))))
- (.active-r "caller" (second *Function.caller-stack*)))))
+ (.active-r "caller" *current-caller*))))
(add-to-lib *stdlib*
(.constructor "Array" (&rest args)
View
@@ -422,9 +422,8 @@
(when uses-eval
(push (make-with-scope :var eval-scope) *scope*))
(let ((body1 `((let* (,@(when *enable-Function.caller*
- `((*Function.caller-stack*
- (cons ,(as-sym fname)
- *Function.caller-stack*))))
+ `((*current-caller* *current-callee*)
+ (*current-callee* ,(as-sym fname))))
,@(loop :for var :in internal :collect `(,var :undefined))
;; TODO sane object init
,@(and uses-eval `((,eval-scope (make-obj (find-cls :object)))

0 comments on commit 1494087

Please sign in to comment.