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

Unified Diff: src/objects.h

Issue 776143005: Optimize Object.seal and Object.preventExtensions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add support for preventExtensions Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.cc » ('j') | src/objects-printer.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index bb9ecee0172d71b6348f4e90ed0ee3c7bc5e5850..38d05d311387757d1a7e6aa44041042bc7e88840 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -2106,6 +2106,9 @@ class JSObject: public JSReceiver {
MUST_USE_RESULT static MaybeHandle<Object> PreventExtensions(
Handle<JSObject> object);
+ // ES5 Object.seal
+ MUST_USE_RESULT static MaybeHandle<Object> Seal(Handle<JSObject> object);
+
// ES5 Object.freeze
MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object);
@@ -2393,6 +2396,15 @@ class JSObject: public JSReceiver {
static Handle<Smi> GetOrCreateIdentityHash(Handle<JSObject> object);
+ static Handle<SeededNumberDictionary> GetNormalizedElementDictionary(
+ Handle<JSObject> object);
+
+ // Helper for fast versions of preventExtensions, seal, and freeze.
+ // attrs is one of NONE, SEALED, or FROZEN (depending on the operation).
+ template <PropertyAttributes attrs>
+ MUST_USE_RESULT static MaybeHandle<Object> PreventExtensionsWithTransition(
+ Handle<JSObject> object);
+
DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject);
};
@@ -5612,6 +5624,9 @@ class DependentCode: public FixedArray {
};
+class Symbol;
Igor Sheludko 2014/12/10 10:36:14 I think src/globals.h is a better place for this.
adamk 2014/12/10 18:46:01 Thanks for the pointer, I didn't know about that l
+
+
// All heap objects have a Map that describes their structure.
// A Map contains information about:
// - Size information about the object
@@ -5662,11 +5677,10 @@ class Map: public HeapObject {
class OwnsDescriptors : public BitField<bool, 21, 1> {};
class HasInstanceCallHandler : public BitField<bool, 22, 1> {};
class Deprecated : public BitField<bool, 23, 1> {};
- class IsFrozen : public BitField<bool, 24, 1> {};
- class IsUnstable : public BitField<bool, 25, 1> {};
- class IsMigrationTarget : public BitField<bool, 26, 1> {};
- class DoneInobjectSlackTracking : public BitField<bool, 27, 1> {};
- // Bit 28 is free.
+ class IsUnstable : public BitField<bool, 24, 1> {};
+ class IsMigrationTarget : public BitField<bool, 25, 1> {};
+ class DoneInobjectSlackTracking : public BitField<bool, 26, 1> {};
+ // Bits 27 and 28 are free.
// Keep this bit field at the very end for better code in
// Builtins::kJSConstructStubGeneric stub.
@@ -6006,8 +6020,6 @@ class Map: public HeapObject {
inline void set_owns_descriptors(bool owns_descriptors);
inline bool has_instance_call_handler();
inline void set_has_instance_call_handler();
- inline void freeze();
- inline bool is_frozen();
inline void mark_unstable();
inline bool is_stable();
inline void set_migration_target(bool value);
@@ -6067,7 +6079,10 @@ class Map: public HeapObject {
static Handle<Map> CopyForObserved(Handle<Map> map);
- static Handle<Map> CopyForFreeze(Handle<Map> map);
+ static Handle<Map> CopyForPreventExtensions(Handle<Map> map,
+ PropertyAttributes attrs_to_add,
+ Handle<Symbol> transition_marker,
+ const char* reason);
// Maximal number of fast properties. Used to restrict the number of map
// transitions to avoid an explosion in the number of maps for objects used as
// dictionaries.
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.cc » ('j') | src/objects-printer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698