avm2 pcode 学习笔记。高手勿笑

  1  getlocal_0
  2 pushscope          //一般一段methodbody  开头都是这么2个,
  3                            //               pushscope    推一个对象到范围堆栈。        getlocal_0   得到局部寄存器。或者说当前类好点
  4 
  5 
  6     FindPropertyStrict    <MultiName>(1563) addFrameScript
  7     PushByte    0         //压入0
  8     GetLocal0             //得到当前对象,翻译成this.
  9     GetProperty    <MultiName>(1564) _SafeStr120          //获取属性
 10     PushByte    3
 11     GetLocal0   
 12     GetProperty    <MultiName>(1565) _SafeStr121
 13     CallPropertyVoid    <MultiName>(1563) addFrameScript, <PARAMCOUNT>(4)
 14 
 15 
 16 翻译结果是     addFrameScript(0, this._SafeStr120, 3, this._SafeStr121);
 17 分析执行一段函数是以  FindPropertyStrict    <MultiName>(1563) addFrameScript
 18                                     。。。。。。。。。
 19                                        CallPropertyVoid    <MultiName>(1563) addFrameScript, <PARAMCOUNT>(4)
 20 
 21 案例
 22         FindPropertyStrict    <MultiName>(1566) stop
 23        CallPropertyVoid    <MultiName>(1566) stop, <PARAMCOUNT>(0)
 24        //这么一段的话,就可以翻译成stop()                         <MultiName>(1566)代表stop   每个swf应该都不一样,具体看的
 25 
 26 
 27     GetLocal0   
 28     ConstructSuper    <ARGCOUNT>(0)                super()  
 29 
 30 
 31    GetLocal0   
 32     PushFalse   
 33     InitProperty    <MultiName>(1571) _SafeStr90             // InitProperty   初始化信息
 34    this._SafeStr90 =false
 35 
 36 
 37 
 38 
 39 
 40 
 41     FindProperty    <MultiName>(1572) scrollRect                  //找到属性
 42     FindPropertyStrict    <MultiName>(1573) Rectangle
 43     PushByte    0
 44     Dup         //复制栈的顶值
 45     PushShort    <VALUE>(700)
 46     PushShort    <VALUE>(630)
 47     ConstructProperty    <MultiName>(1573) Rectangle, <PARAMCOUNT>(4)
 48     InitProperty    <MultiName>(1572) scrollRect             //初始化属性              问题这个scrollRect是当前类的父类的。
 49   编译成    scrollRect = new Rectangle(0, 0, 700, 630);
 50 
 51 
 52                                   dup                pushbyte 10                        var _loc2_:* = 10 + 10;
 53                                                        dup
 54                                                        add
 55                                                       setlocal_2
 56                                                       ---------------------------------------------------------
 57                                                      pushbyte 10                    var _loc2_:int = 10 + 10;
 58                                                      dup
 59                                                      add
 60                                                     convert_i            /./转换成int
 61                                                                               //convert_b  转换成boolean类型       convert_d  转换成双精度  convert_s  转换成字符串      convert_o  转换成对象(Object)  convert_u  转换成unsigned integer
 62                                                                              
 63                                                     setlocal_2
 64  
 65 
 66 
 67 
 68         GetLocal2                     //得到local2
 69         GetLocal3                   //得到local3
 70         IfNotGreaterEqual    @@L__22        //如果local2小于local3 则跳转到L_22
 71         if (_local2 >= _local3)
 72 
 73 IfEqual                                                 如果相等跳转                                  即不等于则执行下面的语句   if(a !=b){ 语句 }
 74 IfNotEqual                                           如果不相等跳转                               即等于则执行下面的语句      if(a==b){ 语句 }
 75 IfFalse                                              
 76 IfTrue
 77 IfGreaterEqual
 78 IfNotGreaterEqual
 79 IfGreaterThan
 80 IfNotGreaterThan
 81 IfLessEqual
 82 IfLowerThan
 83 IfNotLowerEqual
 84 IfNotLowerThan
 85 
 86 IfStrictEqual                                    如果全等则跳转                                 即不全等则执行语句  if(a !== b){  语句}
 87 
 88 IfStrictNotEqual                              如果不全等则跳转                                 即不全等则执行语句  if(a === b){ 语句}
 89 
 90 
 91 
 92         GetLocal0   
 93         FindPropertyStrict    <MultiName>(1616) Welcome
 94         ConstructProperty    <MultiName>(1616) Welcome, <PARAMCOUNT>(0)
 95         SetProperty    <MultiName>(1615) _SafeStr74
 96 this._SafeStr74 = new Welcome();
 97 
 98          GetLocal0   
 99         FindPropertyStrict    <MultiName>(1616) Welcome
100         PushByte    10
101         ConstructProperty    <MultiName>(1616) Welcome, <PARAMCOUNT>(1)
102         SetProperty    <MultiName>(1615) _SafeStr74
103 this._SafeStr74 = new Welcome(10);

 

posted @ 2014-12-03 10:43  白菜大叔  阅读(305)  评论(0编辑  收藏  举报