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

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

Issue 14820028: Delay Class parsing until the class is actually used. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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) 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after
3044 return target; 3044 return target;
3045 } 3045 }
3046 3046
3047 const GrowableObjectArray& names = 3047 const GrowableObjectArray& names =
3048 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); 3048 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New());
3049 Function& func = Function::Handle(); 3049 Function& func = Function::Handle();
3050 String& name = String::Handle(); 3050 String& name = String::Handle();
3051 3051
3052 if (obj.IsClass()) { 3052 if (obj.IsClass()) {
3053 const Class& cls = Class::Cast(obj); 3053 const Class& cls = Class::Cast(obj);
3054 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate));
3055 if (!error.IsNull()) {
3056 return Api::NewHandle(isolate, error.raw());
3057 }
3054 const Array& func_array = Array::Handle(cls.functions()); 3058 const Array& func_array = Array::Handle(cls.functions());
3055 3059
3056 // Some special types like 'dynamic' have a null functions list. 3060 // Some special types like 'dynamic' have a null functions list.
3057 if (!func_array.IsNull()) { 3061 if (!func_array.IsNull()) {
3058 for (intptr_t i = 0; i < func_array.Length(); ++i) { 3062 for (intptr_t i = 0; i < func_array.Length(); ++i) {
3059 func ^= func_array.At(i); 3063 func ^= func_array.At(i);
3060 3064
3061 // Skip implicit getters and setters. 3065 // Skip implicit getters and setters.
3062 if (func.kind() == RawFunction::kImplicitGetter || 3066 if (func.kind() == RawFunction::kImplicitGetter ||
3063 func.kind() == RawFunction::kImplicitSetter || 3067 func.kind() == RawFunction::kImplicitSetter ||
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 return target; 3388 return target;
3385 } 3389 }
3386 3390
3387 const GrowableObjectArray& names = 3391 const GrowableObjectArray& names =
3388 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); 3392 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New());
3389 Field& field = Field::Handle(isolate); 3393 Field& field = Field::Handle(isolate);
3390 String& name = String::Handle(isolate); 3394 String& name = String::Handle(isolate);
3391 3395
3392 if (obj.IsClass()) { 3396 if (obj.IsClass()) {
3393 const Class& cls = Class::Cast(obj); 3397 const Class& cls = Class::Cast(obj);
3398 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate));
3399 if (!error.IsNull()) {
3400 return Api::NewHandle(isolate, error.raw());
3401 }
3394 const Array& field_array = Array::Handle(cls.fields()); 3402 const Array& field_array = Array::Handle(cls.fields());
3395 3403
3396 // Some special types like 'dynamic' have a null fields list. 3404 // Some special types like 'dynamic' have a null fields list.
3397 // 3405 //
3398 // TODO(turnidge): Fix 'dynamic' so that it does not have a null 3406 // TODO(turnidge): Fix 'dynamic' so that it does not have a null
3399 // fields list. This will have to wait until the empty array is 3407 // fields list. This will have to wait until the empty array is
3400 // allocated in the vm isolate. 3408 // allocated in the vm isolate.
3401 if (!field_array.IsNull()) { 3409 if (!field_array.IsNull()) {
3402 for (intptr_t i = 0; i < field_array.Length(); ++i) { 3410 for (intptr_t i = 0; i < field_array.Length(); ++i) {
3403 field ^= field_array.At(i); 3411 field ^= field_array.At(i);
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
4872 } 4880 }
4873 { 4881 {
4874 NoGCScope no_gc; 4882 NoGCScope no_gc;
4875 RawObject* raw_obj = obj.raw(); 4883 RawObject* raw_obj = obj.raw();
4876 isolate->heap()->SetPeer(raw_obj, peer); 4884 isolate->heap()->SetPeer(raw_obj, peer);
4877 } 4885 }
4878 return Api::Success(isolate); 4886 return Api::Success(isolate);
4879 } 4887 }
4880 4888
4881 } // namespace dart 4889 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698