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

Side by Side Diff: src/objects.h

Issue 29353003: [Object.observe] Don't force normalization of elements for observed objects (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: whitespace Created 7 years, 1 month 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/mips/ic-mips.cc ('k') | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 5646 matching lines...) Expand 10 before | Expand all | Expand 10 after
5657 // Bit field 3. 5657 // Bit field 3.
5658 inline uint32_t bit_field3(); 5658 inline uint32_t bit_field3();
5659 inline void set_bit_field3(uint32_t bits); 5659 inline void set_bit_field3(uint32_t bits);
5660 5660
5661 class EnumLengthBits: public BitField<int, 0, 11> {}; 5661 class EnumLengthBits: public BitField<int, 0, 11> {};
5662 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {}; 5662 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {};
5663 class IsShared: public BitField<bool, 22, 1> {}; 5663 class IsShared: public BitField<bool, 22, 1> {};
5664 class FunctionWithPrototype: public BitField<bool, 23, 1> {}; 5664 class FunctionWithPrototype: public BitField<bool, 23, 1> {};
5665 class DictionaryMap: public BitField<bool, 24, 1> {}; 5665 class DictionaryMap: public BitField<bool, 24, 1> {};
5666 class OwnsDescriptors: public BitField<bool, 25, 1> {}; 5666 class OwnsDescriptors: public BitField<bool, 25, 1> {};
5667 class IsObserved: public BitField<bool, 26, 1> {}; 5667 class HasInstanceCallHandler: public BitField<bool, 26, 1> {};
5668 class Deprecated: public BitField<bool, 27, 1> {}; 5668 class Deprecated: public BitField<bool, 27, 1> {};
5669 class IsFrozen: public BitField<bool, 28, 1> {}; 5669 class IsFrozen: public BitField<bool, 28, 1> {};
5670 class IsUnstable: public BitField<bool, 29, 1> {}; 5670 class IsUnstable: public BitField<bool, 29, 1> {};
5671 class IsMigrationTarget: public BitField<bool, 30, 1> {}; 5671 class IsMigrationTarget: public BitField<bool, 30, 1> {};
5672 5672
5673 // Tells whether the object in the prototype property will be used 5673 // Tells whether the object in the prototype property will be used
5674 // for instances created from this function. If the prototype 5674 // for instances created from this function. If the prototype
5675 // property is set to a value that is not a JSObject, the prototype 5675 // property is set to a value that is not a JSObject, the prototype
5676 // property will not be used to create instances of the function. 5676 // property will not be used to create instances of the function.
5677 // See ECMA-262, 13.2.2. 5677 // See ECMA-262, 13.2.2.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
5720 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549. 5720 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549.
5721 inline void set_is_undetectable() { 5721 inline void set_is_undetectable() {
5722 set_bit_field(bit_field() | (1 << kIsUndetectable)); 5722 set_bit_field(bit_field() | (1 << kIsUndetectable));
5723 } 5723 }
5724 5724
5725 inline bool is_undetectable() { 5725 inline bool is_undetectable() {
5726 return ((1 << kIsUndetectable) & bit_field()) != 0; 5726 return ((1 << kIsUndetectable) & bit_field()) != 0;
5727 } 5727 }
5728 5728
5729 // Tells whether the instance has a call-as-function handler. 5729 // Tells whether the instance has a call-as-function handler.
5730 inline void set_has_instance_call_handler() { 5730 inline void set_is_observed() {
5731 set_bit_field(bit_field() | (1 << kHasInstanceCallHandler)); 5731 set_bit_field(bit_field() | (1 << kIsObserved));
5732 } 5732 }
5733 5733
5734 inline bool has_instance_call_handler() { 5734 inline bool is_observed() {
5735 return ((1 << kHasInstanceCallHandler) & bit_field()) != 0; 5735 return ((1 << kIsObserved) & bit_field()) != 0;
5736 } 5736 }
5737 5737
5738 inline void set_is_extensible(bool value); 5738 inline void set_is_extensible(bool value);
5739 inline bool is_extensible(); 5739 inline bool is_extensible();
5740 5740
5741 inline void set_elements_kind(ElementsKind elements_kind) { 5741 inline void set_elements_kind(ElementsKind elements_kind) {
5742 ASSERT(elements_kind < kElementsKindCount); 5742 ASSERT(elements_kind < kElementsKindCount);
5743 ASSERT(kElementsKindCount <= (1 << kElementsKindBitCount)); 5743 ASSERT(kElementsKindCount <= (1 << kElementsKindBitCount));
5744 ASSERT(!is_observed() ||
5745 elements_kind == DICTIONARY_ELEMENTS ||
5746 elements_kind == NON_STRICT_ARGUMENTS_ELEMENTS ||
5747 IsExternalArrayElementsKind(elements_kind));
5748 set_bit_field2((bit_field2() & ~kElementsKindMask) | 5744 set_bit_field2((bit_field2() & ~kElementsKindMask) |
5749 (elements_kind << kElementsKindShift)); 5745 (elements_kind << kElementsKindShift));
5750 ASSERT(this->elements_kind() == elements_kind); 5746 ASSERT(this->elements_kind() == elements_kind);
5751 } 5747 }
5752 5748
5753 inline ElementsKind elements_kind() { 5749 inline ElementsKind elements_kind() {
5754 return static_cast<ElementsKind>( 5750 return static_cast<ElementsKind>(
5755 (bit_field2() & kElementsKindMask) >> kElementsKindShift); 5751 (bit_field2() & kElementsKindMask) >> kElementsKindShift);
5756 } 5752 }
5757 5753
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
5990 if (length != kInvalidEnumCache) { 5986 if (length != kInvalidEnumCache) {
5991 ASSERT(length >= 0); 5987 ASSERT(length >= 0);
5992 ASSERT(length == 0 || instance_descriptors()->HasEnumCache()); 5988 ASSERT(length == 0 || instance_descriptors()->HasEnumCache());
5993 ASSERT(length <= NumberOfOwnDescriptors()); 5989 ASSERT(length <= NumberOfOwnDescriptors());
5994 } 5990 }
5995 set_bit_field3(EnumLengthBits::update(bit_field3(), length)); 5991 set_bit_field3(EnumLengthBits::update(bit_field3(), length));
5996 } 5992 }
5997 5993
5998 inline bool owns_descriptors(); 5994 inline bool owns_descriptors();
5999 inline void set_owns_descriptors(bool is_shared); 5995 inline void set_owns_descriptors(bool is_shared);
6000 inline bool is_observed(); 5996 inline bool has_instance_call_handler();
6001 inline void set_is_observed(bool is_observed); 5997 inline void set_has_instance_call_handler();
6002 inline void freeze(); 5998 inline void freeze();
6003 inline bool is_frozen(); 5999 inline bool is_frozen();
6004 inline void mark_unstable(); 6000 inline void mark_unstable();
6005 inline bool is_stable(); 6001 inline bool is_stable();
6006 inline void set_migration_target(bool value); 6002 inline void set_migration_target(bool value);
6007 inline bool is_migration_target(); 6003 inline bool is_migration_target();
6008 inline void deprecate(); 6004 inline void deprecate();
6009 inline bool is_deprecated(); 6005 inline bool is_deprecated();
6010 inline bool CanBeDeprecated(); 6006 inline bool CanBeDeprecated();
6011 // Returns a non-deprecated version of the input. If the input was not 6007 // Returns a non-deprecated version of the input. If the input was not
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
6250 6246
6251 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); 6247 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset);
6252 6248
6253 // Bit positions for bit field. 6249 // Bit positions for bit field.
6254 static const int kUnused = 0; // To be used for marking recently used maps. 6250 static const int kUnused = 0; // To be used for marking recently used maps.
6255 static const int kHasNonInstancePrototype = 1; 6251 static const int kHasNonInstancePrototype = 1;
6256 static const int kIsHiddenPrototype = 2; 6252 static const int kIsHiddenPrototype = 2;
6257 static const int kHasNamedInterceptor = 3; 6253 static const int kHasNamedInterceptor = 3;
6258 static const int kHasIndexedInterceptor = 4; 6254 static const int kHasIndexedInterceptor = 4;
6259 static const int kIsUndetectable = 5; 6255 static const int kIsUndetectable = 5;
6260 static const int kHasInstanceCallHandler = 6; 6256 static const int kIsObserved = 6;
6261 static const int kIsAccessCheckNeeded = 7; 6257 static const int kIsAccessCheckNeeded = 7;
6262 6258
6263 // Bit positions for bit field 2 6259 // Bit positions for bit field 2
6264 static const int kIsExtensible = 0; 6260 static const int kIsExtensible = 0;
6265 static const int kStringWrapperSafeForDefaultValueOf = 1; 6261 static const int kStringWrapperSafeForDefaultValueOf = 1;
6266 static const int kAttachedToSharedFunctionInfo = 2; 6262 static const int kAttachedToSharedFunctionInfo = 2;
6267 // No bits can be used after kElementsKindFirstBit, they are all reserved for 6263 // No bits can be used after kElementsKindFirstBit, they are all reserved for
6268 // storing ElementKind. 6264 // storing ElementKind.
6269 static const int kElementsKindShift = 3; 6265 static const int kElementsKindShift = 3;
6270 static const int kElementsKindBitCount = 5; 6266 static const int kElementsKindBitCount = 5;
(...skipping 4206 matching lines...) Expand 10 before | Expand all | Expand 10 after
10477 } else { 10473 } else {
10478 value &= ~(1 << bit_position); 10474 value &= ~(1 << bit_position);
10479 } 10475 }
10480 return value; 10476 return value;
10481 } 10477 }
10482 }; 10478 };
10483 10479
10484 } } // namespace v8::internal 10480 } } // namespace v8::internal
10485 10481
10486 #endif // V8_OBJECTS_H_ 10482 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/ic-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698