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
@@ -89,6 +89,7 @@ namespace internal {
89
89
  F(NotifyDeoptimized, 1, 1) \
90
90
  F(NotifyOSR, 0, 1) \
91
91
  F(DeoptimizeFunction, 1, 1) \
92
+ F(ClearFunctionTypeFeedback, 1, 1) \
92
93
  F(RunningInSimulator, 0, 1) \
93
94
  F(OptimizeFunctionOnNextCall, -1, 1) \
94
95
  F(GetOptimizationStatus, 1, 1) \
@@ -271,7 +272,6 @@ namespace internal {
271
272
  F(GetArrayKeys, 2, 1) \
272
273
  F(MoveArrayContents, 2, 1) \
273
274
  F(EstimateNumberOfElements, 1, 1) \
274
- F(SwapElements, 3, 1) \
275
275
  \
276
276
  /* Getters and Setters */ \
277
277
  F(LookupAccessor, 3, 1) \
@@ -364,9 +364,11 @@ namespace internal {
364
364
  F(IS_VAR, 1, 1) \
365
365
  \
366
366
  /* expose boolean functions from objects-inl.h */ \
367
- F(HasFastSmiOnlyElements, 1, 1) \
368
- F(HasFastElements, 1, 1) \
367
+ F(HasFastSmiElements, 1, 1) \
368
+ F(HasFastSmiOrObjectElements, 1, 1) \
369
+ F(HasFastObjectElements, 1, 1) \
369
370
  F(HasFastDoubleElements, 1, 1) \
371
+ F(HasFastHoleyElements, 1, 1) \
370
372
  F(HasDictionaryElements, 1, 1) \
371
373
  F(HasExternalPixelElements, 1, 1) \
372
374
  F(HasExternalArrayElements, 1, 1) \
@@ -535,8 +537,7 @@ namespace internal {
535
537
  F(RegExpExec, 4, 1) \
536
538
  F(RegExpConstructResult, 3, 1) \
537
539
  F(GetFromCache, 2, 1) \
538
- F(NumberToString, 1, 1) \
539
- F(SwapElements, 3, 1)
540
+ F(NumberToString, 1, 1)
540
541
 
541
542
 
542
543
  //---------------------------------------------------------------------------
@@ -658,6 +658,26 @@ bool Scope::HasTrivialOuterContext() const {
658
658
  }
659
659
 
660
660
 
661
+ bool Scope::AllowsLazyRecompilation() const {
662
+ return !force_eager_compilation_ &&
663
+ !TrivialDeclarationScopesBeforeWithScope();
664
+ }
665
+
666
+
667
+ bool Scope::TrivialDeclarationScopesBeforeWithScope() const {
668
+ Scope* outer = outer_scope_;
669
+ if (outer == NULL) return false;
670
+ outer = outer->DeclarationScope();
671
+ while (outer != NULL) {
672
+ if (outer->is_with_scope()) return true;
673
+ if (outer->is_declaration_scope() && outer->num_heap_slots() > 0)
674
+ return false;
675
+ outer = outer->outer_scope_;
676
+ }
677
+ return false;
678
+ }
679
+
680
+
661
681
  int Scope::ContextChainLength(Scope* scope) {
662
682
  int n = 0;
663
683
  for (Scope* s = this; s != scope; s = s->outer_scope_) {
@@ -362,13 +362,16 @@ class Scope: public ZoneObject {
362
362
  bool AllowsLazyCompilation() const;
363
363
 
364
364
  // True if we can lazily recompile functions with this scope.
365
- bool allows_lazy_recompilation() const {
366
- return !force_eager_compilation_;
367
- }
365
+ bool AllowsLazyRecompilation() const;
368
366
 
369
367
  // True if the outer context of this scope is always the global context.
370
368
  bool HasTrivialOuterContext() const;
371
369
 
370
+ // True if this scope is inside a with scope and all declaration scopes
371
+ // between them have empty contexts. Such declaration scopes become
372
+ // invisible during scope info deserialization.
373
+ bool TrivialDeclarationScopesBeforeWithScope() const;
374
+
372
375
  // The number of contexts between this and scope; zero if this == scope.
373
376
  int ContextChainLength(Scope* scope);
374
377
 
@@ -2295,8 +2295,6 @@ bool PagedSpace::AdvanceSweeper(intptr_t bytes_to_sweep) {
2295
2295
  first_unswept_page_ = p;
2296
2296
  }
2297
2297
 
2298
- heap()->LowerOldGenLimits(freed_bytes);
2299
-
2300
2298
  heap()->FreeQueuedChunks();
2301
2299
 
2302
2300
  return IsSweepingComplete();
@@ -1,4 +1,4 @@
1
- // Copyright 2011 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:
@@ -427,7 +427,7 @@ void StringStream::PrintMentionedObjectCache() {
427
427
  PrintUsingMap(JSObject::cast(printee));
428
428
  if (printee->IsJSArray()) {
429
429
  JSArray* array = JSArray::cast(printee);
430
- if (array->HasFastElements()) {
430
+ if (array->HasFastObjectElements()) {
431
431
  unsigned int limit = FixedArray::cast(array->elements())->length();
432
432
  unsigned int length =
433
433
  static_cast<uint32_t>(JSArray::cast(array)->length()->Number());
@@ -236,8 +236,6 @@ namespace internal {
236
236
  SC(math_sin, V8.MathSin) \
237
237
  SC(math_sqrt, V8.MathSqrt) \
238
238
  SC(math_tan, V8.MathTan) \
239
- SC(array_bounds_checks_seen, V8.ArrayBoundsChecksSeen) \
240
- SC(array_bounds_checks_removed, V8.ArrayBoundsChecksRemoved) \
241
239
  SC(transcendental_cache_hit, V8.TranscendentalCacheHit) \
242
240
  SC(transcendental_cache_miss, V8.TranscendentalCacheMiss) \
243
241
  SC(stack_interrupts, V8.StackInterrupts) \
@@ -337,7 +337,7 @@ function ObjectKeys(obj) {
337
337
  if (%IsJSProxy(obj)) {
338
338
  var handler = %GetHandler(obj);
339
339
  var names = CallTrap0(handler, "keys", DerivedKeysTrap);
340
- return ToStringArray(names);
340
+ return ToStringArray(names, "keys");
341
341
  }
342
342
  return %LocalKeys(obj);
343
343
  }
@@ -963,7 +963,7 @@ function ToStringArray(obj, trap) {
963
963
  var names = {}; // TODO(rossberg): use sets once they are ready.
964
964
  for (var index = 0; index < n; index++) {
965
965
  var s = ToString(obj[index]);
966
- if (s in names) {
966
+ if (%HasLocalProperty(names, s)) {
967
967
  throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]);
968
968
  }
969
969
  array[index] = s;
@@ -1,4 +1,4 @@
1
- // Copyright 2011 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:
@@ -199,10 +199,13 @@ Vector<const char> ReadFile(FILE* file,
199
199
  bool verbose = true);
200
200
 
201
201
 
202
-
203
202
  // Copy from ASCII/16bit chars to ASCII/16bit chars.
204
203
  template <typename sourcechar, typename sinkchar>
205
- inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
204
+ INLINE(void CopyChars(sinkchar* dest, const sourcechar* src, int chars));
205
+
206
+
207
+ template <typename sourcechar, typename sinkchar>
208
+ void CopyChars(sinkchar* dest, const sourcechar* src, int chars) {
206
209
  sinkchar* limit = dest + chars;
207
210
  #ifdef V8_HOST_CAN_READ_UNALIGNED
208
211
  if (sizeof(*dest) == sizeof(*src)) {
@@ -33,7 +33,7 @@
33
33
  // NOTE these macros are used by the SCons build script so their names
34
34
  // cannot be changed without changing the SCons build script.
35
35
  #define MAJOR_VERSION 3
36
- #define MINOR_VERSION 10
36
+ #define MINOR_VERSION 11
37
37
  #define BUILD_NUMBER 8
38
38
  #define PATCH_LEVEL 0
39
39
  // Use 1 for candidates and 0 otherwise.
@@ -629,7 +629,8 @@ class Assembler : public AssemblerBase {
629
629
  static const byte kJccShortPrefix = 0x70;
630
630
  static const byte kJncShortOpcode = kJccShortPrefix | not_carry;
631
631
  static const byte kJcShortOpcode = kJccShortPrefix | carry;
632
-
632
+ static const byte kJnzShortOpcode = kJccShortPrefix | not_zero;
633
+ static const byte kJzShortOpcode = kJccShortPrefix | zero;
633
634
 
634
635
 
635
636
  // ---------------------------------------------------------------------------
@@ -977,7 +977,7 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
977
977
  const int initial_capacity = JSArray::kPreallocatedArrayElements;
978
978
  STATIC_ASSERT(initial_capacity >= 0);
979
979
 
980
- __ LoadInitialArrayMap(array_function, scratch2, scratch1);
980
+ __ LoadInitialArrayMap(array_function, scratch2, scratch1, false);
981
981
 
982
982
  // Allocate the JSArray object together with space for a fixed array with the
983
983
  // requested elements.
@@ -1076,7 +1076,8 @@ static void AllocateJSArray(MacroAssembler* masm,
1076
1076
  Register scratch,
1077
1077
  bool fill_with_hole,
1078
1078
  Label* gc_required) {
1079
- __ LoadInitialArrayMap(array_function, scratch, elements_array);
1079
+ __ LoadInitialArrayMap(array_function, scratch,
1080
+ elements_array, fill_with_hole);
1080
1081
 
1081
1082
  if (FLAG_debug_code) { // Assert that array size is not zero.
1082
1083
  __ testq(array_size, array_size);
@@ -1303,10 +1304,10 @@ static void ArrayNativeCode(MacroAssembler* masm,
1303
1304
  __ jmp(call_generic_code);
1304
1305
 
1305
1306
  __ bind(&not_double);
1306
- // Transition FAST_SMI_ONLY_ELEMENTS to FAST_ELEMENTS.
1307
+ // Transition FAST_SMI_ELEMENTS to FAST_ELEMENTS.
1307
1308
  // rbx: JSArray
1308
1309
  __ movq(r11, FieldOperand(rbx, HeapObject::kMapOffset));
1309
- __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS,
1310
+ __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
1310
1311
  FAST_ELEMENTS,
1311
1312
  r11,
1312
1313
  kScratchRegister,
@@ -2864,30 +2864,37 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
2864
2864
  __ IncrementCounter(counters->regexp_entry_native(), 1);
2865
2865
 
2866
2866
  // Isolates: note we add an additional parameter here (isolate pointer).
2867
- static const int kRegExpExecuteArguments = 8;
2867
+ static const int kRegExpExecuteArguments = 9;
2868
2868
  int argument_slots_on_stack =
2869
2869
  masm->ArgumentStackSlotsForCFunctionCall(kRegExpExecuteArguments);
2870
2870
  __ EnterApiExitFrame(argument_slots_on_stack);
2871
2871
 
2872
- // Argument 8: Pass current isolate address.
2872
+ // Argument 9: Pass current isolate address.
2873
2873
  // __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize),
2874
2874
  // Immediate(ExternalReference::isolate_address()));
2875
2875
  __ LoadAddress(kScratchRegister, ExternalReference::isolate_address());
2876
2876
  __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize),
2877
2877
  kScratchRegister);
2878
2878
 
2879
- // Argument 7: Indicate that this is a direct call from JavaScript.
2879
+ // Argument 8: Indicate that this is a direct call from JavaScript.
2880
2880
  __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kPointerSize),
2881
2881
  Immediate(1));
2882
2882
 
2883
- // Argument 6: Start (high end) of backtracking stack memory area.
2883
+ // Argument 7: Start (high end) of backtracking stack memory area.
2884
2884
  __ movq(kScratchRegister, address_of_regexp_stack_memory_address);
2885
2885
  __ movq(r9, Operand(kScratchRegister, 0));
2886
2886
  __ movq(kScratchRegister, address_of_regexp_stack_memory_size);
2887
2887
  __ addq(r9, Operand(kScratchRegister, 0));
2888
- // Argument 6 passed in r9 on Linux and on the stack on Windows.
2889
- #ifdef _WIN64
2890
2888
  __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kPointerSize), r9);
2889
+
2890
+ // Argument 6: Set the number of capture registers to zero to force global
2891
+ // regexps to behave as non-global. This does not affect non-global regexps.
2892
+ // Argument 6 is passed in r9 on Linux and on the stack on Windows.
2893
+ #ifdef _WIN64
2894
+ __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kPointerSize),
2895
+ Immediate(0));
2896
+ #else
2897
+ __ Set(r9, 0);
2891
2898
  #endif
2892
2899
 
2893
2900
  // Argument 5: static offsets vector buffer.
@@ -2895,7 +2902,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
2895
2902
  ExternalReference::address_of_static_offsets_vector(isolate));
2896
2903
  // Argument 5 passed in r8 on Linux and on the stack on Windows.
2897
2904
  #ifdef _WIN64
2898
- __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kPointerSize), r8);
2905
+ __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kPointerSize), r8);
2899
2906
  #endif
2900
2907
 
2901
2908
  // First four arguments are passed in registers on both Linux and Windows.
@@ -2960,7 +2967,9 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
2960
2967
  // Check the result.
2961
2968
  Label success;
2962
2969
  Label exception;
2963
- __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::SUCCESS));
2970
+ __ cmpl(rax, Immediate(1));
2971
+ // We expect exactly one result since we force the called regexp to behave
2972
+ // as non-global.
2964
2973
  __ j(equal, &success, Label::kNear);
2965
2974
  __ cmpl(rax, Immediate(NativeRegExpMacroAssembler::EXCEPTION));
2966
2975
  __ j(equal, &exception);
@@ -5993,12 +6002,12 @@ struct AheadOfTimeWriteBarrierStubList kAheadOfTime[] = {
5993
6002
  // KeyedStoreStubCompiler::GenerateStoreFastElement.
5994
6003
  { REG(rdi), REG(rbx), REG(rcx), EMIT_REMEMBERED_SET},
5995
6004
  { REG(rdx), REG(rdi), REG(rbx), EMIT_REMEMBERED_SET},
5996
- // ElementsTransitionGenerator::GenerateSmiOnlyToObject
5997
- // and ElementsTransitionGenerator::GenerateSmiOnlyToObject
6005
+ // ElementsTransitionGenerator::GenerateMapChangeElementTransition
6006
+ // and ElementsTransitionGenerator::GenerateSmiToDouble
5998
6007
  // and ElementsTransitionGenerator::GenerateDoubleToObject
5999
6008
  { REG(rdx), REG(rbx), REG(rdi), EMIT_REMEMBERED_SET},
6000
6009
  { REG(rdx), REG(rbx), REG(rdi), OMIT_REMEMBERED_SET},
6001
- // ElementsTransitionGenerator::GenerateSmiOnlyToDouble
6010
+ // ElementsTransitionGenerator::GenerateSmiToDouble
6002
6011
  // and ElementsTransitionGenerator::GenerateDoubleToObject
6003
6012
  { REG(rdx), REG(r11), REG(r15), EMIT_REMEMBERED_SET},
6004
6013
  // ElementsTransitionGenerator::GenerateDoubleToObject
@@ -6272,9 +6281,9 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
6272
6281
 
6273
6282
  __ CheckFastElements(rdi, &double_elements);
6274
6283
 
6275
- // FAST_SMI_ONLY_ELEMENTS or FAST_ELEMENTS
6284
+ // FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS
6276
6285
  __ JumpIfSmi(rax, &smi_element);
6277
- __ CheckFastSmiOnlyElements(rdi, &fast_elements);
6286
+ __ CheckFastSmiElements(rdi, &fast_elements);
6278
6287
 
6279
6288
  // Store into the array literal requires a elements transition. Call into
6280
6289
  // the runtime.
@@ -6292,7 +6301,7 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
6292
6301
  // place.
6293
6302
  __ TailCallRuntime(Runtime::kStoreArrayLiteralElement, 5, 1);
6294
6303
 
6295
- // Array literal has ElementsKind of FAST_ELEMENTS and value is an object.
6304
+ // Array literal has ElementsKind of FAST_*_ELEMENTS and value is an object.
6296
6305
  __ bind(&fast_elements);
6297
6306
  __ SmiToInteger32(kScratchRegister, rcx);
6298
6307
  __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset));
@@ -6306,8 +6315,8 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
6306
6315
  OMIT_SMI_CHECK);
6307
6316
  __ ret(0);
6308
6317
 
6309
- // Array literal has ElementsKind of FAST_SMI_ONLY_ELEMENTS or
6310
- // FAST_ELEMENTS, and value is Smi.
6318
+ // Array literal has ElementsKind of FAST_*_SMI_ELEMENTS or
6319
+ // FAST_*_ELEMENTS, and value is Smi.
6311
6320
  __ bind(&smi_element);
6312
6321
  __ SmiToInteger32(kScratchRegister, rcx);
6313
6322
  __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset));
@@ -220,7 +220,7 @@ ModuloFunction CreateModuloFunction() {
220
220
 
221
221
  #define __ ACCESS_MASM(masm)
222
222
 
223
- void ElementsTransitionGenerator::GenerateSmiOnlyToObject(
223
+ void ElementsTransitionGenerator::GenerateMapChangeElementsTransition(
224
224
  MacroAssembler* masm) {
225
225
  // ----------- S t a t e -------------
226
226
  // -- rax : value
@@ -241,7 +241,7 @@ void ElementsTransitionGenerator::GenerateSmiOnlyToObject(
241
241
  }
242
242
 
243
243
 
244
- void ElementsTransitionGenerator::GenerateSmiOnlyToDouble(
244
+ void ElementsTransitionGenerator::GenerateSmiToDouble(
245
245
  MacroAssembler* masm, Label* fail) {
246
246
  // ----------- S t a t e -------------
247
247
  // -- rax : value
@@ -1,4 +1,4 @@
1
- // Copyright 2011 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:
@@ -91,6 +91,8 @@ void BreakLocationIterator::ClearDebugBreakAtSlot() {
91
91
  rinfo()->PatchCode(original_rinfo()->pc(), Assembler::kDebugBreakSlotLength);
92
92
  }
93
93
 
94
+ const bool Debug::FramePaddingLayout::kIsSupported = true;
95
+
94
96
 
95
97
  #define __ ACCESS_MASM(masm)
96
98
 
@@ -103,6 +105,12 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
103
105
  {
104
106
  FrameScope scope(masm, StackFrame::INTERNAL);
105
107
 
108
+ // Load padding words on stack.
109
+ for (int i = 0; i < Debug::FramePaddingLayout::kInitialSize; i++) {
110
+ __ Push(Smi::FromInt(Debug::FramePaddingLayout::kPaddingValue));
111
+ }
112
+ __ Push(Smi::FromInt(Debug::FramePaddingLayout::kInitialSize));
113
+
106
114
  // Store the registers containing live values on the expression stack to
107
115
  // make sure that these are correctly updated during GC. Non object values
108
116
  // are stored as as two smis causing it to be untouched by GC.
@@ -157,6 +165,11 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
157
165
  }
158
166
  }
159
167
 
168
+ // Read current padding counter and skip corresponding number of words.
169
+ __ pop(kScratchRegister);
170
+ __ SmiToInteger32(kScratchRegister, kScratchRegister);
171
+ __ lea(rsp, Operand(rsp, kScratchRegister, times_pointer_size, 0));
172
+
160
173
  // Get rid of the internal frame.
161
174
  }
162
175
 
@@ -1684,7 +1684,7 @@ int DisassemblerX64::InstructionDecode(v8::internal::Vector<char> out_buffer,
1684
1684
  default:
1685
1685
  UNREACHABLE();
1686
1686
  }
1687
- AppendToBuffer("test%c rax,0x%"V8_PTR_PREFIX"x",
1687
+ AppendToBuffer("test%c rax,0x%" V8_PTR_PREFIX "x",
1688
1688
  operand_size_code(),
1689
1689
  value);
1690
1690
  break;
@@ -659,7 +659,7 @@ void FullCodeGenerator::DoTest(Expression* condition,
659
659
  Label* fall_through) {
660
660
  ToBooleanStub stub(result_register());
661
661
  __ push(result_register());
662
- __ CallStub(&stub);
662
+ __ CallStub(&stub, condition->test_id());
663
663
  __ testq(result_register(), result_register());
664
664
  // The stub returns nonzero for true.
665
665
  Split(not_zero, if_true, if_false, fall_through);
@@ -1659,7 +1659,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1659
1659
  ASSERT_EQ(2, constant_elements->length());
1660
1660
  ElementsKind constant_elements_kind =
1661
1661
  static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1662
- bool has_constant_fast_elements = constant_elements_kind == FAST_ELEMENTS;
1662
+ bool has_constant_fast_elements =
1663
+ IsFastObjectElementsKind(constant_elements_kind);
1663
1664
  Handle<FixedArrayBase> constant_elements_values(
1664
1665
  FixedArrayBase::cast(constant_elements->get(1)));
1665
1666
 
@@ -1670,7 +1671,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1670
1671
  Heap* heap = isolate()->heap();
1671
1672
  if (has_constant_fast_elements &&
1672
1673
  constant_elements_values->map() == heap->fixed_cow_array_map()) {
1673
- // If the elements are already FAST_ELEMENTS, the boilerplate cannot
1674
+ // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1674
1675
  // change, so it's possible to specialize the stub in advance.
1675
1676
  __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1);
1676
1677
  FastCloneShallowArrayStub stub(
@@ -1682,10 +1683,9 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1682
1683
  } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1683
1684
  __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3);
1684
1685
  } else {
1685
- ASSERT(constant_elements_kind == FAST_ELEMENTS ||
1686
- constant_elements_kind == FAST_SMI_ONLY_ELEMENTS ||
1686
+ ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
1687
1687
  FLAG_smi_only_arrays);
1688
- // If the elements are already FAST_ELEMENTS, the boilerplate cannot
1688
+ // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot
1689
1689
  // change, so it's possible to specialize the stub in advance.
1690
1690
  FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements
1691
1691
  ? FastCloneShallowArrayStub::CLONE_ELEMENTS
@@ -1713,9 +1713,9 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1713
1713
  }
1714
1714
  VisitForAccumulatorValue(subexpr);
1715
1715
 
1716
- if (constant_elements_kind == FAST_ELEMENTS) {
1717
- // Fast-case array literal with ElementsKind of FAST_ELEMENTS, they cannot
1718
- // transition and don't need to call the runtime stub.
1716
+ if (IsFastObjectElementsKind(constant_elements_kind)) {
1717
+ // Fast-case array literal with ElementsKind of FAST_*_ELEMENTS, they
1718
+ // cannot transition and don't need to call the runtime stub.
1719
1719
  int offset = FixedArray::kHeaderSize + (i * kPointerSize);
1720
1720
  __ movq(rbx, Operand(rsp, 0)); // Copy of array literal.
1721
1721
  __ movq(rbx, FieldOperand(rbx, JSObject::kElementsOffset));
@@ -2287,7 +2287,7 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) {
2287
2287
 
2288
2288
  CallFunctionStub stub(arg_count, flags);
2289
2289
  __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize));
2290
- __ CallStub(&stub);
2290
+ __ CallStub(&stub, expr->id());
2291
2291
  RecordJSReturnSite(expr);
2292
2292
  // Restore context register.
2293
2293
  __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
@@ -3360,102 +3360,6 @@ void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) {
3360
3360
  }
3361
3361
 
3362
3362
 
3363
- void FullCodeGenerator::EmitSwapElements(CallRuntime* expr) {
3364
- ZoneList<Expression*>* args = expr->arguments();
3365
- ASSERT(args->length() == 3);
3366
- VisitForStackValue(args->at(0));
3367
- VisitForStackValue(args->at(1));
3368
- VisitForStackValue(args->at(2));
3369
- Label done;
3370
- Label slow_case;
3371
- Register object = rax;
3372
- Register index_1 = rbx;
3373
- Register index_2 = rcx;
3374
- Register elements = rdi;
3375
- Register temp = rdx;
3376
- __ movq(object, Operand(rsp, 2 * kPointerSize));
3377
- // Fetch the map and check if array is in fast case.
3378
- // Check that object doesn't require security checks and
3379
- // has no indexed interceptor.
3380
- __ CmpObjectType(object, JS_ARRAY_TYPE, temp);
3381
- __ j(not_equal, &slow_case);
3382
- __ testb(FieldOperand(temp, Map::kBitFieldOffset),
3383
- Immediate(KeyedLoadIC::kSlowCaseBitFieldMask));
3384
- __ j(not_zero, &slow_case);
3385
-
3386
- // Check the object's elements are in fast case and writable.
3387
- __ movq(elements, FieldOperand(object, JSObject::kElementsOffset));
3388
- __ CompareRoot(FieldOperand(elements, HeapObject::kMapOffset),
3389
- Heap::kFixedArrayMapRootIndex);
3390
- __ j(not_equal, &slow_case);
3391
-
3392
- // Check that both indices are smis.
3393
- __ movq(index_1, Operand(rsp, 1 * kPointerSize));
3394
- __ movq(index_2, Operand(rsp, 0 * kPointerSize));
3395
- __ JumpIfNotBothSmi(index_1, index_2, &slow_case);
3396
-
3397
- // Check that both indices are valid.
3398
- // The JSArray length field is a smi since the array is in fast case mode.
3399
- __ movq(temp, FieldOperand(object, JSArray::kLengthOffset));
3400
- __ SmiCompare(temp, index_1);
3401
- __ j(below_equal, &slow_case);
3402
- __ SmiCompare(temp, index_2);
3403
- __ j(below_equal, &slow_case);
3404
-
3405
- __ SmiToInteger32(index_1, index_1);
3406
- __ SmiToInteger32(index_2, index_2);
3407
- // Bring addresses into index1 and index2.
3408
- __ lea(index_1, FieldOperand(elements, index_1, times_pointer_size,
3409
- FixedArray::kHeaderSize));
3410
- __ lea(index_2, FieldOperand(elements, index_2, times_pointer_size,
3411
- FixedArray::kHeaderSize));
3412
-
3413
- // Swap elements. Use object and temp as scratch registers.
3414
- __ movq(object, Operand(index_1, 0));
3415
- __ movq(temp, Operand(index_2, 0));
3416
- __ movq(Operand(index_2, 0), object);
3417
- __ movq(Operand(index_1, 0), temp);
3418
-
3419
- Label no_remembered_set;
3420
- __ CheckPageFlag(elements,
3421
- temp,
3422
- 1 << MemoryChunk::SCAN_ON_SCAVENGE,
3423
- not_zero,
3424
- &no_remembered_set,
3425
- Label::kNear);
3426
- // Possible optimization: do a check that both values are Smis
3427
- // (or them and test against Smi mask.)
3428
-
3429
- // We are swapping two objects in an array and the incremental marker never
3430
- // pauses in the middle of scanning a single object. Therefore the
3431
- // incremental marker is not disturbed, so we don't need to call the
3432
- // RecordWrite stub that notifies the incremental marker.
3433
- __ RememberedSetHelper(elements,
3434
- index_1,
3435
- temp,
3436
- kDontSaveFPRegs,
3437
- MacroAssembler::kFallThroughAtEnd);
3438
- __ RememberedSetHelper(elements,
3439
- index_2,
3440
- temp,
3441
- kDontSaveFPRegs,
3442
- MacroAssembler::kFallThroughAtEnd);
3443
-
3444
- __ bind(&no_remembered_set);
3445
-
3446
- // We are done. Drop elements from the stack, and return undefined.
3447
- __ addq(rsp, Immediate(3 * kPointerSize));
3448
- __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
3449
- __ jmp(&done);
3450
-
3451
- __ bind(&slow_case);
3452
- __ CallRuntime(Runtime::kSwapElements, 3);
3453
-
3454
- __ bind(&done);
3455
- context()->Plug(rax);
3456
- }
3457
-
3458
-
3459
3363
  void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
3460
3364
  ZoneList<Expression*>* args = expr->arguments();
3461
3365
  ASSERT_EQ(2, args->length());