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_byte_offset, | |
7517 intptr_t length) { | |
7518 ASSERT(src_byte_offset + length <= src.Length()); | |
7519 const uint8_t *src_addr = src.ByteAddr(src_byte_offset); | |
cshapiro
2012/01/27 23:00:04
This should be wrapped in a NoGCScope.
Anders Johnsen
2012/01/27 23:42:39
Done.
| |
7520 memmove(dst, src_addr, length); | |
7521 } | |
7522 | |
7523 | |
7524 void ByteArray::Copy(const ByteArray& dst, | |
7525 intptr_t dst_byte_offset, | |
7526 const uint8_t* src, | |
7527 intptr_t length) { | |
7528 ASSERT(dst_byte_offset + length <= dst.Length()); | |
7529 uint8_t *dst_addr = dst.ByteAddr(dst_byte_offset); | |
cshapiro
2012/01/27 23:00:04
Same here...
Anders Johnsen
2012/01/27 23:42:39
Done.
| |
7530 memmove(dst_addr, src, length); | |
7531 } | |
7532 | |
7533 | |
7534 void ByteArray::Copy(const ByteArray& dst, | |
7535 intptr_t dst_byte_offset, | |
7536 const ByteArray& src, | |
7537 intptr_t src_byte_offset, | |
7538 intptr_t length) { | |
7539 ASSERT(src_byte_offset + length <= src.Length()); | |
7540 ASSERT(dst_byte_offset + length <= dst.Length()); | |
7541 const uint8_t *src_addr = src.ByteAddr(src_byte_offset); | |
7542 uint8_t *dst_addr = dst.ByteAddr(dst_byte_offset); | |
cshapiro
2012/01/27 23:00:04
...and here.
Anders Johnsen
2012/01/27 23:42:39
Done.
| |
7543 memmove(dst_addr, src_addr, length); | |
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 | |
7514 const char* ByteArray::ToCString() const { | 7554 const char* ByteArray::ToCString() const { |
7515 // ByteArray is an abstract class. | 7555 // ByteArray is an abstract class. |
7516 UNREACHABLE(); | 7556 UNREACHABLE(); |
7517 return "ByteArray"; | 7557 return "ByteArray"; |
7518 } | 7558 } |
7519 | 7559 |
7520 | 7560 |
7521 RawInternalByteArray* InternalByteArray::New(intptr_t len, | 7561 RawInternalByteArray* InternalByteArray::New(intptr_t len, |
7522 Heap::Space space) { | 7562 Heap::Space space) { |
7523 Isolate* isolate = Isolate::Current(); | 7563 Isolate* isolate = Isolate::Current(); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7882 const String& str = String::Handle(pattern()); | 7922 const String& str = String::Handle(pattern()); |
7883 const char* format = "JSRegExp: pattern=%s flags=%s"; | 7923 const char* format = "JSRegExp: pattern=%s flags=%s"; |
7884 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 7924 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
7885 char* chars = reinterpret_cast<char*>( | 7925 char* chars = reinterpret_cast<char*>( |
7886 Isolate::Current()->current_zone()->Allocate(len + 1)); | 7926 Isolate::Current()->current_zone()->Allocate(len + 1)); |
7887 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 7927 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
7888 return chars; | 7928 return chars; |
7889 } | 7929 } |
7890 | 7930 |
7891 } // namespace dart | 7931 } // namespace dart |
OLD | NEW |