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

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: tweaks 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
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 Handle<Object> args[1] = { args[0] };
3420 Handle<Object> error =
3421 isolate->factory()->NewTypeError("seal_external_array_elements",
3422 HandleVector(args, 1));
3423 return isolate->Throw(*error);
3424 }
3425
3417 // If there are fast elements we normalize. 3426 // If there are fast elements we normalize.
3418 NumberDictionary* dictionary = NULL; 3427 NumberDictionary* dictionary = NULL;
3419 { MaybeObject* maybe = NormalizeElements(); 3428 { MaybeObject* maybe = NormalizeElements();
3420 if (!maybe->To<NumberDictionary>(&dictionary)) return maybe; 3429 if (!maybe->To<NumberDictionary>(&dictionary)) return maybe;
3421 } 3430 }
3422 ASSERT(HasDictionaryElements() || HasDictionaryArgumentsElements()); 3431 ASSERT(HasDictionaryElements() || HasDictionaryArgumentsElements());
3423 // Make sure that we never go back to fast case. 3432 // Make sure that we never go back to fast case.
3424 dictionary->set_requires_slow_elements(); 3433 dictionary->set_requires_slow_elements();
3425 3434
3426 // Do a map transition, other objects with this map may still 3435 // 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; 11607 if (break_point_objects()->IsUndefined()) return 0;
11599 // Single break point. 11608 // Single break point.
11600 if (!break_point_objects()->IsFixedArray()) return 1; 11609 if (!break_point_objects()->IsFixedArray()) return 1;
11601 // Multiple break points. 11610 // Multiple break points.
11602 return FixedArray::cast(break_point_objects())->length(); 11611 return FixedArray::cast(break_point_objects())->length();
11603 } 11612 }
11604 #endif 11613 #endif
11605 11614
11606 11615
11607 } } // namespace v8::internal 11616 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/runtime.cc » ('j') | test/mjsunit/regress/regress-95920.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698