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

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 nonextensible and sealed as special transitions 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') | no next file with comments »
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 3ec5924fde6a9601ddbde9ff27581f723ae0b8f8..d89def9d4bb2cf9f2e1c19d00d56d933081f64d4 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -2115,6 +2115,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);
@@ -2404,6 +2407,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);
};
@@ -5676,10 +5688,9 @@ 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> {};
- // Bit 27 is free.
+ class IsUnstable : public BitField<bool, 24, 1> {};
+ class IsMigrationTarget : public BitField<bool, 25, 1> {};
+ // Bits 26 and 27 are free.
// Keep this bit field at the very end for better code in
// Builtins::kJSConstructStubGeneric stub.
@@ -6029,8 +6040,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);
@@ -6088,7 +6097,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698