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

Unified Diff: src/ic.cc

Issue 6523052: CallIC and KeyedCallIC not wrapping this. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CallIC doesn't wrap this for strict mode functions.wq Created 9 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
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 968b45d0b61f4ac27c102cdc8dae927cc8c51ff2..446511191aa6c9d0277016804d810ef3f8339516 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -458,14 +458,11 @@ MaybeObject* CallICBase::LoadFunction(State state,
return TypeError("non_object_property_call", object, name);
}
- if (object->IsString() || object->IsNumber() || object->IsBoolean()) {
- ReceiverToObject(object);
- }
-
// Check if the name is trivially convertible to an index and get
// the element if so.
uint32_t index;
- if (name->AsArrayIndex(&index)) {
+ // TODO(mmaly): One cannot hang number-indexed functions off of values, right?
Martin Maly 2011/02/16 04:56:17 I couldn't come up with a way where value could ac
Mads Ager (chromium) 2011/02/16 10:43:54 I think that is because we have a bug here. I thin
Martin Maly 2011/02/17 05:25:55 Done.
+ if (object->IsJSObject() && name->AsArrayIndex(&index)) {
Object* result;
{ MaybeObject* maybe_result = object->GetElement(index);
if (!maybe_result->ToObject(&result)) return maybe_result;
@@ -490,6 +487,7 @@ MaybeObject* CallICBase::LoadFunction(State state,
if (IsContextual(object)) {
return ReferenceError("not_defined", name);
}
+ // TODO(mmaly): Should we do ToObject here?
Mads Ager (chromium) 2011/02/16 10:43:54 Nope, there is no change to this code and it makes
Martin Maly 2011/02/17 05:25:55 Done.
return TypeError("undefined_method", object, name);
}
@@ -505,6 +503,14 @@ MaybeObject* CallICBase::LoadFunction(State state,
object->GetProperty(*object, &lookup, *name, &attr);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
+
+ // For non-strict mode functions, make receiver an object.
+ if ((!result->IsJSFunction() ||
+ !JSFunction::cast(result)->shared()->strict_mode()) &&
+ (object->IsString() || object->IsNumber() || object->IsBoolean())) {
+ ReceiverToObject(object);
Vitaly Repeshko 2011/02/16 11:52:12 1. Since this is now done after UpdateCaches, plea
Martin Maly 2011/02/17 05:25:55 Done and done. for the builtin change I ran full t
+ }
+
if (lookup.type() == INTERCEPTOR) {
// If the object does not have the requested property, check which
// exception we need to throw.

Powered by Google App Engine
This is Rietveld 408576698