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

Side by Side 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: Addressed Kevin's comments. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/contexts.h ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 Handle<JSReceiver> receiver(receiver_raw); 2295 Handle<JSReceiver> receiver(receiver_raw);
2296 Handle<Object> name(name_raw); 2296 Handle<Object> name(name_raw);
2297 2297
2298 Handle<Object> args[] = { name }; 2298 Handle<Object> args[] = { name };
2299 Handle<Object> result = CallTrap( 2299 Handle<Object> result = CallTrap(
2300 "getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args); 2300 "getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args);
2301 if (isolate->has_pending_exception()) return NONE; 2301 if (isolate->has_pending_exception()) return NONE;
2302 2302
2303 if (result->IsUndefined()) return ABSENT; 2303 if (result->IsUndefined()) return ABSENT;
2304 2304
2305 // TODO(rossberg): convert result to PropertyAttributes 2305 bool has_pending_exception;
2306 return NONE; 2306 Object** argv[] = { result.location() };
2307 Handle<Object> desc =
2308 Execution::Call(isolate->to_complete_property_descriptor(), result,
2309 ARRAY_SIZE(argv), argv, &has_pending_exception);
2310 if (has_pending_exception) return NONE;
2311
2312 // Convert result to PropertyAttributes.
2313 Handle<String> enum_n = isolate->factory()->LookupAsciiSymbol("enumerable");
2314 Handle<Object> enumerable(v8::internal::GetProperty(desc, enum_n));
2315 if (isolate->has_pending_exception()) return NONE;
2316 Handle<String> conf_n = isolate->factory()->LookupAsciiSymbol("configurable");
2317 Handle<Object> configurable(v8::internal::GetProperty(desc, conf_n));
2318 if (isolate->has_pending_exception()) return NONE;
2319 Handle<String> writ_n = isolate->factory()->LookupAsciiSymbol("writable");
2320 Handle<Object> writable(v8::internal::GetProperty(desc, writ_n));
2321 if (isolate->has_pending_exception()) return NONE;
2322
2323 int attributes = NONE;
2324 if (enumerable->ToBoolean()->IsFalse()) attributes |= DONT_ENUM;
2325 if (configurable->ToBoolean()->IsFalse()) attributes |= DONT_DELETE;
2326 if (writable->ToBoolean()->IsFalse()) attributes |= READ_ONLY;
2327 return static_cast<PropertyAttributes>(attributes);
2307 } 2328 }
2308 2329
2309 2330
2310 void JSProxy::Fix() { 2331 void JSProxy::Fix() {
2311 Isolate* isolate = GetIsolate(); 2332 Isolate* isolate = GetIsolate();
2312 HandleScope scope(isolate); 2333 HandleScope scope(isolate);
2313 Handle<JSProxy> self(this); 2334 Handle<JSProxy> self(this);
2314 2335
2315 if (IsJSFunctionProxy()) { 2336 if (IsJSFunctionProxy()) {
2316 isolate->factory()->BecomeJSFunction(self); 2337 isolate->factory()->BecomeJSFunction(self);
(...skipping 9290 matching lines...) Expand 10 before | Expand all | Expand 10 after
11607 if (break_point_objects()->IsUndefined()) return 0; 11628 if (break_point_objects()->IsUndefined()) return 0;
11608 // Single break point. 11629 // Single break point.
11609 if (!break_point_objects()->IsFixedArray()) return 1; 11630 if (!break_point_objects()->IsFixedArray()) return 1;
11610 // Multiple break points. 11631 // Multiple break points.
11611 return FixedArray::cast(break_point_objects())->length(); 11632 return FixedArray::cast(break_point_objects())->length();
11612 } 11633 }
11613 #endif 11634 #endif
11614 11635
11615 11636
11616 } } // namespace v8::internal 11637 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698