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

Side by Side 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: Created 4 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 11652 matching lines...) Expand 10 before | Expand all | Expand 10 after
11663 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable 11663 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
11664 desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable 11664 desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable
11665 11665
11666 Local<v8::Object> obj = desc->GetFunction(env.local()) 11666 Local<v8::Object> obj = desc->GetFunction(env.local())
11667 .ToLocalChecked() 11667 .ToLocalChecked()
11668 ->NewInstance(env.local()) 11668 ->NewInstance(env.local())
11669 .ToLocalChecked(); 11669 .ToLocalChecked();
11670 CHECK( 11670 CHECK(
11671 env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust()); 11671 env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust());
11672 11672
11673 ExpectString("undetectable.toString()", "[object Object]"); 11673 ExpectString("undetectable.toString()", "[object Function]");
11674 ExpectString("typeof undetectable", "undefined"); 11674 ExpectString("typeof undetectable", "undefined");
11675 ExpectString("typeof(undetectable)", "undefined"); 11675 ExpectString("typeof(undetectable)", "undefined");
11676 ExpectBoolean("typeof undetectable == 'undefined'", true); 11676 ExpectBoolean("typeof undetectable == 'undefined'", true);
11677 ExpectBoolean("typeof undetectable == 'object'", false); 11677 ExpectBoolean("typeof undetectable == 'object'", false);
11678 ExpectBoolean("if (undetectable) { true; } else { false; }", false); 11678 ExpectBoolean("if (undetectable) { true; } else { false; }", false);
11679 ExpectBoolean("!undetectable", true); 11679 ExpectBoolean("!undetectable", true);
11680 11680
11681 ExpectObject("true&&undetectable", obj); 11681 ExpectObject("true&&undetectable", obj);
11682 ExpectBoolean("false&&undetectable", false); 11682 ExpectBoolean("false&&undetectable", false);
11683 ExpectBoolean("true||undetectable", true); 11683 ExpectBoolean("true||undetectable", true);
(...skipping 12596 matching lines...) Expand 10 before | Expand all | Expand 10 after
24280 CHECK_NE(*object->Get(env2.local(), v8_str("values")).ToLocalChecked(), 24280 CHECK_NE(*object->Get(env2.local(), v8_str("values")).ToLocalChecked(),
24281 *object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); 24281 *object2->Get(env2.local(), v8_str("values")).ToLocalChecked());
24282 24282
24283 auto values2 = Local<Function>::Cast( 24283 auto values2 = Local<Function>::Cast(
24284 object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); 24284 object2->Get(env2.local(), v8_str("values")).ToLocalChecked());
24285 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); 24285 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2));
24286 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); 24286 auto ctx2 = v8::Utils::OpenHandle(*env2.local());
24287 CHECK_EQ(fn2->GetCreationContext(), *ctx2); 24287 CHECK_EQ(fn2->GetCreationContext(), *ctx2);
24288 } 24288 }
24289 } 24289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698