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
@@ -42,6 +42,7 @@ typedef bool (*IsAliveFunction)(HeapObject* obj, int* size, int* offset);
42
42
  // Forward declarations.
43
43
  class CodeFlusher;
44
44
  class GCTracer;
45
+ class MarkCompactCollector;
45
46
  class MarkingVisitor;
46
47
  class RootMarkingVisitor;
47
48
 
@@ -166,7 +167,6 @@ class Marking {
166
167
 
167
168
  // ----------------------------------------------------------------------------
168
169
  // Marking deque for tracing live objects.
169
-
170
170
  class MarkingDeque {
171
171
  public:
172
172
  MarkingDeque()
@@ -383,6 +383,34 @@ class SlotsBuffer {
383
383
  };
384
384
 
385
385
 
386
+ // -------------------------------------------------------------------------
387
+ // Marker shared between incremental and non-incremental marking
388
+ template<class BaseMarker> class Marker {
389
+ public:
390
+ Marker(BaseMarker* base_marker, MarkCompactCollector* mark_compact_collector)
391
+ : base_marker_(base_marker),
392
+ mark_compact_collector_(mark_compact_collector) {}
393
+
394
+ // Mark pointers in a Map and its DescriptorArray together, possibly
395
+ // treating transitions or back pointers weak.
396
+ void MarkMapContents(Map* map);
397
+ void MarkDescriptorArray(DescriptorArray* descriptors);
398
+ void MarkAccessorPairSlot(AccessorPair* accessors, int offset);
399
+
400
+ private:
401
+ BaseMarker* base_marker() {
402
+ return base_marker_;
403
+ }
404
+
405
+ MarkCompactCollector* mark_compact_collector() {
406
+ return mark_compact_collector_;
407
+ }
408
+
409
+ BaseMarker* base_marker_;
410
+ MarkCompactCollector* mark_compact_collector_;
411
+ };
412
+
413
+
386
414
  // Defined in isolate.h.
387
415
  class ThreadLocalTop;
388
416
 
@@ -584,8 +612,6 @@ class MarkCompactCollector {
584
612
 
585
613
  bool was_marked_incrementally_;
586
614
 
587
- bool collect_maps_;
588
-
589
615
  bool flush_monomorphic_ics_;
590
616
 
591
617
  // A pointer to the current stack-allocated GC tracer object during a full
@@ -608,12 +634,13 @@ class MarkCompactCollector {
608
634
  //
609
635
  // After: Live objects are marked and non-live objects are unmarked.
610
636
 
611
-
612
637
  friend class RootMarkingVisitor;
613
638
  friend class MarkingVisitor;
614
639
  friend class StaticMarkingVisitor;
615
640
  friend class CodeMarkingVisitor;
616
641
  friend class SharedFunctionInfoMarkingVisitor;
642
+ friend class Marker<IncrementalMarking>;
643
+ friend class Marker<MarkCompactCollector>;
617
644
 
618
645
  // Mark non-optimize code for functions inlined into the given optimized
619
646
  // code. This will prevent it from being flushed.
@@ -631,29 +658,25 @@ class MarkCompactCollector {
631
658
  void AfterMarking();
632
659
 
633
660
  // Marks the object black and pushes it on the marking stack.
634
- // This is for non-incremental marking.
661
+ // Returns true if object needed marking and false otherwise.
662
+ // This is for non-incremental marking only.
663
+ INLINE(bool MarkObjectAndPush(HeapObject* obj));
664
+
665
+ // Marks the object black and pushes it on the marking stack.
666
+ // This is for non-incremental marking only.
635
667
  INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit));
636
668
 
637
- INLINE(bool MarkObjectWithoutPush(HeapObject* object));
638
- INLINE(void MarkObjectAndPush(HeapObject* value));
669
+ // Marks the object black without pushing it on the marking stack.
670
+ // Returns true if object needed marking and false otherwise.
671
+ // This is for non-incremental marking only.
672
+ INLINE(bool MarkObjectWithoutPush(HeapObject* obj));
639
673
 
640
- // Marks the object black. This is for non-incremental marking.
674
+ // Marks the object black assuming that it is not yet marked.
675
+ // This is for non-incremental marking only.
641
676
  INLINE(void SetMark(HeapObject* obj, MarkBit mark_bit));
642
677
 
643
678
  void ProcessNewlyMarkedObject(HeapObject* obj);
644
679
 
645
- // Creates back pointers for all map transitions, stores them in
646
- // the prototype field. The original prototype pointers are restored
647
- // in ClearNonLiveTransitions(). All JSObject maps
648
- // connected by map transitions have the same prototype object, which
649
- // is why we can use this field temporarily for back pointers.
650
- void CreateBackPointers();
651
-
652
- // Mark a Map and its DescriptorArray together, skipping transitions.
653
- void MarkMapContents(Map* map);
654
- void MarkAccessorPairSlot(HeapObject* accessors, int offset);
655
- void MarkDescriptorArray(DescriptorArray* descriptors);
656
-
657
680
  // Mark the heap roots and all objects reachable from them.
658
681
  void MarkRoots(RootMarkingVisitor* visitor);
659
682
 
@@ -756,6 +779,7 @@ class MarkCompactCollector {
756
779
  MarkingDeque marking_deque_;
757
780
  CodeFlusher* code_flusher_;
758
781
  Object* encountered_weak_maps_;
782
+ Marker<MarkCompactCollector> marker_;
759
783
 
760
784
  List<Page*> evacuation_candidates_;
761
785
  List<Code*> invalidated_code_;
@@ -61,18 +61,21 @@ function FormatString(format, message) {
61
61
 
62
62
 
63
63
  // To check if something is a native error we need to check the
64
- // concrete native error types. It is not enough to check "obj
65
- // instanceof $Error" because user code can replace
66
- // NativeError.prototype.__proto__. User code cannot replace
67
- // NativeError.prototype though and therefore this is a safe test.
64
+ // concrete native error types. It is not sufficient to use instanceof
65
+ // since it possible to create an object that has Error.prototype on
66
+ // its prototype chain. This is the case for DOMException for example.
68
67
  function IsNativeErrorObject(obj) {
69
- return (obj instanceof $Error) ||
70
- (obj instanceof $EvalError) ||
71
- (obj instanceof $RangeError) ||
72
- (obj instanceof $ReferenceError) ||
73
- (obj instanceof $SyntaxError) ||
74
- (obj instanceof $TypeError) ||
75
- (obj instanceof $URIError);
68
+ switch (%_ClassOf(obj)) {
69
+ case 'Error':
70
+ case 'EvalError':
71
+ case 'RangeError':
72
+ case 'ReferenceError':
73
+ case 'SyntaxError':
74
+ case 'TypeError':
75
+ case 'URIError':
76
+ return true;
77
+ }
78
+ return false;
76
79
  }
77
80
 
78
81
 
@@ -745,7 +748,7 @@ function GetPositionInLine(message) {
745
748
 
746
749
 
747
750
  function GetStackTraceLine(recv, fun, pos, isGlobal) {
748
- return FormatSourcePosition(new CallSite(recv, fun, pos));
751
+ return new CallSite(recv, fun, pos).toString();
749
752
  }
750
753
 
751
754
  // ----------------------------------------------------------------------------
@@ -785,15 +788,7 @@ function CallSiteGetThis() {
785
788
  }
786
789
 
787
790
  function CallSiteGetTypeName() {
788
- var constructor = this.receiver.constructor;
789
- if (!constructor) {
790
- return %_CallFunction(this.receiver, ObjectToString);
791
- }
792
- var constructorName = constructor.name;
793
- if (!constructorName) {
794
- return %_CallFunction(this.receiver, ObjectToString);
795
- }
796
- return constructorName;
791
+ return GetTypeName(this, false);
797
792
  }
798
793
 
799
794
  function CallSiteIsToplevel() {
@@ -827,8 +822,10 @@ function CallSiteGetFunctionName() {
827
822
  var name = this.fun.name;
828
823
  if (name) {
829
824
  return name;
830
- } else {
831
- return %FunctionGetInferredName(this.fun);
825
+ }
826
+ name = %FunctionGetInferredName(this.fun);
827
+ if (name) {
828
+ return name;
832
829
  }
833
830
  // Maybe this is an evaluation?
834
831
  var script = %FunctionGetScript(this.fun);
@@ -919,6 +916,69 @@ function CallSiteIsConstructor() {
919
916
  return this.fun === constructor;
920
917
  }
921
918
 
919
+ function CallSiteToString() {
920
+ var fileName;
921
+ var fileLocation = "";
922
+ if (this.isNative()) {
923
+ fileLocation = "native";
924
+ } else if (this.isEval()) {
925
+ fileName = this.getScriptNameOrSourceURL();
926
+ if (!fileName) {
927
+ fileLocation = this.getEvalOrigin();
928
+ }
929
+ } else {
930
+ fileName = this.getFileName();
931
+ }
932
+
933
+ if (fileName) {
934
+ fileLocation += fileName;
935
+ var lineNumber = this.getLineNumber();
936
+ if (lineNumber != null) {
937
+ fileLocation += ":" + lineNumber;
938
+ var columnNumber = this.getColumnNumber();
939
+ if (columnNumber) {
940
+ fileLocation += ":" + columnNumber;
941
+ }
942
+ }
943
+ }
944
+
945
+ if (!fileLocation) {
946
+ fileLocation = "unknown source";
947
+ }
948
+ var line = "";
949
+ var functionName = this.getFunctionName();
950
+ var addSuffix = true;
951
+ var isConstructor = this.isConstructor();
952
+ var isMethodCall = !(this.isToplevel() || isConstructor);
953
+ if (isMethodCall) {
954
+ var typeName = GetTypeName(this, true);
955
+ var methodName = this.getMethodName();
956
+ if (functionName) {
957
+ if (typeName && functionName.indexOf(typeName) != 0) {
958
+ line += typeName + ".";
959
+ }
960
+ line += functionName;
961
+ if (methodName && functionName.lastIndexOf("." + methodName) !=
962
+ functionName.length - methodName.length - 1) {
963
+ line += " [as " + methodName + "]";
964
+ }
965
+ } else {
966
+ line += typeName + "." + (methodName || "<anonymous>");
967
+ }
968
+ } else if (isConstructor) {
969
+ line += "new " + (functionName || "<anonymous>");
970
+ } else if (functionName) {
971
+ line += functionName;
972
+ } else {
973
+ line += fileLocation;
974
+ addSuffix = false;
975
+ }
976
+ if (addSuffix) {
977
+ line += " (" + fileLocation + ")";
978
+ }
979
+ return line;
980
+ }
981
+
922
982
  SetUpLockedPrototype(CallSite, $Array("receiver", "fun", "pos"), $Array(
923
983
  "getThis", CallSiteGetThis,
924
984
  "getTypeName", CallSiteGetTypeName,
@@ -934,7 +994,8 @@ SetUpLockedPrototype(CallSite, $Array("receiver", "fun", "pos"), $Array(
934
994
  "getColumnNumber", CallSiteGetColumnNumber,
935
995
  "isNative", CallSiteIsNative,
936
996
  "getPosition", CallSiteGetPosition,
937
- "isConstructor", CallSiteIsConstructor
997
+ "isConstructor", CallSiteIsConstructor,
998
+ "toString", CallSiteToString
938
999
  ));
939
1000
 
940
1001
 
@@ -976,65 +1037,6 @@ function FormatEvalOrigin(script) {
976
1037
  return eval_origin;
977
1038
  }
978
1039
 
979
- function FormatSourcePosition(frame) {
980
- var fileName;
981
- var fileLocation = "";
982
- if (frame.isNative()) {
983
- fileLocation = "native";
984
- } else if (frame.isEval()) {
985
- fileName = frame.getScriptNameOrSourceURL();
986
- if (!fileName) {
987
- fileLocation = frame.getEvalOrigin();
988
- }
989
- } else {
990
- fileName = frame.getFileName();
991
- }
992
-
993
- if (fileName) {
994
- fileLocation += fileName;
995
- var lineNumber = frame.getLineNumber();
996
- if (lineNumber != null) {
997
- fileLocation += ":" + lineNumber;
998
- var columnNumber = frame.getColumnNumber();
999
- if (columnNumber) {
1000
- fileLocation += ":" + columnNumber;
1001
- }
1002
- }
1003
- }
1004
-
1005
- if (!fileLocation) {
1006
- fileLocation = "unknown source";
1007
- }
1008
- var line = "";
1009
- var functionName = frame.getFunction().name;
1010
- var addPrefix = true;
1011
- var isConstructor = frame.isConstructor();
1012
- var isMethodCall = !(frame.isToplevel() || isConstructor);
1013
- if (isMethodCall) {
1014
- var methodName = frame.getMethodName();
1015
- line += frame.getTypeName() + ".";
1016
- if (functionName) {
1017
- line += functionName;
1018
- if (methodName && (methodName != functionName)) {
1019
- line += " [as " + methodName + "]";
1020
- }
1021
- } else {
1022
- line += methodName || "<anonymous>";
1023
- }
1024
- } else if (isConstructor) {
1025
- line += "new " + (functionName || "<anonymous>");
1026
- } else if (functionName) {
1027
- line += functionName;
1028
- } else {
1029
- line += fileLocation;
1030
- addPrefix = false;
1031
- }
1032
- if (addPrefix) {
1033
- line += " (" + fileLocation + ")";
1034
- }
1035
- return line;
1036
- }
1037
-
1038
1040
  function FormatStackTrace(error, frames) {
1039
1041
  var lines = [];
1040
1042
  try {
@@ -1050,7 +1052,7 @@ function FormatStackTrace(error, frames) {
1050
1052
  var frame = frames[i];
1051
1053
  var line;
1052
1054
  try {
1053
- line = FormatSourcePosition(frame);
1055
+ line = frame.toString();
1054
1056
  } catch (e) {
1055
1057
  try {
1056
1058
  line = "<error: " + e + ">";
@@ -1081,6 +1083,19 @@ function FormatRawStackTrace(error, raw_stack) {
1081
1083
  }
1082
1084
  }
1083
1085
 
1086
+ function GetTypeName(obj, requireConstructor) {
1087
+ var constructor = obj.receiver.constructor;
1088
+ if (!constructor) {
1089
+ return requireConstructor ? null :
1090
+ %_CallFunction(obj.receiver, ObjectToString);
1091
+ }
1092
+ var constructorName = constructor.name;
1093
+ if (!constructorName) {
1094
+ return requireConstructor ? null :
1095
+ %_CallFunction(obj.receiver, ObjectToString);
1096
+ }
1097
+ return constructorName;
1098
+ }
1084
1099
 
1085
1100
  function captureStackTrace(obj, cons_opt) {
1086
1101
  var stackTraceLimit = $Error.stackTraceLimit;
@@ -1125,13 +1140,7 @@ function SetUpError() {
1125
1140
  }
1126
1141
  %FunctionSetInstanceClassName(f, 'Error');
1127
1142
  %SetProperty(f.prototype, 'constructor', f, DONT_ENUM);
1128
- // The name property on the prototype of error objects is not
1129
- // specified as being read-one and dont-delete. However, allowing
1130
- // overwriting allows leaks of error objects between script blocks
1131
- // in the same context in a browser setting. Therefore we fix the
1132
- // name.
1133
- %SetProperty(f.prototype, "name", name,
1134
- DONT_ENUM | DONT_DELETE | READ_ONLY) ;
1143
+ %SetProperty(f.prototype, "name", name, DONT_ENUM);
1135
1144
  %SetCode(f, function(m) {
1136
1145
  if (%_IsConstructCall()) {
1137
1146
  // Define all the expected properties directly on the error
@@ -1147,10 +1156,8 @@ function SetUpError() {
1147
1156
  return FormatMessage(%NewMessageObject(obj.type, obj.arguments));
1148
1157
  });
1149
1158
  } else if (!IS_UNDEFINED(m)) {
1150
- %IgnoreAttributesAndSetProperty(this,
1151
- 'message',
1152
- ToString(m),
1153
- DONT_ENUM);
1159
+ %IgnoreAttributesAndSetProperty(
1160
+ this, 'message', ToString(m), DONT_ENUM);
1154
1161
  }
1155
1162
  captureStackTrace(this, f);
1156
1163
  } else {
@@ -1180,16 +1187,41 @@ $Error.captureStackTrace = captureStackTrace;
1180
1187
  var visited_errors = new InternalArray();
1181
1188
  var cyclic_error_marker = new $Object();
1182
1189
 
1190
+ function GetPropertyWithoutInvokingMonkeyGetters(error, name) {
1191
+ // Climb the prototype chain until we find the holder.
1192
+ while (error && !%HasLocalProperty(error, name)) {
1193
+ error = error.__proto__;
1194
+ }
1195
+ if (error === null) return void 0;
1196
+ if (!IS_OBJECT(error)) return error[name];
1197
+ // If the property is an accessor on one of the predefined errors that can be
1198
+ // generated statically by the compiler, don't touch it. This is to address
1199
+ // http://code.google.com/p/chromium/issues/detail?id=69187
1200
+ var desc = %GetOwnProperty(error, name);
1201
+ if (desc && desc[IS_ACCESSOR_INDEX]) {
1202
+ var isName = name === "name";
1203
+ if (error === $ReferenceError.prototype)
1204
+ return isName ? "ReferenceError" : void 0;
1205
+ if (error === $SyntaxError.prototype)
1206
+ return isName ? "SyntaxError" : void 0;
1207
+ if (error === $TypeError.prototype)
1208
+ return isName ? "TypeError" : void 0;
1209
+ }
1210
+ // Otherwise, read normally.
1211
+ return error[name];
1212
+ }
1213
+
1183
1214
  function ErrorToStringDetectCycle(error) {
1184
1215
  if (!%PushIfAbsent(visited_errors, error)) throw cyclic_error_marker;
1185
1216
  try {
1186
- var type = error.type;
1187
- var name = error.name;
1217
+ var type = GetPropertyWithoutInvokingMonkeyGetters(error, "type");
1218
+ var name = GetPropertyWithoutInvokingMonkeyGetters(error, "name");
1188
1219
  name = IS_UNDEFINED(name) ? "Error" : TO_STRING_INLINE(name);
1189
- var message = error.message;
1220
+ var message = GetPropertyWithoutInvokingMonkeyGetters(error, "message");
1190
1221
  var hasMessage = %_CallFunction(error, "message", ObjectHasOwnProperty);
1191
1222
  if (type && !hasMessage) {
1192
- message = FormatMessage(%NewMessageObject(type, error.arguments));
1223
+ var args = GetPropertyWithoutInvokingMonkeyGetters(error, "arguments");
1224
+ message = FormatMessage(%NewMessageObject(type, args));
1193
1225
  }
1194
1226
  message = IS_UNDEFINED(message) ? "" : TO_STRING_INLINE(message);
1195
1227
  if (name === "") return message;
@@ -118,7 +118,7 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
118
118
  Label* gc_required) {
119
119
  const int initial_capacity = JSArray::kPreallocatedArrayElements;
120
120
  STATIC_ASSERT(initial_capacity >= 0);
121
- __ LoadInitialArrayMap(array_function, scratch2, scratch1);
121
+ __ LoadInitialArrayMap(array_function, scratch2, scratch1, false);
122
122
 
123
123
  // Allocate the JSArray object together with space for a fixed array with the
124
124
  // requested elements.
@@ -214,7 +214,8 @@ static void AllocateJSArray(MacroAssembler* masm,
214
214
  bool fill_with_hole,
215
215
  Label* gc_required) {
216
216
  // Load the initial map from the array function.
217
- __ LoadInitialArrayMap(array_function, scratch2, elements_array_storage);
217
+ __ LoadInitialArrayMap(array_function, scratch2,
218
+ elements_array_storage, fill_with_hole);
218
219
 
219
220
  if (FLAG_debug_code) { // Assert that array size is not zero.
220
221
  __ Assert(
@@ -449,10 +450,10 @@ static void ArrayNativeCode(MacroAssembler* masm,
449
450
  __ Branch(call_generic_code);
450
451
 
451
452
  __ bind(&not_double);
452
- // Transition FAST_SMI_ONLY_ELEMENTS to FAST_ELEMENTS.
453
+ // Transition FAST_SMI_ELEMENTS to FAST_ELEMENTS.
453
454
  // a3: JSArray
454
455
  __ lw(a2, FieldMemOperand(a3, HeapObject::kMapOffset));
455
- __ LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS,
456
+ __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
456
457
  FAST_ELEMENTS,
457
458
  a2,
458
459
  t5,