aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-prod (mdb) <android-build-team-robot@google.com>2021-03-04 01:10:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-03-04 01:10:15 +0000
commit7f9774719f43d4c419623018ec15beebc1735e01 (patch)
tree04c0c4755c52b849cb76d90e00947de40ab7b5a2
parente69905817314870c07682208760cc0d944e72282 (diff)
parent01d0e27cc32a54b707284857fea24c76a7473a23 (diff)
downloadv8-7f9774719f43d4c419623018ec15beebc1735e01.tar.gz
Merge "Snap for 7183507 from c5b3df7061edb4eb68c0e27c32480bf1985dbc6f to sdk-release" into sdk-releaseplatform-tools-31.0.2platform-tools-31.0.1
-rw-r--r--Android.bp47
-rw-r--r--src/messages.h2
-rw-r--r--src/parsing/parser-base.h3
-rw-r--r--src/parsing/scanner.cc9
-rw-r--r--src/parsing/scanner.h3
5 files changed, 56 insertions, 8 deletions
diff --git a/Android.bp b/Android.bp
index 9854fc07..bfab54c0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -13,6 +13,53 @@
// limitations under the License.
// Include generated Android.bp files
+package {
+ default_applicable_licenses: ["external_v8_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'filegroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+//
+// large-scale-change included anything that looked like it might be a license
+// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
+//
+// Please consider removing redundant or irrelevant files from 'license_text:'.
+// http://go/android-license-faq
+license {
+ name: "external_v8_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ "SPDX-license-identifier-BSD",
+ "SPDX-license-identifier-CC-BY",
+ "SPDX-license-identifier-CPL-1.0",
+ "SPDX-license-identifier-GPL",
+ "SPDX-license-identifier-GPL-2.0",
+ "SPDX-license-identifier-MIT",
+ "SPDX-license-identifier-PSF-2.0",
+ "legacy_unencumbered",
+ ],
+ license_text: [
+ "LICENSE",
+ "LICENSE.fdlibm",
+ "LICENSE.strongtalk",
+ "LICENSE.v8",
+ "LICENSE.valgrind",
+ "NOTICE",
+ ],
+}
+
build = [
"Android.base.bp",
"Android.platform.bp",
diff --git a/src/messages.h b/src/messages.h
index 030fc0b9..e94ce16e 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -695,7 +695,7 @@ class ErrorUtils : public AllStatic {
T(TooManyArguments, \
"Too many arguments in function call (only 65535 allowed)") \
T(TooManyParameters, \
- "Too many parameters in function definition (only 65535 allowed)") \
+ "Too many parameters in function definition (only 65534 allowed)") \
T(TooManySpreads, \
"Literal containing too many nested spreads (up to 65534 allowed)") \
T(TooManyVariables, "Too many variables declared (only 4194303 allowed)") \
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 9d13724f..60d5e11f 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -3830,7 +3830,8 @@ void ParserBase<Impl>::ParseFormalParameterList(FormalParametersT* parameters,
if (peek() != Token::RPAREN) {
while (true) {
- if (parameters->arity > Code::kMaxArguments) {
+ // Add one since we're going to be adding a parameter.
+ if (parameters->arity + 1 > Code::kMaxArguments) {
ReportMessage(MessageTemplate::kTooManyParameters);
*ok = false;
return;
diff --git a/src/parsing/scanner.cc b/src/parsing/scanner.cc
index 781832c2..38d1936f 100644
--- a/src/parsing/scanner.cc
+++ b/src/parsing/scanner.cc
@@ -68,13 +68,14 @@ Handle<String> Scanner::LiteralBuffer::Internalize(Isolate* isolate) const {
}
int Scanner::LiteralBuffer::NewCapacity(int min_capacity) {
- int capacity = Max(min_capacity, backing_store_.length());
- int new_capacity = Min(capacity * kGrowthFactory, capacity + kMaxGrowth);
- return new_capacity;
+ return min_capacity < (kMaxGrowth / (kGrowthFactor - 1))
+ ? min_capacity * kGrowthFactor
+ : min_capacity + kMaxGrowth;
}
void Scanner::LiteralBuffer::ExpandBuffer() {
- Vector<byte> new_store = Vector<byte>::New(NewCapacity(kInitialCapacity));
+ int min_capacity = Max(kInitialCapacity, backing_store_.length());
+ Vector<byte> new_store = Vector<byte>::New(NewCapacity(min_capacity));
MemCopy(new_store.start(), backing_store_.start(), position_);
backing_store_.Dispose();
backing_store_ = new_store;
diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h
index e592debd..02cd247f 100644
--- a/src/parsing/scanner.h
+++ b/src/parsing/scanner.h
@@ -482,8 +482,7 @@ class Scanner {
private:
static const int kInitialCapacity = 16;
- static const int kGrowthFactory = 4;
- static const int kMinConversionSlack = 256;
+ static const int kGrowthFactor = 4;
static const int kMaxGrowth = 1 * MB;
inline bool IsValidAscii(char code_unit) {