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

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

Issue 1859273002: Add flag to disable string externalization (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « 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 "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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 "instead of showing the corresponding interface names (e.g. \"String\")"); 58 "instead of showing the corresponding interface names (e.g. \"String\")");
59 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache"); 59 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache");
60 DEFINE_FLAG(bool, ignore_patch_signature_mismatch, false, 60 DEFINE_FLAG(bool, ignore_patch_signature_mismatch, false,
61 "Ignore patch file member signature mismatch."); 61 "Ignore patch file member signature mismatch.");
62 62
63 DECLARE_FLAG(charp, coverage_dir); 63 DECLARE_FLAG(charp, coverage_dir);
64 DECLARE_FLAG(bool, show_invisible_frames); 64 DECLARE_FLAG(bool, show_invisible_frames);
65 DECLARE_FLAG(bool, trace_deoptimization); 65 DECLARE_FLAG(bool, trace_deoptimization);
66 DECLARE_FLAG(bool, trace_deoptimization_verbose); 66 DECLARE_FLAG(bool, trace_deoptimization_verbose);
67 DECLARE_FLAG(bool, write_protect_code); 67 DECLARE_FLAG(bool, write_protect_code);
68 DECLARE_FLAG(bool, support_externalizable_strings);
68 69
69 70
70 static const char* const kGetterPrefix = "get:"; 71 static const char* const kGetterPrefix = "get:";
71 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); 72 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix);
72 static const char* const kSetterPrefix = "set:"; 73 static const char* const kSetterPrefix = "set:";
73 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); 74 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix);
74 75
75 // A cache of VM heap allocated preinitialized empty ic data entry arrays. 76 // A cache of VM heap allocated preinitialized empty ic data entry arrays.
76 RawArray* ICData::cached_icdata_arrays_[kCachedICDataArrayCount]; 77 RawArray* ICData::cached_icdata_arrays_[kCachedICDataArrayCount];
77 78
(...skipping 7730 matching lines...) Expand 10 before | Expand all | Expand 10 after
7808 guarded_list_length_in_object_offset()); 7809 guarded_list_length_in_object_offset());
7809 } 7810 }
7810 } 7811 }
7811 7812
7812 return Thread::Current()->zone()->PrintToString("<%s %s>", 7813 return Thread::Current()->zone()->PrintToString("<%s %s>",
7813 is_nullable() ? "nullable" : "not-nullable", 7814 is_nullable() ? "nullable" : "not-nullable",
7814 class_name); 7815 class_name);
7815 } 7816 }
7816 7817
7817 7818
7819 bool Field::IsExternalizableCid(intptr_t cid) {
7820 if (FLAG_support_externalizable_strings) {
7821 return (cid == kOneByteStringCid) || (cid == kTwoByteStringCid);
7822 } else {
7823 return false;
7824 }
7825 }
7826
7827
7818 void Field::InitializeGuardedListLengthInObjectOffset() const { 7828 void Field::InitializeGuardedListLengthInObjectOffset() const {
7819 ASSERT(IsOriginal()); 7829 ASSERT(IsOriginal());
7820 if (needs_length_check() && 7830 if (needs_length_check() &&
7821 (guarded_list_length() != Field::kUnknownFixedLength)) { 7831 (guarded_list_length() != Field::kUnknownFixedLength)) {
7822 const intptr_t offset = GetListLengthOffset(guarded_cid()); 7832 const intptr_t offset = GetListLengthOffset(guarded_cid());
7823 set_guarded_list_length_in_object_offset(offset); 7833 set_guarded_list_length_in_object_offset(offset);
7824 ASSERT(offset != Field::kUnknownLengthOffset); 7834 ASSERT(offset != Field::kUnknownLengthOffset);
7825 } else { 7835 } else {
7826 set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); 7836 set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset);
7827 } 7837 }
(...skipping 11766 matching lines...) Expand 10 before | Expand all | Expand 10 after
19594 peer, 19604 peer,
19595 callback, 19605 callback,
19596 external_size); 19606 external_size);
19597 } 19607 }
19598 19608
19599 19609
19600 RawString* String::MakeExternal(void* array, 19610 RawString* String::MakeExternal(void* array,
19601 intptr_t length, 19611 intptr_t length,
19602 void* peer, 19612 void* peer,
19603 Dart_PeerFinalizer cback) const { 19613 Dart_PeerFinalizer cback) const {
19614 ASSERT(FLAG_support_externalizable_strings);
19604 String& result = String::Handle(); 19615 String& result = String::Handle();
19605 void* external_data; 19616 void* external_data;
19606 Dart_WeakPersistentHandleFinalizer finalizer; 19617 Dart_WeakPersistentHandleFinalizer finalizer;
19607 { 19618 {
19608 NoSafepointScope no_safepoint; 19619 NoSafepointScope no_safepoint;
19609 ASSERT(array != NULL); 19620 ASSERT(array != NULL);
19610 intptr_t str_length = this->Length(); 19621 intptr_t str_length = this->Length();
19611 ASSERT(length >= (str_length * this->CharSize())); 19622 ASSERT(length >= (str_length * this->CharSize()));
19612 intptr_t class_id = raw()->GetClassId(); 19623 intptr_t class_id = raw()->GetClassId();
19613 19624
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
21862 return UserTag::null(); 21873 return UserTag::null();
21863 } 21874 }
21864 21875
21865 21876
21866 const char* UserTag::ToCString() const { 21877 const char* UserTag::ToCString() const {
21867 const String& tag_label = String::Handle(label()); 21878 const String& tag_label = String::Handle(label());
21868 return tag_label.ToCString(); 21879 return tag_label.ToCString();
21869 } 21880 }
21870 21881
21871 } // namespace dart 21882 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698