|
Handle overwriting valueOf on String objects correctly when adding
This adds a check to the fast case string add to ensure that the String object still have the default valueOf function. The default valueOf is sitting on a hidden prototype of String.prototype.
Before using the fast case valueOf the object is checked for a local valueOf property. For slow case objects this check always reports true (the dictionary is not probed, so valueOf might be there) and for fast case objects the descriptor array is checked for the valueOf symbol (just liniar scan). After that the prototype is checked for beeing the initial value of String.prototype. If this all pass (that is the default valueOf is still in place) this result is cached on the map making the check fast the next time.
This is only implemented in the optimizing compiler, as the two usages of %_IsStringWrapperSafeForDefaultValueOf is never hit by the full compiler.
I will port to x64 and ARM when this has been reviewed for ia32.
I will remove the performance counters prior to final commit.
BUG=http://code.google.com/p/v8/issues/detail?id=760
TEST=test/mjsunit/regress/regress-760-1.js
TEST=test/mjsunit/regress/regress-760-2.js
Committed: http://code.google.com/p/v8/source/detail?r=5252
Total comments: 6
Total comments: 8
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+635 lines, -19 lines) |
Patch |
|
M |
src/arm/codegen-arm.h
|
View
|
|
3 chunks |
+6 lines, -4 lines |
0 comments
|
Download
|
|
M |
src/arm/codegen-arm.cc
|
View
|
2
3
|
1 chunk |
+143 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/arm/full-codegen-arm.cc
|
View
|
|
1 chunk |
+20 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/arm/macro-assembler-arm.h
|
View
|
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/arm/macro-assembler-arm.cc
|
View
|
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/bootstrapper.cc
|
View
|
1
|
1 chunk |
+8 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/codegen.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
src/contexts.h
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/full-codegen.h
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/full-codegen.cc
|
View
|
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/ia32/codegen-ia32.h
|
View
|
|
3 chunks |
+6 lines, -4 lines |
0 comments
|
Download
|
|
M |
src/ia32/codegen-ia32.cc
|
View
|
1
|
2 chunks |
+138 lines, -1 line |
0 comments
|
Download
|
|
M |
src/ia32/full-codegen-ia32.cc
|
View
|
1
|
1 chunk |
+19 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/ia32/macro-assembler-ia32.cc
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/objects.h
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
M |
src/runtime.js
|
View
|
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
src/x64/codegen-x64.h
|
View
|
|
3 chunks |
+6 lines, -4 lines |
0 comments
|
Download
|
|
M |
src/x64/codegen-x64.cc
|
View
|
2
3
|
1 chunk |
+137 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/x64/full-codegen-x64.cc
|
View
|
|
1 chunk |
+19 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/x64/macro-assembler-x64.h
|
View
|
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
src/x64/macro-assembler-x64.cc
|
View
|
|
1 chunk |
+8 lines, -1 line |
0 comments
|
Download
|
|
A |
test/mjsunit/regress/regress-760-1.js
|
View
|
1
|
1 chunk |
+49 lines, -0 lines |
0 comments
|
Download
|
|
A |
test/mjsunit/regress/regress-760-2.js
|
View
|
1
|
1 chunk |
+49 lines, -0 lines |
0 comments
|
Download
|
Total messages: 5 (0 generated)
|