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

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

Issue 25418002: Respond to Ivan's code review comments from previous TBR cl. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: PTAL Created 7 years, 2 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/vm/object_test.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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 13672 matching lines...) Expand 10 before | Expand all | Expand 10 after
13683 *(CharAddr(dststr, index)) = '\\'; 13683 *(CharAddr(dststr, index)) = '\\';
13684 *(CharAddr(dststr, index + 1)) = SpecialCharacter(*CharAddr(str, i)); 13684 *(CharAddr(dststr, index + 1)) = SpecialCharacter(*CharAddr(str, i));
13685 index += 2; 13685 index += 2;
13686 } else { 13686 } else {
13687 *(CharAddr(dststr, index)) = *CharAddr(str, i); 13687 *(CharAddr(dststr, index)) = *CharAddr(str, i);
13688 index += 1; 13688 index += 1;
13689 } 13689 }
13690 } 13690 }
13691 return OneByteString::raw(dststr); 13691 return OneByteString::raw(dststr);
13692 } 13692 }
13693 return OneByteString::New(static_cast<intptr_t>(0), Heap::kNew); 13693 return OneByteString::raw(Symbols::Empty());
13694 } 13694 }
13695 13695
13696 RawOneByteString* ExternalOneByteString::EscapeSpecialCharacters( 13696 RawOneByteString* ExternalOneByteString::EscapeSpecialCharacters(
13697 const String& str) { 13697 const String& str) {
13698 intptr_t len = str.Length(); 13698 intptr_t len = str.Length();
13699 if (len > 0) { 13699 if (len > 0) {
13700 intptr_t num_escapes = 0; 13700 intptr_t num_escapes = 0;
13701 for (intptr_t i = 0; i < len; i++) { 13701 for (intptr_t i = 0; i < len; i++) {
13702 if (IsSpecialCharacter(*CharAddr(str, i))) { 13702 if (IsSpecialCharacter(*CharAddr(str, i))) {
13703 num_escapes += 1; 13703 num_escapes += 1;
13704 } 13704 }
13705 } 13705 }
13706 const String& dststr = String::Handle( 13706 const String& dststr = String::Handle(
13707 OneByteString::New(len + num_escapes, Heap::kNew)); 13707 OneByteString::New(len + num_escapes, Heap::kNew));
13708 intptr_t index = 0; 13708 intptr_t index = 0;
13709 for (intptr_t i = 0; i < len; i++) { 13709 for (intptr_t i = 0; i < len; i++) {
13710 if (IsSpecialCharacter(*CharAddr(str, i))) { 13710 if (IsSpecialCharacter(*CharAddr(str, i))) {
13711 *(OneByteString::CharAddr(dststr, index)) = '\\'; 13711 *(OneByteString::CharAddr(dststr, index)) = '\\';
13712 *(OneByteString::CharAddr(dststr, index + 1)) = 13712 *(OneByteString::CharAddr(dststr, index + 1)) =
13713 SpecialCharacter(*CharAddr(str, i)); 13713 SpecialCharacter(*CharAddr(str, i));
13714 index += 2; 13714 index += 2;
13715 } else { 13715 } else {
13716 *(OneByteString::CharAddr(dststr, index)) = *CharAddr(str, i); 13716 *(OneByteString::CharAddr(dststr, index)) = *CharAddr(str, i);
13717 index += 1; 13717 index += 1;
13718 } 13718 }
13719 } 13719 }
13720 return OneByteString::raw(dststr); 13720 return OneByteString::raw(dststr);
13721 } 13721 }
13722 return OneByteString::New(static_cast<intptr_t>(0), Heap::kNew); 13722 return OneByteString::raw(Symbols::Empty());
13723 } 13723 }
13724 13724
13725 13725
13726 RawOneByteString* OneByteString::New(intptr_t len, 13726 RawOneByteString* OneByteString::New(intptr_t len,
13727 Heap::Space space) { 13727 Heap::Space space) {
13728 ASSERT(Isolate::Current() == Dart::vm_isolate() || 13728 ASSERT(Isolate::Current() == Dart::vm_isolate() ||
13729 Isolate::Current()->object_store()->one_byte_string_class() != 13729 Isolate::Current()->object_store()->one_byte_string_class() !=
13730 Class::null()); 13730 Class::null());
13731 if (len < 0 || len > kMaxElements) { 13731 if (len < 0 || len > kMaxElements) {
13732 // This should be caught before we reach here. 13732 // This should be caught before we reach here.
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
15237 return "_MirrorReference"; 15237 return "_MirrorReference";
15238 } 15238 }
15239 15239
15240 15240
15241 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15241 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15242 JSONObject jsobj(stream); 15242 JSONObject jsobj(stream);
15243 } 15243 }
15244 15244
15245 15245
15246 } // namespace dart 15246 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698