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

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

Issue 2820363002: Move Kernel strings into the VM's heap. (Closed)
Patch Set: Created 3 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
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/become.h" 10 #include "vm/become.h"
(...skipping 8952 matching lines...) Expand 10 before | Expand all | Expand 10 after
8963 } 8963 }
8964 return token_stream.GenerateSource(); 8964 return token_stream.GenerateSource();
8965 } 8965 }
8966 8966
8967 8967
8968 void Script::set_compile_time_constants(const Array& value) const { 8968 void Script::set_compile_time_constants(const Array& value) const {
8969 StorePointer(&raw_ptr()->compile_time_constants_, value.raw()); 8969 StorePointer(&raw_ptr()->compile_time_constants_, value.raw());
8970 } 8970 }
8971 8971
8972 8972
8973 void Script::set_kernel_strings(const TypedData& strings) const {
8974 StorePointer(&raw_ptr()->kernel_strings_, strings.raw());
8975 }
8976
8977
8973 RawGrowableObjectArray* Script::GenerateLineNumberArray() const { 8978 RawGrowableObjectArray* Script::GenerateLineNumberArray() const {
8974 Zone* zone = Thread::Current()->zone(); 8979 Zone* zone = Thread::Current()->zone();
8975 const GrowableObjectArray& info = 8980 const GrowableObjectArray& info =
8976 GrowableObjectArray::Handle(zone, GrowableObjectArray::New()); 8981 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
8977 const String& source = String::Handle(zone, Source()); 8982 const String& source = String::Handle(zone, Source());
8978 const String& key = Symbols::Empty(); 8983 const String& key = Symbols::Empty();
8979 const Object& line_separator = Object::Handle(zone); 8984 const Object& line_separator = Object::Handle(zone);
8980 Smi& value = Smi::Handle(zone); 8985 Smi& value = Smi::Handle(zone);
8981 8986
8982 if (kind() == RawScript::kKernelTag) { 8987 if (kind() == RawScript::kKernelTag) {
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
10040 } 10045 }
10041 const String& metaname = String::Handle(MakeMetadataName(obj)); 10046 const String& metaname = String::Handle(MakeMetadataName(obj));
10042 Field& field = Field::Handle(GetMetadataField(metaname)); 10047 Field& field = Field::Handle(GetMetadataField(metaname));
10043 if (field.IsNull()) { 10048 if (field.IsNull()) {
10044 // There is no metadata for this object. 10049 // There is no metadata for this object.
10045 return Object::empty_array().raw(); 10050 return Object::empty_array().raw();
10046 } 10051 }
10047 Object& metadata = Object::Handle(); 10052 Object& metadata = Object::Handle();
10048 metadata = field.StaticValue(); 10053 metadata = field.StaticValue();
10049 if (field.StaticValue() == Object::empty_array().raw()) { 10054 if (field.StaticValue() == Object::empty_array().raw()) {
10050 kernel::TreeNode* kernel_node = 10055 if (field.kernel_field() != NULL) {
10051 reinterpret_cast<kernel::TreeNode*>(field.kernel_field()); 10056 metadata = kernel::EvaluateMetadata(field);
10052
10053 if (kernel_node != NULL) {
10054 metadata = kernel::EvaluateMetadata(kernel_node);
10055 } else { 10057 } else {
10056 metadata = Parser::ParseMetadata(field); 10058 metadata = Parser::ParseMetadata(field);
10057 } 10059 }
10058 if (metadata.IsArray()) { 10060 if (metadata.IsArray()) {
10059 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); 10061 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw());
10060 field.SetStaticValue(Array::Cast(metadata), true); 10062 field.SetStaticValue(Array::Cast(metadata), true);
10061 } 10063 }
10062 } 10064 }
10063 return metadata.raw(); 10065 return metadata.raw();
10064 #endif // defined(DART_PRECOMPILED_RUNTIME) 10066 #endif // defined(DART_PRECOMPILED_RUNTIME)
(...skipping 13118 matching lines...) Expand 10 before | Expand all | Expand 10 after
23183 return UserTag::null(); 23185 return UserTag::null();
23184 } 23186 }
23185 23187
23186 23188
23187 const char* UserTag::ToCString() const { 23189 const char* UserTag::ToCString() const {
23188 const String& tag_label = String::Handle(label()); 23190 const String& tag_label = String::Handle(label());
23189 return tag_label.ToCString(); 23191 return tag_label.ToCString();
23190 } 23192 }
23191 23193
23192 } // namespace dart 23194 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698