Commit 86a62d0d authored by yangguo@chromium.org's avatar yangguo@chromium.org

Added check for trailing whitespaces and corrected existing violations.

Review URL: http://codereview.chromium.org/7826007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9094 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4e94cd8b
...@@ -1406,7 +1406,7 @@ function rng_seed_int(x) { ...@@ -1406,7 +1406,7 @@ function rng_seed_int(x) {
// Mix in the current time (w/milliseconds) into the pool // Mix in the current time (w/milliseconds) into the pool
function rng_seed_time() { function rng_seed_time() {
// Use pre-computed date to avoid making the benchmark // Use pre-computed date to avoid making the benchmark
// results dependent on the current date. // results dependent on the current date.
rng_seed_int(1122926989487); rng_seed_int(1122926989487);
} }
......
...@@ -134,7 +134,7 @@ function sc_rempropBang(sym, key) { ...@@ -134,7 +134,7 @@ function sc_rempropBang(sym, key) {
/*** META ((export #t)) */ /*** META ((export #t)) */
function sc_any2String(o) { function sc_any2String(o) {
return jsstring2string(sc_toDisplayString(o)); return jsstring2string(sc_toDisplayString(o));
} }
/*** META ((export #t) /*** META ((export #t)
(peephole (infix 2 2 "===")) (peephole (infix 2 2 "==="))
...@@ -923,7 +923,7 @@ function sc_dualAppendBang(l1, l2) { ...@@ -923,7 +923,7 @@ function sc_dualAppendBang(l1, l2) {
tmp.cdr = l2; tmp.cdr = l2;
return l1; return l1;
} }
/*** META ((export #t)) */ /*** META ((export #t)) */
function sc_appendBang() { function sc_appendBang() {
var res = null; var res = null;
...@@ -1163,7 +1163,7 @@ sc_Char.readable2char = { ...@@ -1163,7 +1163,7 @@ sc_Char.readable2char = {
"us": "\037", "us": "\037",
"sp": "\040", "sp": "\040",
"del": "\177"}; "del": "\177"};
sc_Char.prototype.toString = function() { sc_Char.prototype.toString = function() {
return this.val; return this.val;
}; };
...@@ -1533,7 +1533,7 @@ function sc_mapBang(proc, l1) { ...@@ -1533,7 +1533,7 @@ function sc_mapBang(proc, l1) {
} }
return l1_orig; return l1_orig;
} }
/*** META ((export #t)) */ /*** META ((export #t)) */
function sc_forEach(proc, l1) { function sc_forEach(proc, l1) {
if (l1 === undefined) if (l1 === undefined)
...@@ -1871,7 +1871,7 @@ function sc_jsNew(c) { ...@@ -1871,7 +1871,7 @@ function sc_jsNew(c) {
evalStr += ", arguments[" + i + "]"; evalStr += ", arguments[" + i + "]";
evalStr +=")"; evalStr +=")";
return eval(evalStr); return eval(evalStr);
} }
// ======================== RegExp ==================== // ======================== RegExp ====================
/*** META ((export #t)) */ /*** META ((export #t)) */
...@@ -1883,9 +1883,9 @@ function sc_pregexp(re) { ...@@ -1883,9 +1883,9 @@ function sc_pregexp(re) {
function sc_pregexpMatch(re, s) { function sc_pregexpMatch(re, s) {
var reg = (re instanceof RegExp) ? re : sc_pregexp(re); var reg = (re instanceof RegExp) ? re : sc_pregexp(re);
var tmp = reg.exec(sc_string2jsstring(s)); var tmp = reg.exec(sc_string2jsstring(s));
if (tmp == null) return false; if (tmp == null) return false;
var res = null; var res = null;
for (var i = tmp.length-1; i >= 0; i--) { for (var i = tmp.length-1; i >= 0; i--) {
if (tmp[i] !== null) { if (tmp[i] !== null) {
...@@ -1896,7 +1896,7 @@ function sc_pregexpMatch(re, s) { ...@@ -1896,7 +1896,7 @@ function sc_pregexpMatch(re, s) {
} }
return res; return res;
} }
/*** META ((export #t)) */ /*** META ((export #t)) */
function sc_pregexpReplace(re, s1, s2) { function sc_pregexpReplace(re, s1, s2) {
var reg; var reg;
...@@ -1914,7 +1914,7 @@ function sc_pregexpReplace(re, s1, s2) { ...@@ -1914,7 +1914,7 @@ function sc_pregexpReplace(re, s1, s2) {
return jss1.replace(reg, jss2); return jss1.replace(reg, jss2);
} }
/*** META ((export pregexp-replace*)) */ /*** META ((export pregexp-replace*)) */
function sc_pregexpReplaceAll(re, s1, s2) { function sc_pregexpReplaceAll(re, s1, s2) {
var reg; var reg;
...@@ -1945,7 +1945,7 @@ function sc_pregexpSplit(re, s) { ...@@ -1945,7 +1945,7 @@ function sc_pregexpSplit(re, s) {
return sc_vector2list(tmp); return sc_vector2list(tmp);
} }
/* =========================================================================== */ /* =========================================================================== */
/* Other library stuff */ /* Other library stuff */
...@@ -2136,7 +2136,7 @@ sc_ErrorInputPort.prototype.getNextChar = function() { ...@@ -2136,7 +2136,7 @@ sc_ErrorInputPort.prototype.getNextChar = function() {
sc_ErrorInputPort.prototype.isCharReady = function() { sc_ErrorInputPort.prototype.isCharReady = function() {
return false; return false;
}; };
/* .............. String port ..........................*/ /* .............. String port ..........................*/
...@@ -2200,7 +2200,7 @@ sc_Tokenizer.prototype.readToken = function() { ...@@ -2200,7 +2200,7 @@ sc_Tokenizer.prototype.readToken = function() {
}; };
sc_Tokenizer.prototype.nextToken = function() { sc_Tokenizer.prototype.nextToken = function() {
var port = this.port; var port = this.port;
function isNumberChar(c) { function isNumberChar(c) {
return (c >= "0" && c <= "9"); return (c >= "0" && c <= "9");
}; };
...@@ -2280,7 +2280,7 @@ sc_Tokenizer.prototype.nextToken = function() { ...@@ -2280,7 +2280,7 @@ sc_Tokenizer.prototype.nextToken = function() {
else else
return new sc_Token(12/*NUMBER*/, res - 0); return new sc_Token(12/*NUMBER*/, res - 0);
}; };
function skipWhitespaceAndComments() { function skipWhitespaceAndComments() {
var done = false; var done = false;
while (!done) { while (!done) {
...@@ -2299,7 +2299,7 @@ sc_Tokenizer.prototype.nextToken = function() { ...@@ -2299,7 +2299,7 @@ sc_Tokenizer.prototype.nextToken = function() {
} }
} }
}; };
function readDot() { function readDot() {
if (isWhitespace(port.peekChar())) if (isWhitespace(port.peekChar()))
return new sc_Token(10/*DOT*/); return new sc_Token(10/*DOT*/);
...@@ -2429,7 +2429,7 @@ sc_Reader.prototype.read = function() { ...@@ -2429,7 +2429,7 @@ sc_Reader.prototype.read = function() {
while (true) { while (true) {
var token = tokenizer.peekToken(); var token = tokenizer.peekToken();
switch (token.type) { switch (token.type) {
case 2/*CLOSE_PAR*/: case 2/*CLOSE_PAR*/:
case 4/*CLOSE_BRACE*/: case 4/*CLOSE_BRACE*/:
...@@ -2491,7 +2491,7 @@ sc_Reader.prototype.read = function() { ...@@ -2491,7 +2491,7 @@ sc_Reader.prototype.read = function() {
else else
throw "bad reference: " + nb; throw "bad reference: " + nb;
}; };
var tokenizer = this.tokenizer; var tokenizer = this.tokenizer;
var token = tokenizer.readToken(); var token = tokenizer.readToken();
...@@ -2499,7 +2499,7 @@ sc_Reader.prototype.read = function() { ...@@ -2499,7 +2499,7 @@ sc_Reader.prototype.read = function() {
// handle error // handle error
if (token.type === 13/*ERROR*/) if (token.type === 13/*ERROR*/)
throw token.val; throw token.val;
switch (token.type) { switch (token.type) {
case 1/*OPEN_PAR*/: case 1/*OPEN_PAR*/:
case 3/*OPEN_BRACE*/: case 3/*OPEN_BRACE*/:
...@@ -2550,7 +2550,7 @@ function sc_peekChar(port) { ...@@ -2550,7 +2550,7 @@ function sc_peekChar(port) {
port = SC_DEFAULT_IN; // THREAD: shared var... port = SC_DEFAULT_IN; // THREAD: shared var...
var t = port.peekChar(); var t = port.peekChar();
return t === SC_EOF_OBJECT? t: new sc_Char(t); return t === SC_EOF_OBJECT? t: new sc_Char(t);
} }
/*** META ((export #t) /*** META ((export #t)
(type bool)) (type bool))
*/ */
...@@ -2722,7 +2722,7 @@ sc_StringOutputPort.prototype.close = function() { ...@@ -2722,7 +2722,7 @@ sc_StringOutputPort.prototype.close = function() {
function sc_getOutputString(sp) { function sc_getOutputString(sp) {
return sc_jsstring2string(sp.res); return sc_jsstring2string(sp.res);
} }
function sc_ErrorOutputPort() { function sc_ErrorOutputPort() {
} }
...@@ -2852,7 +2852,7 @@ function sc_newline(p) { ...@@ -2852,7 +2852,7 @@ function sc_newline(p) {
p = SC_DEFAULT_OUT; p = SC_DEFAULT_OUT;
p.appendJSString("\n"); p.appendJSString("\n");
} }
/* ------------------ write-char ---------------------------------------------------*/ /* ------------------ write-char ---------------------------------------------------*/
/*** META ((export #t)) */ /*** META ((export #t)) */
...@@ -2927,7 +2927,7 @@ sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) { ...@@ -2927,7 +2927,7 @@ sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) {
} }
var res = ""; var res = "";
if (this[symb] !== undefined) { // implies > 0 if (this[symb] !== undefined) { // implies > 0
this[symb + "use"] = true; this[symb + "use"] = true;
if (inList) if (inList)
...@@ -2939,10 +2939,10 @@ sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) { ...@@ -2939,10 +2939,10 @@ sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) {
if (!inList) if (!inList)
res += "("; res += "(";
// print car // print car
res += sc_genToWriteCircleString(this.car, symb); res += sc_genToWriteCircleString(this.car, symb);
if (sc_isPair(this.cdr)) { if (sc_isPair(this.cdr)) {
res += " " + this.cdr.sc_toWriteCircleString(symb, true); res += " " + this.cdr.sc_toWriteCircleString(symb, true);
} else if (this.cdr !== null) { } else if (this.cdr !== null) {
...@@ -3072,7 +3072,7 @@ function sc_format(s, args) { ...@@ -3072,7 +3072,7 @@ function sc_format(s, args) {
p.appendJSString(arguments[j].toString(2)); p.appendJSString(arguments[j].toString(2));
i += 2; j++; i += 2; j++;
break; break;
case 37: case 37:
case 110: case 110:
// %, n // %, n
...@@ -3186,7 +3186,7 @@ function sc_isEqual(o1, o2) { ...@@ -3186,7 +3186,7 @@ function sc_isEqual(o1, o2) {
function sc_number2symbol(x, radix) { function sc_number2symbol(x, radix) {
return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix); return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix);
} }
/*** META ((export number->string integer->string)) */ /*** META ((export number->string integer->string)) */
var sc_number2string = sc_number2jsstring; var sc_number2string = sc_number2jsstring;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
// the popularity of the pages where it occurs and the number of times // the popularity of the pages where it occurs and the number of times
// it is executed while loading each page. Furthermore the literal // it is executed while loading each page. Furthermore the literal
// letters in the data are encoded using ROT13 in a way that does not // letters in the data are encoded using ROT13 in a way that does not
// affect how the regexps match their input. Finally the strings are // affect how the regexps match their input. Finally the strings are
// scrambled to exercise the regexp engine on different input strings. // scrambled to exercise the regexp engine on different input strings.
...@@ -47,7 +47,7 @@ function RegExpSetup() { ...@@ -47,7 +47,7 @@ function RegExpSetup() {
regExpBenchmark = new RegExpBenchmark(); regExpBenchmark = new RegExpBenchmark();
RegExpRun(); // run once to get system initialized RegExpRun(); // run once to get system initialized
} }
function RegExpRun() { function RegExpRun() {
regExpBenchmark.run(); regExpBenchmark.run();
} }
...@@ -1759,6 +1759,6 @@ function RegExpBenchmark() { ...@@ -1759,6 +1759,6 @@ function RegExpBenchmark() {
runBlock11(); runBlock11();
} }
} }
this.run = run; this.run = run;
} }
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Copyright 2011 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
......
...@@ -1656,7 +1656,7 @@ class Object : public Value { ...@@ -1656,7 +1656,7 @@ class Object : public Value {
V8EXPORT bool IsCallable(); V8EXPORT bool IsCallable();
/** /**
* Call an Object as a function if a callback is set by the * Call an Object as a function if a callback is set by the
* ObjectTemplate::SetCallAsFunctionHandler method. * ObjectTemplate::SetCallAsFunctionHandler method.
*/ */
V8EXPORT Local<Value> CallAsFunction(Handle<Object> recv, V8EXPORT Local<Value> CallAsFunction(Handle<Object> recv,
...@@ -3562,7 +3562,7 @@ class V8EXPORT Context { ...@@ -3562,7 +3562,7 @@ class V8EXPORT Context {
* // V8 Now no longer locked. * // V8 Now no longer locked.
* \endcode * \endcode
* *
* *
*/ */
class V8EXPORT Unlocker { class V8EXPORT Unlocker {
public: public:
......
...@@ -1786,7 +1786,7 @@ function decodeLolInfoResponse(body) { ...@@ -1786,7 +1786,7 @@ function decodeLolInfoResponse(body) {
function decodeLolListResponse(body, title) { function decodeLolListResponse(body, title) {
var result; var result;
var total_count = body.count; var total_count = body.count;
var total_size = body.size; var total_size = body.size;
......
...@@ -170,7 +170,7 @@ macro CAPTURE(index) = (3 + (index)); ...@@ -170,7 +170,7 @@ macro CAPTURE(index) = (3 + (index));
const CAPTURE0 = 3; const CAPTURE0 = 3;
const CAPTURE1 = 4; const CAPTURE1 = 4;
# PropertyDescriptor return value indices - must match # PropertyDescriptor return value indices - must match
# PropertyDescriptorIndices in runtime.cc. # PropertyDescriptorIndices in runtime.cc.
const IS_ACCESSOR_INDEX = 0; const IS_ACCESSOR_INDEX = 0;
const VALUE_INDEX = 1; const VALUE_INDEX = 1;
......
...@@ -75,11 +75,11 @@ chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-214: UNIMPLEMENTED ...@@ -75,11 +75,11 @@ chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-214: UNIMPLEMENTED
# NOT IMPLEMENTED: RegExp.prototype.multiline # NOT IMPLEMENTED: RegExp.prototype.multiline
chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-215: UNIMPLEMENTED chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-215: UNIMPLEMENTED
# All of the tests below marked SUBSETFAIL (in 15.2.3.4) fail because # All of the tests below marked SUBSETFAIL (in 15.2.3.4) fail because
# the tests assumes that objects can not have more properties # the tests assumes that objects can not have more properties
# than those described in the spec - but according to spec they can # than those described in the spec - but according to spec they can
# have additional properties. # have additional properties.
# All compareArray calls in these tests could be exchanged with a # All compareArray calls in these tests could be exchanged with a
# isSubsetOfArray call (I will upload a patch to the es5conform site). # isSubsetOfArray call (I will upload a patch to the es5conform site).
# SUBSETFAIL # SUBSETFAIL
......
...@@ -73,7 +73,7 @@ for (var i = 0; i < loop_count; i++) { ...@@ -73,7 +73,7 @@ for (var i = 0; i < loop_count; i++) {
a = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8); a = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8);
assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8], a); assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8], a);
a = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); a = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], a); assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], a);
} }
...@@ -91,9 +91,9 @@ function testConstructOfSizeSize(n) { ...@@ -91,9 +91,9 @@ function testConstructOfSizeSize(n) {
var a = eval('[' + str + ']'); var a = eval('[' + str + ']');
var b = eval('new Array(' + str + ')') var b = eval('new Array(' + str + ')')
var c = eval('Array(' + str + ')') var c = eval('Array(' + str + ')')
assertEquals(n, a.length); assertEquals(n, a.length);
assertArrayEquals(a, b); assertArrayEquals(a, b);
assertArrayEquals(a, c); assertArrayEquals(a, c);
} }
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
a = [0,1]; a = [0,1];
assertFalse(a.every(function(n, index, array) { array[index] = n + 1; return n == 1;})); assertFalse(a.every(function(n, index, array) { array[index] = n + 1; return n == 1;}));
assertArrayEquals([1,1], a); assertArrayEquals([1,1], a);
// Only loop through initial part of array eventhough elements are // Only loop through initial part of array eventhough elements are
// added. // added.
a = [1,1]; a = [1,1];
...@@ -156,23 +156,23 @@ ...@@ -156,23 +156,23 @@
// //
(function() { (function() {
var a = [0,1,2,3,4]; var a = [0,1,2,3,4];
// Simple use. // Simple use.
var result = [1,2,3,4,5]; var result = [1,2,3,4,5];
assertArrayEquals(result, a.map(function(n) { return n + 1; })); assertArrayEquals(result, a.map(function(n) { return n + 1; }));
assertEquals(a, a); assertEquals(a, a);
// Use specified object as this object when calling the function. // Use specified object as this object when calling the function.
var o = { delta: 42 } var o = { delta: 42 }
result = [42,43,44,45,46]; result = [42,43,44,45,46];
assertArrayEquals(result, a.map(function(n) { return this.delta + n; }, o)); assertArrayEquals(result, a.map(function(n) { return this.delta + n; }, o));
// Modify original array. // Modify original array.
a = [0,1,2,3,4]; a = [0,1,2,3,4];
result = [1,2,3,4,5]; result = [1,2,3,4,5];
assertArrayEquals(result, a.map(function(n, index, array) { array[index] = n + 1; return n + 1;})); assertArrayEquals(result, a.map(function(n, index, array) { array[index] = n + 1; return n + 1;}));
assertArrayEquals(result, a); assertArrayEquals(result, a);
// Only loop through initial part of array eventhough elements are // Only loop through initial part of array eventhough elements are
// added. // added.
a = [0,1,2,3,4]; a = [0,1,2,3,4];
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
// Simple use. // Simple use.
assertTrue(a.some(function(n) { return n == 3})); assertTrue(a.some(function(n) { return n == 3}));
assertFalse(a.some(function(n) { return n == 5})); assertFalse(a.some(function(n) { return n == 5}));
// Use specified object as this object when calling the function. // Use specified object as this object when calling the function.
var o = { element: 42 }; var o = { element: 42 };
a = [1,42,3]; a = [1,42,3];
......
...@@ -392,7 +392,7 @@ TestSpecialCasesInheritedElementSort(); ...@@ -392,7 +392,7 @@ TestSpecialCasesInheritedElementSort();
// Test that sort calls compare function with global object as receiver, // Test that sort calls compare function with global object as receiver,
// and with only elements of the array as arguments. // and with only elements of the array as arguments.
function o(v) { function o(v) {
return {__proto__: o.prototype, val: v}; return {__proto__: o.prototype, val: v};
} }
var arr = [o(1), o(2), o(4), o(8), o(16), o(32), o(64), o(128), o(256), o(-0)]; var arr = [o(1), o(2), o(4), o(8), o(16), o(32), o(64), o(128), o(256), o(-0)];
......
...@@ -32,14 +32,14 @@ function C1() { ...@@ -32,14 +32,14 @@ function C1() {
var c1 = new C1(); var c1 = new C1();
assertEquals(23, c1.x); assertEquals(23, c1.x);
assertEquals("undefined", typeof c1.y); assertEquals("undefined", typeof c1.y);
// Add setter somewhere on the prototype chain after having constructed the // Add setter somewhere on the prototype chain after having constructed the
// first instance. // first instance.
C1.prototype = { set x(value) { this.y = 23; } }; C1.prototype = { set x(value) { this.y = 23; } };
var c1 = new C1(); var c1 = new C1();
assertEquals("undefined", typeof c1.x); assertEquals("undefined", typeof c1.x);
assertEquals(23, c1.y); assertEquals(23, c1.y);
// Simple class using inline constructor. // Simple class using inline constructor.
function C2() { function C2() {
this.x = 23; this.x = 23;
......
...@@ -33,11 +33,11 @@ function C() { ...@@ -33,11 +33,11 @@ function C() {
this.x = 23; this.x = 23;
} }
// If a setter is added to the prototype chain of a simple constructor setting // If a setter is added to the prototype chain of a simple constructor setting
// one of the properties assigned in the constructor then this setter is // one of the properties assigned in the constructor then this setter is
// ignored when constructing new objects from the constructor. // ignored when constructing new objects from the constructor.
// This only happens if the setter is added _after_ an instance has been // This only happens if the setter is added _after_ an instance has been
// created. // created.
assertEquals(23, new C().x); assertEquals(23, new C().x);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This test tests that no bailouts are missing by not hitting asserts in debug // This test tests that no bailouts are missing by not hitting asserts in debug
// mode. // mode.
test_count_operation() test_count_operation()
test_compound_assignment() test_compound_assignment()
......
...@@ -55,7 +55,7 @@ function TestLocal(s,e) { ...@@ -55,7 +55,7 @@ function TestLocal(s,e) {
function TestGlobal(s,e) { function TestGlobal(s,e) {
// Collect the global properties before the call. // Collect the global properties before the call.
var properties = []; var properties = [];
for (var key in this) properties.push(key); for (var key in this) properties.push(key);
// Compute the result. // Compute the result.
var result; var result;
try { try {
...@@ -113,7 +113,7 @@ function TestConflict(def0, def1) { ...@@ -113,7 +113,7 @@ function TestConflict(def0, def1) {
// Eval second definition. // Eval second definition.
TestAll("TypeError", def0 + '; eval("' + def1 + '")'); TestAll("TypeError", def0 + '; eval("' + def1 + '")');
// Eval both definitions separately. // Eval both definitions separately.
TestAll("TypeError", 'eval("' + def0 +'"); eval("' + def1 + '")'); TestAll("TypeError", 'eval("' + def0 +'"); eval("' + def1 + '")');
} }
......
...@@ -286,7 +286,7 @@ for (var i = 0; i < 24 * 365 * 100; i += 150) { ...@@ -286,7 +286,7 @@ for (var i = 0; i < 24 * 365 * 100; i += 150) {
// Negative tests. // Negative tests.
var testCasesNegative = [ var testCasesNegative = [
'May 25 2008 1:30 (PM)) UTC', // Bad unmatched ')' after number. 'May 25 2008 1:30 (PM)) UTC', // Bad unmatched ')' after number.
'May 25 2008 1:30( )AM (PM)', // 'May 25 2008 1:30( )AM (PM)', //
'May 25 2008 AAA (GMT)']; // Unknown word after number. 'May 25 2008 AAA (GMT)']; // Unknown word after number.
testCasesNegative.forEach(function (s) { testCasesNegative.forEach(function (s) {
......
...@@ -81,7 +81,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -81,7 +81,7 @@ function listener(event, exec_state, event_data, data) {
assertTrue('context' in msg.body.script); assertTrue('context' in msg.body.script);
// Check that we pick script name from //@ sourceURL, iff present // Check that we pick script name from //@ sourceURL, iff present
assertEquals(current_source.indexOf('sourceURL') >= 0 ? assertEquals(current_source.indexOf('sourceURL') >= 0 ?
'myscript.js' : undefined, 'myscript.js' : undefined,
event_data.script().name()); event_data.script().name());
} }
......
...@@ -110,7 +110,7 @@ function listener_recurse(event, exec_state, event_data, data) { ...@@ -110,7 +110,7 @@ function listener_recurse(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) if (event == Debug.DebugEvent.Break)
{ {
break_count++; break_count++;
// Call functions with break using the FrameMirror directly. // Call functions with break using the FrameMirror directly.
if (break_count == 1) { if (break_count == 1) {
// First break event evaluates with break enabled. // First break event evaluates with break enabled.
......
...@@ -72,7 +72,7 @@ function lookupRequest(exec_state, arguments, success) { ...@@ -72,7 +72,7 @@ function lookupRequest(exec_state, arguments, success) {
// The base part of all lookup requests. // The base part of all lookup requests.
var base_request = '"seq":0,"type":"request","command":"lookup"' var base_request = '"seq":0,"type":"request","command":"lookup"'
// Generate request with the supplied arguments. // Generate request with the supplied arguments.
var request; var request;
if (arguments) { if (arguments) {
...@@ -214,7 +214,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -214,7 +214,7 @@ function listener(event, exec_state, event_data, data) {
'Handle not in the request: ' + handle); 'Handle not in the request: ' + handle);
count++; count++;
} }
assertEquals(count, obj.properties.length, assertEquals(count, obj.properties.length,
'Unexpected number of resolved objects'); 'Unexpected number of resolved objects');
......
...@@ -39,7 +39,7 @@ Debug = debug.Debug ...@@ -39,7 +39,7 @@ Debug = debug.Debug
// below. The test checks for these line numbers. // below. The test checks for these line numbers.
function g() { // line 40 function g() { // line 40
var x = 5; var x = 5;
var y = 6; var y = 6;
var z = 7; var z = 7;
}; };
......
...@@ -52,7 +52,7 @@ function testRequest(dcp, arguments, success, count) { ...@@ -52,7 +52,7 @@ function testRequest(dcp, arguments, success, count) {
} else { } else {
request = '{' + base_request + '}' request = '{' + base_request + '}'
} }
// Process the request and check expectation. // Process the request and check expectation.
var response = safeEval(dcp.processDebugJSONRequest(request)); var response = safeEval(dcp.processDebugJSONRequest(request));
if (success) { if (success) {
...@@ -88,7 +88,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -88,7 +88,7 @@ function listener(event, exec_state, event_data, data) {
var response = safeEval(dcp.processDebugJSONRequest(evaluate_point)); var response = safeEval(dcp.processDebugJSONRequest(evaluate_point));
assertTrue(response.success, "Evaluation of Point failed"); assertTrue(response.success, "Evaluation of Point failed");
var handle = response.body.handle; var handle = response.body.handle;
// Test some legal references requests. // Test some legal references requests.
testRequest(dcp, '{"handle":' + handle + ',"type":"referencedBy"}', true); testRequest(dcp, '{"handle":' + handle + ',"type":"referencedBy"}', true);
testRequest(dcp, '{"handle":' + handle + ',"type":"constructedBy"}', testRequest(dcp, '{"handle":' + handle + ',"type":"constructedBy"}',
......
...@@ -103,12 +103,12 @@ function listener(event, exec_state, event_data, data) { ...@@ -103,12 +103,12 @@ function listener(event, exec_state, event_data, data) {
// Position at the end of the function. // Position at the end of the function.
assertEquals(debugger_source_position + 50, assertEquals(debugger_source_position + 50,
exec_state.frame(0).sourcePosition()); exec_state.frame(0).sourcePosition());
// Just about to return from the function. // Just about to return from the function.
assertTrue(exec_state.frame(0).isAtReturn()) assertTrue(exec_state.frame(0).isAtReturn())
assertEquals(expected_return_value, assertEquals(expected_return_value,
exec_state.frame(0).returnValue().value()); exec_state.frame(0).returnValue().value());
// Check the same using the JSON commands. // Check the same using the JSON commands.
var dcp = exec_state.debugCommandProcessor(false); var dcp = exec_state.debugCommandProcessor(false);
var request = '{"seq":0,"type":"request","command":"backtrace"}'; var request = '{"seq":0,"type":"request","command":"backtrace"}';
...@@ -118,7 +118,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -118,7 +118,7 @@ function listener(event, exec_state, event_data, data) {
assertTrue(frames[0].atReturn); assertTrue(frames[0].atReturn);
assertEquals(expected_return_value, assertEquals(expected_return_value,
response.lookup(frames[0].returnValue.ref).value); response.lookup(frames[0].returnValue.ref).value);
listener_complete = true; listener_complete = true;
} }
} }
...@@ -132,7 +132,7 @@ Debug.setListener(listener); ...@@ -132,7 +132,7 @@ Debug.setListener(listener);
// Four steps from the debugger statement in this function will position us at // Four steps from the debugger statement in this function will position us at
// the function return. // the function return.
// 0 1 2 3 4 5 // 0 1 2 3 4 5
// 0123456789012345678901234567890123456789012345678901 // 0123456789012345678901234567890123456789012345678901
function f(x) {debugger; if (x) { return 1; } else { return 2; } }; function f(x) {debugger; if (x) { return 1; } else { return 2; } };
......
...@@ -62,7 +62,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -62,7 +62,7 @@ function listener(event, exec_state, event_data, data) {
Debug.setListener(listener); Debug.setListener(listener);
function g() { function g() {
return "s"; // expected line return "s"; // expected line
} }
...@@ -71,7 +71,7 @@ function testFunction() { ...@@ -71,7 +71,7 @@ function testFunction() {
var s = 1 +f(10); var s = 1 +f(10);
} }
function g2() { function g2() {
return "s2"; // expected line return "s2"; // expected line
} }
......
...@@ -38,7 +38,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -38,7 +38,7 @@ function listener(event, exec_state, event_data, data) {
if (exec_state.frameCount() > 1) { if (exec_state.frameCount() > 1) {
exec_state.prepareStep(Debug.StepAction.StepIn); exec_state.prepareStep(Debug.StepAction.StepIn);
} }
// Test that there is a script. // Test that there is a script.
assertTrue(typeof(event_data.func().script()) == 'object'); assertTrue(typeof(event_data.func().script()) == 'object');
} }
......
...@@ -29,6 +29,6 @@ ...@@ -29,6 +29,6 @@
// objects from within 'with' statements. // objects from within 'with' statements.
(function(){ (function(){
var tmp = { x: 12 }; var tmp = { x: 12 };
with (tmp) { assertTrue(delete x); } with (tmp) { assertTrue(delete x); }
assertFalse("x" in tmp); assertFalse("x" in tmp);
})(); })();
...@@ -36,7 +36,7 @@ function f() { ...@@ -36,7 +36,7 @@ function f() {
} }
h(); h();
} }
function g() { function g() {
function h() { function h() {
assertEquals(Debug.scriptSource(f), Debug.scriptSource(h)); assertEquals(Debug.scriptSource(f), Debug.scriptSource(h));
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
// This file only tests very simple descriptors that always have // This file only tests very simple descriptors that always have
// configurable, enumerable, and writable set to true. // configurable, enumerable, and writable set to true.
// A range of more elaborate tests are performed in // A range of more elaborate tests are performed in
// object-define-property.js // object-define-property.js
function get() { return x; } function get() { return x; }
......
...@@ -33,6 +33,6 @@ ...@@ -33,6 +33,6 @@
var name = "fisk"; var name = "fisk";
natives[name] = name; natives[name] = name;
function foo() { natives[name] + 12; } function foo() { natives[name] + 12; }
for(var i = 0; i < 3; i++) foo(); for(var i = 0; i < 3; i++) foo();
delete natives[name]; delete natives[name];
for(var i = 0; i < 3; i++) foo(); for(var i = 0; i < 3; i++) foo();
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// HTML. // HTML.
function CheckSimple(f, tag) { function CheckSimple(f, tag) {
assertEquals('<' + tag + '>foo</' + tag + '>', assertEquals('<' + tag + '>foo</' + tag + '>',
"foo"[f]().toLowerCase()); "foo"[f]().toLowerCase());
}; };
var simple = { big: 'big', blink: 'blink', bold: 'b', var simple = { big: 'big', blink: 'blink', bold: 'b',
fixed: 'tt', italics: 'i', small: 'small', fixed: 'tt', italics: 'i', small: 'small',
......
...@@ -86,7 +86,7 @@ a[1] = 2; ...@@ -86,7 +86,7 @@ a[1] = 2;
assertFalse(0 in a); assertFalse(0 in a);
assertTrue(1 in a); assertTrue(1 in a);
assertFalse(2 in a); assertFalse(2 in a);
assertFalse('0' in a); assertFalse('0' in a);
assertTrue('1' in a); assertTrue('1' in a);
assertFalse('2' in a); assertFalse('2' in a);
assertTrue('toString' in a, "toString"); assertTrue('toString' in a, "toString");
......
...@@ -60,10 +60,10 @@ TestChains(); ...@@ -60,10 +60,10 @@ TestChains();
function TestExceptions() { function TestExceptions() {
function F() { } function F() { }
var items = [ 1, new Number(42), var items = [ 1, new Number(42),
true, true,
'string', new String('hest'), 'string', new String('hest'),
{}, [], {}, [],
F, new F(), F, new F(),
Object, String ]; Object, String ];
......
...@@ -37,7 +37,7 @@ function GrowNamed(o) { ...@@ -37,7 +37,7 @@ function GrowNamed(o) {
} }
function GrowKeyed(o) { function GrowKeyed(o) {
var names = ['a','b','c','d','e','f']; var names = ['a','b','c','d','e','f'];
var i = 0; var i = 0;
o[names[i++]] = i; o[names[i++]] = i;
o[names[i++]] = i; o[names[i++]] = i;
......
...@@ -64,7 +64,7 @@ function testArrayMirror(a, names) { ...@@ -64,7 +64,7 @@ function testArrayMirror(a, names) {
assertTrue(mirror.protoObject() instanceof debug.Mirror, 'Unexpected mirror hierachy'); assertTrue(mirror.protoObject() instanceof debug.Mirror, 'Unexpected mirror hierachy');
assertTrue(mirror.prototypeObject() instanceof debug.Mirror, 'Unexpected mirror hierachy'); assertTrue(mirror.prototypeObject() instanceof debug.Mirror, 'Unexpected mirror hierachy');
assertEquals(mirror.length(), a.length, "Length mismatch"); assertEquals(mirror.length(), a.length, "Length mismatch");
var indexedProperties = mirror.indexedPropertiesFromRange(); var indexedProperties = mirror.indexedPropertiesFromRange();
assertEquals(indexedProperties.length, a.length); assertEquals(indexedProperties.length, a.length);
for (var i = 0; i < indexedProperties.length; i++) { for (var i = 0; i < indexedProperties.length; i++) {
...@@ -110,7 +110,7 @@ function testArrayMirror(a, names) { ...@@ -110,7 +110,7 @@ function testArrayMirror(a, names) {
var found = false; var found = false;
for (var j = 0; j < fromJSON.properties.length; j++) { for (var j = 0; j < fromJSON.properties.length; j++) {
if (names[i] == fromJSON.properties[j].name) { if (names[i] == fromJSON.properties[j].name) {
found = true; found = true;
} }
} }
assertTrue(found, names[i]) assertTrue(found, names[i])
......
...@@ -65,7 +65,7 @@ function testFunctionMirror(f) { ...@@ -65,7 +65,7 @@ function testFunctionMirror(f) {
assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror); assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror);
assertTrue(mirror.protoObject() instanceof debug.Mirror); assertTrue(mirror.protoObject() instanceof debug.Mirror);
assertTrue(mirror.prototypeObject() instanceof debug.Mirror); assertTrue(mirror.prototypeObject() instanceof debug.Mirror);
// Test text representation // Test text representation
assertEquals(f.toString(), mirror.toText()); assertEquals(f.toString(), mirror.toText());
......
...@@ -62,7 +62,7 @@ function testScriptMirror(f, file_name, file_lines, type, compilation_type, ...@@ -62,7 +62,7 @@ function testScriptMirror(f, file_name, file_lines, type, compilation_type,
if (eval_from_line) { if (eval_from_line) {
assertEquals(eval_from_line, mirror.evalFromLocation().line); assertEquals(eval_from_line, mirror.evalFromLocation().line);
} }
// Parse JSON representation and check. // Parse JSON representation and check.
var fromJSON = JSON.parse(json); var fromJSON = JSON.parse(json);
assertEquals('script', fromJSON.type); assertEquals('script', fromJSON.type);
......
...@@ -64,7 +64,7 @@ assertEquals(void 0, mirror.source()); ...@@ -64,7 +64,7 @@ assertEquals(void 0, mirror.source());
assertEquals('undefined', mirror.constructorFunction().type()); assertEquals('undefined', mirror.constructorFunction().type());
assertEquals('undefined', mirror.protoObject().type()); assertEquals('undefined', mirror.protoObject().type());
assertEquals('undefined', mirror.prototypeObject().type()); assertEquals('undefined', mirror.prototypeObject().type());
// Parse JSON representation of unresolved functions and check. // Parse JSON representation of unresolved functions and check.
var fromJSON = eval('(' + json + ')'); var fromJSON = eval('(' + json + ')');
assertEquals('function', fromJSON.type, 'Unexpected mirror type in JSON'); assertEquals('function', fromJSON.type, 'Unexpected mirror type in JSON');
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
function f() { return } function f() { return }
function g() { function g() {
return return
4; 4;
} }
...@@ -42,4 +42,4 @@ for (var i = 0; i < 10; i++) { break } ...@@ -42,4 +42,4 @@ for (var i = 0; i < 10; i++) { break }
assertEquals(0, i); assertEquals(0, i);
for (var i = 0; i < 10; i++) { continue } for (var i = 0; i < 10; i++) { continue }
assertEquals(10, i); assertEquals(10, i);
\ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Tests the Object.defineProperties method - ES 15.2.3.7 // Tests the Object.defineProperties method - ES 15.2.3.7
// Note that the internal DefineOwnProperty method is tested through // Note that the internal DefineOwnProperty method is tested through
// object-define-property.js, this file only contains tests specific for // object-define-property.js, this file only contains tests specific for
// Object.defineProperties. Also note that object-create.js contains // Object.defineProperties. Also note that object-create.js contains
// a range of indirect tests on this method since Object.create uses // a range of indirect tests on this method since Object.create uses
......
...@@ -43,4 +43,4 @@ var test6 = { 17.31: function() {}, "17.31": 7 }; ...@@ -43,4 +43,4 @@ var test6 = { 17.31: function() {}, "17.31": 7 };
assertEquals(7, test5[13]); assertEquals(7, test5[13]);
assertEquals(7, test6[17.31]); assertEquals(7, test6[17.31]);
\ No newline at end of file
...@@ -79,7 +79,7 @@ assertEquals(7, foo7[15]); ...@@ -79,7 +79,7 @@ assertEquals(7, foo7[15]);
// Test for the classic code generator. // Test for the classic code generator.
function fun(x) { function fun(x) {
var inner = { j: function(x) { return x; }, j: 7 }; var inner = { j: function(x) { return x; }, j: 7 };
return inner.j; return inner.j;
} }
...@@ -115,4 +115,4 @@ function fun3() { ...@@ -115,4 +115,4 @@ function fun3() {
var y = fun3(); var y = fun3();
assertEquals(7, y); assertEquals(7, y);
assertEquals(3, glob3); assertEquals(3, glob3);
\ No newline at end of file
...@@ -33,7 +33,7 @@ var obj1 = {}; ...@@ -33,7 +33,7 @@ var obj1 = {};
assertTrue(Object.isExtensible(obj1)); assertTrue(Object.isExtensible(obj1));
Object.preventExtensions(obj1); Object.preventExtensions(obj1);
// Make sure the is_extensible flag is set. // Make sure the is_extensible flag is set.
assertFalse(Object.isExtensible(obj1)); assertFalse(Object.isExtensible(obj1));
obj1.x = 42; obj1.x = 42;
assertEquals(undefined, obj1.x); assertEquals(undefined, obj1.x);
......
...@@ -67,7 +67,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -67,7 +67,7 @@ function listener(event, exec_state, event_data, data) {
// The expected backtrace is // The expected backtrace is
// 1: g // 1: g
// 0: [anonymous] // 0: [anonymous]
// Get the debug command processor. // Get the debug command processor.
var dcp = exec_state.debugCommandProcessor(false); var dcp = exec_state.debugCommandProcessor(false);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Test that CodeGenerator::EmitKeyedPropertyAssignment for the start // Test that CodeGenerator::EmitKeyedPropertyAssignment for the start
// of an initialization block doesn't normalize the properties of the // of an initialization block doesn't normalize the properties of the
// JSGlobalProxy. // JSGlobalProxy.
this.w = 0; this.w = 0;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
try { try {
function Crash() { continue;if (Crash) { function Crash() { continue;if (Crash) {
} } } }
Crash(); Crash();
assertTrue(false); assertTrue(false);
} catch (e) { } catch (e) {
......
...@@ -33,7 +33,7 @@ this.__defineSetter__('x', function(value) { assertTrue(false); }); ...@@ -33,7 +33,7 @@ this.__defineSetter__('x', function(value) { assertTrue(false); });
var caught = false; var caught = false;
try { try {
eval('const x'); eval('const x');
} catch(e) { } catch(e) {
assertTrue(e instanceof TypeError); assertTrue(e instanceof TypeError);
caught = true; caught = true;
......
...@@ -30,7 +30,7 @@ function test() { ...@@ -30,7 +30,7 @@ function test() {
var s2 = "s2"; var s2 = "s2";
for (var i = 0; i < 2; i++) { for (var i = 0; i < 2; i++) {
// Crashes in round i==1 with IllegalAccess in %StringAdd(x,y) // Crashes in round i==1 with IllegalAccess in %StringAdd(x,y)
var res = 1 + s2; var res = 1 + s2;
s2 = 2; s2 = 2;
} }
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// The following regression test illustrates a problem in using the // The following regression test illustrates a problem in using the
// value of setting a property in the arguments object. // value of setting a property in the arguments object.
function f(s) { function f(s) {
arguments.length; arguments.length;
......
...@@ -40,10 +40,10 @@ Debug.setListener(listener); ...@@ -40,10 +40,10 @@ Debug.setListener(listener);
function g() { function g() {
} }
function f() { function f() {
debugger; debugger;
g.apply(null, ['']); g.apply(null, ['']);
} }
f() f()
\ No newline at end of file
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Tests that Object.defineProperty works correctly on array indices. // Tests that Object.defineProperty works correctly on array indices.
// Please see http://code.google.com/p/v8/issues/detail?id=619 for details. // Please see http://code.google.com/p/v8/issues/detail?id=619 for details.
var obj = {}; var obj = {};
......
...@@ -36,16 +36,16 @@ assertEquals(7, '\7'.charCodeAt(0)); ...@@ -36,16 +36,16 @@ assertEquals(7, '\7'.charCodeAt(0));
assertEquals(56, '\8'.charCodeAt(0)); assertEquals(56, '\8'.charCodeAt(0));
assertEquals('\010', '\10'); assertEquals('\010', '\10');
assertEquals('\011', '\11'); assertEquals('\011', '\11');
assertEquals('\012', '\12'); assertEquals('\012', '\12');
assertEquals('\013', '\13'); assertEquals('\013', '\13');
assertEquals('\014', '\14'); assertEquals('\014', '\14');
assertEquals('\015', '\15'); assertEquals('\015', '\15');
assertEquals('\016', '\16'); assertEquals('\016', '\16');
assertEquals('\017', '\17'); assertEquals('\017', '\17');
assertEquals('\020', '\20'); assertEquals('\020', '\20');
assertEquals('\021', '\21'); assertEquals('\021', '\21');
assertEquals('\022', '\22'); assertEquals('\022', '\22');
assertEquals('\023', '\23'); assertEquals('\023', '\23');
assertEquals('\024', '\24'); assertEquals('\024', '\24');
...@@ -56,4 +56,4 @@ assertEquals('\027', '\27'); ...@@ -56,4 +56,4 @@ assertEquals('\027', '\27');
assertEquals(73, '\111'.charCodeAt(0)); assertEquals(73, '\111'.charCodeAt(0));
assertEquals(105, '\151'.charCodeAt(0)); assertEquals(105, '\151'.charCodeAt(0));
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
// See: http://code.google.com/p/v8/issues/detail?id=696 // See: http://code.google.com/p/v8/issues/detail?id=696
// Because of the change in dateparser in revision 4557 to support time // Because of the change in dateparser in revision 4557 to support time
// only strings in Date.parse we also misleadingly supported strings with non // only strings in Date.parse we also misleadingly supported strings with non
// leading numbers. // leading numbers.
assertTrue(isNaN(Date.parse('x'))); assertTrue(isNaN(Date.parse('x')));
assertTrue(isNaN(Date.parse('1x'))); assertTrue(isNaN(Date.parse('1x')));
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
// This regression test is used to ensure that Object.defineProperty // This regression test is used to ensure that Object.defineProperty
// keeps the existing value of the writable flag if none is given // keeps the existing value of the writable flag if none is given
// in the provided descriptor. // in the provided descriptor.
// See: http://code.google.com/p/v8/issues/detail?id=720 // See: http://code.google.com/p/v8/issues/detail?id=720
var o = {x: 10}; var o = {x: 10};
......
...@@ -40,7 +40,7 @@ try { ...@@ -40,7 +40,7 @@ try {
callEval(); callEval();
} catch (e) { } catch (e) {
assertUnreachable(); assertUnreachable();
} }
gc(); gc();
gc(); gc();
...@@ -53,4 +53,4 @@ try { ...@@ -53,4 +53,4 @@ try {
callEval(); callEval();
} catch (e) { } catch (e) {
assertUnreachable(); assertUnreachable();
} }
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Check that when valueOf for a String object is overwritten it is called and // Check that when valueOf for a String object is overwritten it is called and
// the result used when that object is added with a string. // the result used when that object is added with a string.
// See: http://code.google.com/p/v8/issues/detail?id=760 // See: http://code.google.com/p/v8/issues/detail?id=760
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Check that when valueOf for a String object is overwritten it is called and // Check that when valueOf for a String object is overwritten it is called and
// the result used when that object is added with a string. // the result used when that object is added with a string.
// See: http://code.google.com/p/v8/issues/detail?id=760 // See: http://code.google.com/p/v8/issues/detail?id=760
......
...@@ -32,7 +32,7 @@ x.__defineGetter__("a", function() { ...@@ -32,7 +32,7 @@ x.__defineGetter__("a", function() {
try { try {
y.x = 40; y.x = 40;
} catch (e) { } catch (e) {
assertEquals(3, e.stack.split('\n').length); assertEquals(3, e.stack.split('\n').length);
} }
return 40; return 40;
}); });
...@@ -41,7 +41,7 @@ x.__defineSetter__("a", function(val) { ...@@ -41,7 +41,7 @@ x.__defineSetter__("a", function(val) {
try { try {
y.x = 40; y.x = 40;
} catch(e) { } catch(e) {
assertEquals(3, e.stack.split('\n').length); assertEquals(3, e.stack.split('\n').length);
} }
}); });
...@@ -50,7 +50,7 @@ function getB() { ...@@ -50,7 +50,7 @@ function getB() {
try { try {
y.x = 30; y.x = 30;
} catch (e) { } catch (e) {
assertEquals(3, e.stack.split('\n').length); assertEquals(3, e.stack.split('\n').length);
} }
return 30; return 30;
} }
...@@ -59,7 +59,7 @@ function setB(val) { ...@@ -59,7 +59,7 @@ function setB(val) {
try { try {
y.x = 30; y.x = 30;
} catch(e) { } catch(e) {
assertEquals(3, e.stack.split('\n').length); assertEquals(3, e.stack.split('\n').length);
} }
} }
...@@ -72,7 +72,7 @@ var descriptor = { ...@@ -72,7 +72,7 @@ var descriptor = {
try { try {
y.x = 40; y.x = 40;
} catch (e) { } catch (e) {
assertEquals(3, e.stack.split('\n').length); assertEquals(3, e.stack.split('\n').length);
} }
return 40; return 40;
}, },
...@@ -80,7 +80,7 @@ var descriptor = { ...@@ -80,7 +80,7 @@ var descriptor = {
try { try {
y.x = 40; y.x = 40;
} catch(e) { } catch(e) {
assertEquals(3, e.stack.split('\n').length); assertEquals(3, e.stack.split('\n').length);
} }
} }
} }
...@@ -88,7 +88,7 @@ var descriptor = { ...@@ -88,7 +88,7 @@ var descriptor = {
Object.defineProperty(x, 'c', descriptor) Object.defineProperty(x, 'c', descriptor)
// Check that the stack for an exception in a getter and setter produce the // Check that the stack for an exception in a getter and setter produce the
// expected stack height. // expected stack height.
x.a; x.a;
x.b; x.b;
x.c; x.c;
......
...@@ -28,6 +28,6 @@ ...@@ -28,6 +28,6 @@
// Parser should not accept parentheses around labels. // Parser should not accept parentheses around labels.
// See http://code.google.com/p/v8/issues/detail?id=918 // See http://code.google.com/p/v8/issues/detail?id=918
// The label was parsed as an expression and then tested for being a // The label was parsed as an expression and then tested for being a
// single identifier. This threw away the parentheses. // single identifier. This threw away the parentheses.
assertThrows("(label):42;"); assertThrows("(label):42;");
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
function assertClose(expected, actual) { function assertClose(expected, actual) {
var delta = 0.00001; var delta = 0.00001;
if (Math.abs(expected - actual) > delta) { if (Math.abs(expected - actual) > delta) {
print('Failure: Expected <' + actual + '> to be close to <' + print('Failure: Expected <' + actual + '> to be close to <' +
expected + '>'); expected + '>');
} }
} }
......
...@@ -41,7 +41,7 @@ function f() { ...@@ -41,7 +41,7 @@ function f() {
} }
} }
} catch (e) { } catch (e) {
// Empty. // Empty.
} }
return 42; return 42;
} }
......
...@@ -35,14 +35,14 @@ function RunTest(ensure_fast_case) { ...@@ -35,14 +35,14 @@ function RunTest(ensure_fast_case) {
if (ensure_fast_case) { if (ensure_fast_case) {
%ToFastProperties(C1.prototype); %ToFastProperties(C1.prototype);
} }
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
var c1 = new C1(); var c1 = new C1();
assertEquals("undefined", typeof c1.x); assertEquals("undefined", typeof c1.x);
assertEquals(23, c1.y); assertEquals(23, c1.y);
} }
function C2() { function C2() {
this.x = 23; this.x = 23;
}; };
...@@ -51,14 +51,14 @@ function RunTest(ensure_fast_case) { ...@@ -51,14 +51,14 @@ function RunTest(ensure_fast_case) {
if (ensure_fast_case) { if (ensure_fast_case) {
%ToFastProperties(C2.prototype.__proto__) %ToFastProperties(C2.prototype.__proto__)
} }
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
var c2 = new C2(); var c2 = new C2();
assertEquals("undefined", typeof c2.x); assertEquals("undefined", typeof c2.x);
assertEquals(23, c2.y); assertEquals(23, c2.y);
} }
function C3() { function C3() {
this.x = 23; this.x = 23;
}; };
...@@ -67,14 +67,14 @@ function RunTest(ensure_fast_case) { ...@@ -67,14 +67,14 @@ function RunTest(ensure_fast_case) {
if (ensure_fast_case) { if (ensure_fast_case) {
%ToFastProperties(C3.prototype); %ToFastProperties(C3.prototype);
} }
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
var c3 = new C3(); var c3 = new C3();
assertEquals("undefined", typeof c3.x); assertEquals("undefined", typeof c3.x);
assertEquals(23, c3.y); assertEquals(23, c3.y);
} }
function C4() { function C4() {
this.x = 23; this.x = 23;
}; };
...@@ -84,14 +84,14 @@ function RunTest(ensure_fast_case) { ...@@ -84,14 +84,14 @@ function RunTest(ensure_fast_case) {
if (ensure_fast_case) { if (ensure_fast_case) {
%ToFastProperties(C4.prototype.__proto__); %ToFastProperties(C4.prototype.__proto__);
} }
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
var c4 = new C4(); var c4 = new C4();
assertEquals("undefined", typeof c4.x); assertEquals("undefined", typeof c4.x);
assertEquals(23, c4.y); assertEquals(23, c4.y);
} }
function D() { function D() {
this.x = 23; this.x = 23;
}; };
...@@ -99,7 +99,7 @@ function RunTest(ensure_fast_case) { ...@@ -99,7 +99,7 @@ function RunTest(ensure_fast_case) {
if (ensure_fast_case) { if (ensure_fast_case) {
%ToFastProperties(D.prototype); %ToFastProperties(D.prototype);
} }
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
var d = new D(); var d = new D();
assertEquals(23, d.x); assertEquals(23, d.x);
......
...@@ -29,8 +29,9 @@ ...@@ -29,8 +29,9 @@
// This situation can arise with sliced strings. This tests for an ARM bug // This situation can arise with sliced strings. This tests for an ARM bug
// that was fixed in r554. // that was fixed in r554.
var base = "Now is the time for all good men to come to the aid of the party. " + var base =
"Now is the time for all good men to come to the aid of the party." "Now is the time for all good men to come to the aid of the party. " +
"Now is the time for all good men to come to the aid of the party."
var s1 = base.substring(0, 64); var s1 = base.substring(0, 64);
var s2 = base.substring(66, 130); var s2 = base.substring(66, 130);
......
...@@ -63,7 +63,7 @@ assertEquals(1, twoByteString.indexOf("\u0391"), "Alpha"); ...@@ -63,7 +63,7 @@ assertEquals(1, twoByteString.indexOf("\u0391"), "Alpha");
assertEquals(2, twoByteString.indexOf("\u03a3"), "First Sigma"); assertEquals(2, twoByteString.indexOf("\u03a3"), "First Sigma");
assertEquals(3, twoByteString.indexOf("\u03a3",3), "Second Sigma"); assertEquals(3, twoByteString.indexOf("\u03a3",3), "Second Sigma");
assertEquals(4, twoByteString.indexOf("\u0395"), "Epsilon"); assertEquals(4, twoByteString.indexOf("\u0395"), "Epsilon");
assertEquals(-1, twoByteString.indexOf("\u0392"), "Not beta"); assertEquals(-1, twoByteString.indexOf("\u0392"), "Not beta");
// Test multi-char pattern // Test multi-char pattern
assertEquals(0, twoByteString.indexOf("\u039a\u0391"), "lambda Alpha"); assertEquals(0, twoByteString.indexOf("\u039a\u0391"), "lambda Alpha");
...@@ -71,7 +71,7 @@ assertEquals(1, twoByteString.indexOf("\u0391\u03a3"), "Alpha Sigma"); ...@@ -71,7 +71,7 @@ assertEquals(1, twoByteString.indexOf("\u0391\u03a3"), "Alpha Sigma");
assertEquals(2, twoByteString.indexOf("\u03a3\u03a3"), "Sigma Sigma"); assertEquals(2, twoByteString.indexOf("\u03a3\u03a3"), "Sigma Sigma");
assertEquals(3, twoByteString.indexOf("\u03a3\u0395"), "Sigma Epsilon"); assertEquals(3, twoByteString.indexOf("\u03a3\u0395"), "Sigma Epsilon");
assertEquals(-1, twoByteString.indexOf("\u0391\u03a3\u0395"), assertEquals(-1, twoByteString.indexOf("\u0391\u03a3\u0395"),
"Not Alpha Sigma Epsilon"); "Not Alpha Sigma Epsilon");
//single char pattern //single char pattern
......
...@@ -57,10 +57,10 @@ for(var i = 0; i < lipsum.length; i += 3) { ...@@ -57,10 +57,10 @@ for(var i = 0; i < lipsum.length; i += 3) {
var index = -1; var index = -1;
do { do {
index = lipsum.indexOf(substring, index + 1); index = lipsum.indexOf(substring, index + 1);
assertTrue(index != -1, assertTrue(index != -1,
"Lipsum substring " + i + ".." + (i + len-1) + " not found"); "Lipsum substring " + i + ".." + (i + len-1) + " not found");
assertEquals(lipsum.substring(index, index + len), substring, assertEquals(lipsum.substring(index, index + len), substring,
"Wrong lipsum substring found: " + i + ".." + (i + len - 1) + "/" + "Wrong lipsum substring found: " + i + ".." + (i + len - 1) + "/" +
index + ".." + (index + len - 1)); index + ".." + (index + len - 1));
} while (index >= 0 && index < i); } while (index >= 0 && index < i);
assertEquals(i, index, "Lipsum match at " + i + ".." + (i + len - 1)); assertEquals(i, index, "Lipsum match at " + i + ".." + (i + len - 1));
......
...@@ -57,7 +57,7 @@ assertEquals(s, s.substr(-100)); ...@@ -57,7 +57,7 @@ assertEquals(s, s.substr(-100));
assertEquals('abc', s.substr(-100, 3)); assertEquals('abc', s.substr(-100, 3));
assertEquals(s1, s.substr(-s.length + 1)); assertEquals(s1, s.substr(-s.length + 1));
// assertEquals('', s.substr(0, void 0)); // smjs and rhino // assertEquals('', s.substr(0, void 0)); // smjs and rhino
assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8 assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8
assertEquals('', s.substr(0, null)); assertEquals('', s.substr(0, null));
assertEquals(s, s.substr(0, String(s.length))); assertEquals(s, s.substr(0, String(s.length)));
...@@ -196,4 +196,4 @@ var b = a.slice(1,-1); ...@@ -196,4 +196,4 @@ var b = a.slice(1,-1);
assertEquals(a.slice(1,-1), b); assertEquals(a.slice(1,-1), b);
externalizeString(a); externalizeString(a);
assertEquals(a.slice(1,-1), b); assertEquals(a.slice(1,-1), b);
*/ */
\ No newline at end of file
...@@ -68,13 +68,13 @@ assertArrayEquals(["a", "b", "c"], "abc".split(/(?=.)/)); ...@@ -68,13 +68,13 @@ assertArrayEquals(["a", "b", "c"], "abc".split(/(?=.)/));
/* "ab".split(/((?=.))/) /* "ab".split(/((?=.))/)
* *
* KJS: ,a,,b * KJS: ,a,,b
* SM: a,,b, * SM: a,,b,
* IE: a,b * IE: a,b
* Opera: a,,b * Opera: a,,b
* V8: a,,b * V8: a,,b
* *
* Opera seems to have this right. The others make no sense. * Opera seems to have this right. The others make no sense.
*/ */
assertArrayEquals(["a", "", "b"], "ab".split(/((?=.))/)); assertArrayEquals(["a", "", "b"], "ab".split(/((?=.))/));
......
...@@ -55,7 +55,7 @@ assertEquals(s, s.substr(-100)); ...@@ -55,7 +55,7 @@ assertEquals(s, s.substr(-100));
assertEquals('abc', s.substr(-100, 3)); assertEquals('abc', s.substr(-100, 3));
assertEquals(s1, s.substr(-s.length + 1)); assertEquals(s1, s.substr(-s.length + 1));
// assertEquals('', s.substr(0, void 0)); // smjs and rhino // assertEquals('', s.substr(0, void 0)); // smjs and rhino
assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8 assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8
assertEquals('', s.substr(0, null)); assertEquals('', s.substr(0, null));
assertEquals(s, s.substr(0, String(s.length))); assertEquals(s, s.substr(0, String(s.length)));
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Tests the handling of multiple assignments to the same property in a // Tests the handling of multiple assignments to the same property in a
// constructor that only has simple this property assignments. // constructor that only has simple this property assignments.
function Node() { function Node() {
......
...@@ -250,7 +250,7 @@ function break_from_nested_catch(x) { ...@@ -250,7 +250,7 @@ function break_from_nested_catch(x) {
} catch (o) { } catch (o) {
x--; x--;
} }
} }
return x; return x;
} }
...@@ -274,7 +274,7 @@ function break_from_nested_finally(x) { ...@@ -274,7 +274,7 @@ function break_from_nested_finally(x) {
x--; x--;
} }
x--; // should not happen x--; // should not happen
} }
return x; return x;
} }
......
...@@ -807,7 +807,7 @@ var cyrillic = ...@@ -807,7 +807,7 @@ var cyrillic =
" * Васильев Л.С. Древний Китай: в 3 т. Т. 3. Период Чжаньго (V–III вв. до н.э.). М.: Восточная литература, 2006. ISBN 502018103X\n" + " * Васильев Л.С. Древний Китай: в 3 т. Т. 3. Период Чжаньго (V–III вв. до н.э.). М.: Восточная литература, 2006. ISBN 502018103X\n" +
" * Непомнин О.Е. История Китая: Эпоха Цин. XVII – начало XX века. М.: Восточная литература, 2005. ISBN 5020184004\n"; " * Непомнин О.Е. История Китая: Эпоха Цин. XVII – начало XX века. М.: Восточная литература, 2005. ISBN 5020184004\n";
var devanagari = var devanagari =
"भारत\n" + "भारत\n" +
"विकिपीडिया, एक मुक्त ज्ञानकोष से\n" + "विकिपीडिया, एक मुक्त ज्ञानकोष से\n" +
"Jump to: navigation, search\n" + "Jump to: navigation, search\n" +
...@@ -1417,7 +1417,7 @@ var english = ...@@ -1417,7 +1417,7 @@ var english =
"There are many words of French origin in English, such as competition, art, table, publicity, police, role, routine, machine, force, and many others that have been and are being anglicised; they are now pronounced according to English rules of phonology, rather than French. A large portion of English vocabulary is of French or Oïl language origin, most derived from, or transmitted via, the Anglo-Norman spoken by the upper classes in England for several hundred years after the Norman Conquest.\n"; "There are many words of French origin in English, such as competition, art, table, publicity, police, role, routine, machine, force, and many others that have been and are being anglicised; they are now pronounced according to English rules of phonology, rather than French. A large portion of English vocabulary is of French or Oïl language origin, most derived from, or transmitted via, the Anglo-Norman spoken by the upper classes in England for several hundred years after the Norman Conquest.\n";
var greek = var greek =
"Ελλάδα\n" + "Ελλάδα\n" +
"Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια\n" + "Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια\n" +
"Ελληνική Δημοκρατία\n" + "Ελληνική Δημοκρατία\n" +
......
...@@ -39,7 +39,7 @@ function RunTests() { ...@@ -39,7 +39,7 @@ function RunTests() {
assertEquals('object', (42).TypeOfThis()); assertEquals('object', (42).TypeOfThis());
assertEquals('object', (3.14).TypeOfThis()); assertEquals('object', (3.14).TypeOfThis());
} }
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
assertEquals('object', 'xxx'['TypeOfThis']()); assertEquals('object', 'xxx'['TypeOfThis']());
assertEquals('object', true['TypeOfThis']()); assertEquals('object', true['TypeOfThis']());
...@@ -47,11 +47,11 @@ function RunTests() { ...@@ -47,11 +47,11 @@ function RunTests() {
assertEquals('object', (42)['TypeOfThis']()); assertEquals('object', (42)['TypeOfThis']());
assertEquals('object', (3.14)['TypeOfThis']()); assertEquals('object', (3.14)['TypeOfThis']());
} }
function CallTypeOfThis(obj) { function CallTypeOfThis(obj) {
assertEquals('object', obj.TypeOfThis()); assertEquals('object', obj.TypeOfThis());
} }
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
CallTypeOfThis('xxx'); CallTypeOfThis('xxx');
CallTypeOfThis(true); CallTypeOfThis(true);
...@@ -59,7 +59,7 @@ function RunTests() { ...@@ -59,7 +59,7 @@ function RunTests() {
CallTypeOfThis(42); CallTypeOfThis(42);
CallTypeOfThis(3.14); CallTypeOfThis(3.14);
} }
function TestWithWith(obj) { function TestWithWith(obj) {
with (obj) { with (obj) {
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
...@@ -67,13 +67,13 @@ function RunTests() { ...@@ -67,13 +67,13 @@ function RunTests() {
} }
} }
} }
TestWithWith('xxx'); TestWithWith('xxx');
TestWithWith(true); TestWithWith(true);
TestWithWith(false); TestWithWith(false);
TestWithWith(42); TestWithWith(42);
TestWithWith(3.14); TestWithWith(3.14);
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
assertEquals('object', true[7]()); assertEquals('object', true[7]());
assertEquals('object', false[7]()); assertEquals('object', false[7]());
...@@ -100,7 +100,7 @@ function RunTests() { ...@@ -100,7 +100,7 @@ function RunTests() {
function TypeOfThis() { return typeof this; } function TypeOfThis() { return typeof this; }
// Test with normal setup of prototype. // Test with normal setup of prototype.
String.prototype.TypeOfThis = TypeOfThis; String.prototype.TypeOfThis = TypeOfThis;
Boolean.prototype.TypeOfThis = TypeOfThis; Boolean.prototype.TypeOfThis = TypeOfThis;
Number.prototype.TypeOfThis = TypeOfThis; Number.prototype.TypeOfThis = TypeOfThis;
......
...@@ -245,7 +245,7 @@ ecma_3/Number/15.7.4.7-1: FAIL_OK ...@@ -245,7 +245,7 @@ ecma_3/Number/15.7.4.7-1: FAIL_OK
# toExponential argument restricted to range 0..20 in JSC/V8 # toExponential argument restricted to range 0..20 in JSC/V8
ecma_3/Number/15.7.4.6-1: FAIL_OK ecma_3/Number/15.7.4.6-1: FAIL_OK
#:=== RegExp:=== #:=== RegExp:===
# We don't match the syntax error message of Mozilla for invalid # We don't match the syntax error message of Mozilla for invalid
# RegExp flags. # RegExp flags.
ecma_3/RegExp/15.10.4.1-6: FAIL_OK ecma_3/RegExp/15.10.4.1-6: FAIL_OK
...@@ -578,7 +578,7 @@ js1_5/Regress/regress-352604: FAIL_OK ...@@ -578,7 +578,7 @@ js1_5/Regress/regress-352604: FAIL_OK
js1_5/Regress/regress-417893: FAIL_OK js1_5/Regress/regress-417893: FAIL_OK
# Unsupported use of "[]" as function parameter. We match JSC. # Unsupported use of "[]" as function parameter. We match JSC.
js1_5/Regress/regress-416737-01: FAIL_OK js1_5/Regress/regress-416737-01: FAIL_OK
js1_5/Regress/regress-416737-02: FAIL_OK js1_5/Regress/regress-416737-02: FAIL_OK
......
...@@ -138,7 +138,7 @@ def v8_to_int(v): ...@@ -138,7 +138,7 @@ def v8_to_int(v):
else: else:
return '?' return '?'
def v8_get_value(vstring): def v8_get_value(vstring):
v = gdb.parse_and_eval(vstring) v = gdb.parse_and_eval(vstring)
return v8_to_int(v) return v8_to_int(v)
......
#!/usr/bin/env python #!/usr/bin/env python
# #
# Copyright 2008 the V8 project authors. All rights reserved. # Copyright 2011 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
...@@ -88,7 +88,6 @@ whitespace/blank_line ...@@ -88,7 +88,6 @@ whitespace/blank_line
whitespace/braces whitespace/braces
whitespace/comma whitespace/comma
whitespace/comments whitespace/comments
whitespace/end_of_line
whitespace/ending_newline whitespace/ending_newline
whitespace/indent whitespace/indent
whitespace/labels whitespace/labels
...@@ -231,11 +230,12 @@ COPYRIGHT_HEADER_PATTERN = re.compile( ...@@ -231,11 +230,12 @@ COPYRIGHT_HEADER_PATTERN = re.compile(
class SourceProcessor(SourceFileProcessor): class SourceProcessor(SourceFileProcessor):
""" """
Check that all files include a copyright notice. Check that all files include a copyright notice and no trailing whitespaces.
""" """
RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript', RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript',
'SConstruct', '.status'] 'SConstruct', '.status', '.gyp', '.gypi']
def IsRelevant(self, name): def IsRelevant(self, name):
for ext in SourceProcessor.RELEVANT_EXTENSIONS: for ext in SourceProcessor.RELEVANT_EXTENSIONS:
if name.endswith(ext): if name.endswith(ext):
...@@ -273,6 +273,22 @@ class SourceProcessor(SourceFileProcessor): ...@@ -273,6 +273,22 @@ class SourceProcessor(SourceFileProcessor):
if not COPYRIGHT_HEADER_PATTERN.search(contents): if not COPYRIGHT_HEADER_PATTERN.search(contents):
print "%s is missing a correct copyright header." % name print "%s is missing a correct copyright header." % name
result = False result = False
ext = base.split('.').pop()
if ' \n' in contents or contents.endswith(' '):
line = 0
lines = []
parts = contents.split(' \n')
if not contents.endswith(' '):
parts.pop()
for part in parts:
line += part.count('\n') + 1
lines.append(str(line))
linenumbers = ', '.join(lines)
if len(lines) > 1:
print "%s has trailing whitespaces in lines %s." % (name, linenumbers)
else:
print "%s has trailing whitespaces in line %s." % (name, linenumbers)
result = False
return result return result
def ProcessFiles(self, files, path): def ProcessFiles(self, files, path):
......
...@@ -47,7 +47,7 @@ def ProcessLogFile(filename, options): ...@@ -47,7 +47,7 @@ def ProcessLogFile(filename, options):
itemname = 'heap-js-cons-item' itemname = 'heap-js-cons-item'
else: else:
itemname = 'heap-sample-item' itemname = 'heap-sample-item'
first_call_time = None first_call_time = None
sample_time = 0.0 sample_time = 0.0
sampling = False sampling = False
...@@ -108,11 +108,11 @@ def Main(): ...@@ -108,11 +108,11 @@ def Main():
if not ProcessOptions(options): if not ProcessOptions(options):
parser.print_help() parser.print_help()
sys.exit(); sys.exit();
if not args: if not args:
print "Missing logfile" print "Missing logfile"
sys.exit(); sys.exit();
ProcessLogFile(args[0], options) ProcessLogFile(args[0], options)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment