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

Issue 1314493005: Remove unnecessary checks and runtime calls from ToLength (Closed)

Created:
5 years, 4 months ago by adamk
Modified:
5 years, 2 months ago
Reviewers:
Benedikt Meurer
CC:
v8-dev, Dan Ehrenberg
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Remove unnecessary checks and runtime calls from ToLength This should make it easier to move to using ToLength in more places to meet ES2015 spec requirements without regressing performance. We might also want to mark it as inlineable, but I've left that for another patch. Also pull 2^53 - 1 out into a macro constant instead of requiring a load from Number.MAX_SAFE_INTEGER.

Patch Set 1 #

Total comments: 1

Patch Set 2 : Add NaN check #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -6 lines) Patch
M src/macros.py View 1 chunk +3 lines, -0 lines 0 comments Download
M src/runtime.js View 1 1 chunk +5 lines, -5 lines 1 comment Download
M src/v8natives.js View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5 (1 generated)
adamk
bmeurer, this might be up your alley. CC littledan as he ran into perf issues ...
5 years, 4 months ago (2015-08-24 22:42:17 UTC) #2
Benedikt Meurer
Hey Adam, I'm currently working on implementing ToPrimitive for ES6, in a way that we ...
5 years, 4 months ago (2015-08-25 04:53:48 UTC) #3
adamk
On 2015/08/25 04:53:48, Benedikt Meurer wrote: > Hey Adam, > > I'm currently working on ...
5 years, 4 months ago (2015-08-25 21:20:15 UTC) #4
adamk
5 years, 4 months ago (2015-08-25 21:55:42 UTC) #5
https://codereview.chromium.org/1314493005/diff/20001/src/runtime.js
File src/runtime.js (right):

https://codereview.chromium.org/1314493005/diff/20001/src/runtime.js#newcode739
src/runtime.js:739: arg = %_MathFloor(arg);
This line is the problem. I get a crash if |arg| is a Smi. Repro:

d8 --harmony-reflect --turbo --always-opt -e 'Reflect.apply(function(){}, {}, {
length: 1 })'

Even more bizarrely, adding a Smi check results in a crash under --stress-opt
--always-opt on a different case:

function f() { 'use strict'; }
Reflect.apply(f, undefined, {});
for (var i = 0; i < 256; ++i) {
  Reflect.apply(f, undefined, { length: i });
}

Seems like something is particularly screwy with either the Reflect stuff or
MathFloor (both of which have strange implementations).

Powered by Google App Engine
This is Rietveld 408576698