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

Issue 243051: the idea is that often times in code, you will see something like this:... (Closed)

Created:
11 years, 2 months ago by kenny
Modified:
9 years, 3 months ago
CC:
v8-dev
Visibility:
Public.

Description

the idea is that often times in code, you will see something like this: lala = "<div>" + "<span>" + myvar + "</span>" + "</div>"; this patch transforms that code during the parse phase to be: lala = "<div><span>" + myvar + "</div></span>"; UPDATE: I merged the NewNumberLiteral in the switch case to be < 80 chars. please review my usage of NAN as default value. I also have had a horrible time getting these tools to work, and couldn't figure out how to add files (factory.cc/h) to the changeset. hopefully this works. FIXED: brain fart on BinaryOperation... it's obvious I didn't run the tests :( - speaking of which, they don't compile for me cause of bad gcc 4.4 detection and hand fixing them is frustrating. that's gonna be my next patch... *sigh*

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 15

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+104 lines, -55 lines) Patch
M src/factory.h View 1 chunk +2 lines, -1 line 0 comments Download
M src/factory.cc View 1 chunk +5 lines, -2 lines 0 comments Download
M src/heap.h View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M src/heap.cc View 1 2 3 4 chunks +14 lines, -7 lines 0 comments Download
M src/parser.cc View 1 2 3 1 chunk +80 lines, -44 lines 4 comments Download

Messages

Total messages: 6 (0 generated)
Kevin Millikin (Chromium)
Here are some simple comments. The general ones is that we cannot allocate without handling ...
11 years, 2 months ago (2009-10-01 12:11:15 UTC) #1
kenny
On 2009/10/01 12:11:15, Kevin Millikin wrote: > Please note that this doesn't do what you ...
11 years, 2 months ago (2009-10-03 01:00:50 UTC) #2
kenny
http://codereview.chromium.org/243051/diff/2001/3001 File src/heap.cc (right): http://codereview.chromium.org/243051/diff/2001/3001#newcode1695 Line 1695: Object* result = Allocate(map, pretenure ? LO_SPACE : ...
11 years, 2 months ago (2009-10-03 01:01:34 UTC) #3
Kevin Millikin (Chromium)
There are still some obvious problems. I may have time to take a closer look ...
11 years, 2 months ago (2009-10-03 07:08:26 UTC) #4
kenny
On 2009/10/03 07:08:26, Kevin Millikin wrote: > There are still some obvious problems. I may ...
11 years, 2 months ago (2009-10-03 09:12:26 UTC) #5
Kevin Millikin (Chromium)
11 years, 2 months ago (2009-10-09 04:23:24 UTC) #6
I glanced at this again.  General comments:

1. It is still wrong.  You did not address my previous comment: this
optimization only correctly applies to addition.

2. You have refactored the switch statement in the loop and introduced a bug. 
Please do not do that.  (Do not try to refactor code unless you understand it. 
Do not add new unrelated changes to a changelist *after* it has begun being
reviewed, as the reviewer may miss them.)

http://codereview.chromium.org/243051/diff/9/8003
File src/parser.cc (right):

http://codereview.chromium.org/243051/diff/9/8003#newcode2810
Line 2810: double new_number = NAN;
I find this new code less clear than the old because it's less direct.  If you
want to jump to the top of the loop ('continue'), why bother setting a variable,
jumping to the bottom of the switch, and then checking the variable?

http://codereview.chromium.org/243051/diff/9/8003#newcode2859
Line 2859: if (new_number != NAN) {
You have introduced a bug.  Because of the way NaN comparisons work,
*everything* is not equal to NaN (even NaN != NaN).  If you don't hit one of the
cases in the switch you will constant-fold to NaN.

1==1 should be true, not NaN.

http://codereview.chromium.org/243051/diff/9/8003#newcode2863
Line 2863: } else if (x_handle->IsString() && y_handle->IsString()) {
No, you cannot do this optimization unless op is Token::ADD.

http://codereview.chromium.org/243051/diff/9/8003#newcode2870
Line 2870: } else if (x && x->AsBinaryOperation() && y_handle->IsString()) {
You cannot do this optimization unless op is Token::Add.

Powered by Google App Engine
This is Rietveld 408576698