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

Unified Diff: src/objects.cc

Issue 7828080: Fix and test use of property descriptor objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index ebcef01aff544a1a6606a87860528e071e97d44e..82eb4aee3cde26783bc9503641b4fc8109c007cf 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2302,8 +2302,29 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
if (result->IsUndefined()) return ABSENT;
- // TODO(rossberg): convert result to PropertyAttributes
- return NONE;
+ bool has_pending_exception;
+ Object** argv[] = { result.location() };
+ Handle<Object> desc =
+ Execution::Call(isolate->to_complete_property_descriptor(), result,
+ ARRAY_SIZE(argv), argv, &has_pending_exception);
+ if (has_pending_exception) return NONE;
+
+ // Convert result to PropertyAttributes.
+ Handle<String> enum_name = isolate->factory()->LookupAsciiSymbol("enumerable");
Kevin Millikin (Chromium) 2011/09/05 13:48:59 It looks like there are a couple of long lines. C
rossberg 2011/09/05 14:07:49 Done.
+ Handle<Object> enumerable(v8::internal::GetProperty(desc, enum_name));
+ if (isolate->has_pending_exception()) return NONE;
+ Handle<String> conf_name = isolate->factory()->LookupAsciiSymbol("configurable");
+ Handle<Object> configurable(v8::internal::GetProperty(desc, conf_name));
+ if (isolate->has_pending_exception()) return NONE;
+ Handle<String> writ_name = isolate->factory()->LookupAsciiSymbol("writable");
+ Handle<Object> writable(v8::internal::GetProperty(desc, writ_name));
+ if (isolate->has_pending_exception()) return NONE;
+
+ int attributes = NONE;
+ if (enumerable->ToBoolean()->IsFalse()) attributes |= DONT_ENUM;
+ if (configurable->ToBoolean()->IsFalse()) attributes |= DONT_DELETE;
+ if (writable->ToBoolean()->IsFalse()) attributes |= READ_ONLY;
+ return static_cast<PropertyAttributes>(attributes);
}
« src/bootstrapper.cc ('K') | « src/contexts.h ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698