Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime.cc

Issue 6534019: Add access checks to Object.preventExtensions + add regression test for 1027.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 3655 matching lines...) Expand 10 before | Expand all | Expand 10 after
3666 uint32_t index; 3666 uint32_t index;
3667 bool is_element = name->AsArrayIndex(&index); 3667 bool is_element = name->AsArrayIndex(&index);
3668 3668
3669 // Special case for elements if any of the flags are true. 3669 // Special case for elements if any of the flags are true.
3670 // If elements are in fast case we always implicitly assume that: 3670 // If elements are in fast case we always implicitly assume that:
3671 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false. 3671 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false.
3672 if (((unchecked & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) && 3672 if (((unchecked & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) &&
3673 is_element) { 3673 is_element) {
3674 // Normalize the elements to enable attributes on the property. 3674 // Normalize the elements to enable attributes on the property.
3675 if (js_object->IsJSGlobalProxy()) { 3675 if (js_object->IsJSGlobalProxy()) {
3676 // We do not need to do access checks here since these has already
3677 // been performed by the call to GetOwnProperty.
3676 Handle<Object> proto(js_object->GetPrototype()); 3678 Handle<Object> proto(js_object->GetPrototype());
3677 // If proxy is detached, ignore the assignment. Alternatively, 3679 // If proxy is detached, ignore the assignment. Alternatively,
3678 // we could throw an exception. 3680 // we could throw an exception.
3679 if (proto->IsNull()) return *obj_value; 3681 if (proto->IsNull()) return *obj_value;
3680 js_object = Handle<JSObject>::cast(proto); 3682 js_object = Handle<JSObject>::cast(proto);
3681 } 3683 }
3682 NormalizeElements(js_object); 3684 NormalizeElements(js_object);
3683 Handle<NumberDictionary> dictionary(js_object->element_dictionary()); 3685 Handle<NumberDictionary> dictionary(js_object->element_dictionary());
3684 // Make sure that we never go back to fast case. 3686 // Make sure that we never go back to fast case.
3685 dictionary->set_requires_slow_elements(); 3687 dictionary->set_requires_slow_elements();
(...skipping 7515 matching lines...) Expand 10 before | Expand all | Expand 10 after
11201 } else { 11203 } else {
11202 // Handle last resort GC and make sure to allow future allocations 11204 // Handle last resort GC and make sure to allow future allocations
11203 // to grow the heap without causing GCs (if possible). 11205 // to grow the heap without causing GCs (if possible).
11204 Counters::gc_last_resort_from_js.Increment(); 11206 Counters::gc_last_resort_from_js.Increment();
11205 Heap::CollectAllGarbage(false); 11207 Heap::CollectAllGarbage(false);
11206 } 11208 }
11207 } 11209 }
11208 11210
11209 11211
11210 } } // namespace v8::internal 11212 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698