libv8 3.10.8.0 → 3.11.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +10 -3
- data/ext/libv8/compiler.rb +46 -0
- data/ext/libv8/extconf.rb +5 -1
- data/ext/libv8/make.rb +13 -0
- data/lib/libv8/version.rb +1 -1
- data/patches/add-freebsd9-and-freebsd10-to-gyp-GetFlavor.patch +11 -0
- data/patches/src_platform-freebsd.cc.patch +10 -0
- data/vendor/v8/ChangeLog +124 -0
- data/vendor/v8/DEPS +27 -0
- data/vendor/v8/Makefile +7 -0
- data/vendor/v8/SConstruct +15 -2
- data/vendor/v8/build/common.gypi +129 -157
- data/vendor/v8/build/gyp_v8 +11 -25
- data/vendor/v8/build/standalone.gypi +9 -3
- data/vendor/v8/include/v8.h +5 -3
- data/vendor/v8/src/SConscript +1 -0
- data/vendor/v8/src/api.cc +4 -33
- data/vendor/v8/src/api.h +2 -2
- data/vendor/v8/src/arm/builtins-arm.cc +5 -4
- data/vendor/v8/src/arm/code-stubs-arm.cc +21 -14
- data/vendor/v8/src/arm/codegen-arm.cc +2 -2
- data/vendor/v8/src/arm/debug-arm.cc +3 -1
- data/vendor/v8/src/arm/full-codegen-arm.cc +3 -102
- data/vendor/v8/src/arm/ic-arm.cc +30 -33
- data/vendor/v8/src/arm/lithium-arm.cc +20 -7
- data/vendor/v8/src/arm/lithium-arm.h +10 -4
- data/vendor/v8/src/arm/lithium-codegen-arm.cc +106 -60
- data/vendor/v8/src/arm/macro-assembler-arm.cc +49 -39
- data/vendor/v8/src/arm/macro-assembler-arm.h +5 -4
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +115 -55
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +7 -6
- data/vendor/v8/src/arm/simulator-arm.h +6 -6
- data/vendor/v8/src/arm/stub-cache-arm.cc +64 -19
- data/vendor/v8/src/array.js +7 -3
- data/vendor/v8/src/ast.cc +11 -6
- data/vendor/v8/src/bootstrapper.cc +9 -11
- data/vendor/v8/src/builtins.cc +61 -31
- data/vendor/v8/src/code-stubs.cc +23 -9
- data/vendor/v8/src/code-stubs.h +1 -0
- data/vendor/v8/src/codegen.h +3 -3
- data/vendor/v8/src/compiler.cc +1 -1
- data/vendor/v8/src/contexts.h +2 -18
- data/vendor/v8/src/d8.cc +94 -93
- data/vendor/v8/src/d8.h +1 -1
- data/vendor/v8/src/debug-agent.cc +3 -3
- data/vendor/v8/src/debug.cc +41 -1
- data/vendor/v8/src/debug.h +50 -0
- data/vendor/v8/src/elements-kind.cc +134 -0
- data/vendor/v8/src/elements-kind.h +210 -0
- data/vendor/v8/src/elements.cc +356 -190
- data/vendor/v8/src/elements.h +36 -28
- data/vendor/v8/src/factory.cc +44 -4
- data/vendor/v8/src/factory.h +11 -7
- data/vendor/v8/src/flag-definitions.h +3 -0
- data/vendor/v8/src/frames.h +3 -0
- data/vendor/v8/src/full-codegen.cc +2 -1
- data/vendor/v8/src/func-name-inferrer.h +2 -0
- data/vendor/v8/src/globals.h +3 -0
- data/vendor/v8/src/heap-inl.h +16 -4
- data/vendor/v8/src/heap.cc +38 -32
- data/vendor/v8/src/heap.h +3 -17
- data/vendor/v8/src/hydrogen-instructions.cc +28 -5
- data/vendor/v8/src/hydrogen-instructions.h +142 -44
- data/vendor/v8/src/hydrogen.cc +160 -55
- data/vendor/v8/src/hydrogen.h +2 -0
- data/vendor/v8/src/ia32/assembler-ia32.h +3 -0
- data/vendor/v8/src/ia32/builtins-ia32.cc +5 -4
- data/vendor/v8/src/ia32/code-stubs-ia32.cc +22 -16
- data/vendor/v8/src/ia32/codegen-ia32.cc +2 -2
- data/vendor/v8/src/ia32/debug-ia32.cc +29 -2
- data/vendor/v8/src/ia32/full-codegen-ia32.cc +8 -101
- data/vendor/v8/src/ia32/ic-ia32.cc +23 -19
- data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +126 -80
- data/vendor/v8/src/ia32/lithium-codegen-ia32.h +2 -1
- data/vendor/v8/src/ia32/lithium-ia32.cc +15 -9
- data/vendor/v8/src/ia32/lithium-ia32.h +14 -6
- data/vendor/v8/src/ia32/macro-assembler-ia32.cc +50 -40
- data/vendor/v8/src/ia32/macro-assembler-ia32.h +5 -4
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +113 -43
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +9 -4
- data/vendor/v8/src/ia32/simulator-ia32.h +4 -4
- data/vendor/v8/src/ia32/stub-cache-ia32.cc +52 -14
- data/vendor/v8/src/ic.cc +77 -20
- data/vendor/v8/src/ic.h +18 -2
- data/vendor/v8/src/incremental-marking-inl.h +21 -5
- data/vendor/v8/src/incremental-marking.cc +35 -8
- data/vendor/v8/src/incremental-marking.h +12 -3
- data/vendor/v8/src/isolate.cc +12 -2
- data/vendor/v8/src/isolate.h +1 -1
- data/vendor/v8/src/jsregexp.cc +66 -26
- data/vendor/v8/src/jsregexp.h +60 -31
- data/vendor/v8/src/list-inl.h +8 -0
- data/vendor/v8/src/list.h +3 -0
- data/vendor/v8/src/lithium.cc +5 -2
- data/vendor/v8/src/liveedit.cc +57 -5
- data/vendor/v8/src/mark-compact-inl.h +17 -11
- data/vendor/v8/src/mark-compact.cc +100 -143
- data/vendor/v8/src/mark-compact.h +44 -20
- data/vendor/v8/src/messages.js +131 -99
- data/vendor/v8/src/mips/builtins-mips.cc +5 -4
- data/vendor/v8/src/mips/code-stubs-mips.cc +23 -15
- data/vendor/v8/src/mips/codegen-mips.cc +2 -2
- data/vendor/v8/src/mips/debug-mips.cc +3 -1
- data/vendor/v8/src/mips/full-codegen-mips.cc +4 -102
- data/vendor/v8/src/mips/ic-mips.cc +34 -36
- data/vendor/v8/src/mips/lithium-codegen-mips.cc +116 -68
- data/vendor/v8/src/mips/lithium-mips.cc +20 -7
- data/vendor/v8/src/mips/lithium-mips.h +11 -4
- data/vendor/v8/src/mips/macro-assembler-mips.cc +50 -39
- data/vendor/v8/src/mips/macro-assembler-mips.h +5 -4
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +110 -50
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +6 -5
- data/vendor/v8/src/mips/simulator-mips.h +5 -5
- data/vendor/v8/src/mips/stub-cache-mips.cc +66 -20
- data/vendor/v8/src/mksnapshot.cc +5 -1
- data/vendor/v8/src/objects-debug.cc +103 -6
- data/vendor/v8/src/objects-inl.h +215 -116
- data/vendor/v8/src/objects-printer.cc +13 -8
- data/vendor/v8/src/objects.cc +608 -331
- data/vendor/v8/src/objects.h +129 -94
- data/vendor/v8/src/parser.cc +16 -4
- data/vendor/v8/src/platform-freebsd.cc +1 -0
- data/vendor/v8/src/platform-linux.cc +9 -30
- data/vendor/v8/src/platform-posix.cc +28 -7
- data/vendor/v8/src/platform-win32.cc +15 -3
- data/vendor/v8/src/platform.h +2 -1
- data/vendor/v8/src/profile-generator-inl.h +25 -2
- data/vendor/v8/src/profile-generator.cc +300 -822
- data/vendor/v8/src/profile-generator.h +97 -214
- data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +2 -1
- data/vendor/v8/src/regexp-macro-assembler-irregexp.h +2 -2
- data/vendor/v8/src/regexp-macro-assembler-tracer.cc +6 -5
- data/vendor/v8/src/regexp-macro-assembler-tracer.h +1 -1
- data/vendor/v8/src/regexp-macro-assembler.cc +7 -3
- data/vendor/v8/src/regexp-macro-assembler.h +10 -2
- data/vendor/v8/src/regexp.js +6 -0
- data/vendor/v8/src/runtime.cc +265 -212
- data/vendor/v8/src/runtime.h +6 -5
- data/vendor/v8/src/scopes.cc +20 -0
- data/vendor/v8/src/scopes.h +6 -3
- data/vendor/v8/src/spaces.cc +0 -2
- data/vendor/v8/src/string-stream.cc +2 -2
- data/vendor/v8/src/v8-counters.h +0 -2
- data/vendor/v8/src/v8natives.js +2 -2
- data/vendor/v8/src/v8utils.h +6 -3
- data/vendor/v8/src/version.cc +1 -1
- data/vendor/v8/src/x64/assembler-x64.h +2 -1
- data/vendor/v8/src/x64/builtins-x64.cc +5 -4
- data/vendor/v8/src/x64/code-stubs-x64.cc +25 -16
- data/vendor/v8/src/x64/codegen-x64.cc +2 -2
- data/vendor/v8/src/x64/debug-x64.cc +14 -1
- data/vendor/v8/src/x64/disasm-x64.cc +1 -1
- data/vendor/v8/src/x64/full-codegen-x64.cc +10 -106
- data/vendor/v8/src/x64/ic-x64.cc +20 -16
- data/vendor/v8/src/x64/lithium-codegen-x64.cc +156 -79
- data/vendor/v8/src/x64/lithium-codegen-x64.h +2 -1
- data/vendor/v8/src/x64/lithium-x64.cc +18 -8
- data/vendor/v8/src/x64/lithium-x64.h +7 -2
- data/vendor/v8/src/x64/macro-assembler-x64.cc +50 -40
- data/vendor/v8/src/x64/macro-assembler-x64.h +5 -4
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +122 -51
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +17 -8
- data/vendor/v8/src/x64/simulator-x64.h +4 -4
- data/vendor/v8/src/x64/stub-cache-x64.cc +55 -17
- data/vendor/v8/test/cctest/cctest.status +1 -0
- data/vendor/v8/test/cctest/test-api.cc +24 -0
- data/vendor/v8/test/cctest/test-func-name-inference.cc +38 -0
- data/vendor/v8/test/cctest/test-heap-profiler.cc +21 -77
- data/vendor/v8/test/cctest/test-heap.cc +164 -3
- data/vendor/v8/test/cctest/test-list.cc +12 -0
- data/vendor/v8/test/cctest/test-mark-compact.cc +5 -5
- data/vendor/v8/test/cctest/test-regexp.cc +14 -8
- data/vendor/v8/test/cctest/testcfg.py +2 -0
- data/vendor/v8/test/mjsunit/accessor-map-sharing.js +176 -0
- data/vendor/v8/test/mjsunit/array-construct-transition.js +3 -3
- data/vendor/v8/test/mjsunit/array-literal-transitions.js +10 -10
- data/vendor/v8/test/mjsunit/big-array-literal.js +3 -0
- data/vendor/v8/test/mjsunit/compiler/inline-construct.js +4 -2
- data/vendor/v8/test/mjsunit/debug-liveedit-stack-padding.js +88 -0
- data/vendor/v8/test/mjsunit/elements-kind.js +4 -4
- data/vendor/v8/test/mjsunit/elements-transition-hoisting.js +2 -2
- data/vendor/v8/test/mjsunit/elements-transition.js +5 -5
- data/vendor/v8/test/mjsunit/error-constructors.js +68 -33
- data/vendor/v8/test/mjsunit/harmony/proxies.js +14 -6
- data/vendor/v8/test/mjsunit/mjsunit.status +1 -0
- data/vendor/v8/test/mjsunit/packed-elements.js +112 -0
- data/vendor/v8/test/mjsunit/regexp-capture-3.js +6 -0
- data/vendor/v8/test/mjsunit/regexp-global.js +132 -0
- data/vendor/v8/test/mjsunit/regexp.js +11 -0
- data/vendor/v8/test/mjsunit/regress/regress-117409.js +52 -0
- data/vendor/v8/test/mjsunit/regress/regress-126412.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-128018.js +35 -0
- data/vendor/v8/test/mjsunit/regress/regress-128146.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-1639-2.js +4 -1
- data/vendor/v8/test/mjsunit/regress/regress-1639.js +14 -8
- data/vendor/v8/test/mjsunit/regress/regress-1849.js +3 -3
- data/vendor/v8/test/mjsunit/regress/regress-1878.js +2 -2
- data/vendor/v8/test/mjsunit/regress/regress-2071.js +79 -0
- data/vendor/v8/test/mjsunit/regress/regress-2153.js +32 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-122271.js +4 -4
- data/vendor/v8/test/mjsunit/regress/regress-crbug-126414.js +32 -0
- data/vendor/v8/test/mjsunit/regress/regress-smi-only-concat.js +2 -2
- data/vendor/v8/test/mjsunit/regress/regress-transcendental.js +49 -0
- data/vendor/v8/test/mjsunit/stack-traces.js +14 -0
- data/vendor/v8/test/mjsunit/unbox-double-arrays.js +4 -3
- data/vendor/v8/test/test262/testcfg.py +6 -1
- data/vendor/v8/tools/check-static-initializers.sh +11 -3
- data/vendor/v8/tools/fuzz-harness.sh +92 -0
- data/vendor/v8/tools/grokdump.py +658 -67
- data/vendor/v8/tools/gyp/v8.gyp +21 -39
- data/vendor/v8/tools/js2c.py +3 -3
- data/vendor/v8/tools/jsmin.py +2 -2
- data/vendor/v8/tools/presubmit.py +2 -1
- data/vendor/v8/tools/test-wrapper-gypbuild.py +25 -11
- metadata +624 -612
data/vendor/v8/src/x64/ic-x64.cc
CHANGED
@@ -769,25 +769,25 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
|
|
769
769
|
__ CompareRoot(r9, Heap::kHeapNumberMapRootIndex);
|
770
770
|
__ j(not_equal, &non_double_value);
|
771
771
|
|
772
|
-
// Value is a double. Transition
|
772
|
+
// Value is a double. Transition FAST_SMI_ELEMENTS ->
|
773
773
|
// FAST_DOUBLE_ELEMENTS and complete the store.
|
774
|
-
__ LoadTransitionedArrayMapConditional(
|
774
|
+
__ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
|
775
775
|
FAST_DOUBLE_ELEMENTS,
|
776
776
|
rbx,
|
777
777
|
rdi,
|
778
778
|
&slow);
|
779
|
-
ElementsTransitionGenerator::
|
779
|
+
ElementsTransitionGenerator::GenerateSmiToDouble(masm, &slow);
|
780
780
|
__ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset));
|
781
781
|
__ jmp(&fast_double_without_map_check);
|
782
782
|
|
783
783
|
__ bind(&non_double_value);
|
784
|
-
// Value is not a double,
|
785
|
-
__ LoadTransitionedArrayMapConditional(
|
784
|
+
// Value is not a double, FAST_SMI_ELEMENTS -> FAST_ELEMENTS
|
785
|
+
__ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
|
786
786
|
FAST_ELEMENTS,
|
787
787
|
rbx,
|
788
788
|
rdi,
|
789
789
|
&slow);
|
790
|
-
ElementsTransitionGenerator::
|
790
|
+
ElementsTransitionGenerator::GenerateMapChangeElementsTransition(masm);
|
791
791
|
__ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset));
|
792
792
|
__ jmp(&finish_object_store);
|
793
793
|
|
@@ -1642,7 +1642,7 @@ void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) {
|
|
1642
1642
|
// Must return the modified receiver in eax.
|
1643
1643
|
if (!FLAG_trace_elements_transitions) {
|
1644
1644
|
Label fail;
|
1645
|
-
ElementsTransitionGenerator::
|
1645
|
+
ElementsTransitionGenerator::GenerateSmiToDouble(masm, &fail);
|
1646
1646
|
__ movq(rax, rdx);
|
1647
1647
|
__ Ret();
|
1648
1648
|
__ bind(&fail);
|
@@ -1741,11 +1741,11 @@ void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
|
|
1741
1741
|
|
1742
1742
|
// Activate inlined smi code.
|
1743
1743
|
if (previous_state == UNINITIALIZED) {
|
1744
|
-
PatchInlinedSmiCode(address());
|
1744
|
+
PatchInlinedSmiCode(address(), ENABLE_INLINED_SMI_CHECK);
|
1745
1745
|
}
|
1746
1746
|
}
|
1747
1747
|
|
1748
|
-
void PatchInlinedSmiCode(Address address) {
|
1748
|
+
void PatchInlinedSmiCode(Address address, InlinedSmiCheck check) {
|
1749
1749
|
// The address of the instruction following the call.
|
1750
1750
|
Address test_instruction_address =
|
1751
1751
|
address + Assembler::kCallTargetAddressOffset;
|
@@ -1766,14 +1766,18 @@ void PatchInlinedSmiCode(Address address) {
|
|
1766
1766
|
address, test_instruction_address, delta);
|
1767
1767
|
}
|
1768
1768
|
|
1769
|
-
// Patch with a short conditional jump.
|
1770
|
-
//
|
1769
|
+
// Patch with a short conditional jump. Enabling means switching from a short
|
1770
|
+
// jump-if-carry/not-carry to jump-if-zero/not-zero, whereas disabling is the
|
1771
|
+
// reverse operation of that.
|
1771
1772
|
Address jmp_address = test_instruction_address - delta;
|
1772
|
-
ASSERT(
|
1773
|
-
*jmp_address == Assembler::
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1773
|
+
ASSERT((check == ENABLE_INLINED_SMI_CHECK)
|
1774
|
+
? (*jmp_address == Assembler::kJncShortOpcode ||
|
1775
|
+
*jmp_address == Assembler::kJcShortOpcode)
|
1776
|
+
: (*jmp_address == Assembler::kJnzShortOpcode ||
|
1777
|
+
*jmp_address == Assembler::kJzShortOpcode));
|
1778
|
+
Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
|
1779
|
+
? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
|
1780
|
+
: (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
|
1777
1781
|
*jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
|
1778
1782
|
}
|
1779
1783
|
|
@@ -2223,41 +2223,35 @@ void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
|
|
2223
2223
|
Register result = ToRegister(instr->result());
|
2224
2224
|
|
2225
2225
|
int map_count = instr->hydrogen()->types()->length();
|
2226
|
-
|
2226
|
+
bool need_generic = instr->hydrogen()->need_generic();
|
2227
2227
|
|
2228
|
-
if (map_count == 0) {
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2228
|
+
if (map_count == 0 && !need_generic) {
|
2229
|
+
DeoptimizeIf(no_condition, instr->environment());
|
2230
|
+
return;
|
2231
|
+
}
|
2232
|
+
Handle<String> name = instr->hydrogen()->name();
|
2233
|
+
Label done;
|
2234
|
+
for (int i = 0; i < map_count; ++i) {
|
2235
|
+
bool last = (i == map_count - 1);
|
2236
|
+
Handle<Map> map = instr->hydrogen()->types()->at(i);
|
2237
|
+
__ Cmp(FieldOperand(object, HeapObject::kMapOffset), map);
|
2238
|
+
if (last && !need_generic) {
|
2239
|
+
DeoptimizeIf(not_equal, instr->environment());
|
2240
|
+
EmitLoadFieldOrConstantFunction(result, object, map, name);
|
2241
|
+
} else {
|
2237
2242
|
Label next;
|
2238
|
-
__ Cmp(FieldOperand(object, HeapObject::kMapOffset), map);
|
2239
2243
|
__ j(not_equal, &next, Label::kNear);
|
2240
2244
|
EmitLoadFieldOrConstantFunction(result, object, map, name);
|
2241
2245
|
__ jmp(&done, Label::kNear);
|
2242
2246
|
__ bind(&next);
|
2243
2247
|
}
|
2244
|
-
Handle<Map> map = instr->hydrogen()->types()->last();
|
2245
|
-
__ Cmp(FieldOperand(object, HeapObject::kMapOffset), map);
|
2246
|
-
if (instr->hydrogen()->need_generic()) {
|
2247
|
-
Label generic;
|
2248
|
-
__ j(not_equal, &generic, Label::kNear);
|
2249
|
-
EmitLoadFieldOrConstantFunction(result, object, map, name);
|
2250
|
-
__ jmp(&done, Label::kNear);
|
2251
|
-
__ bind(&generic);
|
2252
|
-
__ Move(rcx, instr->hydrogen()->name());
|
2253
|
-
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
2254
|
-
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
2255
|
-
} else {
|
2256
|
-
DeoptimizeIf(not_equal, instr->environment());
|
2257
|
-
EmitLoadFieldOrConstantFunction(result, object, map, name);
|
2258
|
-
}
|
2259
|
-
__ bind(&done);
|
2260
2248
|
}
|
2249
|
+
if (need_generic) {
|
2250
|
+
__ Move(rcx, name);
|
2251
|
+
Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
|
2252
|
+
CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
2253
|
+
}
|
2254
|
+
__ bind(&done);
|
2261
2255
|
}
|
2262
2256
|
|
2263
2257
|
|
@@ -2330,8 +2324,10 @@ void LCodeGen::DoLoadElements(LLoadElements* instr) {
|
|
2330
2324
|
__ movzxbq(temp, FieldOperand(temp, Map::kBitField2Offset));
|
2331
2325
|
__ and_(temp, Immediate(Map::kElementsKindMask));
|
2332
2326
|
__ shr(temp, Immediate(Map::kElementsKindShift));
|
2333
|
-
__ cmpl(temp, Immediate(
|
2334
|
-
__ j(
|
2327
|
+
__ cmpl(temp, Immediate(GetInitialFastElementsKind()));
|
2328
|
+
__ j(less, &fail, Label::kNear);
|
2329
|
+
__ cmpl(temp, Immediate(TERMINAL_FAST_ELEMENTS_KIND));
|
2330
|
+
__ j(less_equal, &ok, Label::kNear);
|
2335
2331
|
__ cmpl(temp, Immediate(FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND));
|
2336
2332
|
__ j(less, &fail, Label::kNear);
|
2337
2333
|
__ cmpl(temp, Immediate(LAST_EXTERNAL_ARRAY_ELEMENTS_KIND));
|
@@ -2375,11 +2371,20 @@ void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
|
|
2375
2371
|
void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
|
2376
2372
|
Register result = ToRegister(instr->result());
|
2377
2373
|
|
2374
|
+
if (instr->hydrogen()->IsDehoisted() && !instr->key()->IsConstantOperand()) {
|
2375
|
+
// Sign extend key because it could be a 32 bit negative value
|
2376
|
+
// and the dehoisted address computation happens in 64 bits.
|
2377
|
+
Register key_reg = ToRegister(instr->key());
|
2378
|
+
__ movsxlq(key_reg, key_reg);
|
2379
|
+
}
|
2380
|
+
|
2378
2381
|
// Load the result.
|
2379
2382
|
__ movq(result,
|
2380
|
-
BuildFastArrayOperand(instr->elements(),
|
2383
|
+
BuildFastArrayOperand(instr->elements(),
|
2384
|
+
instr->key(),
|
2381
2385
|
FAST_ELEMENTS,
|
2382
|
-
FixedArray::kHeaderSize - kHeapObjectTag
|
2386
|
+
FixedArray::kHeaderSize - kHeapObjectTag,
|
2387
|
+
instr->additional_index()));
|
2383
2388
|
|
2384
2389
|
// Check for the hole value.
|
2385
2390
|
if (instr->hydrogen()->RequiresHoleCheck()) {
|
@@ -2393,19 +2398,32 @@ void LCodeGen::DoLoadKeyedFastDoubleElement(
|
|
2393
2398
|
LLoadKeyedFastDoubleElement* instr) {
|
2394
2399
|
XMMRegister result(ToDoubleRegister(instr->result()));
|
2395
2400
|
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
2401
|
+
if (instr->hydrogen()->IsDehoisted() && !instr->key()->IsConstantOperand()) {
|
2402
|
+
// Sign extend key because it could be a 32 bit negative value
|
2403
|
+
// and the dehoisted address computation happens in 64 bits
|
2404
|
+
Register key_reg = ToRegister(instr->key());
|
2405
|
+
__ movsxlq(key_reg, key_reg);
|
2406
|
+
}
|
2407
|
+
|
2408
|
+
if (instr->hydrogen()->RequiresHoleCheck()) {
|
2409
|
+
int offset = FixedDoubleArray::kHeaderSize - kHeapObjectTag +
|
2410
|
+
sizeof(kHoleNanLower32);
|
2411
|
+
Operand hole_check_operand = BuildFastArrayOperand(
|
2412
|
+
instr->elements(),
|
2413
|
+
instr->key(),
|
2414
|
+
FAST_DOUBLE_ELEMENTS,
|
2415
|
+
offset,
|
2416
|
+
instr->additional_index());
|
2417
|
+
__ cmpl(hole_check_operand, Immediate(kHoleNanUpper32));
|
2418
|
+
DeoptimizeIf(equal, instr->environment());
|
2419
|
+
}
|
2420
|
+
|
2421
|
+
Operand double_load_operand = BuildFastArrayOperand(
|
2399
2422
|
instr->elements(),
|
2400
2423
|
instr->key(),
|
2401
2424
|
FAST_DOUBLE_ELEMENTS,
|
2402
|
-
|
2403
|
-
|
2404
|
-
DeoptimizeIf(equal, instr->environment());
|
2405
|
-
|
2406
|
-
Operand double_load_operand = BuildFastArrayOperand(
|
2407
|
-
instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS,
|
2408
|
-
FixedDoubleArray::kHeaderSize - kHeapObjectTag);
|
2425
|
+
FixedDoubleArray::kHeaderSize - kHeapObjectTag,
|
2426
|
+
instr->additional_index());
|
2409
2427
|
__ movsd(result, double_load_operand);
|
2410
2428
|
}
|
2411
2429
|
|
@@ -2414,7 +2432,8 @@ Operand LCodeGen::BuildFastArrayOperand(
|
|
2414
2432
|
LOperand* elements_pointer,
|
2415
2433
|
LOperand* key,
|
2416
2434
|
ElementsKind elements_kind,
|
2417
|
-
uint32_t offset
|
2435
|
+
uint32_t offset,
|
2436
|
+
uint32_t additional_index) {
|
2418
2437
|
Register elements_pointer_reg = ToRegister(elements_pointer);
|
2419
2438
|
int shift_size = ElementsKindToShiftSize(elements_kind);
|
2420
2439
|
if (key->IsConstantOperand()) {
|
@@ -2423,11 +2442,14 @@ Operand LCodeGen::BuildFastArrayOperand(
|
|
2423
2442
|
Abort("array index constant value too big");
|
2424
2443
|
}
|
2425
2444
|
return Operand(elements_pointer_reg,
|
2426
|
-
constant_value
|
2445
|
+
((constant_value + additional_index) << shift_size)
|
2446
|
+
+ offset);
|
2427
2447
|
} else {
|
2428
2448
|
ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
|
2429
|
-
return Operand(elements_pointer_reg,
|
2430
|
-
|
2449
|
+
return Operand(elements_pointer_reg,
|
2450
|
+
ToRegister(key),
|
2451
|
+
scale_factor,
|
2452
|
+
offset + (additional_index << shift_size));
|
2431
2453
|
}
|
2432
2454
|
}
|
2433
2455
|
|
@@ -2436,7 +2458,17 @@ void LCodeGen::DoLoadKeyedSpecializedArrayElement(
|
|
2436
2458
|
LLoadKeyedSpecializedArrayElement* instr) {
|
2437
2459
|
ElementsKind elements_kind = instr->elements_kind();
|
2438
2460
|
Operand operand(BuildFastArrayOperand(instr->external_pointer(),
|
2439
|
-
instr->key(),
|
2461
|
+
instr->key(),
|
2462
|
+
elements_kind,
|
2463
|
+
0,
|
2464
|
+
instr->additional_index()));
|
2465
|
+
if (instr->hydrogen()->IsDehoisted() && !instr->key()->IsConstantOperand()) {
|
2466
|
+
// Sign extend key because it could be a 32 bit negative value
|
2467
|
+
// and the dehoisted address computation happens in 64 bits
|
2468
|
+
Register key_reg = ToRegister(instr->key());
|
2469
|
+
__ movsxlq(key_reg, key_reg);
|
2470
|
+
}
|
2471
|
+
|
2440
2472
|
if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
|
2441
2473
|
XMMRegister result(ToDoubleRegister(instr->result()));
|
2442
2474
|
__ movss(result, operand);
|
@@ -2473,8 +2505,11 @@ void LCodeGen::DoLoadKeyedSpecializedArrayElement(
|
|
2473
2505
|
case EXTERNAL_FLOAT_ELEMENTS:
|
2474
2506
|
case EXTERNAL_DOUBLE_ELEMENTS:
|
2475
2507
|
case FAST_ELEMENTS:
|
2476
|
-
case
|
2508
|
+
case FAST_SMI_ELEMENTS:
|
2477
2509
|
case FAST_DOUBLE_ELEMENTS:
|
2510
|
+
case FAST_HOLEY_ELEMENTS:
|
2511
|
+
case FAST_HOLEY_SMI_ELEMENTS:
|
2512
|
+
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
2478
2513
|
case DICTIONARY_ELEMENTS:
|
2479
2514
|
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
2480
2515
|
UNREACHABLE();
|
@@ -3283,7 +3318,22 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
|
|
3283
3318
|
int offset = instr->offset();
|
3284
3319
|
|
3285
3320
|
if (!instr->transition().is_null()) {
|
3286
|
-
|
3321
|
+
if (!instr->hydrogen()->NeedsWriteBarrierForMap()) {
|
3322
|
+
__ Move(FieldOperand(object, HeapObject::kMapOffset),
|
3323
|
+
instr->transition());
|
3324
|
+
} else {
|
3325
|
+
Register temp = ToRegister(instr->TempAt(0));
|
3326
|
+
__ Move(kScratchRegister, instr->transition());
|
3327
|
+
__ movq(FieldOperand(object, HeapObject::kMapOffset), kScratchRegister);
|
3328
|
+
// Update the write barrier for the map field.
|
3329
|
+
__ RecordWriteField(object,
|
3330
|
+
HeapObject::kMapOffset,
|
3331
|
+
kScratchRegister,
|
3332
|
+
temp,
|
3333
|
+
kSaveFPRegs,
|
3334
|
+
OMIT_REMEMBERED_SET,
|
3335
|
+
OMIT_SMI_CHECK);
|
3336
|
+
}
|
3287
3337
|
}
|
3288
3338
|
|
3289
3339
|
// Do the store.
|
@@ -3338,7 +3388,18 @@ void LCodeGen::DoStoreKeyedSpecializedArrayElement(
|
|
3338
3388
|
LStoreKeyedSpecializedArrayElement* instr) {
|
3339
3389
|
ElementsKind elements_kind = instr->elements_kind();
|
3340
3390
|
Operand operand(BuildFastArrayOperand(instr->external_pointer(),
|
3341
|
-
instr->key(),
|
3391
|
+
instr->key(),
|
3392
|
+
elements_kind,
|
3393
|
+
0,
|
3394
|
+
instr->additional_index()));
|
3395
|
+
|
3396
|
+
if (instr->hydrogen()->IsDehoisted() && !instr->key()->IsConstantOperand()) {
|
3397
|
+
// Sign extend key because it could be a 32 bit negative value
|
3398
|
+
// and the dehoisted address computation happens in 64 bits
|
3399
|
+
Register key_reg = ToRegister(instr->key());
|
3400
|
+
__ movsxlq(key_reg, key_reg);
|
3401
|
+
}
|
3402
|
+
|
3342
3403
|
if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
|
3343
3404
|
XMMRegister value(ToDoubleRegister(instr->value()));
|
3344
3405
|
__ cvtsd2ss(value, value);
|
@@ -3364,8 +3425,11 @@ void LCodeGen::DoStoreKeyedSpecializedArrayElement(
|
|
3364
3425
|
case EXTERNAL_FLOAT_ELEMENTS:
|
3365
3426
|
case EXTERNAL_DOUBLE_ELEMENTS:
|
3366
3427
|
case FAST_ELEMENTS:
|
3367
|
-
case
|
3428
|
+
case FAST_SMI_ELEMENTS:
|
3368
3429
|
case FAST_DOUBLE_ELEMENTS:
|
3430
|
+
case FAST_HOLEY_ELEMENTS:
|
3431
|
+
case FAST_HOLEY_SMI_ELEMENTS:
|
3432
|
+
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
3369
3433
|
case DICTIONARY_ELEMENTS:
|
3370
3434
|
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
3371
3435
|
UNREACHABLE();
|
@@ -3408,30 +3472,29 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
|
|
3408
3472
|
Register elements = ToRegister(instr->object());
|
3409
3473
|
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
|
3410
3474
|
|
3411
|
-
|
3412
|
-
|
3413
|
-
|
3414
|
-
|
3415
|
-
|
3416
|
-
|
3417
|
-
|
3418
|
-
|
3419
|
-
|
3420
|
-
|
3421
|
-
|
3422
|
-
|
3423
|
-
value);
|
3475
|
+
Operand operand =
|
3476
|
+
BuildFastArrayOperand(instr->object(),
|
3477
|
+
instr->key(),
|
3478
|
+
FAST_ELEMENTS,
|
3479
|
+
FixedArray::kHeaderSize - kHeapObjectTag,
|
3480
|
+
instr->additional_index());
|
3481
|
+
|
3482
|
+
if (instr->hydrogen()->IsDehoisted() && !instr->key()->IsConstantOperand()) {
|
3483
|
+
// Sign extend key because it could be a 32 bit negative value
|
3484
|
+
// and the dehoisted address computation happens in 64 bits
|
3485
|
+
Register key_reg = ToRegister(instr->key());
|
3486
|
+
__ movsxlq(key_reg, key_reg);
|
3424
3487
|
}
|
3425
3488
|
|
3489
|
+
__ movq(operand, value);
|
3490
|
+
|
3426
3491
|
if (instr->hydrogen()->NeedsWriteBarrier()) {
|
3492
|
+
ASSERT(!instr->key()->IsConstantOperand());
|
3427
3493
|
HType type = instr->hydrogen()->value()->type();
|
3428
3494
|
SmiCheck check_needed =
|
3429
3495
|
type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
|
3430
3496
|
// Compute address of modified element and store it into key register.
|
3431
|
-
__ lea(key,
|
3432
|
-
key,
|
3433
|
-
times_pointer_size,
|
3434
|
-
FixedArray::kHeaderSize));
|
3497
|
+
__ lea(key, operand);
|
3435
3498
|
__ RecordWrite(elements,
|
3436
3499
|
key,
|
3437
3500
|
value,
|
@@ -3460,8 +3523,19 @@ void LCodeGen::DoStoreKeyedFastDoubleElement(
|
|
3460
3523
|
}
|
3461
3524
|
|
3462
3525
|
Operand double_store_operand = BuildFastArrayOperand(
|
3463
|
-
instr->elements(),
|
3464
|
-
|
3526
|
+
instr->elements(),
|
3527
|
+
instr->key(),
|
3528
|
+
FAST_DOUBLE_ELEMENTS,
|
3529
|
+
FixedDoubleArray::kHeaderSize - kHeapObjectTag,
|
3530
|
+
instr->additional_index());
|
3531
|
+
|
3532
|
+
if (instr->hydrogen()->IsDehoisted() && !instr->key()->IsConstantOperand()) {
|
3533
|
+
// Sign extend key because it could be a 32 bit negative value
|
3534
|
+
// and the dehoisted address computation happens in 64 bits
|
3535
|
+
Register key_reg = ToRegister(instr->key());
|
3536
|
+
__ movsxlq(key_reg, key_reg);
|
3537
|
+
}
|
3538
|
+
|
3465
3539
|
__ movsd(double_store_operand, value);
|
3466
3540
|
}
|
3467
3541
|
|
@@ -3490,21 +3564,22 @@ void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) {
|
|
3490
3564
|
__ Cmp(FieldOperand(object_reg, HeapObject::kMapOffset), from_map);
|
3491
3565
|
__ j(not_equal, ¬_applicable);
|
3492
3566
|
__ movq(new_map_reg, to_map, RelocInfo::EMBEDDED_OBJECT);
|
3493
|
-
if (from_kind
|
3567
|
+
if (IsSimpleMapChangeTransition(from_kind, to_kind)) {
|
3494
3568
|
__ movq(FieldOperand(object_reg, HeapObject::kMapOffset), new_map_reg);
|
3495
3569
|
// Write barrier.
|
3496
3570
|
ASSERT_NE(instr->temp_reg(), NULL);
|
3497
3571
|
__ RecordWriteField(object_reg, HeapObject::kMapOffset, new_map_reg,
|
3498
3572
|
ToRegister(instr->temp_reg()), kDontSaveFPRegs);
|
3499
|
-
} else if (from_kind
|
3500
|
-
|
3573
|
+
} else if (IsFastSmiElementsKind(from_kind) &&
|
3574
|
+
IsFastDoubleElementsKind(to_kind)) {
|
3501
3575
|
Register fixed_object_reg = ToRegister(instr->temp_reg());
|
3502
3576
|
ASSERT(fixed_object_reg.is(rdx));
|
3503
3577
|
ASSERT(new_map_reg.is(rbx));
|
3504
3578
|
__ movq(fixed_object_reg, object_reg);
|
3505
3579
|
CallCode(isolate()->builtins()->TransitionElementsSmiToDouble(),
|
3506
3580
|
RelocInfo::CODE_TARGET, instr);
|
3507
|
-
} else if (from_kind
|
3581
|
+
} else if (IsFastDoubleElementsKind(from_kind) &&
|
3582
|
+
IsFastObjectElementsKind(to_kind)) {
|
3508
3583
|
Register fixed_object_reg = ToRegister(instr->temp_reg());
|
3509
3584
|
ASSERT(fixed_object_reg.is(rdx));
|
3510
3585
|
ASSERT(new_map_reg.is(rbx));
|
@@ -4178,8 +4253,9 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
|
|
4178
4253
|
|
4179
4254
|
// Deopt if the array literal boilerplate ElementsKind is of a type different
|
4180
4255
|
// than the expected one. The check isn't necessary if the boilerplate has
|
4181
|
-
// already been converted to
|
4182
|
-
if (
|
4256
|
+
// already been converted to TERMINAL_FAST_ELEMENTS_KIND.
|
4257
|
+
if (CanTransitionToMoreGeneralFastElementsKind(
|
4258
|
+
boilerplate_elements_kind, true)) {
|
4183
4259
|
__ LoadHeapObject(rax, instr->hydrogen()->boilerplate_object());
|
4184
4260
|
__ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset));
|
4185
4261
|
// Load the map's "bit field 2".
|
@@ -4325,10 +4401,11 @@ void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
|
|
4325
4401
|
ElementsKind boilerplate_elements_kind =
|
4326
4402
|
instr->hydrogen()->boilerplate()->GetElementsKind();
|
4327
4403
|
|
4328
|
-
// Deopt if the literal boilerplate ElementsKind is of a type different
|
4329
|
-
// the expected one. The check isn't necessary if the boilerplate has
|
4330
|
-
// been converted to
|
4331
|
-
if (
|
4404
|
+
// Deopt if the array literal boilerplate ElementsKind is of a type different
|
4405
|
+
// than the expected one. The check isn't necessary if the boilerplate has
|
4406
|
+
// already been converted to TERMINAL_FAST_ELEMENTS_KIND.
|
4407
|
+
if (CanTransitionToMoreGeneralFastElementsKind(
|
4408
|
+
boilerplate_elements_kind, true)) {
|
4332
4409
|
__ LoadHeapObject(rbx, instr->hydrogen()->boilerplate());
|
4333
4410
|
__ movq(rcx, FieldOperand(rbx, HeapObject::kMapOffset));
|
4334
4411
|
// Load the map's "bit field 2".
|