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

Unified Diff: include/v8.h

Issue 1910253005: [api] Expose FunctionCallbackInfo::NewTarget (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added a TODO Created 4 years, 8 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 | « no previous file | src/api-arguments.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 51fb1330614237fe6a1e735d9ff5d44798fd552e..ce217fdca41f0d405b0297043903a613bb71a169 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3192,12 +3192,13 @@ class FunctionCallbackInfo {
Local<Function> Callee() const);
V8_INLINE Local<Object> This() const;
V8_INLINE Local<Object> Holder() const;
+ V8_INLINE Local<Value> NewTarget() const;
V8_INLINE bool IsConstructCall() const;
V8_INLINE Local<Value> Data() const;
V8_INLINE Isolate* GetIsolate() const;
V8_INLINE ReturnValue<T> GetReturnValue() const;
// This shouldn't be public, but the arm compiler needs it.
- static const int kArgsLength = 7;
+ static const int kArgsLength = 8;
protected:
friend class internal::FunctionCallbackArguments;
@@ -3209,15 +3210,13 @@ class FunctionCallbackInfo {
static const int kDataIndex = 4;
static const int kCalleeIndex = 5;
static const int kContextSaveIndex = 6;
+ static const int kNewTargetIndex = 7;
V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args,
- internal::Object** values,
- int length,
- bool is_construct_call);
+ internal::Object** values, int length);
internal::Object** implicit_args_;
internal::Object** values_;
int length_;
- int is_construct_call_;
};
@@ -7865,17 +7864,11 @@ internal::Object* ReturnValue<T>::GetDefaultValue() {
return value_[-1];
}
-
-template<typename T>
+template <typename T>
FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args,
internal::Object** values,
- int length,
- bool is_construct_call)
- : implicit_args_(implicit_args),
- values_(values),
- length_(length),
- is_construct_call_(is_construct_call) { }
-
+ int length)
+ : implicit_args_(implicit_args), values_(values), length_(length) {}
template<typename T>
Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
@@ -7903,8 +7896,13 @@ Local<Object> FunctionCallbackInfo<T>::Holder() const {
&implicit_args_[kHolderIndex]));
}
+template <typename T>
+Local<Value> FunctionCallbackInfo<T>::NewTarget() const {
+ return Local<Value>(
+ reinterpret_cast<Value*>(&implicit_args_[kNewTargetIndex]));
+}
-template<typename T>
+template <typename T>
Local<Value> FunctionCallbackInfo<T>::Data() const {
return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex]));
}
@@ -7924,7 +7922,7 @@ ReturnValue<T> FunctionCallbackInfo<T>::GetReturnValue() const {
template<typename T>
bool FunctionCallbackInfo<T>::IsConstructCall() const {
- return is_construct_call_ & 0x1;
+ return !NewTarget()->IsUndefined();
}
« no previous file with comments | « no previous file | src/api-arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698