Revision: 3646
Author: [email protected]
Date: Tue Jan 19 04:56:36 2010
Log: 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.


Review URL: http://codereview.chromium.org/545116
http://code.google.com/p/v8/source/detail?r=3646

Modified:
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/runtime.h

=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Jan 12 15:42:36 2010
+++ /branches/bleeding_edge/src/objects.h       Tue Jan 19 04:56:36 2010
@@ -2888,6 +2888,14 @@
   inline bool has_instance_call_handler() {
     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.
@@ -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);
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Fri Jan 15 07:34:32 2010
+++ /branches/bleeding_edge/src/runtime.cc      Tue Jan 19 04:56:36 2010
@@ -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);
@@ -624,6 +625,14 @@
   elms->set(4, Heap::ToBoolean(!result.IsReadOnly()));
   return *desc;
 }
+
+
+static Object* Runtime_IsExtensible(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) {
=======================================
--- /branches/bleeding_edge/src/runtime.h       Fri Jan 15 07:34:32 2010
+++ /branches/bleeding_edge/src/runtime.h       Tue Jan 19 04:56:36 2010
@@ -68,6 +68,8 @@
   \
   F(GetOwnProperty, 2, 1) \
   \
+  F(IsExtensible, 1, 1) \
+  \
   /* Utilities */ \
   F(GetCalledFunction, 0, 1) \
   F(GetFunctionDelegate, 1, 1) \
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to