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

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

Issue 1542963002: [runtime] Introduce dedicated JSBoundFunction to represent bound functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@FunctionConstructor
Patch Set: [arm64] Poke does not preserve flags with --debug-code. Created 5 years 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/x64/macro-assembler-x64.cc ('k') | test/cctest/test-heap-profiler.cc » ('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 12e99a08474feee263357cfc58d938b2fbc258a2..839893e4a654aa3d241c79f44e72aaa23d86eec0 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -19646,6 +19646,39 @@ THREADED_TEST(CreationContextOfJsFunction) {
}
+THREADED_TEST(CreationContextOfJsBoundFunction) {
+ HandleScope handle_scope(CcTest::isolate());
+ Local<Context> context1 = Context::New(CcTest::isolate());
+ InstallContextId(context1, 1);
+ Local<Context> context2 = Context::New(CcTest::isolate());
+ InstallContextId(context2, 2);
+
+ Local<Function> target_function;
+ {
+ Context::Scope scope(context1);
+ target_function = CompileRun("function foo() {}; foo").As<Function>();
+ }
+
+ Local<Function> bound_function1, bound_function2;
+ {
+ Context::Scope scope(context2);
+ CHECK(context2->Global()
+ ->Set(context2, v8_str("foo"), target_function)
+ .FromJust());
+ bound_function1 = CompileRun("foo.bind(1)").As<Function>();
+ bound_function2 =
+ CompileRun("Function.prototype.bind.call(foo, 2)").As<Function>();
+ }
+
+ Local<Context> other_context = Context::New(CcTest::isolate());
+ Context::Scope scope(other_context);
+ CHECK(bound_function1->CreationContext() == context1);
+ CheckContextId(bound_function1, 1);
+ CHECK(bound_function2->CreationContext() == context2);
+ CheckContextId(bound_function2, 1);
+}
+
+
void HasOwnPropertyIndexedPropertyGetter(
uint32_t index,
const v8::PropertyCallbackInfo<v8::Value>& info) {
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698