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

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/dart_api_impl.cc ('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 7493 matching lines...) Expand 10 before | Expand all | Expand 10 after
7504 } 7504 }
7505 7505
7506 7506
7507 intptr_t ByteArray::Length() const { 7507 intptr_t ByteArray::Length() const {
7508 // ByteArray is an abstract class. 7508 // ByteArray is an abstract class.
7509 UNREACHABLE(); 7509 UNREACHABLE();
7510 return 0; 7510 return 0;
7511 } 7511 }
7512 7512
7513 7513
7514 void ByteArray::Copy(uint8_t* dst,
7515 const ByteArray& src,
7516 intptr_t src_offset,
7517 intptr_t length) {
7518 ASSERT(Utils::RangeCheck(src_offset, length, src.Length()));
7519 {
7520 NoGCScope no_gc;
7521 memmove(dst, src.ByteAddr(src_offset), length);
7522 }
7523 }
7524
7525
7526 void ByteArray::Copy(const ByteArray& dst,
7527 intptr_t dst_offset,
7528 const uint8_t* src,
7529 intptr_t length) {
7530 ASSERT(Utils::RangeCheck(dst_offset, length, dst.Length()));
7531 {
7532 NoGCScope no_gc;
7533 memmove(dst.ByteAddr(dst_offset), src, length);
7534 }
7535 }
7536
7537
7538 void ByteArray::Copy(const ByteArray& dst,
7539 intptr_t dst_offset,
7540 const ByteArray& src,
7541 intptr_t src_offset,
7542 intptr_t length) {
7543 ASSERT(Utils::RangeCheck(src_offset, length, src.Length()));
7544 ASSERT(Utils::RangeCheck(dst_offset, length, dst.Length()));
cshapiro 2012/01/31 03:12:03 This function does not yet seem to exist in Utils.
Anders Johnsen 2012/01/31 03:34:56 Sorry, forgot to add file to cl. Added now.
7545 {
7546 NoGCScope no_gc;
7547 memmove(dst.ByteAddr(dst_offset), src.ByteAddr(src_offset), length);
7548 }
7549 }
7550
7551
7552 uint8_t* ByteArray::ByteAddr(intptr_t byte_offset) const {
7553 // ByteArray is an abstract class.
7554 UNREACHABLE();
7555 return NULL;
7556 }
7557
7558
7514 const char* ByteArray::ToCString() const { 7559 const char* ByteArray::ToCString() const {
7515 // ByteArray is an abstract class. 7560 // ByteArray is an abstract class.
7516 UNREACHABLE(); 7561 UNREACHABLE();
7517 return "ByteArray"; 7562 return "ByteArray";
7518 } 7563 }
7519 7564
7520 7565
7521 RawInternalByteArray* InternalByteArray::New(intptr_t len, 7566 RawInternalByteArray* InternalByteArray::New(intptr_t len,
7522 Heap::Space space) { 7567 Heap::Space space) {
7523 Isolate* isolate = Isolate::Current(); 7568 Isolate* isolate = Isolate::Current();
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
7882 const String& str = String::Handle(pattern()); 7927 const String& str = String::Handle(pattern());
7883 const char* format = "JSRegExp: pattern=%s flags=%s"; 7928 const char* format = "JSRegExp: pattern=%s flags=%s";
7884 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 7929 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
7885 char* chars = reinterpret_cast<char*>( 7930 char* chars = reinterpret_cast<char*>(
7886 Isolate::Current()->current_zone()->Allocate(len + 1)); 7931 Isolate::Current()->current_zone()->Allocate(len + 1));
7887 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 7932 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
7888 return chars; 7933 return chars;
7889 } 7934 }
7890 7935
7891 } // namespace dart 7936 } // namespace dart
OLDNEW
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698