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

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

Issue 99373002: Mark native functions when they are created. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/code_descriptors_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 // Therefore, we undo the optimization performed by the parser, i.e. 1181 // Therefore, we undo the optimization performed by the parser, i.e.
1182 // we create an implicit static final getter and reset the field value 1182 // we create an implicit static final getter and reset the field value
1183 // to the sentinel value. 1183 // to the sentinel value.
1184 const Function& getter = Function::Handle( 1184 const Function& getter = Function::Handle(
1185 Function::New(getter_name, 1185 Function::New(getter_name,
1186 RawFunction::kImplicitStaticFinalGetter, 1186 RawFunction::kImplicitStaticFinalGetter,
1187 /* is_static = */ true, 1187 /* is_static = */ true,
1188 /* is_const = */ field.is_const(), 1188 /* is_const = */ field.is_const(),
1189 /* is_abstract = */ false, 1189 /* is_abstract = */ false,
1190 /* is_external = */ false, 1190 /* is_external = */ false,
1191 /* is_native = */ false,
1191 cls, 1192 cls,
1192 field.token_pos())); 1193 field.token_pos()));
1193 getter.set_result_type(type); 1194 getter.set_result_type(type);
1194 cls.AddFunction(getter); 1195 cls.AddFunction(getter);
1195 field.set_value(Instance::Handle(Object::sentinel().raw())); 1196 field.set_value(Instance::Handle(Object::sentinel().raw()));
1196 1197
1197 // Create initializer function. 1198 // Create initializer function.
1198 if (!field.is_const()) { 1199 if (!field.is_const()) {
1199 const Function& init_function = Function::ZoneHandle( 1200 const Function& init_function = Function::ZoneHandle(
1200 Function::NewStaticInitializer(field)); 1201 Function::NewStaticInitializer(field));
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 ctor_name.ToCString(), 1792 ctor_name.ToCString(),
1792 clone_name.ToCString()); 1793 clone_name.ToCString());
1793 } 1794 }
1794 const Function& clone = Function::Handle( 1795 const Function& clone = Function::Handle(
1795 Function::New(clone_name, 1796 Function::New(clone_name,
1796 func.kind(), 1797 func.kind(),
1797 func.is_static(), 1798 func.is_static(),
1798 false, // Not const. 1799 false, // Not const.
1799 false, // Not abstract. 1800 false, // Not abstract.
1800 false, // Not external. 1801 false, // Not external.
1802 false, // Not native.
1801 mixin_app, 1803 mixin_app,
1802 mixin_app.token_pos())); 1804 mixin_app.token_pos()));
1803 1805
1804 clone.set_num_fixed_parameters(func.num_fixed_parameters()); 1806 clone.set_num_fixed_parameters(func.num_fixed_parameters());
1805 clone.SetNumOptionalParameters(func.NumOptionalParameters(), 1807 clone.SetNumOptionalParameters(func.NumOptionalParameters(),
1806 func.HasOptionalPositionalParameters()); 1808 func.HasOptionalPositionalParameters());
1807 clone.set_result_type(dynamic_type); 1809 clone.set_result_type(dynamic_type);
1808 1810
1809 const intptr_t num_parameters = func.NumParameters(); 1811 const intptr_t num_parameters = func.NumParameters();
1810 // The cloned ctor shares the parameter names array with the 1812 // The cloned ctor shares the parameter names array with the
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 expected_name ^= String::New("_offset"); 2758 expected_name ^= String::New("_offset");
2757 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 2759 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
2758 field ^= fields_array.At(2); 2760 field ^= fields_array.At(2);
2759 ASSERT(field.Offset() == TypedDataView::length_offset()); 2761 ASSERT(field.Offset() == TypedDataView::length_offset());
2760 name ^= field.name(); 2762 name ^= field.name();
2761 ASSERT(name.Equals("length")); 2763 ASSERT(name.Equals("length"));
2762 #endif 2764 #endif
2763 } 2765 }
2764 2766
2765 } // namespace dart 2767 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_descriptors_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698