OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 __ SmiAddConstant(r9, rcx, Smi::FromInt(second), exit); | 794 __ SmiAddConstant(r9, rcx, Smi::FromInt(second), exit); |
795 __ cmpq(r9, r8); | 795 __ cmpq(r9, r8); |
796 __ j(not_equal, exit); | 796 __ j(not_equal, exit); |
797 | 797 |
798 __ incq(rax); | 798 __ incq(rax); |
799 __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), exit); | 799 __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), exit); |
800 __ cmpq(rcx, r8); | 800 __ cmpq(rcx, r8); |
801 __ j(not_equal, exit); | 801 __ j(not_equal, exit); |
802 } | 802 } |
803 | 803 |
| 804 |
804 TEST(SmiAdd) { | 805 TEST(SmiAdd) { |
805 v8::internal::V8::Initialize(NULL); | 806 v8::internal::V8::Initialize(NULL); |
806 // Allocate an executable page of memory. | 807 // Allocate an executable page of memory. |
807 size_t actual_size; | 808 size_t actual_size; |
808 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 809 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
809 &actual_size, | 810 &actual_size, |
810 true)); | 811 true)); |
811 CHECK(buffer); | 812 CHECK(buffer); |
812 Isolate* isolate = Isolate::Current(); | 813 Isolate* isolate = Isolate::Current(); |
813 HandleScope handles(isolate); | 814 HandleScope handles(isolate); |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 index = masm->SmiToNegativeIndex(rcx, rcx, i); | 1391 index = masm->SmiToNegativeIndex(rcx, rcx, i); |
1391 ASSERT(index.reg.is(rcx)); | 1392 ASSERT(index.reg.is(rcx)); |
1392 __ shl(rcx, Immediate(index.scale)); | 1393 __ shl(rcx, Immediate(index.scale)); |
1393 __ Set(r8, static_cast<intptr_t>(-x) << i); | 1394 __ Set(r8, static_cast<intptr_t>(-x) << i); |
1394 __ cmpq(rcx, r8); | 1395 __ cmpq(rcx, r8); |
1395 __ j(not_equal, exit); | 1396 __ j(not_equal, exit); |
1396 __ incq(rax); | 1397 __ incq(rax); |
1397 } | 1398 } |
1398 } | 1399 } |
1399 | 1400 |
| 1401 |
1400 TEST(SmiIndex) { | 1402 TEST(SmiIndex) { |
1401 v8::internal::V8::Initialize(NULL); | 1403 v8::internal::V8::Initialize(NULL); |
1402 // Allocate an executable page of memory. | 1404 // Allocate an executable page of memory. |
1403 size_t actual_size; | 1405 size_t actual_size; |
1404 byte* buffer = | 1406 byte* buffer = |
1405 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, | 1407 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, |
1406 &actual_size, | 1408 &actual_size, |
1407 true)); | 1409 true)); |
1408 CHECK(buffer); | 1410 CHECK(buffer); |
1409 Isolate* isolate = Isolate::Current(); | 1411 Isolate* isolate = Isolate::Current(); |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 CodeDesc desc; | 2515 CodeDesc desc; |
2514 masm->GetCode(&desc); | 2516 masm->GetCode(&desc); |
2515 // Call the function from C++. | 2517 // Call the function from C++. |
2516 int result = FUNCTION_CAST<F0>(buffer)(); | 2518 int result = FUNCTION_CAST<F0>(buffer)(); |
2517 CHECK_EQ(0, result); | 2519 CHECK_EQ(0, result); |
2518 } | 2520 } |
2519 | 2521 |
2520 | 2522 |
2521 | 2523 |
2522 #undef __ | 2524 #undef __ |
OLD | NEW |