[pypy-svn] r65145 - pypy/branch/js-refactoring/pypy/lang/js
jandem at codespeak.net
jandem at codespeak.net
Thu May 7 20:18:52 CEST 2009
Author: jandem
Date: Thu May 7 20:18:51 2009
New Revision: 65145
Modified:
pypy/branch/js-refactoring/pypy/lang/js/interpreter.py
pypy/branch/js-refactoring/pypy/lang/js/jscode.py
pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
Log:
fix ObjectObjects tests (one failure because Date is not implemented) and some FunctionObjects tests
Modified: pypy/branch/js-refactoring/pypy/lang/js/interpreter.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/interpreter.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/interpreter.py Thu May 7 20:18:51 2009
@@ -243,6 +243,7 @@
return W_String("[object %s]"%this.Class)
class W_ValueOf(W_NewBuiltin):
+ length = 0
def Call(self, ctx, args=[], this=None):
return this
@@ -583,16 +584,19 @@
w_Function = W_Function(ctx, Class='Function',
Prototype=w_ObjPrototype)
+ w_FncPrototype = W_Function(ctx, Class='Function', Prototype=w_ObjPrototype)#W_Object(Prototype=None, Class='Function')
+
w_Function.Put(ctx, 'length', W_IntNumber(1), flags = allon)
w_Global.Put(ctx, 'Function', w_Function)
- w_Object = W_ObjectObject('Object', w_Function)
+ w_Object = W_ObjectObject('Object', w_FncPrototype)
w_Object.Put(ctx, 'prototype', w_ObjPrototype, flags = allon)
- w_Object.Put(ctx, 'length', W_IntNumber(1), flags = RO | DD)
- w_Global.Put(ctx, 'Object', w_Object)
+ w_Object.Put(ctx, 'length', W_IntNumber(1), flags = allon)
w_Global.Prototype = w_ObjPrototype
- w_FncPrototype = w_Function.Call(ctx, this=w_Function)
+ w_Object.Put(ctx, 'prototype', w_ObjPrototype, flags = allon)
+ w_Global.Put(ctx, 'Object', w_Object)
+
w_Function.Put(ctx, 'prototype', w_FncPrototype, flags = allon)
w_Function.Put(ctx, 'constructor', w_Function, flags=allon)
@@ -600,7 +604,7 @@
put_values(ctx, w_ObjPrototype, {
'constructor': w_Object,
- '__proto__': w_FncPrototype,
+ '__proto__': w_Null,
'toString': toString,
'toLocaleString': toString,
'valueOf': W_ValueOf(ctx),
@@ -617,6 +621,7 @@
'apply': W_Apply(ctx),
'call': W_Call(ctx),
'arguments': w_Null,
+ 'valueOf': W_ValueOf(ctx),
})
w_Boolean = W_BooleanObject('Boolean', w_FncPrototype)
Modified: pypy/branch/js-refactoring/pypy/lang/js/jscode.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/jscode.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/jscode.py Thu May 7 20:18:51 2009
@@ -27,19 +27,19 @@
try:
while i < len(opcodes):
opcode = opcodes[i]
- if we_are_translated():
- #this is an optimization strategy for translated code
- #on top of cpython it destroys the performance
- #besides, this code might be completely wrong
- for name, op in opcode_unrolling:
- opcode = hint(opcode, deepfreeze=True)
- if isinstance(opcode, op):
- result = opcode.eval(ctx, stack)
- assert result is None
- break
- else:
- result = opcode.eval(ctx, stack)
- assert result is None
+ #if we_are_translated():
+ # #this is an optimization strategy for translated code
+ # #on top of cpython it destroys the performance
+ # #besides, this code might be completely wrong
+ # for name, op in opcode_unrolling:
+ # opcode = hint(opcode, deepfreeze=True)
+ # if isinstance(opcode, op):
+ # result = opcode.eval(ctx, stack)
+ # assert result is None
+ # break
+ #else:
+ result = opcode.eval(ctx, stack)
+ assert result is None
if isinstance(opcode, BaseJump):
i = opcode.do_jump(stack, i)
Modified: pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/jsobj.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/jsobj.py Thu May 7 20:18:51 2009
@@ -669,6 +669,7 @@
proto = ctx.get_global().Get(ctx, prototypename).Get(ctx, 'prototype')
obj = W_Object(ctx, callfunc = callfunc,Prototype=proto,
Class = proto.Class, Value = Value)
+ obj.Put(ctx, '__proto__', proto, DE|DD|RO)
return obj
def isnull_or_undefined(obj):
More information about the Pypy-commit
mailing list