Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: runtime/vm/parser.cc

Issue 1900863002: Reapply "- Use a hash table to canonicalize instances/arrays to avoid having to iterate over a line… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index a1c0b546b7869d1c832a0826811083829f379e6c..0429867b414b84edbf16294fbda064e98ff1f3e7 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -12064,7 +12064,7 @@ RawInstance* Parser::TryCanonicalize(const Instance& instance,
}
const char* error_str = NULL;
Instance& result =
- Instance::Handle(Z, instance.CheckAndCanonicalize(&error_str));
+ Instance::Handle(Z, instance.CheckAndCanonicalize(thread(), &error_str));
if (result.IsNull()) {
ReportError(token_pos, "Invalid const object %s", error_str);
}
@@ -12749,6 +12749,9 @@ AstNode* Parser::ParseListLiteral(TokenPosition type_pos,
if (is_const) {
// Allocate and initialize the const list at compile time.
+ if ((element_list.length() == 0) && list_type_arguments.IsNull()) {
+ return new(Z) LiteralNode(literal_pos, Object::empty_array());
+ }
Array& const_list = Array::ZoneHandle(Z,
Array::New(element_list.length(), Heap::kOld));
const_list.SetTypeArguments(
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698