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

Unified Diff: src/objects.h

Issue 1368753003: Add C++ implementation of Object.defineProperties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: make compilers happy 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/heap/heap.h ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 2f1405f57d10825a38899967a80d41ffca23d5cd..db3ce118d6b93abdc976bc687bede89ae070f262 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -859,6 +859,7 @@ class LookupIterator;
class ObjectHashTable;
class ObjectVisitor;
class PropertyCell;
+class PropertyDescriptor;
class SafepointEntry;
class SharedFunctionInfo;
class StringStream;
@@ -1780,6 +1781,9 @@ enum AccessorComponent {
enum KeyFilter { SKIP_SYMBOLS, INCLUDE_SYMBOLS };
+enum ShouldThrow { THROW_ON_ERROR, DONT_THROW };
+
+
// JSReceiver includes types on which properties can be defined, i.e.,
// JSObject and JSProxy.
class JSReceiver: public HeapObject {
@@ -1816,6 +1820,35 @@ class JSReceiver: public HeapObject {
Handle<JSReceiver> object, uint32_t index,
LanguageMode language_mode = SLOPPY);
+ MUST_USE_RESULT static Object* DefineProperty(Isolate* isolate,
+ Handle<Object> object,
+ Handle<Object> name,
+ Handle<Object> attributes);
+ MUST_USE_RESULT static Object* DefineProperties(Isolate* isolate,
+ Handle<Object> object,
+ Handle<Object> properties);
+
+ // "virtual" dispatcher to the correct [[DefineOwnProperty]] implementation.
+ static bool DefineOwnProperty(Isolate* isolate, Handle<JSObject> object,
+ Handle<Object> key, PropertyDescriptor* desc,
+ ShouldThrow should_throw);
+
+ static bool OrdinaryDefineOwnProperty(Isolate* isolate,
+ Handle<JSObject> object,
+ Handle<Object> key,
+ PropertyDescriptor* desc,
+ ShouldThrow should_throw);
+ static bool OrdinaryDefineOwnProperty(LookupIterator* it,
+ PropertyDescriptor* desc,
+ ShouldThrow should_throw);
+
+ static bool GetOwnPropertyDescriptor(Isolate* isolate,
+ Handle<JSObject> object,
+ Handle<Object> key,
+ PropertyDescriptor* desc);
+ static bool GetOwnPropertyDescriptor(LookupIterator* it,
+ PropertyDescriptor* desc);
+
// Tests for the fast common case for property enumeration.
bool IsSimpleEnum();
@@ -2062,6 +2095,10 @@ class JSObject: public JSReceiver {
Handle<Object> getter,
Handle<Object> setter,
PropertyAttributes attributes);
+ static MaybeHandle<Object> DefineAccessor(LookupIterator* it,
+ Handle<Object> getter,
+ Handle<Object> setter,
+ PropertyAttributes attributes);
// Defines an AccessorInfo property on the given object.
MUST_USE_RESULT static MaybeHandle<Object> SetAccessor(
@@ -10021,6 +10058,14 @@ class JSArray: public JSObject {
static inline void SetContent(Handle<JSArray> array,
Handle<FixedArrayBase> storage);
+ static bool DefineOwnProperty(Isolate* isolate, Handle<JSArray> o,
+ Handle<Object> name, PropertyDescriptor* desc,
+ ShouldThrow should_throw);
+
+ static bool ArraySetLength(Isolate* isolate, Handle<JSArray> a,
+ PropertyDescriptor* desc,
+ ShouldThrow should_throw);
+
DECLARE_CAST(JSArray)
// Dispatched behavior.
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698