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

Unified Diff: src/ic.cc

Issue 542087: Ensure correct boxing of values when calling functions on them... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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
===================================================================
--- src/ic.cc (revision 3613)
+++ src/ic.cc (working copy)
@@ -378,7 +378,19 @@
return *delegate;
}
+void CallIC::ReceiverToObject(Object* object) {
+ HandleScope scope;
+ Handle<Object> receiver(object);
+ // Change the receiver to the result of calling ToObject on it.
+ const int argc = this->target()->arguments_count();
+ StackFrameLocator locator;
+ JavaScriptFrame* frame = locator.FindJavaScriptFrame(0);
+ int index = frame->ComputeExpressionsCount() - (argc + 1);
+ frame->SetExpression(index, object->ToObject());
+}
+
+
Object* CallIC::LoadFunction(State state,
Handle<Object> object,
Handle<String> name) {
@@ -388,6 +400,10 @@
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;
« no previous file with comments | « src/ic.h ('k') | src/x64/codegen-x64.h » ('j') | test/mjsunit/value-wrapper.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698