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 // Flags: --expose-wasm |
| 6 |
5 function bytes() { | 7 function bytes() { |
6 var buffer = new ArrayBuffer(arguments.length); | 8 var buffer = new ArrayBuffer(arguments.length); |
7 var view = new Uint8Array(buffer); | 9 var view = new Uint8Array(buffer); |
8 for (var i = 0; i < arguments.length; i++) { | 10 for (var i = 0; i < arguments.length; i++) { |
9 var val = arguments[i]; | 11 var val = arguments[i]; |
10 if ((typeof val) == "string") val = val.charCodeAt(0); | 12 if ((typeof val) == "string") val = val.charCodeAt(0); |
11 view[i] = val | 0; | 13 view[i] = val | 0; |
12 } | 14 } |
13 return buffer; | 15 return buffer; |
14 } | 16 } |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 239 } |
238 threwException = false; | 240 threwException = false; |
239 } catch (e) { | 241 } catch (e) { |
240 assertEquals("string", typeof e); | 242 assertEquals("string", typeof e); |
241 assertEquals(kTrapMsgs[trap], e); | 243 assertEquals(kTrapMsgs[trap], e); |
242 // Success. | 244 // Success. |
243 return; | 245 return; |
244 } | 246 } |
245 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); | 247 throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]
); |
246 } | 248 } |
OLD | NEW |