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

Issue 6304001: Support StringCharCodeAt in hydrogen/lithium. (Closed)

Created:
9 years, 11 months ago by Vitaly Repeshko
Modified:
9 years, 7 months ago
Reviewers:
fschneider
CC:
v8-dev
Visibility:
Public.

Description

Support StringCharCodeAt in hydrogen/lithium.

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+319 lines, -57 lines) Patch
M src/ast.cc View 4 chunks +9 lines, -17 lines 0 comments Download
M src/hydrogen.h View 1 chunk +4 lines, -1 line 0 comments Download
M src/hydrogen.cc View 8 chunks +77 lines, -36 lines 0 comments Download
M src/hydrogen-instructions.h View 4 chunks +44 lines, -0 lines 2 comments Download
M src/ia32/lithium-codegen-ia32.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 2 chunks +138 lines, -3 lines 0 comments Download
M src/ia32/lithium-ia32.h View 4 chunks +28 lines, -0 lines 0 comments Download
M src/ia32/lithium-ia32.cc View 1 chunk +13 lines, -0 lines 2 comments Download
M src/objects.h View 3 chunks +4 lines, -0 lines 0 comments Download
M src/objects-printer.cc View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Vitaly Repeshko
9 years, 11 months ago (2011-01-13 14:18:21 UTC) #1
fschneider
9 years, 11 months ago (2011-01-14 12:06:11 UTC) #2
I'm with Kevin in that we should avoid adding too many special cases to the
hydrogen-builder.

Maybe we can achieve almost the same performance by implementing
%_StringCharCodeAt in hydrogen and making sure that we inline the builtin
functions that call it with the standard inlining mechanism.

For the out-of-bounds access you need to return NaN which would make the output
representation a double number. This does not seem ideal. - How about returning
a tagged value (smi or heap number) instead?

http://codereview.chromium.org/6304001/diff/1/src/hydrogen-instructions.h
File src/hydrogen-instructions.h (right):

http://codereview.chromium.org/6304001/diff/1/src/hydrogen-instructions.h#new...
src/hydrogen-instructions.h:84: //       HStringChartCodeAt
->HStringCharCodeAt

http://codereview.chromium.org/6304001/diff/1/src/hydrogen-instructions.h#new...
src/hydrogen-instructions.h:2914: class HStringLength: public HUnaryOperation {
Could you use HStringLength to optimize access like s.length (similar to the way
we do for ArrayLength)?

http://codereview.chromium.org/6304001/diff/1/src/ia32/lithium-ia32.cc
File src/ia32/lithium-ia32.cc (right):

http://codereview.chromium.org/6304001/diff/1/src/ia32/lithium-ia32.cc#newcod...
src/ia32/lithium-ia32.cc:1746: return
AssignEnvironment(AssignPointerMap(DefineAsRegister(
I'd rather split this into multiple statements to improve readability.

LOperand* object = UseRegister(instr->string());
LOperand* index = UseRegisterOrConstant(instr->index());
...

http://codereview.chromium.org/6304001/diff/1/src/ia32/lithium-ia32.cc#newcod...
src/ia32/lithium-ia32.cc:1753: return DefineAsRegister(
I'd also split this into 2 statement here.

Powered by Google App Engine
This is Rietveld 408576698