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

Unified Diff: src/objects.cc

Issue 481043002: Get rid of LookupRealNamedProperty and LookupRealNamedPropertyInPrototypes and update clients (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« src/api.cc ('K') | « src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index d407f74c644c619c71c4af592071901bad26b2b5..b6757ab9e7307a3b2d6ec97b6035663896dd0384 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -140,6 +140,34 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
}
+Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object,
+ Handle<Name> key) {
+ LookupIterator it(object, key, LookupIterator::CHECK_DERIVED_PROPERTY);
+ for (; it.IsFound(); it.Next()) {
+ switch (it.state()) {
+ case LookupIterator::NOT_FOUND:
+ case LookupIterator::ACCESS_CHECK:
+ case LookupIterator::INTERCEPTOR:
+ UNREACHABLE();
+ case LookupIterator::JSPROXY:
+ return it.isolate()->factory()->undefined_value();
+ case LookupIterator::PROPERTY:
+ if (!it.HasProperty()) continue;
+ switch (it.property_kind()) {
+ case LookupIterator::DATA:
+ return it.GetDataValue();
+ case LookupIterator::ACCESSOR:
+ // TODO(verwaest): For now this doesn't call into
+ // ExecutableAccessorInfo, since clients don't need it. Update once
+ // relevant.
+ return it.isolate()->factory()->undefined_value();
+ }
+ }
+ }
+ return it.isolate()->factory()->undefined_value();
+}
+
+
bool Object::ToInt32(int32_t* value) {
if (IsSmi()) {
*value = Smi::cast(this)->value();
@@ -3418,37 +3446,6 @@ void JSObject::LookupOwnRealNamedProperty(Handle<Name> name,
}
-void JSObject::LookupRealNamedProperty(Handle<Name> name,
- LookupResult* result) {
- DisallowHeapAllocation no_gc;
- LookupOwnRealNamedProperty(name, result);
- if (result->IsFound()) return;
-
- LookupRealNamedPropertyInPrototypes(name, result);
-}
-
-
-void JSObject::LookupRealNamedPropertyInPrototypes(Handle<Name> name,
- LookupResult* result) {
- if (name->IsOwn()) {
- result->NotFound();
- return;
- }
-
- DisallowHeapAllocation no_gc;
- Isolate* isolate = GetIsolate();
- for (PrototypeIterator iter(isolate, this); !iter.IsAtEnd(); iter.Advance()) {
- if (iter.GetCurrent()->IsJSProxy()) {
- return result->HandlerResult(JSProxy::cast(iter.GetCurrent()));
- }
- JSObject::cast(iter.GetCurrent())->LookupOwnRealNamedProperty(name, result);
- DCHECK(!(result->IsFound() && result->type() == INTERCEPTOR));
- if (result->IsFound()) return;
- }
- result->NotFound();
-}
-
-
Maybe<bool> JSProxy::HasPropertyWithHandler(Handle<JSProxy> proxy,
Handle<Name> name) {
Isolate* isolate = proxy->GetIsolate();
@@ -5664,41 +5661,6 @@ MaybeHandle<JSObject> JSObject::DeepCopy(
}
-Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object,
- Handle<Name> key) {
- Isolate* isolate = object->GetIsolate();
- LookupResult lookup(isolate);
- {
- DisallowHeapAllocation no_allocation;
- object->LookupRealNamedProperty(key, &lookup);
- }
- Handle<Object> result = isolate->factory()->undefined_value();
- if (lookup.IsFound() && !lookup.IsTransition()) {
- switch (lookup.type()) {
- case NORMAL:
- result = GetNormalizedProperty(
- Handle<JSObject>(lookup.holder(), isolate), &lookup);
- break;
- case FIELD:
- result = FastPropertyAt(Handle<JSObject>(lookup.holder(), isolate),
- lookup.representation(),
- lookup.GetFieldIndex());
- break;
- case CONSTANT:
- result = Handle<Object>(lookup.GetConstant(), isolate);
- break;
- case CALLBACKS:
- case HANDLER:
- case INTERCEPTOR:
- break;
- case NONEXISTENT:
- UNREACHABLE();
- }
- }
- return result;
-}
-
-
// Tests for the fast common case for property enumeration:
// - This object and all prototypes has an enum cache (which means that
// it is no proxy, has no interceptors and needs no access checks).
« src/api.cc ('K') | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698