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

Unified Diff: src/js/messages.js

Issue 1510833003: Improve the CallSite constructor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/messages.js
diff --git a/src/js/messages.js b/src/js/messages.js
index d0305412b74896a7971e4e435032b5f9a8ee3a05..e0d6a07daeec5fa3adbc7b97e107833810f4958b 100644
--- a/src/js/messages.js
+++ b/src/js/messages.js
@@ -566,10 +566,18 @@ function GetStackTraceLine(recv, fun, pos, isGlobal) {
// Error implementation
function CallSite(receiver, fun, pos, strict_mode) {
+ if (!IS_FUNCTION(fun)) {
+ throw MakeTypeError(kCallSiteExpectsFunction, typeof fun);
+ }
+
+ if (IS_UNDEFINED(new.target)) {
+ return new CallSite(receiver, fun, pos, strict_mode);
+ }
+
SET_PRIVATE(this, callSiteReceiverSymbol, receiver);
SET_PRIVATE(this, callSiteFunctionSymbol, fun);
- SET_PRIVATE(this, callSitePositionSymbol, pos);
- SET_PRIVATE(this, callSiteStrictSymbol, strict_mode);
+ SET_PRIVATE(this, callSitePositionSymbol, TO_INT32(pos));
+ SET_PRIVATE(this, callSiteStrictSymbol, TO_BOOLEAN(strict_mode));
}
function CallSiteGetThis() {
« no previous file with comments | « no previous file | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698