OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
874 elms->set(VALUE_INDEX, value); | 874 elms->set(VALUE_INDEX, value); |
875 } | 875 } |
876 | 876 |
877 return *desc; | 877 return *desc; |
878 } | 878 } |
879 | 879 |
880 | 880 |
881 static MaybeObject* Runtime_PreventExtensions(Arguments args) { | 881 static MaybeObject* Runtime_PreventExtensions(Arguments args) { |
882 ASSERT(args.length() == 1); | 882 ASSERT(args.length() == 1); |
883 CONVERT_CHECKED(JSObject, obj, args[0]); | 883 CONVERT_CHECKED(JSObject, obj, args[0]); |
884 | |
885 if (obj->IsJSGlobalProxy()) { | |
886 // If access checks fail simply return false | |
antonm
2011/02/17 15:44:12
nit: dot at the end, please
Rico
2011/02/18 07:49:09
Done.
| |
887 if (obj->IsAccessCheckNeeded() && | |
antonm
2011/02/17 15:44:12
Do we want access checks only on the proxy? Why n
| |
888 !Top::MayNamedAccess(obj, Heap::undefined_value(), v8::ACCESS_KEYS)) { | |
889 Top::ReportFailedAccessCheck(obj, v8::ACCESS_KEYS); | |
890 return Heap::false_value(); | |
891 } | |
892 obj = JSObject::cast(obj->GetPrototype()); | |
893 } | |
894 | |
884 return obj->PreventExtensions(); | 895 return obj->PreventExtensions(); |
885 } | 896 } |
886 | 897 |
887 | 898 |
888 static MaybeObject* Runtime_IsExtensible(Arguments args) { | 899 static MaybeObject* Runtime_IsExtensible(Arguments args) { |
889 ASSERT(args.length() == 1); | 900 ASSERT(args.length() == 1); |
890 CONVERT_CHECKED(JSObject, obj, args[0]); | 901 CONVERT_CHECKED(JSObject, obj, args[0]); |
891 if (obj->IsJSGlobalProxy()) { | 902 if (obj->IsJSGlobalProxy()) { |
892 Object* proto = obj->GetPrototype(); | 903 Object* proto = obj->GetPrototype(); |
893 if (proto->IsNull()) return Heap::false_value(); | 904 if (proto->IsNull()) return Heap::false_value(); |
(...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3666 uint32_t index; | 3677 uint32_t index; |
3667 bool is_element = name->AsArrayIndex(&index); | 3678 bool is_element = name->AsArrayIndex(&index); |
3668 | 3679 |
3669 // Special case for elements if any of the flags are true. | 3680 // Special case for elements if any of the flags are true. |
3670 // If elements are in fast case we always implicitly assume that: | 3681 // If elements are in fast case we always implicitly assume that: |
3671 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false. | 3682 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false. |
3672 if (((unchecked & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) && | 3683 if (((unchecked & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) && |
3673 is_element) { | 3684 is_element) { |
3674 // Normalize the elements to enable attributes on the property. | 3685 // Normalize the elements to enable attributes on the property. |
3675 if (js_object->IsJSGlobalProxy()) { | 3686 if (js_object->IsJSGlobalProxy()) { |
3687 // We do not need to do access checks here since these has already | |
3688 // been performed by the call to GetOwnProperty. | |
3676 Handle<Object> proto(js_object->GetPrototype()); | 3689 Handle<Object> proto(js_object->GetPrototype()); |
3677 // If proxy is detached, ignore the assignment. Alternatively, | 3690 // If proxy is detached, ignore the assignment. Alternatively, |
3678 // we could throw an exception. | 3691 // we could throw an exception. |
3679 if (proto->IsNull()) return *obj_value; | 3692 if (proto->IsNull()) return *obj_value; |
3680 js_object = Handle<JSObject>::cast(proto); | 3693 js_object = Handle<JSObject>::cast(proto); |
3681 } | 3694 } |
3682 NormalizeElements(js_object); | 3695 NormalizeElements(js_object); |
3683 Handle<NumberDictionary> dictionary(js_object->element_dictionary()); | 3696 Handle<NumberDictionary> dictionary(js_object->element_dictionary()); |
3684 // Make sure that we never go back to fast case. | 3697 // Make sure that we never go back to fast case. |
3685 dictionary->set_requires_slow_elements(); | 3698 dictionary->set_requires_slow_elements(); |
(...skipping 7515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11201 } else { | 11214 } else { |
11202 // Handle last resort GC and make sure to allow future allocations | 11215 // Handle last resort GC and make sure to allow future allocations |
11203 // to grow the heap without causing GCs (if possible). | 11216 // to grow the heap without causing GCs (if possible). |
11204 Counters::gc_last_resort_from_js.Increment(); | 11217 Counters::gc_last_resort_from_js.Increment(); |
11205 Heap::CollectAllGarbage(false); | 11218 Heap::CollectAllGarbage(false); |
11206 } | 11219 } |
11207 } | 11220 } |
11208 | 11221 |
11209 | 11222 |
11210 } } // namespace v8::internal | 11223 } } // namespace v8::internal |
OLD | NEW |