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

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

Issue 25062003: - Add special access for receiver as it is a frequently used operation (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
« no previous file with comments | « no previous file | runtime/vm/native_arguments.h » ('j') | runtime/vm/native_arguments.h » ('J')
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 "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 3595 matching lines...) Expand 10 before | Expand all | Expand 10 after
3606 } 3606 }
3607 3607
3608 3608
3609 DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, 3609 DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args,
3610 intptr_t* value) { 3610 intptr_t* value) {
3611 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); 3611 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
3612 Isolate* isolate = arguments->isolate(); 3612 Isolate* isolate = arguments->isolate();
3613 CHECK_ISOLATE(isolate); 3613 CHECK_ISOLATE(isolate);
3614 ReusableObjectHandleScope reused_obj_handle(isolate); 3614 ReusableObjectHandleScope reused_obj_handle(isolate);
3615 Object& obj = reused_obj_handle.Handle(); 3615 Object& obj = reused_obj_handle.Handle();
3616 obj = arguments->NativeArgAt(0); 3616 obj = arguments->NativeReceiver();
3617 intptr_t cid = obj.GetClassId(); 3617 intptr_t cid = obj.GetClassId();
3618 if (cid <= kNumPredefinedCids) { 3618 if (cid <= kNumPredefinedCids) {
3619 if (cid == kNullCid) { 3619 if (cid == kNullCid) {
3620 return Api::NewError("%s expects receiver argument to be non-null.", 3620 return Api::NewError("%s expects receiver argument to be non-null.",
3621 CURRENT_FUNC); 3621 CURRENT_FUNC);
3622 } 3622 }
3623 return Api::NewError("%s expects receiver argument to be of" 3623 return Api::NewError("%s expects receiver argument to be of"
3624 " type Instance.", CURRENT_FUNC); 3624 " type Instance.", CURRENT_FUNC);
3625 } 3625 }
3626 const Instance& instance = Instance::Cast(obj); 3626 const Instance& instance = Instance::Cast(obj);
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
4284 } 4284 }
4285 { 4285 {
4286 NoGCScope no_gc; 4286 NoGCScope no_gc;
4287 RawObject* raw_obj = obj.raw(); 4287 RawObject* raw_obj = obj.raw();
4288 isolate->heap()->SetPeer(raw_obj, peer); 4288 isolate->heap()->SetPeer(raw_obj, peer);
4289 } 4289 }
4290 return Api::Success(); 4290 return Api::Success();
4291 } 4291 }
4292 4292
4293 } // namespace dart 4293 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/native_arguments.h » ('j') | runtime/vm/native_arguments.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698