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.
Files changed (215) hide show
  1. data/Rakefile +10 -3
  2. data/ext/libv8/compiler.rb +46 -0
  3. data/ext/libv8/extconf.rb +5 -1
  4. data/ext/libv8/make.rb +13 -0
  5. data/lib/libv8/version.rb +1 -1
  6. data/patches/add-freebsd9-and-freebsd10-to-gyp-GetFlavor.patch +11 -0
  7. data/patches/src_platform-freebsd.cc.patch +10 -0
  8. data/vendor/v8/ChangeLog +124 -0
  9. data/vendor/v8/DEPS +27 -0
  10. data/vendor/v8/Makefile +7 -0
  11. data/vendor/v8/SConstruct +15 -2
  12. data/vendor/v8/build/common.gypi +129 -157
  13. data/vendor/v8/build/gyp_v8 +11 -25
  14. data/vendor/v8/build/standalone.gypi +9 -3
  15. data/vendor/v8/include/v8.h +5 -3
  16. data/vendor/v8/src/SConscript +1 -0
  17. data/vendor/v8/src/api.cc +4 -33
  18. data/vendor/v8/src/api.h +2 -2
  19. data/vendor/v8/src/arm/builtins-arm.cc +5 -4
  20. data/vendor/v8/src/arm/code-stubs-arm.cc +21 -14
  21. data/vendor/v8/src/arm/codegen-arm.cc +2 -2
  22. data/vendor/v8/src/arm/debug-arm.cc +3 -1
  23. data/vendor/v8/src/arm/full-codegen-arm.cc +3 -102
  24. data/vendor/v8/src/arm/ic-arm.cc +30 -33
  25. data/vendor/v8/src/arm/lithium-arm.cc +20 -7
  26. data/vendor/v8/src/arm/lithium-arm.h +10 -4
  27. data/vendor/v8/src/arm/lithium-codegen-arm.cc +106 -60
  28. data/vendor/v8/src/arm/macro-assembler-arm.cc +49 -39
  29. data/vendor/v8/src/arm/macro-assembler-arm.h +5 -4
  30. data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +115 -55
  31. data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +7 -6
  32. data/vendor/v8/src/arm/simulator-arm.h +6 -6
  33. data/vendor/v8/src/arm/stub-cache-arm.cc +64 -19
  34. data/vendor/v8/src/array.js +7 -3
  35. data/vendor/v8/src/ast.cc +11 -6
  36. data/vendor/v8/src/bootstrapper.cc +9 -11
  37. data/vendor/v8/src/builtins.cc +61 -31
  38. data/vendor/v8/src/code-stubs.cc +23 -9
  39. data/vendor/v8/src/code-stubs.h +1 -0
  40. data/vendor/v8/src/codegen.h +3 -3
  41. data/vendor/v8/src/compiler.cc +1 -1
  42. data/vendor/v8/src/contexts.h +2 -18
  43. data/vendor/v8/src/d8.cc +94 -93
  44. data/vendor/v8/src/d8.h +1 -1
  45. data/vendor/v8/src/debug-agent.cc +3 -3
  46. data/vendor/v8/src/debug.cc +41 -1
  47. data/vendor/v8/src/debug.h +50 -0
  48. data/vendor/v8/src/elements-kind.cc +134 -0
  49. data/vendor/v8/src/elements-kind.h +210 -0
  50. data/vendor/v8/src/elements.cc +356 -190
  51. data/vendor/v8/src/elements.h +36 -28
  52. data/vendor/v8/src/factory.cc +44 -4
  53. data/vendor/v8/src/factory.h +11 -7
  54. data/vendor/v8/src/flag-definitions.h +3 -0
  55. data/vendor/v8/src/frames.h +3 -0
  56. data/vendor/v8/src/full-codegen.cc +2 -1
  57. data/vendor/v8/src/func-name-inferrer.h +2 -0
  58. data/vendor/v8/src/globals.h +3 -0
  59. data/vendor/v8/src/heap-inl.h +16 -4
  60. data/vendor/v8/src/heap.cc +38 -32
  61. data/vendor/v8/src/heap.h +3 -17
  62. data/vendor/v8/src/hydrogen-instructions.cc +28 -5
  63. data/vendor/v8/src/hydrogen-instructions.h +142 -44
  64. data/vendor/v8/src/hydrogen.cc +160 -55
  65. data/vendor/v8/src/hydrogen.h +2 -0
  66. data/vendor/v8/src/ia32/assembler-ia32.h +3 -0
  67. data/vendor/v8/src/ia32/builtins-ia32.cc +5 -4
  68. data/vendor/v8/src/ia32/code-stubs-ia32.cc +22 -16
  69. data/vendor/v8/src/ia32/codegen-ia32.cc +2 -2
  70. data/vendor/v8/src/ia32/debug-ia32.cc +29 -2
  71. data/vendor/v8/src/ia32/full-codegen-ia32.cc +8 -101
  72. data/vendor/v8/src/ia32/ic-ia32.cc +23 -19
  73. data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +126 -80
  74. data/vendor/v8/src/ia32/lithium-codegen-ia32.h +2 -1
  75. data/vendor/v8/src/ia32/lithium-ia32.cc +15 -9
  76. data/vendor/v8/src/ia32/lithium-ia32.h +14 -6
  77. data/vendor/v8/src/ia32/macro-assembler-ia32.cc +50 -40
  78. data/vendor/v8/src/ia32/macro-assembler-ia32.h +5 -4
  79. data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +113 -43
  80. data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +9 -4
  81. data/vendor/v8/src/ia32/simulator-ia32.h +4 -4
  82. data/vendor/v8/src/ia32/stub-cache-ia32.cc +52 -14
  83. data/vendor/v8/src/ic.cc +77 -20
  84. data/vendor/v8/src/ic.h +18 -2
  85. data/vendor/v8/src/incremental-marking-inl.h +21 -5
  86. data/vendor/v8/src/incremental-marking.cc +35 -8
  87. data/vendor/v8/src/incremental-marking.h +12 -3
  88. data/vendor/v8/src/isolate.cc +12 -2
  89. data/vendor/v8/src/isolate.h +1 -1
  90. data/vendor/v8/src/jsregexp.cc +66 -26
  91. data/vendor/v8/src/jsregexp.h +60 -31
  92. data/vendor/v8/src/list-inl.h +8 -0
  93. data/vendor/v8/src/list.h +3 -0
  94. data/vendor/v8/src/lithium.cc +5 -2
  95. data/vendor/v8/src/liveedit.cc +57 -5
  96. data/vendor/v8/src/mark-compact-inl.h +17 -11
  97. data/vendor/v8/src/mark-compact.cc +100 -143
  98. data/vendor/v8/src/mark-compact.h +44 -20
  99. data/vendor/v8/src/messages.js +131 -99
  100. data/vendor/v8/src/mips/builtins-mips.cc +5 -4
  101. data/vendor/v8/src/mips/code-stubs-mips.cc +23 -15
  102. data/vendor/v8/src/mips/codegen-mips.cc +2 -2
  103. data/vendor/v8/src/mips/debug-mips.cc +3 -1
  104. data/vendor/v8/src/mips/full-codegen-mips.cc +4 -102
  105. data/vendor/v8/src/mips/ic-mips.cc +34 -36
  106. data/vendor/v8/src/mips/lithium-codegen-mips.cc +116 -68
  107. data/vendor/v8/src/mips/lithium-mips.cc +20 -7
  108. data/vendor/v8/src/mips/lithium-mips.h +11 -4
  109. data/vendor/v8/src/mips/macro-assembler-mips.cc +50 -39
  110. data/vendor/v8/src/mips/macro-assembler-mips.h +5 -4
  111. data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +110 -50
  112. data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +6 -5
  113. data/vendor/v8/src/mips/simulator-mips.h +5 -5
  114. data/vendor/v8/src/mips/stub-cache-mips.cc +66 -20
  115. data/vendor/v8/src/mksnapshot.cc +5 -1
  116. data/vendor/v8/src/objects-debug.cc +103 -6
  117. data/vendor/v8/src/objects-inl.h +215 -116
  118. data/vendor/v8/src/objects-printer.cc +13 -8
  119. data/vendor/v8/src/objects.cc +608 -331
  120. data/vendor/v8/src/objects.h +129 -94
  121. data/vendor/v8/src/parser.cc +16 -4
  122. data/vendor/v8/src/platform-freebsd.cc +1 -0
  123. data/vendor/v8/src/platform-linux.cc +9 -30
  124. data/vendor/v8/src/platform-posix.cc +28 -7
  125. data/vendor/v8/src/platform-win32.cc +15 -3
  126. data/vendor/v8/src/platform.h +2 -1
  127. data/vendor/v8/src/profile-generator-inl.h +25 -2
  128. data/vendor/v8/src/profile-generator.cc +300 -822
  129. data/vendor/v8/src/profile-generator.h +97 -214
  130. data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +2 -1
  131. data/vendor/v8/src/regexp-macro-assembler-irregexp.h +2 -2
  132. data/vendor/v8/src/regexp-macro-assembler-tracer.cc +6 -5
  133. data/vendor/v8/src/regexp-macro-assembler-tracer.h +1 -1
  134. data/vendor/v8/src/regexp-macro-assembler.cc +7 -3
  135. data/vendor/v8/src/regexp-macro-assembler.h +10 -2
  136. data/vendor/v8/src/regexp.js +6 -0
  137. data/vendor/v8/src/runtime.cc +265 -212
  138. data/vendor/v8/src/runtime.h +6 -5
  139. data/vendor/v8/src/scopes.cc +20 -0
  140. data/vendor/v8/src/scopes.h +6 -3
  141. data/vendor/v8/src/spaces.cc +0 -2
  142. data/vendor/v8/src/string-stream.cc +2 -2
  143. data/vendor/v8/src/v8-counters.h +0 -2
  144. data/vendor/v8/src/v8natives.js +2 -2
  145. data/vendor/v8/src/v8utils.h +6 -3
  146. data/vendor/v8/src/version.cc +1 -1
  147. data/vendor/v8/src/x64/assembler-x64.h +2 -1
  148. data/vendor/v8/src/x64/builtins-x64.cc +5 -4
  149. data/vendor/v8/src/x64/code-stubs-x64.cc +25 -16
  150. data/vendor/v8/src/x64/codegen-x64.cc +2 -2
  151. data/vendor/v8/src/x64/debug-x64.cc +14 -1
  152. data/vendor/v8/src/x64/disasm-x64.cc +1 -1
  153. data/vendor/v8/src/x64/full-codegen-x64.cc +10 -106
  154. data/vendor/v8/src/x64/ic-x64.cc +20 -16
  155. data/vendor/v8/src/x64/lithium-codegen-x64.cc +156 -79
  156. data/vendor/v8/src/x64/lithium-codegen-x64.h +2 -1
  157. data/vendor/v8/src/x64/lithium-x64.cc +18 -8
  158. data/vendor/v8/src/x64/lithium-x64.h +7 -2
  159. data/vendor/v8/src/x64/macro-assembler-x64.cc +50 -40
  160. data/vendor/v8/src/x64/macro-assembler-x64.h +5 -4
  161. data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +122 -51
  162. data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +17 -8
  163. data/vendor/v8/src/x64/simulator-x64.h +4 -4
  164. data/vendor/v8/src/x64/stub-cache-x64.cc +55 -17
  165. data/vendor/v8/test/cctest/cctest.status +1 -0
  166. data/vendor/v8/test/cctest/test-api.cc +24 -0
  167. data/vendor/v8/test/cctest/test-func-name-inference.cc +38 -0
  168. data/vendor/v8/test/cctest/test-heap-profiler.cc +21 -77
  169. data/vendor/v8/test/cctest/test-heap.cc +164 -3
  170. data/vendor/v8/test/cctest/test-list.cc +12 -0
  171. data/vendor/v8/test/cctest/test-mark-compact.cc +5 -5
  172. data/vendor/v8/test/cctest/test-regexp.cc +14 -8
  173. data/vendor/v8/test/cctest/testcfg.py +2 -0
  174. data/vendor/v8/test/mjsunit/accessor-map-sharing.js +176 -0
  175. data/vendor/v8/test/mjsunit/array-construct-transition.js +3 -3
  176. data/vendor/v8/test/mjsunit/array-literal-transitions.js +10 -10
  177. data/vendor/v8/test/mjsunit/big-array-literal.js +3 -0
  178. data/vendor/v8/test/mjsunit/compiler/inline-construct.js +4 -2
  179. data/vendor/v8/test/mjsunit/debug-liveedit-stack-padding.js +88 -0
  180. data/vendor/v8/test/mjsunit/elements-kind.js +4 -4
  181. data/vendor/v8/test/mjsunit/elements-transition-hoisting.js +2 -2
  182. data/vendor/v8/test/mjsunit/elements-transition.js +5 -5
  183. data/vendor/v8/test/mjsunit/error-constructors.js +68 -33
  184. data/vendor/v8/test/mjsunit/harmony/proxies.js +14 -6
  185. data/vendor/v8/test/mjsunit/mjsunit.status +1 -0
  186. data/vendor/v8/test/mjsunit/packed-elements.js +112 -0
  187. data/vendor/v8/test/mjsunit/regexp-capture-3.js +6 -0
  188. data/vendor/v8/test/mjsunit/regexp-global.js +132 -0
  189. data/vendor/v8/test/mjsunit/regexp.js +11 -0
  190. data/vendor/v8/test/mjsunit/regress/regress-117409.js +52 -0
  191. data/vendor/v8/test/mjsunit/regress/regress-126412.js +33 -0
  192. data/vendor/v8/test/mjsunit/regress/regress-128018.js +35 -0
  193. data/vendor/v8/test/mjsunit/regress/regress-128146.js +33 -0
  194. data/vendor/v8/test/mjsunit/regress/regress-1639-2.js +4 -1
  195. data/vendor/v8/test/mjsunit/regress/regress-1639.js +14 -8
  196. data/vendor/v8/test/mjsunit/regress/regress-1849.js +3 -3
  197. data/vendor/v8/test/mjsunit/regress/regress-1878.js +2 -2
  198. data/vendor/v8/test/mjsunit/regress/regress-2071.js +79 -0
  199. data/vendor/v8/test/mjsunit/regress/regress-2153.js +32 -0
  200. data/vendor/v8/test/mjsunit/regress/regress-crbug-122271.js +4 -4
  201. data/vendor/v8/test/mjsunit/regress/regress-crbug-126414.js +32 -0
  202. data/vendor/v8/test/mjsunit/regress/regress-smi-only-concat.js +2 -2
  203. data/vendor/v8/test/mjsunit/regress/regress-transcendental.js +49 -0
  204. data/vendor/v8/test/mjsunit/stack-traces.js +14 -0
  205. data/vendor/v8/test/mjsunit/unbox-double-arrays.js +4 -3
  206. data/vendor/v8/test/test262/testcfg.py +6 -1
  207. data/vendor/v8/tools/check-static-initializers.sh +11 -3
  208. data/vendor/v8/tools/fuzz-harness.sh +92 -0
  209. data/vendor/v8/tools/grokdump.py +658 -67
  210. data/vendor/v8/tools/gyp/v8.gyp +21 -39
  211. data/vendor/v8/tools/js2c.py +3 -3
  212. data/vendor/v8/tools/jsmin.py +2 -2
  213. data/vendor/v8/tools/presubmit.py +2 -1
  214. data/vendor/v8/tools/test-wrapper-gypbuild.py +25 -11
  215. metadata +624 -612
@@ -673,7 +673,7 @@ TEST(JSArray) {
673
673
  array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked();
674
674
  CHECK_EQ(Smi::FromInt(0), array->length());
675
675
  // Must be in fast mode.
676
- CHECK(array->HasFastTypeElements());
676
+ CHECK(array->HasFastSmiOrObjectElements());
677
677
 
678
678
  // array[length] = name.
679
679
  array->SetElement(0, *name, NONE, kNonStrictMode)->ToObjectChecked();
@@ -811,7 +811,9 @@ TEST(Iteration) {
811
811
 
812
812
  // Allocate a JS array to OLD_POINTER_SPACE and NEW_SPACE
813
813
  objs[next_objs_index++] = FACTORY->NewJSArray(10);
814
- objs[next_objs_index++] = FACTORY->NewJSArray(10, FAST_ELEMENTS, TENURED);
814
+ objs[next_objs_index++] = FACTORY->NewJSArray(10,
815
+ FAST_HOLEY_ELEMENTS,
816
+ TENURED);
815
817
 
816
818
  // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE
817
819
  objs[next_objs_index++] =
@@ -1595,7 +1597,7 @@ TEST(PrototypeTransitionClearing) {
1595
1597
  Handle<JSObject> prototype;
1596
1598
  PagedSpace* space = HEAP->old_pointer_space();
1597
1599
  do {
1598
- prototype = FACTORY->NewJSArray(32 * KB, FAST_ELEMENTS, TENURED);
1600
+ prototype = FACTORY->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED);
1599
1601
  } while (space->FirstPage() == space->LastPage() ||
1600
1602
  !space->LastPage()->Contains(prototype->address()));
1601
1603
 
@@ -1735,3 +1737,162 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
1735
1737
 
1736
1738
  CHECK(HEAP->InNewSpace(*o));
1737
1739
  }
1740
+
1741
+
1742
+ static int CountMapTransitions(Map* map) {
1743
+ int result = 0;
1744
+ DescriptorArray* descs = map->instance_descriptors();
1745
+ for (int i = 0; i < descs->number_of_descriptors(); i++) {
1746
+ if (descs->IsTransitionOnly(i)) {
1747
+ result++;
1748
+ }
1749
+ }
1750
+ return result;
1751
+ }
1752
+
1753
+
1754
+ // Test that map transitions are cleared and maps are collected with
1755
+ // incremental marking as well.
1756
+ TEST(Regress1465) {
1757
+ i::FLAG_allow_natives_syntax = true;
1758
+ i::FLAG_trace_incremental_marking = true;
1759
+ InitializeVM();
1760
+ v8::HandleScope scope;
1761
+
1762
+ #define TRANSITION_COUNT 256
1763
+ for (int i = 0; i < TRANSITION_COUNT; i++) {
1764
+ EmbeddedVector<char, 64> buffer;
1765
+ OS::SNPrintF(buffer, "var o = new Object; o.prop%d = %d;", i, i);
1766
+ CompileRun(buffer.start());
1767
+ }
1768
+ CompileRun("var root = new Object;");
1769
+ Handle<JSObject> root =
1770
+ v8::Utils::OpenHandle(
1771
+ *v8::Handle<v8::Object>::Cast(
1772
+ v8::Context::GetCurrent()->Global()->Get(v8_str("root"))));
1773
+
1774
+ // Count number of live transitions before marking.
1775
+ int transitions_before = CountMapTransitions(root->map());
1776
+ CompileRun("%DebugPrint(root);");
1777
+ CHECK_EQ(TRANSITION_COUNT, transitions_before);
1778
+
1779
+ // Go through all incremental marking steps in one swoop.
1780
+ IncrementalMarking* marking = HEAP->incremental_marking();
1781
+ CHECK(marking->IsStopped());
1782
+ marking->Start();
1783
+ CHECK(marking->IsMarking());
1784
+ while (!marking->IsComplete()) {
1785
+ marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
1786
+ }
1787
+ CHECK(marking->IsComplete());
1788
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1789
+ CHECK(marking->IsStopped());
1790
+
1791
+ // Count number of live transitions after marking. Note that one transition
1792
+ // is left, because 'o' still holds an instance of one transition target.
1793
+ int transitions_after = CountMapTransitions(root->map());
1794
+ CompileRun("%DebugPrint(root);");
1795
+ CHECK_EQ(1, transitions_after);
1796
+ }
1797
+
1798
+
1799
+ TEST(Regress2143a) {
1800
+ i::FLAG_collect_maps = true;
1801
+ i::FLAG_incremental_marking = true;
1802
+ InitializeVM();
1803
+ v8::HandleScope scope;
1804
+
1805
+ // Prepare a map transition from the root object together with a yet
1806
+ // untransitioned root object.
1807
+ CompileRun("var root = new Object;"
1808
+ "root.foo = 0;"
1809
+ "root = new Object;");
1810
+
1811
+ // Go through all incremental marking steps in one swoop.
1812
+ IncrementalMarking* marking = HEAP->incremental_marking();
1813
+ CHECK(marking->IsStopped());
1814
+ marking->Start();
1815
+ CHECK(marking->IsMarking());
1816
+ while (!marking->IsComplete()) {
1817
+ marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
1818
+ }
1819
+ CHECK(marking->IsComplete());
1820
+
1821
+ // Compile a StoreIC that performs the prepared map transition. This
1822
+ // will restart incremental marking and should make sure the root is
1823
+ // marked grey again.
1824
+ CompileRun("function f(o) {"
1825
+ " o.foo = 0;"
1826
+ "}"
1827
+ "f(new Object);"
1828
+ "f(root);");
1829
+
1830
+ // This bug only triggers with aggressive IC clearing.
1831
+ HEAP->AgeInlineCaches();
1832
+
1833
+ // Explicitly request GC to perform final marking step and sweeping.
1834
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1835
+ CHECK(marking->IsStopped());
1836
+
1837
+ Handle<JSObject> root =
1838
+ v8::Utils::OpenHandle(
1839
+ *v8::Handle<v8::Object>::Cast(
1840
+ v8::Context::GetCurrent()->Global()->Get(v8_str("root"))));
1841
+
1842
+ // The root object should be in a sane state.
1843
+ CHECK(root->IsJSObject());
1844
+ CHECK(root->map()->IsMap());
1845
+ }
1846
+
1847
+
1848
+ TEST(Regress2143b) {
1849
+ i::FLAG_collect_maps = true;
1850
+ i::FLAG_incremental_marking = true;
1851
+ i::FLAG_allow_natives_syntax = true;
1852
+ InitializeVM();
1853
+ v8::HandleScope scope;
1854
+
1855
+ // Prepare a map transition from the root object together with a yet
1856
+ // untransitioned root object.
1857
+ CompileRun("var root = new Object;"
1858
+ "root.foo = 0;"
1859
+ "root = new Object;");
1860
+
1861
+ // Go through all incremental marking steps in one swoop.
1862
+ IncrementalMarking* marking = HEAP->incremental_marking();
1863
+ CHECK(marking->IsStopped());
1864
+ marking->Start();
1865
+ CHECK(marking->IsMarking());
1866
+ while (!marking->IsComplete()) {
1867
+ marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
1868
+ }
1869
+ CHECK(marking->IsComplete());
1870
+
1871
+ // Compile an optimized LStoreNamedField that performs the prepared
1872
+ // map transition. This will restart incremental marking and should
1873
+ // make sure the root is marked grey again.
1874
+ CompileRun("function f(o) {"
1875
+ " o.foo = 0;"
1876
+ "}"
1877
+ "f(new Object);"
1878
+ "f(new Object);"
1879
+ "%OptimizeFunctionOnNextCall(f);"
1880
+ "f(root);"
1881
+ "%DeoptimizeFunction(f);");
1882
+
1883
+ // This bug only triggers with aggressive IC clearing.
1884
+ HEAP->AgeInlineCaches();
1885
+
1886
+ // Explicitly request GC to perform final marking step and sweeping.
1887
+ HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1888
+ CHECK(marking->IsStopped());
1889
+
1890
+ Handle<JSObject> root =
1891
+ v8::Utils::OpenHandle(
1892
+ *v8::Handle<v8::Object>::Cast(
1893
+ v8::Context::GetCurrent()->Global()->Get(v8_str("root"))));
1894
+
1895
+ // The root object should be in a sane state.
1896
+ CHECK(root->IsJSObject());
1897
+ CHECK(root->map()->IsMap());
1898
+ }
@@ -130,6 +130,18 @@ TEST(RemoveLast) {
130
130
  }
131
131
 
132
132
 
133
+ TEST(Allocate) {
134
+ List<int> list(4);
135
+ list.Add(1);
136
+ CHECK_EQ(1, list.length());
137
+ list.Allocate(100);
138
+ CHECK_EQ(100, list.length());
139
+ CHECK_LE(100, list.capacity());
140
+ list[99] = 123;
141
+ CHECK_EQ(123, list[99]);
142
+ }
143
+
144
+
133
145
  TEST(Clear) {
134
146
  List<int> list(4);
135
147
  CHECK_EQ(0, list.length());
@@ -531,18 +531,18 @@ TEST(BootUpMemoryUse) {
531
531
  // there we just skip the test.
532
532
  if (initial_memory >= 0) {
533
533
  InitializeVM();
534
- intptr_t booted_memory = MemoryInUse();
534
+ intptr_t delta = MemoryInUse() - initial_memory;
535
535
  if (sizeof(initial_memory) == 8) {
536
536
  if (v8::internal::Snapshot::IsEnabled()) {
537
- CHECK_LE(booted_memory - initial_memory, 3600 * 1024); // 3396.
537
+ CHECK_LE(delta, 3600 * 1024); // 3396.
538
538
  } else {
539
- CHECK_LE(booted_memory - initial_memory, 3600 * 1024); // 3432.
539
+ CHECK_LE(delta, 4000 * 1024); // 3948.
540
540
  }
541
541
  } else {
542
542
  if (v8::internal::Snapshot::IsEnabled()) {
543
- CHECK_LE(booted_memory - initial_memory, 2600 * 1024); // 2484.
543
+ CHECK_LE(delta, 2600 * 1024); // 2484.
544
544
  } else {
545
- CHECK_LE(booted_memory - initial_memory, 2950 * 1024); // 2844
545
+ CHECK_LE(delta, 2950 * 1024); // 2844
546
546
  }
547
547
  }
548
548
  }
@@ -1,4 +1,4 @@
1
- // Copyright 2008 the V8 project authors. All rights reserved.
1
+ // Copyright 2012 the V8 project authors. All rights reserved.
2
2
  // Redistribution and use in source and binary forms, with or without
3
3
  // modification, are permitted provided that the following conditions are
4
4
  // met:
@@ -506,8 +506,13 @@ static RegExpNode* Compile(const char* input, bool multiline, bool is_ascii) {
506
506
  NewStringFromUtf8(CStrVector(input));
507
507
  Handle<String> sample_subject =
508
508
  isolate->factory()->NewStringFromUtf8(CStrVector(""));
509
- RegExpEngine::Compile(
510
- &compile_data, false, multiline, pattern, sample_subject, is_ascii);
509
+ RegExpEngine::Compile(&compile_data,
510
+ false,
511
+ false,
512
+ multiline,
513
+ pattern,
514
+ sample_subject,
515
+ is_ascii);
511
516
  return compile_data.node;
512
517
  }
513
518
 
@@ -720,6 +725,7 @@ static ArchRegExpMacroAssembler::Result Execute(Code* code,
720
725
  input_start,
721
726
  input_end,
722
727
  captures,
728
+ 0,
723
729
  Isolate::Current());
724
730
  }
725
731
 
@@ -998,11 +1004,11 @@ TEST(MacroAssemblerNativeBackReferenceUC16) {
998
1004
  int output[4];
999
1005
  NativeRegExpMacroAssembler::Result result =
1000
1006
  Execute(*code,
1001
- *input,
1002
- 0,
1003
- start_adr,
1004
- start_adr + input->length() * 2,
1005
- output);
1007
+ *input,
1008
+ 0,
1009
+ start_adr,
1010
+ start_adr + input->length() * 2,
1011
+ output);
1006
1012
 
1007
1013
  CHECK_EQ(NativeRegExpMacroAssembler::SUCCESS, result);
1008
1014
  CHECK_EQ(0, output[0]);
@@ -53,6 +53,8 @@ class CcTestCase(test.TestCase):
53
53
  serialization_file = join('obj', 'test', self.mode, 'serdes')
54
54
  else:
55
55
  serialization_file = join('obj', 'serdes')
56
+ if not exists(join(self.context.buildspace, 'obj')):
57
+ os.makedirs(join(self.context.buildspace, 'obj'))
56
58
  serialization_file += '_' + self.GetName()
57
59
  serialization_file = join(self.context.buildspace, serialization_file)
58
60
  serialization_file += ''.join(self.variant_flags).replace('-', '_')
@@ -0,0 +1,176 @@
1
+ // Copyright 2012 the V8 project authors. All rights reserved.
2
+ // Redistribution and use in source and binary forms, with or without
3
+ // modification, are permitted provided that the following conditions are
4
+ // met:
5
+ //
6
+ // * Redistributions of source code must retain the above copyright
7
+ // notice, this list of conditions and the following disclaimer.
8
+ // * Redistributions in binary form must reproduce the above
9
+ // copyright notice, this list of conditions and the following
10
+ // disclaimer in the documentation and/or other materials provided
11
+ // with the distribution.
12
+ // * Neither the name of Google Inc. nor the names of its
13
+ // contributors may be used to endorse or promote products derived
14
+ // from this software without specific prior written permission.
15
+ //
16
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ // Flags: --allow-natives-syntax --fast-accessor-properties
29
+
30
+ // Handy abbreviations.
31
+ var dp = Object.defineProperty;
32
+ var gop = Object.getOwnPropertyDescriptor;
33
+
34
+ function getter() { return 111; }
35
+ function setter(x) { print(222); }
36
+ function anotherGetter() { return 333; }
37
+ function anotherSetter(x) { print(444); }
38
+ var obj1, obj2;
39
+
40
+ // Two objects with the same getter.
41
+ obj1 = {};
42
+ dp(obj1, "alpha", { get: getter });
43
+ obj2 = {};
44
+ dp(obj2, "alpha", { get: getter });
45
+ assertTrue(%HaveSameMap(obj1, obj2));
46
+
47
+ // Two objects with the same getter, oldskool.
48
+ obj1 = {};
49
+ obj1.__defineGetter__("bravo", getter);
50
+ assertEquals(getter, obj1.__lookupGetter__("bravo"));
51
+ obj2 = {};
52
+ obj2.__defineGetter__("bravo", getter);
53
+ assertEquals(getter, obj2.__lookupGetter__("bravo"));
54
+ assertTrue(%HaveSameMap(obj1, obj2));
55
+
56
+ // Two objects with the same setter.
57
+ obj1 = {};
58
+ dp(obj1, "charlie", { set: setter });
59
+ obj2 = {};
60
+ dp(obj2, "charlie", { set: setter });
61
+ assertTrue(%HaveSameMap(obj1, obj2));
62
+
63
+ // Two objects with the same setter, oldskool.
64
+ obj1 = {};
65
+ obj1.__defineSetter__("delta", setter);
66
+ assertEquals(setter, obj1.__lookupSetter__("delta"));
67
+ obj2 = {};
68
+ obj2.__defineSetter__("delta", setter);
69
+ assertEquals(setter, obj2.__lookupSetter__("delta"));
70
+ assertTrue(%HaveSameMap(obj1, obj2));
71
+
72
+ // Two objects with the same getter and setter.
73
+ obj1 = {};
74
+ dp(obj1, "foxtrot", { get: getter, set: setter });
75
+ obj2 = {};
76
+ dp(obj2, "foxtrot", { get: getter, set: setter });
77
+ assertTrue(%HaveSameMap(obj1, obj2));
78
+
79
+ // Two objects with the same getter and setter, set separately.
80
+ obj1 = {};
81
+ dp(obj1, "golf", { get: getter, configurable: true });
82
+ dp(obj1, "golf", { set: setter, configurable: true });
83
+ obj2 = {};
84
+ dp(obj2, "golf", { get: getter, configurable: true });
85
+ dp(obj2, "golf", { set: setter, configurable: true });
86
+ assertTrue(%HaveSameMap(obj1, obj2));
87
+
88
+ // Two objects with the same getter and setter, set separately, oldskool.
89
+ obj1 = {};
90
+ obj1.__defineGetter__("hotel", getter);
91
+ obj1.__defineSetter__("hotel", setter);
92
+ obj2 = {};
93
+ obj2.__defineGetter__("hotel", getter);
94
+ obj2.__defineSetter__("hotel", setter);
95
+ assertTrue(%HaveSameMap(obj1, obj2));
96
+
97
+ // Attribute-only change, shouldn't affect previous descriptor properties.
98
+ obj1 = {};
99
+ dp(obj1, "india", { get: getter, configurable: true, enumerable: true });
100
+ assertEquals(getter, gop(obj1, "india").get);
101
+ assertTrue(gop(obj1, "india").configurable);
102
+ assertTrue(gop(obj1, "india").enumerable);
103
+ dp(obj1, "india", { enumerable: false });
104
+ assertEquals(getter, gop(obj1, "india").get);
105
+ assertTrue(gop(obj1, "india").configurable);
106
+ assertFalse(gop(obj1, "india").enumerable);
107
+
108
+ // Attribute-only change, shouldn't affect objects with previously shared maps.
109
+ obj1 = {};
110
+ dp(obj1, "juliet", { set: setter, configurable: true, enumerable: false });
111
+ assertEquals(setter, gop(obj1, "juliet").set);
112
+ assertTrue(gop(obj1, "juliet").configurable);
113
+ assertFalse(gop(obj1, "juliet").enumerable);
114
+ obj2 = {};
115
+ dp(obj2, "juliet", { set: setter, configurable: true, enumerable: false });
116
+ assertEquals(setter, gop(obj2, "juliet").set);
117
+ assertTrue(gop(obj2, "juliet").configurable);
118
+ assertFalse(gop(obj2, "juliet").enumerable);
119
+ dp(obj1, "juliet", { set: setter, configurable: false, enumerable: true });
120
+ assertEquals(setter, gop(obj1, "juliet").set);
121
+ assertFalse(gop(obj1, "juliet").configurable);
122
+ assertTrue(gop(obj1, "juliet").enumerable);
123
+ assertEquals(setter, gop(obj2, "juliet").set);
124
+ assertTrue(gop(obj2, "juliet").configurable);
125
+ assertFalse(gop(obj2, "juliet").enumerable);
126
+
127
+ // Two objects with the different getters.
128
+ obj1 = {};
129
+ dp(obj1, "kilo", { get: getter });
130
+ obj2 = {};
131
+ dp(obj2, "kilo", { get: anotherGetter });
132
+ assertEquals(getter, gop(obj1, "kilo").get);
133
+ assertEquals(anotherGetter, gop(obj2, "kilo").get);
134
+ assertFalse(%HaveSameMap(obj1, obj2));
135
+
136
+ // Two objects with the same getters and different setters.
137
+ obj1 = {};
138
+ dp(obj1, "lima", { get: getter, set: setter });
139
+ obj2 = {};
140
+ dp(obj2, "lima", { get: getter, set: anotherSetter });
141
+ assertEquals(setter, gop(obj1, "lima").set);
142
+ assertEquals(anotherSetter, gop(obj2, "lima").set);
143
+ assertFalse(%HaveSameMap(obj1, obj2));
144
+
145
+ // Even 'undefined' is a kind of getter.
146
+ obj1 = {};
147
+ dp(obj1, "mike", { get: undefined });
148
+ assertTrue("mike" in obj1);
149
+ assertEquals(undefined, gop(obj1, "mike").get);
150
+ assertEquals(undefined, obj1.__lookupGetter__("mike"));
151
+ assertEquals(undefined, gop(obj1, "mike").set);
152
+ assertEquals(undefined, obj1.__lookupSetter__("mike"));
153
+
154
+ // Even 'undefined' is a kind of setter.
155
+ obj1 = {};
156
+ dp(obj1, "november", { set: undefined });
157
+ assertTrue("november" in obj1);
158
+ assertEquals(undefined, gop(obj1, "november").get);
159
+ assertEquals(undefined, obj1.__lookupGetter__("november"));
160
+ assertEquals(undefined, gop(obj1, "november").set);
161
+ assertEquals(undefined, obj1.__lookupSetter__("november"));
162
+
163
+ // Redefining a data property.
164
+ obj1 = {};
165
+ obj1.oscar = 12345;
166
+ dp(obj1, "oscar", { set: setter });
167
+ assertEquals(setter, gop(obj1, "oscar").set);
168
+
169
+ // Re-adding the same getter/attributes pair.
170
+ obj1 = {};
171
+ dp(obj1, "papa", { get: getter, configurable: true });
172
+ dp(obj1, "papa", { get: getter, set: setter, configurable: true });
173
+ assertEquals(getter, gop(obj1, "papa").get);
174
+ assertEquals(setter, gop(obj1, "papa").set);
175
+ assertTrue(gop(obj1, "papa").configurable);
176
+ assertFalse(gop(obj1, "papa").enumerable);