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

Side by Side Diff: src/objects.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/messages.js ('k') | src/runtime.cc » ('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 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 return isolate->heap()->false_value(); 3407 return isolate->heap()->false_value();
3408 } 3408 }
3409 3409
3410 if (IsJSGlobalProxy()) { 3410 if (IsJSGlobalProxy()) {
3411 Object* proto = GetPrototype(); 3411 Object* proto = GetPrototype();
3412 if (proto->IsNull()) return this; 3412 if (proto->IsNull()) return this;
3413 ASSERT(proto->IsJSGlobalObject()); 3413 ASSERT(proto->IsJSGlobalObject());
3414 return JSObject::cast(proto)->PreventExtensions(); 3414 return JSObject::cast(proto)->PreventExtensions();
3415 } 3415 }
3416 3416
3417 // It's not possible to seal objects with external array elements
3418 if (HasExternalArrayElements()) {
3419 HandleScope scope(isolate);
3420 Handle<Object> object(this);
3421 Handle<Object> error =
3422 isolate->factory()->NewTypeError(
3423 "cant_prevent_ext_external_array_elements",
3424 HandleVector(&object, 1));
3425 return isolate->Throw(*error);
3426 }
3427
3417 // If there are fast elements we normalize. 3428 // If there are fast elements we normalize.
3418 NumberDictionary* dictionary = NULL; 3429 NumberDictionary* dictionary = NULL;
3419 { MaybeObject* maybe = NormalizeElements(); 3430 { MaybeObject* maybe = NormalizeElements();
3420 if (!maybe->To<NumberDictionary>(&dictionary)) return maybe; 3431 if (!maybe->To<NumberDictionary>(&dictionary)) return maybe;
3421 } 3432 }
3422 ASSERT(HasDictionaryElements() || HasDictionaryArgumentsElements()); 3433 ASSERT(HasDictionaryElements() || HasDictionaryArgumentsElements());
3423 // Make sure that we never go back to fast case. 3434 // Make sure that we never go back to fast case.
3424 dictionary->set_requires_slow_elements(); 3435 dictionary->set_requires_slow_elements();
3425 3436
3426 // Do a map transition, other objects with this map may still 3437 // Do a map transition, other objects with this map may still
(...skipping 8171 matching lines...) Expand 10 before | Expand all | Expand 10 after
11598 if (break_point_objects()->IsUndefined()) return 0; 11609 if (break_point_objects()->IsUndefined()) return 0;
11599 // Single break point. 11610 // Single break point.
11600 if (!break_point_objects()->IsFixedArray()) return 1; 11611 if (!break_point_objects()->IsFixedArray()) return 1;
11601 // Multiple break points. 11612 // Multiple break points.
11602 return FixedArray::cast(break_point_objects())->length(); 11613 return FixedArray::cast(break_point_objects())->length();
11603 } 11614 }
11604 #endif 11615 #endif
11605 11616
11606 11617
11607 } } // namespace v8::internal 11618 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698