Commit Graph

28802 Commits

Author SHA1 Message Date
littledan
60eb0fdf61 Make TypedArray.from and TypedArray.of writable and configurable
BUG=v8:4315
R=adamk
LOG=Y

Review URL: https://codereview.chromium.org/1734223004

Cr-Commit-Position: refs/heads/master@{#34310}
2016-02-26 04:39:54 +00:00
v8-autoroll
4461af8f79 Update V8 DEPS.
Rolling v8/base/trace_event/common to 81b7b6f531ad2375140b2a5f4d3a803e5ba2514c

Rolling v8/buildtools to 14288a03a92856fe1fc296d39e6a25c2d83cd6cf

Rolling v8/tools/swarming_client to a72f46e42dba1335e8001499b4621acad2d26728

TBR=machenbach@chromium.org,vogelheim@chromium.org,hablich@chromium.org

Review URL: https://codereview.chromium.org/1737243003

Cr-Commit-Position: refs/heads/master@{#34309}
2016-02-26 04:19:17 +00:00
adamk
fca68bac47 Revert of [compiler] Drop the CompareNilIC. (patchset #4 id:60001 of https://codereview.chromium.org/1722193002/ )
Reason for revert:
Speculative revert in attempt to fix #2 crasher on canary.

Original issue's description:
> [compiler] Drop the CompareNilIC.
>
> Since both null and undefined are also marked as undetectable now, we
> can just test that bit instead of having the CompareNilIC try to collect
> feedback to speed up the general case (without the undetectable bit
> being used).
>
> Drive-by-fix: Update the type system to match the new handling of
> undetectable in the runtime.
>
> R=danno@chromium.org
>
> Committed: https://crrev.com/666aec0348c8793e61c8633dee7ad29a514239ba
> Cr-Commit-Position: refs/heads/master@{#34237}

TBR=danno@chromium.org,verwaest@chromium.org,bmeurer@chromium.org
LOG=y
BUG=chromium:589897
NOTRY=true

Review URL: https://codereview.chromium.org/1743433002

Cr-Commit-Position: refs/heads/master@{#34308}
2016-02-26 00:16:54 +00:00
littledan
227fd1d4ed Ship ES2015 iterator finalization
This patch moves iterator finalization (calling .return() when a
for-of loop exits early) to shipping. The only part of this feature
which is currently known to be missing is destructuring--.return()
should be also be called when destructuring with an array which
does not end in a rest pattern, but it currently does not. The rest
of this feature, including calling .return() from certain builtins,
is implemented.

R=adamk
BUG=v8:3566
LOG=Y

Review URL: https://codereview.chromium.org/1738463003

Cr-Commit-Position: refs/heads/master@{#34307}
2016-02-25 23:16:53 +00:00
mbrandy
4da2e3dbcf PPC: [runtime] Unify comparison operator runtime entries.
Port 55b4df7357

Original commit message:
    Only use one set of %StrictEquals/%StrictNotEquals and
    %Equals/%NotEquals runtime entries for both the interpreter
    and the old-style CompareICStub. The long-term plan is to
    update the CompareICStub to also return boolean values, and
    even allow some more code sharing with the interpreter there.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1737853002

Cr-Commit-Position: refs/heads/master@{#34306}
2016-02-25 21:52:33 +00:00
dgozman
66b87c00b8 Introduce MicrotasksCompletedCallback.
This calback is run after an attempt to run microtasks.

BUG=chromium:585949
LOG=Y

Review URL: https://codereview.chromium.org/1731773005

Cr-Commit-Position: refs/heads/master@{#34305}
2016-02-25 19:49:53 +00:00
ulan
b0a804da4f [api] Clarify the limits of ResourceConstraints.
BUG=v8:4781
LOG=NO

Review URL: https://codereview.chromium.org/1740533004

Cr-Commit-Position: refs/heads/master@{#34304}
2016-02-25 19:21:34 +00:00
bmeurer
55b4df7357 [runtime] Unify comparison operator runtime entries.
Only use one set of %StrictEquals/%StrictNotEquals and
%Equals/%NotEquals runtime entries for both the interpreter
and the old-style CompareICStub. The long-term plan is to
update the CompareICStub to also return boolean values, and
even allow some more code sharing with the interpreter there.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/1738883002

Cr-Commit-Position: refs/heads/master@{#34303}
2016-02-25 19:12:38 +00:00
ulan
01b8fc894b Reland "Replace slots buffer with remembered set. (patchset #14 id:250001 of https://codereview.chromium.org/1703823002/ )"
This reverts commit 9146bc5e20.

This contains a fix for the following crash:
1. We record slots for a fixed array.
2. We trim the fixed array, so that some recorded slots are now in free space.
3. During mark-compact we sweep the page with the fixed array. Now free list items contain memory with recorded slots.
4. We evacuate a byte array using the new free list items.
5. We iterate slots that are now inside the byte array and crash.

BUG=chromium:589413,chromium:578883
LOG=NO

Review URL: https://codereview.chromium.org/1735523002

Cr-Commit-Position: refs/heads/master@{#34302}
2016-02-25 17:29:22 +00:00
alan.li
e9495433aa MIPS64: Fix '[turbofan] Introduce DeoptimizeIf And DeoptimizeUnless common
operators.'

Port c129aa4d39

Original commit message:
These macro operators represent a conditional eager deoptimization exit
without explicit branching, which greatly reduces overhead of both
scheduling and register allocation, and thereby greatly reduces overall
compilation time, esp. when there are a lot of eager deoptimization
exits.

BUG=
TEST=mjsunit/asm/embenchen/fasta

Review URL: https://codereview.chromium.org/1736653003

Cr-Commit-Position: refs/heads/master@{#34301}
2016-02-25 16:51:05 +00:00
alan.li
50a394df2b MIPS64: Fix 'MIPS: use DAHI/DATH for li macro on mips64r6.'
Port 1f5b84e467

TEST=test-run-machops/RunInt64SubWithOverflowImm, test-run-machops/RunInt64AddWithOverflowImm
BUG=

Review URL: https://codereview.chromium.org/1714283002

Cr-Commit-Position: refs/heads/master@{#34300}
2016-02-25 16:47:27 +00:00
mstarzinger
bbd60c5d71 [interpreter] Enable tests on x64-debug that no longer fail.
R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1733363002

Cr-Commit-Position: refs/heads/master@{#34299}
2016-02-25 16:45:53 +00:00
mattloring
7bc1577a0b Fix iterator (std::vector) invalidation during sampling heap profile retrieval
It is possible for JS objects to be allocated while we are retrieving the
profile. These JS objects can in turn end up getting sampled by the profiler.
Adding these to the profile data structures invalidates the iterators that
are presently in flight. This change prevents such concurrent modifications
from affecting the retrieve operation.

BUG=

Review URL: https://codereview.chromium.org/1735733002

Cr-Commit-Position: refs/heads/master@{#34298}
2016-02-25 16:08:55 +00:00
mstarzinger
6acee6ee59 [interpreter] Make setting of function data more resilient.
This adds explicit setters for the SharedFunctionInfo::function_data
field. Such setters are safer because they allow for explicit checking
of which values are allowed, and they improve readability because the
intended semantics become clear for each call-site. Also fix a cctest
case along the way.

R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1730853005

Cr-Commit-Position: refs/heads/master@{#34297}
2016-02-25 16:07:24 +00:00
mtrofin
ac9f182746 [turbofan] don't take hints from deferred blocks
We should prefer hints from operands in non-deferred blocks, else we
risk sideways moves on the hot path, just to accommodate the register
allocator's choice of register assignment in the deferred block.

BUG=

Review URL: https://codereview.chromium.org/1718223002

Cr-Commit-Position: refs/heads/master@{#34296}
2016-02-25 15:41:14 +00:00
ulan
c5142d863b Clear recorded slots when creating filler objects.
BUG=chromium:589413
LOG=NO

Review URL: https://codereview.chromium.org/1733333002

Cr-Commit-Position: refs/heads/master@{#34295}
2016-02-25 14:37:20 +00:00
jochen
05ae2db706 Don't use Isolate::Current for AST debugging.
BUG=
R=littledan@chromium.org

Review URL: https://codereview.chromium.org/1735033002

Cr-Commit-Position: refs/heads/master@{#34294}
2016-02-25 13:50:55 +00:00
mstarzinger
ee4225fd0f [interpreter] Remove wholesale skipping of strong mode tests.
By now the deprecation of strong mode is far enough along that the
support present in the interpreter matches the support in the other
compilers. Special expectations aren't needed anymore.

R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1738653003

Cr-Commit-Position: refs/heads/master@{#34293}
2016-02-25 13:50:54 +00:00
bmeurer
19bad8a9f1 [Interpreter] Use FastCloneRegExpStub for CreateRegExpLiteral.
No need to go to the runtime to create a RegExp literal in Ignition, the
stub can handle everything.

R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1737633002

Cr-Commit-Position: refs/heads/master@{#34292}
2016-02-25 13:33:38 +00:00
yangguo
9d0d5fd20d [debugger] fix --print-break-location for multiline scripts.
We otherwise would print the \n from the last line.

R=vogelheim@chromium.org

Review URL: https://codereview.chromium.org/1738723003

Cr-Commit-Position: refs/heads/master@{#34291}
2016-02-25 13:01:20 +00:00
machenbach
e89a7b4797 [Swarming] Switch off test isolation check by default.
The steps are slow on dev workstations. Having them
run by the bots should be enough. The bots pass the mode
explicitly.

BUG=chromium:535160
LOG=n
TBR=tandrii@chromium.org, kjellander@chromium.org

Review URL: https://codereview.chromium.org/1738833002

Cr-Commit-Position: refs/heads/master@{#34290}
2016-02-25 12:55:41 +00:00
bmeurer
40bf2d7eee [Interpreter] Implement ForInStep directly.
The ForInStep bytecode is essentially a (guaranteed) Smi increment
operation. We can do not need to go to the runtime for this operation.

R=oth@chromium.org

Review URL: https://codereview.chromium.org/1738823002

Cr-Commit-Position: refs/heads/master@{#34289}
2016-02-25 12:49:35 +00:00
bmeurer
7ef9b6b88e [Interpreter] Use existing type conversion stubs.
We already have stubs for ToName, ToObject and ToNumber, so we can just
use them for Ignition instead of the generic runtime calls.

R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1736643003

Cr-Commit-Position: refs/heads/master@{#34288}
2016-02-25 12:15:55 +00:00
ahaas
fab253109d [wasm] I added comparison operators to the Int64Lowering.
Comparison operators are lowered using to a lexicographic ordering, e.g.
(a,b) <= (c,d) <<>> (a < c) | (a == c) & (b <= d).

R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1729263002

Cr-Commit-Position: refs/heads/master@{#34287}
2016-02-25 12:15:54 +00:00
mstarzinger
ee250655b4 Remove strong mode support from count operations.
R=bmeurer@chromium.org
BUG=v8:3956
LOG=n

Review URL: https://codereview.chromium.org/1736963002

Cr-Commit-Position: refs/heads/master@{#34286}
2016-02-25 12:13:01 +00:00
ssanfilippo
6ae030590d [Interpreter] Refactor bytecode generator test suite.
Bytecode expectations have been moved to external (.golden) files,
one per test. Each test in the suite builds a representation of the
the compiled bytecode using BytecodeExpectationsPrinter. The output is
then compared to the golden file. If the comparision fails, a textual
diff can be used to identify the discrepancies.

Only the test snippets are left in the cc file, which also allows to
make it more compact and meaningful. Leaving the snippets in the cc
file was a deliberate choice to allow keeping the "truth" about the
tests in the cc file, which will rarely change, as opposed to golden
files.

Golden files can be generated and kept up to date using
generate-bytecode-expectations, which also means that the test suite
can be batch updated whenever the bytecode or golden format changes.

The golden format has been slightly amended (no more comments about
`void*`, add size of the bytecode array) following the consideration
made while converting the tests.

There is also a fix: BytecodeExpectationsPrinter::top_level_ was left
uninitialized, leading to undefined behaviour.

BUG=v8:4280
LOG=N

Review URL: https://codereview.chromium.org/1717293002

Cr-Commit-Position: refs/heads/master@{#34285}
2016-02-25 12:07:19 +00:00
yangguo
6695290c5e [debugger] add utility to print break location.
This is to help debugging missing break locations.

R=vogelheim@chromium.org

Review URL: https://codereview.chromium.org/1732253002

Cr-Commit-Position: refs/heads/master@{#34284}
2016-02-25 12:00:08 +00:00
bmeurer
c81bbda7e4 [Interpreter] Implement TypeOf bytecode using the TypeofStub.
We already have a code stub that implements Typeof, so we don't
need a special runtime entry here to implement the TypeOf handler.

R=rmcilroy@chromium.org

Review URL: https://codereview.chromium.org/1732273002

Cr-Commit-Position: refs/heads/master@{#34283}
2016-02-25 11:41:41 +00:00
mythria
4d325854f2 [Interpreter] Handles stack overflow in interpreter.
Handles stack overflow in interpreter.
1. When visiting function literal, if the shared function
 info cannot be found we should return a stack overflow.
2. When visiting the ast graph, if stack overflow happens
 then all the ast nodes are not visited, so we need to have
appropriate handling in the AccumulatorResultScope and
RegisterResultScope.
3. MakeBytecode should not return a suceess unconditionally.
If there is a stack overflow, it should return false, so
RangeError can be thrown.

BUG=v8:4280,v8:4680
LOG=N

Review URL: https://codereview.chromium.org/1721983005

Cr-Commit-Position: refs/heads/master@{#34282}
2016-02-25 11:27:38 +00:00
machenbach
6809588a9a [Swarming] Only try to untar test262 on swarming.
Follow up after:
https://codereview.chromium.org/1713993002/

BUG=chromium:535160
LOG=n
TBR=tandrii@chromium.org, jkummerow@chromium.org

Review URL: https://codereview.chromium.org/1733273002

Cr-Commit-Position: refs/heads/master@{#34281}
2016-02-25 10:32:42 +00:00
machenbach
cbeaf19213 [test] Skip test for arm64 gc stress.
BUG=v8:4779
LOG=n
NOTRY=true
TBR=bmeurer@chromium.org, ulan@chromium.org

Review URL: https://codereview.chromium.org/1729263006

Cr-Commit-Position: refs/heads/master@{#34280}
2016-02-25 10:23:58 +00:00
ahaas
a6619c2c44 [wasm] Enable I64Neq on 32 bit platforms.
R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1724193003

Cr-Commit-Position: refs/heads/master@{#34279}
2016-02-25 10:12:42 +00:00
ahaas
5dc96ae28d [wasm] mips: Turn off signalling NaN tests on mips and mips64.
I turn the test off for now. The problem is that mips does not deal with
signalling NaNs as expected.

@v8-mips-ports: Could it be that the mips simulator deals differently
with signalling NaNs than the actual hardware? The implementation that
is tested in these tests assumes that sNaN * 1.0 = qNaN, where the bits
of sNaN and qNaN are equal except for the most significant mantissa bit.
This assumption holds for the simulator, but seems not to hold for actual
mips hardware. Do you know more about that?

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

Review URL: https://codereview.chromium.org/1735673003

Cr-Commit-Position: refs/heads/master@{#34278}
2016-02-25 09:50:38 +00:00
zhengxing.li
fbbe5ed147 X87: [fullcodegen] Implement control flow across do-expressions.
port ee8108b71c (r34246)

  original commit message:
  This implements proper handling of local control flow (i.e. break and
  continue) that spans the boundary of a do-expression. We can no longer
  determine the number of operands to be dropped from the nesting of
  statements alone, instead we use the new precise operand stack depth
  tracking.

BUG=

Review URL: https://codereview.chromium.org/1735853002

Cr-Commit-Position: refs/heads/master@{#34277}
2016-02-25 09:40:52 +00:00
machenbach
e55c5c06e2 [coverage] Filter some files from instrumentation.
This filters test and third_party files to get a speed-up
when running tests and when collecting profile data.

BUG=chromium:568949
LOG=n

Committed: https://crrev.com/761ee31be5ab4fde05c294e5d632608fbaea8ad4
Cr-Commit-Position: refs/heads/master@{#34216}

Committed: https://crrev.com/906db7448702a6ac9fab2a445c57cc85f6dd1b1a
Cr-Commit-Position: refs/heads/master@{#34253}

Committed: https://crrev.com/fe38ad573ee737e06a74b7fcd73f557ac0f1135a
Cr-Commit-Position: refs/heads/master@{#34272}

Review URL: https://codereview.chromium.org/1730543002

Cr-Commit-Position: refs/heads/master@{#34276}
2016-02-25 09:20:56 +00:00
machenbach
5683974925 Revert of [coverage] Filter some files from instrumentation. (patchset #4 id:60001 of https://codereview.chromium.org/1730543002/ )
Reason for revert:
Prevents using goma with make.

Original issue's description:
> [coverage] Filter some files from instrumentation.
>
> This filters test and third_party files to get a speed-up
> when running tests and when collecting profile data.
>
> BUG=chromium:568949
> LOG=n
>
> Committed: https://crrev.com/761ee31be5ab4fde05c294e5d632608fbaea8ad4
> Cr-Commit-Position: refs/heads/master@{#34216}
>
> Committed: https://crrev.com/906db7448702a6ac9fab2a445c57cc85f6dd1b1a
> Cr-Commit-Position: refs/heads/master@{#34253}
>
> Committed: https://crrev.com/fe38ad573ee737e06a74b7fcd73f557ac0f1135a
> Cr-Commit-Position: refs/heads/master@{#34272}

TBR=tandrii@chromium.org,kjellander@chromium.org,jfb@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:568949

Review URL: https://codereview.chromium.org/1733213002

Cr-Commit-Position: refs/heads/master@{#34275}
2016-02-25 08:21:48 +00:00
bmeurer
f97ed07e3a [builtins] Migrate a bunch of Math builtins to C++.
Migrate Math.imul, Math.fround, Math.acos, Math.asin and Math.atan to
C++ builtins, as these ones call into C++ anyway and so there's no
need to have this extra wrapper around it.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1731543004

Cr-Commit-Position: refs/heads/master@{#34274}
2016-02-25 08:07:07 +00:00
ishell
fcb83f2015 [crankshaft] [ia32] Remove dynamic frame alignment optimization.
This optimization does not give us much (see perf try bot results associated with this CL) but complicates things a lot. The main motivation is to avoid additional complexity in tail call optimization.

There are some pieces left in the deoptimizer, but I'll address this in a separate CL.

Review URL: https://codereview.chromium.org/1731273003

Cr-Commit-Position: refs/heads/master@{#34273}
2016-02-25 08:04:10 +00:00
machenbach
fe38ad573e [coverage] Filter some files from instrumentation.
This filters test and third_party files to get a speed-up
when running tests and when collecting profile data.

BUG=chromium:568949
LOG=n

Committed: https://crrev.com/761ee31be5ab4fde05c294e5d632608fbaea8ad4
Cr-Commit-Position: refs/heads/master@{#34216}

Committed: https://crrev.com/906db7448702a6ac9fab2a445c57cc85f6dd1b1a
Cr-Commit-Position: refs/heads/master@{#34253}

Review URL: https://codereview.chromium.org/1730543002

Cr-Commit-Position: refs/heads/master@{#34272}
2016-02-25 07:55:30 +00:00
mtrofin
ea16a752de [turbofan] removed "auto" from register-allocator-verifier
BUG=

Review URL: https://codereview.chromium.org/1740543002

Cr-Commit-Position: refs/heads/master@{#34271}
2016-02-25 07:45:11 +00:00
zhengxing.li
b915411c29 X87: [compiler] Drop the CompareNilIC.
port 666aec0348 (r34237)

  original commit message:
  Since both null and undefined are also marked as undetectable now, we
  can just test that bit instead of having the CompareNilIC try to collect
  feedback to speed up the general case (without the undetectable bit
  being used).

  Drive-by-fix: Update the type system to match the new handling of
  undetectable in the runtime.

BUG=

Review URL: https://codereview.chromium.org/1731383003

Cr-Commit-Position: refs/heads/master@{#34270}
2016-02-25 06:02:24 +00:00
jkummerow
01d228f3cd Tune Array.forEach, fix Array functions
When there is no receiver object, plain function calls are a few
percent faster than %_Call().
This patch also fixes the HAS_INDEX macro used in a bunch of
Array.prototype functions to properly check for elements inherited
from prototypes.

Review URL: https://codereview.chromium.org/1706213002

Cr-Commit-Position: refs/heads/master@{#34269}
2016-02-25 05:43:48 +00:00
jkummerow
2ae50119cb [runtime] Speed up C++ version of ArrayPush
Mostly by avoiding unnecessary Handle/HandleScope creation,
"length" property lookups, and length conversions.
This yields about 60% speedup on the microbenchmark I tested with.

Note that the C++ builtin is the middle performance tier of three,
so not every Array.push use case will be affected by this patch.

Review URL: https://codereview.chromium.org/1716833002

Cr-Commit-Position: refs/heads/master@{#34268}
2016-02-25 05:40:32 +00:00
mbrandy
e1bed4f936 PPC: [turbofan] Introduce DeoptimizeIf And DeoptimizeUnless common operators.
Port c129aa4d39

Original commit message:
    These macro operators represent a conditional eager deoptimization exit
    without explicit branching, which greatly reduces overhead of both
    scheduling and register allocation, and thereby greatly reduces overall
    compilation time, esp. when there are a lot of eager deoptimization
    exits.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1730383002

Cr-Commit-Position: refs/heads/master@{#34267}
2016-02-24 22:38:18 +00:00
mbrandy
546ea6b839 PPC: [compiler] Drop the CompareNilIC.
Port 666aec0348

Original commit message:
    Since both null and undefined are also marked as undetectable now, we
    can just test that bit instead of having the CompareNilIC try to collect
    feedback to speed up the general case (without the undetectable bit
    being used).

    Drive-by-fix: Update the type system to match the new handling of
    undetectable in the runtime.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1733663003

Cr-Commit-Position: refs/heads/master@{#34266}
2016-02-24 22:32:32 +00:00
v8-autoroll
24e85029ca Update V8 DEPS.
Rolling v8/tools/clang to 8598a726360f2722f4db0eab732a5f6b4cb41eb9

Rolling v8/tools/swarming_client to 71c61c858bb2c2deda83781978fe65e94171f58f

TBR=machenbach@chromium.org,vogelheim@chromium.org,hablich@chromium.org

Review URL: https://codereview.chromium.org/1729263004

Cr-Commit-Position: refs/heads/master@{#34265}
2016-02-24 20:38:46 +00:00
mbrandy
54d6d35a07 PPC: [fullcodegen] Implement control flow across do-expressions.
Port ee8108b71c

Original commit message:
    This implements proper handling of local control flow (i.e. break and
    continue) that spans the boundary of a do-expression. We can no longer
    determine the number of operands to be dropped from the nesting of
    statements alone, instead we use the new precise operand stack depth
    tracking.

R=mstarzinger@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
TEST=mjsunit/harmony/do-expressions-control
BUG=v8:4488
LOG=n

Review URL: https://codereview.chromium.org/1735623002

Cr-Commit-Position: refs/heads/master@{#34264}
2016-02-24 19:21:26 +00:00
mstarzinger
a0198f2cb6 [fullcodegen] Factor out EmitNewClosure from architectures.
This makes the aforementioned emitting function independent of the
target architecture by leveraging existing abstractions.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/1730243002

Cr-Commit-Position: refs/heads/master@{#34263}
2016-02-24 19:19:55 +00:00
littledan
1aee75551e Ensure IteratorClose is called for errors in non-declaring assignments
There was a bug in for-of loops without newly declared variables: If,
in performing the assignment, an exception were thrown, then
IteratorClose would not be called. The problem was that the assignment
is done as part of assign_each, which happens before the loop is put
back in the state which is recognized to be breaking/throwing/returning
early.

This patch modifies the for-of desugaring by setting the loop state
before, rather than after, evaluating the assign_each portion, which is
responsible for evaluating the assignment in for-of loops which do not
have a declaration.

This patch, together with https://codereview.chromium.org/1728973002 ,
allow all test262 iterator return-related tests to pass.

R=rossberg
BUG=v8:4776
LOG=Y

Review URL: https://codereview.chromium.org/1731773003

Cr-Commit-Position: refs/heads/master@{#34262}
2016-02-24 18:52:29 +00:00
littledan
5f67e34aed Fix priority of exceptions being thrown from for-of loops
In the for-of desugaring, IteratorClose is a subtle thing to get right.
When return exists, the logic for which exception to throw is as follows:
1. Get the 'return' property and property any exception that might come from
  the property read
2. Call return, not yet propagating an exception if it's thrown.
3. If we are closing the iterator due to an exception, propagate that error.
4. If return threw, propagate that error.
5. Check if return's return value was not an object, and throw if so

Previously, we were effectively doing step 5 even if an exception "had already
been thrown" by step 3. Because this took place in a finally block, the exception
"won the race" and was the one propagated to the user. The fix is a simple change
to the desugaring to do step 5 only if step 3 didn't happen.

R=rossberg
BUG=v8:4775
LOG=Y

Review URL: https://codereview.chromium.org/1728973002

Cr-Commit-Position: refs/heads/master@{#34261}
2016-02-24 18:21:44 +00:00