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

Side by Side Diff: src/objects.h

Issue 437083004: Keep function.prototype fast. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add TODO and make .prototype fast on creating the initial map Created 6 years, 4 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/factory.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assert-scope.h" 9 #include "src/assert-scope.h"
10 #include "src/builtins.h" 10 #include "src/builtins.h"
(...skipping 6186 matching lines...) Expand 10 before | Expand all | Expand 10 after
6197 inline void set_is_observed() { 6197 inline void set_is_observed() {
6198 set_bit_field(bit_field() | (1 << kIsObserved)); 6198 set_bit_field(bit_field() | (1 << kIsObserved));
6199 } 6199 }
6200 6200
6201 inline bool is_observed() { 6201 inline bool is_observed() {
6202 return ((1 << kIsObserved) & bit_field()) != 0; 6202 return ((1 << kIsObserved) & bit_field()) != 0;
6203 } 6203 }
6204 6204
6205 inline void set_is_extensible(bool value); 6205 inline void set_is_extensible(bool value);
6206 inline bool is_extensible(); 6206 inline bool is_extensible();
6207 inline void mark_prototype_map();
6208 inline bool is_prototype_map();
6207 6209
6208 inline void set_elements_kind(ElementsKind elements_kind) { 6210 inline void set_elements_kind(ElementsKind elements_kind) {
6209 ASSERT(elements_kind < kElementsKindCount); 6211 ASSERT(elements_kind < kElementsKindCount);
6210 ASSERT(kElementsKindCount <= (1 << Map::ElementsKindBits::kSize)); 6212 ASSERT(kElementsKindCount <= (1 << Map::ElementsKindBits::kSize));
6211 set_bit_field2(Map::ElementsKindBits::update(bit_field2(), elements_kind)); 6213 set_bit_field2(Map::ElementsKindBits::update(bit_field2(), elements_kind));
6212 ASSERT(this->elements_kind() == elements_kind); 6214 ASSERT(this->elements_kind() == elements_kind);
6213 } 6215 }
6214 6216
6215 inline ElementsKind elements_kind() { 6217 inline ElementsKind elements_kind() {
6216 return Map::ElementsKindBits::decode(bit_field2()); 6218 return Map::ElementsKindBits::decode(bit_field2());
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
6530 Handle<Name> name, 6532 Handle<Name> name,
6531 Handle<Object> value, 6533 Handle<Object> value,
6532 PropertyAttributes attributes, 6534 PropertyAttributes attributes,
6533 StoreFromKeyed store_mode); 6535 StoreFromKeyed store_mode);
6534 6536
6535 inline void AppendDescriptor(Descriptor* desc); 6537 inline void AppendDescriptor(Descriptor* desc);
6536 6538
6537 // Returns a copy of the map, with all transitions dropped from the 6539 // Returns a copy of the map, with all transitions dropped from the
6538 // instance descriptors. 6540 // instance descriptors.
6539 static Handle<Map> Copy(Handle<Map> map); 6541 static Handle<Map> Copy(Handle<Map> map);
6542 static Handle<Map> CopyAsPrototypeMap(Handle<Map> map);
6540 static Handle<Map> Create(Handle<JSFunction> constructor, 6543 static Handle<Map> Create(Handle<JSFunction> constructor,
6541 int extra_inobject_properties); 6544 int extra_inobject_properties);
6542 6545
6543 // Returns the next free property index (only valid for FAST MODE). 6546 // Returns the next free property index (only valid for FAST MODE).
6544 int NextFreePropertyIndex(); 6547 int NextFreePropertyIndex();
6545 6548
6546 // Returns the number of properties described in instance_descriptors 6549 // Returns the number of properties described in instance_descriptors
6547 // filtering out properties with the specified attributes. 6550 // filtering out properties with the specified attributes.
6548 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS, 6551 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS,
6549 PropertyAttributes filter = NONE); 6552 PropertyAttributes filter = NONE);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
6729 static const int kHasNamedInterceptor = 2; 6732 static const int kHasNamedInterceptor = 2;
6730 static const int kHasIndexedInterceptor = 3; 6733 static const int kHasIndexedInterceptor = 3;
6731 static const int kIsUndetectable = 4; 6734 static const int kIsUndetectable = 4;
6732 static const int kIsObserved = 5; 6735 static const int kIsObserved = 5;
6733 static const int kIsAccessCheckNeeded = 6; 6736 static const int kIsAccessCheckNeeded = 6;
6734 class FunctionWithPrototype: public BitField<bool, 7, 1> {}; 6737 class FunctionWithPrototype: public BitField<bool, 7, 1> {};
6735 6738
6736 // Bit positions for bit field 2 6739 // Bit positions for bit field 2
6737 static const int kIsExtensible = 0; 6740 static const int kIsExtensible = 0;
6738 static const int kStringWrapperSafeForDefaultValueOf = 1; 6741 static const int kStringWrapperSafeForDefaultValueOf = 1;
6739 // Currently bit 2 is not used. 6742 class IsPrototypeMapBits : public BitField<bool, 2, 1> {};
6740 class ElementsKindBits: public BitField<ElementsKind, 3, 5> {}; 6743 class ElementsKindBits: public BitField<ElementsKind, 3, 5> {};
6741 6744
6742 // Derived values from bit field 2 6745 // Derived values from bit field 2
6743 static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>( 6746 static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>(
6744 (FAST_ELEMENTS + 1) << Map::ElementsKindBits::kShift) - 1; 6747 (FAST_ELEMENTS + 1) << Map::ElementsKindBits::kShift) - 1;
6745 static const int8_t kMaximumBitField2FastSmiElementValue = 6748 static const int8_t kMaximumBitField2FastSmiElementValue =
6746 static_cast<int8_t>((FAST_SMI_ELEMENTS + 1) << 6749 static_cast<int8_t>((FAST_SMI_ELEMENTS + 1) <<
6747 Map::ElementsKindBits::kShift) - 1; 6750 Map::ElementsKindBits::kShift) - 1;
6748 static const int8_t kMaximumBitField2FastHoleyElementValue = 6751 static const int8_t kMaximumBitField2FastHoleyElementValue =
6749 static_cast<int8_t>((FAST_HOLEY_ELEMENTS + 1) << 6752 static_cast<int8_t>((FAST_HOLEY_ELEMENTS + 1) <<
(...skipping 4510 matching lines...) Expand 10 before | Expand all | Expand 10 after
11260 } else { 11263 } else {
11261 value &= ~(1 << bit_position); 11264 value &= ~(1 << bit_position);
11262 } 11265 }
11263 return value; 11266 return value;
11264 } 11267 }
11265 }; 11268 };
11266 11269
11267 } } // namespace v8::internal 11270 } } // namespace v8::internal
11268 11271
11269 #endif // V8_OBJECTS_H_ 11272 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698