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

Unified Diff: src/objects.h

Issue 1417243002: [es6] Partially implement Reflect.setPrototypeOf. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/builtins.cc ('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 d591f1d38ded2ccf161fea307543544c8ed0fb02..15631ee6f12b64f46d9a18e369df0017640d6fd3 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1801,6 +1801,25 @@ enum GetKeysConversion { KEEP_NUMBERS, CONVERT_TO_STRING };
enum ShouldThrow { THROW_ON_ERROR, DONT_THROW };
+#define RETURN_FAILURE(isolate, should_throw, call) \
+ do { \
+ if ((should_throw) == DONT_THROW) { \
+ return Just(false); \
+ } else { \
+ isolate->Throw(*isolate->factory()->call); \
+ return Nothing<bool>(); \
+ } \
+ } while (false)
+
+
+#define MAYBE_RETURN(call, value) \
+ do { \
+ if ((call).IsNothing()) return value; \
+ } while (false)
+
+#define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>())
+
+
// JSReceiver includes types on which properties can be defined, i.e.,
// JSObject and JSProxy.
class JSReceiver: public HeapObject {
@@ -1894,6 +1913,12 @@ class JSReceiver: public HeapObject {
MUST_USE_RESULT static Maybe<PropertyAttributes> GetPropertyAttributes(
LookupIterator* it);
+ // Set the object's prototype (only JSReceiver and null are allowed values).
+ MUST_USE_RESULT static Maybe<bool> SetPrototype(Handle<JSReceiver> object,
+ Handle<Object> value,
+ bool from_javascript,
+ ShouldThrow should_throw);
+
static Handle<Object> GetDataProperty(Handle<JSReceiver> object,
Handle<Name> name);
@@ -2315,8 +2340,10 @@ class JSObject: public JSReceiver {
= UPDATE_WRITE_BARRIER);
// Set the object's prototype (only JSReceiver and null are allowed values).
- MUST_USE_RESULT static MaybeHandle<Object> SetPrototype(
- Handle<JSObject> object, Handle<Object> value, bool from_javascript);
+ MUST_USE_RESULT static Maybe<bool> SetPrototype(Handle<JSObject> object,
+ Handle<Object> value,
+ bool from_javascript,
+ ShouldThrow should_throw);
// Initializes the body after properties slot, properties slot is
// initialized by set_properties. Fill the pre-allocated fields with
@@ -2522,8 +2549,9 @@ class JSObject: public JSReceiver {
MUST_USE_RESULT static Maybe<bool> PreventExtensionsWithTransition(
Handle<JSObject> object, ShouldThrow should_throw);
- MUST_USE_RESULT static MaybeHandle<Object> SetPrototypeUnobserved(
- Handle<JSObject> object, Handle<Object> value, bool from_javascript);
+ MUST_USE_RESULT static Maybe<bool> SetPrototypeUnobserved(
+ Handle<JSObject> object, Handle<Object> value, bool from_javascript,
+ ShouldThrow should_throw);
DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject);
};
« no previous file with comments | « src/builtins.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698