mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
[build] Default to -O2 instead of -O3.
This moderately reduces code size without large regressions on Golem. Going further to -Os still produces noticeable regressions. TEST=ci Bug: https://github.com/dart-lang/sdk/issues/38647 Change-Id: I8409908ca37d4a2b18cb989d9748e35a15072df6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217504 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
2ca588fce8
commit
1aa7f17b56
|
@ -815,13 +815,9 @@ if (is_win) {
|
|||
# Default "optimization on" config. On Windows, this favors size over speed.
|
||||
config("optimize") {
|
||||
if (is_win) {
|
||||
# Favor size over speed, /O1 must be before the common flags. The GYP
|
||||
# build also specifies /Os and /GF but these are implied by /O1.
|
||||
cflags = [ "/O2" ] + common_optimize_on_cflags + [ "/Oi" ]
|
||||
} else if (is_android) {
|
||||
cflags = [ "-Os" ] + common_optimize_on_cflags # Favor size over speed.
|
||||
} else {
|
||||
cflags = [ "-O3" ] + common_optimize_on_cflags
|
||||
cflags = [ "-O2" ] + common_optimize_on_cflags
|
||||
}
|
||||
ldflags = common_optimize_on_ldflags
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ config("dart_config") {
|
|||
} else if (dart_debug) {
|
||||
cflags += [ "-O${dart_debug_optimization_level}" ]
|
||||
} else {
|
||||
cflags += [ "-O3" ]
|
||||
cflags += [ "-O2" ]
|
||||
}
|
||||
|
||||
if (is_fuchsia) {
|
||||
|
|
|
@ -79,12 +79,24 @@ static BoolPtr CopyData(const TypedDataBase& dst_array,
|
|||
src_array.LengthInBytes()));
|
||||
ASSERT(Utils::RangeCheck(dst_offset_in_bytes, length_in_bytes,
|
||||
dst_array.LengthInBytes()));
|
||||
if (clamped) {
|
||||
TypedData::ClampedCopy(dst_array, dst_offset_in_bytes, src_array,
|
||||
src_offset_in_bytes, length_in_bytes);
|
||||
} else {
|
||||
TypedData::Copy(dst_array, dst_offset_in_bytes, src_array,
|
||||
src_offset_in_bytes, length_in_bytes);
|
||||
if (length_in_bytes > 0) {
|
||||
NoSafepointScope no_safepoint;
|
||||
if (clamped) {
|
||||
uint8_t* dst_data =
|
||||
reinterpret_cast<uint8_t*>(dst_array.DataAddr(dst_offset_in_bytes));
|
||||
int8_t* src_data =
|
||||
reinterpret_cast<int8_t*>(src_array.DataAddr(src_offset_in_bytes));
|
||||
for (intptr_t ix = 0; ix < length_in_bytes; ix++) {
|
||||
int8_t v = *src_data;
|
||||
if (v < 0) v = 0;
|
||||
*dst_data = v;
|
||||
src_data++;
|
||||
dst_data++;
|
||||
}
|
||||
} else {
|
||||
memmove(dst_array.DataAddr(dst_offset_in_bytes),
|
||||
src_array.DataAddr(src_offset_in_bytes), length_in_bytes);
|
||||
}
|
||||
}
|
||||
return Bool::True().ptr();
|
||||
}
|
||||
|
|
|
@ -11431,51 +11431,6 @@ class TypedData : public TypedDataBase {
|
|||
intptr_t len,
|
||||
Heap::Space space = Heap::kNew);
|
||||
|
||||
static void Copy(const TypedDataBase& dst,
|
||||
intptr_t dst_offset_in_bytes,
|
||||
const TypedDataBase& src,
|
||||
intptr_t src_offset_in_bytes,
|
||||
intptr_t length_in_bytes) {
|
||||
ASSERT(Utils::RangeCheck(src_offset_in_bytes, length_in_bytes,
|
||||
src.LengthInBytes()));
|
||||
ASSERT(Utils::RangeCheck(dst_offset_in_bytes, length_in_bytes,
|
||||
dst.LengthInBytes()));
|
||||
{
|
||||
NoSafepointScope no_safepoint;
|
||||
if (length_in_bytes > 0) {
|
||||
memmove(dst.DataAddr(dst_offset_in_bytes),
|
||||
src.DataAddr(src_offset_in_bytes), length_in_bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ClampedCopy(const TypedDataBase& dst,
|
||||
intptr_t dst_offset_in_bytes,
|
||||
const TypedDataBase& src,
|
||||
intptr_t src_offset_in_bytes,
|
||||
intptr_t length_in_bytes) {
|
||||
ASSERT(Utils::RangeCheck(src_offset_in_bytes, length_in_bytes,
|
||||
src.LengthInBytes()));
|
||||
ASSERT(Utils::RangeCheck(dst_offset_in_bytes, length_in_bytes,
|
||||
dst.LengthInBytes()));
|
||||
{
|
||||
NoSafepointScope no_safepoint;
|
||||
if (length_in_bytes > 0) {
|
||||
uint8_t* dst_data =
|
||||
reinterpret_cast<uint8_t*>(dst.DataAddr(dst_offset_in_bytes));
|
||||
int8_t* src_data =
|
||||
reinterpret_cast<int8_t*>(src.DataAddr(src_offset_in_bytes));
|
||||
for (intptr_t ix = 0; ix < length_in_bytes; ix++) {
|
||||
int8_t v = *src_data;
|
||||
if (v < 0) v = 0;
|
||||
*dst_data = v;
|
||||
src_data++;
|
||||
dst_data++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsTypedData(const Instance& obj) {
|
||||
ASSERT(!obj.IsNull());
|
||||
intptr_t cid = obj.ptr()->GetClassId();
|
||||
|
|
Loading…
Reference in a new issue