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

Side by Side Diff: runtime/bin/dartutils.h

Issue 12093071: - Change the layout of external typed array objects to avoid the extra indirection when accessing e… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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/bin/dartutils.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 BIN_DARTUTILS_H_ 5 #ifndef BIN_DARTUTILS_H_
6 #define BIN_DARTUTILS_H_ 6 #define BIN_DARTUTILS_H_
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/utils.h" 9 #include "bin/utils.h"
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 static CObject* Bool(bool value); 221 static CObject* Bool(bool value);
222 static Dart_CObject* NewInt32(int32_t value); 222 static Dart_CObject* NewInt32(int32_t value);
223 static Dart_CObject* NewInt64(int64_t value); 223 static Dart_CObject* NewInt64(int64_t value);
224 static Dart_CObject* NewIntptr(intptr_t value); 224 static Dart_CObject* NewIntptr(intptr_t value);
225 // TODO(sgjesse): Add support for kBigint. 225 // TODO(sgjesse): Add support for kBigint.
226 static Dart_CObject* NewDouble(double value); 226 static Dart_CObject* NewDouble(double value);
227 static Dart_CObject* NewString(int length); 227 static Dart_CObject* NewString(int length);
228 static Dart_CObject* NewString(const char* str); 228 static Dart_CObject* NewString(const char* str);
229 static Dart_CObject* NewArray(int length); 229 static Dart_CObject* NewArray(int length);
230 static Dart_CObject* NewUint8Array(int length); 230 static Dart_CObject* NewUint8Array(int length);
231 static Dart_CObject* NewExternalUint8Array(int64_t length, 231 static Dart_CObject* NewExternalUint8Array(
232 uint8_t* data, 232 int64_t length, uint8_t* data, void* peer,
233 void* peer, 233 Dart_WeakPersistentHandleFinalizer callback);
234 Dart_PeerFinalizer callback);
235 static Dart_CObject* NewIOBuffer(int64_t length); 234 static Dart_CObject* NewIOBuffer(int64_t length);
236 static void FreeIOBufferData(Dart_CObject* object); 235 static void FreeIOBufferData(Dart_CObject* object);
237 236
238 Dart_CObject* AsApiCObject() { return cobject_; } 237 Dart_CObject* AsApiCObject() { return cobject_; }
239 238
240 // Create a new CObject array with an illegal arguments error. 239 // Create a new CObject array with an illegal arguments error.
241 static CObject* IllegalArgumentError(); 240 static CObject* IllegalArgumentError();
242 // Create a new CObject array with a file closed error. 241 // Create a new CObject array with a file closed error.
243 static CObject* FileClosedError(); 242 static CObject* FileClosedError();
244 // Create a new CObject array with the current OS error. 243 // Create a new CObject array with the current OS error.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 class CObjectExternalUint8Array : public CObject { 404 class CObjectExternalUint8Array : public CObject {
406 public: 405 public:
407 DECLARE_COBJECT_CONSTRUCTORS(ExternalUint8Array) 406 DECLARE_COBJECT_CONSTRUCTORS(ExternalUint8Array)
408 407
409 int Length() const { return cobject_->value.as_external_byte_array.length; } 408 int Length() const { return cobject_->value.as_external_byte_array.length; }
410 void SetLength(uint64_t length) { 409 void SetLength(uint64_t length) {
411 cobject_->value.as_external_byte_array.length = length; 410 cobject_->value.as_external_byte_array.length = length;
412 } 411 }
413 uint8_t* Data() const { return cobject_->value.as_external_byte_array.data; } 412 uint8_t* Data() const { return cobject_->value.as_external_byte_array.data; }
414 void* Peer() const { return cobject_->value.as_external_byte_array.peer; } 413 void* Peer() const { return cobject_->value.as_external_byte_array.peer; }
415 Dart_PeerFinalizer Callback() const { 414 Dart_WeakPersistentHandleFinalizer Callback() const {
416 return cobject_->value.as_external_byte_array.callback; 415 return cobject_->value.as_external_byte_array.callback;
417 } 416 }
418 417
419 private: 418 private:
420 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array); 419 DISALLOW_COPY_AND_ASSIGN(CObjectExternalUint8Array);
421 }; 420 };
422 421
423 #endif // BIN_DARTUTILS_H_ 422 #endif // BIN_DARTUTILS_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698