OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 endmacro | 55 endmacro |
56 | 56 |
57 SIMD_ALL_TYPES(DECLARE_GLOBALS) | 57 SIMD_ALL_TYPES(DECLARE_GLOBALS) |
58 | 58 |
59 macro DECLARE_COMMON_FUNCTIONS(NAME, TYPE, LANES) | 59 macro DECLARE_COMMON_FUNCTIONS(NAME, TYPE, LANES) |
60 function NAMECheckJS(a) { | 60 function NAMECheckJS(a) { |
61 return %NAMECheck(a); | 61 return %NAMECheck(a); |
62 } | 62 } |
63 | 63 |
64 function NAMEToString() { | 64 function NAMEToString() { |
65 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') { | 65 var value = %_ValueOf(this); |
| 66 if (typeof(value) !== 'TYPE') { |
66 throw MakeTypeError(kIncompatibleMethodReceiver, | 67 throw MakeTypeError(kIncompatibleMethodReceiver, |
67 "NAME.prototype.toString", this); | 68 "NAME.prototype.toString", this); |
68 } | 69 } |
69 var value = %_ValueOf(this); | |
70 var str = "SIMD.NAME("; | 70 var str = "SIMD.NAME("; |
71 str += %NAMEExtractLane(value, 0); | 71 str += %NAMEExtractLane(value, 0); |
72 for (var i = 1; i < LANES; i++) { | 72 for (var i = 1; i < LANES; i++) { |
73 str += ", " + %NAMEExtractLane(value, i); | 73 str += ", " + %NAMEExtractLane(value, i); |
74 } | 74 } |
75 return str + ")"; | 75 return str + ")"; |
76 } | 76 } |
77 | 77 |
78 function NAMEToLocaleString() { | 78 function NAMEToLocaleString() { |
79 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') { | 79 var value = %_ValueOf(this); |
| 80 if (typeof(value) !== 'TYPE') { |
80 throw MakeTypeError(kIncompatibleMethodReceiver, | 81 throw MakeTypeError(kIncompatibleMethodReceiver, |
81 "NAME.prototype.toLocaleString", this); | 82 "NAME.prototype.toLocaleString", this); |
82 } | 83 } |
83 var value = %_ValueOf(this); | |
84 var str = "SIMD.NAME("; | 84 var str = "SIMD.NAME("; |
85 str += %NAMEExtractLane(value, 0).toLocaleString(); | 85 str += %NAMEExtractLane(value, 0).toLocaleString(); |
86 for (var i = 1; i < LANES; i++) { | 86 for (var i = 1; i < LANES; i++) { |
87 str += ", " + %NAMEExtractLane(value, i).toLocaleString(); | 87 str += ", " + %NAMEExtractLane(value, i).toLocaleString(); |
88 } | 88 } |
89 return str + ")"; | 89 return str + ")"; |
90 } | 90 } |
91 | 91 |
92 function NAMEValueOf() { | 92 function NAMEValueOf() { |
93 if (typeof(this) !== 'TYPE' && %_ClassOf(this) !== 'NAME') { | 93 var value = %_ValueOf(this); |
| 94 if (typeof(value) !== 'TYPE') { |
94 throw MakeTypeError(kIncompatibleMethodReceiver, | 95 throw MakeTypeError(kIncompatibleMethodReceiver, |
95 "NAME.prototype.valueOf", this); | 96 "NAME.prototype.valueOf", this); |
96 } | 97 } |
97 return %_ValueOf(this); | 98 return value; |
98 } | 99 } |
99 | 100 |
100 function NAMEExtractLaneJS(instance, lane) { | 101 function NAMEExtractLaneJS(instance, lane) { |
101 return %NAMEExtractLane(instance, lane); | 102 return %NAMEExtractLane(instance, lane); |
102 } | 103 } |
103 endmacro | 104 endmacro |
104 | 105 |
105 SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS) | 106 SIMD_ALL_TYPES(DECLARE_COMMON_FUNCTIONS) |
106 | 107 |
107 macro DECLARE_SHIFT_FUNCTIONS(NAME, TYPE, LANES) | 108 macro DECLARE_SHIFT_FUNCTIONS(NAME, TYPE, LANES) |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 to.Bool32x4ToString = Bool32x4ToString; | 912 to.Bool32x4ToString = Bool32x4ToString; |
912 to.Int16x8ToString = Int16x8ToString; | 913 to.Int16x8ToString = Int16x8ToString; |
913 to.Uint16x8ToString = Uint16x8ToString; | 914 to.Uint16x8ToString = Uint16x8ToString; |
914 to.Bool16x8ToString = Bool16x8ToString; | 915 to.Bool16x8ToString = Bool16x8ToString; |
915 to.Int8x16ToString = Int8x16ToString; | 916 to.Int8x16ToString = Int8x16ToString; |
916 to.Uint8x16ToString = Uint8x16ToString; | 917 to.Uint8x16ToString = Uint8x16ToString; |
917 to.Bool8x16ToString = Bool8x16ToString; | 918 to.Bool8x16ToString = Bool8x16ToString; |
918 }); | 919 }); |
919 | 920 |
920 }) | 921 }) |
OLD | NEW |