This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new a8fb592a5f Add index to XMLList prototype instead of instances. This 
prevents GC thrashing
a8fb592a5f is described below

commit a8fb592a5f622356cde9e63f4b944e9cef25baa3
Author: Harbs <[email protected]>
AuthorDate: Mon May 27 00:27:33 2024 +0300

    Add index to XMLList prototype instead of instances. This prevents GC 
thrashing
---
 frameworks/projects/XML/src/main/royale/XMLList.as | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/frameworks/projects/XML/src/main/royale/XMLList.as 
b/frameworks/projects/XML/src/main/royale/XMLList.as
index 324f53d054..b15d37b708 100644
--- a/frameworks/projects/XML/src/main/royale/XMLList.as
+++ b/frameworks/projects/XML/src/main/royale/XMLList.as
@@ -171,7 +171,7 @@ package
                        return target;
                }
         
-               private var _xmlArray:Array = [];
+               protected var _xmlArray:Array = [];
                /*
                        9.2.1.2 [[Put]] (P, V)
                        Overview
@@ -256,14 +256,16 @@ package
                private function addIndex(idx:int):void
                {
                        var idxStr:String = "" + idx;
-                       Object.defineProperty(this,idxStr,
+                       if(idxStr in XMLList.prototype)
+                               return;
+                       Object.defineProperty(XMLList.prototype,idxStr,
                                {
-                                       "get": function():* { return 
_xmlArray[idx]; },
+                                       "get": function():* { return 
this._xmlArray[idx]; },
                                        "set": function(newValue:*):void {
-                                               if(idx >= _xmlArray.length)
-                                                       append(newValue);
+                                               if(idx >= this._xmlArray.length)
+                                                       this.append(newValue);
                                                else
-                                                       
replaceChildAt(idx,newValue);
+                                                       
this.replaceChildAt(idx,newValue);
                                        },
                                        enumerable: true,
                                        configurable: true
@@ -976,7 +978,7 @@ package
                                        child.parent().removeChild(child);
                        }
                }
-               private function replaceChildAt(idx:int,child:*):void
+               protected function replaceChildAt(idx:int,child:*):void
                {
                        var i:int;
                        var childToReplace:XML = _xmlArray[idx];

Reply via email to