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

Unified Diff: runtime/lib/string.cc

Issue 578443003: Support old-space allocation in generated code (bump block only for now). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/assembler_arm.h » ('j') | runtime/vm/stub_code_x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string.cc
===================================================================
--- runtime/lib/string.cc (revision 40518)
+++ runtime/lib/string.cc (working copy)
@@ -137,20 +137,22 @@
DEFINE_NATIVE_ENTRY(OneByteString_allocate, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(Smi, length_obj, arguments->NativeArgAt(0));
- return OneByteString::New(length_obj.Value(), Heap::kNew);
+ Heap::Space space = isolate->heap()->SpaceForAllocation(kOneByteStringCid);
+ return OneByteString::New(length_obj.Value(), space);
}
DEFINE_NATIVE_ENTRY(OneByteString_allocateFromOneByteList, 1) {
Instance& list = Instance::CheckedHandle(arguments->NativeArgAt(0));
+ Heap::Space space = isolate->heap()->SpaceForAllocation(kOneByteStringCid);
if (list.IsTypedData()) {
const TypedData& array = TypedData::Cast(list);
intptr_t length = array.LengthInBytes();
- return OneByteString::New(array, 0, length);
+ return OneByteString::New(array, 0, length, space);
} else if (list.IsExternalTypedData()) {
const ExternalTypedData& array = ExternalTypedData::Cast(list);
intptr_t length = array.LengthInBytes();
- return OneByteString::New(array, 0, length);
+ return OneByteString::New(array, 0, length, space);
} else if (RawObject::IsTypedDataViewClassId(list.GetClassId())) {
const Instance& view = Instance::Cast(list);
intptr_t length = Smi::Value(TypedDataView::Length(view));
@@ -158,15 +160,15 @@
intptr_t data_offset = Smi::Value(TypedDataView::OffsetInBytes(view));
if (data_obj.IsTypedData()) {
const TypedData& array = TypedData::Cast(data_obj);
- return OneByteString::New(array, data_offset, length);
+ return OneByteString::New(array, data_offset, length, space);
} else if (data_obj.IsExternalTypedData()) {
const ExternalTypedData& array = ExternalTypedData::Cast(data_obj);
- return OneByteString::New(array, data_offset, length);
+ return OneByteString::New(array, data_offset, length, space);
}
} else if (list.IsArray()) {
const Array& array = Array::Cast(list);
intptr_t length = array.Length();
- String& string = String::Handle(OneByteString::New(length, Heap::kNew));
+ String& string = String::Handle(OneByteString::New(length, space));
for (int i = 0; i < length; i++) {
intptr_t value = Smi::Value(reinterpret_cast<RawSmi*>(array.At(i)));
OneByteString::SetCharAt(string, i, value);
@@ -175,7 +177,7 @@
} else if (list.IsGrowableObjectArray()) {
const GrowableObjectArray& array = GrowableObjectArray::Cast(list);
intptr_t length = array.Length();
- String& string = String::Handle(OneByteString::New(length, Heap::kNew));
+ String& string = String::Handle(OneByteString::New(length, space));
for (int i = 0; i < length; i++) {
intptr_t value = Smi::Value(reinterpret_cast<RawSmi*>(array.At(i)));
OneByteString::SetCharAt(string, i, value);
« no previous file with comments | « no previous file | runtime/vm/assembler_arm.h » ('j') | runtime/vm/stub_code_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698