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

Issue 604033: Introduce builtin for Array.shift function. (Closed)

Created:
10 years, 10 months ago by antonm
Modified:
9 years, 4 months ago
CC:
v8-dev
Visibility:
Public.

Description

Introduce builtin for Array.shift function.

Patch Set 1 #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -7 lines) Patch
M src/bootstrapper.cc View 1 chunk +9 lines, -7 lines 0 comments Download
M src/builtins.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/builtins.cc View 1 chunk +35 lines, -0 lines 8 comments Download

Messages

Total messages: 4 (0 generated)
antonm
Mads, may you have a look? If it's fine, I'd port other function as well.
10 years, 10 months ago (2010-02-12 13:18:17 UTC) #1
Mads Ager (chromium)
I don't think this works correctly for arrays with holes? http://codereview.chromium.org/604033/diff/1/3 File src/builtins.cc (right): http://codereview.chromium.org/604033/diff/1/3#newcode341 ...
10 years, 10 months ago (2010-02-12 13:27:51 UTC) #2
antonm
http://codereview.chromium.org/604033/diff/1/3 File src/builtins.cc (right): http://codereview.chromium.org/604033/diff/1/3#newcode341 src/builtins.cc:341: Object* undefined = Heap::undefined_value(); On 2010/02/12 13:27:51, Mads Ager ...
10 years, 10 months ago (2010-02-12 14:05:55 UTC) #3
antonm
10 years, 10 months ago (2010-02-12 14:08:21 UTC) #4
Sorry, messed up with git cl.  Moving to 
http://codereview.chromium.org/606017


On 2010/02/12 14:05:55, antonm wrote:
> http://codereview.chromium.org/604033/diff/1/3
> File src/builtins.cc (right):
> 
> http://codereview.chromium.org/604033/diff/1/3#newcode341
> src/builtins.cc:341: Object* undefined = Heap::undefined_value();
> On 2010/02/12 13:27:51, Mads Ager wrote:
> > Get rid of the local variable and just put in Heap::undefined_value at the
> only
> > use site?
> 
> Done.
> 
> http://codereview.chromium.org/604033/diff/1/3#newcode358
> src/builtins.cc:358: if (first->IsTheHole())
> On 2010/02/12 13:27:51, Mads Ager wrote:
> > Please use braces around the body.
> 
> Done.
> 
> http://codereview.chromium.org/604033/diff/1/3#newcode363
> src/builtins.cc:363: if (e->IsTheHole())
> On 2010/02/12 13:27:51, Mads Ager wrote:
> > Please use braces around the body.
> 
> Done.
> 
> http://codereview.chromium.org/604033/diff/1/3#newcode365
> src/builtins.cc:365: elms->set(i, e);
> On 2010/02/12 13:27:51, Mads Ager wrote:
> > Will this preserve array holes?  Won't GetElement return undefined for holes
> in
> > the array?  Then set will introduce an element that wasn't there before with
> an
> > undefined value?
> 
> Nice catch, thanks a lot.  Regression test added.  Fixed in not most optimal
way
> for sparsed arrays (doing HasElement call).  If it'd prove to be a bottleneck,
> I'd adjust.
> 
> The problem is I didn't find an API to get element which would distinguish
> between hole and undefined.  It's easy to add (if indeed missing).

Powered by Google App Engine
This is Rietveld 408576698