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

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

Issue 735543003: Range feedback for binary integer operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: ready for review Created 6 years 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 | Annotate | Revision Log
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/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 3381 matching lines...) Expand 10 before | Expand all | Expand 10 after
3392 __ ret(); 3392 __ ret();
3393 } 3393 }
3394 3394
3395 3395
3396 ASSEMBLER_TEST_RUN(BitTest, test) { 3396 ASSEMBLER_TEST_RUN(BitTest, test) {
3397 typedef int (*BitTest)(); 3397 typedef int (*BitTest)();
3398 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())()); 3398 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())());
3399 } 3399 }
3400 3400
3401 3401
3402 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
3403 Label miss, done;
3404 __ movl(ECX, Address(ESP, 1 * kWordSize));
3405
3406 __ pushl(ESI);
3407 __ pushl(EDI);
3408 __ ComputeRange(EAX, ECX, ESI, EDI, &miss);
3409 __ jmp(&done);
3410
3411 __ Bind(&miss);
3412 __ movl(EAX, Immediate(-1));
3413
3414 __ Bind(&done);
3415 __ popl(EDI);
3416 __ popl(ESI);
3417 __ ret();
3418 }
3419
3420
3421 ASSEMBLER_TEST_RUN(ComputeRange, test) {
3422 typedef intptr_t (*ComputeRange)(RawObject* value);
3423 ComputeRange range_of = reinterpret_cast<ComputeRange>(test->entry());
3424
3425 EXPECT_EQ(0, range_of(Smi::New(0)));
3426 EXPECT_EQ(0, range_of(Smi::New(1)));
3427 EXPECT_EQ(ICData::kSignBit, range_of(Smi::New(-1)));
3428 EXPECT_EQ(0, range_of(Smi::New(Smi::kMaxValue)));
3429 EXPECT_EQ(ICData::kSignBit, range_of(Smi::New(Smi::kMinValue)));
3430
3431 EXPECT_EQ(ICData::kInt32Bit, range_of(Integer::New(Smi::kMaxValue + 1)));
3432 EXPECT_EQ(ICData::kInt32Bit | ICData::kSignBit,
3433 range_of(Integer::New(Smi::kMinValue - 1)));
3434 EXPECT_EQ(ICData::kInt32Bit, range_of(Integer::New(kMaxInt32)));
3435 EXPECT_EQ(ICData::kInt32Bit | ICData::kSignBit,
3436 range_of(Integer::New(kMinInt32)));
3437
3438 EXPECT_EQ(ICData::kUint32Bit,
3439 range_of(Integer::New(static_cast<int64_t>(kMaxInt32) + 1)));
3440 EXPECT_EQ(ICData::kUint32Bit, range_of(Integer::New(kMaxUint32)));
3441
3442 EXPECT_EQ(ICData::kInt64Bit,
3443 range_of(Integer::New(static_cast<int64_t>(kMaxUint32) + 1)));
3444 EXPECT_EQ(ICData::kInt64Bit,
3445 range_of(Integer::New(static_cast<int64_t>(kMinInt32) - 1)));
3446 EXPECT_EQ(ICData::kInt64Bit, range_of(Integer::New(kMaxInt64)));
3447 EXPECT_EQ(ICData::kInt64Bit, range_of(Integer::New(kMinInt64)));
3448
3449 EXPECT_EQ(-1, range_of(Bool::True().raw()));
3450 }
3451
3452
3402 } // namespace dart 3453 } // namespace dart
3403 3454
3404 #endif // defined TARGET_ARCH_IA32 3455 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698