OLD | NEW |
---|---|
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 Loading... | |
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(src_offset + length <= src.Length()); | |
cshapiro
2012/01/28 02:25:48
This assert is insufficient... for example
ASSE
Anders Johnsen
2012/01/30 21:15:28
Done.
| |
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(dst_offset + length <= dst.Length()); | |
cshapiro
2012/01/28 02:25:48
Same here.
Anders Johnsen
2012/01/30 21:15:28
Done.
| |
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(src_offset + length <= src.Length()); | |
cshapiro
2012/01/28 02:25:48
Same here.
Anders Johnsen
2012/01/30 21:15:28
Done.
| |
7544 ASSERT(dst_offset + length <= dst.Length()); | |
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 Loading... | |
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 |
OLD | NEW |