Upgrade the bundled V8 and update code in src/ and lib/ to the new API. Notable backwards incompatible changes are the removal of the smalloc module and dropped support for CESU-8 decoding. CESU-8 support can be brought back if necessary by doing UTF-8 decoding ourselves. This commit includes https://codereview.chromium.org/1192973004 to fix a build error on python 2.6 systems. The original commit log follows: Use optparse in js2c.py for python compatibility Without this change, V8 won't build on RHEL/CentOS 6 because the distro python is too old to know about the argparse module. PR-URL: https://github.com/nodejs/io.js/pull/2022 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
68 lines
1.4 KiB
JavaScript
68 lines
1.4 KiB
JavaScript
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
//
|
|
// Flags: --harmony-classes --allow-natives-syntax
|
|
'use strict';
|
|
|
|
(function TestMaps() {
|
|
class Base {}
|
|
class Derived extends Base {}
|
|
|
|
let d1 = new Derived();
|
|
let d2 = new Derived();
|
|
|
|
assertTrue(%HaveSameMap(d1, d2));
|
|
}());
|
|
|
|
|
|
(function TestProtoModificationArray() {
|
|
let called = 0;
|
|
function F() {
|
|
called++;
|
|
assertFalse(Array.isArray(this));
|
|
}
|
|
class Derived extends Array {}
|
|
assertSame(Derived.__proto__, Array);
|
|
|
|
let d1 = new Derived();
|
|
assertTrue(Array.isArray(d1));
|
|
|
|
Derived.__proto__ = F;
|
|
called = 0;
|
|
let d2 = new Derived();
|
|
assertSame(1, called);
|
|
assertFalse(Array.isArray(d2));
|
|
|
|
assertFalse(%HaveSameMap(d1, d2));
|
|
}());
|
|
|
|
|
|
(function TestProtoModification() {
|
|
let called = 0;
|
|
function F() {
|
|
called++;
|
|
let exn = null;
|
|
try {
|
|
this.byteLength;
|
|
} catch (e) {
|
|
exn = e;
|
|
}
|
|
assertTrue(exn instanceof TypeError);
|
|
}
|
|
class Derived extends Uint8Array {
|
|
constructor() { super(10); }
|
|
}
|
|
assertSame(Derived.__proto__, Uint8Array);
|
|
|
|
let d1 = new Derived();
|
|
assertSame(10, d1.byteLength);
|
|
|
|
Derived.__proto__ = F;
|
|
called = 0;
|
|
let d2 = new Derived();
|
|
assertSame(1, called);
|
|
assertThrows(function() { d2.byteLength; }, TypeError);
|
|
|
|
assertFalse(%HaveSameMap(d1, d2));
|
|
}());
|