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

Unified Diff: runtime/vm/parser.cc

Issue 1488773004: VM: More read-only handles for constant null-objects/-instances. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « no previous file | no next file » | 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 ecdfc5874e6301287baf8e8c6ccbb7a9987aebd1..cb92c36c6dfba3e6ac3bdd1c8b6ba5dda87bd0ed 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -2528,7 +2528,7 @@ void Parser::CheckFieldsInitialized(const Class& cls) {
if (found) continue;
- field.RecordStore(Object::Handle(Z));
+ field.RecordStore(Object::null_object());
}
}
@@ -2695,12 +2695,12 @@ AstNode* Parser::CheckDuplicateFieldInit(
// List argumentNames.
// The missing implicit setter of the field has no argument names.
- nsm_args->Add(new(Z) LiteralNode(init_pos, Array::ZoneHandle(Z)));
+ nsm_args->Add(new(Z) LiteralNode(init_pos, Object::null_array()));
// List existingArgumentNames.
// There is no setter for the final field, thus there are
// no existing names.
- nsm_args->Add(new(Z) LiteralNode(init_pos, Array::ZoneHandle(Z)));
+ nsm_args->Add(new(Z) LiteralNode(init_pos, Object::null_array()));
AstNode* nsm_call =
MakeStaticCall(Symbols::NoSuchMethodError(),
@@ -7446,7 +7446,7 @@ AstNode* Parser::ParseVariableDeclaration(const AbstractType& type,
// Initialize variable with null.
variable = new(Z) LocalVariable(
assign_pos, ident, type);
- AstNode* null_expr = new(Z) LiteralNode(ident_pos, Instance::ZoneHandle(Z));
+ AstNode* null_expr = new(Z) LiteralNode(ident_pos, Object::null_instance());
initialization = new(Z) StoreLocalNode(
ident_pos, variable, null_expr);
}
@@ -10288,7 +10288,7 @@ AstNode* Parser::ThrowTypeError(intptr_t type_pos, const AbstractType& type,
arguments->Add(new(Z) LiteralNode(
type_pos, Integer::ZoneHandle(Z, Integer::New(type_pos))));
// Src value argument.
- arguments->Add(new(Z) LiteralNode(type_pos, Instance::ZoneHandle(Z)));
+ arguments->Add(new(Z) LiteralNode(type_pos, Object::null_instance()));
// Dst type name argument.
arguments->Add(new(Z) LiteralNode(type_pos, Symbols::Malformed()));
// Dst name argument.
@@ -10347,7 +10347,7 @@ AstNode* Parser::ThrowNoSuchMethodError(intptr_t call_pos,
Smi::New(InvocationMirror::EncodeType(im_call, im_type)))));
// List arguments.
if (function_arguments == NULL) {
- arguments->Add(new(Z) LiteralNode(call_pos, Array::ZoneHandle(Z)));
+ arguments->Add(new(Z) LiteralNode(call_pos, Object::null_array()));
} else {
ArrayNode* array = new(Z) ArrayNode(
call_pos,
@@ -10357,7 +10357,7 @@ AstNode* Parser::ThrowNoSuchMethodError(intptr_t call_pos,
}
// List argumentNames.
if (function_arguments == NULL) {
- arguments->Add(new(Z) LiteralNode(call_pos, Array::ZoneHandle(Z)));
+ arguments->Add(new(Z) LiteralNode(call_pos, Object::null_array()));
} else {
arguments->Add(new(Z) LiteralNode(call_pos, function_arguments->names()));
}
@@ -10560,7 +10560,7 @@ AstNode* Parser::OptimizeBinaryOpNode(intptr_t op_pos,
LocalVariable* left_temp = result->AddInitializer(lhs);
const intptr_t no_pos = Scanner::kNoSourcePos;
LiteralNode* null_operand =
- new(Z) LiteralNode(no_pos, Instance::ZoneHandle(Z));
+ new(Z) LiteralNode(no_pos, Object::null_instance());
LoadLocalNode* load_left_temp = new(Z) LoadLocalNode(no_pos, left_temp);
ComparisonNode* null_compare =
new(Z) ComparisonNode(no_pos,
@@ -12136,8 +12136,8 @@ RawObject* Parser::EvaluateConstConstructorCall(
}
const Array& args_descriptor = Array::Handle(Z,
ArgumentsDescriptor::New(num_arguments, arguments->names()));
- Object& result = Object::Handle(Z);
- result = DartEntry::InvokeFunction(constructor, arg_values, args_descriptor);
+ const Object& result = Object::Handle(Z,
+ DartEntry::InvokeFunction(constructor, arg_values, args_descriptor));
if (result.IsError()) {
// An exception may not occur in every parse attempt, i.e., the
// generated AST is not deterministic. Therefore mark the function as
@@ -13874,7 +13874,7 @@ AstNode* Parser::ParsePrimary() {
primary = new(Z) LiteralNode(TokenPos(), Bool::False());
ConsumeToken();
} else if (token == Token::kNULL) {
- primary = new(Z) LiteralNode(TokenPos(), Instance::ZoneHandle(Z));
+ primary = new(Z) LiteralNode(TokenPos(), Object::null_instance());
ConsumeToken();
} else if (token == Token::kLPAREN) {
ConsumeToken();
@@ -13883,7 +13883,7 @@ AstNode* Parser::ParsePrimary() {
SetAllowFunctionLiterals(saved_mode);
ExpectToken(Token::kRPAREN);
} else if (token == Token::kDOUBLE) {
- Double& double_value = Double::ZoneHandle(Z, CurrentDoubleLiteral());
+ const Double& double_value = Double::ZoneHandle(Z, CurrentDoubleLiteral());
if (double_value.IsNull()) {
ReportError("invalid double literal");
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698