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

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

Issue 26682003: Cache number of type arguments in class object instead of recalculating it. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 3607 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 Isolate* isolate = Isolate::Current(); 3618 Isolate* isolate = Isolate::Current();
3619 DARTSCOPE(isolate); 3619 DARTSCOPE(isolate);
3620 const String& cls_name = Api::UnwrapStringHandle(isolate, name); 3620 const String& cls_name = Api::UnwrapStringHandle(isolate, name);
3621 if (cls_name.IsNull()) { 3621 if (cls_name.IsNull()) {
3622 RETURN_TYPE_ERROR(isolate, name, String); 3622 RETURN_TYPE_ERROR(isolate, name, String);
3623 } 3623 }
3624 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); 3624 const Library& lib = Api::UnwrapLibraryHandle(isolate, library);
3625 if (lib.IsNull()) { 3625 if (lib.IsNull()) {
3626 RETURN_TYPE_ERROR(isolate, library, Library); 3626 RETURN_TYPE_ERROR(isolate, library, Library);
3627 } 3627 }
3628 if (field_count <= 0) { 3628 if (!Utils::IsUint(16, field_count)) {
3629 return Api::NewError( 3629 return Api::NewError(
3630 "Negative field_count passed to Dart_CreateNativeWrapperClass"); 3630 "Invalid field_count passed to Dart_CreateNativeWrapperClass");
3631 } 3631 }
3632 CHECK_CALLBACK_STATE(isolate); 3632 CHECK_CALLBACK_STATE(isolate);
3633 3633
3634 String& cls_symbol = String::Handle(isolate, Symbols::New(cls_name)); 3634 String& cls_symbol = String::Handle(isolate, Symbols::New(cls_name));
3635 const Class& cls = Class::Handle( 3635 const Class& cls = Class::Handle(
3636 isolate, Class::NewNativeWrapper(lib, cls_symbol, field_count)); 3636 isolate, Class::NewNativeWrapper(lib, cls_symbol, field_count));
3637 if (cls.IsNull()) { 3637 if (cls.IsNull()) {
3638 return Api::NewError( 3638 return Api::NewError(
3639 "Unable to create native wrapper class : already exists"); 3639 "Unable to create native wrapper class : already exists");
3640 } 3640 }
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
4436 } 4436 }
4437 { 4437 {
4438 NoGCScope no_gc; 4438 NoGCScope no_gc;
4439 RawObject* raw_obj = obj.raw(); 4439 RawObject* raw_obj = obj.raw();
4440 isolate->heap()->SetPeer(raw_obj, peer); 4440 isolate->heap()->SetPeer(raw_obj, peer);
4441 } 4441 }
4442 return Api::Success(); 4442 return Api::Success();
4443 } 4443 }
4444 4444
4445 } // namespace dart 4445 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698