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; |
| 39 using v8::internal::CodeDesc; |
| 40 using v8::internal::Condition; |
| 41 using v8::internal::FUNCTION_CAST; |
| 42 using v8::internal::HandleScope; |
| 43 using v8::internal::Immediate; |
| 44 using v8::internal::Isolate; |
| 45 using v8::internal::Label; |
| 46 using v8::internal::MacroAssembler; |
| 47 using v8::internal::OS; |
| 48 using v8::internal::Operand; |
| 49 using v8::internal::RelocInfo; |
| 50 using v8::internal::Smi; |
| 51 using v8::internal::SmiIndex; |
38 using v8::internal::byte; | 52 using v8::internal::byte; |
39 using v8::internal::OS; | 53 using v8::internal::carry; |
40 using v8::internal::Assembler; | 54 using v8::internal::greater; |
41 using v8::internal::Condition; | 55 using v8::internal::greater_equal; |
42 using v8::internal::MacroAssembler; | 56 using v8::internal::kIntSize; |
43 using v8::internal::HandleScope; | 57 using v8::internal::kPointerSize; |
44 using v8::internal::Operand; | 58 using v8::internal::kSmiTagMask; |
45 using v8::internal::Immediate; | 59 using v8::internal::kSmiValueSize; |
46 using v8::internal::SmiIndex; | 60 using v8::internal::less_equal; |
47 using v8::internal::Label; | 61 using v8::internal::negative; |
48 using v8::internal::RelocInfo; | 62 using v8::internal::not_carry; |
49 using v8::internal::rax; | 63 using v8::internal::not_equal; |
50 using v8::internal::rbx; | 64 using v8::internal::not_zero; |
51 using v8::internal::rsi; | 65 using v8::internal::positive; |
52 using v8::internal::rdi; | |
53 using v8::internal::rcx; | |
54 using v8::internal::rdx; | |
55 using v8::internal::rbp; | |
56 using v8::internal::rsp; | |
57 using v8::internal::r8; | |
58 using v8::internal::r9; | |
59 using v8::internal::r11; | 66 using v8::internal::r11; |
60 using v8::internal::r13; | 67 using v8::internal::r13; |
61 using v8::internal::r14; | 68 using v8::internal::r14; |
62 using v8::internal::r15; | 69 using v8::internal::r15; |
| 70 using v8::internal::r8; |
| 71 using v8::internal::r9; |
| 72 using v8::internal::rax; |
| 73 using v8::internal::rbp; |
| 74 using v8::internal::rbx; |
| 75 using v8::internal::rcx; |
| 76 using v8::internal::rdi; |
| 77 using v8::internal::rdx; |
| 78 using v8::internal::rsi; |
| 79 using v8::internal::rsp; |
63 using v8::internal::times_pointer_size; | 80 using v8::internal::times_pointer_size; |
64 using v8::internal::FUNCTION_CAST; | |
65 using v8::internal::CodeDesc; | |
66 using v8::internal::less_equal; | |
67 using v8::internal::not_equal; | |
68 using v8::internal::not_zero; | |
69 using v8::internal::greater; | |
70 using v8::internal::greater_equal; | |
71 using v8::internal::carry; | |
72 using v8::internal::not_carry; | |
73 using v8::internal::negative; | |
74 using v8::internal::positive; | |
75 using v8::internal::Smi; | |
76 using v8::internal::kSmiTagMask; | |
77 using v8::internal::kSmiValueSize; | |
78 using v8::internal::kPointerSize; | |
79 using v8::internal::kIntSize; | |
80 | 81 |
81 // Test the x64 assembler by compiling some simple functions into | 82 // Test the x64 assembler by compiling some simple functions into |
82 // a buffer and executing them. These tests do not initialize the | 83 // a buffer and executing them. These tests do not initialize the |
83 // V8 library, create a context, or use any V8 objects. | 84 // V8 library, create a context, or use any V8 objects. |
84 // The AMD64 calling convention is used, with the first five arguments | 85 // The AMD64 calling convention is used, with the first five arguments |
85 // in RSI, RDI, RDX, RCX, R8, and R9, and floating point arguments in | 86 // in RSI, RDI, RDX, RCX, R8, and R9, and floating point arguments in |
86 // the XMM registers. The return value is in RAX. | 87 // the XMM registers. The return value is in RAX. |
87 // This calling convention is used on Linux, with GCC, and on Mac OS, | 88 // This calling convention is used on Linux, with GCC, and on Mac OS, |
88 // with GCC. A different convention is used on 64-bit windows. | 89 // with GCC. A different convention is used on 64-bit windows. |
89 | 90 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // 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. |
151 TEST(SmiMove) { | 152 TEST(SmiMove) { |
152 v8::internal::V8::Initialize(NULL); | 153 v8::internal::V8::Initialize(NULL); |
153 // Allocate an executable page of memory. | 154 // Allocate an executable page of memory. |
154 size_t actual_size; | 155 size_t actual_size; |
155 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 156 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
156 &actual_size, | 157 &actual_size, |
157 true)); | 158 true)); |
158 CHECK(buffer); | 159 CHECK(buffer); |
159 HandleScope handles; | 160 HandleScope handles; |
160 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 161 MacroAssembler assembler(Isolate::Current(), |
| 162 buffer, |
| 163 static_cast<int>(actual_size)); |
161 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. | 164 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. |
162 masm->set_allow_stub_calls(false); | 165 masm->set_allow_stub_calls(false); |
163 EntryCode(masm); | 166 EntryCode(masm); |
164 Label exit; | 167 Label exit; |
165 | 168 |
166 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); | 169 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); |
167 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); | 170 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); |
168 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); | 171 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); |
169 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); | 172 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); |
170 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256)); | 173 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256)); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 TEST(SmiCompare) { | 241 TEST(SmiCompare) { |
239 v8::internal::V8::Initialize(NULL); | 242 v8::internal::V8::Initialize(NULL); |
240 // Allocate an executable page of memory. | 243 // Allocate an executable page of memory. |
241 size_t actual_size; | 244 size_t actual_size; |
242 byte* buffer = | 245 byte* buffer = |
243 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 246 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
244 &actual_size, | 247 &actual_size, |
245 true)); | 248 true)); |
246 CHECK(buffer); | 249 CHECK(buffer); |
247 HandleScope handles; | 250 HandleScope handles; |
248 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 251 MacroAssembler assembler(Isolate::Current(), |
| 252 buffer, |
| 253 static_cast<int>(actual_size)); |
249 | 254 |
250 MacroAssembler* masm = &assembler; | 255 MacroAssembler* masm = &assembler; |
251 masm->set_allow_stub_calls(false); | 256 masm->set_allow_stub_calls(false); |
252 EntryCode(masm); | 257 EntryCode(masm); |
253 Label exit; | 258 Label exit; |
254 | 259 |
255 TestSmiCompare(masm, &exit, 0x10, 0, 0); | 260 TestSmiCompare(masm, &exit, 0x10, 0, 0); |
256 TestSmiCompare(masm, &exit, 0x20, 0, 1); | 261 TestSmiCompare(masm, &exit, 0x20, 0, 1); |
257 TestSmiCompare(masm, &exit, 0x30, 1, 0); | 262 TestSmiCompare(masm, &exit, 0x30, 1, 0); |
258 TestSmiCompare(masm, &exit, 0x40, 1, 1); | 263 TestSmiCompare(masm, &exit, 0x40, 1, 1); |
(...skipping 29 matching lines...) Expand all Loading... |
288 | 293 |
289 TEST(Integer32ToSmi) { | 294 TEST(Integer32ToSmi) { |
290 v8::internal::V8::Initialize(NULL); | 295 v8::internal::V8::Initialize(NULL); |
291 // Allocate an executable page of memory. | 296 // Allocate an executable page of memory. |
292 size_t actual_size; | 297 size_t actual_size; |
293 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 298 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
294 &actual_size, | 299 &actual_size, |
295 true)); | 300 true)); |
296 CHECK(buffer); | 301 CHECK(buffer); |
297 HandleScope handles; | 302 HandleScope handles; |
298 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 303 MacroAssembler assembler(Isolate::Current(), |
| 304 buffer, |
| 305 static_cast<int>(actual_size)); |
299 | 306 |
300 MacroAssembler* masm = &assembler; | 307 MacroAssembler* masm = &assembler; |
301 masm->set_allow_stub_calls(false); | 308 masm->set_allow_stub_calls(false); |
302 EntryCode(masm); | 309 EntryCode(masm); |
303 Label exit; | 310 Label exit; |
304 | 311 |
305 __ movq(rax, Immediate(1)); // Test number. | 312 __ movq(rax, Immediate(1)); // Test number. |
306 __ movl(rcx, Immediate(0)); | 313 __ movl(rcx, Immediate(0)); |
307 __ Integer32ToSmi(rcx, rcx); | 314 __ Integer32ToSmi(rcx, rcx); |
308 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); | 315 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 423 |
417 TEST(Integer64PlusConstantToSmi) { | 424 TEST(Integer64PlusConstantToSmi) { |
418 v8::internal::V8::Initialize(NULL); | 425 v8::internal::V8::Initialize(NULL); |
419 // Allocate an executable page of memory. | 426 // Allocate an executable page of memory. |
420 size_t actual_size; | 427 size_t actual_size; |
421 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 428 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
422 &actual_size, | 429 &actual_size, |
423 true)); | 430 true)); |
424 CHECK(buffer); | 431 CHECK(buffer); |
425 HandleScope handles; | 432 HandleScope handles; |
426 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 433 MacroAssembler assembler(Isolate::Current(), |
| 434 buffer, |
| 435 static_cast<int>(actual_size)); |
427 | 436 |
428 MacroAssembler* masm = &assembler; | 437 MacroAssembler* masm = &assembler; |
429 masm->set_allow_stub_calls(false); | 438 masm->set_allow_stub_calls(false); |
430 EntryCode(masm); | 439 EntryCode(masm); |
431 Label exit; | 440 Label exit; |
432 | 441 |
433 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2; | 442 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2; |
434 | 443 |
435 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0); | 444 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0); |
436 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1); | 445 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1); |
(...skipping 23 matching lines...) Expand all Loading... |
460 | 469 |
461 TEST(SmiCheck) { | 470 TEST(SmiCheck) { |
462 v8::internal::V8::Initialize(NULL); | 471 v8::internal::V8::Initialize(NULL); |
463 // Allocate an executable page of memory. | 472 // Allocate an executable page of memory. |
464 size_t actual_size; | 473 size_t actual_size; |
465 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 474 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
466 &actual_size, | 475 &actual_size, |
467 true)); | 476 true)); |
468 CHECK(buffer); | 477 CHECK(buffer); |
469 HandleScope handles; | 478 HandleScope handles; |
470 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 479 MacroAssembler assembler(Isolate::Current(), |
| 480 buffer, |
| 481 static_cast<int>(actual_size)); |
471 | 482 |
472 MacroAssembler* masm = &assembler; | 483 MacroAssembler* masm = &assembler; |
473 masm->set_allow_stub_calls(false); | 484 masm->set_allow_stub_calls(false); |
474 EntryCode(masm); | 485 EntryCode(masm); |
475 Label exit; | 486 Label exit; |
476 Condition cond; | 487 Condition cond; |
477 | 488 |
478 __ movl(rax, Immediate(1)); // Test number. | 489 __ movl(rax, Immediate(1)); // Test number. |
479 | 490 |
480 // CheckSmi | 491 // CheckSmi |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 TEST(SmiNeg) { | 719 TEST(SmiNeg) { |
709 v8::internal::V8::Initialize(NULL); | 720 v8::internal::V8::Initialize(NULL); |
710 // Allocate an executable page of memory. | 721 // Allocate an executable page of memory. |
711 size_t actual_size; | 722 size_t actual_size; |
712 byte* buffer = | 723 byte* buffer = |
713 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 724 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
714 &actual_size, | 725 &actual_size, |
715 true)); | 726 true)); |
716 CHECK(buffer); | 727 CHECK(buffer); |
717 HandleScope handles; | 728 HandleScope handles; |
718 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 729 MacroAssembler assembler(Isolate::Current(), |
| 730 buffer, |
| 731 static_cast<int>(actual_size)); |
719 | 732 |
720 MacroAssembler* masm = &assembler; | 733 MacroAssembler* masm = &assembler; |
721 masm->set_allow_stub_calls(false); | 734 masm->set_allow_stub_calls(false); |
722 EntryCode(masm); | 735 EntryCode(masm); |
723 Label exit; | 736 Label exit; |
724 | 737 |
725 TestSmiNeg(masm, &exit, 0x10, 0); | 738 TestSmiNeg(masm, &exit, 0x10, 0); |
726 TestSmiNeg(masm, &exit, 0x20, 1); | 739 TestSmiNeg(masm, &exit, 0x20, 1); |
727 TestSmiNeg(masm, &exit, 0x30, -1); | 740 TestSmiNeg(masm, &exit, 0x30, -1); |
728 TestSmiNeg(masm, &exit, 0x40, 127); | 741 TestSmiNeg(masm, &exit, 0x40, 127); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 | 809 |
797 TEST(SmiAdd) { | 810 TEST(SmiAdd) { |
798 v8::internal::V8::Initialize(NULL); | 811 v8::internal::V8::Initialize(NULL); |
799 // Allocate an executable page of memory. | 812 // Allocate an executable page of memory. |
800 size_t actual_size; | 813 size_t actual_size; |
801 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 814 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
802 &actual_size, | 815 &actual_size, |
803 true)); | 816 true)); |
804 CHECK(buffer); | 817 CHECK(buffer); |
805 HandleScope handles; | 818 HandleScope handles; |
806 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 819 MacroAssembler assembler(Isolate::Current(), |
| 820 buffer, |
| 821 static_cast<int>(actual_size)); |
807 | 822 |
808 MacroAssembler* masm = &assembler; | 823 MacroAssembler* masm = &assembler; |
809 masm->set_allow_stub_calls(false); | 824 masm->set_allow_stub_calls(false); |
810 EntryCode(masm); | 825 EntryCode(masm); |
811 Label exit; | 826 Label exit; |
812 | 827 |
813 // No-overflow tests. | 828 // No-overflow tests. |
814 SmiAddTest(masm, &exit, 0x10, 1, 2); | 829 SmiAddTest(masm, &exit, 0x10, 1, 2); |
815 SmiAddTest(masm, &exit, 0x20, 1, -2); | 830 SmiAddTest(masm, &exit, 0x20, 1, -2); |
816 SmiAddTest(masm, &exit, 0x30, -1, 2); | 831 SmiAddTest(masm, &exit, 0x30, -1, 2); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 TEST(SmiSub) { | 1001 TEST(SmiSub) { |
987 v8::internal::V8::Initialize(NULL); | 1002 v8::internal::V8::Initialize(NULL); |
988 // Allocate an executable page of memory. | 1003 // Allocate an executable page of memory. |
989 size_t actual_size; | 1004 size_t actual_size; |
990 byte* buffer = | 1005 byte* buffer = |
991 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1006 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
992 &actual_size, | 1007 &actual_size, |
993 true)); | 1008 true)); |
994 CHECK(buffer); | 1009 CHECK(buffer); |
995 HandleScope handles; | 1010 HandleScope handles; |
996 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1011 MacroAssembler assembler(Isolate::Current(), |
| 1012 buffer, |
| 1013 static_cast<int>(actual_size)); |
997 | 1014 |
998 MacroAssembler* masm = &assembler; | 1015 MacroAssembler* masm = &assembler; |
999 masm->set_allow_stub_calls(false); | 1016 masm->set_allow_stub_calls(false); |
1000 EntryCode(masm); | 1017 EntryCode(masm); |
1001 Label exit; | 1018 Label exit; |
1002 | 1019 |
1003 SmiSubTest(masm, &exit, 0x10, 1, 2); | 1020 SmiSubTest(masm, &exit, 0x10, 1, 2); |
1004 SmiSubTest(masm, &exit, 0x20, 1, -2); | 1021 SmiSubTest(masm, &exit, 0x20, 1, -2); |
1005 SmiSubTest(masm, &exit, 0x30, -1, 2); | 1022 SmiSubTest(masm, &exit, 0x30, -1, 2); |
1006 SmiSubTest(masm, &exit, 0x40, -1, -2); | 1023 SmiSubTest(masm, &exit, 0x40, -1, -2); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 | 1093 |
1077 TEST(SmiMul) { | 1094 TEST(SmiMul) { |
1078 v8::internal::V8::Initialize(NULL); | 1095 v8::internal::V8::Initialize(NULL); |
1079 // Allocate an executable page of memory. | 1096 // Allocate an executable page of memory. |
1080 size_t actual_size; | 1097 size_t actual_size; |
1081 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1098 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1082 &actual_size, | 1099 &actual_size, |
1083 true)); | 1100 true)); |
1084 CHECK(buffer); | 1101 CHECK(buffer); |
1085 HandleScope handles; | 1102 HandleScope handles; |
1086 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1103 MacroAssembler assembler(Isolate::Current(), |
| 1104 buffer, |
| 1105 static_cast<int>(actual_size)); |
1087 | 1106 |
1088 MacroAssembler* masm = &assembler; | 1107 MacroAssembler* masm = &assembler; |
1089 masm->set_allow_stub_calls(false); | 1108 masm->set_allow_stub_calls(false); |
1090 EntryCode(masm); | 1109 EntryCode(masm); |
1091 Label exit; | 1110 Label exit; |
1092 | 1111 |
1093 TestSmiMul(masm, &exit, 0x10, 0, 0); | 1112 TestSmiMul(masm, &exit, 0x10, 0, 0); |
1094 TestSmiMul(masm, &exit, 0x20, -1, 0); | 1113 TestSmiMul(masm, &exit, 0x20, -1, 0); |
1095 TestSmiMul(masm, &exit, 0x30, 0, -1); | 1114 TestSmiMul(masm, &exit, 0x30, 0, -1); |
1096 TestSmiMul(masm, &exit, 0x40, -1, -1); | 1115 TestSmiMul(masm, &exit, 0x40, -1, -1); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 TEST(SmiDiv) { | 1201 TEST(SmiDiv) { |
1183 v8::internal::V8::Initialize(NULL); | 1202 v8::internal::V8::Initialize(NULL); |
1184 // Allocate an executable page of memory. | 1203 // Allocate an executable page of memory. |
1185 size_t actual_size; | 1204 size_t actual_size; |
1186 byte* buffer = | 1205 byte* buffer = |
1187 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1206 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
1188 &actual_size, | 1207 &actual_size, |
1189 true)); | 1208 true)); |
1190 CHECK(buffer); | 1209 CHECK(buffer); |
1191 HandleScope handles; | 1210 HandleScope handles; |
1192 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1211 MacroAssembler assembler(Isolate::Current(), |
| 1212 buffer, |
| 1213 static_cast<int>(actual_size)); |
1193 | 1214 |
1194 MacroAssembler* masm = &assembler; | 1215 MacroAssembler* masm = &assembler; |
1195 masm->set_allow_stub_calls(false); | 1216 masm->set_allow_stub_calls(false); |
1196 EntryCode(masm); | 1217 EntryCode(masm); |
1197 Label exit; | 1218 Label exit; |
1198 | 1219 |
1199 __ push(r14); | 1220 __ push(r14); |
1200 __ push(r15); | 1221 __ push(r15); |
1201 TestSmiDiv(masm, &exit, 0x10, 1, 1); | 1222 TestSmiDiv(masm, &exit, 0x10, 1, 1); |
1202 TestSmiDiv(masm, &exit, 0x20, 1, 0); | 1223 TestSmiDiv(masm, &exit, 0x20, 1, 0); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 TEST(SmiMod) { | 1313 TEST(SmiMod) { |
1293 v8::internal::V8::Initialize(NULL); | 1314 v8::internal::V8::Initialize(NULL); |
1294 // Allocate an executable page of memory. | 1315 // Allocate an executable page of memory. |
1295 size_t actual_size; | 1316 size_t actual_size; |
1296 byte* buffer = | 1317 byte* buffer = |
1297 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 1318 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
1298 &actual_size, | 1319 &actual_size, |
1299 true)); | 1320 true)); |
1300 CHECK(buffer); | 1321 CHECK(buffer); |
1301 HandleScope handles; | 1322 HandleScope handles; |
1302 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1323 MacroAssembler assembler(Isolate::Current(), |
| 1324 buffer, |
| 1325 static_cast<int>(actual_size)); |
1303 | 1326 |
1304 MacroAssembler* masm = &assembler; | 1327 MacroAssembler* masm = &assembler; |
1305 masm->set_allow_stub_calls(false); | 1328 masm->set_allow_stub_calls(false); |
1306 EntryCode(masm); | 1329 EntryCode(masm); |
1307 Label exit; | 1330 Label exit; |
1308 | 1331 |
1309 __ push(r14); | 1332 __ push(r14); |
1310 __ push(r15); | 1333 __ push(r15); |
1311 TestSmiMod(masm, &exit, 0x10, 1, 1); | 1334 TestSmiMod(masm, &exit, 0x10, 1, 1); |
1312 TestSmiMod(masm, &exit, 0x20, 1, 0); | 1335 TestSmiMod(masm, &exit, 0x20, 1, 0); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 TEST(SmiIndex) { | 1411 TEST(SmiIndex) { |
1389 v8::internal::V8::Initialize(NULL); | 1412 v8::internal::V8::Initialize(NULL); |
1390 // Allocate an executable page of memory. | 1413 // Allocate an executable page of memory. |
1391 size_t actual_size; | 1414 size_t actual_size; |
1392 byte* buffer = | 1415 byte* buffer = |
1393 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, | 1416 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, |
1394 &actual_size, | 1417 &actual_size, |
1395 true)); | 1418 true)); |
1396 CHECK(buffer); | 1419 CHECK(buffer); |
1397 HandleScope handles; | 1420 HandleScope handles; |
1398 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1421 MacroAssembler assembler(Isolate::Current(), |
| 1422 buffer, |
| 1423 static_cast<int>(actual_size)); |
1399 | 1424 |
1400 MacroAssembler* masm = &assembler; | 1425 MacroAssembler* masm = &assembler; |
1401 masm->set_allow_stub_calls(false); | 1426 masm->set_allow_stub_calls(false); |
1402 EntryCode(masm); | 1427 EntryCode(masm); |
1403 Label exit; | 1428 Label exit; |
1404 | 1429 |
1405 TestSmiIndex(masm, &exit, 0x10, 0); | 1430 TestSmiIndex(masm, &exit, 0x10, 0); |
1406 TestSmiIndex(masm, &exit, 0x20, 1); | 1431 TestSmiIndex(masm, &exit, 0x20, 1); |
1407 TestSmiIndex(masm, &exit, 0x30, 100); | 1432 TestSmiIndex(masm, &exit, 0x30, 100); |
1408 TestSmiIndex(masm, &exit, 0x40, 1000); | 1433 TestSmiIndex(masm, &exit, 0x40, 1000); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 TEST(SmiSelectNonSmi) { | 1482 TEST(SmiSelectNonSmi) { |
1458 v8::internal::V8::Initialize(NULL); | 1483 v8::internal::V8::Initialize(NULL); |
1459 // Allocate an executable page of memory. | 1484 // Allocate an executable page of memory. |
1460 size_t actual_size; | 1485 size_t actual_size; |
1461 byte* buffer = | 1486 byte* buffer = |
1462 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1487 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1463 &actual_size, | 1488 &actual_size, |
1464 true)); | 1489 true)); |
1465 CHECK(buffer); | 1490 CHECK(buffer); |
1466 HandleScope handles; | 1491 HandleScope handles; |
1467 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1492 MacroAssembler assembler(Isolate::Current(), |
| 1493 buffer, |
| 1494 static_cast<int>(actual_size)); |
1468 | 1495 |
1469 MacroAssembler* masm = &assembler; | 1496 MacroAssembler* masm = &assembler; |
1470 masm->set_allow_stub_calls(false); // Avoid inline checks. | 1497 masm->set_allow_stub_calls(false); // Avoid inline checks. |
1471 EntryCode(masm); | 1498 EntryCode(masm); |
1472 Label exit; | 1499 Label exit; |
1473 | 1500 |
1474 TestSelectNonSmi(masm, &exit, 0x10, 0, 0); | 1501 TestSelectNonSmi(masm, &exit, 0x10, 0, 0); |
1475 TestSelectNonSmi(masm, &exit, 0x20, 0, 1); | 1502 TestSelectNonSmi(masm, &exit, 0x20, 0, 1); |
1476 TestSelectNonSmi(masm, &exit, 0x30, 1, 0); | 1503 TestSelectNonSmi(masm, &exit, 0x30, 1, 0); |
1477 TestSelectNonSmi(masm, &exit, 0x40, 0, -1); | 1504 TestSelectNonSmi(masm, &exit, 0x40, 0, -1); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 TEST(SmiAnd) { | 1563 TEST(SmiAnd) { |
1537 v8::internal::V8::Initialize(NULL); | 1564 v8::internal::V8::Initialize(NULL); |
1538 // Allocate an executable page of memory. | 1565 // Allocate an executable page of memory. |
1539 size_t actual_size; | 1566 size_t actual_size; |
1540 byte* buffer = | 1567 byte* buffer = |
1541 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1568 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1542 &actual_size, | 1569 &actual_size, |
1543 true)); | 1570 true)); |
1544 CHECK(buffer); | 1571 CHECK(buffer); |
1545 HandleScope handles; | 1572 HandleScope handles; |
1546 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1573 MacroAssembler assembler(Isolate::Current(), |
| 1574 buffer, |
| 1575 static_cast<int>(actual_size)); |
1547 | 1576 |
1548 MacroAssembler* masm = &assembler; | 1577 MacroAssembler* masm = &assembler; |
1549 masm->set_allow_stub_calls(false); | 1578 masm->set_allow_stub_calls(false); |
1550 EntryCode(masm); | 1579 EntryCode(masm); |
1551 Label exit; | 1580 Label exit; |
1552 | 1581 |
1553 TestSmiAnd(masm, &exit, 0x10, 0, 0); | 1582 TestSmiAnd(masm, &exit, 0x10, 0, 0); |
1554 TestSmiAnd(masm, &exit, 0x20, 0, 1); | 1583 TestSmiAnd(masm, &exit, 0x20, 0, 1); |
1555 TestSmiAnd(masm, &exit, 0x30, 1, 0); | 1584 TestSmiAnd(masm, &exit, 0x30, 1, 0); |
1556 TestSmiAnd(masm, &exit, 0x40, 0, -1); | 1585 TestSmiAnd(masm, &exit, 0x40, 0, -1); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 TEST(SmiOr) { | 1646 TEST(SmiOr) { |
1618 v8::internal::V8::Initialize(NULL); | 1647 v8::internal::V8::Initialize(NULL); |
1619 // Allocate an executable page of memory. | 1648 // Allocate an executable page of memory. |
1620 size_t actual_size; | 1649 size_t actual_size; |
1621 byte* buffer = | 1650 byte* buffer = |
1622 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1651 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1623 &actual_size, | 1652 &actual_size, |
1624 true)); | 1653 true)); |
1625 CHECK(buffer); | 1654 CHECK(buffer); |
1626 HandleScope handles; | 1655 HandleScope handles; |
1627 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1656 MacroAssembler assembler(Isolate::Current(), |
| 1657 buffer, |
| 1658 static_cast<int>(actual_size)); |
1628 | 1659 |
1629 MacroAssembler* masm = &assembler; | 1660 MacroAssembler* masm = &assembler; |
1630 masm->set_allow_stub_calls(false); | 1661 masm->set_allow_stub_calls(false); |
1631 EntryCode(masm); | 1662 EntryCode(masm); |
1632 Label exit; | 1663 Label exit; |
1633 | 1664 |
1634 TestSmiOr(masm, &exit, 0x10, 0, 0); | 1665 TestSmiOr(masm, &exit, 0x10, 0, 0); |
1635 TestSmiOr(masm, &exit, 0x20, 0, 1); | 1666 TestSmiOr(masm, &exit, 0x20, 0, 1); |
1636 TestSmiOr(masm, &exit, 0x30, 1, 0); | 1667 TestSmiOr(masm, &exit, 0x30, 1, 0); |
1637 TestSmiOr(masm, &exit, 0x40, 0, -1); | 1668 TestSmiOr(masm, &exit, 0x40, 0, -1); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 TEST(SmiXor) { | 1731 TEST(SmiXor) { |
1701 v8::internal::V8::Initialize(NULL); | 1732 v8::internal::V8::Initialize(NULL); |
1702 // Allocate an executable page of memory. | 1733 // Allocate an executable page of memory. |
1703 size_t actual_size; | 1734 size_t actual_size; |
1704 byte* buffer = | 1735 byte* buffer = |
1705 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1736 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1706 &actual_size, | 1737 &actual_size, |
1707 true)); | 1738 true)); |
1708 CHECK(buffer); | 1739 CHECK(buffer); |
1709 HandleScope handles; | 1740 HandleScope handles; |
1710 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1741 MacroAssembler assembler(Isolate::Current(), |
| 1742 buffer, |
| 1743 static_cast<int>(actual_size)); |
1711 | 1744 |
1712 MacroAssembler* masm = &assembler; | 1745 MacroAssembler* masm = &assembler; |
1713 masm->set_allow_stub_calls(false); | 1746 masm->set_allow_stub_calls(false); |
1714 EntryCode(masm); | 1747 EntryCode(masm); |
1715 Label exit; | 1748 Label exit; |
1716 | 1749 |
1717 TestSmiXor(masm, &exit, 0x10, 0, 0); | 1750 TestSmiXor(masm, &exit, 0x10, 0, 0); |
1718 TestSmiXor(masm, &exit, 0x20, 0, 1); | 1751 TestSmiXor(masm, &exit, 0x20, 0, 1); |
1719 TestSmiXor(masm, &exit, 0x30, 1, 0); | 1752 TestSmiXor(masm, &exit, 0x30, 1, 0); |
1720 TestSmiXor(masm, &exit, 0x40, 0, -1); | 1753 TestSmiXor(masm, &exit, 0x40, 0, -1); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1767 TEST(SmiNot) { | 1800 TEST(SmiNot) { |
1768 v8::internal::V8::Initialize(NULL); | 1801 v8::internal::V8::Initialize(NULL); |
1769 // Allocate an executable page of memory. | 1802 // Allocate an executable page of memory. |
1770 size_t actual_size; | 1803 size_t actual_size; |
1771 byte* buffer = | 1804 byte* buffer = |
1772 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, | 1805 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, |
1773 &actual_size, | 1806 &actual_size, |
1774 true)); | 1807 true)); |
1775 CHECK(buffer); | 1808 CHECK(buffer); |
1776 HandleScope handles; | 1809 HandleScope handles; |
1777 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1810 MacroAssembler assembler(Isolate::Current(), |
| 1811 buffer, |
| 1812 static_cast<int>(actual_size)); |
1778 | 1813 |
1779 MacroAssembler* masm = &assembler; | 1814 MacroAssembler* masm = &assembler; |
1780 masm->set_allow_stub_calls(false); | 1815 masm->set_allow_stub_calls(false); |
1781 EntryCode(masm); | 1816 EntryCode(masm); |
1782 Label exit; | 1817 Label exit; |
1783 | 1818 |
1784 TestSmiNot(masm, &exit, 0x10, 0); | 1819 TestSmiNot(masm, &exit, 0x10, 0); |
1785 TestSmiNot(masm, &exit, 0x20, 1); | 1820 TestSmiNot(masm, &exit, 0x20, 1); |
1786 TestSmiNot(masm, &exit, 0x30, -1); | 1821 TestSmiNot(masm, &exit, 0x30, -1); |
1787 TestSmiNot(masm, &exit, 0x40, 127); | 1822 TestSmiNot(masm, &exit, 0x40, 127); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 TEST(SmiShiftLeft) { | 1898 TEST(SmiShiftLeft) { |
1864 v8::internal::V8::Initialize(NULL); | 1899 v8::internal::V8::Initialize(NULL); |
1865 // Allocate an executable page of memory. | 1900 // Allocate an executable page of memory. |
1866 size_t actual_size; | 1901 size_t actual_size; |
1867 byte* buffer = | 1902 byte* buffer = |
1868 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, | 1903 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, |
1869 &actual_size, | 1904 &actual_size, |
1870 true)); | 1905 true)); |
1871 CHECK(buffer); | 1906 CHECK(buffer); |
1872 HandleScope handles; | 1907 HandleScope handles; |
1873 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 1908 MacroAssembler assembler(Isolate::Current(), |
| 1909 buffer, |
| 1910 static_cast<int>(actual_size)); |
1874 | 1911 |
1875 MacroAssembler* masm = &assembler; | 1912 MacroAssembler* masm = &assembler; |
1876 masm->set_allow_stub_calls(false); | 1913 masm->set_allow_stub_calls(false); |
1877 EntryCode(masm); | 1914 EntryCode(masm); |
1878 Label exit; | 1915 Label exit; |
1879 | 1916 |
1880 TestSmiShiftLeft(masm, &exit, 0x10, 0); | 1917 TestSmiShiftLeft(masm, &exit, 0x10, 0); |
1881 TestSmiShiftLeft(masm, &exit, 0x50, 1); | 1918 TestSmiShiftLeft(masm, &exit, 0x50, 1); |
1882 TestSmiShiftLeft(masm, &exit, 0x90, 127); | 1919 TestSmiShiftLeft(masm, &exit, 0x90, 127); |
1883 TestSmiShiftLeft(masm, &exit, 0xD0, 65535); | 1920 TestSmiShiftLeft(masm, &exit, 0xD0, 65535); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 TEST(SmiShiftLogicalRight) { | 2006 TEST(SmiShiftLogicalRight) { |
1970 v8::internal::V8::Initialize(NULL); | 2007 v8::internal::V8::Initialize(NULL); |
1971 // Allocate an executable page of memory. | 2008 // Allocate an executable page of memory. |
1972 size_t actual_size; | 2009 size_t actual_size; |
1973 byte* buffer = | 2010 byte* buffer = |
1974 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, | 2011 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, |
1975 &actual_size, | 2012 &actual_size, |
1976 true)); | 2013 true)); |
1977 CHECK(buffer); | 2014 CHECK(buffer); |
1978 HandleScope handles; | 2015 HandleScope handles; |
1979 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 2016 MacroAssembler assembler(Isolate::Current(), |
| 2017 buffer, |
| 2018 static_cast<int>(actual_size)); |
1980 | 2019 |
1981 MacroAssembler* masm = &assembler; | 2020 MacroAssembler* masm = &assembler; |
1982 masm->set_allow_stub_calls(false); | 2021 masm->set_allow_stub_calls(false); |
1983 EntryCode(masm); | 2022 EntryCode(masm); |
1984 Label exit; | 2023 Label exit; |
1985 | 2024 |
1986 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0); | 2025 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0); |
1987 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1); | 2026 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1); |
1988 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127); | 2027 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127); |
1989 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535); | 2028 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 TEST(SmiShiftArithmeticRight) { | 2077 TEST(SmiShiftArithmeticRight) { |
2039 v8::internal::V8::Initialize(NULL); | 2078 v8::internal::V8::Initialize(NULL); |
2040 // Allocate an executable page of memory. | 2079 // Allocate an executable page of memory. |
2041 size_t actual_size; | 2080 size_t actual_size; |
2042 byte* buffer = | 2081 byte* buffer = |
2043 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 2082 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
2044 &actual_size, | 2083 &actual_size, |
2045 true)); | 2084 true)); |
2046 CHECK(buffer); | 2085 CHECK(buffer); |
2047 HandleScope handles; | 2086 HandleScope handles; |
2048 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 2087 MacroAssembler assembler(Isolate::Current(), |
| 2088 buffer, |
| 2089 static_cast<int>(actual_size)); |
2049 | 2090 |
2050 MacroAssembler* masm = &assembler; | 2091 MacroAssembler* masm = &assembler; |
2051 masm->set_allow_stub_calls(false); | 2092 masm->set_allow_stub_calls(false); |
2052 EntryCode(masm); | 2093 EntryCode(masm); |
2053 Label exit; | 2094 Label exit; |
2054 | 2095 |
2055 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0); | 2096 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0); |
2056 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1); | 2097 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1); |
2057 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127); | 2098 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127); |
2058 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535); | 2099 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2102 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { | 2143 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { |
2103 v8::internal::V8::Initialize(NULL); | 2144 v8::internal::V8::Initialize(NULL); |
2104 // Allocate an executable page of memory. | 2145 // Allocate an executable page of memory. |
2105 size_t actual_size; | 2146 size_t actual_size; |
2106 byte* buffer = | 2147 byte* buffer = |
2107 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, | 2148 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, |
2108 &actual_size, | 2149 &actual_size, |
2109 true)); | 2150 true)); |
2110 CHECK(buffer); | 2151 CHECK(buffer); |
2111 HandleScope handles; | 2152 HandleScope handles; |
2112 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 2153 MacroAssembler assembler(Isolate::Current(), |
| 2154 buffer, |
| 2155 static_cast<int>(actual_size)); |
2113 | 2156 |
2114 MacroAssembler* masm = &assembler; | 2157 MacroAssembler* masm = &assembler; |
2115 masm->set_allow_stub_calls(false); | 2158 masm->set_allow_stub_calls(false); |
2116 EntryCode(masm); | 2159 EntryCode(masm); |
2117 Label exit; | 2160 Label exit; |
2118 | 2161 |
2119 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0); | 2162 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0); |
2120 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1); | 2163 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1); |
2121 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127); | 2164 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127); |
2122 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128); | 2165 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128); |
(...skipping 22 matching lines...) Expand all Loading... |
2145 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } | 2188 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } |
2146 | 2189 |
2147 // Allocate an executable page of memory. | 2190 // Allocate an executable page of memory. |
2148 size_t actual_size; | 2191 size_t actual_size; |
2149 byte* buffer = | 2192 byte* buffer = |
2150 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, | 2193 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, |
2151 &actual_size, | 2194 &actual_size, |
2152 true)); | 2195 true)); |
2153 CHECK(buffer); | 2196 CHECK(buffer); |
2154 HandleScope handles; | 2197 HandleScope handles; |
2155 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); | 2198 MacroAssembler assembler(Isolate::Current(), |
| 2199 buffer, |
| 2200 static_cast<int>(actual_size)); |
2156 | 2201 |
2157 MacroAssembler* masm = &assembler; | 2202 MacroAssembler* masm = &assembler; |
2158 masm->set_allow_stub_calls(false); | 2203 masm->set_allow_stub_calls(false); |
2159 Label exit; | 2204 Label exit; |
2160 | 2205 |
2161 EntryCode(masm); | 2206 EntryCode(masm); |
2162 __ push(r13); | 2207 __ push(r13); |
2163 __ push(r14); | 2208 __ push(r14); |
2164 __ push(rbx); | 2209 __ push(rbx); |
2165 __ push(rbp); | 2210 __ push(rbp); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 CodeDesc desc; | 2535 CodeDesc desc; |
2491 masm->GetCode(&desc); | 2536 masm->GetCode(&desc); |
2492 // Call the function from C++. | 2537 // Call the function from C++. |
2493 int result = FUNCTION_CAST<F0>(buffer)(); | 2538 int result = FUNCTION_CAST<F0>(buffer)(); |
2494 CHECK_EQ(0, result); | 2539 CHECK_EQ(0, result); |
2495 } | 2540 } |
2496 | 2541 |
2497 | 2542 |
2498 | 2543 |
2499 #undef __ | 2544 #undef __ |
OLD | NEW |