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

Unified Diff: src/objects.cc

Issue 1421033002: [es6] Partially implement Reflect.defineProperty. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address a comment and rebase. Created 5 years, 2 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/objects.h ('k') | test/mjsunit/harmony/reflect.js » ('j') | 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 40f4650b77b398dc7b4e12622eb7ee5623966222..7b223c084a371ea7043b70f30108a91405eb9678 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -6061,7 +6061,7 @@ Object* JSReceiver::DefineProperties(Isolate* isolate, Handle<Object> object,
// static
-bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSObject> object,
+bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSReceiver> object,
Handle<Object> key, PropertyDescriptor* desc,
ShouldThrow should_throw) {
if (object->IsJSArray()) {
@@ -6070,12 +6070,14 @@ bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSObject> object,
}
// TODO(jkummerow): Support Modules (ES6 9.4.6.6)
// TODO(jkummerow): Support Proxies (ES6 9.5.6)
+ if (!object->IsJSObject()) return true;
// OrdinaryDefineOwnProperty, by virtue of calling
// DefineOwnPropertyIgnoreAttributes, can handle arguments (ES6 9.4.4.2)
// and IntegerIndexedExotics (ES6 9.4.5.3), with one exception:
// TODO(jkummerow): Setting an indexed accessor on a typed array should throw.
- return OrdinaryDefineOwnProperty(isolate, object, key, desc, should_throw);
+ return OrdinaryDefineOwnProperty(isolate, Handle<JSObject>::cast(object), key,
+ desc, should_throw);
}
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/harmony/reflect.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698