Commit 57760b82 authored by lrn@chromium.org's avatar lrn@chromium.org

Make preparser detect duplicate parameters and object literal properties.

This is a fix and reapply of r8516 with some comments addressed and more
tests added.
The difference from r8516 is that canonicalization of number literals is
no performed using the same methods as in v8, to avoid false positives/negatives
when detecting duplicates.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8541 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1fff7803
...@@ -232,8 +232,13 @@ PREPARSER_SOURCES = { ...@@ -232,8 +232,13 @@ PREPARSER_SOURCES = {
'all': Split(""" 'all': Split("""
allocation.cc allocation.cc
bignum.cc bignum.cc
bignum-dtoa.cc
cached-powers.cc cached-powers.cc
conversions.cc conversions.cc
diy-fp.cc
dtoa.cc
fast-dtoa.cc
fixed-dtoa.cc
hashmap.cc hashmap.cc
preparse-data.cc preparse-data.cc
preparser.cc preparser.cc
......
// Copyright 2010 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:
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
#include <math.h> #include <math.h>
#include "v8.h" #include "../include/v8stdint.h"
#include "checks.h"
#include "utils.h"
#include "bignum-dtoa.h" #include "bignum-dtoa.h"
#include "bignum.h" #include "bignum.h"
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +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.
#include <stdarg.h> #include <stdarg.h>
#include <math.h>
#include <limits.h> #include <limits.h>
#include "conversions-inl.h" #include "conversions-inl.h"
...@@ -390,7 +391,7 @@ char* DoubleToRadixCString(double value, int radix) { ...@@ -390,7 +391,7 @@ char* DoubleToRadixCString(double value, int radix) {
int integer_pos = kBufferSize - 2; int integer_pos = kBufferSize - 2;
do { do {
integer_buffer[integer_pos--] = integer_buffer[integer_pos--] =
chars[static_cast<int>(modulo(integer_part, radix))]; chars[static_cast<int>(fmod(integer_part, radix))];
integer_part /= radix; integer_part /= radix;
} while (integer_part >= 1.0); } while (integer_part >= 1.0);
// Sanity check. // Sanity check.
...@@ -430,24 +431,4 @@ char* DoubleToRadixCString(double value, int radix) { ...@@ -430,24 +431,4 @@ char* DoubleToRadixCString(double value, int radix) {
return builder.Finalize(); return builder.Finalize();
} }
static Mutex* dtoa_lock_one = OS::CreateMutex();
static Mutex* dtoa_lock_zero = OS::CreateMutex();
} } // namespace v8::internal } } // namespace v8::internal
extern "C" {
void ACQUIRE_DTOA_LOCK(int n) {
ASSERT(n == 0 || n == 1);
(n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)->Lock();
}
void FREE_DTOA_LOCK(int n) {
ASSERT(n == 0 || n == 1);
(n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)->
Unlock();
}
}
...@@ -127,6 +127,8 @@ double StringToDouble(UnicodeCache* unicode_cache, ...@@ -127,6 +127,8 @@ double StringToDouble(UnicodeCache* unicode_cache,
int flags, int flags,
double empty_string_val = 0); double empty_string_val = 0);
const int kDoubleToCStringMinBufferSize = 100;
// Converts a double to a string value according to ECMA-262 9.8.1. // Converts a double to a string value according to ECMA-262 9.8.1.
// The buffer should be large enough for any floating point number. // The buffer should be large enough for any floating point number.
// 100 characters is enough. // 100 characters is enough.
......
// Copyright 2010 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:
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
#include <math.h> #include <math.h>
#include "v8.h" #include "../include/v8stdint.h"
#include "checks.h"
#include "utils.h"
#include "dtoa.h" #include "dtoa.h"
#include "bignum-dtoa.h" #include "bignum-dtoa.h"
......
// Copyright 2010 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:
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
// (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.
#include "v8.h" #include "../include/v8stdint.h"
#include "checks.h"
#include "utils.h"
#include "fast-dtoa.h" #include "fast-dtoa.h"
......
// Copyright 2010 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:
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
#include <math.h> #include <math.h>
#include "v8.h" #include "../include/v8stdint.h"
#include "checks.h"
#include "utils.h"
#include "double.h" #include "double.h"
#include "fixed-dtoa.h" #include "fixed-dtoa.h"
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "allocation.h" #include "allocation.h"
#include "utils.h" #include "utils.h"
#include "list.h" #include "list.h"
#include "hashmap.h"
#include "scanner-base.h" #include "scanner-base.h"
#include "preparse-data-format.h" #include "preparse-data-format.h"
#include "preparse-data.h" #include "preparse-data.h"
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
// (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.
#include <math.h>
#include "../include/v8stdint.h" #include "../include/v8stdint.h"
#include "unicode.h" #include "unicode.h"
#include "globals.h" #include "globals.h"
...@@ -32,6 +34,8 @@ ...@@ -32,6 +34,8 @@
#include "allocation.h" #include "allocation.h"
#include "utils.h" #include "utils.h"
#include "list.h" #include "list.h"
#include "conversions.h"
#include "hashmap.h"
#include "scanner-base.h" #include "scanner-base.h"
#include "preparse-data-format.h" #include "preparse-data-format.h"
...@@ -70,27 +74,22 @@ void PreParser::ReportUnexpectedToken(i::Token::Value token) { ...@@ -70,27 +74,22 @@ void PreParser::ReportUnexpectedToken(i::Token::Value token) {
// Four of the tokens are treated specially // Four of the tokens are treated specially
switch (token) { switch (token) {
case i::Token::EOS: case i::Token::EOS:
return ReportMessageAt(source_location.beg_pos, source_location.end_pos, return ReportMessageAt(source_location, "unexpected_eos", NULL);
"unexpected_eos", NULL);
case i::Token::NUMBER: case i::Token::NUMBER:
return ReportMessageAt(source_location.beg_pos, source_location.end_pos, return ReportMessageAt(source_location, "unexpected_token_number", NULL);
"unexpected_token_number", NULL);
case i::Token::STRING: case i::Token::STRING:
return ReportMessageAt(source_location.beg_pos, source_location.end_pos, return ReportMessageAt(source_location, "unexpected_token_string", NULL);
"unexpected_token_string", NULL);
case i::Token::IDENTIFIER: case i::Token::IDENTIFIER:
return ReportMessageAt(source_location.beg_pos, source_location.end_pos, return ReportMessageAt(source_location,
"unexpected_token_identifier", NULL); "unexpected_token_identifier", NULL);
case i::Token::FUTURE_RESERVED_WORD: case i::Token::FUTURE_RESERVED_WORD:
return ReportMessageAt(source_location.beg_pos, source_location.end_pos, return ReportMessageAt(source_location, "unexpected_reserved", NULL);
"unexpected_reserved", NULL);
case i::Token::FUTURE_STRICT_RESERVED_WORD: case i::Token::FUTURE_STRICT_RESERVED_WORD:
return ReportMessageAt(source_location.beg_pos, source_location.end_pos, return ReportMessageAt(source_location,
"unexpected_strict_reserved", NULL); "unexpected_strict_reserved", NULL);
default: default:
const char* name = i::Token::String(token); const char* name = i::Token::String(token);
ReportMessageAt(source_location.beg_pos, source_location.end_pos, ReportMessageAt(source_location, "unexpected_token", name);
"unexpected_token", name);
} }
} }
...@@ -100,7 +99,7 @@ void PreParser::ReportUnexpectedToken(i::Token::Value token) { ...@@ -100,7 +99,7 @@ void PreParser::ReportUnexpectedToken(i::Token::Value token) {
void PreParser::CheckOctalLiteral(int beg_pos, int end_pos, bool* ok) { void PreParser::CheckOctalLiteral(int beg_pos, int end_pos, bool* ok) {
i::Scanner::Location octal = scanner_->octal_position(); i::Scanner::Location octal = scanner_->octal_position();
if (beg_pos <= octal.beg_pos && octal.end_pos <= end_pos) { if (beg_pos <= octal.beg_pos && octal.end_pos <= end_pos) {
ReportMessageAt(octal.beg_pos, octal.end_pos, "strict_octal_literal", NULL); ReportMessageAt(octal, "strict_octal_literal", NULL);
scanner_->clear_octal_position(); scanner_->clear_octal_position();
*ok = false; *ok = false;
} }
...@@ -243,7 +242,7 @@ PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) { ...@@ -243,7 +242,7 @@ PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) {
if (identifier.IsFutureStrictReserved()) { if (identifier.IsFutureStrictReserved()) {
type = "strict_reserved_word"; type = "strict_reserved_word";
} }
ReportMessageAt(location.beg_pos, location.end_pos, type, NULL); ReportMessageAt(location, type, NULL);
*ok = false; *ok = false;
} }
return Statement::FunctionDeclaration(); return Statement::FunctionDeclaration();
...@@ -300,8 +299,7 @@ PreParser::Statement PreParser::ParseVariableDeclarations(bool accept_IN, ...@@ -300,8 +299,7 @@ PreParser::Statement PreParser::ParseVariableDeclarations(bool accept_IN,
} else if (peek() == i::Token::CONST) { } else if (peek() == i::Token::CONST) {
if (strict_mode()) { if (strict_mode()) {
i::Scanner::Location location = scanner_->peek_location(); i::Scanner::Location location = scanner_->peek_location();
ReportMessageAt(location.beg_pos, location.end_pos, ReportMessageAt(location, "strict_const", NULL);
"strict_const", NULL);
*ok = false; *ok = false;
return Statement::Default(); return Statement::Default();
} }
...@@ -450,8 +448,7 @@ PreParser::Statement PreParser::ParseWithStatement(bool* ok) { ...@@ -450,8 +448,7 @@ PreParser::Statement PreParser::ParseWithStatement(bool* ok) {
Expect(i::Token::WITH, CHECK_OK); Expect(i::Token::WITH, CHECK_OK);
if (strict_mode()) { if (strict_mode()) {
i::Scanner::Location location = scanner_->location(); i::Scanner::Location location = scanner_->location();
ReportMessageAt(location.beg_pos, location.end_pos, ReportMessageAt(location, "strict_mode_with", NULL);
"strict_mode_with", NULL);
*ok = false; *ok = false;
return Statement::Default(); return Statement::Default();
} }
...@@ -586,8 +583,7 @@ PreParser::Statement PreParser::ParseThrowStatement(bool* ok) { ...@@ -586,8 +583,7 @@ PreParser::Statement PreParser::ParseThrowStatement(bool* ok) {
Expect(i::Token::THROW, CHECK_OK); Expect(i::Token::THROW, CHECK_OK);
if (scanner_->HasAnyLineTerminatorBeforeNext()) { if (scanner_->HasAnyLineTerminatorBeforeNext()) {
i::JavaScriptScanner::Location pos = scanner_->location(); i::JavaScriptScanner::Location pos = scanner_->location();
ReportMessageAt(pos.beg_pos, pos.end_pos, ReportMessageAt(pos, "newline_after_throw", NULL);
"newline_after_throw", NULL);
*ok = false; *ok = false;
return Statement::Default(); return Statement::Default();
} }
...@@ -999,8 +995,7 @@ PreParser::Expression PreParser::ParsePrimaryExpression(bool* ok) { ...@@ -999,8 +995,7 @@ PreParser::Expression PreParser::ParsePrimaryExpression(bool* ok) {
if (strict_mode()) { if (strict_mode()) {
Next(); Next();
i::Scanner::Location location = scanner_->location(); i::Scanner::Location location = scanner_->location();
ReportMessageAt(location.beg_pos, location.end_pos, ReportMessageAt(location, "strict_reserved_word", NULL);
"strict_reserved_word", NULL);
*ok = false; *ok = false;
return Expression::Default(); return Expression::Default();
} }
...@@ -1081,6 +1076,39 @@ PreParser::Expression PreParser::ParseArrayLiteral(bool* ok) { ...@@ -1081,6 +1076,39 @@ PreParser::Expression PreParser::ParseArrayLiteral(bool* ok) {
return Expression::Default(); return Expression::Default();
} }
void PreParser::CheckDuplicate(DuplicateFinder* finder,
i::Token::Value property,
int type,
bool* ok) {
int old_type;
if (property == i::Token::NUMBER) {
old_type = finder->AddNumber(scanner_->literal_ascii_string(), type);
} else if (scanner_->is_literal_ascii()) {
old_type = finder->AddAsciiSymbol(scanner_->literal_ascii_string(),
type);
} else {
old_type = finder->AddUC16Symbol(scanner_->literal_uc16_string(), type);
}
if (HasConflict(old_type, type)) {
if (IsDataDataConflict(old_type, type)) {
// Both are data properties.
if (!strict_mode()) return;
ReportMessageAt(scanner_->location(),
"strict_duplicate_property", NULL);
} else if (IsDataAccessorConflict(old_type, type)) {
// Both a data and an accessor property with the same name.
ReportMessageAt(scanner_->location(),
"accessor_data_property", NULL);
} else {
ASSERT(IsAccessorAccessorConflict(old_type, type));
// Both accessors of the same type.
ReportMessageAt(scanner_->location(),
"accessor_get_set", NULL);
}
*ok = false;
}
}
PreParser::Expression PreParser::ParseObjectLiteral(bool* ok) { PreParser::Expression PreParser::ParseObjectLiteral(bool* ok) {
// ObjectLiteral :: // ObjectLiteral ::
...@@ -1090,6 +1118,7 @@ PreParser::Expression PreParser::ParseObjectLiteral(bool* ok) { ...@@ -1090,6 +1118,7 @@ PreParser::Expression PreParser::ParseObjectLiteral(bool* ok) {
// )*[','] '}' // )*[','] '}'
Expect(i::Token::LBRACE, CHECK_OK); Expect(i::Token::LBRACE, CHECK_OK);
DuplicateFinder duplicate_finder(scanner_->unicode_cache());
while (peek() != i::Token::RBRACE) { while (peek() != i::Token::RBRACE) {
i::Token::Value next = peek(); i::Token::Value next = peek();
switch (next) { switch (next) {
...@@ -1114,24 +1143,30 @@ PreParser::Expression PreParser::ParseObjectLiteral(bool* ok) { ...@@ -1114,24 +1143,30 @@ PreParser::Expression PreParser::ParseObjectLiteral(bool* ok) {
if (!is_keyword) { if (!is_keyword) {
LogSymbol(); LogSymbol();
} }
PropertyType type = is_getter ? kGetterProperty : kSetterProperty;
CheckDuplicate(&duplicate_finder, name, type, CHECK_OK);
ParseFunctionLiteral(CHECK_OK); ParseFunctionLiteral(CHECK_OK);
if (peek() != i::Token::RBRACE) { if (peek() != i::Token::RBRACE) {
Expect(i::Token::COMMA, CHECK_OK); Expect(i::Token::COMMA, CHECK_OK);
} }
continue; // restart the while continue; // restart the while
} }
CheckDuplicate(&duplicate_finder, next, kValueProperty, CHECK_OK);
break; break;
} }
case i::Token::STRING: case i::Token::STRING:
Consume(next); Consume(next);
CheckDuplicate(&duplicate_finder, next, kValueProperty, CHECK_OK);
GetStringSymbol(); GetStringSymbol();
break; break;
case i::Token::NUMBER: case i::Token::NUMBER:
Consume(next); Consume(next);
CheckDuplicate(&duplicate_finder, next, kValueProperty, CHECK_OK);
break; break;
default: default:
if (i::Token::IsKeyword(next)) { if (i::Token::IsKeyword(next)) {
Consume(next); Consume(next);
CheckDuplicate(&duplicate_finder, next, kValueProperty, CHECK_OK);
} else { } else {
// Unexpected token. // Unexpected token.
*ok = false; *ok = false;
...@@ -1156,9 +1191,7 @@ PreParser::Expression PreParser::ParseRegExpLiteral(bool seen_equal, ...@@ -1156,9 +1191,7 @@ PreParser::Expression PreParser::ParseRegExpLiteral(bool seen_equal,
bool* ok) { bool* ok) {
if (!scanner_->ScanRegExpPattern(seen_equal)) { if (!scanner_->ScanRegExpPattern(seen_equal)) {
Next(); Next();
i::JavaScriptScanner::Location location = scanner_->location(); ReportMessageAt(scanner_->location(), "unterminated_regexp", NULL);
ReportMessageAt(location.beg_pos, location.end_pos,
"unterminated_regexp", NULL);
*ok = false; *ok = false;
return Expression::Default(); return Expression::Default();
} }
...@@ -1167,9 +1200,7 @@ PreParser::Expression PreParser::ParseRegExpLiteral(bool seen_equal, ...@@ -1167,9 +1200,7 @@ PreParser::Expression PreParser::ParseRegExpLiteral(bool seen_equal,
if (!scanner_->ScanRegExpFlags()) { if (!scanner_->ScanRegExpFlags()) {
Next(); Next();
i::JavaScriptScanner::Location location = scanner_->location(); ReportMessageAt(scanner_->location(), "invalid_regexp_flags", NULL);
ReportMessageAt(location.beg_pos, location.end_pos,
"invalid_regexp_flags", NULL);
*ok = false; *ok = false;
return Expression::Default(); return Expression::Default();
} }
...@@ -1214,6 +1245,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(bool* ok) { ...@@ -1214,6 +1245,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(bool* ok) {
Expect(i::Token::LPAREN, CHECK_OK); Expect(i::Token::LPAREN, CHECK_OK);
int start_position = scanner_->location().beg_pos; int start_position = scanner_->location().beg_pos;
bool done = (peek() == i::Token::RPAREN); bool done = (peek() == i::Token::RPAREN);
DuplicateFinder duplicate_finder(scanner_->unicode_cache());
while (!done) { while (!done) {
Identifier id = ParseIdentifier(CHECK_OK); Identifier id = ParseIdentifier(CHECK_OK);
if (!id.IsValidStrictVariable()) { if (!id.IsValidStrictVariable()) {
...@@ -1222,6 +1254,20 @@ PreParser::Expression PreParser::ParseFunctionLiteral(bool* ok) { ...@@ -1222,6 +1254,20 @@ PreParser::Expression PreParser::ParseFunctionLiteral(bool* ok) {
id, id,
CHECK_OK); CHECK_OK);
} }
int prev_value;
if (scanner_->is_literal_ascii()) {
prev_value =
duplicate_finder.AddAsciiSymbol(scanner_->literal_ascii_string(), 1);
} else {
prev_value =
duplicate_finder.AddUC16Symbol(scanner_->literal_uc16_string(), 1);
}
if (prev_value != 0) {
SetStrictModeViolation(scanner_->location(),
"strict_param_dupe",
CHECK_OK);
}
done = (peek() == i::Token::RPAREN); done = (peek() == i::Token::RPAREN);
if (!done) { if (!done) {
Expect(i::Token::COMMA, CHECK_OK); Expect(i::Token::COMMA, CHECK_OK);
...@@ -1373,13 +1419,18 @@ void PreParser::SetStrictModeViolation(i::Scanner::Location location, ...@@ -1373,13 +1419,18 @@ void PreParser::SetStrictModeViolation(i::Scanner::Location location,
const char* type, const char* type,
bool* ok) { bool* ok) {
if (strict_mode()) { if (strict_mode()) {
ReportMessageAt(location.beg_pos, location.end_pos, type, NULL); ReportMessageAt(location, type, NULL);
*ok = false; *ok = false;
return; return;
} }
// Delay report in case this later turns out to be strict code // Delay report in case this later turns out to be strict code
// (i.e., for function names and parameters prior to a "use strict" // (i.e., for function names and parameters prior to a "use strict"
// directive). // directive).
// It's safe to overwrite an existing violation.
// It's either from a function that turned out to be non-strict,
// or it's in the current function (and we just need to report
// one error), or it's in a unclosed nesting function that wasn't
// strict (otherwise we would already be in strict mode).
strict_mode_violation_location_ = location; strict_mode_violation_location_ = location;
strict_mode_violation_type_ = type; strict_mode_violation_type_ = type;
} }
...@@ -1391,11 +1442,9 @@ void PreParser::CheckDelayedStrictModeViolation(int beg_pos, ...@@ -1391,11 +1442,9 @@ void PreParser::CheckDelayedStrictModeViolation(int beg_pos,
i::Scanner::Location location = strict_mode_violation_location_; i::Scanner::Location location = strict_mode_violation_location_;
if (location.IsValid() && if (location.IsValid() &&
location.beg_pos > beg_pos && location.end_pos < end_pos) { location.beg_pos > beg_pos && location.end_pos < end_pos) {
ReportMessageAt(location.beg_pos, location.end_pos, ReportMessageAt(location, strict_mode_violation_type_, NULL);
strict_mode_violation_type_, NULL);
*ok = false; *ok = false;
} }
strict_mode_violation_location_ = i::Scanner::Location::invalid();
} }
...@@ -1410,7 +1459,7 @@ void PreParser::StrictModeIdentifierViolation(i::Scanner::Location location, ...@@ -1410,7 +1459,7 @@ void PreParser::StrictModeIdentifierViolation(i::Scanner::Location location,
type = "strict_reserved_word"; type = "strict_reserved_word";
} }
if (strict_mode()) { if (strict_mode()) {
ReportMessageAt(location.beg_pos, location.end_pos, type, NULL); ReportMessageAt(location, type, NULL);
*ok = false; *ok = false;
return; return;
} }
...@@ -1462,4 +1511,137 @@ bool PreParser::peek_any_identifier() { ...@@ -1462,4 +1511,137 @@ bool PreParser::peek_any_identifier() {
next == i::Token::FUTURE_RESERVED_WORD || next == i::Token::FUTURE_RESERVED_WORD ||
next == i::Token::FUTURE_STRICT_RESERVED_WORD; next == i::Token::FUTURE_STRICT_RESERVED_WORD;
} }
int DuplicateFinder::AddAsciiSymbol(i::Vector<const char> key, int value) {
return AddSymbol(i::Vector<const byte>::cast(key), true, value);
}
int DuplicateFinder::AddUC16Symbol(i::Vector<const uint16_t> key, int value) {
return AddSymbol(i::Vector<const byte>::cast(key), false, value);
}
int DuplicateFinder::AddSymbol(i::Vector<const byte> key,
bool is_ascii,
int value) {
uint32_t hash = Hash(key, is_ascii);
byte* encoding = BackupKey(key, is_ascii);
i::HashMap::Entry* entry = map_->Lookup(encoding, hash, true);
int old_value = static_cast<int>(reinterpret_cast<intptr_t>(entry->value));
entry->value =
reinterpret_cast<void*>(static_cast<intptr_t>(value | old_value));
return old_value;
}
int DuplicateFinder::AddNumber(i::Vector<const char> key, int value) {
ASSERT(key.length() > 0);
// Quick check for already being in canonical form.
if (IsNumberCanonical(key)) {
return AddAsciiSymbol(key, value);
}
int flags = i::ALLOW_HEX | i::ALLOW_OCTALS;
double double_value = StringToDouble(unicode_constants_, key, flags, 0.0);
int length;
const char* string;
if (!isfinite(double_value)) {
string = "Infinity";
length = 8; // strlen("Infinity");
} else {
string = DoubleToCString(double_value,
i::Vector<char>(number_buffer_, kBufferSize));
length = i::StrLength(string);
}
return AddAsciiSymbol(i::Vector<const char>(string, length), value);
}
bool DuplicateFinder::IsNumberCanonical(i::Vector<const char> number) {
// Test for a safe approximation of number literals that are already
// in canonical form: max 15 digits, no leading zeroes, except an
// integer part that is a single zero, and no trailing zeros below
// the decimal point.
int pos = 0;
int length = number.length();
if (number.length() > 15) return false;
if (number[pos] == '0') {
pos++;
} else {
while (pos < length &&
static_cast<unsigned>(number[pos] - '0') <= ('9' - '0')) pos++;
}
if (length == pos) return true;
if (number[pos] != '.') return false;
pos++;
bool invalid_last_digit = true;
while (pos < length) {
byte digit = number[pos] - '0';
if (digit > '9' - '0') return false;
invalid_last_digit = (digit == 0);
pos++;
}
return !invalid_last_digit;
}
uint32_t DuplicateFinder::Hash(i::Vector<const byte> key, bool is_ascii) {
// Primitive hash function, almost identical to the one used
// for strings (except that it's seeded by the length and ASCII-ness).
int length = key.length();
uint32_t hash = (length << 1) | (is_ascii ? 1 : 0) ;
for (int i = 0; i < length; i++) {
uint32_t c = key[i];
hash = (hash + c) * 1025;
hash ^= (hash >> 6);
}
return hash;
}
bool DuplicateFinder::Match(void* first, void* second) {
// Decode lengths.
// Length + ASCII-bit is encoded as base 128, most significant heptet first,
// with a 8th bit being non-zero while there are more heptets.
// The value encodes the number of bytes following, and whether the original
// was ASCII.
byte* s1 = reinterpret_cast<byte*>(first);
byte* s2 = reinterpret_cast<byte*>(second);
uint32_t length_ascii_field = 0;
byte c1;
do {
c1 = *s1;
if (c1 != *s2) return false;
length_ascii_field = (length_ascii_field << 7) | (c1 & 0x7f);
s1++;
s2++;
} while ((c1 & 0x80) != 0);
int length = static_cast<int>(length_ascii_field >> 1);
return memcmp(s1, s2, length) == 0;
}
byte* DuplicateFinder::BackupKey(i::Vector<const byte> bytes,
bool is_ascii) {
uint32_t ascii_length = (bytes.length() << 1) | (is_ascii ? 1 : 0);
backing_store_.StartSequence();
// Emit ascii_length as base-128 encoded number, with the 7th bit set
// on the byte of every heptet except the last, least significant, one.
if (ascii_length >= (1 << 7)) {
if (ascii_length >= (1 << 14)) {
if (ascii_length >= (1 << 21)) {
if (ascii_length >= (1 << 28)) {
backing_store_.Add(static_cast<byte>((ascii_length >> 28) | 0x80));
}
backing_store_.Add(static_cast<byte>((ascii_length >> 21) | 0x80u));
}
backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
}
backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
}
backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
backing_store_.AddBlock(bytes);
return backing_store_.EndSequence().start();
}
} } // v8::preparser } } // v8::preparser
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
namespace v8 { namespace v8 {
namespace preparser { namespace preparser {
typedef uint8_t byte;
// Preparsing checks a JavaScript program and emits preparse-data that helps // Preparsing checks a JavaScript program and emits preparse-data that helps
// a later parsing to be faster. // a later parsing to be faster.
// See preparse-data-format.h for the data format. // See preparse-data-format.h for the data format.
...@@ -46,6 +48,57 @@ namespace preparser { ...@@ -46,6 +48,57 @@ namespace preparser {
namespace i = v8::internal; namespace i = v8::internal;
class DuplicateFinder {
public:
explicit DuplicateFinder(i::UnicodeCache* constants)
: unicode_constants_(constants),
backing_store_(16),
map_(new i::HashMap(&Match)) { }
~DuplicateFinder() {
delete map_;
}
int AddAsciiSymbol(i::Vector<const char> key, int value);
int AddUC16Symbol(i::Vector<const uint16_t> key, int value);
// Add a a number literal by converting it (if necessary)
// to the string that ToString(ToNumber(literal)) would generate.
// and then adding that string with AddAsciiSymbol.
// This string is the actual value used as key in an object literal,
// and the one that must be different from the other keys.
int AddNumber(i::Vector<const char> key, int value);
private:
int AddSymbol(i::Vector<const byte> key, bool is_ascii, int value);
// Backs up the key and its length in the backing store.
// The backup is stored with a base 127 encoding of the
// length (plus a bit saying whether the string is ASCII),
// followed by the bytes of the key.
byte* BackupKey(i::Vector<const byte> key, bool is_ascii);
// Compare two encoded keys (both pointing into the backing store)
// for having the same base-127 encoded lengths and ASCII-ness,
// and then having the same 'length' bytes following.
static bool Match(void* first, void* second);
// Creates a hash from a sequence of bytes.
static uint32_t Hash(i::Vector<const byte> key, bool is_ascii);
// Checks whether a string containing a JS number is its canonical
// form.
static bool IsNumberCanonical(i::Vector<const char> key);
// Size of buffer. Sufficient for using it to call DoubleToCString in
// from conversions.h.
static const int kBufferSize = 100;
i::UnicodeCache* unicode_constants_;
// Backing store used to store strings used as hashmap keys.
i::SequenceCollector<unsigned char> backing_store_;
i::HashMap* map_;
// Buffer used for string->number->canonical string conversions.
char number_buffer_[kBufferSize];
};
class PreParser { class PreParser {
public: public:
enum PreParseResult { enum PreParseResult {
...@@ -67,6 +120,45 @@ class PreParser { ...@@ -67,6 +120,45 @@ class PreParser {
} }
private: private:
// Used to detect duplicates in object literals. Each of the values
// kGetterProperty, kSetterProperty and kValueProperty represents
// a type of object literal property. When parsing a property, its
// type value is stored in the DuplicateFinder for the property name.
// Values are chosen so that having intersection bits means the there is
// an incompatibility.
// I.e., you can add a getter to a property that already has a setter, since
// kGetterProperty and kSetterProperty doesn't intersect, but not if it
// already has a getter or a value. Adding the getter to an existing
// setter will store the value (kGetterProperty | kSetterProperty), which
// is incompatible with adding any further properties.
enum PropertyType {
kNone = 0,
// Bit patterns representing different object literal property types.
kGetterProperty = 1,
kSetterProperty = 2,
kValueProperty = 7,
// Helper constants.
kValueFlag = 4
};
// Checks the type of conflict based on values coming from PropertyType.
bool HasConflict(int type1, int type2) { return (type1 & type2) != 0; }
bool IsDataDataConflict(int type1, int type2) {
return ((type1 & type2) & kValueFlag) != 0;
}
bool IsDataAccessorConflict(int type1, int type2) {
return ((type1 ^ type2) & kValueFlag) != 0;
}
bool IsAccessorAccessorConflict(int type1, int type2) {
return ((type1 | type2) & kValueFlag) == 0;
}
void CheckDuplicate(DuplicateFinder* finder,
i::Token::Value property,
int type,
bool* ok);
// These types form an algebra over syntactic categories that is just // These types form an algebra over syntactic categories that is just
// rich enough to let us recognize and propagate the constructs that // rich enough to let us recognize and propagate the constructs that
// are either being counted in the preparser data, or is important // are either being counted in the preparser data, or is important
...@@ -364,6 +456,11 @@ class PreParser { ...@@ -364,6 +456,11 @@ class PreParser {
// Report syntax error // Report syntax error
void ReportUnexpectedToken(i::Token::Value token); void ReportUnexpectedToken(i::Token::Value token);
void ReportMessageAt(i::Scanner::Location location,
const char* type,
const char* name_opt) {
log_->LogMessage(location.beg_pos, location.end_pos, type, name_opt);
}
void ReportMessageAt(int start_pos, void ReportMessageAt(int start_pos,
int end_pos, int end_pos,
const char* type, const char* type,
......
...@@ -349,6 +349,8 @@ class Scanner { ...@@ -349,6 +349,8 @@ class Scanner {
return next_.literal_chars->length(); return next_.literal_chars->length();
} }
UnicodeCache* unicode_cache() { return unicode_cache_; }
static const int kCharacterLookaheadBufferSize = 1; static const int kCharacterLookaheadBufferSize = 1;
protected: protected:
......
...@@ -496,9 +496,6 @@ class Collector { ...@@ -496,9 +496,6 @@ class Collector {
public: public:
explicit Collector(int initial_capacity = kMinCapacity) explicit Collector(int initial_capacity = kMinCapacity)
: index_(0), size_(0) { : index_(0), size_(0) {
if (initial_capacity < kMinCapacity) {
initial_capacity = kMinCapacity;
}
current_chunk_ = Vector<T>::New(initial_capacity); current_chunk_ = Vector<T>::New(initial_capacity);
} }
...@@ -600,13 +597,21 @@ class Collector { ...@@ -600,13 +597,21 @@ class Collector {
// Creates a new current chunk, and stores the old chunk in the chunks_ list. // Creates a new current chunk, and stores the old chunk in the chunks_ list.
void Grow(int min_capacity) { void Grow(int min_capacity) {
ASSERT(growth_factor > 1); ASSERT(growth_factor > 1);
int growth = current_chunk_.length() * (growth_factor - 1); int new_capacity;
if (growth > max_growth) { int current_length = current_chunk_.length();
growth = max_growth; if (current_length < kMinCapacity) {
} // The collector started out as empty.
int new_capacity = current_chunk_.length() + growth; new_capacity = min_capacity * growth_factor;
if (new_capacity < min_capacity) { if (new_capacity < kMinCapacity) new_capacity = kMinCapacity;
new_capacity = min_capacity + growth; } else {
int growth = current_length * (growth_factor - 1);
if (growth > max_growth) {
growth = max_growth;
}
new_capacity = current_length + growth;
if (new_capacity < min_capacity) {
new_capacity = min_capacity + growth;
}
} }
Vector<T> new_chunk = Vector<T>::New(new_capacity); Vector<T> new_chunk = Vector<T>::New(new_capacity);
int new_index = PrepareGrow(new_chunk); int new_index = PrepareGrow(new_chunk);
......
# Copyright 2011 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Templatated tests with duplicate parameter names.
# ----------------------------------------------------------------------
# Constants and utility functions
# A template that performs the same strict-mode test in different
# scopes (global scope, function scope, and nested function scope),
# and in non-strict mode too.
def DuplicateParameterTest(name, source):
expectation = "strict_param_dupe"
non_selfstrict = {"selfstrict":"", "id":"selfnormal"}
Template(name, '"use strict";\n' + source)(non_selfstrict, expectation)
Template(name + '-infunc',
'function foo() {\n "use strict";\n' + source +'\n}\n')(
non_selfstrict, expectation)
Template(name + '-infunc2',
'function foo() {\n "use strict";\n function bar() {\n' +
source +'\n }\n}\n')(non_selfstrict, expectation)
selfstrict = {"selfstrict": "\"use strict\";", "id": "selfstrict"}
nestedstrict = {"selfstrict": "function bar(){\"use strict\";}",
"id": "nestedstrict"}
selfstrictnestedclean = {"selfstrict": """
"use strict";
function bar(){}
""", "id": "selfstrictnestedclean"}
selftest = Template(name + '-$id', source)
selftest(selfstrict, expectation)
selftest(selfstrictnestedclean, expectation)
selftest(nestedstrict, None)
selftest(non_selfstrict, None)
# ----------------------------------------------------------------------
# Test templates
DuplicateParameterTest("dups", """
function foo(a, a) { $selfstrict }
""");
DuplicateParameterTest("dups-apart", """
function foo(a, b, c, d, e, f, g, h, i, j, k, l, m, n, a) { $selfstrict }
""");
DuplicateParameterTest("dups-escaped", """
function foo(\u0061, b, c, d, e, f, g, h, i, j, k, l, m, n, a) { $selfstrict }
""");
DuplicateParameterTest("triples", """
function foo(a, b, c, d, e, f, g, h, a, i, j, k, l, m, n, a) { $selfstrict }
""");
DuplicateParameterTest("escapes", """
function foo(a, \u0061) { $selfstrict }
""");
DuplicateParameterTest("long-names", """
function foo(arglebargleglopglyfarglebargleglopglyfarglebargleglopglyfa,
arglebargleglopglyfarglebargleglopglyfarglebargleglopglyfa) {
$selfstrict
}
""");
# Copyright 2011 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Tests of duplicate properties in object literals.
# ----------------------------------------------------------------------
# Utility functions to generate a number of tests for each property
# name pair.
def PropertyTest(name, propa, propb, allow_strict = True):
replacement = {"id1": propa, "id2": propb, "name": name}
# Tests same test in both strict and non-strict context.
def StrictTest(name, source, replacement, expectation):
if (allow_strict):
Template("strict-" + name,
"\"use strict\";\n" + source)(replacement, expectation)
Template(name, source)(replacement, expectation)
# This one only fails in non-strict context.
if (allow_strict):
Template("strict-$name-data-data", """
"use strict";
var o = {$id1: 42, $id2: 42};
""")(replacement, "strict_duplicate_property")
Template("$name-data-data", """
var o = {$id1: 42, $id2: 42};
""")(replacement, None)
StrictTest("$name-data-get", """
var o = {$id1: 42, get $id2(){}};
""", replacement, "accessor_data_property")
StrictTest("$name-data-set", """
var o = {$id1: 42, set $id2(v){}};
""", replacement, "accessor_data_property")
StrictTest("$name-get-data", """
var o = {get $id1(){}, $id2: 42};
""", replacement, "accessor_data_property")
StrictTest("$name-set-data", """
var o = {set $id1(v){}, $id2: 42};
""", replacement, "accessor_data_property")
StrictTest("$name-get-get", """
var o = {get $id1(){}, get $id2(){}};
""", replacement, "accessor_get_set")
StrictTest("$name-set-set", """
var o = {set $id1(v){}, set $id2(v){}};
""", replacement, "accessor_get_set")
StrictTest("$name-nested-get", """
var o = {get $id1(){}, o: {get $id2(){} } };
""", replacement, None)
StrictTest("$name-nested-set", """
var o = {set $id1(){}, o: {set $id2(){} } };
""", replacement, None)
def TestBothWays(name, propa, propb, allow_strict = True):
PropertyTest(name + "-1", propa, propb, allow_strict)
PropertyTest(name + "-2", propb, propa, allow_strict)
def TestSame(name, prop, allow_strict = True):
PropertyTest(name, prop, prop, allow_strict)
#-----------------------------------------------------------------------
# Simple identifier property
TestSame("a", "a")
# Get/set identifiers
TestSame("get-id", "get")
TestSame("set-id", "set")
# Number properties
TestSame("0", "0")
TestSame("0.1", "0.1")
TestSame("1.0", "1.0")
TestSame("42.33", "42.33")
TestSame("2^32-2", "4294967294")
TestSame("2^32", "4294967296")
TestSame("2^53", "9007199254740992")
TestSame("Hex20", "0x20")
TestSame("exp10", "1e10")
TestSame("exp20", "1e20")
TestSame("Oct40", "040", False);
# String properties
TestSame("str-a", '"a"')
TestSame("str-0", '"0"')
TestSame("str-42", '"42"')
TestSame("str-empty", '""')
# Keywords
TestSame("if", "if")
TestSame("case", "case")
# Future reserved keywords
TestSame("public", "public")
TestSame("class", "class")
# Test that numbers are converted to string correctly.
TestBothWays("hex-int", "0x20", "32")
TestBothWays("oct-int", "040", "32", False) # Octals disallowed in strict mode.
TestBothWays("dec-int", "32.00", "32")
TestBothWays("dec-underflow-int",
"32.00000000000000000000000000000000000000001", "32")
TestBothWays("exp-int", "3.2e1", "32")
TestBothWays("exp-int", "3200e-2", "32")
TestBothWays("overflow-inf", "1e2000", "Infinity")
TestBothWays("overflow-inf-exact", "1.797693134862315808e+308", "Infinity")
TestBothWays("non-overflow-inf-exact", "1.797693134862315807e+308",
"1.7976931348623157e+308")
TestBothWays("underflow-0", "1e-2000", "0")
TestBothWays("underflow-0-exact", "2.4703282292062E-324", "0")
TestBothWays("non-underflow-0-exact", "2.4703282292063E-324", "5e-324")
TestBothWays("precission-loss-high", "9007199254740992", "9007199254740993")
TestBothWays("precission-loss-low", "1.9999999999999998", "1.9999999999999997")
TestBothWays("non-canonical-literal-int", "1.0", "1")
TestBothWays("non-canonical-literal-frac", "1.50", "1.5")
TestBothWays("rounding-down", "1.12512512512512452", "1.1251251251251244")
TestBothWays("rounding-up", "1.12512512512512453", "1.1251251251251246")
TestBothWays("hex-int-str", "0x20", '"32"')
TestBothWays("dec-int-str", "32.00", '"32"')
TestBothWays("exp-int-str", "3.2e1", '"32"')
TestBothWays("overflow-inf-str", "1e2000", '"Infinity"')
TestBothWays("underflow-0-str", "1e-2000", '"0"')
TestBothWays("non-canonical-literal-int-str", "1.0", '"1"')
TestBothWays("non-canonical-literal-frac-str", "1.50", '"1.5"')
...@@ -98,7 +98,6 @@ class PreparserTestConfiguration(test.TestConfiguration): ...@@ -98,7 +98,6 @@ class PreparserTestConfiguration(test.TestConfiguration):
def ParsePythonTestTemplates(self, result, filename, def ParsePythonTestTemplates(self, result, filename,
executable, current_path, mode): executable, current_path, mode):
pathname = join(self.root, filename + ".pyt") pathname = join(self.root, filename + ".pyt")
source = open(pathname).read();
def Test(name, source, expectation): def Test(name, source, expectation):
throws = None throws = None
if (expectation is not None): if (expectation is not None):
...@@ -118,8 +117,7 @@ class PreparserTestConfiguration(test.TestConfiguration): ...@@ -118,8 +117,7 @@ class PreparserTestConfiguration(test.TestConfiguration):
testsource = testsource.replace("$"+key, replacement[key]); testsource = testsource.replace("$"+key, replacement[key]);
Test(testname, testsource, expectation) Test(testname, testsource, expectation)
return MkTest return MkTest
eval(compile(source, pathname, "exec"), execfile(pathname, {"Test": Test, "Template": Template})
{"Test": Test, "Template": Template}, {})
def ListTests(self, current_path, path, mode, variant_flags): def ListTests(self, current_path, path, mode, variant_flags):
executable = join('obj', 'preparser', mode, 'preparser') executable = join('obj', 'preparser', mode, 'preparser')
...@@ -143,7 +141,7 @@ class PreparserTestConfiguration(test.TestConfiguration): ...@@ -143,7 +141,7 @@ class PreparserTestConfiguration(test.TestConfiguration):
filenames.sort() filenames.sort()
for file in filenames: for file in filenames:
# Each file as a python source file to be executed in a specially # Each file as a python source file to be executed in a specially
# perparsed environment (defining the Template and Test functions) # created environment (defining the Template and Test functions)
self.ParsePythonTestTemplates(result, file, self.ParsePythonTestTemplates(result, file,
executable, current_path, mode) executable, current_path, mode)
return result return result
......
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