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

Unified Diff: src/runtime.js

Issue 149177: Optimize Date construction and string concatenation with... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 | « src/math.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
===================================================================
--- src/runtime.js (revision 2342)
+++ src/runtime.js (working copy)
@@ -161,14 +161,31 @@
// Left operand (this) is already a string.
function STRING_ADD_LEFT(y) {
- if (!IS_STRING(y)) y = %ToString(%ToPrimitive(y, NO_HINT));
+ if (!IS_STRING(y)) {
+ if (IS_STRING_WRAPPER(y)) {
+ y = %_ValueOf(y);
+ } else {
+ y = IS_NUMBER(y)
+ ? %NumberToString(y)
+ : %ToString(%ToPrimitive(y, NO_HINT));
+ }
+ }
return %StringAdd(this, y);
}
// Right operand (y) is already a string.
function STRING_ADD_RIGHT(y) {
- var x = IS_STRING(this) ? this : %ToString(%ToPrimitive(this, NO_HINT));
+ var x = this;
+ if (!IS_STRING(x)) {
+ if (IS_STRING_WRAPPER(x)) {
+ x = %_ValueOf(x);
+ } else {
+ x = IS_NUMBER(x)
+ ? %NumberToString(x)
+ : %ToString(%ToPrimitive(x, NO_HINT));
+ }
+ }
return %StringAdd(x, y);
}
« no previous file with comments | « src/math.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698