28 #ifndef V8_PROPERTY_H_
29 #define V8_PROPERTY_H_
48 if (!key_->IsUniqueName()) {
49 MaybeObject* maybe_result =
50 key_->GetIsolate()->heap()->InternalizeString(
String::cast(key_));
51 if (!maybe_result->To(&key_))
return maybe_result;
61 void Print(FILE* out);
69 PropertyDetails details_;
93 details_(attributes, type, representation, field_index) { }
105 : Descriptor(key,
Smi::FromInt(0), attributes,
106 FIELD, representation, field_index) {}
115 : Descriptor(key, value, attributes,
CONSTANT,
116 value->OptimalRepresentation()) {}
125 : Descriptor(key, foreign, attributes,
CALLBACKS,
155 return field_index() < holder->map()->inobject_properties();
160 int index =
field_index() - holder->map()->inobject_properties();
161 if (index >= 0)
return index;
162 return index + holder->map()->instance_size() /
kPointerSize;
166 static const int kHeaderIndexBit = 1 << 31;
167 static const int kIndexMask = ~kHeaderIndexBit;
169 int value() {
return index_ & kIndexMask; }
171 PropertyIndex(
int index,
bool is_header_based)
172 : index_(index | (is_header_based ? kHeaderIndexBit : 0)) {
173 ASSERT(index <= kIndexMask);
184 next_(isolate->top_lookup_result()),
185 lookup_type_(NOT_FOUND),
190 isolate->set_top_lookup_result(
this);
194 ASSERT(isolate()->top_lookup_result() ==
this);
195 isolate()->set_top_lookup_result(next_);
201 lookup_type_ = DESCRIPTOR_TYPE;
209 if (IsNormal())
return true;
211 return value->FitsRepresentation(details_.representation());
215 lookup_type_ = TRANSITION_TYPE;
218 transition_ = target;
223 lookup_type_ = DICTIONARY_TYPE;
231 lookup_type_ = HANDLER_TYPE;
239 lookup_type_ = INTERCEPTOR_TYPE;
246 lookup_type_ = NOT_FOUND;
264 return details_.type();
271 return details_.representation();
278 return details_.attributes();
288 return IsTransition() || type() !=
NORMAL;
301 return details_.IsReadOnly();
306 return details_.type() ==
FIELD;
311 return details_.type() ==
NORMAL;
320 return IsConstant() && GetValue()->IsJSFunction();
325 bool IsFound()
const {
return lookup_type_ != NOT_FOUND; }
327 bool IsHandler()
const {
return lookup_type_ == HANDLER_TYPE; }
332 return IsFound() && !IsTransition();
342 Object* callback = GetCallbackObject();
361 return holder()->RawFastPropertyAt(GetFieldIndex().field_index());
364 value = holder()->property_dictionary()->ValueAt(GetDictionaryEntry());
365 if (holder()->IsGlobalObject()) {
371 return GetConstant();
377 return isolate()->heap()->the_hole_value();
389 return transition_->GetLastDescriptorDetails();
393 return IsTransition() && GetTransitionDetails().type() ==
FIELD;
397 return IsTransition() && GetTransitionDetails().type() ==
CONSTANT;
401 ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
406 ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
415 ASSERT(lookup_type_ == DICTIONARY_TYPE);
426 return GetValueFromMap(map);
444 void Print(FILE* out);
448 if (lookup_type_ == DESCRIPTOR_TYPE) {
449 return GetValueFromMap(holder()->
map());
452 ASSERT(lookup_type_ == DICTIONARY_TYPE);
453 return holder()->GetNormalizedProperty(
this);
457 ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
458 ASSERT(number_ < map->NumberOfOwnDescriptors());
459 return map->instance_descriptors()->GetValue(number_);
463 ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
464 ASSERT(number_ < map->NumberOfOwnDescriptors());
465 return map->instance_descriptors()->GetFieldIndex(number_);
468 void Iterate(ObjectVisitor* visitor);
488 PropertyDetails details_;
494 #endif // V8_PROPERTY_H_
void DescriptorResult(JSObject *holder, PropertyDetails details, int number)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
Descriptor(Name *key, Object *value, PropertyDetails details)
PropertyDetails GetTransitionDetails() const
Object * GetLazyValue() const
Object * GetConstant() const
PropertyDetails GetPropertyDetails() const
int inobject_properties()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths true
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
Representation representation() const
static String * cast(Object *obj)
Object * GetValueFromMap(Map *map) const
int GetDescriptorIndex() const
PropertyType type() const
MUST_USE_RESULT MaybeObject * KeyToUniqueName()
static PropertyIndex NewFieldIndex(int index)
bool is_inobject(Handle< JSObject > holder)
#define ASSERT(condition)
int translate(Handle< JSObject > holder)
Object * GetValue() const
CallbacksDescriptor(Name *key, Object *foreign, PropertyAttributes attributes)
bool IsDataProperty() const
bool IsPropertyCallbacks() const
void SetSortedKeyIndex(int index)
LookupResult(Isolate *isolate)
JSFunction * GetConstantFunctionFromMap(Map *map) const
static PropertyCell * cast(Object *obj)
bool CanHoldValue(Handle< Object > value)
bool IsFastPropertyType() const
Isolate * isolate() const
bool IsInterceptor() const
int GetDictionaryEntry() const
NameDictionary * property_dictionary()
JSFunction * GetConstantFunction() const
int GetLocalFieldIndexFromMap(Map *map) const
static PropertyIndex NewHeaderIndex(int index)
int GetFieldIndexFromMap(Map *map) const
void HandlerResult(JSProxy *proxy)
PropertyIndex GetFieldIndex() const
void Init(Name *key, Object *value, PropertyDetails details)
PropertyDetails DetailsAt(int entry)
FieldDescriptor(Name *key, int field_index, PropertyAttributes attributes, Representation representation)
JSObject * holder() const
bool IsTransitionToConstant() const
static JSProxy * cast(Object *obj)
void Print(const v8::FunctionCallbackInfo< v8::Value > &args)
void InterceptorResult(JSObject *holder)
Object * GetCallbackObject() const
void DictionaryResult(JSObject *holder, int entry)
PropertyAttributes GetAttributes() const
static Representation None()
Map * GetTransitionTarget() const
static Representation Tagged()
Descriptor(Name *key, Object *value, PropertyAttributes attributes, PropertyType type, Representation representation, int field_index=0)
bool IsDontDelete() const
bool IsConstantFunction() const
static JSObject * cast(Object *obj)
bool IsTransition() const
bool IsTransitionToField() const
Object * GetConstantFromMap(Map *map) const
PropertyDetails GetDetails()
void TransitionResult(JSObject *holder, Map *target)
ConstantDescriptor(Name *key, Object *value, PropertyAttributes attributes)
static JSFunction * cast(Object *obj)