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 2820363002: Move Kernel strings into the VM's heap. (Closed)
Patch Set: Incorporate review comments. 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('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/become.h" 10 #include "vm/become.h"
(...skipping 9055 matching lines...) Expand 10 before | Expand all | Expand 10 after
9066 } 9066 }
9067 return token_stream.GenerateSource(); 9067 return token_stream.GenerateSource();
9068 } 9068 }
9069 9069
9070 9070
9071 void Script::set_compile_time_constants(const Array& value) const { 9071 void Script::set_compile_time_constants(const Array& value) const {
9072 StorePointer(&raw_ptr()->compile_time_constants_, value.raw()); 9072 StorePointer(&raw_ptr()->compile_time_constants_, value.raw());
9073 } 9073 }
9074 9074
9075 9075
9076 void Script::set_kernel_strings(const TypedData& strings) const {
9077 StorePointer(&raw_ptr()->kernel_strings_, strings.raw());
9078 }
9079
9080
9076 RawGrowableObjectArray* Script::GenerateLineNumberArray() const { 9081 RawGrowableObjectArray* Script::GenerateLineNumberArray() const {
9077 Zone* zone = Thread::Current()->zone(); 9082 Zone* zone = Thread::Current()->zone();
9078 const GrowableObjectArray& info = 9083 const GrowableObjectArray& info =
9079 GrowableObjectArray::Handle(zone, GrowableObjectArray::New()); 9084 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
9080 const String& source = String::Handle(zone, Source()); 9085 const String& source = String::Handle(zone, Source());
9081 const String& key = Symbols::Empty(); 9086 const String& key = Symbols::Empty();
9082 const Object& line_separator = Object::Handle(zone); 9087 const Object& line_separator = Object::Handle(zone);
9083 Smi& value = Smi::Handle(zone); 9088 Smi& value = Smi::Handle(zone);
9084 9089
9085 if (kind() == RawScript::kKernelTag) { 9090 if (kind() == RawScript::kKernelTag) {
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
10143 } 10148 }
10144 const String& metaname = String::Handle(MakeMetadataName(obj)); 10149 const String& metaname = String::Handle(MakeMetadataName(obj));
10145 Field& field = Field::Handle(GetMetadataField(metaname)); 10150 Field& field = Field::Handle(GetMetadataField(metaname));
10146 if (field.IsNull()) { 10151 if (field.IsNull()) {
10147 // There is no metadata for this object. 10152 // There is no metadata for this object.
10148 return Object::empty_array().raw(); 10153 return Object::empty_array().raw();
10149 } 10154 }
10150 Object& metadata = Object::Handle(); 10155 Object& metadata = Object::Handle();
10151 metadata = field.StaticValue(); 10156 metadata = field.StaticValue();
10152 if (field.StaticValue() == Object::empty_array().raw()) { 10157 if (field.StaticValue() == Object::empty_array().raw()) {
10153 kernel::TreeNode* kernel_node = 10158 if (field.kernel_field() != NULL) {
10154 reinterpret_cast<kernel::TreeNode*>(field.kernel_field()); 10159 metadata = kernel::EvaluateMetadata(field);
10155
10156 if (kernel_node != NULL) {
10157 metadata = kernel::EvaluateMetadata(kernel_node);
10158 } else { 10160 } else {
10159 metadata = Parser::ParseMetadata(field); 10161 metadata = Parser::ParseMetadata(field);
10160 } 10162 }
10161 if (metadata.IsArray()) { 10163 if (metadata.IsArray()) {
10162 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw()); 10164 ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw());
10163 field.SetStaticValue(Array::Cast(metadata), true); 10165 field.SetStaticValue(Array::Cast(metadata), true);
10164 } 10166 }
10165 } 10167 }
10166 return metadata.raw(); 10168 return metadata.raw();
10167 #endif // defined(DART_PRECOMPILED_RUNTIME) 10169 #endif // defined(DART_PRECOMPILED_RUNTIME)
(...skipping 13122 matching lines...) Expand 10 before | Expand all | Expand 10 after
23290 return UserTag::null(); 23292 return UserTag::null();
23291 } 23293 }
23292 23294
23293 23295
23294 const char* UserTag::ToCString() const { 23296 const char* UserTag::ToCString() const {
23295 const String& tag_label = String::Handle(label()); 23297 const String& tag_label = String::Handle(label());
23296 return tag_label.ToCString(); 23298 return tag_label.ToCString();
23297 } 23299 }
23298 23300
23299 } // namespace dart 23301 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698