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

Unified Diff: test/cctest/test-api.cc

Issue 2535753004: [turbofan] Add appropriate types to express Callable. (Closed)
Patch Set: Add spec comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | test/mjsunit/compiler/instanceof-opt1.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 48d0c156e7fb76b3e03ffda22c0bb7ac27c3f52d..6f9f6979a8c982fe0b13ff88971bd36fd0bbeb47 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -7085,6 +7085,9 @@ THREADED_TEST(Regress892105) {
.FromJust());
}
+static void ReturnThis(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ args.GetReturnValue().Set(args.This());
+}
THREADED_TEST(UndetectableObject) {
LocalContext env;
@@ -7093,6 +7096,7 @@ THREADED_TEST(UndetectableObject) {
Local<v8::FunctionTemplate> desc =
v8::FunctionTemplate::New(env->GetIsolate());
desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
+ desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable
Local<v8::Object> obj = desc->GetFunction(env.local())
.ToLocalChecked()
@@ -7141,6 +7145,7 @@ THREADED_TEST(VoidLiteral) {
Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(isolate);
desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
+ desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable
Local<v8::Object> obj = desc->GetFunction(env.local())
.ToLocalChecked()
@@ -7191,6 +7196,7 @@ THREADED_TEST(ExtensibleOnUndetectable) {
Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(isolate);
desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
+ desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable
Local<v8::Object> obj = desc->GetFunction(env.local())
.ToLocalChecked()
@@ -11775,11 +11781,6 @@ static void call_as_function(const v8::FunctionCallbackInfo<v8::Value>& args) {
}
-static void ReturnThis(const v8::FunctionCallbackInfo<v8::Value>& args) {
- args.GetReturnValue().Set(args.This());
-}
-
-
// Test that a call handler can be set for objects which will allow
// non-function objects created through the API to be called as
// functions.
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | test/mjsunit/compiler/instanceof-opt1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698