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

Side by Side Diff: runtime/vm/class_finalizer.cc

Issue 10928160: Limit the maximum number of formal parameters (32K fixed and 32K optional) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/class_finalizer.h" 5 #include "vm/class_finalizer.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/heap.h" 8 #include "vm/heap.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 // It is not a compile time error if this name does not resolve to a class or 775 // It is not a compile time error if this name does not resolve to a class or
776 // interface. 776 // interface.
777 ResolveType(cls, type, kCanonicalize); 777 ResolveType(cls, type, kCanonicalize);
778 type = FinalizeType(cls, type, kCanonicalize); 778 type = FinalizeType(cls, type, kCanonicalize);
779 // In production mode, a malformed result type is mapped to Dynamic. 779 // In production mode, a malformed result type is mapped to Dynamic.
780 if (!FLAG_enable_type_checks && type.IsMalformed()) { 780 if (!FLAG_enable_type_checks && type.IsMalformed()) {
781 type = Type::DynamicType(); 781 type = Type::DynamicType();
782 } 782 }
783 function.set_result_type(type); 783 function.set_result_type(type);
784 // Resolve formal parameter types. 784 // Resolve formal parameter types.
785 const intptr_t num_parameters = function.NumberOfParameters(); 785 const intptr_t num_parameters = function.NumParameters();
786 for (intptr_t i = 0; i < num_parameters; i++) { 786 for (intptr_t i = 0; i < num_parameters; i++) {
787 type = function.ParameterTypeAt(i); 787 type = function.ParameterTypeAt(i);
788 ResolveType(cls, type, kCanonicalize); 788 ResolveType(cls, type, kCanonicalize);
789 type = FinalizeType(cls, type, kCanonicalize); 789 type = FinalizeType(cls, type, kCanonicalize);
790 // In production mode, a malformed parameter type is mapped to Dynamic. 790 // In production mode, a malformed parameter type is mapped to Dynamic.
791 if (!FLAG_enable_type_checks && type.IsMalformed()) { 791 if (!FLAG_enable_type_checks && type.IsMalformed()) {
792 type = Type::DynamicType(); 792 type = Type::DynamicType();
793 } 793 }
794 function.SetParameterTypeAt(i, type); 794 function.SetParameterTypeAt(i, type);
795 } 795 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 const Class& type_class = Class::Handle(type.type_class()); 1150 const Class& type_class = Class::Handle(type.type_class());
1151 if (!type_class.is_finalized() && 1151 if (!type_class.is_finalized() &&
1152 type_class.IsSignatureClass() && 1152 type_class.IsSignatureClass() &&
1153 !type_class.IsCanonicalSignatureClass()) { 1153 !type_class.IsCanonicalSignatureClass()) {
1154 if (!IsAliasCycleFree(type_class, visited)) { 1154 if (!IsAliasCycleFree(type_class, visited)) {
1155 return false; 1155 return false;
1156 } 1156 }
1157 } 1157 }
1158 } 1158 }
1159 // Check classes of formal parameter types. 1159 // Check classes of formal parameter types.
1160 const intptr_t num_parameters = function.NumberOfParameters(); 1160 const intptr_t num_parameters = function.NumParameters();
1161 for (intptr_t i = 0; i < num_parameters; i++) { 1161 for (intptr_t i = 0; i < num_parameters; i++) {
1162 type = function.ParameterTypeAt(i); 1162 type = function.ParameterTypeAt(i);
1163 ResolveType(cls, type, kCanonicalize); 1163 ResolveType(cls, type, kCanonicalize);
1164 if (type.IsType() && !type.IsMalformed()) { 1164 if (type.IsType() && !type.IsMalformed()) {
1165 const Class& type_class = Class::Handle(type.type_class()); 1165 const Class& type_class = Class::Handle(type.type_class());
1166 if (!type_class.is_finalized() && 1166 if (!type_class.is_finalized() &&
1167 type_class.IsSignatureClass() && 1167 type_class.IsSignatureClass() &&
1168 !type_class.IsCanonicalSignatureClass()) { 1168 !type_class.IsCanonicalSignatureClass()) {
1169 if (!IsAliasCycleFree(type_class, visited)) { 1169 if (!IsAliasCycleFree(type_class, visited)) {
1170 return false; 1170 return false;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 void ClassFinalizer::ReportError(const char* format, ...) { 1404 void ClassFinalizer::ReportError(const char* format, ...) {
1405 va_list args; 1405 va_list args;
1406 va_start(args, format); 1406 va_start(args, format);
1407 const Error& error = Error::Handle( 1407 const Error& error = Error::Handle(
1408 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); 1408 Parser::FormatError(Script::Handle(), -1, "Error", format, args));
1409 va_end(args); 1409 va_end(args);
1410 ReportError(error); 1410 ReportError(error);
1411 } 1411 }
1412 1412
1413 } // namespace dart 1413 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698