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

Unified Diff: src/runtime.js

Issue 604064: Fix stack corruption when calling non-function. (Closed)
Patch Set: Created 10 years, 10 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 | « src/runtime.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index 3c31ddb7ef3a936a714f46d8f02b84f6ce0f8ed5..231763cbcabf6c2d3e392b509d25376fcd2c62f3 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -395,26 +395,20 @@ function FILTER_KEY(key) {
function CALL_NON_FUNCTION() {
- var callee = %GetCalledFunction();
- var delegate = %GetFunctionDelegate(callee);
+ var delegate = %GetFunctionDelegate(this);
if (!IS_FUNCTION(delegate)) {
- throw %MakeTypeError('called_non_callable', [typeof callee]);
+ throw %MakeTypeError('called_non_callable', [typeof this]);
}
-
- var parameters = %NewArguments(delegate);
- return delegate.apply(callee, parameters);
+ return delegate.apply(this, arguments);
}
function CALL_NON_FUNCTION_AS_CONSTRUCTOR() {
- var callee = %GetCalledFunction();
- var delegate = %GetConstructorDelegate(callee);
+ var delegate = %GetConstructorDelegate(this);
if (!IS_FUNCTION(delegate)) {
- throw %MakeTypeError('called_non_callable', [typeof callee]);
+ throw %MakeTypeError('called_non_callable', [typeof this]);
}
-
- var parameters = %NewArguments(delegate);
- return delegate.apply(callee, parameters);
+ return delegate.apply(this, arguments);
}
« no previous file with comments | « src/runtime.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698