Commit Graph

27848 Commits

Author SHA1 Message Date
verwaest
6ed87bfbc2 Always immediately propagate flags outwards rather than relying on PropagateScopeInfo
- Now "inner_scope_uses_eval_" is also set of scopes that call eval themselves.
- AllowLazyParsing doesn't check force_eager_compilation_ anymore.
- Both inner_scope_uses_eval_ and force_eager_compilation_ are propagated
  outwards immediately when set.

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2269603002
Cr-Commit-Position: refs/heads/master@{#38797}
2016-08-22 17:18:59 +00:00
bradnelson
2d46ef23b1 [wasm] asm.js - Check stdlib functions are valid.
Check remaining asm.js stdlib functions for validitity at instatiation.

Fail when a member is referenced, even if not used.

BUG= https://bugs.chromium.org/p/v8/issues/detail?id=4203
LOG=N
R=jpp@chromium.org,titzer@chromium.org

Review-Url: https://codereview.chromium.org/2267633002
Cr-Commit-Position: refs/heads/master@{#38796}
2016-08-22 17:17:57 +00:00
jbroman
cff8e03d4d Blink-compatible serialization of dates.
BUG=chromium:148757

Review-Url: https://codereview.chromium.org/2255973005
Cr-Commit-Position: refs/heads/master@{#38795}
2016-08-22 17:14:58 +00:00
vogelheim
8ff52750ed Reduce TokenDesc size by 20% on 64b platforms.
(40B -> 32B, due to alignment rules. Should be neutral on 32b platforms.)

BUG=v8:4947

Review-Url: https://codereview.chromium.org/2256183005
Cr-Commit-Position: refs/heads/master@{#38794}
2016-08-22 16:58:28 +00:00
caitp
f93ac8968a [builtins] support exception handling in TFJ builtins
BUG=v8:5264, v8:5268
R=mstarzinger@chromium.org, bmeurer@chromium.org, epertoso@chromium.org

Review-Url: https://codereview.chromium.org/2247353005
Cr-Commit-Position: refs/heads/master@{#38792}
2016-08-22 15:58:13 +00:00
ahaas
10e7ccfbd4 [turbofan] mark Float64(Max|Min) as associative and commutative.
Now that -0.0 and 0.0 are ordered by Float64Max and Float64Min, these
two operator are both associative and commutative for all numbers. The
operators would not be associative and commutative for NaNs, but
neither JavaScript nor WebAssembly distinguish between NaNs nowadays.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2263163002
Cr-Commit-Position: refs/heads/master@{#38791}
2016-08-22 15:26:28 +00:00
jgruber
a89639e79c Handle unicode correctly in CallPrinter
CallPrinter currently has only a single use, namely to print the call
site when throwing CalledNonCallable (ConstructedNonConstructable)
errors. This ensures that unicode call sites such as "あいう"() are
printed correctly by using an IncrementalStringBuilder internally.

BUG=637167

Review-Url: https://codereview.chromium.org/2265073002
Cr-Commit-Position: refs/heads/master@{#38790}
2016-08-22 15:13:17 +00:00
bjaideep
2e6db3af00 PPC/s390: [wasm] adding case for kAttachedReference in Serializer/Deseriealizer
For PPC/s390 the case is missing where reference=attachedreference
how_to_code=kFromCode and  where_to_point=kStartOfObject. On PPC/s390
IsCodedSpecially always return true, hence how_to_code will not be a
straight pointer.
This should also fix the similar issue on mipsel.
The testcase was added as part of https://codereview.chromium.org/2205973003/

R=mtrofin@chromium.org, yangguo@chromium.org, titzer@chromium.org

BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2247093002
Cr-Commit-Position: refs/heads/master@{#38789}
2016-08-22 15:07:34 +00:00
jgruber
be23ef541b [turbofan] Disable inlining of Cpp builtins in need of argument adaption
Disable inlining of Cpp to a direct CEntryStub call when a call would
require argument adaption, i.e. when argument adaption is enabled for
the given function and the actual argument count differs from the formal
parameter count.

This is intended to be a temporary fix until we either disable argument
adaption for all Cpp builtins or add adaption logic to inlined Cpp
builtins.

BUG=chromium:639752

Review-Url: https://codereview.chromium.org/2266893002
Cr-Commit-Position: refs/heads/master@{#38788}
2016-08-22 14:55:38 +00:00
franzih
81ab165daf Improve DCHECK in DefineAccessor().
Fix getter/setter typo so we use the correct object in DCHECK.

BUG=

Review-Url: https://codereview.chromium.org/2255713002
Cr-Commit-Position: refs/heads/master@{#38787}
2016-08-22 14:54:32 +00:00
verwaest
83febb1d8d Move has_arguments_parameter_ to DeclarationScope
BUG=v8:5209

Review-Url: https://codereview.chromium.org/2265903003
Cr-Commit-Position: refs/heads/master@{#38786}
2016-08-22 14:47:23 +00:00
ahaas
2027b0bed1 [turbofan] Add Float32(Max|Min) machine operators.
The new operators are implemented similar to the Float64(Max|Min) which
already exist. The purpose of the new operators is the implementation
of the F32Max and F32Min instructions in WebAssembly.

R=titzer@chromium.org, v8-arm-ports@googlegroups.com, v8-mips-ports@googlegroups.com

Review-Url: https://codereview.chromium.org/2252863003
Cr-Commit-Position: refs/heads/master@{#38784}
2016-08-22 13:50:51 +00:00
jgruber
6d51bab3d2 [turbofan] Inline construct calls to CPP builtins
BUG=

Review-Url: https://codereview.chromium.org/2255313006
Cr-Commit-Position: refs/heads/master@{#38783}
2016-08-22 12:57:55 +00:00
verwaest
d8bc375853 Force eager compilation on closure scopes only
In theory the flag could otherwise be set on a blockscope that might be finalized (removed) before PropagateScopeInfo can propagate the flag around. In that case we'd lose the flag.

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2267683002
Cr-Commit-Position: refs/heads/master@{#38781}
2016-08-22 12:32:44 +00:00
verwaest
8f8a906751 Find the last outer eval scope to check in fullcodegen rather than scope analysis
This is the only user of outer_scope_calls_sloppy_eval. Inlining it simplifies scope analysis.

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2263123002
Cr-Commit-Position: refs/heads/master@{#38779}
2016-08-22 11:50:50 +00:00
rmcilroy
0996cea5b6 [Interpreter] Introduce InterpreterCompilationJob
Adds InterpreterCompilationJob as a sub-class of
CompilationJob, to enable off-thread bytecode
generation. Currently only used in
Interpreter::MakeBytecode.

As part of this change, CompilationJob is modified
to make it less specific to optimized compilation,
renaming the phases as follows:
 - CreateGraph -> PrepareJob
 - OptimizeGraph -> ExecuteJob
 - GenerateCode -> FinalizeJob

RegisterWeakObjectsInOptimizedCode is also moved out
of CompilationJob and instead becomes a static function
on Compiler.

BUG=v8:5203

Committed: https://crrev.com/1fb6a7e697e8bc5b4af51647553741f966e00cdc
Committed: https://crrev.com/785990e9fc0dd9a9d963d25d0bed2909165e4ca9
Committed: https://crrev.com/d7c6195c4c5cdc080caa74dfe2ae9ecab69bea73
Review-Url: https://codereview.chromium.org/2240463002
Cr-Original-Original-Original-Commit-Position: refs/heads/master@{#38662}
Cr-Original-Original-Commit-Position: refs/heads/master@{#38668}
Cr-Original-Commit-Position: refs/heads/master@{#38725}
Cr-Commit-Position: refs/heads/master@{#38778}
2016-08-22 11:49:26 +00:00
marja
f9d6076115 Cleanup: Move ParseInfo to a separate file.
This makes us able to get rid of dependencies to parser.h from places
which only need the ParseInfo, and also gets rid of the curious Parser
<-> Compiler circular dependency.

Also IWYUd where necessary.

BUG=

Review-Url: https://codereview.chromium.org/2268513002
Cr-Commit-Position: refs/heads/master@{#38777}
2016-08-22 11:33:58 +00:00
mstarzinger
a311bfa693 [compiler] Fix uncommon CompileOptimized fallback.
This fixes the uncommon fallback when Compiler::CompileOptimized fails
creating optimized code and also the underlying SharedFunctionInfo is
not compiled. We make sure not to uselessly regenerate the bytecode.

R=rmcilroy@chromium.org
BUG=chromium:639753

Review-Url: https://codereview.chromium.org/2261123002
Cr-Commit-Position: refs/heads/master@{#38776}
2016-08-22 11:29:45 +00:00
jochen
d181e6e1e6 Add debug code to catch faulty interceptor
BUG=chromium:625155
R=jkummerow@chromium.org

Review-Url: https://codereview.chromium.org/2265903002
Cr-Commit-Position: refs/heads/master@{#38775}
2016-08-22 10:43:18 +00:00
rmcilroy
c13acc8153 [TurboFan] Ensure value is pushed for StackOverflow in AstVisitor::Visit.
AstGraphBuilder overrides Visit(Expression*) to ensure that even if there is a
stack overflow, a value still gets produced. However, if there was no stack
overflow in the overriden function, but calling
AstVisitor<AstGraphBuilder>::Visit(expr) pushes us over the stack limit, then
the stack overflow check in that function will return without visiting the
expression, and the result will never get pushed.

To fix this, we add a new VisitNoStackOverflowCheck function which avoids the
inner stack check, and call that instead.

Since this depends on the size of C++ stack frames, there is no reliable test
I can add, however regress-635429.js exibits this behavior after
https://codereview.chromium.org/2240463002/ lands.

Review-Url: https://codereview.chromium.org/2262703002
Cr-Commit-Position: refs/heads/master@{#38774}
2016-08-22 10:28:03 +00:00
verwaest
3db269f98c Drop is_eval_scope when checking how to access dynamic globals. It has no influence
BUG=

Review-Url: https://codereview.chromium.org/2266843002
Cr-Commit-Position: refs/heads/master@{#38773}
2016-08-22 09:45:58 +00:00
franzih
6e665b094e [turbofan] Induction variable bound analysis for decrements.
This detects loops with integer decrements.

Drive-by fix: Add lower bounds to lower_bounds
zone vector instead of upper_bounds.

BUG=

Review-Url: https://codereview.chromium.org/2260153002
Cr-Commit-Position: refs/heads/master@{#38772}
2016-08-22 09:21:42 +00:00
verwaest
72b784426d Simplify Scope::AllowsLazyCompilationWithoutContext
Now it just relies on NeedsContext and hence is guaranteed to be in sync.

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2262133002
Cr-Commit-Position: refs/heads/master@{#38771}
2016-08-22 09:02:17 +00:00
marja
038be51756 Include only stuff you need, part 2: ast.h, ast-value-factory.h in ports.
Rebuilding (after touching certain files) is crazy slow because
includes are out of control.

Fixing it:
- Don't include stuff in headers unless necessary.
- Include the stuff you need, not some other stuff that happens to include the
stuff you need.

BUG=v8:5294

Review-Url: https://codereview.chromium.org/2258603003
Cr-Commit-Position: refs/heads/master@{#38770}
2016-08-22 08:16:57 +00:00
bmeurer
0e8fe08299 [turbofan] Cache the most common Deoptimize operators.
This adds cached versions of the DeoptimizeIf, DeoptimizeUnless and
Deoptimize operators that occur most often in various benchmarks.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2266743002
Cr-Commit-Position: refs/heads/master@{#38769}
2016-08-22 07:55:10 +00:00
nikolaos
8133ab4c1a This patch continues the refactoring of the traits objects, used by the
parser and the preparser, so that they contain the same set of methods,
with the same signatures.  It mainly flags some traits methods as const.
It also contains a small cosmetic change in the definition of CHECK_OK.

R=adamk@chromium.org, marja@chromium.org
BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2258123002
Cr-Commit-Position: refs/heads/master@{#38767}
2016-08-20 14:36:22 +00:00
nikolaos
848b6278f8 [parser] Reorder traits methods
This patch simply reorders the elements of classes ParserTraits
and PreParserTraits (mainly method headers), so that in both
classes the elements are defined in the same order.  This is
useful for easily verifying the consistency between these two
classes.

R=adamk@chromium.org, marja@chromium.org
BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2264483003
Cr-Commit-Position: refs/heads/master@{#38766}
2016-08-20 14:11:30 +00:00
gsathya
fc52e32361 [parser] Allow duplicate __proto__ keys in patterns
This patch subsumes CoverInitializedNameProduction to create an ObjectLiteralProduction which is now used to report the duplicate proto error as well.

This patch also changes ObjectLiteralChecker::CheckProperty
to record an ObjectLiteralProduction error instead of
bailing out immediately. Once we realize that we're in a
pattern, we rewind the error, otherwise we report the
error.

BUG=v8:5121

Review-Url: https://codereview.chromium.org/2255353002
Cr-Commit-Position: refs/heads/master@{#38764}
2016-08-20 01:01:51 +00:00
adamk
7da873b73f Remove unused default argument value in ExpressionClassifier::Accumulate
Also removed the "StandardProductions" enum value as its name is unhelpful
in deciding when to use it (and it only had a single reference).

R=gsathya@chromium.org

Review-Url: https://codereview.chromium.org/2260183003
Cr-Commit-Position: refs/heads/master@{#38763}
2016-08-19 19:53:38 +00:00
lpy
0c95efb7b7 Fix not throwing error when redefine eval or arguments in strict mode.
Currently when redefining eval or arguments in non-simple parameter list and
destructuring binding, V8 doesn't throw any error, this patch fixes it.

BUG=v8:5201
LOG=N

Review-Url: https://codereview.chromium.org/2185223002
Cr-Commit-Position: refs/heads/master@{#38762}
2016-08-19 19:48:17 +00:00
verwaest
d814ca8d29 Dont track scope_inside_with_ explicitly
This is only needed to set a flag on the SharedFunctionInfo generated for a function literal. Hence we only need it in 1 scope, and only read it once. Recursing in that case will be more efficient than always tracking it.

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2261693002
Cr-Commit-Position: refs/heads/master@{#38761}
2016-08-19 18:37:04 +00:00
bradnelson
561bfcb70d [wasm] asm.js - Check stdlib.NaN is valid, prepare for the rest.
Record which asm.js stdlib members are used and add a check that NaN is actually correctly set. Other stdlib members to be added in a later change.

Also add a stdlib argument to Wasm.instantiateModuleFromAsm, in preparation for that function to be replaced by normal asm.js instantiation.

BUG= https://bugs.chromium.org/p/v8/issues/detail?id=4203
LOG=N
R=jpp@chromium.org,titzer@chromium.org

Review-Url: https://codereview.chromium.org/2251433002
Cr-Commit-Position: refs/heads/master@{#38760}
2016-08-19 18:26:24 +00:00
krasin
e3ad26fee6 Disable CFI on a few methods.
While they have not been observed to slow down real-world use cases,
some blink_layout microbenchmarks feel better with these methods
disabled. In order to be concervative at the launch time, lift
the CFI defense for these methods.

8/10 of these methods will become much faster when an optimization
proposed in https://crbug.com/638056 -- we only need to load vptr
once (before the loop) and have a single CFI check instead of
a check per iteration.

BUG=638056,634139

Review-Url: https://codereview.chromium.org/2258003002
Cr-Commit-Position: refs/heads/master@{#38759}
2016-08-19 16:31:46 +00:00
jgruber
70a54d46b3 [turbofan] Inline calls to CPP builtins
BUG=

Review-Url: https://codereview.chromium.org/2259883002
Cr-Commit-Position: refs/heads/master@{#38758}
2016-08-19 15:37:24 +00:00
ivica.bogosavljevic
9092f8ac86 MIPS64: Fix [wasm] Support validation of asm.js modules with != 3 args.
Fix d0e52555f0

Typo in builtin-mips64.cc caused crashes in test mjsunit/asm/asm-validation.js

TEST=mjsunit/asm/asm-validation
BUG=

Review-Url: https://codereview.chromium.org/2258093002
Cr-Commit-Position: refs/heads/master@{#38757}
2016-08-19 15:26:34 +00:00
vogelheim
b68df2d270 Fix Scanner invariants w/ literal buffers.
This isn't the most elegant fix, but I'd prefer to not rework the logic
right now. What happens is:
- Most parts of the Scanner use nullptr to mean, no literal buffer.
- The bookmarking logic may end up with a state where there's a non-nullptr
  literal buffer, but it's empty. (length 0)
- These are functionally equivalent, so there's no 'real' bug.
- But it makes it hard to reason. This patch hence checks for length-0
  literal buffers, and uses nullptr instead.

R=marja@chromium.org
BUG=chromium:639191 v8:4947

Review-Url: https://codereview.chromium.org/2258073003
Cr-Commit-Position: refs/heads/master@{#38756}
2016-08-19 15:25:23 +00:00
neis
9bc44ff086 Add some scope-related DCHECKs.
R=adamk@chromium.org, verwaest@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2263523002
Cr-Commit-Position: refs/heads/master@{#38755}
2016-08-19 15:24:12 +00:00
jbroman
20a8ef0b92 Blink-compatible deserialization of "version 0" sparse arrays.
Version 0 dense arrays cannot be deserialized by current Chromium, which
suggests that this is not necessary.

BUG=chromium:148757

Review-Url: https://codereview.chromium.org/2256413002
Cr-Commit-Position: refs/heads/master@{#38754}
2016-08-19 13:40:14 +00:00
verwaest
10c72887b5 Move asm_module_ and asm_function_ down to DeclarationScope
BUG=v8:5209

Review-Url: https://codereview.chromium.org/2253913002
Cr-Commit-Position: refs/heads/master@{#38753}
2016-08-19 13:29:34 +00:00
bgeron
b0ce5d9daa [turbofan] Give different functions different names.
BUG=

Review-Url: https://codereview.chromium.org/2255973004
Cr-Commit-Position: refs/heads/master@{#38752}
2016-08-19 13:25:13 +00:00
epertoso
6949acab5c [interpreter] Record type feedback in the handlers for Inc and Dec.
BUG=v8:5273
R=rmcilroy@chromium.org

Review-Url: https://codereview.chromium.org/2250513005
Cr-Commit-Position: refs/heads/master@{#38751}
2016-08-19 12:58:59 +00:00
hpayer
870763f5ce [heap] Don't clear black areas in Heap::AllocateFillerObject.
BUG=chromium:630386

Review-Url: https://codereview.chromium.org/2258083002
Cr-Commit-Position: refs/heads/master@{#38750}
2016-08-19 12:27:34 +00:00
marija.antic
e1c5d09bda MIPS: Implement Neg_d and Neg_s instruction macros.
Implement Neg_d and Neg_s in macro-assembler.
Floating point negate instructions are removed in release 6.
On r2, these instructoin do not change the sign of NaN operands.

TEST=cctest/test-run-wasm/RunWasmCompiled_Float32Neg, cctest/test-run-wasm/RunWasmCompiled_Float64Neg
BUG=

Review-Url: https://codereview.chromium.org/2256963003
Cr-Commit-Position: refs/heads/master@{#38749}
2016-08-19 11:32:31 +00:00
bgeron
21f2eb6c48 [turbolizer] Also escape backslashes in JSON strings.
BUG=

Review-Url: https://codereview.chromium.org/2255263002
Cr-Commit-Position: refs/heads/master@{#38748}
2016-08-19 10:54:24 +00:00
mstarzinger
4598d9139e [interpreter] Fix self-healing with preserved bytecode.
This fixes the self-healing mechanism for closures in the interpreter
entry trampoline not that bytecode can be preserved even when baseline
code is already available.

R=rmcilroy@chromium.org
TEST=cctest/test-compiler/IgnitionEntryTrampolineSelfHealing
BUG=chromium:638225

Review-Url: https://codereview.chromium.org/2257143002
Cr-Commit-Position: refs/heads/master@{#38747}
2016-08-19 10:34:23 +00:00
bmeurer
99edc1b8e7 [turbofan] Unify Int32Add/Sub representation selection rules.
Unify the representation selection rules for NumberAdd/Subtract and
SpeculativeNumberAdd/Subtract wrt. Int32Add/Sub selection. We can
safely use Int32Add/Sub as long as the inputs are in the safe additive
integer range and the output is either truncated to Word32 or provably
in Signed32 or Unsigned32 range.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2253293005
Cr-Commit-Position: refs/heads/master@{#38746}
2016-08-19 09:50:22 +00:00
peterssen
f4e92fe13e Add ToSmi and Goto operations to FastAccessorAssembler.
BUG=chromium:508898

Review-Url: https://codereview.chromium.org/2237443002
Cr-Commit-Position: refs/heads/master@{#38745}
2016-08-19 09:35:17 +00:00
klaasb
e4c67d3f70 [interpreter] Use VisitForTest for loop conditions
Changes the control flow builder classes to make use of the
BytecodeLabels helper class.

BUG=v8:4280
LOG=n

Review-Url: https://codereview.chromium.org/2254493002
Cr-Commit-Position: refs/heads/master@{#38744}
2016-08-19 09:22:44 +00:00
franzih
a305726686 [compiler] Delete unused variable.
BUG=

Review-Url: https://codereview.chromium.org/2257393002
Cr-Commit-Position: refs/heads/master@{#38743}
2016-08-19 09:11:57 +00:00
ahaas
bb187a106e [wasm] Add stack checks at the beginning of each function.
TEST=mjsunit/wasm/stack.js:testStackOverflow

R=titzer@chromium.org

Review-Url: https://codereview.chromium.org/2256603002
Cr-Commit-Position: refs/heads/master@{#38742}
2016-08-19 08:54:39 +00:00