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 17 matching lines...) Expand all Loading... |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 | 29 |
30 #include "v8.h" | 30 #include "v8.h" |
31 | 31 |
32 #include "macro-assembler.h" | 32 #include "macro-assembler.h" |
33 #include "factory.h" | 33 #include "factory.h" |
34 #include "platform.h" | 34 #include "platform.h" |
35 #include "serialize.h" | 35 #include "serialize.h" |
36 #include "cctest.h" | 36 #include "cctest.h" |
37 | 37 |
38 using v8::internal::Assembler; | 38 namespace i = v8::internal; |
39 using v8::internal::CodeDesc; | 39 using i::Assembler; |
40 using v8::internal::Condition; | 40 using i::CodeDesc; |
41 using v8::internal::FUNCTION_CAST; | 41 using i::Condition; |
42 using v8::internal::HandleScope; | 42 using i::FUNCTION_CAST; |
43 using v8::internal::Immediate; | 43 using i::HandleScope; |
44 using v8::internal::Isolate; | 44 using i::Immediate; |
45 using v8::internal::Label; | 45 using i::Isolate; |
46 using v8::internal::MacroAssembler; | 46 using i::Label; |
47 using v8::internal::OS; | 47 using i::MacroAssembler; |
48 using v8::internal::Operand; | 48 using i::OS; |
49 using v8::internal::RelocInfo; | 49 using i::Operand; |
50 using v8::internal::Smi; | 50 using i::RelocInfo; |
51 using v8::internal::SmiIndex; | 51 using i::Smi; |
52 using v8::internal::byte; | 52 using i::SmiIndex; |
53 using v8::internal::carry; | 53 using i::byte; |
54 using v8::internal::greater; | 54 using i::carry; |
55 using v8::internal::greater_equal; | 55 using i::greater; |
56 using v8::internal::kIntSize; | 56 using i::greater_equal; |
57 using v8::internal::kPointerSize; | 57 using i::kIntSize; |
58 using v8::internal::kSmiTagMask; | 58 using i::kPointerSize; |
59 using v8::internal::kSmiValueSize; | 59 using i::kSmiTagMask; |
60 using v8::internal::less_equal; | 60 using i::kSmiValueSize; |
61 using v8::internal::negative; | 61 using i::less_equal; |
62 using v8::internal::not_carry; | 62 using i::negative; |
63 using v8::internal::not_equal; | 63 using i::not_carry; |
64 using v8::internal::not_zero; | 64 using i::not_equal; |
65 using v8::internal::positive; | 65 using i::equal; |
66 using v8::internal::r11; | 66 using i::not_zero; |
67 using v8::internal::r13; | 67 using i::positive; |
68 using v8::internal::r14; | 68 using i::r11; |
69 using v8::internal::r15; | 69 using i::r13; |
70 using v8::internal::r8; | 70 using i::r14; |
71 using v8::internal::r9; | 71 using i::r15; |
72 using v8::internal::rax; | 72 using i::r8; |
73 using v8::internal::rbp; | 73 using i::r9; |
74 using v8::internal::rbx; | 74 using i::rax; |
75 using v8::internal::rcx; | 75 using i::rbp; |
76 using v8::internal::rdi; | 76 using i::rbx; |
77 using v8::internal::rdx; | 77 using i::rcx; |
78 using v8::internal::rsi; | 78 using i::rdi; |
79 using v8::internal::rsp; | 79 using i::rdx; |
80 using v8::internal::times_pointer_size; | 80 using i::rsi; |
| 81 using i::rsp; |
| 82 using i::times_pointer_size; |
81 | 83 |
82 // Test the x64 assembler by compiling some simple functions into | 84 // Test the x64 assembler by compiling some simple functions into |
83 // a buffer and executing them. These tests do not initialize the | 85 // a buffer and executing them. These tests do not initialize the |
84 // V8 library, create a context, or use any V8 objects. | 86 // V8 library, create a context, or use any V8 objects. |
85 // The AMD64 calling convention is used, with the first five arguments | 87 // The AMD64 calling convention is used, with the first five arguments |
86 // in RSI, RDI, RDX, RCX, R8, and R9, and floating point arguments in | 88 // in RSI, RDI, RDX, RCX, R8, and R9, and floating point arguments in |
87 // the XMM registers. The return value is in RAX. | 89 // the XMM registers. The return value is in RAX. |
88 // This calling convention is used on Linux, with GCC, and on Mac OS, | 90 // This calling convention is used on Linux, with GCC, and on Mac OS, |
89 // with GCC. A different convention is used on 64-bit windows. | 91 // with GCC. A different convention is used on 64-bit windows. |
90 | 92 |
91 typedef int (*F0)(); | 93 typedef int (*F0)(); |
92 | 94 |
93 #define __ masm-> | 95 #define __ masm-> |
94 | 96 |
95 | 97 |
96 static void EntryCode(MacroAssembler* masm) { | 98 static void EntryCode(MacroAssembler* masm) { |
97 // Smi constant register is callee save. | 99 // Smi constant register is callee save. |
98 __ push(v8::internal::kSmiConstantRegister); | 100 __ push(i::kSmiConstantRegister); |
99 __ push(v8::internal::kRootRegister); | 101 __ push(i::kRootRegister); |
100 __ InitializeSmiConstantRegister(); | 102 __ InitializeSmiConstantRegister(); |
101 __ InitializeRootRegister(); | 103 __ InitializeRootRegister(); |
102 } | 104 } |
103 | 105 |
104 | 106 |
105 static void ExitCode(MacroAssembler* masm) { | 107 static void ExitCode(MacroAssembler* masm) { |
106 // Return -1 if kSmiConstantRegister was clobbered during the test. | 108 // Return -1 if kSmiConstantRegister was clobbered during the test. |
107 __ Move(rdx, Smi::FromInt(1)); | 109 __ Move(rdx, Smi::FromInt(1)); |
108 __ cmpq(rdx, v8::internal::kSmiConstantRegister); | 110 __ cmpq(rdx, i::kSmiConstantRegister); |
109 __ movq(rdx, Immediate(-1)); | 111 __ movq(rdx, Immediate(-1)); |
110 __ cmovq(not_equal, rax, rdx); | 112 __ cmovq(not_equal, rax, rdx); |
111 __ pop(v8::internal::kRootRegister); | 113 __ pop(i::kRootRegister); |
112 __ pop(v8::internal::kSmiConstantRegister); | 114 __ pop(i::kSmiConstantRegister); |
113 } | 115 } |
114 | 116 |
115 | 117 |
116 TEST(Smi) { | 118 TEST(Smi) { |
117 // Check that C++ Smi operations work as expected. | 119 // Check that C++ Smi operations work as expected. |
118 int64_t test_numbers[] = { | 120 int64_t test_numbers[] = { |
119 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257, | 121 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257, |
120 Smi::kMaxValue, static_cast<int64_t>(Smi::kMaxValue) + 1, | 122 Smi::kMaxValue, static_cast<int64_t>(Smi::kMaxValue) + 1, |
121 Smi::kMinValue, static_cast<int64_t>(Smi::kMinValue) - 1 | 123 Smi::kMinValue, static_cast<int64_t>(Smi::kMinValue) - 1 |
122 }; | 124 }; |
(...skipping 20 matching lines...) Expand all Loading... |
143 __ movl(rax, Immediate(id)); | 145 __ movl(rax, Immediate(id)); |
144 __ Move(rcx, value); | 146 __ Move(rcx, value); |
145 __ Set(rdx, reinterpret_cast<intptr_t>(value)); | 147 __ Set(rdx, reinterpret_cast<intptr_t>(value)); |
146 __ cmpq(rcx, rdx); | 148 __ cmpq(rcx, rdx); |
147 __ j(not_equal, exit); | 149 __ j(not_equal, exit); |
148 } | 150 } |
149 | 151 |
150 | 152 |
151 // Test that we can move a Smi value literally into a register. | 153 // Test that we can move a Smi value literally into a register. |
152 TEST(SmiMove) { | 154 TEST(SmiMove) { |
153 v8::internal::V8::Initialize(NULL); | 155 i::V8::Initialize(NULL); |
154 // Allocate an executable page of memory. | 156 // Allocate an executable page of memory. |
155 size_t actual_size; | 157 size_t actual_size; |
156 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 158 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
157 &actual_size, | 159 &actual_size, |
158 true)); | 160 true)); |
159 CHECK(buffer); | 161 CHECK(buffer); |
160 Isolate* isolate = CcTest::i_isolate(); | 162 Isolate* isolate = CcTest::i_isolate(); |
161 HandleScope handles(isolate); | 163 HandleScope handles(isolate); |
162 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 164 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
163 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. | 165 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 __ j(not_equal, exit); | 233 __ j(not_equal, exit); |
232 __ incq(rax); | 234 __ incq(rax); |
233 __ cmpq(rcx, r8); | 235 __ cmpq(rcx, r8); |
234 __ j(not_equal, exit); | 236 __ j(not_equal, exit); |
235 } | 237 } |
236 } | 238 } |
237 | 239 |
238 | 240 |
239 // Test that we can compare smis for equality (and more). | 241 // Test that we can compare smis for equality (and more). |
240 TEST(SmiCompare) { | 242 TEST(SmiCompare) { |
241 v8::internal::V8::Initialize(NULL); | 243 i::V8::Initialize(NULL); |
242 // Allocate an executable page of memory. | 244 // Allocate an executable page of memory. |
243 size_t actual_size; | 245 size_t actual_size; |
244 byte* buffer = | 246 byte* buffer = |
245 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 247 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
246 &actual_size, | 248 &actual_size, |
247 true)); | 249 true)); |
248 CHECK(buffer); | 250 CHECK(buffer); |
249 Isolate* isolate = CcTest::i_isolate(); | 251 Isolate* isolate = CcTest::i_isolate(); |
250 HandleScope handles(isolate); | 252 HandleScope handles(isolate); |
251 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 253 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 CodeDesc desc; | 285 CodeDesc desc; |
284 masm->GetCode(&desc); | 286 masm->GetCode(&desc); |
285 // Call the function from C++. | 287 // Call the function from C++. |
286 int result = FUNCTION_CAST<F0>(buffer)(); | 288 int result = FUNCTION_CAST<F0>(buffer)(); |
287 CHECK_EQ(0, result); | 289 CHECK_EQ(0, result); |
288 } | 290 } |
289 | 291 |
290 | 292 |
291 | 293 |
292 TEST(Integer32ToSmi) { | 294 TEST(Integer32ToSmi) { |
293 v8::internal::V8::Initialize(NULL); | 295 i::V8::Initialize(NULL); |
294 // Allocate an executable page of memory. | 296 // Allocate an executable page of memory. |
295 size_t actual_size; | 297 size_t actual_size; |
296 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 298 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
297 &actual_size, | 299 &actual_size, |
298 true)); | 300 true)); |
299 CHECK(buffer); | 301 CHECK(buffer); |
300 Isolate* isolate = CcTest::i_isolate(); | 302 Isolate* isolate = CcTest::i_isolate(); |
301 HandleScope handles(isolate); | 303 HandleScope handles(isolate); |
302 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 304 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
303 | 305 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 __ j(not_equal, exit); | 414 __ j(not_equal, exit); |
413 | 415 |
414 __ incq(rax); | 416 __ incq(rax); |
415 __ Integer64PlusConstantToSmi(rcx, rcx, y); | 417 __ Integer64PlusConstantToSmi(rcx, rcx, y); |
416 __ cmpq(rcx, r8); | 418 __ cmpq(rcx, r8); |
417 __ j(not_equal, exit); | 419 __ j(not_equal, exit); |
418 } | 420 } |
419 | 421 |
420 | 422 |
421 TEST(Integer64PlusConstantToSmi) { | 423 TEST(Integer64PlusConstantToSmi) { |
422 v8::internal::V8::Initialize(NULL); | 424 i::V8::Initialize(NULL); |
423 // Allocate an executable page of memory. | 425 // Allocate an executable page of memory. |
424 size_t actual_size; | 426 size_t actual_size; |
425 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 427 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
426 &actual_size, | 428 &actual_size, |
427 true)); | 429 true)); |
428 CHECK(buffer); | 430 CHECK(buffer); |
429 Isolate* isolate = CcTest::i_isolate(); | 431 Isolate* isolate = CcTest::i_isolate(); |
430 HandleScope handles(isolate); | 432 HandleScope handles(isolate); |
431 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 433 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
432 | 434 |
(...skipping 24 matching lines...) Expand all Loading... |
457 | 459 |
458 CodeDesc desc; | 460 CodeDesc desc; |
459 masm->GetCode(&desc); | 461 masm->GetCode(&desc); |
460 // Call the function from C++. | 462 // Call the function from C++. |
461 int result = FUNCTION_CAST<F0>(buffer)(); | 463 int result = FUNCTION_CAST<F0>(buffer)(); |
462 CHECK_EQ(0, result); | 464 CHECK_EQ(0, result); |
463 } | 465 } |
464 | 466 |
465 | 467 |
466 TEST(SmiCheck) { | 468 TEST(SmiCheck) { |
467 v8::internal::V8::Initialize(NULL); | 469 i::V8::Initialize(NULL); |
468 // Allocate an executable page of memory. | 470 // Allocate an executable page of memory. |
469 size_t actual_size; | 471 size_t actual_size; |
470 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 472 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
471 &actual_size, | 473 &actual_size, |
472 true)); | 474 true)); |
473 CHECK(buffer); | 475 CHECK(buffer); |
474 Isolate* isolate = CcTest::i_isolate(); | 476 Isolate* isolate = CcTest::i_isolate(); |
475 HandleScope handles(isolate); | 477 HandleScope handles(isolate); |
476 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 478 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
477 | 479 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 __ jmp(exit); | 707 __ jmp(exit); |
706 __ bind(&smi_ok2); | 708 __ bind(&smi_ok2); |
707 __ incq(rax); | 709 __ incq(rax); |
708 __ cmpq(rcx, r8); | 710 __ cmpq(rcx, r8); |
709 __ j(not_equal, exit); | 711 __ j(not_equal, exit); |
710 } | 712 } |
711 } | 713 } |
712 | 714 |
713 | 715 |
714 TEST(SmiNeg) { | 716 TEST(SmiNeg) { |
715 v8::internal::V8::Initialize(NULL); | 717 i::V8::Initialize(NULL); |
716 // Allocate an executable page of memory. | 718 // Allocate an executable page of memory. |
717 size_t actual_size; | 719 size_t actual_size; |
718 byte* buffer = | 720 byte* buffer = |
719 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 721 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
720 &actual_size, | 722 &actual_size, |
721 true)); | 723 true)); |
722 CHECK(buffer); | 724 CHECK(buffer); |
723 Isolate* isolate = CcTest::i_isolate(); | 725 Isolate* isolate = CcTest::i_isolate(); |
724 HandleScope handles(isolate); | 726 HandleScope handles(isolate); |
725 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 727 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 __ jmp(exit); | 902 __ jmp(exit); |
901 __ bind(&overflow_ok); | 903 __ bind(&overflow_ok); |
902 __ incq(rax); | 904 __ incq(rax); |
903 __ cmpq(rcx, r11); | 905 __ cmpq(rcx, r11); |
904 __ j(not_equal, exit); | 906 __ j(not_equal, exit); |
905 } | 907 } |
906 } | 908 } |
907 | 909 |
908 | 910 |
909 TEST(SmiAdd) { | 911 TEST(SmiAdd) { |
910 v8::internal::V8::Initialize(NULL); | 912 i::V8::Initialize(NULL); |
911 // Allocate an executable page of memory. | 913 // Allocate an executable page of memory. |
912 size_t actual_size; | 914 size_t actual_size; |
913 byte* buffer = | 915 byte* buffer = |
914 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 916 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
915 &actual_size, | 917 &actual_size, |
916 true)); | 918 true)); |
917 CHECK(buffer); | 919 CHECK(buffer); |
918 Isolate* isolate = CcTest::i_isolate(); | 920 Isolate* isolate = CcTest::i_isolate(); |
919 HandleScope handles(isolate); | 921 HandleScope handles(isolate); |
920 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 922 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 __ incq(rax); // Test 2. | 981 __ incq(rax); // Test 2. |
980 __ SmiSubConstant(r9, rcx, Smi::FromInt(second)); | 982 __ SmiSubConstant(r9, rcx, Smi::FromInt(second)); |
981 __ cmpq(r9, r8); | 983 __ cmpq(r9, r8); |
982 __ j(not_equal, exit); | 984 __ j(not_equal, exit); |
983 | 985 |
984 __ incq(rax); // Test 3. | 986 __ incq(rax); // Test 3. |
985 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second)); | 987 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second)); |
986 __ cmpq(rcx, r8); | 988 __ cmpq(rcx, r8); |
987 __ j(not_equal, exit); | 989 __ j(not_equal, exit); |
988 | 990 |
| 991 i::SmiOperationExecutionMode mode; |
| 992 mode.Add(i::RESERVE_SOURCE_REGISTER); |
| 993 mode.Add(i::BAILOUT_ON_OVERFLOW); |
| 994 __ Move(rcx, Smi::FromInt(first)); |
| 995 __ incq(rax); // Test 4. |
| 996 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), mode, exit); |
| 997 __ cmpq(rcx, r8); |
| 998 __ j(not_equal, exit); |
| 999 |
989 __ Move(rcx, Smi::FromInt(first)); | 1000 __ Move(rcx, Smi::FromInt(first)); |
990 | 1001 __ incq(rax); // Test 5. |
991 __ incq(rax); // Test 4. | 1002 __ SmiSubConstant(r9, rcx, Smi::FromInt(second), mode, exit); |
992 __ SmiSubConstant(r9, rcx, Smi::FromInt(second), exit); | |
993 __ cmpq(r9, r8); | 1003 __ cmpq(r9, r8); |
994 __ j(not_equal, exit); | 1004 __ j(not_equal, exit); |
995 | 1005 |
996 __ incq(rax); // Test 5. | 1006 mode.RemoveAll(); |
997 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), exit); | 1007 mode.Add(i::RESERVE_SOURCE_REGISTER); |
| 1008 mode.Add(i::BAILOUT_ON_NO_OVERFLOW); |
| 1009 __ Move(rcx, Smi::FromInt(first)); |
| 1010 Label done; |
| 1011 __ incq(rax); // Test 6. |
| 1012 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), mode, &done); |
| 1013 __ jmp(exit); |
| 1014 __ bind(&done); |
998 __ cmpq(rcx, r8); | 1015 __ cmpq(rcx, r8); |
999 __ j(not_equal, exit); | 1016 __ j(not_equal, exit); |
1000 } | 1017 } |
1001 | 1018 |
1002 | 1019 |
1003 static void SmiSubOverflowTest(MacroAssembler* masm, | 1020 static void SmiSubOverflowTest(MacroAssembler* masm, |
1004 Label* exit, | 1021 Label* exit, |
1005 int id, | 1022 int id, |
1006 int x) { | 1023 int x) { |
1007 // Subtracts a Smi from x so that the subtraction overflows. | 1024 // Subtracts a Smi from x so that the subtraction overflows. |
(...skipping 19 matching lines...) Expand all Loading... |
1027 Label overflow_ok; | 1044 Label overflow_ok; |
1028 __ incq(rax); | 1045 __ incq(rax); |
1029 __ SmiSub(rcx, rcx, rdx, &overflow_ok); | 1046 __ SmiSub(rcx, rcx, rdx, &overflow_ok); |
1030 __ jmp(exit); | 1047 __ jmp(exit); |
1031 __ bind(&overflow_ok); | 1048 __ bind(&overflow_ok); |
1032 __ incq(rax); | 1049 __ incq(rax); |
1033 __ cmpq(rcx, r11); | 1050 __ cmpq(rcx, r11); |
1034 __ j(not_equal, exit); | 1051 __ j(not_equal, exit); |
1035 } | 1052 } |
1036 | 1053 |
| 1054 i::SmiOperationExecutionMode mode; |
| 1055 mode.Add(i::RESERVE_SOURCE_REGISTER); |
| 1056 mode.Add(i::BAILOUT_ON_OVERFLOW); |
| 1057 |
1037 __ movq(rcx, r11); | 1058 __ movq(rcx, r11); |
1038 { | 1059 { |
1039 Label overflow_ok; | 1060 Label overflow_ok; |
1040 __ incq(rax); | 1061 __ incq(rax); |
1041 __ SmiSubConstant(r9, rcx, Smi::FromInt(y_min), &overflow_ok); | 1062 __ SmiSubConstant(r9, rcx, Smi::FromInt(y_min), mode, &overflow_ok); |
1042 __ jmp(exit); | 1063 __ jmp(exit); |
1043 __ bind(&overflow_ok); | 1064 __ bind(&overflow_ok); |
1044 __ incq(rax); | 1065 __ incq(rax); |
1045 __ cmpq(rcx, r11); | 1066 __ cmpq(rcx, r11); |
1046 __ j(not_equal, exit); | 1067 __ j(not_equal, exit); |
1047 } | 1068 } |
1048 | 1069 |
1049 { | 1070 { |
1050 Label overflow_ok; | 1071 Label overflow_ok; |
1051 __ incq(rax); | 1072 __ incq(rax); |
1052 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_min), &overflow_ok); | 1073 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_min), mode, &overflow_ok); |
1053 __ jmp(exit); | 1074 __ jmp(exit); |
1054 __ bind(&overflow_ok); | 1075 __ bind(&overflow_ok); |
1055 __ incq(rax); | 1076 __ incq(rax); |
1056 __ cmpq(rcx, r11); | 1077 __ cmpq(rcx, r11); |
1057 __ j(not_equal, exit); | 1078 __ j(not_equal, exit); |
1058 } | 1079 } |
1059 | 1080 |
1060 __ Move(rdx, Smi::FromInt(y_max)); | 1081 __ Move(rdx, Smi::FromInt(y_max)); |
1061 | 1082 |
1062 { | 1083 { |
(...skipping 15 matching lines...) Expand all Loading... |
1078 __ bind(&overflow_ok); | 1099 __ bind(&overflow_ok); |
1079 __ incq(rax); | 1100 __ incq(rax); |
1080 __ cmpq(rcx, r11); | 1101 __ cmpq(rcx, r11); |
1081 __ j(not_equal, exit); | 1102 __ j(not_equal, exit); |
1082 } | 1103 } |
1083 | 1104 |
1084 __ movq(rcx, r11); | 1105 __ movq(rcx, r11); |
1085 { | 1106 { |
1086 Label overflow_ok; | 1107 Label overflow_ok; |
1087 __ incq(rax); | 1108 __ incq(rax); |
1088 __ SmiSubConstant(r9, rcx, Smi::FromInt(y_max), &overflow_ok); | 1109 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), mode, &overflow_ok); |
1089 __ jmp(exit); | 1110 __ jmp(exit); |
1090 __ bind(&overflow_ok); | 1111 __ bind(&overflow_ok); |
1091 __ incq(rax); | 1112 __ incq(rax); |
1092 __ cmpq(rcx, r11); | 1113 __ cmpq(rcx, r11); |
1093 __ j(not_equal, exit); | 1114 __ j(not_equal, exit); |
1094 } | 1115 } |
1095 | 1116 |
| 1117 mode.RemoveAll(); |
| 1118 mode.Add(i::BAILOUT_ON_OVERFLOW); |
| 1119 __ movq(rcx, r11); |
1096 { | 1120 { |
1097 Label overflow_ok; | 1121 Label overflow_ok; |
1098 __ incq(rax); | 1122 __ incq(rax); |
1099 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), &overflow_ok); | 1123 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), mode, &overflow_ok); |
1100 __ jmp(exit); | 1124 __ jmp(exit); |
1101 __ bind(&overflow_ok); | 1125 __ bind(&overflow_ok); |
1102 __ incq(rax); | 1126 __ incq(rax); |
1103 __ cmpq(rcx, r11); | 1127 __ cmpq(rcx, r11); |
1104 __ j(not_equal, exit); | 1128 __ j(equal, exit); |
1105 } | 1129 } |
1106 } | 1130 } |
1107 | 1131 |
1108 | 1132 |
1109 TEST(SmiSub) { | 1133 TEST(SmiSub) { |
1110 v8::internal::V8::Initialize(NULL); | 1134 i::V8::Initialize(NULL); |
1111 // Allocate an executable page of memory. | 1135 // Allocate an executable page of memory. |
1112 size_t actual_size; | 1136 size_t actual_size; |
1113 byte* buffer = | 1137 byte* buffer = |
1114 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1138 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
1115 &actual_size, | 1139 &actual_size, |
1116 true)); | 1140 true)); |
1117 CHECK(buffer); | 1141 CHECK(buffer); |
1118 Isolate* isolate = CcTest::i_isolate(); | 1142 Isolate* isolate = CcTest::i_isolate(); |
1119 HandleScope handles(isolate); | 1143 HandleScope handles(isolate); |
1120 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1144 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 __ bind(&overflow_ok2); | 1216 __ bind(&overflow_ok2); |
1193 // 31-bit version doesn't preserve rcx on failure. | 1217 // 31-bit version doesn't preserve rcx on failure. |
1194 // __ incq(rax); | 1218 // __ incq(rax); |
1195 // __ cmpq(r11, rcx); | 1219 // __ cmpq(r11, rcx); |
1196 // __ j(not_equal, exit); | 1220 // __ j(not_equal, exit); |
1197 } | 1221 } |
1198 } | 1222 } |
1199 | 1223 |
1200 | 1224 |
1201 TEST(SmiMul) { | 1225 TEST(SmiMul) { |
1202 v8::internal::V8::Initialize(NULL); | 1226 i::V8::Initialize(NULL); |
1203 // Allocate an executable page of memory. | 1227 // Allocate an executable page of memory. |
1204 size_t actual_size; | 1228 size_t actual_size; |
1205 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1229 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1206 &actual_size, | 1230 &actual_size, |
1207 true)); | 1231 true)); |
1208 CHECK(buffer); | 1232 CHECK(buffer); |
1209 Isolate* isolate = CcTest::i_isolate(); | 1233 Isolate* isolate = CcTest::i_isolate(); |
1210 HandleScope handles(isolate); | 1234 HandleScope handles(isolate); |
1211 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1235 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
1212 | 1236 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 __ bind(&fail_ok2); | 1322 __ bind(&fail_ok2); |
1299 | 1323 |
1300 __ incq(r15); | 1324 __ incq(r15); |
1301 __ cmpq(rcx, r11); | 1325 __ cmpq(rcx, r11); |
1302 __ j(not_equal, exit); | 1326 __ j(not_equal, exit); |
1303 } | 1327 } |
1304 } | 1328 } |
1305 | 1329 |
1306 | 1330 |
1307 TEST(SmiDiv) { | 1331 TEST(SmiDiv) { |
1308 v8::internal::V8::Initialize(NULL); | 1332 i::V8::Initialize(NULL); |
1309 // Allocate an executable page of memory. | 1333 // Allocate an executable page of memory. |
1310 size_t actual_size; | 1334 size_t actual_size; |
1311 byte* buffer = | 1335 byte* buffer = |
1312 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1336 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
1313 &actual_size, | 1337 &actual_size, |
1314 true)); | 1338 true)); |
1315 CHECK(buffer); | 1339 CHECK(buffer); |
1316 Isolate* isolate = CcTest::i_isolate(); | 1340 Isolate* isolate = CcTest::i_isolate(); |
1317 HandleScope handles(isolate); | 1341 HandleScope handles(isolate); |
1318 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1342 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 __ bind(&fail_ok2); | 1433 __ bind(&fail_ok2); |
1410 | 1434 |
1411 __ incq(r15); | 1435 __ incq(r15); |
1412 __ cmpq(rcx, r11); | 1436 __ cmpq(rcx, r11); |
1413 __ j(not_equal, exit); | 1437 __ j(not_equal, exit); |
1414 } | 1438 } |
1415 } | 1439 } |
1416 | 1440 |
1417 | 1441 |
1418 TEST(SmiMod) { | 1442 TEST(SmiMod) { |
1419 v8::internal::V8::Initialize(NULL); | 1443 i::V8::Initialize(NULL); |
1420 // Allocate an executable page of memory. | 1444 // Allocate an executable page of memory. |
1421 size_t actual_size; | 1445 size_t actual_size; |
1422 byte* buffer = | 1446 byte* buffer = |
1423 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1447 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
1424 &actual_size, | 1448 &actual_size, |
1425 true)); | 1449 true)); |
1426 CHECK(buffer); | 1450 CHECK(buffer); |
1427 Isolate* isolate = CcTest::i_isolate(); | 1451 Isolate* isolate = CcTest::i_isolate(); |
1428 HandleScope handles(isolate); | 1452 HandleScope handles(isolate); |
1429 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1453 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 __ shl(rcx, Immediate(index.scale)); | 1531 __ shl(rcx, Immediate(index.scale)); |
1508 __ Set(r8, static_cast<intptr_t>(-x) << i); | 1532 __ Set(r8, static_cast<intptr_t>(-x) << i); |
1509 __ cmpq(rcx, r8); | 1533 __ cmpq(rcx, r8); |
1510 __ j(not_equal, exit); | 1534 __ j(not_equal, exit); |
1511 __ incq(rax); | 1535 __ incq(rax); |
1512 } | 1536 } |
1513 } | 1537 } |
1514 | 1538 |
1515 | 1539 |
1516 TEST(SmiIndex) { | 1540 TEST(SmiIndex) { |
1517 v8::internal::V8::Initialize(NULL); | 1541 i::V8::Initialize(NULL); |
1518 // Allocate an executable page of memory. | 1542 // Allocate an executable page of memory. |
1519 size_t actual_size; | 1543 size_t actual_size; |
1520 byte* buffer = | 1544 byte* buffer = |
1521 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, | 1545 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, |
1522 &actual_size, | 1546 &actual_size, |
1523 true)); | 1547 true)); |
1524 CHECK(buffer); | 1548 CHECK(buffer); |
1525 Isolate* isolate = CcTest::i_isolate(); | 1549 Isolate* isolate = CcTest::i_isolate(); |
1526 HandleScope handles(isolate); | 1550 HandleScope handles(isolate); |
1527 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1551 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 __ Move(rdx, Smi::FromInt(y)); | 1601 __ Move(rdx, Smi::FromInt(y)); |
1578 __ xor_(rcx, Immediate(kSmiTagMask)); | 1602 __ xor_(rcx, Immediate(kSmiTagMask)); |
1579 __ xor_(rdx, Immediate(kSmiTagMask)); | 1603 __ xor_(rdx, Immediate(kSmiTagMask)); |
1580 __ SelectNonSmi(r9, rcx, rdx, &fail_ok); | 1604 __ SelectNonSmi(r9, rcx, rdx, &fail_ok); |
1581 __ jmp(exit); | 1605 __ jmp(exit); |
1582 __ bind(&fail_ok); | 1606 __ bind(&fail_ok); |
1583 } | 1607 } |
1584 | 1608 |
1585 | 1609 |
1586 TEST(SmiSelectNonSmi) { | 1610 TEST(SmiSelectNonSmi) { |
1587 v8::internal::V8::Initialize(NULL); | 1611 i::V8::Initialize(NULL); |
1588 // Allocate an executable page of memory. | 1612 // Allocate an executable page of memory. |
1589 size_t actual_size; | 1613 size_t actual_size; |
1590 byte* buffer = | 1614 byte* buffer = |
1591 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1615 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1592 &actual_size, | 1616 &actual_size, |
1593 true)); | 1617 true)); |
1594 CHECK(buffer); | 1618 CHECK(buffer); |
1595 Isolate* isolate = CcTest::i_isolate(); | 1619 Isolate* isolate = CcTest::i_isolate(); |
1596 HandleScope handles(isolate); | 1620 HandleScope handles(isolate); |
1597 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1621 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 __ j(not_equal, exit); | 1681 __ j(not_equal, exit); |
1658 | 1682 |
1659 __ incq(rax); | 1683 __ incq(rax); |
1660 __ SmiAndConstant(rcx, rcx, Smi::FromInt(y)); | 1684 __ SmiAndConstant(rcx, rcx, Smi::FromInt(y)); |
1661 __ cmpq(r8, rcx); | 1685 __ cmpq(r8, rcx); |
1662 __ j(not_equal, exit); | 1686 __ j(not_equal, exit); |
1663 } | 1687 } |
1664 | 1688 |
1665 | 1689 |
1666 TEST(SmiAnd) { | 1690 TEST(SmiAnd) { |
1667 v8::internal::V8::Initialize(NULL); | 1691 i::V8::Initialize(NULL); |
1668 // Allocate an executable page of memory. | 1692 // Allocate an executable page of memory. |
1669 size_t actual_size; | 1693 size_t actual_size; |
1670 byte* buffer = | 1694 byte* buffer = |
1671 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1695 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1672 &actual_size, | 1696 &actual_size, |
1673 true)); | 1697 true)); |
1674 CHECK(buffer); | 1698 CHECK(buffer); |
1675 Isolate* isolate = CcTest::i_isolate(); | 1699 Isolate* isolate = CcTest::i_isolate(); |
1676 HandleScope handles(isolate); | 1700 HandleScope handles(isolate); |
1677 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1701 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 __ j(not_equal, exit); | 1763 __ j(not_equal, exit); |
1740 | 1764 |
1741 __ incq(rax); | 1765 __ incq(rax); |
1742 __ SmiOrConstant(rcx, rcx, Smi::FromInt(y)); | 1766 __ SmiOrConstant(rcx, rcx, Smi::FromInt(y)); |
1743 __ cmpq(r8, rcx); | 1767 __ cmpq(r8, rcx); |
1744 __ j(not_equal, exit); | 1768 __ j(not_equal, exit); |
1745 } | 1769 } |
1746 | 1770 |
1747 | 1771 |
1748 TEST(SmiOr) { | 1772 TEST(SmiOr) { |
1749 v8::internal::V8::Initialize(NULL); | 1773 i::V8::Initialize(NULL); |
1750 // Allocate an executable page of memory. | 1774 // Allocate an executable page of memory. |
1751 size_t actual_size; | 1775 size_t actual_size; |
1752 byte* buffer = | 1776 byte* buffer = |
1753 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1777 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1754 &actual_size, | 1778 &actual_size, |
1755 true)); | 1779 true)); |
1756 CHECK(buffer); | 1780 CHECK(buffer); |
1757 Isolate* isolate = CcTest::i_isolate(); | 1781 Isolate* isolate = CcTest::i_isolate(); |
1758 HandleScope handles(isolate); | 1782 HandleScope handles(isolate); |
1759 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1783 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 __ j(not_equal, exit); | 1847 __ j(not_equal, exit); |
1824 | 1848 |
1825 __ incq(rax); | 1849 __ incq(rax); |
1826 __ SmiXorConstant(rcx, rcx, Smi::FromInt(y)); | 1850 __ SmiXorConstant(rcx, rcx, Smi::FromInt(y)); |
1827 __ cmpq(r8, rcx); | 1851 __ cmpq(r8, rcx); |
1828 __ j(not_equal, exit); | 1852 __ j(not_equal, exit); |
1829 } | 1853 } |
1830 | 1854 |
1831 | 1855 |
1832 TEST(SmiXor) { | 1856 TEST(SmiXor) { |
1833 v8::internal::V8::Initialize(NULL); | 1857 i::V8::Initialize(NULL); |
1834 // Allocate an executable page of memory. | 1858 // Allocate an executable page of memory. |
1835 size_t actual_size; | 1859 size_t actual_size; |
1836 byte* buffer = | 1860 byte* buffer = |
1837 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1861 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1838 &actual_size, | 1862 &actual_size, |
1839 true)); | 1863 true)); |
1840 CHECK(buffer); | 1864 CHECK(buffer); |
1841 Isolate* isolate = CcTest::i_isolate(); | 1865 Isolate* isolate = CcTest::i_isolate(); |
1842 HandleScope handles(isolate); | 1866 HandleScope handles(isolate); |
1843 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1867 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 __ j(not_equal, exit); | 1915 __ j(not_equal, exit); |
1892 | 1916 |
1893 __ incq(rax); | 1917 __ incq(rax); |
1894 __ SmiNot(rcx, rcx); | 1918 __ SmiNot(rcx, rcx); |
1895 __ cmpq(rcx, r8); | 1919 __ cmpq(rcx, r8); |
1896 __ j(not_equal, exit); | 1920 __ j(not_equal, exit); |
1897 } | 1921 } |
1898 | 1922 |
1899 | 1923 |
1900 TEST(SmiNot) { | 1924 TEST(SmiNot) { |
1901 v8::internal::V8::Initialize(NULL); | 1925 i::V8::Initialize(NULL); |
1902 // Allocate an executable page of memory. | 1926 // Allocate an executable page of memory. |
1903 size_t actual_size; | 1927 size_t actual_size; |
1904 byte* buffer = | 1928 byte* buffer = |
1905 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1929 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1906 &actual_size, | 1930 &actual_size, |
1907 true)); | 1931 true)); |
1908 CHECK(buffer); | 1932 CHECK(buffer); |
1909 Isolate* isolate = CcTest::i_isolate(); | 1933 Isolate* isolate = CcTest::i_isolate(); |
1910 HandleScope handles(isolate); | 1934 HandleScope handles(isolate); |
1911 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 1935 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 __ incq(rax); | 2012 __ incq(rax); |
1989 __ cmpq(rdx, r8); | 2013 __ cmpq(rdx, r8); |
1990 __ j(not_equal, exit); | 2014 __ j(not_equal, exit); |
1991 | 2015 |
1992 __ incq(rax); | 2016 __ incq(rax); |
1993 } | 2017 } |
1994 } | 2018 } |
1995 | 2019 |
1996 | 2020 |
1997 TEST(SmiShiftLeft) { | 2021 TEST(SmiShiftLeft) { |
1998 v8::internal::V8::Initialize(NULL); | 2022 i::V8::Initialize(NULL); |
1999 // Allocate an executable page of memory. | 2023 // Allocate an executable page of memory. |
2000 size_t actual_size; | 2024 size_t actual_size; |
2001 byte* buffer = | 2025 byte* buffer = |
2002 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, | 2026 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, |
2003 &actual_size, | 2027 &actual_size, |
2004 true)); | 2028 true)); |
2005 CHECK(buffer); | 2029 CHECK(buffer); |
2006 Isolate* isolate = CcTest::i_isolate(); | 2030 Isolate* isolate = CcTest::i_isolate(); |
2007 HandleScope handles(isolate); | 2031 HandleScope handles(isolate); |
2008 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 2032 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 __ cmpq(rcx, r11); | 2119 __ cmpq(rcx, r11); |
2096 __ j(not_equal, exit); | 2120 __ j(not_equal, exit); |
2097 | 2121 |
2098 __ addq(rax, Immediate(3)); | 2122 __ addq(rax, Immediate(3)); |
2099 } | 2123 } |
2100 } | 2124 } |
2101 } | 2125 } |
2102 | 2126 |
2103 | 2127 |
2104 TEST(SmiShiftLogicalRight) { | 2128 TEST(SmiShiftLogicalRight) { |
2105 v8::internal::V8::Initialize(NULL); | 2129 i::V8::Initialize(NULL); |
2106 // Allocate an executable page of memory. | 2130 // Allocate an executable page of memory. |
2107 size_t actual_size; | 2131 size_t actual_size; |
2108 byte* buffer = | 2132 byte* buffer = |
2109 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, | 2133 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, |
2110 &actual_size, | 2134 &actual_size, |
2111 true)); | 2135 true)); |
2112 CHECK(buffer); | 2136 CHECK(buffer); |
2113 Isolate* isolate = CcTest::i_isolate(); | 2137 Isolate* isolate = CcTest::i_isolate(); |
2114 HandleScope handles(isolate); | 2138 HandleScope handles(isolate); |
2115 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 2139 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 | 2189 |
2166 __ cmpq(rdx, r8); | 2190 __ cmpq(rdx, r8); |
2167 __ j(not_equal, exit); | 2191 __ j(not_equal, exit); |
2168 | 2192 |
2169 __ incq(rax); | 2193 __ incq(rax); |
2170 } | 2194 } |
2171 } | 2195 } |
2172 | 2196 |
2173 | 2197 |
2174 TEST(SmiShiftArithmeticRight) { | 2198 TEST(SmiShiftArithmeticRight) { |
2175 v8::internal::V8::Initialize(NULL); | 2199 i::V8::Initialize(NULL); |
2176 // Allocate an executable page of memory. | 2200 // Allocate an executable page of memory. |
2177 size_t actual_size; | 2201 size_t actual_size; |
2178 byte* buffer = | 2202 byte* buffer = |
2179 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 2203 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
2180 &actual_size, | 2204 &actual_size, |
2181 true)); | 2205 true)); |
2182 CHECK(buffer); | 2206 CHECK(buffer); |
2183 Isolate* isolate = CcTest::i_isolate(); | 2207 Isolate* isolate = CcTest::i_isolate(); |
2184 HandleScope handles(isolate); | 2208 HandleScope handles(isolate); |
2185 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 2209 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 __ incq(rax); | 2254 __ incq(rax); |
2231 __ PositiveSmiTimesPowerOfTwoToInteger64(rcx, rcx, power); | 2255 __ PositiveSmiTimesPowerOfTwoToInteger64(rcx, rcx, power); |
2232 __ cmpq(rdx, r8); | 2256 __ cmpq(rdx, r8); |
2233 __ j(not_equal, exit); | 2257 __ j(not_equal, exit); |
2234 __ incq(rax); | 2258 __ incq(rax); |
2235 } | 2259 } |
2236 } | 2260 } |
2237 | 2261 |
2238 | 2262 |
2239 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { | 2263 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { |
2240 v8::internal::V8::Initialize(NULL); | 2264 i::V8::Initialize(NULL); |
2241 // Allocate an executable page of memory. | 2265 // Allocate an executable page of memory. |
2242 size_t actual_size; | 2266 size_t actual_size; |
2243 byte* buffer = | 2267 byte* buffer = |
2244 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, | 2268 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, |
2245 &actual_size, | 2269 &actual_size, |
2246 true)); | 2270 true)); |
2247 CHECK(buffer); | 2271 CHECK(buffer); |
2248 Isolate* isolate = CcTest::i_isolate(); | 2272 Isolate* isolate = CcTest::i_isolate(); |
2249 HandleScope handles(isolate); | 2273 HandleScope handles(isolate); |
2250 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 2274 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); |
(...skipping 20 matching lines...) Expand all Loading... |
2271 | 2295 |
2272 CodeDesc desc; | 2296 CodeDesc desc; |
2273 masm->GetCode(&desc); | 2297 masm->GetCode(&desc); |
2274 // Call the function from C++. | 2298 // Call the function from C++. |
2275 int result = FUNCTION_CAST<F0>(buffer)(); | 2299 int result = FUNCTION_CAST<F0>(buffer)(); |
2276 CHECK_EQ(0, result); | 2300 CHECK_EQ(0, result); |
2277 } | 2301 } |
2278 | 2302 |
2279 | 2303 |
2280 TEST(OperandOffset) { | 2304 TEST(OperandOffset) { |
2281 v8::internal::V8::Initialize(NULL); | 2305 i::V8::Initialize(NULL); |
2282 int data[256]; | 2306 int data[256]; |
2283 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } | 2307 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } |
2284 | 2308 |
2285 // Allocate an executable page of memory. | 2309 // Allocate an executable page of memory. |
2286 size_t actual_size; | 2310 size_t actual_size; |
2287 byte* buffer = | 2311 byte* buffer = |
2288 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 2312 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
2289 &actual_size, | 2313 &actual_size, |
2290 true)); | 2314 true)); |
2291 CHECK(buffer); | 2315 CHECK(buffer); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 CodeDesc desc; | 2653 CodeDesc desc; |
2630 masm->GetCode(&desc); | 2654 masm->GetCode(&desc); |
2631 // Call the function from C++. | 2655 // Call the function from C++. |
2632 int result = FUNCTION_CAST<F0>(buffer)(); | 2656 int result = FUNCTION_CAST<F0>(buffer)(); |
2633 CHECK_EQ(0, result); | 2657 CHECK_EQ(0, result); |
2634 } | 2658 } |
2635 | 2659 |
2636 | 2660 |
2637 | 2661 |
2638 #undef __ | 2662 #undef __ |
OLD | NEW |