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

Unified Diff: src/ic.cc

Issue 8229008: Fix handling of this in direct calls to function proxies. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test for one more code path. Created 9 years, 2 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 | « no previous file | src/messages.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index f54f0d79ed3acc7bf53e9de9988d81a285be3e76..279eade459ca3b18afbab0ed73dfca4324b20bd0 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -413,7 +413,7 @@ Object* CallICBase::TryCallAsFunction(Object* object) {
Handle<Object> target(object, isolate());
Handle<Object> delegate = Execution::GetFunctionDelegate(target);
- if (delegate->IsJSFunction()) {
+ if (delegate->IsJSFunction() && !object->IsJSFunctionProxy()) {
// Patch the receiver and use the delegate as the function to
// invoke. This is used for invoking objects as if they were
// functions.
@@ -430,6 +430,9 @@ Object* CallICBase::TryCallAsFunction(Object* object) {
void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee,
Handle<Object> object) {
+ while (callee->IsJSFunctionProxy())
+ callee = Handle<Object>(JSFunctionProxy::cast(*callee)->call_trap());
Kevin Millikin (Chromium) 2011/10/13 14:36:40 V8 style is braces around this body (unless it cou
+
if (callee->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(callee);
if (function->shared()->strict_mode() || function->IsBuiltin()) {
« no previous file with comments | « no previous file | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698