Ensure correct boxing of values when calling functions on them
authorsgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 15 Jan 2010 13:42:32 +0000 (13:42 +0000)
committersgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 15 Jan 2010 13:42:32 +0000 (13:42 +0000)
commit562f90d37555301a86bfe5d11119e38896da36a7
tree8e27684b21db018539ed60a217653d376dec2c73
parente174a64a6d05ebcb33fc70aa11bdcb0cb545e5eb
Ensure correct boxing of values when calling functions on them

When a function is called with a value type as the receiver this is now boxed as an object.

This is a low-impact solution where the receiver is only boxed when required. For IC calls to the V8 builtins values are not boxed and as most of the functions on String.prototype, Number.prototype and Boolean.prototype are sitting there most IC calls on values will not need any boxing of the receiver.

For calls which are not IC calls but calls through the CallFunctionStub a flag is used to determine whether the receiver might be a value and only when that is the case will the receiver be boxed.

No changtes to Function.call and Function.apply - they already boxed values. According to the ES5 spec the receiver should not be boxed for these functions, but current browsers have not adopted that change yet.

BUG=223
TEST=test/mjsunit/value-wrapper.js
TEST=test/mjsunit/regress/regress-crbug-3184.js
Review URL: http://codereview.chromium.org/542087

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3617 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
20 files changed:
src/arm/codegen-arm.cc
src/arm/codegen-arm.h
src/arm/fast-codegen-arm.cc
src/arm/stub-cache-arm.cc
src/codegen.h
src/debug.cc
src/globals.h
src/ia32/codegen-ia32.cc
src/ia32/codegen-ia32.h
src/ia32/fast-codegen-ia32.cc
src/ia32/stub-cache-ia32.cc
src/ic.cc
src/ic.h
src/x64/codegen-x64.cc
src/x64/codegen-x64.h
src/x64/fast-codegen-x64.cc
src/x64/stub-cache-x64.cc
test/mjsunit/bugs/bug-223.js [deleted file]
test/mjsunit/regress/regress-crbug-3184.js [new file with mode: 0644]
test/mjsunit/value-wrapper.js [new file with mode: 0644]