Reviewers: Søren Gjesse, Mads Ager,

Description:
Added Extensible property to objects and made methods for extracting and setting
it.
Also added one method to runtime to get the extensible value
Additionally, added a check on the number of arguments in the start of
GetOwnProperty.



Please review this at http://codereview.chromium.org/545116

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/objects.h
  M     src/runtime.h
  M     src/runtime.cc


Index: src/runtime.cc
===================================================================
--- src/runtime.cc      (revision 3642)
+++ src/runtime.cc      (working copy)
@@ -583,6 +583,7 @@
 //  if args[1] is an accessor on args[0]
 //         [true, GetFunction, SetFunction, Enumerable, Configurable]
 static Object* Runtime_GetOwnProperty(Arguments args) {
+  ASSERT(args.lenght() == 2);
   HandleScope scope;
   Handle<FixedArray> elms = Factory::NewFixedArray(5);
   Handle<JSArray> desc = Factory::NewJSArrayWithElements(elms);
@@ -626,6 +627,14 @@
 }


+static Object* Runtime_Extensible(Arguments args) {
+  ASSERT(args.length() == 1);
+  CONVERT_CHECKED(JSObject, obj, args[0]);
+  return obj->map()->is_extensible() ?  Heap::true_value()
+                                     : Heap::false_value();
+}
+
+
 static Object* Runtime_RegExpCompile(Arguments args) {
   HandleScope scope;
   ASSERT(args.length() == 3);
Index: src/runtime.h
===================================================================
--- src/runtime.h       (revision 3642)
+++ src/runtime.h       (working copy)
@@ -68,6 +68,8 @@
   \
   F(GetOwnProperty, 2, 1) \
   \
+  F(Extensible, 1, 1) \
+  \
   /* Utilities */ \
   F(GetCalledFunction, 0, 1) \
   F(GetFunctionDelegate, 1, 1) \
Index: src/objects.h
===================================================================
--- src/objects.h       (revision 3642)
+++ src/objects.h       (working copy)
@@ -2889,6 +2889,14 @@
     return ((1 << kHasInstanceCallHandler) & bit_field()) != 0;
   }

+  inline void set_is_extensible() {
+    set_bit_field2(bit_field2() | (1 << kIsExtensible));
+  }
+
+  inline bool is_extensible() {
+    return ((1 << kIsExtensible) & bit_field2()) != 0;
+  }
+
   // Tells whether the instance needs security checks when accessing its
   // properties.
   inline void set_is_access_check_needed(bool access_check_needed);
@@ -3006,6 +3014,7 @@

   // Bit positions for bit field 2
   static const int kNeedsLoading = 0;
+  static const int kIsExtensible = 1;

  private:
   DISALLOW_IMPLICIT_CONSTRUCTORS(Map);


-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to