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

Side by Side Diff: src/runtime.cc

Issue 7858031: Don't allow seal or element property definition on external arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 years, 3 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
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-95920.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4275 matching lines...) Expand 10 before | Expand all | Expand 10 after
4286 // Normalize the elements to enable attributes on the property. 4286 // Normalize the elements to enable attributes on the property.
4287 if (js_object->IsJSGlobalProxy()) { 4287 if (js_object->IsJSGlobalProxy()) {
4288 // We do not need to do access checks here since these has already 4288 // We do not need to do access checks here since these has already
4289 // been performed by the call to GetOwnProperty. 4289 // been performed by the call to GetOwnProperty.
4290 Handle<Object> proto(js_object->GetPrototype()); 4290 Handle<Object> proto(js_object->GetPrototype());
4291 // If proxy is detached, ignore the assignment. Alternatively, 4291 // If proxy is detached, ignore the assignment. Alternatively,
4292 // we could throw an exception. 4292 // we could throw an exception.
4293 if (proto->IsNull()) return *obj_value; 4293 if (proto->IsNull()) return *obj_value;
4294 js_object = Handle<JSObject>::cast(proto); 4294 js_object = Handle<JSObject>::cast(proto);
4295 } 4295 }
4296
4297 // Don't allow element properties to be redefined on objects with external
4298 // array elements.
4299 if (js_object->HasExternalArrayElements()) {
4300 Handle<Object> args[2] = { js_object, name };
4301 Handle<Object> error =
4302 isolate->factory()->NewTypeError("redef_external_array_element",
4303 HandleVector(args, 2));
4304 return isolate->Throw(*error);
4305 }
4306
4296 Handle<NumberDictionary> dictionary = NormalizeElements(js_object); 4307 Handle<NumberDictionary> dictionary = NormalizeElements(js_object);
4297 // Make sure that we never go back to fast case. 4308 // Make sure that we never go back to fast case.
4298 dictionary->set_requires_slow_elements(); 4309 dictionary->set_requires_slow_elements();
4299 PropertyDetails details = PropertyDetails(attr, NORMAL); 4310 PropertyDetails details = PropertyDetails(attr, NORMAL);
4300 Handle<NumberDictionary> extended_dictionary = 4311 Handle<NumberDictionary> extended_dictionary =
4301 NumberDictionarySet(dictionary, index, obj_value, details); 4312 NumberDictionarySet(dictionary, index, obj_value, details);
4302 if (*extended_dictionary != *dictionary) { 4313 if (*extended_dictionary != *dictionary) {
4303 if (js_object->GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { 4314 if (js_object->GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) {
4304 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); 4315 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary);
4305 } else { 4316 } else {
(...skipping 8827 matching lines...) Expand 10 before | Expand all | Expand 10 after
13133 } else { 13144 } else {
13134 // Handle last resort GC and make sure to allow future allocations 13145 // Handle last resort GC and make sure to allow future allocations
13135 // to grow the heap without causing GCs (if possible). 13146 // to grow the heap without causing GCs (if possible).
13136 isolate->counters()->gc_last_resort_from_js()->Increment(); 13147 isolate->counters()->gc_last_resort_from_js()->Increment();
13137 isolate->heap()->CollectAllGarbage(false); 13148 isolate->heap()->CollectAllGarbage(false);
13138 } 13149 }
13139 } 13150 }
13140 13151
13141 13152
13142 } } // namespace v8::internal 13153 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-95920.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698