| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 // Test that we can move a Smi value literally into a register. | 151 // Test that we can move a Smi value literally into a register. |
| 152 TEST(SmiMove) { | 152 TEST(SmiMove) { |
| 153 v8::internal::V8::Initialize(NULL); | 153 v8::internal::V8::Initialize(NULL); |
| 154 // Allocate an executable page of memory. | 154 // Allocate an executable page of memory. |
| 155 size_t actual_size; | 155 size_t actual_size; |
| 156 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 156 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 157 &actual_size, | 157 &actual_size, |
| 158 true)); | 158 true)); |
| 159 CHECK(buffer); | 159 CHECK(buffer); |
| 160 Isolate* isolate = Isolate::Current(); | 160 Isolate* isolate = CcTest::i_isolate(); |
| 161 HandleScope handles(isolate); | 161 HandleScope handles(isolate); |
| 162 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 162 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 163 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. | 163 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. |
| 164 masm->set_allow_stub_calls(false); | 164 masm->set_allow_stub_calls(false); |
| 165 EntryCode(masm); | 165 EntryCode(masm); |
| 166 Label exit; | 166 Label exit; |
| 167 | 167 |
| 168 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); | 168 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); |
| 169 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); | 169 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); |
| 170 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); | 170 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // Test that we can compare smis for equality (and more). | 239 // Test that we can compare smis for equality (and more). |
| 240 TEST(SmiCompare) { | 240 TEST(SmiCompare) { |
| 241 v8::internal::V8::Initialize(NULL); | 241 v8::internal::V8::Initialize(NULL); |
| 242 // Allocate an executable page of memory. | 242 // Allocate an executable page of memory. |
| 243 size_t actual_size; | 243 size_t actual_size; |
| 244 byte* buffer = | 244 byte* buffer = |
| 245 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 245 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 246 &actual_size, | 246 &actual_size, |
| 247 true)); | 247 true)); |
| 248 CHECK(buffer); | 248 CHECK(buffer); |
| 249 Isolate* isolate = Isolate::Current(); | 249 Isolate* isolate = CcTest::i_isolate(); |
| 250 HandleScope handles(isolate); | 250 HandleScope handles(isolate); |
| 251 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 251 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 252 | 252 |
| 253 MacroAssembler* masm = &assembler; | 253 MacroAssembler* masm = &assembler; |
| 254 masm->set_allow_stub_calls(false); | 254 masm->set_allow_stub_calls(false); |
| 255 EntryCode(masm); | 255 EntryCode(masm); |
| 256 Label exit; | 256 Label exit; |
| 257 | 257 |
| 258 TestSmiCompare(masm, &exit, 0x10, 0, 0); | 258 TestSmiCompare(masm, &exit, 0x10, 0, 0); |
| 259 TestSmiCompare(masm, &exit, 0x20, 0, 1); | 259 TestSmiCompare(masm, &exit, 0x20, 0, 1); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 290 | 290 |
| 291 | 291 |
| 292 TEST(Integer32ToSmi) { | 292 TEST(Integer32ToSmi) { |
| 293 v8::internal::V8::Initialize(NULL); | 293 v8::internal::V8::Initialize(NULL); |
| 294 // Allocate an executable page of memory. | 294 // Allocate an executable page of memory. |
| 295 size_t actual_size; | 295 size_t actual_size; |
| 296 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 296 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 297 &actual_size, | 297 &actual_size, |
| 298 true)); | 298 true)); |
| 299 CHECK(buffer); | 299 CHECK(buffer); |
| 300 Isolate* isolate = Isolate::Current(); | 300 Isolate* isolate = CcTest::i_isolate(); |
| 301 HandleScope handles(isolate); | 301 HandleScope handles(isolate); |
| 302 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 302 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 303 | 303 |
| 304 MacroAssembler* masm = &assembler; | 304 MacroAssembler* masm = &assembler; |
| 305 masm->set_allow_stub_calls(false); | 305 masm->set_allow_stub_calls(false); |
| 306 EntryCode(masm); | 306 EntryCode(masm); |
| 307 Label exit; | 307 Label exit; |
| 308 | 308 |
| 309 __ movq(rax, Immediate(1)); // Test number. | 309 __ movq(rax, Immediate(1)); // Test number. |
| 310 __ movl(rcx, Immediate(0)); | 310 __ movl(rcx, Immediate(0)); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 | 420 |
| 421 TEST(Integer64PlusConstantToSmi) { | 421 TEST(Integer64PlusConstantToSmi) { |
| 422 v8::internal::V8::Initialize(NULL); | 422 v8::internal::V8::Initialize(NULL); |
| 423 // Allocate an executable page of memory. | 423 // Allocate an executable page of memory. |
| 424 size_t actual_size; | 424 size_t actual_size; |
| 425 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 425 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 426 &actual_size, | 426 &actual_size, |
| 427 true)); | 427 true)); |
| 428 CHECK(buffer); | 428 CHECK(buffer); |
| 429 Isolate* isolate = Isolate::Current(); | 429 Isolate* isolate = CcTest::i_isolate(); |
| 430 HandleScope handles(isolate); | 430 HandleScope handles(isolate); |
| 431 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 431 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 432 | 432 |
| 433 MacroAssembler* masm = &assembler; | 433 MacroAssembler* masm = &assembler; |
| 434 masm->set_allow_stub_calls(false); | 434 masm->set_allow_stub_calls(false); |
| 435 EntryCode(masm); | 435 EntryCode(masm); |
| 436 Label exit; | 436 Label exit; |
| 437 | 437 |
| 438 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2; | 438 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2; |
| 439 | 439 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 464 | 464 |
| 465 | 465 |
| 466 TEST(SmiCheck) { | 466 TEST(SmiCheck) { |
| 467 v8::internal::V8::Initialize(NULL); | 467 v8::internal::V8::Initialize(NULL); |
| 468 // Allocate an executable page of memory. | 468 // Allocate an executable page of memory. |
| 469 size_t actual_size; | 469 size_t actual_size; |
| 470 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 470 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 471 &actual_size, | 471 &actual_size, |
| 472 true)); | 472 true)); |
| 473 CHECK(buffer); | 473 CHECK(buffer); |
| 474 Isolate* isolate = Isolate::Current(); | 474 Isolate* isolate = CcTest::i_isolate(); |
| 475 HandleScope handles(isolate); | 475 HandleScope handles(isolate); |
| 476 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 476 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 477 | 477 |
| 478 MacroAssembler* masm = &assembler; | 478 MacroAssembler* masm = &assembler; |
| 479 masm->set_allow_stub_calls(false); | 479 masm->set_allow_stub_calls(false); |
| 480 EntryCode(masm); | 480 EntryCode(masm); |
| 481 Label exit; | 481 Label exit; |
| 482 Condition cond; | 482 Condition cond; |
| 483 | 483 |
| 484 __ movl(rax, Immediate(1)); // Test number. | 484 __ movl(rax, Immediate(1)); // Test number. |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 | 713 |
| 714 TEST(SmiNeg) { | 714 TEST(SmiNeg) { |
| 715 v8::internal::V8::Initialize(NULL); | 715 v8::internal::V8::Initialize(NULL); |
| 716 // Allocate an executable page of memory. | 716 // Allocate an executable page of memory. |
| 717 size_t actual_size; | 717 size_t actual_size; |
| 718 byte* buffer = | 718 byte* buffer = |
| 719 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 719 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 720 &actual_size, | 720 &actual_size, |
| 721 true)); | 721 true)); |
| 722 CHECK(buffer); | 722 CHECK(buffer); |
| 723 Isolate* isolate = Isolate::Current(); | 723 Isolate* isolate = CcTest::i_isolate(); |
| 724 HandleScope handles(isolate); | 724 HandleScope handles(isolate); |
| 725 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 725 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 726 | 726 |
| 727 MacroAssembler* masm = &assembler; | 727 MacroAssembler* masm = &assembler; |
| 728 masm->set_allow_stub_calls(false); | 728 masm->set_allow_stub_calls(false); |
| 729 EntryCode(masm); | 729 EntryCode(masm); |
| 730 Label exit; | 730 Label exit; |
| 731 | 731 |
| 732 TestSmiNeg(masm, &exit, 0x10, 0); | 732 TestSmiNeg(masm, &exit, 0x10, 0); |
| 733 TestSmiNeg(masm, &exit, 0x20, 1); | 733 TestSmiNeg(masm, &exit, 0x20, 1); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 | 803 |
| 804 | 804 |
| 805 TEST(SmiAdd) { | 805 TEST(SmiAdd) { |
| 806 v8::internal::V8::Initialize(NULL); | 806 v8::internal::V8::Initialize(NULL); |
| 807 // Allocate an executable page of memory. | 807 // Allocate an executable page of memory. |
| 808 size_t actual_size; | 808 size_t actual_size; |
| 809 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 809 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 810 &actual_size, | 810 &actual_size, |
| 811 true)); | 811 true)); |
| 812 CHECK(buffer); | 812 CHECK(buffer); |
| 813 Isolate* isolate = Isolate::Current(); | 813 Isolate* isolate = CcTest::i_isolate(); |
| 814 HandleScope handles(isolate); | 814 HandleScope handles(isolate); |
| 815 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 815 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 816 | 816 |
| 817 MacroAssembler* masm = &assembler; | 817 MacroAssembler* masm = &assembler; |
| 818 masm->set_allow_stub_calls(false); | 818 masm->set_allow_stub_calls(false); |
| 819 EntryCode(masm); | 819 EntryCode(masm); |
| 820 Label exit; | 820 Label exit; |
| 821 | 821 |
| 822 // No-overflow tests. | 822 // No-overflow tests. |
| 823 SmiAddTest(masm, &exit, 0x10, 1, 2); | 823 SmiAddTest(masm, &exit, 0x10, 1, 2); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 | 994 |
| 995 TEST(SmiSub) { | 995 TEST(SmiSub) { |
| 996 v8::internal::V8::Initialize(NULL); | 996 v8::internal::V8::Initialize(NULL); |
| 997 // Allocate an executable page of memory. | 997 // Allocate an executable page of memory. |
| 998 size_t actual_size; | 998 size_t actual_size; |
| 999 byte* buffer = | 999 byte* buffer = |
| 1000 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1000 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 1001 &actual_size, | 1001 &actual_size, |
| 1002 true)); | 1002 true)); |
| 1003 CHECK(buffer); | 1003 CHECK(buffer); |
| 1004 Isolate* isolate = Isolate::Current(); | 1004 Isolate* isolate = CcTest::i_isolate(); |
| 1005 HandleScope handles(isolate); | 1005 HandleScope handles(isolate); |
| 1006 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1006 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1007 | 1007 |
| 1008 MacroAssembler* masm = &assembler; | 1008 MacroAssembler* masm = &assembler; |
| 1009 masm->set_allow_stub_calls(false); | 1009 masm->set_allow_stub_calls(false); |
| 1010 EntryCode(masm); | 1010 EntryCode(masm); |
| 1011 Label exit; | 1011 Label exit; |
| 1012 | 1012 |
| 1013 SmiSubTest(masm, &exit, 0x10, 1, 2); | 1013 SmiSubTest(masm, &exit, 0x10, 1, 2); |
| 1014 SmiSubTest(masm, &exit, 0x20, 1, -2); | 1014 SmiSubTest(masm, &exit, 0x20, 1, -2); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 | 1085 |
| 1086 | 1086 |
| 1087 TEST(SmiMul) { | 1087 TEST(SmiMul) { |
| 1088 v8::internal::V8::Initialize(NULL); | 1088 v8::internal::V8::Initialize(NULL); |
| 1089 // Allocate an executable page of memory. | 1089 // Allocate an executable page of memory. |
| 1090 size_t actual_size; | 1090 size_t actual_size; |
| 1091 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1091 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 1092 &actual_size, | 1092 &actual_size, |
| 1093 true)); | 1093 true)); |
| 1094 CHECK(buffer); | 1094 CHECK(buffer); |
| 1095 Isolate* isolate = Isolate::Current(); | 1095 Isolate* isolate = CcTest::i_isolate(); |
| 1096 HandleScope handles(isolate); | 1096 HandleScope handles(isolate); |
| 1097 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1097 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1098 | 1098 |
| 1099 MacroAssembler* masm = &assembler; | 1099 MacroAssembler* masm = &assembler; |
| 1100 masm->set_allow_stub_calls(false); | 1100 masm->set_allow_stub_calls(false); |
| 1101 EntryCode(masm); | 1101 EntryCode(masm); |
| 1102 Label exit; | 1102 Label exit; |
| 1103 | 1103 |
| 1104 TestSmiMul(masm, &exit, 0x10, 0, 0); | 1104 TestSmiMul(masm, &exit, 0x10, 0, 0); |
| 1105 TestSmiMul(masm, &exit, 0x20, -1, 0); | 1105 TestSmiMul(masm, &exit, 0x20, -1, 0); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 | 1192 |
| 1193 TEST(SmiDiv) { | 1193 TEST(SmiDiv) { |
| 1194 v8::internal::V8::Initialize(NULL); | 1194 v8::internal::V8::Initialize(NULL); |
| 1195 // Allocate an executable page of memory. | 1195 // Allocate an executable page of memory. |
| 1196 size_t actual_size; | 1196 size_t actual_size; |
| 1197 byte* buffer = | 1197 byte* buffer = |
| 1198 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1198 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 1199 &actual_size, | 1199 &actual_size, |
| 1200 true)); | 1200 true)); |
| 1201 CHECK(buffer); | 1201 CHECK(buffer); |
| 1202 Isolate* isolate = Isolate::Current(); | 1202 Isolate* isolate = CcTest::i_isolate(); |
| 1203 HandleScope handles(isolate); | 1203 HandleScope handles(isolate); |
| 1204 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1204 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1205 | 1205 |
| 1206 MacroAssembler* masm = &assembler; | 1206 MacroAssembler* masm = &assembler; |
| 1207 masm->set_allow_stub_calls(false); | 1207 masm->set_allow_stub_calls(false); |
| 1208 EntryCode(masm); | 1208 EntryCode(masm); |
| 1209 Label exit; | 1209 Label exit; |
| 1210 | 1210 |
| 1211 __ push(r14); | 1211 __ push(r14); |
| 1212 __ push(r15); | 1212 __ push(r15); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 | 1303 |
| 1304 TEST(SmiMod) { | 1304 TEST(SmiMod) { |
| 1305 v8::internal::V8::Initialize(NULL); | 1305 v8::internal::V8::Initialize(NULL); |
| 1306 // Allocate an executable page of memory. | 1306 // Allocate an executable page of memory. |
| 1307 size_t actual_size; | 1307 size_t actual_size; |
| 1308 byte* buffer = | 1308 byte* buffer = |
| 1309 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1309 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 1310 &actual_size, | 1310 &actual_size, |
| 1311 true)); | 1311 true)); |
| 1312 CHECK(buffer); | 1312 CHECK(buffer); |
| 1313 Isolate* isolate = Isolate::Current(); | 1313 Isolate* isolate = CcTest::i_isolate(); |
| 1314 HandleScope handles(isolate); | 1314 HandleScope handles(isolate); |
| 1315 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1315 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1316 | 1316 |
| 1317 MacroAssembler* masm = &assembler; | 1317 MacroAssembler* masm = &assembler; |
| 1318 masm->set_allow_stub_calls(false); | 1318 masm->set_allow_stub_calls(false); |
| 1319 EntryCode(masm); | 1319 EntryCode(masm); |
| 1320 Label exit; | 1320 Label exit; |
| 1321 | 1321 |
| 1322 __ push(r14); | 1322 __ push(r14); |
| 1323 __ push(r15); | 1323 __ push(r15); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 | 1401 |
| 1402 TEST(SmiIndex) { | 1402 TEST(SmiIndex) { |
| 1403 v8::internal::V8::Initialize(NULL); | 1403 v8::internal::V8::Initialize(NULL); |
| 1404 // Allocate an executable page of memory. | 1404 // Allocate an executable page of memory. |
| 1405 size_t actual_size; | 1405 size_t actual_size; |
| 1406 byte* buffer = | 1406 byte* buffer = |
| 1407 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, | 1407 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, |
| 1408 &actual_size, | 1408 &actual_size, |
| 1409 true)); | 1409 true)); |
| 1410 CHECK(buffer); | 1410 CHECK(buffer); |
| 1411 Isolate* isolate = Isolate::Current(); | 1411 Isolate* isolate = CcTest::i_isolate(); |
| 1412 HandleScope handles(isolate); | 1412 HandleScope handles(isolate); |
| 1413 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1413 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1414 | 1414 |
| 1415 MacroAssembler* masm = &assembler; | 1415 MacroAssembler* masm = &assembler; |
| 1416 masm->set_allow_stub_calls(false); | 1416 masm->set_allow_stub_calls(false); |
| 1417 EntryCode(masm); | 1417 EntryCode(masm); |
| 1418 Label exit; | 1418 Label exit; |
| 1419 | 1419 |
| 1420 TestSmiIndex(masm, &exit, 0x10, 0); | 1420 TestSmiIndex(masm, &exit, 0x10, 0); |
| 1421 TestSmiIndex(masm, &exit, 0x20, 1); | 1421 TestSmiIndex(masm, &exit, 0x20, 1); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 | 1471 |
| 1472 TEST(SmiSelectNonSmi) { | 1472 TEST(SmiSelectNonSmi) { |
| 1473 v8::internal::V8::Initialize(NULL); | 1473 v8::internal::V8::Initialize(NULL); |
| 1474 // Allocate an executable page of memory. | 1474 // Allocate an executable page of memory. |
| 1475 size_t actual_size; | 1475 size_t actual_size; |
| 1476 byte* buffer = | 1476 byte* buffer = |
| 1477 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1477 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 1478 &actual_size, | 1478 &actual_size, |
| 1479 true)); | 1479 true)); |
| 1480 CHECK(buffer); | 1480 CHECK(buffer); |
| 1481 Isolate* isolate = Isolate::Current(); | 1481 Isolate* isolate = CcTest::i_isolate(); |
| 1482 HandleScope handles(isolate); | 1482 HandleScope handles(isolate); |
| 1483 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1483 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1484 | 1484 |
| 1485 MacroAssembler* masm = &assembler; | 1485 MacroAssembler* masm = &assembler; |
| 1486 masm->set_allow_stub_calls(false); // Avoid inline checks. | 1486 masm->set_allow_stub_calls(false); // Avoid inline checks. |
| 1487 EntryCode(masm); | 1487 EntryCode(masm); |
| 1488 Label exit; | 1488 Label exit; |
| 1489 | 1489 |
| 1490 TestSelectNonSmi(masm, &exit, 0x10, 0, 0); | 1490 TestSelectNonSmi(masm, &exit, 0x10, 0, 0); |
| 1491 TestSelectNonSmi(masm, &exit, 0x20, 0, 1); | 1491 TestSelectNonSmi(masm, &exit, 0x20, 0, 1); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 | 1551 |
| 1552 TEST(SmiAnd) { | 1552 TEST(SmiAnd) { |
| 1553 v8::internal::V8::Initialize(NULL); | 1553 v8::internal::V8::Initialize(NULL); |
| 1554 // Allocate an executable page of memory. | 1554 // Allocate an executable page of memory. |
| 1555 size_t actual_size; | 1555 size_t actual_size; |
| 1556 byte* buffer = | 1556 byte* buffer = |
| 1557 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1557 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 1558 &actual_size, | 1558 &actual_size, |
| 1559 true)); | 1559 true)); |
| 1560 CHECK(buffer); | 1560 CHECK(buffer); |
| 1561 Isolate* isolate = Isolate::Current(); | 1561 Isolate* isolate = CcTest::i_isolate(); |
| 1562 HandleScope handles(isolate); | 1562 HandleScope handles(isolate); |
| 1563 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1563 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1564 | 1564 |
| 1565 MacroAssembler* masm = &assembler; | 1565 MacroAssembler* masm = &assembler; |
| 1566 masm->set_allow_stub_calls(false); | 1566 masm->set_allow_stub_calls(false); |
| 1567 EntryCode(masm); | 1567 EntryCode(masm); |
| 1568 Label exit; | 1568 Label exit; |
| 1569 | 1569 |
| 1570 TestSmiAnd(masm, &exit, 0x10, 0, 0); | 1570 TestSmiAnd(masm, &exit, 0x10, 0, 0); |
| 1571 TestSmiAnd(masm, &exit, 0x20, 0, 1); | 1571 TestSmiAnd(masm, &exit, 0x20, 0, 1); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 | 1633 |
| 1634 TEST(SmiOr) { | 1634 TEST(SmiOr) { |
| 1635 v8::internal::V8::Initialize(NULL); | 1635 v8::internal::V8::Initialize(NULL); |
| 1636 // Allocate an executable page of memory. | 1636 // Allocate an executable page of memory. |
| 1637 size_t actual_size; | 1637 size_t actual_size; |
| 1638 byte* buffer = | 1638 byte* buffer = |
| 1639 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1639 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 1640 &actual_size, | 1640 &actual_size, |
| 1641 true)); | 1641 true)); |
| 1642 CHECK(buffer); | 1642 CHECK(buffer); |
| 1643 Isolate* isolate = Isolate::Current(); | 1643 Isolate* isolate = CcTest::i_isolate(); |
| 1644 HandleScope handles(isolate); | 1644 HandleScope handles(isolate); |
| 1645 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1645 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1646 | 1646 |
| 1647 MacroAssembler* masm = &assembler; | 1647 MacroAssembler* masm = &assembler; |
| 1648 masm->set_allow_stub_calls(false); | 1648 masm->set_allow_stub_calls(false); |
| 1649 EntryCode(masm); | 1649 EntryCode(masm); |
| 1650 Label exit; | 1650 Label exit; |
| 1651 | 1651 |
| 1652 TestSmiOr(masm, &exit, 0x10, 0, 0); | 1652 TestSmiOr(masm, &exit, 0x10, 0, 0); |
| 1653 TestSmiOr(masm, &exit, 0x20, 0, 1); | 1653 TestSmiOr(masm, &exit, 0x20, 0, 1); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 | 1717 |
| 1718 TEST(SmiXor) { | 1718 TEST(SmiXor) { |
| 1719 v8::internal::V8::Initialize(NULL); | 1719 v8::internal::V8::Initialize(NULL); |
| 1720 // Allocate an executable page of memory. | 1720 // Allocate an executable page of memory. |
| 1721 size_t actual_size; | 1721 size_t actual_size; |
| 1722 byte* buffer = | 1722 byte* buffer = |
| 1723 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1723 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 1724 &actual_size, | 1724 &actual_size, |
| 1725 true)); | 1725 true)); |
| 1726 CHECK(buffer); | 1726 CHECK(buffer); |
| 1727 Isolate* isolate = Isolate::Current(); | 1727 Isolate* isolate = CcTest::i_isolate(); |
| 1728 HandleScope handles(isolate); | 1728 HandleScope handles(isolate); |
| 1729 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1729 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1730 | 1730 |
| 1731 MacroAssembler* masm = &assembler; | 1731 MacroAssembler* masm = &assembler; |
| 1732 masm->set_allow_stub_calls(false); | 1732 masm->set_allow_stub_calls(false); |
| 1733 EntryCode(masm); | 1733 EntryCode(masm); |
| 1734 Label exit; | 1734 Label exit; |
| 1735 | 1735 |
| 1736 TestSmiXor(masm, &exit, 0x10, 0, 0); | 1736 TestSmiXor(masm, &exit, 0x10, 0, 0); |
| 1737 TestSmiXor(masm, &exit, 0x20, 0, 1); | 1737 TestSmiXor(masm, &exit, 0x20, 0, 1); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 | 1785 |
| 1786 TEST(SmiNot) { | 1786 TEST(SmiNot) { |
| 1787 v8::internal::V8::Initialize(NULL); | 1787 v8::internal::V8::Initialize(NULL); |
| 1788 // Allocate an executable page of memory. | 1788 // Allocate an executable page of memory. |
| 1789 size_t actual_size; | 1789 size_t actual_size; |
| 1790 byte* buffer = | 1790 byte* buffer = |
| 1791 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1791 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
| 1792 &actual_size, | 1792 &actual_size, |
| 1793 true)); | 1793 true)); |
| 1794 CHECK(buffer); | 1794 CHECK(buffer); |
| 1795 Isolate* isolate = Isolate::Current(); | 1795 Isolate* isolate = CcTest::i_isolate(); |
| 1796 HandleScope handles(isolate); | 1796 HandleScope handles(isolate); |
| 1797 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1797 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1798 | 1798 |
| 1799 MacroAssembler* masm = &assembler; | 1799 MacroAssembler* masm = &assembler; |
| 1800 masm->set_allow_stub_calls(false); | 1800 masm->set_allow_stub_calls(false); |
| 1801 EntryCode(masm); | 1801 EntryCode(masm); |
| 1802 Label exit; | 1802 Label exit; |
| 1803 | 1803 |
| 1804 TestSmiNot(masm, &exit, 0x10, 0); | 1804 TestSmiNot(masm, &exit, 0x10, 0); |
| 1805 TestSmiNot(masm, &exit, 0x20, 1); | 1805 TestSmiNot(masm, &exit, 0x20, 1); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1882 | 1882 |
| 1883 TEST(SmiShiftLeft) { | 1883 TEST(SmiShiftLeft) { |
| 1884 v8::internal::V8::Initialize(NULL); | 1884 v8::internal::V8::Initialize(NULL); |
| 1885 // Allocate an executable page of memory. | 1885 // Allocate an executable page of memory. |
| 1886 size_t actual_size; | 1886 size_t actual_size; |
| 1887 byte* buffer = | 1887 byte* buffer = |
| 1888 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, | 1888 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, |
| 1889 &actual_size, | 1889 &actual_size, |
| 1890 true)); | 1890 true)); |
| 1891 CHECK(buffer); | 1891 CHECK(buffer); |
| 1892 Isolate* isolate = Isolate::Current(); | 1892 Isolate* isolate = CcTest::i_isolate(); |
| 1893 HandleScope handles(isolate); | 1893 HandleScope handles(isolate); |
| 1894 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1894 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 1895 | 1895 |
| 1896 MacroAssembler* masm = &assembler; | 1896 MacroAssembler* masm = &assembler; |
| 1897 masm->set_allow_stub_calls(false); | 1897 masm->set_allow_stub_calls(false); |
| 1898 EntryCode(masm); | 1898 EntryCode(masm); |
| 1899 Label exit; | 1899 Label exit; |
| 1900 | 1900 |
| 1901 TestSmiShiftLeft(masm, &exit, 0x10, 0); | 1901 TestSmiShiftLeft(masm, &exit, 0x10, 0); |
| 1902 TestSmiShiftLeft(masm, &exit, 0x50, 1); | 1902 TestSmiShiftLeft(masm, &exit, 0x50, 1); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 | 1989 |
| 1990 TEST(SmiShiftLogicalRight) { | 1990 TEST(SmiShiftLogicalRight) { |
| 1991 v8::internal::V8::Initialize(NULL); | 1991 v8::internal::V8::Initialize(NULL); |
| 1992 // Allocate an executable page of memory. | 1992 // Allocate an executable page of memory. |
| 1993 size_t actual_size; | 1993 size_t actual_size; |
| 1994 byte* buffer = | 1994 byte* buffer = |
| 1995 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, | 1995 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, |
| 1996 &actual_size, | 1996 &actual_size, |
| 1997 true)); | 1997 true)); |
| 1998 CHECK(buffer); | 1998 CHECK(buffer); |
| 1999 Isolate* isolate = Isolate::Current(); | 1999 Isolate* isolate = CcTest::i_isolate(); |
| 2000 HandleScope handles(isolate); | 2000 HandleScope handles(isolate); |
| 2001 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 2001 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 2002 | 2002 |
| 2003 MacroAssembler* masm = &assembler; | 2003 MacroAssembler* masm = &assembler; |
| 2004 masm->set_allow_stub_calls(false); | 2004 masm->set_allow_stub_calls(false); |
| 2005 EntryCode(masm); | 2005 EntryCode(masm); |
| 2006 Label exit; | 2006 Label exit; |
| 2007 | 2007 |
| 2008 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0); | 2008 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0); |
| 2009 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1); | 2009 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 | 2059 |
| 2060 TEST(SmiShiftArithmeticRight) { | 2060 TEST(SmiShiftArithmeticRight) { |
| 2061 v8::internal::V8::Initialize(NULL); | 2061 v8::internal::V8::Initialize(NULL); |
| 2062 // Allocate an executable page of memory. | 2062 // Allocate an executable page of memory. |
| 2063 size_t actual_size; | 2063 size_t actual_size; |
| 2064 byte* buffer = | 2064 byte* buffer = |
| 2065 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 2065 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 2066 &actual_size, | 2066 &actual_size, |
| 2067 true)); | 2067 true)); |
| 2068 CHECK(buffer); | 2068 CHECK(buffer); |
| 2069 Isolate* isolate = Isolate::Current(); | 2069 Isolate* isolate = CcTest::i_isolate(); |
| 2070 HandleScope handles(isolate); | 2070 HandleScope handles(isolate); |
| 2071 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 2071 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 2072 | 2072 |
| 2073 MacroAssembler* masm = &assembler; | 2073 MacroAssembler* masm = &assembler; |
| 2074 masm->set_allow_stub_calls(false); | 2074 masm->set_allow_stub_calls(false); |
| 2075 EntryCode(masm); | 2075 EntryCode(masm); |
| 2076 Label exit; | 2076 Label exit; |
| 2077 | 2077 |
| 2078 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0); | 2078 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0); |
| 2079 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1); | 2079 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 | 2124 |
| 2125 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { | 2125 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { |
| 2126 v8::internal::V8::Initialize(NULL); | 2126 v8::internal::V8::Initialize(NULL); |
| 2127 // Allocate an executable page of memory. | 2127 // Allocate an executable page of memory. |
| 2128 size_t actual_size; | 2128 size_t actual_size; |
| 2129 byte* buffer = | 2129 byte* buffer = |
| 2130 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, | 2130 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, |
| 2131 &actual_size, | 2131 &actual_size, |
| 2132 true)); | 2132 true)); |
| 2133 CHECK(buffer); | 2133 CHECK(buffer); |
| 2134 Isolate* isolate = Isolate::Current(); | 2134 Isolate* isolate = CcTest::i_isolate(); |
| 2135 HandleScope handles(isolate); | 2135 HandleScope handles(isolate); |
| 2136 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 2136 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 2137 | 2137 |
| 2138 MacroAssembler* masm = &assembler; | 2138 MacroAssembler* masm = &assembler; |
| 2139 masm->set_allow_stub_calls(false); | 2139 masm->set_allow_stub_calls(false); |
| 2140 EntryCode(masm); | 2140 EntryCode(masm); |
| 2141 Label exit; | 2141 Label exit; |
| 2142 | 2142 |
| 2143 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0); | 2143 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0); |
| 2144 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1); | 2144 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2168 int data[256]; | 2168 int data[256]; |
| 2169 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } | 2169 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } |
| 2170 | 2170 |
| 2171 // Allocate an executable page of memory. | 2171 // Allocate an executable page of memory. |
| 2172 size_t actual_size; | 2172 size_t actual_size; |
| 2173 byte* buffer = | 2173 byte* buffer = |
| 2174 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 2174 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
| 2175 &actual_size, | 2175 &actual_size, |
| 2176 true)); | 2176 true)); |
| 2177 CHECK(buffer); | 2177 CHECK(buffer); |
| 2178 Isolate* isolate = Isolate::Current(); | 2178 Isolate* isolate = CcTest::i_isolate(); |
| 2179 HandleScope handles(isolate); | 2179 HandleScope handles(isolate); |
| 2180 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 2180 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
| 2181 | 2181 |
| 2182 MacroAssembler* masm = &assembler; | 2182 MacroAssembler* masm = &assembler; |
| 2183 masm->set_allow_stub_calls(false); | 2183 masm->set_allow_stub_calls(false); |
| 2184 Label exit; | 2184 Label exit; |
| 2185 | 2185 |
| 2186 EntryCode(masm); | 2186 EntryCode(masm); |
| 2187 __ push(r13); | 2187 __ push(r13); |
| 2188 __ push(r14); | 2188 __ push(r14); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2515 CodeDesc desc; | 2515 CodeDesc desc; |
| 2516 masm->GetCode(&desc); | 2516 masm->GetCode(&desc); |
| 2517 // Call the function from C++. | 2517 // Call the function from C++. |
| 2518 int result = FUNCTION_CAST<F0>(buffer)(); | 2518 int result = FUNCTION_CAST<F0>(buffer)(); |
| 2519 CHECK_EQ(0, result); | 2519 CHECK_EQ(0, result); |
| 2520 } | 2520 } |
| 2521 | 2521 |
| 2522 | 2522 |
| 2523 | 2523 |
| 2524 #undef __ | 2524 #undef __ |
| OLD | NEW |