Reviewers: danno,
Description:
Replaced LookupResult::IsProperty by LookupResult::IsFound where possible.
Yak shaving for map sharing with accessor properties contd.: When CALLBACKS
can
have map transitions, simply looking at the property type is not sufficient
anymore to decide if a property is there or not. One has to look at the
actual
contents of the descriptor entry then, but this breaks down sometimes when
the
lookup is being done with a NULL holder. Luckily enough, we can oftren
replace
IsProperty by the simpler IsFound, because we inspect the type immediately
afterwards, anyway.
Please review this at https://chromiumcodereview.appspot.com/9280007/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/lithium-codegen-arm.cc
M src/arm/stub-cache-arm.cc
M src/ast.cc
M src/bootstrapper.cc
M src/hydrogen-instructions.cc
M src/hydrogen.cc
M src/ia32/lithium-codegen-ia32.cc
M src/ia32/stub-cache-ia32.cc
M src/ic.cc
M src/mips/lithium-codegen-mips.cc
M src/mips/stub-cache-mips.cc
M src/objects.cc
M src/runtime.cc
M src/stub-cache.cc
M src/x64/lithium-codegen-x64.cc
M src/x64/stub-cache-x64.cc
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index
0e050fea1d589da2e17769d37b4028447f51cb8d..080785725fb09cc8ddb1cd9fa17b3249841be48f
100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -2387,7 +2387,7 @@ void
LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
Handle<String> name) {
LookupResult lookup(isolate());
type->LookupInDescriptors(NULL, *name, &lookup);
- ASSERT(lookup.IsProperty() &&
+ ASSERT(lookup.IsFound() &&
(lookup.type() == FIELD || lookup.type() == CONSTANT_FUNCTION));
if (lookup.type() == FIELD) {
int index = lookup.GetLocalFieldIndexFromMap(*type);
Index: src/arm/stub-cache-arm.cc
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc
index
cf2d4e2064f8fade86711ac58a78bcd6f0b59b2e..33fbee52d6c4db01f962f7c0030e58b1a44d06c8
100644
--- a/src/arm/stub-cache-arm.cc
+++ b/src/arm/stub-cache-arm.cc
@@ -1179,7 +1179,7 @@ void
StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
// and CALLBACKS, so inline only them, other cases may be added
// later.
bool compile_followup_inline = false;
- if (lookup->IsProperty() && lookup->IsCacheable()) {
+ if (lookup->IsFound() && lookup->IsCacheable()) {
if (lookup->type() == FIELD) {
compile_followup_inline = true;
} else if (lookup->type() == CALLBACKS &&
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index
7c5e3a79635fbedaedea66a6e4c1e9a79106bd28..580a4850781758991a9d2d8fce0c27f185ce1dea
100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -746,7 +746,7 @@ bool Call::ComputeTarget(Handle<Map> type,
Handle<String> name) {
&& type->prototype()->IsJSObject()) {
holder_ = Handle<JSObject>(JSObject::cast(type->prototype()));
type = Handle<Map>(holder()->map());
- } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) {
+ } else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
target_ =
Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type));
return true;
} else {
@@ -760,7 +760,7 @@ bool Call::ComputeGlobalTarget(Handle<GlobalObject>
global,
LookupResult* lookup) {
target_ = Handle<JSFunction>::null();
cell_ = Handle<JSGlobalPropertyCell>::null();
- ASSERT(lookup->IsProperty() &&
+ ASSERT(lookup->IsFound() &&
lookup->type() == NORMAL &&
lookup->holder() == *global);
cell_ = Handle<JSGlobalPropertyCell>(global->GetPropertyCell(lookup));
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index
752b220e5b56742978049a70544877622bb15266..cedb0efd00127bf54461832b2b706de4db675d0c
100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1099,11 +1099,11 @@ void Genesis::InitializeGlobal(Handle<GlobalObject>
inner_global,
#ifdef DEBUG
LookupResult lookup(isolate);
result->LocalLookup(heap->callee_symbol(), &lookup);
- ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
+ ASSERT(lookup.IsFound() && (lookup.type() == FIELD));
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsCalleeIndex);
result->LocalLookup(heap->length_symbol(), &lookup);
- ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
+ ASSERT(lookup.IsFound() && (lookup.type() == FIELD));
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex);
ASSERT(result->map()->inobject_properties() >
Heap::kArgumentsCalleeIndex);
@@ -1197,7 +1197,7 @@ void Genesis::InitializeGlobal(Handle<GlobalObject>
inner_global,
#ifdef DEBUG
LookupResult lookup(isolate);
result->LocalLookup(heap->length_symbol(), &lookup);
- ASSERT(lookup.IsProperty() && (lookup.type() == FIELD));
+ ASSERT(lookup.IsFound() && (lookup.type() == FIELD));
ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex);
ASSERT(result->map()->inobject_properties() >
Heap::kArgumentsLengthIndex);
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index
ee45ae5105a8bb5185ca1d765d13ab595a64b81e..2d32ad1fed8a67e6e3a2b6821eff8293cb6b4aa5
100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -1415,7 +1415,7 @@
HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context,
Handle<Map> map = types->at(i);
LookupResult lookup(map->GetIsolate());
map->LookupInDescriptors(NULL, *name, &lookup);
- if (lookup.IsProperty()) {
+ if (lookup.IsFound()) {
switch (lookup.type()) {
case FIELD: {
int index = lookup.GetLocalFieldIndexFromMap(*map);
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
4cfd45f53fd785ce29f841d39a4e4abbb7753e18..1a63f1e7aaa7fe9c12b6033a4149659375c43de9
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -3207,7 +3207,7 @@ HGraphBuilder::GlobalPropertyAccess
HGraphBuilder::LookupGlobalProperty(
}
Handle<GlobalObject> global(info()->global_object());
global->Lookup(*var->name(), lookup);
- if (!lookup->IsProperty() ||
+ if (!lookup->IsFound() ||
lookup->type() != NORMAL ||
(is_store && lookup->IsReadOnly()) ||
lookup->holder() != *global) {
@@ -4159,13 +4159,13 @@ HInstruction* HGraphBuilder::BuildLoadNamed(HValue*
obj,
Handle<String> name) {
LookupResult lookup(isolate());
map->LookupInDescriptors(NULL, *name, &lookup);
- if (lookup.IsProperty() && lookup.type() == FIELD) {
+ if (lookup.IsFound() && lookup.type() == FIELD) {
return BuildLoadNamedField(obj,
expr,
map,
&lookup,
true);
- } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) {
+ } else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) {
AddInstruction(new(zone()) HCheckNonSmi(obj));
AddInstruction(new(zone()) HCheckMap(obj, map, NULL,
ALLOW_ELEMENT_TRANSITION_MAPS));
@@ -6253,7 +6253,7 @@ void
HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
Handle<GlobalObject> global(info()->global_object());
LookupResult lookup(isolate());
global->Lookup(*name, &lookup);
- if (lookup.IsProperty() &&
+ if (lookup.IsFound() &&
lookup.type() == NORMAL &&
lookup.GetValue()->IsJSFunction()) {
Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue()));
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc
b/src/ia32/lithium-codegen-ia32.cc
index
a5c96b01fabd527c94689afd677d0247718e7ec4..976b23448df38cc2b902e6222db918263764ebde
100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -2216,7 +2216,7 @@ void
LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
Handle<String> name) {
LookupResult lookup(isolate());
type->LookupInDescriptors(NULL, *name, &lookup);
- ASSERT(lookup.IsProperty() &&
+ ASSERT(lookup.IsFound() &&
(lookup.type() == FIELD || lookup.type() == CONSTANT_FUNCTION));
if (lookup.type() == FIELD) {
int index = lookup.GetLocalFieldIndexFromMap(*type);
Index: src/ia32/stub-cache-ia32.cc
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
index
0adb10173ed89fb2166228c30900a23726e48ed0..f6f424176b5dffa1f91e8143a4f12a91483b86b2
100644
--- a/src/ia32/stub-cache-ia32.cc
+++ b/src/ia32/stub-cache-ia32.cc
@@ -1053,7 +1053,7 @@ void
StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
// and CALLBACKS, so inline only them, other cases may be added
// later.
bool compile_followup_inline = false;
- if (lookup->IsProperty() && lookup->IsCacheable()) {
+ if (lookup->IsFound() && lookup->IsCacheable()) {
if (lookup->type() == FIELD) {
compile_followup_inline = true;
} else if (lookup->type() == CALLBACKS &&
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index
eb845347c4b0e76e3ff12ffb9a1d5fe0c20e6cdd..b084109a713aa572bb79acdfb7f1155d8a9ba9f8
100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -860,7 +860,7 @@ MaybeObject* LoadIC::Load(State state,
}
PropertyAttributes attr;
- if (lookup.IsProperty() &&
+ if (lookup.IsFound() &&
(lookup.type() == INTERCEPTOR || lookup.type() == HANDLER)) {
// Get the property.
Handle<Object> result =
@@ -1083,7 +1083,7 @@ MaybeObject* KeyedLoadIC::Load(State state,
}
PropertyAttributes attr;
- if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) {
+ if (lookup.IsFound() && lookup.type() == INTERCEPTOR) {
// Get the property.
Handle<Object> result =
Object::GetProperty(object, object, &lookup, name, &attr);
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
34883f71fcc5dc221747f4eb7654bfa1a45c5632..7a230c1fac6d71c1924c989b4afe7383644e1612
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -2269,7 +2269,7 @@ void
LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
Handle<String> name) {
LookupResult lookup(isolate());
type->LookupInDescriptors(NULL, *name, &lookup);
- ASSERT(lookup.IsProperty() &&
+ ASSERT(lookup.IsFound() &&
(lookup.type() == FIELD || lookup.type() == CONSTANT_FUNCTION));
if (lookup.type() == FIELD) {
int index = lookup.GetLocalFieldIndexFromMap(*type);
Index: src/mips/stub-cache-mips.cc
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc
index
90c5130766fd1f3693ed10620b13fb848adcfa7a..0051edfb6c65f95e35de6f8d0fa93d791ad17db4
100644
--- a/src/mips/stub-cache-mips.cc
+++ b/src/mips/stub-cache-mips.cc
@@ -1204,7 +1204,7 @@ void
StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
// and CALLBACKS, so inline only them, other cases may be added
// later.
bool compile_followup_inline = false;
- if (lookup->IsProperty() && lookup->IsCacheable()) {
+ if (lookup->IsFound() && lookup->IsCacheable()) {
if (lookup->type() == FIELD) {
compile_followup_inline = true;
} else if (lookup->type() == CALLBACKS &&
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
0941e792f04e98f3391c5a8757da74902d74e21e..e9af0d8e35ca24a58ef166d23ce7c5048e833290
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4353,7 +4353,7 @@ void JSObject::LookupCallback(String* name,
LookupResult* result) {
current != heap->null_value() && current->IsJSObject();
current = JSObject::cast(current)->GetPrototype()) {
JSObject::cast(current)->LocalLookupRealNamedProperty(name, result);
- if (result->IsProperty() && result->type() == CALLBACKS) return;
+ if (result->IsFound() && result->type() == CALLBACKS) return;
}
result->NotFound();
}
@@ -4457,7 +4457,7 @@ MaybeObject* JSObject::DefineGetterSetter(String*
name,
// Lookup the name.
LookupResult result(heap->isolate());
LocalLookupRealNamedProperty(name, &result);
- if (result.IsProperty()) {
+ if (result.IsFound()) {
// TODO(mstarzinger): We should check for result.IsDontDelete() here
once
// we only call into the runtime once to set both getter and setter.
if (result.type() == CALLBACKS) {
@@ -7472,7 +7472,7 @@ bool
SharedFunctionInfo::CanGenerateInlineConstructor(Object* prototype) {
LookupResult result(heap->isolate());
String* name = GetThisPropertyAssignmentName(i);
js_object->LocalLookupRealNamedProperty(name, &result);
- if (result.IsProperty() && result.type() == CALLBACKS) {
+ if (result.IsFound() && result.type() == CALLBACKS) {
return false;
}
}
@@ -10146,7 +10146,7 @@ bool JSObject::HasRealNamedCallbackProperty(String*
key) {
LookupResult result(isolate);
LocalLookupRealNamedProperty(key, &result);
- return result.IsProperty() && (result.type() == CALLBACKS);
+ return result.IsFound() && (result.type() == CALLBACKS);
}
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
67d7c64d1dff1b5f31aaa6069e1e3d5b21fcd1fd..2bac30473beb0732979c860175535e322cd016dc
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1434,7 +1434,7 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_DeclareContextSlot) {
!object->IsJSContextExtensionObject()) {
LookupResult lookup(isolate);
object->Lookup(*name, &lookup);
- if (lookup.IsProperty() && (lookup.type() == CALLBACKS)) {
+ if (lookup.IsFound() && (lookup.type() == CALLBACKS)) {
return ThrowRedeclarationError(isolate, "const", name);
}
}
@@ -1482,7 +1482,7 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_InitializeVarGlobal) {
JSObject::cast(object)->map()->is_hidden_prototype()) {
JSObject* raw_holder = JSObject::cast(object);
raw_holder->LocalLookup(*name, &lookup);
- if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) {
+ if (lookup.IsFound() && lookup.type() == INTERCEPTOR) {
HandleScope handle_scope(isolate);
Handle<JSObject> holder(raw_holder);
PropertyAttributes intercepted = holder->GetPropertyAttribute(*name);
@@ -1648,7 +1648,7 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_InitializeConstContextSlot) {
// GetProperty() to get the current value as it 'unholes' the value.
LookupResult lookup(isolate);
object->LocalLookupRealNamedProperty(*name, &lookup);
- ASSERT(lookup.IsProperty()); // the property was declared
+ ASSERT(lookup.IsFound()); // the property was declared
ASSERT(lookup.IsReadOnly()); // and it was declared as read-only
PropertyType type = lookup.type();
@@ -4256,7 +4256,7 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_KeyedGetProperty) {
// appropriate.
LookupResult result(isolate);
receiver->LocalLookup(key, &result);
- if (result.IsProperty() && result.type() == FIELD) {
+ if (result.IsFound() && result.type() == FIELD) {
int offset = result.GetFieldIndex();
keyed_lookup_cache->Update(receiver_map, key, offset);
return receiver->FastPropertyAt(offset);
@@ -4404,7 +4404,7 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_DefineOrRedefineDataProperty) {
js_object->LocalLookupRealNamedProperty(*name, &result);
// Special case for callback properties.
- if (result.IsProperty() && result.type() == CALLBACKS) {
+ if (result.IsFound() && result.type() == CALLBACKS) {
Object* callback = result.GetCallbackObject();
// To be compatible with Safari we do not change the value on API
objects
// in Object.defineProperty(). Firefox disagrees here, and actually
changes
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index
ec8f6bdf25b949d8c962788f9ed87fd762ed9d07..c7f4f9438602ac44dee8de379b6ee1f1265f92b0
100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -1452,13 +1452,13 @@ Handle<Code> ConstructStubCompiler::GetCode() {
CallOptimization::CallOptimization(LookupResult* lookup) {
- if (!lookup->IsProperty() ||
- !lookup->IsCacheable() ||
- lookup->type() != CONSTANT_FUNCTION) {
- Initialize(Handle<JSFunction>::null());
- } else {
+ if (lookup->IsFound() &&
+ lookup->IsCacheable() &&
+ lookup->type() == CONSTANT_FUNCTION) {
// We only optimize constant function calls.
Initialize(Handle<JSFunction>(lookup->GetConstantFunction()));
+ } else {
+ Initialize(Handle<JSFunction>::null());
}
}
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index
350ff6f4d79079d02aba812a64eb5afe5e0e175d..e0512147735ca5b6d3260c4ff63a5cb098b045e6
100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -2142,7 +2142,7 @@ void
LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
Handle<String> name) {
LookupResult lookup(isolate());
type->LookupInDescriptors(NULL, *name, &lookup);
- ASSERT(lookup.IsProperty() &&
+ ASSERT(lookup.IsFound() &&
(lookup.type() == FIELD || lookup.type() == CONSTANT_FUNCTION));
if (lookup.type() == FIELD) {
int index = lookup.GetLocalFieldIndexFromMap(*type);
Index: src/x64/stub-cache-x64.cc
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc
index
47c217792c860d29cb251228933076dd20bcfc6a..a6e1b833c1855e2e2fc4f5e0339b49e0bd0e603e
100644
--- a/src/x64/stub-cache-x64.cc
+++ b/src/x64/stub-cache-x64.cc
@@ -1045,7 +1045,7 @@ void
StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
// and CALLBACKS, so inline only them, other cases may be added
// later.
bool compile_followup_inline = false;
- if (lookup->IsProperty() && lookup->IsCacheable()) {
+ if (lookup->IsFound() && lookup->IsCacheable()) {
if (lookup->type() == FIELD) {
compile_followup_inline = true;
} else if (lookup->type() == CALLBACKS &&
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev