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

Side by Side Diff: vm/dart_api_impl.h

Issue 10386060: Speed up the Dart_IsBlah functions by checking the class index. This (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | vm/dart_api_impl.cc » ('j') | vm/dart_api_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #ifndef VM_DART_API_IMPL_H_ 5 #ifndef VM_DART_API_IMPL_H_
6 #define VM_DART_API_IMPL_H_ 6 #define VM_DART_API_IMPL_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 RawObject* raw = *(reinterpret_cast<RawObject**>(handle)); 116 RawObject* raw = *(reinterpret_cast<RawObject**>(handle));
117 return !raw->IsHeapObject(); 117 return !raw->IsHeapObject();
118 } 118 }
119 119
120 // Returns the value of a Smi. 120 // Returns the value of a Smi.
121 static intptr_t SmiValue(Dart_Handle handle) { 121 static intptr_t SmiValue(Dart_Handle handle) {
122 uword value = *(reinterpret_cast<uword*>(handle)); 122 uword value = *(reinterpret_cast<uword*>(handle));
123 return Smi::ValueFromRaw(value); 123 return Smi::ValueFromRaw(value);
124 } 124 }
125 125
126 static intptr_t ClassIndex(Dart_Handle handle) {
Ivan Posva 2012/05/09 23:28:16 There is an inconsistency naming this. In RawObjec
turnidge 2012/05/10 17:49:38 I thought about this some more and decided to go w
127 RawObject* raw = *(reinterpret_cast<RawObject**>(handle));
128 if (!raw->IsHeapObject()) {
129 return kSmi;
130 }
131 return raw->GetClassTag();
132 }
133
126 // Generates a handle used to designate an error return. 134 // Generates a handle used to designate an error return.
127 static Dart_Handle NewError(const char* format, ...); 135 static Dart_Handle NewError(const char* format, ...);
128 136
129 // Gets a handle to Null. 137 // Gets a handle to Null.
130 static Dart_Handle Null(Isolate* isolate); 138 static Dart_Handle Null(Isolate* isolate);
131 139
132 // Gets a handle to True. 140 // Gets a handle to True.
133 static Dart_Handle True(Isolate* isolate); 141 static Dart_Handle True(Isolate* isolate);
134 142
135 // Gets a handle to False 143 // Gets a handle to False
(...skipping 29 matching lines...) Expand all
165 } 173 }
166 private: 174 private:
167 Isolate* saved_isolate_; 175 Isolate* saved_isolate_;
168 176
169 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); 177 DISALLOW_COPY_AND_ASSIGN(IsolateSaver);
170 }; 178 };
171 179
172 } // namespace dart. 180 } // namespace dart.
173 181
174 #endif // VM_DART_API_IMPL_H_ 182 #endif // VM_DART_API_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | vm/dart_api_impl.cc » ('j') | vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698