mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:58:13 +00:00
Bug fix and cleanup of inlining of recognized [] methods.
1. Fix a bug with polymorphic inlining of [] on platforms that don't support inlined SIMD ops (e.g. MIPS), or unboxed int32/uint32. (ia32 with SSE <4.1). 2. Cleanup of duplicate code. R=kmillikin@google.com Review URL: https://codereview.chromium.org//24567003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28000 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
567317297e
commit
b389bddb1a
|
@ -692,8 +692,6 @@ static intptr_t ReceiverClassId(InstanceCallInstr* call) {
|
|||
|
||||
const ICData& ic_data = ICData::Handle(call->ic_data()->AsUnaryClassChecks());
|
||||
|
||||
if (ic_data.NumberOfChecks() == 0) return kIllegalCid;
|
||||
// TODO(vegorov): Add multiple receiver type support.
|
||||
if (ic_data.NumberOfChecks() != 1) return kIllegalCid;
|
||||
ASSERT(ic_data.HasOneTarget());
|
||||
|
||||
|
@ -1069,9 +1067,13 @@ bool FlowGraphOptimizer::TryInlineRecognizedMethod(const Function& target,
|
|||
case MethodRecognizer::kExternalUint8ClampedArrayGetIndexed:
|
||||
case MethodRecognizer::kInt16ArrayGetIndexed:
|
||||
case MethodRecognizer::kUint16ArrayGetIndexed:
|
||||
return TryInlineGetIndexed(kind, call, ic_data, entry, last);
|
||||
case MethodRecognizer::kFloat32x4ArrayGetIndexed:
|
||||
if (!ShouldInlineSimd()) return false;
|
||||
return TryInlineGetIndexed(kind, call, ic_data, entry, last);
|
||||
case MethodRecognizer::kInt32ArrayGetIndexed:
|
||||
case MethodRecognizer::kUint32ArrayGetIndexed:
|
||||
case MethodRecognizer::kFloat32x4ArrayGetIndexed:
|
||||
if (!CanUnboxInt32()) return false;
|
||||
return TryInlineGetIndexed(kind, call, ic_data, entry, last);
|
||||
default:
|
||||
return false;
|
||||
|
@ -1176,44 +1178,22 @@ bool FlowGraphOptimizer::TryInlineGetIndexed(MethodRecognizer::Kind kind,
|
|||
|
||||
|
||||
bool FlowGraphOptimizer::TryReplaceWithLoadIndexed(InstanceCallInstr* call) {
|
||||
const intptr_t class_id = ReceiverClassId(call);
|
||||
switch (class_id) {
|
||||
case kArrayCid:
|
||||
case kImmutableArrayCid:
|
||||
case kGrowableObjectArrayCid:
|
||||
case kTypedDataFloat32ArrayCid:
|
||||
case kTypedDataFloat64ArrayCid:
|
||||
case kTypedDataInt8ArrayCid:
|
||||
case kTypedDataUint8ArrayCid:
|
||||
case kTypedDataUint8ClampedArrayCid:
|
||||
case kExternalTypedDataUint8ArrayCid:
|
||||
case kExternalTypedDataUint8ClampedArrayCid:
|
||||
case kTypedDataInt16ArrayCid:
|
||||
case kTypedDataUint16ArrayCid:
|
||||
break;
|
||||
case kTypedDataFloat32x4ArrayCid:
|
||||
if (!ShouldInlineSimd()) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case kTypedDataInt32ArrayCid:
|
||||
case kTypedDataUint32ArrayCid:
|
||||
if (!CanUnboxInt32()) return false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
// Check for monomorphic IC data.
|
||||
if (!call->HasICData()) return false;
|
||||
const ICData& ic_data = ICData::Handle(call->ic_data()->AsUnaryClassChecks());
|
||||
if (ic_data.NumberOfChecks() != 1) return false;
|
||||
ASSERT(ic_data.HasOneTarget());
|
||||
|
||||
const Function& target =
|
||||
Function::Handle(call->ic_data()->GetTargetAt(0));
|
||||
const Function& target = Function::Handle(ic_data.GetTargetAt(0));
|
||||
TargetEntryInstr* entry;
|
||||
Definition* last;
|
||||
ASSERT(class_id == MethodKindToCid(MethodRecognizer::RecognizeKind(target)));
|
||||
bool success = TryInlineRecognizedMethod(target,
|
||||
call,
|
||||
*call->ic_data(),
|
||||
&entry, &last);
|
||||
ASSERT(success);
|
||||
if (!TryInlineRecognizedMethod(target,
|
||||
call,
|
||||
*call->ic_data(),
|
||||
&entry, &last)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Insert receiver class check.
|
||||
AddReceiverCheck(call);
|
||||
// Remove the original push arguments.
|
||||
|
|
|
@ -9803,7 +9803,6 @@ RawICData* ICData::AsUnaryClassChecksForArgNr(intptr_t arg_nr) const {
|
|||
Array::Handle(arguments_descriptor()),
|
||||
deopt_id(),
|
||||
kNumArgsTested));
|
||||
result.set_deopt_reason(deopt_reason());
|
||||
const intptr_t len = NumberOfChecks();
|
||||
for (intptr_t i = 0; i < len; i++) {
|
||||
const intptr_t class_id = GetClassIdAt(i, arg_nr);
|
||||
|
@ -9829,7 +9828,7 @@ RawICData* ICData::AsUnaryClassChecksForArgNr(intptr_t arg_nr) const {
|
|||
}
|
||||
}
|
||||
// Copy deoptimization reason.
|
||||
result.set_deopt_reason(this->deopt_reason());
|
||||
result.set_deopt_reason(deopt_reason());
|
||||
|
||||
return result.raw();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
//
|
||||
// Dart test program for testing native float arrays.
|
||||
|
||||
// VMOptions=--optimization_counter_threshold=10
|
||||
|
||||
// Library tag to be able to run in html test framework.
|
||||
library FloatArrayTest;
|
||||
|
||||
|
@ -186,23 +188,34 @@ storeIt64(Float64List a, int index, value) {
|
|||
a[index] = value;
|
||||
}
|
||||
|
||||
testPolymorphicLoad(var list) {
|
||||
return list[0];
|
||||
}
|
||||
|
||||
main() {
|
||||
var a32 = new Float32List(5);
|
||||
for (int i = 0; i < 2000; i++) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
testCreateFloat32Array();
|
||||
testSetRange32();
|
||||
testIndexOutOfRange32();
|
||||
testIndexOf32();
|
||||
storeIt32(a32, 1, 2.0);
|
||||
testPolymorphicLoad(a32);
|
||||
}
|
||||
var a64 = new Float64List(5);
|
||||
for (int i = 0; i < 2000; i++) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
testCreateFloat64Array();
|
||||
testSetRange64();
|
||||
testIndexOutOfRange64();
|
||||
testIndexOf64();
|
||||
storeIt64(a64, 1, 2.0);
|
||||
testPolymorphicLoad(a64);
|
||||
}
|
||||
var f32x4 = new Float32x4List(5);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
testPolymorphicLoad(f32x4);
|
||||
}
|
||||
|
||||
// These two take a long time in checked mode.
|
||||
testBadValues32();
|
||||
testBadValues64();
|
||||
|
|
Loading…
Reference in a new issue