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

Unified Diff: runtime/vm/parser.cc

Issue 10696155: Allocate types in proper heap space. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 9528)
+++ runtime/vm/parser.cc (working copy)
@@ -1053,7 +1053,7 @@
// functions appearing in type tests with typedefs.
parameter.type = &AbstractType::ZoneHandle(
ParseType(is_top_level_ ? ClassFinalizer::kTryResolve :
- ClassFinalizer::kFinalize));
+ ClassFinalizer::kCanonicalize));
} else {
parameter.type = &Type::ZoneHandle(Type::DynamicType());
}
@@ -1126,7 +1126,7 @@
Type& signature_type = Type::ZoneHandle(signature_class.SignatureType());
if (!is_top_level_ && !signature_type.IsFinalized()) {
signature_type ^= ClassFinalizer::FinalizeType(
- signature_class, signature_type, ClassFinalizer::kFinalize);
+ signature_class, signature_type, ClassFinalizer::kCanonicalize);
}
// The type of the parameter is now the signature type.
parameter.type = &signature_type;
@@ -4165,7 +4165,7 @@
TRACE_PARSER("ParseVariableDeclarationList");
bool is_final = (CurrentToken() == Token::kFINAL);
const AbstractType& type = AbstractType::ZoneHandle(ParseFinalVarOrType(
- FLAG_enable_type_checks ? ClassFinalizer::kFinalize :
+ FLAG_enable_type_checks ? ClassFinalizer::kCanonicalize :
ClassFinalizer::kIgnore));
if (!IsIdentifier()) {
ErrorMsg("identifier expected");
@@ -4202,7 +4202,7 @@
result_type = Type::VoidType();
} else if ((CurrentToken() == Token::kIDENT) &&
(LookaheadToken(1) != Token::kLPAREN)) {
- result_type = ParseType(ClassFinalizer::kFinalize);
+ result_type = ParseType(ClassFinalizer::kCanonicalize);
}
const intptr_t ident_pos = TokenPos();
if (IsIdentifier()) {
@@ -4329,7 +4329,7 @@
// been finalized already.
if (!signature_type.IsFinalized()) {
signature_type ^= ClassFinalizer::FinalizeType(
- signature_class, signature_type, ClassFinalizer::kFinalize);
+ signature_class, signature_type, ClassFinalizer::kCanonicalize);
// The call to ClassFinalizer::FinalizeType may have
// extended the vector of type arguments.
ASSERT(signature_type_arguments.IsNull() ||
@@ -4896,7 +4896,7 @@
} else {
// The case without a type is handled above, so require a type here.
const AbstractType& type = AbstractType::ZoneHandle(ParseFinalVarOrType(
- FLAG_enable_type_checks ? ClassFinalizer::kFinalize :
+ FLAG_enable_type_checks ? ClassFinalizer::kCanonicalize :
ClassFinalizer::kIgnore));
loop_var_pos = TokenPos();
loop_var_name = ExpectIdentifier("variable name expected");
@@ -5152,7 +5152,7 @@
// The type of the catch parameter must always be resolved, even in unchecked
// mode.
catch_param->type = &AbstractType::ZoneHandle(
- ParseFinalVarOrType(ClassFinalizer::kFinalizeWellFormed));
+ ParseFinalVarOrType(ClassFinalizer::kCanonicalizeWellFormed));
catch_param->token_pos = TokenPos();
catch_param->var = ExpectIdentifier("identifier expected");
}
@@ -5987,7 +5987,7 @@
}
const intptr_t type_pos = TokenPos();
const AbstractType& type =
- AbstractType::ZoneHandle(ParseType(ClassFinalizer::kFinalize));
+ AbstractType::ZoneHandle(ParseType(ClassFinalizer::kCanonicalize));
if (!type.IsInstantiated() &&
(current_block_->scope->function_level() > 0)) {
// Make sure that the instantiator is captured.
@@ -6887,7 +6887,7 @@
if (!resolved_type_class.IsNull()) {
// Replace unresolved class with resolved type class.
parameterized_type.set_type_class(resolved_type_class);
- } else if (finalization >= ClassFinalizer::kFinalize) {
+ } else if (finalization >= ClassFinalizer::kCanonicalize) {
// The type is malformed.
ClassFinalizer::FinalizeMalformedType(
Error::Handle(), // No previous error.
@@ -7450,7 +7450,7 @@
if (finalization >= ClassFinalizer::kTryResolve) {
const Class& scope_class = Class::Handle(TypeParametersScopeClass());
ResolveTypeFromClass(scope_class, finalization, &type);
- if (finalization >= ClassFinalizer::kFinalize) {
+ if (finalization >= ClassFinalizer::kCanonicalize) {
type ^= ClassFinalizer::FinalizeType(current_class(), type, finalization);
}
}
@@ -7832,11 +7832,11 @@
Error& malformed_error = Error::Handle();
AbstractTypeArguments& type_arguments = AbstractTypeArguments::ZoneHandle(
ParseTypeArguments(&malformed_error,
- ClassFinalizer::kFinalizeWellFormed));
+ ClassFinalizer::kCanonicalizeWellFormed));
// Map and List interfaces do not declare bounds on their type parameters, so
// we should never see a malformed type error here.
// Note that a bound error is the only possible malformed type error returned
- // when requesting kFinalizeWellFormed type finalization.
+ // when requesting kCanonicalizeWellFormed type finalization.
ASSERT(malformed_error.IsNull());
AstNode* primary = NULL;
if ((CurrentToken() == Token::kLBRACK) ||
@@ -7878,9 +7878,9 @@
}
intptr_t type_pos = TokenPos();
const AbstractType& type = AbstractType::Handle(
- ParseType(ClassFinalizer::kFinalizeWellFormed));
+ ParseType(ClassFinalizer::kCanonicalizeWellFormed));
// Malformed bounds never result in a compile time error, therefore, the
- // parsed type may be malformed although we requested kFinalizeWellFormed.
+ // parsed type may be malformed although we requested kCanonicalizeWellFormed.
// In that case, we throw a dynamic type error instead of calling the
// constructor.
if (type.IsTypeParameter()) {
@@ -8012,14 +8012,13 @@
// the bounds on the factory class may be tighter than on the interface.
if (constructor_class.raw() != type_class.raw()) {
const intptr_t num_type_parameters = constructor_class.NumTypeParameters();
- // TODO(regis): Temporary type args should be allocated in new gen heap.
TypeArguments& temp_type_arguments = TypeArguments::Handle();
if (!type_arguments.IsNull()) {
// Copy the parsed type arguments starting at offset 0, because interfaces
// have no super types.
ASSERT(type_class.NumTypeArguments() == type_class.NumTypeParameters());
const intptr_t num_type_arguments = type_arguments.Length();
- temp_type_arguments = TypeArguments::New(num_type_parameters);
+ temp_type_arguments = TypeArguments::New(num_type_parameters, Heap::kNew);
AbstractType& type_argument = AbstractType::Handle();
for (intptr_t i = 0; i < num_type_parameters; i++) {
if (i < num_type_arguments) {
@@ -8030,9 +8029,9 @@
temp_type_arguments.SetTypeAt(i, type_argument);
}
}
- // TODO(regis): Temporary type should be allocated in new gen heap.
- Type& temp_type = Type::Handle(
- Type::New(constructor_class, temp_type_arguments, type.token_pos()));
+ Type& temp_type = Type::Handle(Type::New(
+ constructor_class, temp_type_arguments, type.token_pos(), Heap::kNew));
+ // No need to canonicalize temporary type.
temp_type ^= ClassFinalizer::FinalizeType(
current_class(), temp_type, ClassFinalizer::kFinalize);
// The type argument vector may have been expanded with the type arguments
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698