libv8 3.10.8.0 → 3.11.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +10 -3
- data/ext/libv8/compiler.rb +46 -0
- data/ext/libv8/extconf.rb +5 -1
- data/ext/libv8/make.rb +13 -0
- data/lib/libv8/version.rb +1 -1
- data/patches/add-freebsd9-and-freebsd10-to-gyp-GetFlavor.patch +11 -0
- data/patches/src_platform-freebsd.cc.patch +10 -0
- data/vendor/v8/ChangeLog +124 -0
- data/vendor/v8/DEPS +27 -0
- data/vendor/v8/Makefile +7 -0
- data/vendor/v8/SConstruct +15 -2
- data/vendor/v8/build/common.gypi +129 -157
- data/vendor/v8/build/gyp_v8 +11 -25
- data/vendor/v8/build/standalone.gypi +9 -3
- data/vendor/v8/include/v8.h +5 -3
- data/vendor/v8/src/SConscript +1 -0
- data/vendor/v8/src/api.cc +4 -33
- data/vendor/v8/src/api.h +2 -2
- data/vendor/v8/src/arm/builtins-arm.cc +5 -4
- data/vendor/v8/src/arm/code-stubs-arm.cc +21 -14
- data/vendor/v8/src/arm/codegen-arm.cc +2 -2
- data/vendor/v8/src/arm/debug-arm.cc +3 -1
- data/vendor/v8/src/arm/full-codegen-arm.cc +3 -102
- data/vendor/v8/src/arm/ic-arm.cc +30 -33
- data/vendor/v8/src/arm/lithium-arm.cc +20 -7
- data/vendor/v8/src/arm/lithium-arm.h +10 -4
- data/vendor/v8/src/arm/lithium-codegen-arm.cc +106 -60
- data/vendor/v8/src/arm/macro-assembler-arm.cc +49 -39
- data/vendor/v8/src/arm/macro-assembler-arm.h +5 -4
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +115 -55
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +7 -6
- data/vendor/v8/src/arm/simulator-arm.h +6 -6
- data/vendor/v8/src/arm/stub-cache-arm.cc +64 -19
- data/vendor/v8/src/array.js +7 -3
- data/vendor/v8/src/ast.cc +11 -6
- data/vendor/v8/src/bootstrapper.cc +9 -11
- data/vendor/v8/src/builtins.cc +61 -31
- data/vendor/v8/src/code-stubs.cc +23 -9
- data/vendor/v8/src/code-stubs.h +1 -0
- data/vendor/v8/src/codegen.h +3 -3
- data/vendor/v8/src/compiler.cc +1 -1
- data/vendor/v8/src/contexts.h +2 -18
- data/vendor/v8/src/d8.cc +94 -93
- data/vendor/v8/src/d8.h +1 -1
- data/vendor/v8/src/debug-agent.cc +3 -3
- data/vendor/v8/src/debug.cc +41 -1
- data/vendor/v8/src/debug.h +50 -0
- data/vendor/v8/src/elements-kind.cc +134 -0
- data/vendor/v8/src/elements-kind.h +210 -0
- data/vendor/v8/src/elements.cc +356 -190
- data/vendor/v8/src/elements.h +36 -28
- data/vendor/v8/src/factory.cc +44 -4
- data/vendor/v8/src/factory.h +11 -7
- data/vendor/v8/src/flag-definitions.h +3 -0
- data/vendor/v8/src/frames.h +3 -0
- data/vendor/v8/src/full-codegen.cc +2 -1
- data/vendor/v8/src/func-name-inferrer.h +2 -0
- data/vendor/v8/src/globals.h +3 -0
- data/vendor/v8/src/heap-inl.h +16 -4
- data/vendor/v8/src/heap.cc +38 -32
- data/vendor/v8/src/heap.h +3 -17
- data/vendor/v8/src/hydrogen-instructions.cc +28 -5
- data/vendor/v8/src/hydrogen-instructions.h +142 -44
- data/vendor/v8/src/hydrogen.cc +160 -55
- data/vendor/v8/src/hydrogen.h +2 -0
- data/vendor/v8/src/ia32/assembler-ia32.h +3 -0
- data/vendor/v8/src/ia32/builtins-ia32.cc +5 -4
- data/vendor/v8/src/ia32/code-stubs-ia32.cc +22 -16
- data/vendor/v8/src/ia32/codegen-ia32.cc +2 -2
- data/vendor/v8/src/ia32/debug-ia32.cc +29 -2
- data/vendor/v8/src/ia32/full-codegen-ia32.cc +8 -101
- data/vendor/v8/src/ia32/ic-ia32.cc +23 -19
- data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +126 -80
- data/vendor/v8/src/ia32/lithium-codegen-ia32.h +2 -1
- data/vendor/v8/src/ia32/lithium-ia32.cc +15 -9
- data/vendor/v8/src/ia32/lithium-ia32.h +14 -6
- data/vendor/v8/src/ia32/macro-assembler-ia32.cc +50 -40
- data/vendor/v8/src/ia32/macro-assembler-ia32.h +5 -4
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +113 -43
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +9 -4
- data/vendor/v8/src/ia32/simulator-ia32.h +4 -4
- data/vendor/v8/src/ia32/stub-cache-ia32.cc +52 -14
- data/vendor/v8/src/ic.cc +77 -20
- data/vendor/v8/src/ic.h +18 -2
- data/vendor/v8/src/incremental-marking-inl.h +21 -5
- data/vendor/v8/src/incremental-marking.cc +35 -8
- data/vendor/v8/src/incremental-marking.h +12 -3
- data/vendor/v8/src/isolate.cc +12 -2
- data/vendor/v8/src/isolate.h +1 -1
- data/vendor/v8/src/jsregexp.cc +66 -26
- data/vendor/v8/src/jsregexp.h +60 -31
- data/vendor/v8/src/list-inl.h +8 -0
- data/vendor/v8/src/list.h +3 -0
- data/vendor/v8/src/lithium.cc +5 -2
- data/vendor/v8/src/liveedit.cc +57 -5
- data/vendor/v8/src/mark-compact-inl.h +17 -11
- data/vendor/v8/src/mark-compact.cc +100 -143
- data/vendor/v8/src/mark-compact.h +44 -20
- data/vendor/v8/src/messages.js +131 -99
- data/vendor/v8/src/mips/builtins-mips.cc +5 -4
- data/vendor/v8/src/mips/code-stubs-mips.cc +23 -15
- data/vendor/v8/src/mips/codegen-mips.cc +2 -2
- data/vendor/v8/src/mips/debug-mips.cc +3 -1
- data/vendor/v8/src/mips/full-codegen-mips.cc +4 -102
- data/vendor/v8/src/mips/ic-mips.cc +34 -36
- data/vendor/v8/src/mips/lithium-codegen-mips.cc +116 -68
- data/vendor/v8/src/mips/lithium-mips.cc +20 -7
- data/vendor/v8/src/mips/lithium-mips.h +11 -4
- data/vendor/v8/src/mips/macro-assembler-mips.cc +50 -39
- data/vendor/v8/src/mips/macro-assembler-mips.h +5 -4
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +110 -50
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +6 -5
- data/vendor/v8/src/mips/simulator-mips.h +5 -5
- data/vendor/v8/src/mips/stub-cache-mips.cc +66 -20
- data/vendor/v8/src/mksnapshot.cc +5 -1
- data/vendor/v8/src/objects-debug.cc +103 -6
- data/vendor/v8/src/objects-inl.h +215 -116
- data/vendor/v8/src/objects-printer.cc +13 -8
- data/vendor/v8/src/objects.cc +608 -331
- data/vendor/v8/src/objects.h +129 -94
- data/vendor/v8/src/parser.cc +16 -4
- data/vendor/v8/src/platform-freebsd.cc +1 -0
- data/vendor/v8/src/platform-linux.cc +9 -30
- data/vendor/v8/src/platform-posix.cc +28 -7
- data/vendor/v8/src/platform-win32.cc +15 -3
- data/vendor/v8/src/platform.h +2 -1
- data/vendor/v8/src/profile-generator-inl.h +25 -2
- data/vendor/v8/src/profile-generator.cc +300 -822
- data/vendor/v8/src/profile-generator.h +97 -214
- data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +2 -1
- data/vendor/v8/src/regexp-macro-assembler-irregexp.h +2 -2
- data/vendor/v8/src/regexp-macro-assembler-tracer.cc +6 -5
- data/vendor/v8/src/regexp-macro-assembler-tracer.h +1 -1
- data/vendor/v8/src/regexp-macro-assembler.cc +7 -3
- data/vendor/v8/src/regexp-macro-assembler.h +10 -2
- data/vendor/v8/src/regexp.js +6 -0
- data/vendor/v8/src/runtime.cc +265 -212
- data/vendor/v8/src/runtime.h +6 -5
- data/vendor/v8/src/scopes.cc +20 -0
- data/vendor/v8/src/scopes.h +6 -3
- data/vendor/v8/src/spaces.cc +0 -2
- data/vendor/v8/src/string-stream.cc +2 -2
- data/vendor/v8/src/v8-counters.h +0 -2
- data/vendor/v8/src/v8natives.js +2 -2
- data/vendor/v8/src/v8utils.h +6 -3
- data/vendor/v8/src/version.cc +1 -1
- data/vendor/v8/src/x64/assembler-x64.h +2 -1
- data/vendor/v8/src/x64/builtins-x64.cc +5 -4
- data/vendor/v8/src/x64/code-stubs-x64.cc +25 -16
- data/vendor/v8/src/x64/codegen-x64.cc +2 -2
- data/vendor/v8/src/x64/debug-x64.cc +14 -1
- data/vendor/v8/src/x64/disasm-x64.cc +1 -1
- data/vendor/v8/src/x64/full-codegen-x64.cc +10 -106
- data/vendor/v8/src/x64/ic-x64.cc +20 -16
- data/vendor/v8/src/x64/lithium-codegen-x64.cc +156 -79
- data/vendor/v8/src/x64/lithium-codegen-x64.h +2 -1
- data/vendor/v8/src/x64/lithium-x64.cc +18 -8
- data/vendor/v8/src/x64/lithium-x64.h +7 -2
- data/vendor/v8/src/x64/macro-assembler-x64.cc +50 -40
- data/vendor/v8/src/x64/macro-assembler-x64.h +5 -4
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +122 -51
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +17 -8
- data/vendor/v8/src/x64/simulator-x64.h +4 -4
- data/vendor/v8/src/x64/stub-cache-x64.cc +55 -17
- data/vendor/v8/test/cctest/cctest.status +1 -0
- data/vendor/v8/test/cctest/test-api.cc +24 -0
- data/vendor/v8/test/cctest/test-func-name-inference.cc +38 -0
- data/vendor/v8/test/cctest/test-heap-profiler.cc +21 -77
- data/vendor/v8/test/cctest/test-heap.cc +164 -3
- data/vendor/v8/test/cctest/test-list.cc +12 -0
- data/vendor/v8/test/cctest/test-mark-compact.cc +5 -5
- data/vendor/v8/test/cctest/test-regexp.cc +14 -8
- data/vendor/v8/test/cctest/testcfg.py +2 -0
- data/vendor/v8/test/mjsunit/accessor-map-sharing.js +176 -0
- data/vendor/v8/test/mjsunit/array-construct-transition.js +3 -3
- data/vendor/v8/test/mjsunit/array-literal-transitions.js +10 -10
- data/vendor/v8/test/mjsunit/big-array-literal.js +3 -0
- data/vendor/v8/test/mjsunit/compiler/inline-construct.js +4 -2
- data/vendor/v8/test/mjsunit/debug-liveedit-stack-padding.js +88 -0
- data/vendor/v8/test/mjsunit/elements-kind.js +4 -4
- data/vendor/v8/test/mjsunit/elements-transition-hoisting.js +2 -2
- data/vendor/v8/test/mjsunit/elements-transition.js +5 -5
- data/vendor/v8/test/mjsunit/error-constructors.js +68 -33
- data/vendor/v8/test/mjsunit/harmony/proxies.js +14 -6
- data/vendor/v8/test/mjsunit/mjsunit.status +1 -0
- data/vendor/v8/test/mjsunit/packed-elements.js +112 -0
- data/vendor/v8/test/mjsunit/regexp-capture-3.js +6 -0
- data/vendor/v8/test/mjsunit/regexp-global.js +132 -0
- data/vendor/v8/test/mjsunit/regexp.js +11 -0
- data/vendor/v8/test/mjsunit/regress/regress-117409.js +52 -0
- data/vendor/v8/test/mjsunit/regress/regress-126412.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-128018.js +35 -0
- data/vendor/v8/test/mjsunit/regress/regress-128146.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-1639-2.js +4 -1
- data/vendor/v8/test/mjsunit/regress/regress-1639.js +14 -8
- data/vendor/v8/test/mjsunit/regress/regress-1849.js +3 -3
- data/vendor/v8/test/mjsunit/regress/regress-1878.js +2 -2
- data/vendor/v8/test/mjsunit/regress/regress-2071.js +79 -0
- data/vendor/v8/test/mjsunit/regress/regress-2153.js +32 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-122271.js +4 -4
- data/vendor/v8/test/mjsunit/regress/regress-crbug-126414.js +32 -0
- data/vendor/v8/test/mjsunit/regress/regress-smi-only-concat.js +2 -2
- data/vendor/v8/test/mjsunit/regress/regress-transcendental.js +49 -0
- data/vendor/v8/test/mjsunit/stack-traces.js +14 -0
- data/vendor/v8/test/mjsunit/unbox-double-arrays.js +4 -3
- data/vendor/v8/test/test262/testcfg.py +6 -1
- data/vendor/v8/tools/check-static-initializers.sh +11 -3
- data/vendor/v8/tools/fuzz-harness.sh +92 -0
- data/vendor/v8/tools/grokdump.py +658 -67
- data/vendor/v8/tools/gyp/v8.gyp +21 -39
- data/vendor/v8/tools/js2c.py +3 -3
- data/vendor/v8/tools/jsmin.py +2 -2
- data/vendor/v8/tools/presubmit.py +2 -1
- data/vendor/v8/tools/test-wrapper-gypbuild.py +25 -11
- metadata +624 -612
@@ -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
|
-
//
|
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
|
-
|
638
|
-
|
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
|
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_;
|
data/vendor/v8/src/messages.js
CHANGED
@@ -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
|
65
|
-
//
|
66
|
-
//
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
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
|
-
|
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
|
-
}
|
831
|
-
|
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 =
|
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
|
-
|
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(
|
1151
|
-
|
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
|
1187
|
-
var name = error
|
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
|
1220
|
+
var message = GetPropertyWithoutInvokingMonkeyGetters(error, "message");
|
1190
1221
|
var hasMessage = %_CallFunction(error, "message", ObjectHasOwnProperty);
|
1191
1222
|
if (type && !hasMessage) {
|
1192
|
-
|
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,
|
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(¬_double);
|
452
|
-
// Transition
|
453
|
+
// Transition FAST_SMI_ELEMENTS to FAST_ELEMENTS.
|
453
454
|
// a3: JSArray
|
454
455
|
__ lw(a2, FieldMemOperand(a3, HeapObject::kMapOffset));
|
455
|
-
__ LoadTransitionedArrayMapConditional(
|
456
|
+
__ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
|
456
457
|
FAST_ELEMENTS,
|
457
458
|
a2,
|
458
459
|
t5,
|