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

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

Issue 9235067: Use ByteArray's native for Socket and File. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | no next file » | 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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 7488 matching lines...) Expand 10 before | Expand all | Expand 10 after
7499 } 7499 }
7500 7500
7501 7501
7502 intptr_t ByteArray::Length() const { 7502 intptr_t ByteArray::Length() const {
7503 // ByteArray is an abstract class. 7503 // ByteArray is an abstract class.
7504 UNREACHABLE(); 7504 UNREACHABLE();
7505 return 0; 7505 return 0;
7506 } 7506 }
7507 7507
7508 7508
7509 void ByteArray::Copy(uint8_t* dst,
7510 const ByteArray& src,
7511 intptr_t src_offset,
7512 intptr_t length) {
7513 ASSERT(Utils::RangeCheck(src_offset, length, src.Length()));
7514 {
7515 NoGCScope no_gc;
7516 memmove(dst, src.ByteAddr(src_offset), length);
7517 }
7518 }
7519
7520
7521 void ByteArray::Copy(const ByteArray& dst,
7522 intptr_t dst_offset,
7523 const uint8_t* src,
7524 intptr_t length) {
7525 ASSERT(Utils::RangeCheck(dst_offset, length, dst.Length()));
7526 {
7527 NoGCScope no_gc;
7528 memmove(dst.ByteAddr(dst_offset), src, length);
7529 }
7530 }
7531
7532
7533 void ByteArray::Copy(const ByteArray& dst,
7534 intptr_t dst_offset,
7535 const ByteArray& src,
7536 intptr_t src_offset,
7537 intptr_t length) {
7538 ASSERT(Utils::RangeCheck(src_offset, length, src.Length()));
7539 ASSERT(Utils::RangeCheck(dst_offset, length, dst.Length()));
7540 {
7541 NoGCScope no_gc;
7542 memmove(dst.ByteAddr(dst_offset), src.ByteAddr(src_offset), length);
7543 }
7544 }
7545
7546
7547 uint8_t* ByteArray::ByteAddr(intptr_t byte_offset) const {
7548 // ByteArray is an abstract class.
7549 UNREACHABLE();
7550 return NULL;
7551 }
7552
7553
7509 const char* ByteArray::ToCString() const { 7554 const char* ByteArray::ToCString() const {
7510 // ByteArray is an abstract class. 7555 // ByteArray is an abstract class.
7511 UNREACHABLE(); 7556 UNREACHABLE();
7512 return "ByteArray"; 7557 return "ByteArray";
7513 } 7558 }
7514 7559
7515 7560
7516 RawInternalByteArray* InternalByteArray::New(intptr_t len, 7561 RawInternalByteArray* InternalByteArray::New(intptr_t len,
7517 Heap::Space space) { 7562 Heap::Space space) {
7518 Isolate* isolate = Isolate::Current(); 7563 Isolate* isolate = Isolate::Current();
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
7877 const String& str = String::Handle(pattern()); 7922 const String& str = String::Handle(pattern());
7878 const char* format = "JSRegExp: pattern=%s flags=%s"; 7923 const char* format = "JSRegExp: pattern=%s flags=%s";
7879 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 7924 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
7880 char* chars = reinterpret_cast<char*>( 7925 char* chars = reinterpret_cast<char*>(
7881 Isolate::Current()->current_zone()->Allocate(len + 1)); 7926 Isolate::Current()->current_zone()->Allocate(len + 1));
7882 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 7927 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
7883 return chars; 7928 return chars;
7884 } 7929 }
7885 7930
7886 } // namespace dart 7931 } // namespace dart
OLDNEW
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698