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

Unified Diff: src/v8natives.js

Issue 1368753003: Add C++ implementation of Object.defineProperties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: preview -- needs refactoring Created 5 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 168f97b91add2c5ac868bffb6842b56104f850ad..95a7193b8ae7490902bf493785999adfaa7a4919 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1089,19 +1089,24 @@ function GetOwnEnumerablePropertyNames(object) {
// ES5 section 15.2.3.7.
function ObjectDefineProperties(obj, properties) {
- if (!IS_SPEC_OBJECT(obj)) {
- throw MakeTypeError(kCalledOnNonObject, "Object.defineProperties");
- }
- var props = TO_OBJECT(properties);
- var names = GetOwnEnumerablePropertyNames(props);
- var descriptors = new InternalArray();
- for (var i = 0; i < names.length; i++) {
- descriptors.push(ToPropertyDescriptor(props[names[i]]));
- }
- for (var i = 0; i < names.length; i++) {
- DefineOwnProperty(obj, names[i], descriptors[i], true);
+ // The new pure-C++ implementation doesn't support Proxies yet, nor O.o.
+ // TODO(jkummerow): Implement missing features and remove fallback path.
+ if (%_IsJSProxy(obj) || %_IsJSProxy(properties) || %IsObserved(obj)) {
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError(kCalledOnNonObject, "Object.defineProperties");
+ }
+ var props = TO_OBJECT(properties);
+ var names = GetOwnEnumerablePropertyNames(props);
+ var descriptors = new InternalArray();
+ for (var i = 0; i < names.length; i++) {
+ descriptors.push(ToPropertyDescriptor(props[names[i]]));
+ }
+ for (var i = 0; i < names.length; i++) {
+ DefineOwnProperty(obj, names[i], descriptors[i], true);
+ }
+ return obj;
}
- return obj;
+ return %ObjectDefineProperties(obj, properties);
}
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698