Commit 4667efc0 authored by ricow@chromium.org's avatar ricow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3646 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3e8539d8
...@@ -2889,6 +2889,14 @@ class Map: public HeapObject { ...@@ -2889,6 +2889,14 @@ class Map: public HeapObject {
return ((1 << kHasInstanceCallHandler) & bit_field()) != 0; 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 // Tells whether the instance needs security checks when accessing its
// properties. // properties.
inline void set_is_access_check_needed(bool access_check_needed); inline void set_is_access_check_needed(bool access_check_needed);
...@@ -3006,6 +3014,7 @@ class Map: public HeapObject { ...@@ -3006,6 +3014,7 @@ class Map: public HeapObject {
// Bit positions for bit field 2 // Bit positions for bit field 2
static const int kNeedsLoading = 0; static const int kNeedsLoading = 0;
static const int kIsExtensible = 1;
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Map); DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
......
...@@ -583,6 +583,7 @@ static void GetOwnPropertyImplementation(JSObject* obj, ...@@ -583,6 +583,7 @@ static void GetOwnPropertyImplementation(JSObject* obj,
// if args[1] is an accessor on args[0] // if args[1] is an accessor on args[0]
// [true, GetFunction, SetFunction, Enumerable, Configurable] // [true, GetFunction, SetFunction, Enumerable, Configurable]
static Object* Runtime_GetOwnProperty(Arguments args) { static Object* Runtime_GetOwnProperty(Arguments args) {
ASSERT(args.lenght() == 2);
HandleScope scope; HandleScope scope;
Handle<FixedArray> elms = Factory::NewFixedArray(5); Handle<FixedArray> elms = Factory::NewFixedArray(5);
Handle<JSArray> desc = Factory::NewJSArrayWithElements(elms); Handle<JSArray> desc = Factory::NewJSArrayWithElements(elms);
...@@ -626,6 +627,14 @@ static Object* Runtime_GetOwnProperty(Arguments args) { ...@@ -626,6 +627,14 @@ static Object* Runtime_GetOwnProperty(Arguments args) {
} }
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) { static Object* Runtime_RegExpCompile(Arguments args) {
HandleScope scope; HandleScope scope;
ASSERT(args.length() == 3); ASSERT(args.length() == 3);
......
...@@ -68,6 +68,8 @@ namespace internal { ...@@ -68,6 +68,8 @@ namespace internal {
\ \
F(GetOwnProperty, 2, 1) \ F(GetOwnProperty, 2, 1) \
\ \
F(IsExtensible, 1, 1) \
\
/* Utilities */ \ /* Utilities */ \
F(GetCalledFunction, 0, 1) \ F(GetCalledFunction, 0, 1) \
F(GetFunctionDelegate, 1, 1) \ F(GetFunctionDelegate, 1, 1) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment