"src/fast-dtoa.cc",
"src/fast-dtoa.h",
"src/feedback-slots.h",
- "src/field-index.cc",
"src/field-index.h",
"src/field-index-inl.h",
"src/fixed-dtoa.cc",
JSObject::SetNormalizedProperty(to, key, callbacks, d);
break;
}
+ // Do not occur since the from object has fast properties.
case NORMAL:
- // Do not occur since the from object has fast properties.
- case HANDLER:
- case INTERCEPTOR:
- // No element in instance descriptors have proxy or interceptor type.
UNREACHABLE();
break;
}
}
+// static
+void LoadFastElementStub::InstallDescriptors(Isolate* isolate) {
+ LoadFastElementStub stub(isolate, true, FAST_ELEMENTS);
+ InstallDescriptor(isolate, &stub);
+}
+
+
ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
: PlatformCodeStub(isolate) {
minor_key_ = ArgumentCountBits::encode(ANY);
virtual Handle<Code> GenerateCode() V8_OVERRIDE;
+ static void InstallDescriptors(Isolate* isolate);
+
virtual void InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/v8.h"
-
-#include "src/field-index.h"
-#include "src/objects.h"
-#include "src/objects-inl.h"
-
-namespace v8 {
-namespace internal {
-
-
-FieldIndex FieldIndex::ForLookupResult(const LookupResult* lookup_result) {
- Map* map = lookup_result->holder()->map();
- return ForPropertyIndex(map,
- lookup_result->GetFieldIndexFromMap(map),
- lookup_result->representation().IsDouble());
-}
-
-
-} } // namespace v8::internal
int index,
bool is_double = false);
static FieldIndex ForInObjectOffset(int offset, Map* map = NULL);
- static FieldIndex ForLookupResult(const LookupResult* result);
static FieldIndex ForDescriptor(Map* map, int descriptor_index);
static FieldIndex ForLoadByFieldIndex(Map* map, int index);
static FieldIndex ForKeyedLookupCacheIndex(Map* map, int index);
descs->GetKey(i), descs->GetValue(i));
break;
case NORMAL: // only in slow mode
- case HANDLER: // only in lookup results, not in descriptors
- case INTERCEPTOR: // only in lookup results, not in descriptors
+ UNREACHABLE();
break;
}
}
PropertyAccessInfo* info,
HValue* checked_object) {
// See if this is a load for an immutable property
- if (checked_object->ActualValue()->IsConstant() && info->IsCacheable() &&
- info->IsReadOnly() && !info->IsConfigurable()) {
+ if (checked_object->ActualValue()->IsConstant() && info->IsReadOnly() &&
+ !info->IsConfigurable()) {
Handle<Object> object(
HConstant::cast(checked_object->ActualValue())->handle(isolate()));
bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) {
- if (!IsLoad() && IsProperty() && (IsReadOnly() || !IsCacheable())) {
+ if (!IsLoad() && IsProperty() && IsReadOnly()) {
return false;
}
return IsLoad();
}
if (!LookupDescriptor()) return false;
- if (IsFound()) {
- if (IsLoad()) return true;
- return !IsReadOnly() && IsCacheable();
- }
+ if (IsFound()) return IsLoad() || !IsReadOnly();
if (!LookupInPrototypes()) return false;
if (IsLoad()) return true;
bool IsConfigurable() const { return lookup_.IsConfigurable(); }
bool IsReadOnly() const { return lookup_.IsReadOnly(); }
- bool IsCacheable() const { return lookup_.IsCacheable(); }
private:
Handle<Object> GetAccessorsFromMap(Handle<Map> map) const {
RegExpConstructResultStub::InstallDescriptors(this);
KeyedLoadGenericStub::InstallDescriptors(this);
StoreFieldStub::InstallDescriptors(this);
+ LoadFastElementStub::InstallDescriptors(this);
}
CallDescriptors::InitializeForIsolate(this);
case v8::internal::CALLBACKS:
property_kind_ = ACCESSOR;
break;
- case v8::internal::HANDLER:
- case v8::internal::INTERCEPTOR:
- UNREACHABLE();
}
}
PropertyType.Field = 1;
PropertyType.Constant = 2;
PropertyType.Callbacks = 3;
-PropertyType.Handler = 4;
-PropertyType.Interceptor = 5;
// Different attributes for a property.
this.name_ = name;
this.value_ = details[0];
this.details_ = details[1];
- if (details.length > 2) {
- this.exception_ = details[2];
- this.getter_ = details[3];
- this.setter_ = details[4];
+ this.is_interceptor_ = details[2];
+ if (details.length > 3) {
+ this.exception_ = details[3];
+ this.getter_ = details[4];
+ this.setter_ = details[5];
}
}
inherits(PropertyMirror, Mirror);
* UndefinedMirror if there is no setter for this property
*/
PropertyMirror.prototype.isNative = function() {
- return (this.propertyType() == PropertyType.Interceptor) ||
+ return this.is_interceptor_ ||
((this.propertyType() == PropertyType.Callbacks) &&
!this.hasGetter() && !this.hasSetter());
};
os << Brief(descs->GetCallbacksObject(i)) << " (callback)\n";
break;
case NORMAL: // only in slow mode
- case HANDLER: // only in lookup results, not in descriptors
- case INTERCEPTOR: // only in lookup results, not in descriptors
UNREACHABLE();
break;
}
break;
// Values below are never in the target descriptor array.
case NORMAL:
- case HANDLER:
- case INTERCEPTOR:
UNREACHABLE();
break;
}
break;
// Values below are never in the target descriptor array.
case NORMAL:
- case HANDLER:
- case INTERCEPTOR:
UNREACHABLE();
break;
}
break;
case NORMAL:
- case HANDLER:
- case INTERCEPTOR:
UNREACHABLE();
}
}
dictionary = NameDictionary::Add(dictionary, key, value, d);
break;
}
- case INTERCEPTOR:
- break;
- case HANDLER:
case NORMAL:
UNREACHABLE();
break;
return false;
case NORMAL:
- case INTERCEPTOR:
- case HANDLER:
+ UNREACHABLE();
break;
}
// Only in fast mode.
FIELD = 1,
CONSTANT = 2,
- CALLBACKS = 3,
- // Only in lookup results, not in descriptors.
- HANDLER = 4,
- INTERCEPTOR = 5
+ CALLBACKS = 3
};
// Bit fields in value_ (type, shift, size). Must be public so the
// constants can be embedded in generated code.
- class TypeField: public BitField<PropertyType, 0, 3> {};
- class AttributesField: public BitField<PropertyAttributes, 3, 3> {};
+ class TypeField : public BitField<PropertyType, 0, 2> {};
+ class AttributesField : public BitField<PropertyAttributes, 2, 3> {};
// Bit fields for normalized objects.
- class DeletedField: public BitField<uint32_t, 6, 1> {};
- class DictionaryStorageField: public BitField<uint32_t, 7, 24> {};
+ class DeletedField : public BitField<uint32_t, 5, 1> {};
+ class DictionaryStorageField : public BitField<uint32_t, 6, 24> {};
// Bit fields for fast objects.
- class RepresentationField: public BitField<uint32_t, 6, 4> {};
- class DescriptorPointer: public BitField<uint32_t, 10,
- kDescriptorIndexBitCount> {}; // NOLINT
- class FieldIndexField: public BitField<uint32_t,
- 10 + kDescriptorIndexBitCount,
- kDescriptorIndexBitCount> {}; // NOLINT
+ class RepresentationField : public BitField<uint32_t, 5, 4> {};
+ class DescriptorPointer
+ : public BitField<uint32_t, 9, kDescriptorIndexBitCount> {}; // NOLINT
+ class FieldIndexField
+ : public BitField<uint32_t, 9 + kDescriptorIndexBitCount,
+ kDescriptorIndexBitCount> {}; // NOLINT
// All bits for fast objects must fix in a smi.
- STATIC_ASSERT(10 + kDescriptorIndexBitCount + kDescriptorIndexBitCount <= 31);
+ STATIC_ASSERT(9 + kDescriptorIndexBitCount + kDescriptorIndexBitCount <= 31);
static const int kInitialIndex = 1;
if (!r.IsFound()) return os << "Not Found\n";
os << "LookupResult:\n";
- os << " -cacheable = " << (r.IsCacheable() ? "true" : "false") << "\n";
- os << " -attributes = " << hex << r.GetAttributes() << dec << "\n";
if (r.IsTransition()) {
os << " -transition target:\n" << Brief(r.GetTransitionTarget()) << "\n";
}
- switch (r.type()) {
- case NORMAL:
- return os << " -type = normal\n"
- << " -entry = " << r.GetDictionaryEntry() << "\n";
- case CONSTANT:
- return os << " -type = constant\n";
- case FIELD:
- os << " -type = field\n"
- << " -index = " << r.GetFieldIndex().property_index() << "\n"
- << " -field type:";
- r.GetFieldType()->PrintTo(os);
- return os << "\n";
- case CALLBACKS:
- return os << " -type = call backs\n";
- case HANDLER:
- return os << " -type = lookup proxy\n";
- case INTERCEPTOR:
- return os << " -type = lookup interceptor\n";
- }
return os;
}
lookup_type_(NOT_FOUND),
holder_(NULL),
transition_(NULL),
- cacheable_(true),
details_(NONE, NORMAL, Representation::None()) {
isolate->set_top_lookup_result(this);
}
number_ = number;
}
- bool CanHoldValue(Handle<Object> value) const {
- switch (type()) {
- case NORMAL:
- return true;
- case FIELD:
- return value->FitsRepresentation(representation()) &&
- GetFieldType()->NowContains(value);
- case CONSTANT: {
- Map* map =
- lookup_type_ == DESCRIPTOR_TYPE ? holder_->map() : transition_;
- Object* constant = GetConstantFromMap(map);
- DCHECK(constant != *value ||
- value->FitsRepresentation(representation()));
- return constant == *value;
- }
- case CALLBACKS:
- case HANDLER:
- case INTERCEPTOR:
- return true;
- }
- UNREACHABLE();
- return true;
- }
-
void TransitionResult(JSObject* holder, Map* target) {
lookup_type_ = TRANSITION_TYPE;
number_ = target->LastAdded();
transition_ = target;
}
- void DictionaryResult(JSObject* holder, int entry) {
- lookup_type_ = DICTIONARY_TYPE;
- holder_ = holder;
- transition_ = NULL;
- details_ = holder->property_dictionary()->DetailsAt(entry);
- number_ = entry;
- }
-
- void HandlerResult(JSProxy* proxy) {
- lookup_type_ = HANDLER_TYPE;
- holder_ = proxy;
- transition_ = NULL;
- details_ = PropertyDetails(NONE, HANDLER, Representation::Tagged());
- cacheable_ = false;
- }
-
- void InterceptorResult(JSObject* holder) {
- lookup_type_ = INTERCEPTOR_TYPE;
- holder_ = holder;
- transition_ = NULL;
- details_ = PropertyDetails(NONE, INTERCEPTOR, Representation::Tagged());
- }
-
void NotFound() {
lookup_type_ = NOT_FOUND;
details_ = PropertyDetails(NONE, NORMAL, Representation::None());
transition_ = NULL;
}
- JSObject* holder() const {
- DCHECK(IsFound());
- return JSObject::cast(holder_);
- }
-
- JSProxy* proxy() const {
- DCHECK(IsHandler());
- return JSProxy::cast(holder_);
- }
-
- PropertyType type() const {
- DCHECK(IsFound());
- return details_.type();
- }
-
Representation representation() const {
DCHECK(IsFound());
return details_.representation();
}
- PropertyAttributes GetAttributes() const {
- DCHECK(IsFound());
- return details_.attributes();
- }
-
- PropertyDetails GetPropertyDetails() const {
- return details_;
- }
-
- bool IsFastPropertyType() const {
- DCHECK(IsFound());
- return IsTransition() || type() != NORMAL;
- }
-
// Property callbacks does not include transitions to callbacks.
bool IsPropertyCallbacks() const {
DCHECK(!(details_.type() == CALLBACKS && !IsFound()));
bool IsField() const {
DCHECK(!(details_.type() == FIELD && !IsFound()));
- return IsDescriptorOrDictionary() && type() == FIELD;
- }
-
- bool IsNormal() const {
- return IsFound() && IsDescriptorOrDictionary() && type() == NORMAL;
+ return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == FIELD;
}
bool IsConstant() const {
DCHECK(!(details_.type() == CONSTANT && !IsFound()));
- return IsDescriptorOrDictionary() && type() == CONSTANT;
+ return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == CONSTANT;
}
bool IsConfigurable() const { return details_.IsConfigurable(); }
- bool IsDontEnum() const { return details_.IsDontEnum(); }
bool IsFound() const { return lookup_type_ != NOT_FOUND; }
- bool IsDescriptorOrDictionary() const {
- return lookup_type_ == DESCRIPTOR_TYPE || lookup_type_ == DICTIONARY_TYPE;
- }
bool IsTransition() const { return lookup_type_ == TRANSITION_TYPE; }
- bool IsHandler() const { return lookup_type_ == HANDLER_TYPE; }
- bool IsInterceptor() const { return lookup_type_ == INTERCEPTOR_TYPE; }
// Is the result is a property excluding transitions and the null descriptor?
bool IsProperty() const {
return IsFound() && !IsTransition();
}
- bool IsCacheable() const { return cacheable_; }
- void DisallowCaching() { cacheable_ = false; }
-
Map* GetTransitionTarget() const {
DCHECK(IsTransition());
return transition_;
return IsTransition() && details_.type() == FIELD;
}
- bool IsTransitionToConstant() const {
- return IsTransition() && details_.type() == CONSTANT;
- }
-
- int GetDescriptorIndex() const {
- DCHECK(lookup_type_ == DESCRIPTOR_TYPE);
- return number_;
- }
-
- FieldIndex GetFieldIndex() const {
- DCHECK(lookup_type_ == DESCRIPTOR_TYPE ||
- lookup_type_ == TRANSITION_TYPE);
- return FieldIndex::ForLookupResult(this);
- }
-
int GetLocalFieldIndexFromMap(Map* map) const {
return GetFieldIndexFromMap(map) - map->inobject_properties();
}
- int GetDictionaryEntry() const {
- DCHECK(lookup_type_ == DICTIONARY_TYPE);
- return number_;
- }
-
Object* GetConstantFromMap(Map* map) const {
- DCHECK(type() == CONSTANT);
+ DCHECK(details_.type() == CONSTANT);
return GetValueFromMap(map);
}
return map->instance_descriptors()->GetFieldIndex(number_);
}
- HeapType* GetFieldType() const {
- DCHECK(type() == FIELD);
- if (lookup_type_ == DESCRIPTOR_TYPE) {
- return GetFieldTypeFromMap(holder()->map());
- }
- DCHECK(lookup_type_ == TRANSITION_TYPE);
- return GetFieldTypeFromMap(transition_);
- }
-
HeapType* GetFieldTypeFromMap(Map* map) const {
- DCHECK(lookup_type_ == DESCRIPTOR_TYPE ||
- lookup_type_ == TRANSITION_TYPE);
+ DCHECK_NE(NOT_FOUND, lookup_type_);
DCHECK(number_ < map->NumberOfOwnDescriptors());
return map->instance_descriptors()->GetFieldType(number_);
}
- Map* GetFieldOwner() const {
- return GetFieldOwnerFromMap(holder()->map());
- }
-
Map* GetFieldOwnerFromMap(Map* map) const {
DCHECK(lookup_type_ == DESCRIPTOR_TYPE ||
lookup_type_ == TRANSITION_TYPE);
return map->FindFieldOwner(number_);
}
- bool ReceiverIsHolder(Handle<Object> receiver) {
- if (*receiver == holder()) return true;
- if (lookup_type_ == TRANSITION_TYPE) return true;
- return false;
- }
-
void Iterate(ObjectVisitor* visitor);
private:
LookupResult* next_;
// Where did we find the result;
- enum {
- NOT_FOUND,
- DESCRIPTOR_TYPE,
- TRANSITION_TYPE,
- DICTIONARY_TYPE,
- HANDLER_TYPE,
- INTERCEPTOR_TYPE
- } lookup_type_;
+ enum { NOT_FOUND, DESCRIPTOR_TYPE, TRANSITION_TYPE } lookup_type_;
JSReceiver* holder_;
Map* transition_;
int number_;
- bool cacheable_;
PropertyDetails details_;
};
// getter and/or setter.
bool has_js_accessors = !maybe_pair.is_null() && maybe_pair->IsAccessorPair();
Handle<FixedArray> details =
- isolate->factory()->NewFixedArray(has_js_accessors ? 5 : 2);
+ isolate->factory()->NewFixedArray(has_js_accessors ? 6 : 3);
details->set(0, *value);
// TODO(verwaest): Get rid of this random way of handling interceptors.
PropertyDetails d = it.state() == LookupIterator::INTERCEPTOR
- ? PropertyDetails(NONE, INTERCEPTOR, 0)
+ ? PropertyDetails(NONE, NORMAL, 0)
: it.property_details();
details->set(1, d.AsSmi());
+ details->set(
+ 2, isolate->heap()->ToBoolean(it.state() == LookupIterator::INTERCEPTOR));
if (has_js_accessors) {
AccessorPair* accessors = AccessorPair::cast(*maybe_pair);
- details->set(2, isolate->heap()->ToBoolean(has_caught));
- details->set(3, accessors->GetComponent(ACCESSOR_GETTER));
- details->set(4, accessors->GetComponent(ACCESSOR_SETTER));
+ details->set(3, isolate->heap()->ToBoolean(has_caught));
+ details->set(4, accessors->GetComponent(ACCESSOR_GETTER));
+ details->set(5, accessors->GetComponent(ACCESSOR_SETTER));
}
return *isolate->factory()->NewJSArrayWithElements(details);
"named_values[%d] instanceof debug.PropertyMirror", i);
CHECK(CompileRun(buffer.start())->BooleanValue());
- SNPrintF(buffer, "named_values[%d].propertyType()", i);
- CHECK_EQ(v8::internal::INTERCEPTOR,
- CompileRun(buffer.start())->Int32Value());
-
SNPrintF(buffer, "named_values[%d].isNative()", i);
CHECK(CompileRun(buffer.start())->BooleanValue());
}
'../../src/fast-dtoa.cc',
'../../src/fast-dtoa.h',
'../../src/feedback-slots.h',
- '../../src/field-index.cc',
'../../src/field-index.h',
'../../src/field-index-inl.h',
'../../src/fixed-dtoa.cc',