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

Side by Side Diff: test/cctest/test-macro-assembler-x64.cc

Issue 22935005: Refine CountOperation of FullCodeGen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Tweak SmiSubConstant and use it in CountOperation with bailout label Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 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
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::not_zero;
66 using v8::internal::r11; 66 using i::positive;
67 using v8::internal::r13; 67 using i::r11;
68 using v8::internal::r14; 68 using i::r13;
69 using v8::internal::r15; 69 using i::r14;
70 using v8::internal::r8; 70 using i::r15;
71 using v8::internal::r9; 71 using i::r8;
72 using v8::internal::rax; 72 using i::r9;
73 using v8::internal::rbp; 73 using i::rax;
74 using v8::internal::rbx; 74 using i::rbp;
75 using v8::internal::rcx; 75 using i::rbx;
76 using v8::internal::rdi; 76 using i::rcx;
77 using v8::internal::rdx; 77 using i::rdi;
78 using v8::internal::rsi; 78 using i::rdx;
79 using v8::internal::rsp; 79 using i::rsi;
80 using v8::internal::times_pointer_size; 80 using i::rsp;
81 using i::times_pointer_size;
81 82
82 // Test the x64 assembler by compiling some simple functions into 83 // Test the x64 assembler by compiling some simple functions into
83 // a buffer and executing them. These tests do not initialize the 84 // a buffer and executing them. These tests do not initialize the
84 // V8 library, create a context, or use any V8 objects. 85 // V8 library, create a context, or use any V8 objects.
85 // The AMD64 calling convention is used, with the first five arguments 86 // 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 87 // in RSI, RDI, RDX, RCX, R8, and R9, and floating point arguments in
87 // the XMM registers. The return value is in RAX. 88 // the XMM registers. The return value is in RAX.
88 // This calling convention is used on Linux, with GCC, and on Mac OS, 89 // 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. 90 // with GCC. A different convention is used on 64-bit windows.
90 91
91 typedef int (*F0)(); 92 typedef int (*F0)();
92 93
93 #define __ masm-> 94 #define __ masm->
94 95
95 96
96 static void EntryCode(MacroAssembler* masm) { 97 static void EntryCode(MacroAssembler* masm) {
97 // Smi constant register is callee save. 98 // Smi constant register is callee save.
98 __ push(v8::internal::kSmiConstantRegister); 99 __ push(i::kSmiConstantRegister);
99 __ push(v8::internal::kRootRegister); 100 __ push(i::kRootRegister);
100 __ InitializeSmiConstantRegister(); 101 __ InitializeSmiConstantRegister();
101 __ InitializeRootRegister(); 102 __ InitializeRootRegister();
102 } 103 }
103 104
104 105
105 static void ExitCode(MacroAssembler* masm) { 106 static void ExitCode(MacroAssembler* masm) {
106 // Return -1 if kSmiConstantRegister was clobbered during the test. 107 // Return -1 if kSmiConstantRegister was clobbered during the test.
107 __ Move(rdx, Smi::FromInt(1)); 108 __ Move(rdx, Smi::FromInt(1));
108 __ cmpq(rdx, v8::internal::kSmiConstantRegister); 109 __ cmpq(rdx, i::kSmiConstantRegister);
109 __ movq(rdx, Immediate(-1)); 110 __ movq(rdx, Immediate(-1));
110 __ cmovq(not_equal, rax, rdx); 111 __ cmovq(not_equal, rax, rdx);
111 __ pop(v8::internal::kRootRegister); 112 __ pop(i::kRootRegister);
112 __ pop(v8::internal::kSmiConstantRegister); 113 __ pop(i::kSmiConstantRegister);
113 } 114 }
114 115
115 116
116 TEST(Smi) { 117 TEST(Smi) {
117 // Check that C++ Smi operations work as expected. 118 // Check that C++ Smi operations work as expected.
118 int64_t test_numbers[] = { 119 int64_t test_numbers[] = {
119 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257, 120 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257,
120 Smi::kMaxValue, static_cast<int64_t>(Smi::kMaxValue) + 1, 121 Smi::kMaxValue, static_cast<int64_t>(Smi::kMaxValue) + 1,
121 Smi::kMinValue, static_cast<int64_t>(Smi::kMinValue) - 1 122 Smi::kMinValue, static_cast<int64_t>(Smi::kMinValue) - 1
122 }; 123 };
(...skipping 20 matching lines...) Expand all
143 __ movl(rax, Immediate(id)); 144 __ movl(rax, Immediate(id));
144 __ Move(rcx, Smi::FromInt(0)); 145 __ Move(rcx, Smi::FromInt(0));
145 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); 146 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
146 __ cmpq(rcx, rdx); 147 __ cmpq(rcx, rdx);
147 __ j(not_equal, exit); 148 __ j(not_equal, exit);
148 } 149 }
149 150
150 151
151 // Test that we can move a Smi value literally into a register. 152 // Test that we can move a Smi value literally into a register.
152 TEST(SmiMove) { 153 TEST(SmiMove) {
153 v8::internal::V8::Initialize(NULL); 154 i::V8::Initialize(NULL);
154 // Allocate an executable page of memory. 155 // Allocate an executable page of memory.
155 size_t actual_size; 156 size_t actual_size;
156 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 157 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
157 &actual_size, 158 &actual_size,
158 true)); 159 true));
159 CHECK(buffer); 160 CHECK(buffer);
160 Isolate* isolate = CcTest::i_isolate(); 161 Isolate* isolate = CcTest::i_isolate();
161 HandleScope handles(isolate); 162 HandleScope handles(isolate);
162 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 163 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
163 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 164 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 __ j(not_equal, exit); 232 __ j(not_equal, exit);
232 __ incq(rax); 233 __ incq(rax);
233 __ cmpq(rcx, r8); 234 __ cmpq(rcx, r8);
234 __ j(not_equal, exit); 235 __ j(not_equal, exit);
235 } 236 }
236 } 237 }
237 238
238 239
239 // Test that we can compare smis for equality (and more). 240 // Test that we can compare smis for equality (and more).
240 TEST(SmiCompare) { 241 TEST(SmiCompare) {
241 v8::internal::V8::Initialize(NULL); 242 i::V8::Initialize(NULL);
242 // Allocate an executable page of memory. 243 // Allocate an executable page of memory.
243 size_t actual_size; 244 size_t actual_size;
244 byte* buffer = 245 byte* buffer =
245 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 246 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
246 &actual_size, 247 &actual_size,
247 true)); 248 true));
248 CHECK(buffer); 249 CHECK(buffer);
249 Isolate* isolate = CcTest::i_isolate(); 250 Isolate* isolate = CcTest::i_isolate();
250 HandleScope handles(isolate); 251 HandleScope handles(isolate);
251 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 252 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 CodeDesc desc; 284 CodeDesc desc;
284 masm->GetCode(&desc); 285 masm->GetCode(&desc);
285 // Call the function from C++. 286 // Call the function from C++.
286 int result = FUNCTION_CAST<F0>(buffer)(); 287 int result = FUNCTION_CAST<F0>(buffer)();
287 CHECK_EQ(0, result); 288 CHECK_EQ(0, result);
288 } 289 }
289 290
290 291
291 292
292 TEST(Integer32ToSmi) { 293 TEST(Integer32ToSmi) {
293 v8::internal::V8::Initialize(NULL); 294 i::V8::Initialize(NULL);
294 // Allocate an executable page of memory. 295 // Allocate an executable page of memory.
295 size_t actual_size; 296 size_t actual_size;
296 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 297 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
297 &actual_size, 298 &actual_size,
298 true)); 299 true));
299 CHECK(buffer); 300 CHECK(buffer);
300 Isolate* isolate = CcTest::i_isolate(); 301 Isolate* isolate = CcTest::i_isolate();
301 HandleScope handles(isolate); 302 HandleScope handles(isolate);
302 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 303 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
303 304
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 __ j(not_equal, exit); 413 __ j(not_equal, exit);
413 414
414 __ incq(rax); 415 __ incq(rax);
415 __ Integer64PlusConstantToSmi(rcx, rcx, y); 416 __ Integer64PlusConstantToSmi(rcx, rcx, y);
416 __ cmpq(rcx, r8); 417 __ cmpq(rcx, r8);
417 __ j(not_equal, exit); 418 __ j(not_equal, exit);
418 } 419 }
419 420
420 421
421 TEST(Integer64PlusConstantToSmi) { 422 TEST(Integer64PlusConstantToSmi) {
422 v8::internal::V8::Initialize(NULL); 423 i::V8::Initialize(NULL);
423 // Allocate an executable page of memory. 424 // Allocate an executable page of memory.
424 size_t actual_size; 425 size_t actual_size;
425 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 426 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
426 &actual_size, 427 &actual_size,
427 true)); 428 true));
428 CHECK(buffer); 429 CHECK(buffer);
429 Isolate* isolate = CcTest::i_isolate(); 430 Isolate* isolate = CcTest::i_isolate();
430 HandleScope handles(isolate); 431 HandleScope handles(isolate);
431 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 432 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
432 433
(...skipping 24 matching lines...) Expand all
457 458
458 CodeDesc desc; 459 CodeDesc desc;
459 masm->GetCode(&desc); 460 masm->GetCode(&desc);
460 // Call the function from C++. 461 // Call the function from C++.
461 int result = FUNCTION_CAST<F0>(buffer)(); 462 int result = FUNCTION_CAST<F0>(buffer)();
462 CHECK_EQ(0, result); 463 CHECK_EQ(0, result);
463 } 464 }
464 465
465 466
466 TEST(SmiCheck) { 467 TEST(SmiCheck) {
467 v8::internal::V8::Initialize(NULL); 468 i::V8::Initialize(NULL);
468 // Allocate an executable page of memory. 469 // Allocate an executable page of memory.
469 size_t actual_size; 470 size_t actual_size;
470 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 471 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
471 &actual_size, 472 &actual_size,
472 true)); 473 true));
473 CHECK(buffer); 474 CHECK(buffer);
474 Isolate* isolate = CcTest::i_isolate(); 475 Isolate* isolate = CcTest::i_isolate();
475 HandleScope handles(isolate); 476 HandleScope handles(isolate);
476 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 477 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
477 478
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 __ jmp(exit); 706 __ jmp(exit);
706 __ bind(&smi_ok2); 707 __ bind(&smi_ok2);
707 __ incq(rax); 708 __ incq(rax);
708 __ cmpq(rcx, r8); 709 __ cmpq(rcx, r8);
709 __ j(not_equal, exit); 710 __ j(not_equal, exit);
710 } 711 }
711 } 712 }
712 713
713 714
714 TEST(SmiNeg) { 715 TEST(SmiNeg) {
715 v8::internal::V8::Initialize(NULL); 716 i::V8::Initialize(NULL);
716 // Allocate an executable page of memory. 717 // Allocate an executable page of memory.
717 size_t actual_size; 718 size_t actual_size;
718 byte* buffer = 719 byte* buffer =
719 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 720 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
720 &actual_size, 721 &actual_size,
721 true)); 722 true));
722 CHECK(buffer); 723 CHECK(buffer);
723 Isolate* isolate = CcTest::i_isolate(); 724 Isolate* isolate = CcTest::i_isolate();
724 HandleScope handles(isolate); 725 HandleScope handles(isolate);
725 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 726 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 __ j(not_equal, exit); 797 __ j(not_equal, exit);
797 798
798 __ incq(rax); 799 __ incq(rax);
799 __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), exit); 800 __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), exit);
800 __ cmpq(rcx, r8); 801 __ cmpq(rcx, r8);
801 __ j(not_equal, exit); 802 __ j(not_equal, exit);
802 } 803 }
803 804
804 805
805 TEST(SmiAdd) { 806 TEST(SmiAdd) {
806 v8::internal::V8::Initialize(NULL); 807 i::V8::Initialize(NULL);
807 // Allocate an executable page of memory. 808 // Allocate an executable page of memory.
808 size_t actual_size; 809 size_t actual_size;
809 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 810 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
810 &actual_size, 811 &actual_size,
811 true)); 812 true));
812 CHECK(buffer); 813 CHECK(buffer);
813 Isolate* isolate = CcTest::i_isolate(); 814 Isolate* isolate = CcTest::i_isolate();
814 HandleScope handles(isolate); 815 HandleScope handles(isolate);
815 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 816 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
816 817
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 __ incq(rax); // Test 2. 867 __ incq(rax); // Test 2.
867 __ SmiSubConstant(r9, rcx, Smi::FromInt(second)); 868 __ SmiSubConstant(r9, rcx, Smi::FromInt(second));
868 __ cmpq(r9, r8); 869 __ cmpq(r9, r8);
869 __ j(not_equal, exit); 870 __ j(not_equal, exit);
870 871
871 __ incq(rax); // Test 3. 872 __ incq(rax); // Test 3.
872 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second)); 873 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second));
873 __ cmpq(rcx, r8); 874 __ cmpq(rcx, r8);
874 __ j(not_equal, exit); 875 __ j(not_equal, exit);
875 876
877 i::SmiExecutionMode mode = static_cast<i::SmiExecutionMode>(
878 i::SMI_NEED_RESERVE_SOURCES | i::SMI_BAILOUT_ON_OVERFLOW);
876 __ Move(rcx, Smi::FromInt(first)); 879 __ Move(rcx, Smi::FromInt(first));
877
878 __ incq(rax); // Test 4. 880 __ incq(rax); // Test 4.
879 __ SmiSubConstant(r9, rcx, Smi::FromInt(second), exit); 881 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), mode, exit);
880 __ cmpq(r9, r8); 882 __ cmpq(rcx, r8);
881 __ j(not_equal, exit); 883 __ j(not_equal, exit);
882 884
885 mode = static_cast<i::SmiExecutionMode>(
886 i::SMI_NEED_RESERVE_SOURCES | i::SMI_BAILOUT_ON_NO_OVERFLOW);
887 __ Move(rcx, Smi::FromInt(first));
888 Label done;
883 __ incq(rax); // Test 5. 889 __ incq(rax); // Test 5.
884 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), exit); 890 __ SmiSubConstant(rcx, rcx, Smi::FromInt(second), mode, &done);
891 __ jmp(exit);
892 __ bind(&done);
885 __ cmpq(rcx, r8); 893 __ cmpq(rcx, r8);
886 __ j(not_equal, exit); 894 __ j(not_equal, exit);
887 } 895 }
888 896
889 static void SmiSubOverflowTest(MacroAssembler* masm, 897 static void SmiSubOverflowTest(MacroAssembler* masm,
890 Label* exit, 898 Label* exit,
891 int id, 899 int id,
892 int x) { 900 int x) {
893 // Subtracts a Smi from x so that the subtraction overflows. 901 // Subtracts a Smi from x so that the subtraction overflows.
894 ASSERT(x != -1); // Can't overflow by subtracting a Smi. 902 ASSERT(x != -1); // Can't overflow by subtracting a Smi.
(...skipping 19 matching lines...) Expand all
914 __ incq(rax); 922 __ incq(rax);
915 __ SmiSub(rcx, rcx, rdx, &overflow_ok); 923 __ SmiSub(rcx, rcx, rdx, &overflow_ok);
916 __ jmp(exit); 924 __ jmp(exit);
917 __ bind(&overflow_ok); 925 __ bind(&overflow_ok);
918 __ incq(rax); 926 __ incq(rax);
919 __ cmpq(rcx, r11); 927 __ cmpq(rcx, r11);
920 __ j(not_equal, exit); 928 __ j(not_equal, exit);
921 } 929 }
922 930
923 __ movq(rcx, r11); 931 __ movq(rcx, r11);
932 i::SmiExecutionMode mode = static_cast<i::SmiExecutionMode>(
933 i::SMI_NEED_RESERVE_SOURCES | i::SMI_BAILOUT_ON_OVERFLOW);
924 { 934 {
925 Label overflow_ok; 935 Label overflow_ok;
926 __ incq(rax); 936 __ incq(rax);
927 __ SmiSubConstant(r9, rcx, Smi::FromInt(y_min), &overflow_ok); 937 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_min), mode, &overflow_ok);
928 __ jmp(exit); 938 __ jmp(exit);
929 __ bind(&overflow_ok); 939 __ bind(&overflow_ok);
930 __ incq(rax); 940 __ incq(rax);
931 __ cmpq(rcx, r11);
932 __ j(not_equal, exit);
933 }
934
935 {
936 Label overflow_ok;
937 __ incq(rax);
938 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_min), &overflow_ok);
939 __ jmp(exit);
940 __ bind(&overflow_ok);
941 __ incq(rax);
942 __ cmpq(rcx, r11); 941 __ cmpq(rcx, r11);
943 __ j(not_equal, exit); 942 __ j(not_equal, exit);
944 } 943 }
945 944
946 __ Move(rdx, Smi::FromInt(y_max)); 945 __ Move(rdx, Smi::FromInt(y_max));
947 946
948 { 947 {
949 Label overflow_ok; 948 Label overflow_ok;
950 __ incq(rax); 949 __ incq(rax);
951 __ SmiSub(r9, rcx, rdx, &overflow_ok); 950 __ SmiSub(r9, rcx, rdx, &overflow_ok);
(...skipping 12 matching lines...) Expand all
964 __ bind(&overflow_ok); 963 __ bind(&overflow_ok);
965 __ incq(rax); 964 __ incq(rax);
966 __ cmpq(rcx, r11); 965 __ cmpq(rcx, r11);
967 __ j(not_equal, exit); 966 __ j(not_equal, exit);
968 } 967 }
969 968
970 __ movq(rcx, r11); 969 __ movq(rcx, r11);
971 { 970 {
972 Label overflow_ok; 971 Label overflow_ok;
973 __ incq(rax); 972 __ incq(rax);
974 __ SmiSubConstant(r9, rcx, Smi::FromInt(y_max), &overflow_ok); 973 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), mode, &overflow_ok);
975 __ jmp(exit); 974 __ jmp(exit);
976 __ bind(&overflow_ok); 975 __ bind(&overflow_ok);
977 __ incq(rax); 976 __ incq(rax);
978 __ cmpq(rcx, r11);
979 __ j(not_equal, exit);
980 }
981
982 {
983 Label overflow_ok;
984 __ incq(rax);
985 __ SmiSubConstant(rcx, rcx, Smi::FromInt(y_max), &overflow_ok);
986 __ jmp(exit);
987 __ bind(&overflow_ok);
988 __ incq(rax);
989 __ cmpq(rcx, r11); 977 __ cmpq(rcx, r11);
990 __ j(not_equal, exit); 978 __ j(not_equal, exit);
991 } 979 }
992 } 980 }
993 981
994 982
995 TEST(SmiSub) { 983 TEST(SmiSub) {
996 v8::internal::V8::Initialize(NULL); 984 i::V8::Initialize(NULL);
997 // Allocate an executable page of memory. 985 // Allocate an executable page of memory.
998 size_t actual_size; 986 size_t actual_size;
999 byte* buffer = 987 byte* buffer =
1000 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 988 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1001 &actual_size, 989 &actual_size,
1002 true)); 990 true));
1003 CHECK(buffer); 991 CHECK(buffer);
1004 Isolate* isolate = CcTest::i_isolate(); 992 Isolate* isolate = CcTest::i_isolate();
1005 HandleScope handles(isolate); 993 HandleScope handles(isolate);
1006 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 994 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 __ bind(&overflow_ok2); 1066 __ bind(&overflow_ok2);
1079 // 31-bit version doesn't preserve rcx on failure. 1067 // 31-bit version doesn't preserve rcx on failure.
1080 // __ incq(rax); 1068 // __ incq(rax);
1081 // __ cmpq(r11, rcx); 1069 // __ cmpq(r11, rcx);
1082 // __ j(not_equal, exit); 1070 // __ j(not_equal, exit);
1083 } 1071 }
1084 } 1072 }
1085 1073
1086 1074
1087 TEST(SmiMul) { 1075 TEST(SmiMul) {
1088 v8::internal::V8::Initialize(NULL); 1076 i::V8::Initialize(NULL);
1089 // Allocate an executable page of memory. 1077 // Allocate an executable page of memory.
1090 size_t actual_size; 1078 size_t actual_size;
1091 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1079 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1092 &actual_size, 1080 &actual_size,
1093 true)); 1081 true));
1094 CHECK(buffer); 1082 CHECK(buffer);
1095 Isolate* isolate = CcTest::i_isolate(); 1083 Isolate* isolate = CcTest::i_isolate();
1096 HandleScope handles(isolate); 1084 HandleScope handles(isolate);
1097 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1085 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1098 1086
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 __ bind(&fail_ok2); 1172 __ bind(&fail_ok2);
1185 1173
1186 __ incq(r15); 1174 __ incq(r15);
1187 __ cmpq(rcx, r11); 1175 __ cmpq(rcx, r11);
1188 __ j(not_equal, exit); 1176 __ j(not_equal, exit);
1189 } 1177 }
1190 } 1178 }
1191 1179
1192 1180
1193 TEST(SmiDiv) { 1181 TEST(SmiDiv) {
1194 v8::internal::V8::Initialize(NULL); 1182 i::V8::Initialize(NULL);
1195 // Allocate an executable page of memory. 1183 // Allocate an executable page of memory.
1196 size_t actual_size; 1184 size_t actual_size;
1197 byte* buffer = 1185 byte* buffer =
1198 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1186 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1199 &actual_size, 1187 &actual_size,
1200 true)); 1188 true));
1201 CHECK(buffer); 1189 CHECK(buffer);
1202 Isolate* isolate = CcTest::i_isolate(); 1190 Isolate* isolate = CcTest::i_isolate();
1203 HandleScope handles(isolate); 1191 HandleScope handles(isolate);
1204 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1192 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 __ bind(&fail_ok2); 1283 __ bind(&fail_ok2);
1296 1284
1297 __ incq(r15); 1285 __ incq(r15);
1298 __ cmpq(rcx, r11); 1286 __ cmpq(rcx, r11);
1299 __ j(not_equal, exit); 1287 __ j(not_equal, exit);
1300 } 1288 }
1301 } 1289 }
1302 1290
1303 1291
1304 TEST(SmiMod) { 1292 TEST(SmiMod) {
1305 v8::internal::V8::Initialize(NULL); 1293 i::V8::Initialize(NULL);
1306 // Allocate an executable page of memory. 1294 // Allocate an executable page of memory.
1307 size_t actual_size; 1295 size_t actual_size;
1308 byte* buffer = 1296 byte* buffer =
1309 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1297 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1310 &actual_size, 1298 &actual_size,
1311 true)); 1299 true));
1312 CHECK(buffer); 1300 CHECK(buffer);
1313 Isolate* isolate = CcTest::i_isolate(); 1301 Isolate* isolate = CcTest::i_isolate();
1314 HandleScope handles(isolate); 1302 HandleScope handles(isolate);
1315 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1303 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 __ shl(rcx, Immediate(index.scale)); 1381 __ shl(rcx, Immediate(index.scale));
1394 __ Set(r8, static_cast<intptr_t>(-x) << i); 1382 __ Set(r8, static_cast<intptr_t>(-x) << i);
1395 __ cmpq(rcx, r8); 1383 __ cmpq(rcx, r8);
1396 __ j(not_equal, exit); 1384 __ j(not_equal, exit);
1397 __ incq(rax); 1385 __ incq(rax);
1398 } 1386 }
1399 } 1387 }
1400 1388
1401 1389
1402 TEST(SmiIndex) { 1390 TEST(SmiIndex) {
1403 v8::internal::V8::Initialize(NULL); 1391 i::V8::Initialize(NULL);
1404 // Allocate an executable page of memory. 1392 // Allocate an executable page of memory.
1405 size_t actual_size; 1393 size_t actual_size;
1406 byte* buffer = 1394 byte* buffer =
1407 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1395 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
1408 &actual_size, 1396 &actual_size,
1409 true)); 1397 true));
1410 CHECK(buffer); 1398 CHECK(buffer);
1411 Isolate* isolate = CcTest::i_isolate(); 1399 Isolate* isolate = CcTest::i_isolate();
1412 HandleScope handles(isolate); 1400 HandleScope handles(isolate);
1413 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1401 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 __ Move(rdx, Smi::FromInt(y)); 1451 __ Move(rdx, Smi::FromInt(y));
1464 __ xor_(rcx, Immediate(kSmiTagMask)); 1452 __ xor_(rcx, Immediate(kSmiTagMask));
1465 __ xor_(rdx, Immediate(kSmiTagMask)); 1453 __ xor_(rdx, Immediate(kSmiTagMask));
1466 __ SelectNonSmi(r9, rcx, rdx, &fail_ok); 1454 __ SelectNonSmi(r9, rcx, rdx, &fail_ok);
1467 __ jmp(exit); 1455 __ jmp(exit);
1468 __ bind(&fail_ok); 1456 __ bind(&fail_ok);
1469 } 1457 }
1470 1458
1471 1459
1472 TEST(SmiSelectNonSmi) { 1460 TEST(SmiSelectNonSmi) {
1473 v8::internal::V8::Initialize(NULL); 1461 i::V8::Initialize(NULL);
1474 // Allocate an executable page of memory. 1462 // Allocate an executable page of memory.
1475 size_t actual_size; 1463 size_t actual_size;
1476 byte* buffer = 1464 byte* buffer =
1477 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1465 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1478 &actual_size, 1466 &actual_size,
1479 true)); 1467 true));
1480 CHECK(buffer); 1468 CHECK(buffer);
1481 Isolate* isolate = CcTest::i_isolate(); 1469 Isolate* isolate = CcTest::i_isolate();
1482 HandleScope handles(isolate); 1470 HandleScope handles(isolate);
1483 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1471 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 __ j(not_equal, exit); 1531 __ j(not_equal, exit);
1544 1532
1545 __ incq(rax); 1533 __ incq(rax);
1546 __ SmiAndConstant(rcx, rcx, Smi::FromInt(y)); 1534 __ SmiAndConstant(rcx, rcx, Smi::FromInt(y));
1547 __ cmpq(r8, rcx); 1535 __ cmpq(r8, rcx);
1548 __ j(not_equal, exit); 1536 __ j(not_equal, exit);
1549 } 1537 }
1550 1538
1551 1539
1552 TEST(SmiAnd) { 1540 TEST(SmiAnd) {
1553 v8::internal::V8::Initialize(NULL); 1541 i::V8::Initialize(NULL);
1554 // Allocate an executable page of memory. 1542 // Allocate an executable page of memory.
1555 size_t actual_size; 1543 size_t actual_size;
1556 byte* buffer = 1544 byte* buffer =
1557 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1545 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1558 &actual_size, 1546 &actual_size,
1559 true)); 1547 true));
1560 CHECK(buffer); 1548 CHECK(buffer);
1561 Isolate* isolate = CcTest::i_isolate(); 1549 Isolate* isolate = CcTest::i_isolate();
1562 HandleScope handles(isolate); 1550 HandleScope handles(isolate);
1563 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1551 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 __ j(not_equal, exit); 1613 __ j(not_equal, exit);
1626 1614
1627 __ incq(rax); 1615 __ incq(rax);
1628 __ SmiOrConstant(rcx, rcx, Smi::FromInt(y)); 1616 __ SmiOrConstant(rcx, rcx, Smi::FromInt(y));
1629 __ cmpq(r8, rcx); 1617 __ cmpq(r8, rcx);
1630 __ j(not_equal, exit); 1618 __ j(not_equal, exit);
1631 } 1619 }
1632 1620
1633 1621
1634 TEST(SmiOr) { 1622 TEST(SmiOr) {
1635 v8::internal::V8::Initialize(NULL); 1623 i::V8::Initialize(NULL);
1636 // Allocate an executable page of memory. 1624 // Allocate an executable page of memory.
1637 size_t actual_size; 1625 size_t actual_size;
1638 byte* buffer = 1626 byte* buffer =
1639 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1627 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1640 &actual_size, 1628 &actual_size,
1641 true)); 1629 true));
1642 CHECK(buffer); 1630 CHECK(buffer);
1643 Isolate* isolate = CcTest::i_isolate(); 1631 Isolate* isolate = CcTest::i_isolate();
1644 HandleScope handles(isolate); 1632 HandleScope handles(isolate);
1645 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1633 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 __ j(not_equal, exit); 1697 __ j(not_equal, exit);
1710 1698
1711 __ incq(rax); 1699 __ incq(rax);
1712 __ SmiXorConstant(rcx, rcx, Smi::FromInt(y)); 1700 __ SmiXorConstant(rcx, rcx, Smi::FromInt(y));
1713 __ cmpq(r8, rcx); 1701 __ cmpq(r8, rcx);
1714 __ j(not_equal, exit); 1702 __ j(not_equal, exit);
1715 } 1703 }
1716 1704
1717 1705
1718 TEST(SmiXor) { 1706 TEST(SmiXor) {
1719 v8::internal::V8::Initialize(NULL); 1707 i::V8::Initialize(NULL);
1720 // Allocate an executable page of memory. 1708 // Allocate an executable page of memory.
1721 size_t actual_size; 1709 size_t actual_size;
1722 byte* buffer = 1710 byte* buffer =
1723 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1711 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1724 &actual_size, 1712 &actual_size,
1725 true)); 1713 true));
1726 CHECK(buffer); 1714 CHECK(buffer);
1727 Isolate* isolate = CcTest::i_isolate(); 1715 Isolate* isolate = CcTest::i_isolate();
1728 HandleScope handles(isolate); 1716 HandleScope handles(isolate);
1729 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1717 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 __ j(not_equal, exit); 1765 __ j(not_equal, exit);
1778 1766
1779 __ incq(rax); 1767 __ incq(rax);
1780 __ SmiNot(rcx, rcx); 1768 __ SmiNot(rcx, rcx);
1781 __ cmpq(rcx, r8); 1769 __ cmpq(rcx, r8);
1782 __ j(not_equal, exit); 1770 __ j(not_equal, exit);
1783 } 1771 }
1784 1772
1785 1773
1786 TEST(SmiNot) { 1774 TEST(SmiNot) {
1787 v8::internal::V8::Initialize(NULL); 1775 i::V8::Initialize(NULL);
1788 // Allocate an executable page of memory. 1776 // Allocate an executable page of memory.
1789 size_t actual_size; 1777 size_t actual_size;
1790 byte* buffer = 1778 byte* buffer =
1791 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1779 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1792 &actual_size, 1780 &actual_size,
1793 true)); 1781 true));
1794 CHECK(buffer); 1782 CHECK(buffer);
1795 Isolate* isolate = CcTest::i_isolate(); 1783 Isolate* isolate = CcTest::i_isolate();
1796 HandleScope handles(isolate); 1784 HandleScope handles(isolate);
1797 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1785 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 __ incq(rax); 1862 __ incq(rax);
1875 __ cmpq(rdx, r8); 1863 __ cmpq(rdx, r8);
1876 __ j(not_equal, exit); 1864 __ j(not_equal, exit);
1877 1865
1878 __ incq(rax); 1866 __ incq(rax);
1879 } 1867 }
1880 } 1868 }
1881 1869
1882 1870
1883 TEST(SmiShiftLeft) { 1871 TEST(SmiShiftLeft) {
1884 v8::internal::V8::Initialize(NULL); 1872 i::V8::Initialize(NULL);
1885 // Allocate an executable page of memory. 1873 // Allocate an executable page of memory.
1886 size_t actual_size; 1874 size_t actual_size;
1887 byte* buffer = 1875 byte* buffer =
1888 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 1876 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
1889 &actual_size, 1877 &actual_size,
1890 true)); 1878 true));
1891 CHECK(buffer); 1879 CHECK(buffer);
1892 Isolate* isolate = CcTest::i_isolate(); 1880 Isolate* isolate = CcTest::i_isolate();
1893 HandleScope handles(isolate); 1881 HandleScope handles(isolate);
1894 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1882 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 __ cmpq(rcx, r11); 1969 __ cmpq(rcx, r11);
1982 __ j(not_equal, exit); 1970 __ j(not_equal, exit);
1983 1971
1984 __ addq(rax, Immediate(3)); 1972 __ addq(rax, Immediate(3));
1985 } 1973 }
1986 } 1974 }
1987 } 1975 }
1988 1976
1989 1977
1990 TEST(SmiShiftLogicalRight) { 1978 TEST(SmiShiftLogicalRight) {
1991 v8::internal::V8::Initialize(NULL); 1979 i::V8::Initialize(NULL);
1992 // Allocate an executable page of memory. 1980 // Allocate an executable page of memory.
1993 size_t actual_size; 1981 size_t actual_size;
1994 byte* buffer = 1982 byte* buffer =
1995 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1983 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
1996 &actual_size, 1984 &actual_size,
1997 true)); 1985 true));
1998 CHECK(buffer); 1986 CHECK(buffer);
1999 Isolate* isolate = CcTest::i_isolate(); 1987 Isolate* isolate = CcTest::i_isolate();
2000 HandleScope handles(isolate); 1988 HandleScope handles(isolate);
2001 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1989 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 2039
2052 __ cmpq(rdx, r8); 2040 __ cmpq(rdx, r8);
2053 __ j(not_equal, exit); 2041 __ j(not_equal, exit);
2054 2042
2055 __ incq(rax); 2043 __ incq(rax);
2056 } 2044 }
2057 } 2045 }
2058 2046
2059 2047
2060 TEST(SmiShiftArithmeticRight) { 2048 TEST(SmiShiftArithmeticRight) {
2061 v8::internal::V8::Initialize(NULL); 2049 i::V8::Initialize(NULL);
2062 // Allocate an executable page of memory. 2050 // Allocate an executable page of memory.
2063 size_t actual_size; 2051 size_t actual_size;
2064 byte* buffer = 2052 byte* buffer =
2065 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2053 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2066 &actual_size, 2054 &actual_size,
2067 true)); 2055 true));
2068 CHECK(buffer); 2056 CHECK(buffer);
2069 Isolate* isolate = CcTest::i_isolate(); 2057 Isolate* isolate = CcTest::i_isolate();
2070 HandleScope handles(isolate); 2058 HandleScope handles(isolate);
2071 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2059 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 __ incq(rax); 2104 __ incq(rax);
2117 __ PositiveSmiTimesPowerOfTwoToInteger64(rcx, rcx, power); 2105 __ PositiveSmiTimesPowerOfTwoToInteger64(rcx, rcx, power);
2118 __ cmpq(rdx, r8); 2106 __ cmpq(rdx, r8);
2119 __ j(not_equal, exit); 2107 __ j(not_equal, exit);
2120 __ incq(rax); 2108 __ incq(rax);
2121 } 2109 }
2122 } 2110 }
2123 2111
2124 2112
2125 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { 2113 TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
2126 v8::internal::V8::Initialize(NULL); 2114 i::V8::Initialize(NULL);
2127 // Allocate an executable page of memory. 2115 // Allocate an executable page of memory.
2128 size_t actual_size; 2116 size_t actual_size;
2129 byte* buffer = 2117 byte* buffer =
2130 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 2118 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
2131 &actual_size, 2119 &actual_size,
2132 true)); 2120 true));
2133 CHECK(buffer); 2121 CHECK(buffer);
2134 Isolate* isolate = CcTest::i_isolate(); 2122 Isolate* isolate = CcTest::i_isolate();
2135 HandleScope handles(isolate); 2123 HandleScope handles(isolate);
2136 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2124 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
(...skipping 20 matching lines...) Expand all
2157 2145
2158 CodeDesc desc; 2146 CodeDesc desc;
2159 masm->GetCode(&desc); 2147 masm->GetCode(&desc);
2160 // Call the function from C++. 2148 // Call the function from C++.
2161 int result = FUNCTION_CAST<F0>(buffer)(); 2149 int result = FUNCTION_CAST<F0>(buffer)();
2162 CHECK_EQ(0, result); 2150 CHECK_EQ(0, result);
2163 } 2151 }
2164 2152
2165 2153
2166 TEST(OperandOffset) { 2154 TEST(OperandOffset) {
2167 v8::internal::V8::Initialize(NULL); 2155 i::V8::Initialize(NULL);
2168 int data[256]; 2156 int data[256];
2169 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } 2157 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; }
2170 2158
2171 // Allocate an executable page of memory. 2159 // Allocate an executable page of memory.
2172 size_t actual_size; 2160 size_t actual_size;
2173 byte* buffer = 2161 byte* buffer =
2174 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2162 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2175 &actual_size, 2163 &actual_size,
2176 true)); 2164 true));
2177 CHECK(buffer); 2165 CHECK(buffer);
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 CodeDesc desc; 2503 CodeDesc desc;
2516 masm->GetCode(&desc); 2504 masm->GetCode(&desc);
2517 // Call the function from C++. 2505 // Call the function from C++.
2518 int result = FUNCTION_CAST<F0>(buffer)(); 2506 int result = FUNCTION_CAST<F0>(buffer)();
2519 CHECK_EQ(0, result); 2507 CHECK_EQ(0, result);
2520 } 2508 }
2521 2509
2522 2510
2523 2511
2524 #undef __ 2512 #undef __
OLDNEW
« src/x64/macro-assembler-x64.h ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698