[pypy-commit] lang-js default: mark immutable fields

stepahn noreply at buildbot.pypy.org
Fri Dec 28 11:35:36 CET 2012


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r314:38a3df9f5a9f
Date: 2012-12-11 16:30 +0100
http://bitbucket.org/pypy/lang-js/changeset/38a3df9f5a9f/

Log:	mark immutable fields

diff --git a/js/environment_record.py b/js/environment_record.py
--- a/js/environment_record.py
+++ b/js/environment_record.py
@@ -30,6 +30,8 @@
 
 
 class DeclarativeEnvironmentRecord(EnvironmentRecord):
+    _immutable_fields_ = ['_binding_slots_', '_binding_resize_']
+
     def __init__(self, size=0, resize=True):
         EnvironmentRecord.__init__(self)
         self._binding_map_ = _new_map()
diff --git a/js/execution_context.py b/js/execution_context.py
--- a/js/execution_context.py
+++ b/js/execution_context.py
@@ -188,6 +188,7 @@
 
 
 class FunctionExecutionContext(ExecutionContext):
+    _immutable_fields_ = ['_scope_', '_calling_context_']
     _refs_resizable_ = False
     def __init__(self, code, formal_parameters=[], argv=[], this=w_Undefined, strict=False, scope=None, w_func=None):
         from js.jsobj import isnull_or_undefined, W_BasicObject
diff --git a/js/jsobj.py b/js/jsobj.py
--- a/js/jsobj.py
+++ b/js/jsobj.py
@@ -816,6 +816,7 @@
 
 
 class W__Function(W_BasicFunction):
+    _immutable_fields_ = ['_type_', '_class_', '_extensible_', '_scope_', '_params_', '_strict_', '_function_']
 
     def __init__(self, function_body, formal_parameter_list=[], scope=None, strict=False):
         W_BasicFunction.__init__(self)
@@ -1153,6 +1154,8 @@
 
 
 class W_FloatNumber(W_Number):
+    _immutable_fields_ = ['_floatval_']
+
     """ Number known to be a float
     """
     def __init__(self, floatval):
diff --git a/js/opcodes.py b/js/opcodes.py
--- a/js/opcodes.py
+++ b/js/opcodes.py
@@ -106,7 +106,7 @@
 
 
 class LOAD_STRINGCONSTANT(Opcode):
-    _immutable_fields_ = ['w_stringvalue']
+    _immutable_fields_ = ['strval']
 
     def __init__(self, value):
         #assert isinstance(value, unicode)


More information about the pypy-commit mailing list