Cleaning up usage of lookup results.
- Ensure that IsFound() is only used when not in combination with other checks. To do so, the default type is NONEXISTENT rather than NORMAL; and NotFound() also resets the type to NONEXISTENT. - Use test methods rather than .type() == A_PROPERTY_TYPE. Review URL: https://chromiumcodereview.appspot.com/10626004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11899 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
3e0e042e4a
commit
1cff0c498e
@ -2579,7 +2579,7 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
|
|||||||
LookupResult lookup(isolate());
|
LookupResult lookup(isolate());
|
||||||
type->LookupInDescriptors(NULL, *name, &lookup);
|
type->LookupInDescriptors(NULL, *name, &lookup);
|
||||||
ASSERT(lookup.IsFound() || lookup.IsCacheable());
|
ASSERT(lookup.IsFound() || lookup.IsCacheable());
|
||||||
if (lookup.IsFound() && lookup.type() == FIELD) {
|
if (lookup.IsField()) {
|
||||||
int index = lookup.GetLocalFieldIndexFromMap(*type);
|
int index = lookup.GetLocalFieldIndexFromMap(*type);
|
||||||
int offset = index * kPointerSize;
|
int offset = index * kPointerSize;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
@ -2591,7 +2591,7 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
|
|||||||
__ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
|
__ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
|
||||||
__ ldr(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize));
|
__ ldr(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize));
|
||||||
}
|
}
|
||||||
} else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
|
} else if (lookup.IsConstantFunction()) {
|
||||||
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
||||||
__ LoadHeapObject(result, function);
|
__ LoadHeapObject(result, function);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1303,7 +1303,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
|
|||||||
// later.
|
// later.
|
||||||
bool compile_followup_inline = false;
|
bool compile_followup_inline = false;
|
||||||
if (lookup->IsFound() && lookup->IsCacheable()) {
|
if (lookup->IsFound() && lookup->IsCacheable()) {
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
compile_followup_inline = true;
|
compile_followup_inline = true;
|
||||||
} else if (lookup->type() == CALLBACKS &&
|
} else if (lookup->type() == CALLBACKS &&
|
||||||
lookup->GetCallbackObject()->IsAccessorInfo()) {
|
lookup->GetCallbackObject()->IsAccessorInfo()) {
|
||||||
@ -1377,7 +1377,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
|
|||||||
miss);
|
miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
// We found FIELD property in prototype chain of interceptor's holder.
|
// We found FIELD property in prototype chain of interceptor's holder.
|
||||||
// Retrieve a field from field's holder.
|
// Retrieve a field from field's holder.
|
||||||
GenerateFastPropertyLoad(masm(), r0, holder_reg,
|
GenerateFastPropertyLoad(masm(), r0, holder_reg,
|
||||||
|
@ -1080,11 +1080,11 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
LookupResult lookup(isolate);
|
LookupResult lookup(isolate);
|
||||||
result->LocalLookup(heap->callee_symbol(), &lookup);
|
result->LocalLookup(heap->callee_symbol(), &lookup);
|
||||||
ASSERT(lookup.IsFound() && (lookup.type() == FIELD));
|
ASSERT(lookup.IsField());
|
||||||
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsCalleeIndex);
|
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsCalleeIndex);
|
||||||
|
|
||||||
result->LocalLookup(heap->length_symbol(), &lookup);
|
result->LocalLookup(heap->length_symbol(), &lookup);
|
||||||
ASSERT(lookup.IsFound() && (lookup.type() == FIELD));
|
ASSERT(lookup.IsField());
|
||||||
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex);
|
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex);
|
||||||
|
|
||||||
ASSERT(result->map()->inobject_properties() > Heap::kArgumentsCalleeIndex);
|
ASSERT(result->map()->inobject_properties() > Heap::kArgumentsCalleeIndex);
|
||||||
@ -1178,7 +1178,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
LookupResult lookup(isolate);
|
LookupResult lookup(isolate);
|
||||||
result->LocalLookup(heap->length_symbol(), &lookup);
|
result->LocalLookup(heap->length_symbol(), &lookup);
|
||||||
ASSERT(lookup.IsFound() && (lookup.type() == FIELD));
|
ASSERT(lookup.IsField());
|
||||||
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex);
|
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex);
|
||||||
|
|
||||||
ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex);
|
ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex);
|
||||||
|
@ -4536,8 +4536,7 @@ HGraphBuilder::GlobalPropertyAccess HGraphBuilder::LookupGlobalProperty(
|
|||||||
}
|
}
|
||||||
Handle<GlobalObject> global(info()->global_object());
|
Handle<GlobalObject> global(info()->global_object());
|
||||||
global->Lookup(*var->name(), lookup);
|
global->Lookup(*var->name(), lookup);
|
||||||
if (!lookup->IsFound() ||
|
if (!lookup->IsNormal() ||
|
||||||
lookup->type() != NORMAL ||
|
|
||||||
(is_store && lookup->IsReadOnly()) ||
|
(is_store && lookup->IsReadOnly()) ||
|
||||||
lookup->holder() != *global) {
|
lookup->holder() != *global) {
|
||||||
return kUseGeneric;
|
return kUseGeneric;
|
||||||
@ -4916,9 +4915,8 @@ static bool ComputeLoadStoreField(Handle<Map> type,
|
|||||||
LookupResult* lookup,
|
LookupResult* lookup,
|
||||||
bool is_store) {
|
bool is_store) {
|
||||||
type->LookupInDescriptors(NULL, *name, lookup);
|
type->LookupInDescriptors(NULL, *name, lookup);
|
||||||
if (!lookup->IsFound()) return false;
|
if (lookup->IsField()) return true;
|
||||||
if (lookup->type() == FIELD) return true;
|
return is_store && lookup->IsMapTransition() &&
|
||||||
return is_store && (lookup->type() == MAP_TRANSITION) &&
|
|
||||||
(type->unused_property_fields() > 0);
|
(type->unused_property_fields() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4926,8 +4924,8 @@ static bool ComputeLoadStoreField(Handle<Map> type,
|
|||||||
static int ComputeLoadStoreFieldIndex(Handle<Map> type,
|
static int ComputeLoadStoreFieldIndex(Handle<Map> type,
|
||||||
Handle<String> name,
|
Handle<String> name,
|
||||||
LookupResult* lookup) {
|
LookupResult* lookup) {
|
||||||
ASSERT(lookup->type() == FIELD || lookup->type() == MAP_TRANSITION);
|
ASSERT(lookup->IsField() || lookup->type() == MAP_TRANSITION);
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
return lookup->GetLocalFieldIndexFromMap(*type);
|
return lookup->GetLocalFieldIndexFromMap(*type);
|
||||||
} else {
|
} else {
|
||||||
Map* transition = lookup->GetTransitionMapFromMap(*type);
|
Map* transition = lookup->GetTransitionMapFromMap(*type);
|
||||||
@ -5626,13 +5624,13 @@ HInstruction* HGraphBuilder::BuildLoadNamed(HValue* obj,
|
|||||||
Handle<String> name) {
|
Handle<String> name) {
|
||||||
LookupResult lookup(isolate());
|
LookupResult lookup(isolate());
|
||||||
map->LookupInDescriptors(NULL, *name, &lookup);
|
map->LookupInDescriptors(NULL, *name, &lookup);
|
||||||
if (lookup.IsFound() && lookup.type() == FIELD) {
|
if (lookup.IsField()) {
|
||||||
return BuildLoadNamedField(obj,
|
return BuildLoadNamedField(obj,
|
||||||
expr,
|
expr,
|
||||||
map,
|
map,
|
||||||
&lookup,
|
&lookup,
|
||||||
true);
|
true);
|
||||||
} else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
|
} else if (lookup.IsConstantFunction()) {
|
||||||
AddInstruction(new(zone()) HCheckNonSmi(obj));
|
AddInstruction(new(zone()) HCheckNonSmi(obj));
|
||||||
AddInstruction(HCheckMaps::NewWithTransitions(obj, map, zone()));
|
AddInstruction(HCheckMaps::NewWithTransitions(obj, map, zone()));
|
||||||
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map));
|
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map));
|
||||||
@ -8116,9 +8114,7 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
|||||||
Handle<GlobalObject> global(info()->global_object());
|
Handle<GlobalObject> global(info()->global_object());
|
||||||
LookupResult lookup(isolate());
|
LookupResult lookup(isolate());
|
||||||
global->Lookup(*name, &lookup);
|
global->Lookup(*name, &lookup);
|
||||||
if (lookup.IsFound() &&
|
if (lookup.IsNormal() && lookup.GetValue()->IsJSFunction()) {
|
||||||
lookup.type() == NORMAL &&
|
|
||||||
lookup.GetValue()->IsJSFunction()) {
|
|
||||||
Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue()));
|
Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue()));
|
||||||
// If the function is in new space we assume it's more likely to
|
// If the function is in new space we assume it's more likely to
|
||||||
// change and thus prefer the general IC code.
|
// change and thus prefer the general IC code.
|
||||||
|
@ -2412,7 +2412,7 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
|
|||||||
LookupResult lookup(isolate());
|
LookupResult lookup(isolate());
|
||||||
type->LookupInDescriptors(NULL, *name, &lookup);
|
type->LookupInDescriptors(NULL, *name, &lookup);
|
||||||
ASSERT(lookup.IsFound() || lookup.IsCacheable());
|
ASSERT(lookup.IsFound() || lookup.IsCacheable());
|
||||||
if (lookup.IsFound() && lookup.type() == FIELD) {
|
if (lookup.IsField()) {
|
||||||
int index = lookup.GetLocalFieldIndexFromMap(*type);
|
int index = lookup.GetLocalFieldIndexFromMap(*type);
|
||||||
int offset = index * kPointerSize;
|
int offset = index * kPointerSize;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
@ -2424,7 +2424,7 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
|
|||||||
__ mov(result, FieldOperand(object, JSObject::kPropertiesOffset));
|
__ mov(result, FieldOperand(object, JSObject::kPropertiesOffset));
|
||||||
__ mov(result, FieldOperand(result, offset + FixedArray::kHeaderSize));
|
__ mov(result, FieldOperand(result, offset + FixedArray::kHeaderSize));
|
||||||
}
|
}
|
||||||
} else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
|
} else if (lookup.IsConstantFunction()) {
|
||||||
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
||||||
__ LoadHeapObject(result, function);
|
__ LoadHeapObject(result, function);
|
||||||
} else {
|
} else {
|
||||||
@ -2469,8 +2469,7 @@ static bool CompactEmit(
|
|||||||
LookupResult lookup(isolate);
|
LookupResult lookup(isolate);
|
||||||
Handle<Map> map = list->at(i);
|
Handle<Map> map = list->at(i);
|
||||||
map->LookupInDescriptors(NULL, *name, &lookup);
|
map->LookupInDescriptors(NULL, *name, &lookup);
|
||||||
return lookup.IsFound() &&
|
return lookup.IsField() || lookup.IsConstantFunction();
|
||||||
(lookup.type() == FIELD || lookup.type() == CONSTANT_FUNCTION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1157,7 +1157,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
|
|||||||
// later.
|
// later.
|
||||||
bool compile_followup_inline = false;
|
bool compile_followup_inline = false;
|
||||||
if (lookup->IsFound() && lookup->IsCacheable()) {
|
if (lookup->IsFound() && lookup->IsCacheable()) {
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
compile_followup_inline = true;
|
compile_followup_inline = true;
|
||||||
} else if (lookup->type() == CALLBACKS &&
|
} else if (lookup->type() == CALLBACKS &&
|
||||||
lookup->GetCallbackObject()->IsAccessorInfo()) {
|
lookup->GetCallbackObject()->IsAccessorInfo()) {
|
||||||
@ -1242,7 +1242,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
|
|||||||
miss);
|
miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
// We found FIELD property in prototype chain of interceptor's holder.
|
// We found FIELD property in prototype chain of interceptor's holder.
|
||||||
// Retrieve a field from field's holder.
|
// Retrieve a field from field's holder.
|
||||||
GenerateFastPropertyLoad(masm(), eax, holder_reg,
|
GenerateFastPropertyLoad(masm(), eax, holder_reg,
|
||||||
|
21
src/ic.cc
21
src/ic.cc
@ -435,9 +435,7 @@ static void LookupForRead(Handle<Object> object,
|
|||||||
// Besides normal conditions (property not found or it's not
|
// Besides normal conditions (property not found or it's not
|
||||||
// an interceptor), bail out if lookup is not cacheable: we won't
|
// an interceptor), bail out if lookup is not cacheable: we won't
|
||||||
// be able to IC it anyway and regular lookup should work fine.
|
// be able to IC it anyway and regular lookup should work fine.
|
||||||
if (!lookup->IsFound()
|
if (!lookup->IsInterceptor() || !lookup->IsCacheable()) {
|
||||||
|| (lookup->type() != INTERCEPTOR)
|
|
||||||
|| !lookup->IsCacheable()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +446,7 @@ static void LookupForRead(Handle<Object> object,
|
|||||||
|
|
||||||
holder->LocalLookupRealNamedProperty(*name, lookup);
|
holder->LocalLookupRealNamedProperty(*name, lookup);
|
||||||
if (lookup->IsProperty()) {
|
if (lookup->IsProperty()) {
|
||||||
ASSERT(lookup->type() != INTERCEPTOR);
|
ASSERT(!lookup->IsInterceptor());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +552,7 @@ MaybeObject* CallICBase::LoadFunction(State state,
|
|||||||
Object::GetProperty(object, object, &lookup, name, &attr);
|
Object::GetProperty(object, object, &lookup, name, &attr);
|
||||||
RETURN_IF_EMPTY_HANDLE(isolate(), result);
|
RETURN_IF_EMPTY_HANDLE(isolate(), result);
|
||||||
|
|
||||||
if (lookup.type() == INTERCEPTOR && attr == ABSENT) {
|
if (lookup.IsInterceptor() && attr == ABSENT) {
|
||||||
// If the object does not have the requested property, check which
|
// If the object does not have the requested property, check which
|
||||||
// exception we need to throw.
|
// exception we need to throw.
|
||||||
return IsContextual(object)
|
return IsContextual(object)
|
||||||
@ -915,8 +913,7 @@ MaybeObject* LoadIC::Load(State state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PropertyAttributes attr;
|
PropertyAttributes attr;
|
||||||
if (lookup.IsFound() &&
|
if (lookup.IsInterceptor() || lookup.IsHandler()) {
|
||||||
(lookup.type() == INTERCEPTOR || lookup.type() == HANDLER)) {
|
|
||||||
// Get the property.
|
// Get the property.
|
||||||
Handle<Object> result =
|
Handle<Object> result =
|
||||||
Object::GetProperty(object, object, &lookup, name, &attr);
|
Object::GetProperty(object, object, &lookup, name, &attr);
|
||||||
@ -1177,7 +1174,7 @@ MaybeObject* KeyedLoadIC::Load(State state,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PropertyAttributes attr;
|
PropertyAttributes attr;
|
||||||
if (lookup.IsFound() && lookup.type() == INTERCEPTOR) {
|
if (lookup.IsInterceptor()) {
|
||||||
// Get the property.
|
// Get the property.
|
||||||
Handle<Object> result =
|
Handle<Object> result =
|
||||||
Object::GetProperty(object, object, &lookup, name, &attr);
|
Object::GetProperty(object, object, &lookup, name, &attr);
|
||||||
@ -1321,7 +1318,7 @@ static bool LookupForWrite(Handle<JSObject> receiver,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookup->type() == INTERCEPTOR &&
|
if (lookup->IsInterceptor() &&
|
||||||
receiver->GetNamedInterceptor()->setter()->IsUndefined()) {
|
receiver->GetNamedInterceptor()->setter()->IsUndefined()) {
|
||||||
receiver->LocalLookupRealNamedProperty(*name, lookup);
|
receiver->LocalLookupRealNamedProperty(*name, lookup);
|
||||||
return StoreICableLookup(lookup);
|
return StoreICableLookup(lookup);
|
||||||
@ -1438,7 +1435,7 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
|
|||||||
ASSERT(!receiver->IsJSGlobalProxy());
|
ASSERT(!receiver->IsJSGlobalProxy());
|
||||||
ASSERT(StoreICableLookup(lookup));
|
ASSERT(StoreICableLookup(lookup));
|
||||||
// These are not cacheable, so we never see such LookupResults here.
|
// These are not cacheable, so we never see such LookupResults here.
|
||||||
ASSERT(lookup->type() != HANDLER);
|
ASSERT(!lookup->IsHandler());
|
||||||
// We get only called for properties or transitions, see StoreICableLookup.
|
// We get only called for properties or transitions, see StoreICableLookup.
|
||||||
ASSERT(lookup->type() != NULL_DESCRIPTOR);
|
ASSERT(lookup->type() != NULL_DESCRIPTOR);
|
||||||
|
|
||||||
@ -1940,7 +1937,7 @@ void KeyedStoreIC::UpdateCaches(LookupResult* lookup,
|
|||||||
ASSERT(!receiver->IsJSGlobalProxy());
|
ASSERT(!receiver->IsJSGlobalProxy());
|
||||||
ASSERT(StoreICableLookup(lookup));
|
ASSERT(StoreICableLookup(lookup));
|
||||||
// These are not cacheable, so we never see such LookupResults here.
|
// These are not cacheable, so we never see such LookupResults here.
|
||||||
ASSERT(lookup->type() != HANDLER);
|
ASSERT(!lookup->IsHandler());
|
||||||
// We get only called for properties or transitions, see StoreICableLookup.
|
// We get only called for properties or transitions, see StoreICableLookup.
|
||||||
ASSERT(lookup->type() != NULL_DESCRIPTOR);
|
ASSERT(lookup->type() != NULL_DESCRIPTOR);
|
||||||
|
|
||||||
@ -2116,7 +2113,7 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
|
|||||||
// The length property has to be a writable callback property.
|
// The length property has to be a writable callback property.
|
||||||
LookupResult debug_lookup(isolate);
|
LookupResult debug_lookup(isolate);
|
||||||
receiver->LocalLookup(isolate->heap()->length_symbol(), &debug_lookup);
|
receiver->LocalLookup(isolate->heap()->length_symbol(), &debug_lookup);
|
||||||
ASSERT(debug_lookup.type() == CALLBACKS && !debug_lookup.IsReadOnly());
|
ASSERT(debug_lookup.IsCallbacks() && !debug_lookup.IsReadOnly());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Object* result;
|
Object* result;
|
||||||
|
@ -2323,7 +2323,7 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
|
|||||||
LookupResult lookup(isolate());
|
LookupResult lookup(isolate());
|
||||||
type->LookupInDescriptors(NULL, *name, &lookup);
|
type->LookupInDescriptors(NULL, *name, &lookup);
|
||||||
ASSERT(lookup.IsFound() || lookup.IsCacheable());
|
ASSERT(lookup.IsFound() || lookup.IsCacheable());
|
||||||
if (lookup.IsFound() && lookup.type() == FIELD) {
|
if (lookup.IsField()) {
|
||||||
int index = lookup.GetLocalFieldIndexFromMap(*type);
|
int index = lookup.GetLocalFieldIndexFromMap(*type);
|
||||||
int offset = index * kPointerSize;
|
int offset = index * kPointerSize;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
@ -2335,7 +2335,7 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
|
|||||||
__ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
|
__ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
|
||||||
__ lw(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize));
|
__ lw(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize));
|
||||||
}
|
}
|
||||||
} else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
|
} else if (lookup.IsConstantFunction()) {
|
||||||
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
||||||
__ LoadHeapObject(result, function);
|
__ LoadHeapObject(result, function);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1318,7 +1318,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
|
|||||||
// later.
|
// later.
|
||||||
bool compile_followup_inline = false;
|
bool compile_followup_inline = false;
|
||||||
if (lookup->IsFound() && lookup->IsCacheable()) {
|
if (lookup->IsFound() && lookup->IsCacheable()) {
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
compile_followup_inline = true;
|
compile_followup_inline = true;
|
||||||
} else if (lookup->type() == CALLBACKS &&
|
} else if (lookup->type() == CALLBACKS &&
|
||||||
lookup->GetCallbackObject()->IsAccessorInfo()) {
|
lookup->GetCallbackObject()->IsAccessorInfo()) {
|
||||||
@ -1391,7 +1391,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
|
|||||||
miss);
|
miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
// We found FIELD property in prototype chain of interceptor's holder.
|
// We found FIELD property in prototype chain of interceptor's holder.
|
||||||
// Retrieve a field from field's holder.
|
// Retrieve a field from field's holder.
|
||||||
GenerateFastPropertyLoad(masm(), v0, holder_reg,
|
GenerateFastPropertyLoad(masm(), v0, holder_reg,
|
||||||
|
@ -415,7 +415,10 @@ PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
case HANDLER:
|
||||||
|
case MAP_TRANSITION:
|
||||||
|
case CONSTANT_TRANSITION:
|
||||||
|
case NONEXISTENT:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2417,10 +2420,11 @@ void JSObject::LocalLookupRealNamedProperty(String* name,
|
|||||||
// We return all of these result types because
|
// We return all of these result types because
|
||||||
// LocalLookupRealNamedProperty is used when setting properties
|
// LocalLookupRealNamedProperty is used when setting properties
|
||||||
// where map transitions and null descriptors are handled.
|
// where map transitions and null descriptors are handled.
|
||||||
ASSERT(result->holder() == this && result->type() != NORMAL);
|
ASSERT(result->holder() == this && result->IsFastPropertyType());
|
||||||
// Disallow caching for uninitialized constants. These can only
|
// Disallow caching for uninitialized constants. These can only
|
||||||
// occur as fields.
|
// occur as fields.
|
||||||
if (result->IsReadOnly() && result->type() == FIELD &&
|
if (result->IsField() &&
|
||||||
|
result->IsReadOnly() &&
|
||||||
FastPropertyAt(result->GetFieldIndex())->IsTheHole()) {
|
FastPropertyAt(result->GetFieldIndex())->IsTheHole()) {
|
||||||
result->DisallowCaching();
|
result->DisallowCaching();
|
||||||
}
|
}
|
||||||
@ -2537,7 +2541,7 @@ MaybeObject* JSReceiver::SetProperty(LookupResult* result,
|
|||||||
PropertyAttributes attributes,
|
PropertyAttributes attributes,
|
||||||
StrictModeFlag strict_mode,
|
StrictModeFlag strict_mode,
|
||||||
JSReceiver::StoreFromKeyed store_mode) {
|
JSReceiver::StoreFromKeyed store_mode) {
|
||||||
if (result->IsFound() && result->type() == HANDLER) {
|
if (result->IsHandler()) {
|
||||||
return result->proxy()->SetPropertyWithHandler(
|
return result->proxy()->SetPropertyWithHandler(
|
||||||
this, key, value, attributes, strict_mode);
|
this, key, value, attributes, strict_mode);
|
||||||
} else {
|
} else {
|
||||||
@ -3908,7 +3912,7 @@ MaybeObject* JSObject::DeleteProperty(String* name, DeleteMode mode) {
|
|||||||
return isolate->heap()->false_value();
|
return isolate->heap()->false_value();
|
||||||
}
|
}
|
||||||
// Check for interceptor.
|
// Check for interceptor.
|
||||||
if (result.type() == INTERCEPTOR) {
|
if (result.IsInterceptor()) {
|
||||||
// Skip interceptor if forcing a deletion.
|
// Skip interceptor if forcing a deletion.
|
||||||
if (mode == FORCE_DELETION) {
|
if (mode == FORCE_DELETION) {
|
||||||
return DeletePropertyPostInterceptor(name, mode);
|
return DeletePropertyPostInterceptor(name, mode);
|
||||||
@ -4267,7 +4271,7 @@ void JSObject::LookupCallback(String* name, LookupResult* result) {
|
|||||||
current != heap->null_value() && current->IsJSObject();
|
current != heap->null_value() && current->IsJSObject();
|
||||||
current = JSObject::cast(current)->GetPrototype()) {
|
current = JSObject::cast(current)->GetPrototype()) {
|
||||||
JSObject::cast(current)->LocalLookupRealNamedProperty(name, result);
|
JSObject::cast(current)->LocalLookupRealNamedProperty(name, result);
|
||||||
if (result->IsFound() && result->type() == CALLBACKS) return;
|
if (result->IsCallbacks()) return;
|
||||||
}
|
}
|
||||||
result->NotFound();
|
result->NotFound();
|
||||||
}
|
}
|
||||||
@ -4370,7 +4374,7 @@ MaybeObject* JSObject::DefineElementAccessor(uint32_t index,
|
|||||||
MaybeObject* JSObject::CreateAccessorPairFor(String* name) {
|
MaybeObject* JSObject::CreateAccessorPairFor(String* name) {
|
||||||
LookupResult result(GetHeap()->isolate());
|
LookupResult result(GetHeap()->isolate());
|
||||||
LocalLookupRealNamedProperty(name, &result);
|
LocalLookupRealNamedProperty(name, &result);
|
||||||
if (result.IsProperty() && result.type() == CALLBACKS) {
|
if (result.IsProperty() && result.IsCallbacks()) {
|
||||||
// Note that the result can actually have IsDontDelete() == true when we
|
// Note that the result can actually have IsDontDelete() == true when we
|
||||||
// e.g. have to fall back to the slow case while adding a setter after
|
// e.g. have to fall back to the slow case while adding a setter after
|
||||||
// successfully reusing a map transition for a getter. Nevertheless, this is
|
// successfully reusing a map transition for a getter. Nevertheless, this is
|
||||||
@ -4840,7 +4844,7 @@ Object* JSObject::LookupAccessor(String* name, AccessorComponent component) {
|
|||||||
JSObject::cast(obj)->LocalLookup(name, &result);
|
JSObject::cast(obj)->LocalLookup(name, &result);
|
||||||
if (result.IsProperty()) {
|
if (result.IsProperty()) {
|
||||||
if (result.IsReadOnly()) return heap->undefined_value();
|
if (result.IsReadOnly()) return heap->undefined_value();
|
||||||
if (result.type() == CALLBACKS) {
|
if (result.IsCallbacks()) {
|
||||||
Object* obj = result.GetCallbackObject();
|
Object* obj = result.GetCallbackObject();
|
||||||
if (obj->IsAccessorPair()) {
|
if (obj->IsAccessorPair()) {
|
||||||
return AccessorPair::cast(obj)->GetComponent(component);
|
return AccessorPair::cast(obj)->GetComponent(component);
|
||||||
@ -7788,9 +7792,7 @@ bool SharedFunctionInfo::CanGenerateInlineConstructor(Object* prototype) {
|
|||||||
LookupResult result(heap->isolate());
|
LookupResult result(heap->isolate());
|
||||||
String* name = GetThisPropertyAssignmentName(i);
|
String* name = GetThisPropertyAssignmentName(i);
|
||||||
js_object->LocalLookupRealNamedProperty(name, &result);
|
js_object->LocalLookupRealNamedProperty(name, &result);
|
||||||
if (result.IsFound() && result.type() == CALLBACKS) {
|
if (result.IsCallbacks()) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10385,7 +10387,7 @@ bool JSObject::HasRealNamedProperty(String* key) {
|
|||||||
|
|
||||||
LookupResult result(isolate);
|
LookupResult result(isolate);
|
||||||
LocalLookupRealNamedProperty(key, &result);
|
LocalLookupRealNamedProperty(key, &result);
|
||||||
return result.IsProperty() && (result.type() != INTERCEPTOR);
|
return result.IsProperty() && !result.IsInterceptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -10465,7 +10467,7 @@ bool JSObject::HasRealNamedCallbackProperty(String* key) {
|
|||||||
|
|
||||||
LookupResult result(isolate);
|
LookupResult result(isolate);
|
||||||
LocalLookupRealNamedProperty(key, &result);
|
LocalLookupRealNamedProperty(key, &result);
|
||||||
return result.IsFound() && (result.type() == CALLBACKS);
|
return result.IsCallbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class LookupResult BASE_EMBEDDED {
|
|||||||
lookup_type_(NOT_FOUND),
|
lookup_type_(NOT_FOUND),
|
||||||
holder_(NULL),
|
holder_(NULL),
|
||||||
cacheable_(true),
|
cacheable_(true),
|
||||||
details_(NONE, NORMAL) {
|
details_(NONE, NONEXISTENT) {
|
||||||
isolate->SetTopLookupResult(this);
|
isolate->SetTopLookupResult(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +237,7 @@ class LookupResult BASE_EMBEDDED {
|
|||||||
|
|
||||||
void NotFound() {
|
void NotFound() {
|
||||||
lookup_type_ = NOT_FOUND;
|
lookup_type_ = NOT_FOUND;
|
||||||
|
details_ = PropertyDetails(NONE, NONEXISTENT);
|
||||||
holder_ = NULL;
|
holder_ = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,12 +265,47 @@ class LookupResult BASE_EMBEDDED {
|
|||||||
return details_;
|
return details_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsReadOnly() { return details_.IsReadOnly(); }
|
bool IsFastPropertyType() {
|
||||||
|
ASSERT(IsFound());
|
||||||
|
return type() != NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsReadOnly() {
|
||||||
|
ASSERT(IsFound());
|
||||||
|
return details_.IsReadOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsCallbacks() {
|
||||||
|
ASSERT(!(details_.type() == CALLBACKS && !IsFound()));
|
||||||
|
return details_.type() == CALLBACKS;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsField() {
|
||||||
|
ASSERT(!(details_.type() == FIELD && !IsFound()));
|
||||||
|
return details_.type() == FIELD;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsNormal() {
|
||||||
|
ASSERT(!(details_.type() == NORMAL && !IsFound()));
|
||||||
|
return details_.type() == NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsConstantFunction() {
|
||||||
|
ASSERT(!(details_.type() == CONSTANT_FUNCTION && !IsFound()));
|
||||||
|
return details_.type() == CONSTANT_FUNCTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsMapTransition() {
|
||||||
|
ASSERT(!(details_.type() == MAP_TRANSITION && !IsFound()));
|
||||||
|
return details_.type() == MAP_TRANSITION;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsDontDelete() { return details_.IsDontDelete(); }
|
bool IsDontDelete() { return details_.IsDontDelete(); }
|
||||||
bool IsDontEnum() { return details_.IsDontEnum(); }
|
bool IsDontEnum() { return details_.IsDontEnum(); }
|
||||||
bool IsDeleted() { return details_.IsDeleted(); }
|
bool IsDeleted() { return details_.IsDeleted(); }
|
||||||
bool IsFound() { return lookup_type_ != NOT_FOUND; }
|
bool IsFound() { return lookup_type_ != NOT_FOUND; }
|
||||||
bool IsHandler() { return lookup_type_ == HANDLER_TYPE; }
|
bool IsHandler() { return lookup_type_ == HANDLER_TYPE; }
|
||||||
|
bool IsInterceptor() { return lookup_type_ == INTERCEPTOR_TYPE; }
|
||||||
|
|
||||||
// Is the result is a property excluding transitions and the null descriptor?
|
// Is the result is a property excluding transitions and the null descriptor?
|
||||||
bool IsProperty() {
|
bool IsProperty() {
|
||||||
@ -298,7 +334,6 @@ class LookupResult BASE_EMBEDDED {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Map* GetTransitionMap() {
|
Map* GetTransitionMap() {
|
||||||
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
|
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
|
||||||
ASSERT(type() == MAP_TRANSITION ||
|
ASSERT(type() == MAP_TRANSITION ||
|
||||||
@ -314,13 +349,13 @@ class LookupResult BASE_EMBEDDED {
|
|||||||
|
|
||||||
int GetFieldIndex() {
|
int GetFieldIndex() {
|
||||||
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
|
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
|
||||||
ASSERT(type() == FIELD);
|
ASSERT(IsField());
|
||||||
return Descriptor::IndexFromValue(GetValue());
|
return Descriptor::IndexFromValue(GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetLocalFieldIndexFromMap(Map* map) {
|
int GetLocalFieldIndexFromMap(Map* map) {
|
||||||
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
|
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
|
||||||
ASSERT(type() == FIELD);
|
ASSERT(IsField());
|
||||||
return Descriptor::IndexFromValue(
|
return Descriptor::IndexFromValue(
|
||||||
map->instance_descriptors()->GetValue(number_)) -
|
map->instance_descriptors()->GetValue(number_)) -
|
||||||
map->inobject_properties();
|
map->inobject_properties();
|
||||||
|
@ -1115,7 +1115,7 @@ static MaybeObject* GetOwnProperty(Isolate* isolate,
|
|||||||
elms->set(ENUMERABLE_INDEX, heap->ToBoolean(!result.IsDontEnum()));
|
elms->set(ENUMERABLE_INDEX, heap->ToBoolean(!result.IsDontEnum()));
|
||||||
elms->set(CONFIGURABLE_INDEX, heap->ToBoolean(!result.IsDontDelete()));
|
elms->set(CONFIGURABLE_INDEX, heap->ToBoolean(!result.IsDontDelete()));
|
||||||
|
|
||||||
bool is_js_accessor = (result.type() == CALLBACKS) &&
|
bool is_js_accessor = result.IsCallbacks() &&
|
||||||
(result.GetCallbackObject()->IsAccessorPair());
|
(result.GetCallbackObject()->IsAccessorPair());
|
||||||
|
|
||||||
if (is_js_accessor) {
|
if (is_js_accessor) {
|
||||||
@ -1328,7 +1328,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
|
|||||||
if (lookup.IsProperty()) {
|
if (lookup.IsProperty()) {
|
||||||
// We found an existing property. Unless it was an interceptor
|
// We found an existing property. Unless it was an interceptor
|
||||||
// that claims the property is absent, skip this declaration.
|
// that claims the property is absent, skip this declaration.
|
||||||
if (lookup.type() != INTERCEPTOR) continue;
|
if (!lookup.IsInterceptor()) continue;
|
||||||
PropertyAttributes attributes = global->GetPropertyAttribute(*name);
|
PropertyAttributes attributes = global->GetPropertyAttribute(*name);
|
||||||
if (attributes != ABSENT) continue;
|
if (attributes != ABSENT) continue;
|
||||||
// Fall-through and introduce the absent property by using
|
// Fall-through and introduce the absent property by using
|
||||||
@ -1366,7 +1366,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
|
|||||||
// as required for function declarations.
|
// as required for function declarations.
|
||||||
if (lookup.IsProperty() && lookup.IsDontDelete()) {
|
if (lookup.IsProperty() && lookup.IsDontDelete()) {
|
||||||
if (lookup.IsReadOnly() || lookup.IsDontEnum() ||
|
if (lookup.IsReadOnly() || lookup.IsDontEnum() ||
|
||||||
lookup.type() == CALLBACKS) {
|
lookup.IsCallbacks()) {
|
||||||
return ThrowRedeclarationError(
|
return ThrowRedeclarationError(
|
||||||
isolate, is_function ? "function" : "module", name);
|
isolate, is_function ? "function" : "module", name);
|
||||||
}
|
}
|
||||||
@ -1475,7 +1475,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
|
|||||||
!object->IsJSContextExtensionObject()) {
|
!object->IsJSContextExtensionObject()) {
|
||||||
LookupResult lookup(isolate);
|
LookupResult lookup(isolate);
|
||||||
object->Lookup(*name, &lookup);
|
object->Lookup(*name, &lookup);
|
||||||
if (lookup.IsFound() && (lookup.type() == CALLBACKS)) {
|
if (lookup.IsCallbacks()) {
|
||||||
return ThrowRedeclarationError(isolate, "const", name);
|
return ThrowRedeclarationError(isolate, "const", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1528,7 +1528,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
|
|||||||
JSObject::cast(object)->map()->is_hidden_prototype()) {
|
JSObject::cast(object)->map()->is_hidden_prototype()) {
|
||||||
JSObject* raw_holder = JSObject::cast(object);
|
JSObject* raw_holder = JSObject::cast(object);
|
||||||
raw_holder->LocalLookup(*name, &lookup);
|
raw_holder->LocalLookup(*name, &lookup);
|
||||||
if (lookup.IsFound() && lookup.type() == INTERCEPTOR) {
|
if (lookup.IsInterceptor()) {
|
||||||
HandleScope handle_scope(isolate);
|
HandleScope handle_scope(isolate);
|
||||||
Handle<JSObject> holder(raw_holder);
|
Handle<JSObject> holder(raw_holder);
|
||||||
PropertyAttributes intercepted = holder->GetPropertyAttribute(*name);
|
PropertyAttributes intercepted = holder->GetPropertyAttribute(*name);
|
||||||
@ -1606,14 +1606,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
|
|||||||
// constant. For now, we determine this by checking if the
|
// constant. For now, we determine this by checking if the
|
||||||
// current value is the hole.
|
// current value is the hole.
|
||||||
// Strict mode handling not needed (const is disallowed in strict mode).
|
// Strict mode handling not needed (const is disallowed in strict mode).
|
||||||
PropertyType type = lookup.type();
|
if (lookup.IsField()) {
|
||||||
if (type == FIELD) {
|
|
||||||
FixedArray* properties = global->properties();
|
FixedArray* properties = global->properties();
|
||||||
int index = lookup.GetFieldIndex();
|
int index = lookup.GetFieldIndex();
|
||||||
if (properties->get(index)->IsTheHole() || !lookup.IsReadOnly()) {
|
if (properties->get(index)->IsTheHole() || !lookup.IsReadOnly()) {
|
||||||
properties->set(index, *value);
|
properties->set(index, *value);
|
||||||
}
|
}
|
||||||
} else if (type == NORMAL) {
|
} else if (lookup.IsNormal()) {
|
||||||
if (global->GetNormalizedProperty(&lookup)->IsTheHole() ||
|
if (global->GetNormalizedProperty(&lookup)->IsTheHole() ||
|
||||||
!lookup.IsReadOnly()) {
|
!lookup.IsReadOnly()) {
|
||||||
global->SetNormalizedProperty(&lookup, *value);
|
global->SetNormalizedProperty(&lookup, *value);
|
||||||
@ -1621,7 +1620,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
|
|||||||
} else {
|
} else {
|
||||||
// Ignore re-initialization of constants that have already been
|
// Ignore re-initialization of constants that have already been
|
||||||
// assigned a function value.
|
// assigned a function value.
|
||||||
ASSERT(lookup.IsReadOnly() && type == CONSTANT_FUNCTION);
|
ASSERT(lookup.IsReadOnly() && lookup.IsConstantFunction());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the set value as the result of the operation.
|
// Use the set value as the result of the operation.
|
||||||
@ -1697,14 +1696,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstContextSlot) {
|
|||||||
ASSERT(lookup.IsFound()); // the property was declared
|
ASSERT(lookup.IsFound()); // the property was declared
|
||||||
ASSERT(lookup.IsReadOnly()); // and it was declared as read-only
|
ASSERT(lookup.IsReadOnly()); // and it was declared as read-only
|
||||||
|
|
||||||
PropertyType type = lookup.type();
|
if (lookup.IsField()) {
|
||||||
if (type == FIELD) {
|
|
||||||
FixedArray* properties = object->properties();
|
FixedArray* properties = object->properties();
|
||||||
int index = lookup.GetFieldIndex();
|
int index = lookup.GetFieldIndex();
|
||||||
if (properties->get(index)->IsTheHole()) {
|
if (properties->get(index)->IsTheHole()) {
|
||||||
properties->set(index, *value);
|
properties->set(index, *value);
|
||||||
}
|
}
|
||||||
} else if (type == NORMAL) {
|
} else if (lookup.IsNormal()) {
|
||||||
if (object->GetNormalizedProperty(&lookup)->IsTheHole()) {
|
if (object->GetNormalizedProperty(&lookup)->IsTheHole()) {
|
||||||
object->SetNormalizedProperty(&lookup, *value);
|
object->SetNormalizedProperty(&lookup, *value);
|
||||||
}
|
}
|
||||||
@ -4373,7 +4371,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_KeyedGetProperty) {
|
|||||||
// appropriate.
|
// appropriate.
|
||||||
LookupResult result(isolate);
|
LookupResult result(isolate);
|
||||||
receiver->LocalLookup(key, &result);
|
receiver->LocalLookup(key, &result);
|
||||||
if (result.IsFound() && result.type() == FIELD) {
|
if (result.IsField()) {
|
||||||
int offset = result.GetFieldIndex();
|
int offset = result.GetFieldIndex();
|
||||||
keyed_lookup_cache->Update(receiver_map, key, offset);
|
keyed_lookup_cache->Update(receiver_map, key, offset);
|
||||||
return receiver->FastPropertyAt(offset);
|
return receiver->FastPropertyAt(offset);
|
||||||
@ -4485,7 +4483,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
|
|||||||
js_object->LocalLookupRealNamedProperty(*name, &result);
|
js_object->LocalLookupRealNamedProperty(*name, &result);
|
||||||
|
|
||||||
// Special case for callback properties.
|
// Special case for callback properties.
|
||||||
if (result.IsFound() && result.type() == CALLBACKS) {
|
if (result.IsCallbacks()) {
|
||||||
Object* callback = result.GetCallbackObject();
|
Object* callback = result.GetCallbackObject();
|
||||||
// To be compatible with Safari we do not change the value on API objects
|
// To be compatible with Safari we do not change the value on API objects
|
||||||
// in Object.defineProperty(). Firefox disagrees here, and actually changes
|
// in Object.defineProperty(). Firefox disagrees here, and actually changes
|
||||||
@ -4513,7 +4511,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
|
|||||||
// correctly in the case where a property is a field and is reset with
|
// correctly in the case where a property is a field and is reset with
|
||||||
// new attributes.
|
// new attributes.
|
||||||
if (result.IsProperty() &&
|
if (result.IsProperty() &&
|
||||||
(attr != result.GetAttributes() || result.type() == CALLBACKS)) {
|
(attr != result.GetAttributes() || result.IsCallbacks())) {
|
||||||
// New attributes - normalize to avoid writing to instance descriptor
|
// New attributes - normalize to avoid writing to instance descriptor
|
||||||
if (js_object->IsJSGlobalProxy()) {
|
if (js_object->IsJSGlobalProxy()) {
|
||||||
// Since the result is a property, the prototype will exist so
|
// Since the result is a property, the prototype will exist so
|
||||||
@ -10365,9 +10363,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPropertyDetails) {
|
|||||||
// LookupResult is not GC safe as it holds raw object pointers.
|
// LookupResult is not GC safe as it holds raw object pointers.
|
||||||
// GC can happen later in this code so put the required fields into
|
// GC can happen later in this code so put the required fields into
|
||||||
// local variables using handles when required for later use.
|
// local variables using handles when required for later use.
|
||||||
PropertyType result_type = result.type();
|
|
||||||
Handle<Object> result_callback_obj;
|
Handle<Object> result_callback_obj;
|
||||||
if (result_type == CALLBACKS) {
|
if (result.IsCallbacks()) {
|
||||||
result_callback_obj = Handle<Object>(result.GetCallbackObject(),
|
result_callback_obj = Handle<Object>(result.GetCallbackObject(),
|
||||||
isolate);
|
isolate);
|
||||||
}
|
}
|
||||||
@ -10385,7 +10382,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPropertyDetails) {
|
|||||||
|
|
||||||
// If the callback object is a fixed array then it contains JavaScript
|
// If the callback object is a fixed array then it contains JavaScript
|
||||||
// getter and/or setter.
|
// getter and/or setter.
|
||||||
bool hasJavaScriptAccessors = result_type == CALLBACKS &&
|
bool hasJavaScriptAccessors = result.IsCallbacks() &&
|
||||||
result_callback_obj->IsAccessorPair();
|
result_callback_obj->IsAccessorPair();
|
||||||
Handle<FixedArray> details =
|
Handle<FixedArray> details =
|
||||||
isolate->factory()->NewFixedArray(hasJavaScriptAccessors ? 5 : 2);
|
isolate->factory()->NewFixedArray(hasJavaScriptAccessors ? 5 : 2);
|
||||||
|
@ -2286,7 +2286,7 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
|
|||||||
LookupResult lookup(isolate());
|
LookupResult lookup(isolate());
|
||||||
type->LookupInDescriptors(NULL, *name, &lookup);
|
type->LookupInDescriptors(NULL, *name, &lookup);
|
||||||
ASSERT(lookup.IsFound() || lookup.IsCacheable());
|
ASSERT(lookup.IsFound() || lookup.IsCacheable());
|
||||||
if (lookup.IsFound() && lookup.type() == FIELD) {
|
if (lookup.IsField()) {
|
||||||
int index = lookup.GetLocalFieldIndexFromMap(*type);
|
int index = lookup.GetLocalFieldIndexFromMap(*type);
|
||||||
int offset = index * kPointerSize;
|
int offset = index * kPointerSize;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
@ -2298,7 +2298,7 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
|
|||||||
__ movq(result, FieldOperand(object, JSObject::kPropertiesOffset));
|
__ movq(result, FieldOperand(object, JSObject::kPropertiesOffset));
|
||||||
__ movq(result, FieldOperand(result, offset + FixedArray::kHeaderSize));
|
__ movq(result, FieldOperand(result, offset + FixedArray::kHeaderSize));
|
||||||
}
|
}
|
||||||
} else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
|
} else if (lookup.IsConstantFunction()) {
|
||||||
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
||||||
__ LoadHeapObject(result, function);
|
__ LoadHeapObject(result, function);
|
||||||
} else {
|
} else {
|
||||||
@ -2326,8 +2326,7 @@ static bool CompactEmit(
|
|||||||
LookupResult lookup(isolate);
|
LookupResult lookup(isolate);
|
||||||
Handle<Map> map = list->at(i);
|
Handle<Map> map = list->at(i);
|
||||||
map->LookupInDescriptors(NULL, *name, &lookup);
|
map->LookupInDescriptors(NULL, *name, &lookup);
|
||||||
return lookup.IsFound() &&
|
return lookup.IsField() || lookup.IsConstantFunction();
|
||||||
(lookup.type() == FIELD || lookup.type() == CONSTANT_FUNCTION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1143,7 +1143,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
|
|||||||
// later.
|
// later.
|
||||||
bool compile_followup_inline = false;
|
bool compile_followup_inline = false;
|
||||||
if (lookup->IsFound() && lookup->IsCacheable()) {
|
if (lookup->IsFound() && lookup->IsCacheable()) {
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
compile_followup_inline = true;
|
compile_followup_inline = true;
|
||||||
} else if (lookup->type() == CALLBACKS &&
|
} else if (lookup->type() == CALLBACKS &&
|
||||||
lookup->GetCallbackObject()->IsAccessorInfo()) {
|
lookup->GetCallbackObject()->IsAccessorInfo()) {
|
||||||
@ -1221,7 +1221,7 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
|
|||||||
miss);
|
miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookup->type() == FIELD) {
|
if (lookup->IsField()) {
|
||||||
// We found FIELD property in prototype chain of interceptor's holder.
|
// We found FIELD property in prototype chain of interceptor's holder.
|
||||||
// Retrieve a field from field's holder.
|
// Retrieve a field from field's holder.
|
||||||
GenerateFastPropertyLoad(masm(), rax, holder_reg,
|
GenerateFastPropertyLoad(masm(), rax, holder_reg,
|
||||||
|
Loading…
Reference in New Issue
Block a user