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
@@ -115,7 +115,7 @@ class RegExpMacroAssemblerMIPS: public NativeRegExpMacroAssembler {
115
115
  virtual void ReadStackPointerFromRegister(int reg);
116
116
  virtual void SetCurrentPositionFromEnd(int by);
117
117
  virtual void SetRegister(int register_index, int to);
118
- virtual void Succeed();
118
+ virtual bool Succeed();
119
119
  virtual void WriteCurrentPositionToRegister(int reg, int cp_offset);
120
120
  virtual void ClearRegisters(int reg_from, int reg_to);
121
121
  virtual void WriteStackPointerToRegister(int reg);
@@ -141,7 +141,8 @@ class RegExpMacroAssemblerMIPS: public NativeRegExpMacroAssembler {
141
141
  static const int kStackFrameHeader = kReturnAddress + kPointerSize;
142
142
  // Stack parameters placed by caller.
143
143
  static const int kRegisterOutput = kStackFrameHeader + 20;
144
- static const int kStackHighEnd = kRegisterOutput + kPointerSize;
144
+ static const int kNumOutputRegisters = kRegisterOutput + kPointerSize;
145
+ static const int kStackHighEnd = kNumOutputRegisters + kPointerSize;
145
146
  static const int kDirectCall = kStackHighEnd + kPointerSize;
146
147
  static const int kIsolate = kDirectCall + kPointerSize;
147
148
 
@@ -153,10 +154,10 @@ class RegExpMacroAssemblerMIPS: public NativeRegExpMacroAssembler {
153
154
  static const int kInputString = kStartIndex - kPointerSize;
154
155
  // When adding local variables remember to push space for them in
155
156
  // the frame in GetCode.
156
- static const int kInputStartMinusOne = kInputString - kPointerSize;
157
- static const int kAtStart = kInputStartMinusOne - kPointerSize;
157
+ static const int kSuccessfulCaptures = kInputString - kPointerSize;
158
+ static const int kInputStartMinusOne = kSuccessfulCaptures - kPointerSize;
158
159
  // First register address. Following registers are below it on the stack.
159
- static const int kRegisterZero = kAtStart - kPointerSize;
160
+ static const int kRegisterZero = kInputStartMinusOne - kPointerSize;
160
161
 
161
162
  // Initial size of code buffer.
162
163
  static const size_t kRegExpCodeSize = 1024;
@@ -50,16 +50,16 @@ namespace internal {
50
50
  entry(p0, p1, p2, p3, p4)
51
51
 
52
52
  typedef int (*mips_regexp_matcher)(String*, int, const byte*, const byte*,
53
- void*, int*, Address, int, Isolate*);
53
+ void*, int*, int, Address, int, Isolate*);
54
54
 
55
55
 
56
56
  // Call the generated regexp code directly. The code at the entry address
57
57
  // should act as a function matching the type arm_regexp_matcher.
58
58
  // The fifth argument is a dummy that reserves the space used for
59
59
  // the return address added by the ExitFrame in native calls.
60
- #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \
60
+ #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
61
61
  (FUNCTION_CAST<mips_regexp_matcher>(entry)( \
62
- p0, p1, p2, p3, NULL, p4, p5, p6, p7))
62
+ p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8))
63
63
 
64
64
  #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
65
65
  reinterpret_cast<TryCatch*>(try_catch_address)
@@ -403,9 +403,9 @@ class Simulator {
403
403
  reinterpret_cast<Object*>(Simulator::current(Isolate::Current())->Call( \
404
404
  FUNCTION_ADDR(entry), 5, p0, p1, p2, p3, p4))
405
405
 
406
- #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \
406
+ #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
407
407
  Simulator::current(Isolate::Current())->Call( \
408
- entry, 9, p0, p1, p2, p3, NULL, p4, p5, p6, p7)
408
+ entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8)
409
409
 
410
410
  #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
411
411
  try_catch_address == NULL ? \
@@ -458,10 +458,20 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm,
458
458
  }
459
459
 
460
460
  if (!transition.is_null()) {
461
- // Update the map of the object; no write barrier updating is
462
- // needed because the map is never in new space.
463
- __ li(t0, Operand(transition));
464
- __ sw(t0, FieldMemOperand(receiver_reg, HeapObject::kMapOffset));
461
+ // Update the map of the object.
462
+ __ li(scratch, Operand(transition));
463
+ __ sw(scratch, FieldMemOperand(receiver_reg, HeapObject::kMapOffset));
464
+
465
+ // Update the write barrier for the map field and pass the now unused
466
+ // name_reg as scratch register.
467
+ __ RecordWriteField(receiver_reg,
468
+ HeapObject::kMapOffset,
469
+ scratch,
470
+ name_reg,
471
+ kRAHasNotBeenSaved,
472
+ kDontSaveFPRegs,
473
+ OMIT_REMEMBERED_SET,
474
+ OMIT_SMI_CHECK);
465
475
  }
466
476
 
467
477
  // Adjust for the number of properties stored in the object. Even in the
@@ -1287,12 +1297,19 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
1287
1297
  name, miss);
1288
1298
  ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1));
1289
1299
 
1300
+ // Preserve the receiver register explicitly whenever it is different from
1301
+ // the holder and it is needed should the interceptor return without any
1302
+ // result. The CALLBACKS case needs the receiver to be passed into C++ code,
1303
+ // the FIELD case might cause a miss during the prototype check.
1304
+ bool must_perfrom_prototype_check = *interceptor_holder != lookup->holder();
1305
+ bool must_preserve_receiver_reg = !receiver.is(holder_reg) &&
1306
+ (lookup->type() == CALLBACKS || must_perfrom_prototype_check);
1307
+
1290
1308
  // Save necessary data before invoking an interceptor.
1291
1309
  // Requires a frame to make GC aware of pushed pointers.
1292
1310
  {
1293
1311
  FrameScope frame_scope(masm(), StackFrame::INTERNAL);
1294
- if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) {
1295
- // CALLBACKS case needs a receiver to be passed into C++ callback.
1312
+ if (must_preserve_receiver_reg) {
1296
1313
  __ Push(receiver, holder_reg, name_reg);
1297
1314
  } else {
1298
1315
  __ Push(holder_reg, name_reg);
@@ -1316,14 +1333,14 @@ void StubCompiler::GenerateLoadInterceptor(Handle<JSObject> object,
1316
1333
  __ bind(&interceptor_failed);
1317
1334
  __ pop(name_reg);
1318
1335
  __ pop(holder_reg);
1319
- if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) {
1336
+ if (must_preserve_receiver_reg) {
1320
1337
  __ pop(receiver);
1321
1338
  }
1322
1339
  // Leave the internal frame.
1323
1340
  }
1324
1341
  // Check that the maps from interceptor's holder to lookup's holder
1325
1342
  // haven't changed. And load lookup's holder into |holder| register.
1326
- if (*interceptor_holder != lookup->holder()) {
1343
+ if (must_perfrom_prototype_check) {
1327
1344
  holder_reg = CheckPrototypes(interceptor_holder,
1328
1345
  holder_reg,
1329
1346
  Handle<JSObject>(lookup->holder()),
@@ -1578,16 +1595,29 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall(
1578
1595
  __ jmp(&fast_object);
1579
1596
  // In case of fast smi-only, convert to fast object, otherwise bail out.
1580
1597
  __ bind(&not_fast_object);
1581
- __ CheckFastSmiOnlyElements(a3, t3, &call_builtin);
1598
+ __ CheckFastSmiElements(a3, t3, &call_builtin);
1582
1599
  // edx: receiver
1583
1600
  // r3: map
1584
- __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS,
1601
+ Label try_holey_map;
1602
+ __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
1585
1603
  FAST_ELEMENTS,
1586
1604
  a3,
1587
1605
  t3,
1606
+ &try_holey_map);
1607
+ __ mov(a2, receiver);
1608
+ ElementsTransitionGenerator::
1609
+ GenerateMapChangeElementsTransition(masm());
1610
+ __ jmp(&fast_object);
1611
+
1612
+ __ bind(&try_holey_map);
1613
+ __ LoadTransitionedArrayMapConditional(FAST_HOLEY_SMI_ELEMENTS,
1614
+ FAST_HOLEY_ELEMENTS,
1615
+ a3,
1616
+ t3,
1588
1617
  &call_builtin);
1589
1618
  __ mov(a2, receiver);
1590
- ElementsTransitionGenerator::GenerateSmiOnlyToObject(masm());
1619
+ ElementsTransitionGenerator::
1620
+ GenerateMapChangeElementsTransition(masm());
1591
1621
  __ bind(&fast_object);
1592
1622
  } else {
1593
1623
  __ CheckFastObjectElements(a3, a3, &call_builtin);
@@ -3365,9 +3395,12 @@ static bool IsElementTypeSigned(ElementsKind elements_kind) {
3365
3395
 
3366
3396
  case EXTERNAL_FLOAT_ELEMENTS:
3367
3397
  case EXTERNAL_DOUBLE_ELEMENTS:
3368
- case FAST_SMI_ONLY_ELEMENTS:
3398
+ case FAST_SMI_ELEMENTS:
3369
3399
  case FAST_ELEMENTS:
3370
3400
  case FAST_DOUBLE_ELEMENTS:
3401
+ case FAST_HOLEY_SMI_ELEMENTS:
3402
+ case FAST_HOLEY_ELEMENTS:
3403
+ case FAST_HOLEY_DOUBLE_ELEMENTS:
3371
3404
  case DICTIONARY_ELEMENTS:
3372
3405
  case NON_STRICT_ARGUMENTS_ELEMENTS:
3373
3406
  UNREACHABLE();
@@ -3501,8 +3534,11 @@ void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3501
3534
  }
3502
3535
  break;
3503
3536
  case FAST_ELEMENTS:
3504
- case FAST_SMI_ONLY_ELEMENTS:
3537
+ case FAST_SMI_ELEMENTS:
3505
3538
  case FAST_DOUBLE_ELEMENTS:
3539
+ case FAST_HOLEY_ELEMENTS:
3540
+ case FAST_HOLEY_SMI_ELEMENTS:
3541
+ case FAST_HOLEY_DOUBLE_ELEMENTS:
3506
3542
  case DICTIONARY_ELEMENTS:
3507
3543
  case NON_STRICT_ARGUMENTS_ELEMENTS:
3508
3544
  UNREACHABLE();
@@ -3862,8 +3898,11 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3862
3898
  }
3863
3899
  break;
3864
3900
  case FAST_ELEMENTS:
3865
- case FAST_SMI_ONLY_ELEMENTS:
3901
+ case FAST_SMI_ELEMENTS:
3866
3902
  case FAST_DOUBLE_ELEMENTS:
3903
+ case FAST_HOLEY_ELEMENTS:
3904
+ case FAST_HOLEY_SMI_ELEMENTS:
3905
+ case FAST_HOLEY_DOUBLE_ELEMENTS:
3867
3906
  case DICTIONARY_ELEMENTS:
3868
3907
  case NON_STRICT_ARGUMENTS_ELEMENTS:
3869
3908
  UNREACHABLE();
@@ -3927,8 +3966,11 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3927
3966
  case EXTERNAL_FLOAT_ELEMENTS:
3928
3967
  case EXTERNAL_DOUBLE_ELEMENTS:
3929
3968
  case FAST_ELEMENTS:
3930
- case FAST_SMI_ONLY_ELEMENTS:
3969
+ case FAST_SMI_ELEMENTS:
3931
3970
  case FAST_DOUBLE_ELEMENTS:
3971
+ case FAST_HOLEY_ELEMENTS:
3972
+ case FAST_HOLEY_SMI_ELEMENTS:
3973
+ case FAST_HOLEY_DOUBLE_ELEMENTS:
3932
3974
  case DICTIONARY_ELEMENTS:
3933
3975
  case NON_STRICT_ARGUMENTS_ELEMENTS:
3934
3976
  UNREACHABLE();
@@ -4099,8 +4141,11 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
4099
4141
  case EXTERNAL_FLOAT_ELEMENTS:
4100
4142
  case EXTERNAL_DOUBLE_ELEMENTS:
4101
4143
  case FAST_ELEMENTS:
4102
- case FAST_SMI_ONLY_ELEMENTS:
4144
+ case FAST_SMI_ELEMENTS:
4103
4145
  case FAST_DOUBLE_ELEMENTS:
4146
+ case FAST_HOLEY_ELEMENTS:
4147
+ case FAST_HOLEY_SMI_ELEMENTS:
4148
+ case FAST_HOLEY_DOUBLE_ELEMENTS:
4104
4149
  case DICTIONARY_ELEMENTS:
4105
4150
  case NON_STRICT_ARGUMENTS_ELEMENTS:
4106
4151
  UNREACHABLE();
@@ -4279,7 +4324,7 @@ void KeyedStoreStubCompiler::GenerateStoreFastElement(
4279
4324
  // Check that the key is a smi or a heap number convertible to a smi.
4280
4325
  GenerateSmiKeyCheck(masm, key_reg, t0, t1, f2, &miss_force_generic);
4281
4326
 
4282
- if (elements_kind == FAST_SMI_ONLY_ELEMENTS) {
4327
+ if (IsFastSmiElementsKind(elements_kind)) {
4283
4328
  __ JumpIfNotSmi(value_reg, &transition_elements_kind);
4284
4329
  }
4285
4330
 
@@ -4307,7 +4352,7 @@ void KeyedStoreStubCompiler::GenerateStoreFastElement(
4307
4352
 
4308
4353
  __ bind(&finish_store);
4309
4354
 
4310
- if (elements_kind == FAST_SMI_ONLY_ELEMENTS) {
4355
+ if (IsFastSmiElementsKind(elements_kind)) {
4311
4356
  __ Addu(scratch,
4312
4357
  elements_reg,
4313
4358
  Operand(FixedArray::kHeaderSize - kHeapObjectTag));
@@ -4316,7 +4361,7 @@ void KeyedStoreStubCompiler::GenerateStoreFastElement(
4316
4361
  __ Addu(scratch, scratch, scratch2);
4317
4362
  __ sw(value_reg, MemOperand(scratch));
4318
4363
  } else {
4319
- ASSERT(elements_kind == FAST_ELEMENTS);
4364
+ ASSERT(IsFastObjectElementsKind(elements_kind));
4320
4365
  __ Addu(scratch,
4321
4366
  elements_reg,
4322
4367
  Operand(FixedArray::kHeaderSize - kHeapObjectTag));
@@ -4325,7 +4370,6 @@ void KeyedStoreStubCompiler::GenerateStoreFastElement(
4325
4370
  __ Addu(scratch, scratch, scratch2);
4326
4371
  __ sw(value_reg, MemOperand(scratch));
4327
4372
  __ mov(receiver_reg, value_reg);
4328
- ASSERT(elements_kind == FAST_ELEMENTS);
4329
4373
  __ RecordWrite(elements_reg, // Object.
4330
4374
  scratch, // Address.
4331
4375
  receiver_reg, // Value.
@@ -4537,6 +4581,8 @@ void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
4537
4581
  // Increment the length of the array.
4538
4582
  __ li(length_reg, Operand(Smi::FromInt(1)));
4539
4583
  __ sw(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
4584
+ __ lw(elements_reg,
4585
+ FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4540
4586
  __ jmp(&finish_store);
4541
4587
 
4542
4588
  __ bind(&check_capacity);
@@ -303,7 +303,11 @@ int main(int argc, char** argv) {
303
303
  #endif
304
304
  i::Serializer::Enable();
305
305
  Persistent<Context> context = v8::Context::New();
306
- ASSERT(!context.IsEmpty());
306
+ if (context.IsEmpty()) {
307
+ fprintf(stderr,
308
+ "\nException thrown while compiling natives - see above.\n\n");
309
+ exit(1);
310
+ }
307
311
  // Make sure all builtin scripts are cached.
308
312
  { HandleScope scope;
309
313
  for (int i = 0; i < i::Natives::GetBuiltinsCount(); i++) {
@@ -286,12 +286,11 @@ void JSObject::JSObjectVerify() {
286
286
  (map()->inobject_properties() + properties()->length() -
287
287
  map()->NextFreePropertyIndex()));
288
288
  }
289
- ASSERT_EQ((map()->has_fast_elements() ||
290
- map()->has_fast_smi_only_elements() ||
289
+ ASSERT_EQ((map()->has_fast_smi_or_object_elements() ||
291
290
  (elements() == GetHeap()->empty_fixed_array())),
292
291
  (elements()->map() == GetHeap()->fixed_array_map() ||
293
292
  elements()->map() == GetHeap()->fixed_cow_array_map()));
294
- ASSERT(map()->has_fast_elements() == HasFastElements());
293
+ ASSERT(map()->has_fast_object_elements() == HasFastObjectElements());
295
294
  }
296
295
 
297
296
 
@@ -303,6 +302,8 @@ void Map::MapVerify() {
303
302
  instance_size() < HEAP->Capacity()));
304
303
  VerifyHeapPointer(prototype());
305
304
  VerifyHeapPointer(instance_descriptors());
305
+ SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates());
306
+ SLOW_ASSERT(instance_descriptors()->IsConsistentWithBackPointers(this));
306
307
  }
307
308
 
308
309
 
@@ -456,10 +457,17 @@ void String::StringVerify() {
456
457
  ConsString::cast(this)->ConsStringVerify();
457
458
  } else if (IsSlicedString()) {
458
459
  SlicedString::cast(this)->SlicedStringVerify();
460
+ } else if (IsSeqAsciiString()) {
461
+ SeqAsciiString::cast(this)->SeqAsciiStringVerify();
459
462
  }
460
463
  }
461
464
 
462
465
 
466
+ void SeqAsciiString::SeqAsciiStringVerify() {
467
+ CHECK(String::IsAscii(GetChars(), length()));
468
+ }
469
+
470
+
463
471
  void ConsString::ConsStringVerify() {
464
472
  CHECK(this->first()->IsString());
465
473
  CHECK(this->second() == GetHeap()->empty_string() ||
@@ -508,7 +516,7 @@ void JSGlobalProxy::JSGlobalProxyVerify() {
508
516
  VerifyObjectField(JSGlobalProxy::kContextOffset);
509
517
  // Make sure that this object has no properties, elements.
510
518
  CHECK_EQ(0, properties()->length());
511
- CHECK(HasFastElements());
519
+ CHECK(HasFastObjectElements());
512
520
  CHECK_EQ(0, FixedArray::cast(elements())->length());
513
521
  }
514
522
 
@@ -803,6 +811,11 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) {
803
811
  }
804
812
  // Indexed properties
805
813
  switch (GetElementsKind()) {
814
+ case FAST_HOLEY_SMI_ELEMENTS:
815
+ case FAST_SMI_ELEMENTS:
816
+ case FAST_HOLEY_DOUBLE_ELEMENTS:
817
+ case FAST_DOUBLE_ELEMENTS:
818
+ case FAST_HOLEY_ELEMENTS:
806
819
  case FAST_ELEMENTS: {
807
820
  info->number_of_objects_with_fast_elements_++;
808
821
  int holes = 0;
@@ -816,6 +829,14 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) {
816
829
  info->number_of_fast_unused_elements_ += holes;
817
830
  break;
818
831
  }
832
+ case EXTERNAL_BYTE_ELEMENTS:
833
+ case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
834
+ case EXTERNAL_SHORT_ELEMENTS:
835
+ case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
836
+ case EXTERNAL_INT_ELEMENTS:
837
+ case EXTERNAL_UNSIGNED_INT_ELEMENTS:
838
+ case EXTERNAL_FLOAT_ELEMENTS:
839
+ case EXTERNAL_DOUBLE_ELEMENTS:
819
840
  case EXTERNAL_PIXEL_ELEMENTS: {
820
841
  info->number_of_objects_with_fast_elements_++;
821
842
  ExternalPixelArray* e = ExternalPixelArray::cast(elements());
@@ -829,8 +850,7 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) {
829
850
  dict->Capacity() - dict->NumberOfElements();
830
851
  break;
831
852
  }
832
- default:
833
- UNREACHABLE();
853
+ case NON_STRICT_ARGUMENTS_ELEMENTS:
834
854
  break;
835
855
  }
836
856
  }
@@ -894,6 +914,61 @@ bool DescriptorArray::IsSortedNoDuplicates() {
894
914
  }
895
915
 
896
916
 
917
+ static bool CheckOneBackPointer(Map* current_map, Object* target) {
918
+ return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map;
919
+ }
920
+
921
+
922
+ bool DescriptorArray::IsConsistentWithBackPointers(Map* current_map) {
923
+ for (int i = 0; i < number_of_descriptors(); ++i) {
924
+ switch (GetType(i)) {
925
+ case MAP_TRANSITION:
926
+ case CONSTANT_TRANSITION:
927
+ if (!CheckOneBackPointer(current_map, GetValue(i))) {
928
+ return false;
929
+ }
930
+ break;
931
+ case ELEMENTS_TRANSITION: {
932
+ Object* object = GetValue(i);
933
+ if (!CheckOneBackPointer(current_map, object)) {
934
+ return false;
935
+ }
936
+ if (object->IsFixedArray()) {
937
+ FixedArray* array = FixedArray::cast(object);
938
+ for (int i = 0; i < array->length(); ++i) {
939
+ if (!CheckOneBackPointer(current_map, array->get(i))) {
940
+ return false;
941
+ }
942
+ }
943
+ }
944
+ break;
945
+ }
946
+ case CALLBACKS: {
947
+ Object* object = GetValue(i);
948
+ if (object->IsAccessorPair()) {
949
+ AccessorPair* accessors = AccessorPair::cast(object);
950
+ if (!CheckOneBackPointer(current_map, accessors->getter())) {
951
+ return false;
952
+ }
953
+ if (!CheckOneBackPointer(current_map, accessors->setter())) {
954
+ return false;
955
+ }
956
+ }
957
+ break;
958
+ }
959
+ case NORMAL:
960
+ case FIELD:
961
+ case CONSTANT_FUNCTION:
962
+ case HANDLER:
963
+ case INTERCEPTOR:
964
+ case NULL_DESCRIPTOR:
965
+ break;
966
+ }
967
+ }
968
+ return true;
969
+ }
970
+
971
+
897
972
  void JSFunctionResultCache::JSFunctionResultCacheVerify() {
898
973
  JSFunction::cast(get(kFactoryIndex))->Verify();
899
974
 
@@ -935,6 +1010,28 @@ void NormalizedMapCache::NormalizedMapCacheVerify() {
935
1010
  }
936
1011
 
937
1012
 
1013
+ void Map::ZapInstanceDescriptors() {
1014
+ DescriptorArray* descriptors = instance_descriptors();
1015
+ if (descriptors == GetHeap()->empty_descriptor_array()) return;
1016
+ FixedArray* contents = FixedArray::cast(
1017
+ descriptors->get(DescriptorArray::kContentArrayIndex));
1018
+ MemsetPointer(descriptors->data_start(),
1019
+ GetHeap()->the_hole_value(),
1020
+ descriptors->length());
1021
+ MemsetPointer(contents->data_start(),
1022
+ GetHeap()->the_hole_value(),
1023
+ contents->length());
1024
+ }
1025
+
1026
+
1027
+ void Map::ZapPrototypeTransitions() {
1028
+ FixedArray* proto_transitions = prototype_transitions();
1029
+ MemsetPointer(proto_transitions->data_start(),
1030
+ GetHeap()->the_hole_value(),
1031
+ proto_transitions->length());
1032
+ }
1033
+
1034
+
938
1035
  #endif // DEBUG
939
1036
 
940
1037
  } } // namespace v8::internal