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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 Assembler::kMinimalBufferSize, &actual_size, true)); | 169 Assembler::kMinimalBufferSize, &actual_size, true)); |
170 CHECK(buffer); | 170 CHECK(buffer); |
171 Isolate* isolate = CcTest::i_isolate(); | 171 Isolate* isolate = CcTest::i_isolate(); |
172 HandleScope handles(isolate); | 172 HandleScope handles(isolate); |
173 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), | 173 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), |
174 v8::internal::CodeObjectRequired::kYes); | 174 v8::internal::CodeObjectRequired::kYes); |
175 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. | 175 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. |
176 EntryCode(masm); | 176 EntryCode(masm); |
177 Label exit; | 177 Label exit; |
178 | 178 |
179 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); | 179 TestMoveSmi(masm, &exit, 1, Smi::kZero); |
180 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); | 180 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); |
181 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); | 181 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); |
182 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); | 182 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); |
183 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256)); | 183 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256)); |
184 TestMoveSmi(masm, &exit, 6, Smi::FromInt(Smi::kMaxValue)); | 184 TestMoveSmi(masm, &exit, 6, Smi::FromInt(Smi::kMaxValue)); |
185 TestMoveSmi(masm, &exit, 7, Smi::FromInt(-1)); | 185 TestMoveSmi(masm, &exit, 7, Smi::FromInt(-1)); |
186 TestMoveSmi(masm, &exit, 8, Smi::FromInt(-128)); | 186 TestMoveSmi(masm, &exit, 8, Smi::FromInt(-128)); |
187 TestMoveSmi(masm, &exit, 9, Smi::FromInt(-129)); | 187 TestMoveSmi(masm, &exit, 9, Smi::FromInt(-129)); |
188 TestMoveSmi(masm, &exit, 10, Smi::FromInt(-256)); | 188 TestMoveSmi(masm, &exit, 10, Smi::FromInt(-256)); |
189 TestMoveSmi(masm, &exit, 11, Smi::FromInt(-257)); | 189 TestMoveSmi(masm, &exit, 11, Smi::FromInt(-257)); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), | 308 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), |
309 v8::internal::CodeObjectRequired::kYes); | 309 v8::internal::CodeObjectRequired::kYes); |
310 | 310 |
311 MacroAssembler* masm = &assembler; | 311 MacroAssembler* masm = &assembler; |
312 EntryCode(masm); | 312 EntryCode(masm); |
313 Label exit; | 313 Label exit; |
314 | 314 |
315 __ movq(rax, Immediate(1)); // Test number. | 315 __ movq(rax, Immediate(1)); // Test number. |
316 __ movl(rcx, Immediate(0)); | 316 __ movl(rcx, Immediate(0)); |
317 __ Integer32ToSmi(rcx, rcx); | 317 __ Integer32ToSmi(rcx, rcx); |
318 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); | 318 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::kZero)); |
319 __ cmpq(rcx, rdx); | 319 __ cmpq(rcx, rdx); |
320 __ j(not_equal, &exit); | 320 __ j(not_equal, &exit); |
321 | 321 |
322 __ movq(rax, Immediate(2)); // Test number. | 322 __ movq(rax, Immediate(2)); // Test number. |
323 __ movl(rcx, Immediate(1024)); | 323 __ movl(rcx, Immediate(1024)); |
324 __ Integer32ToSmi(rcx, rcx); | 324 __ Integer32ToSmi(rcx, rcx); |
325 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(1024))); | 325 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(1024))); |
326 __ cmpq(rcx, rdx); | 326 __ cmpq(rcx, rdx); |
327 __ j(not_equal, &exit); | 327 __ j(not_equal, &exit); |
328 | 328 |
(...skipping 16 matching lines...) Expand all Loading... |
345 __ Integer32ToSmi(rcx, rcx); | 345 __ Integer32ToSmi(rcx, rcx); |
346 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(Smi::kMinValue))); | 346 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(Smi::kMinValue))); |
347 __ cmpq(rcx, rdx); | 347 __ cmpq(rcx, rdx); |
348 __ j(not_equal, &exit); | 348 __ j(not_equal, &exit); |
349 | 349 |
350 // Different target register. | 350 // Different target register. |
351 | 351 |
352 __ movq(rax, Immediate(6)); // Test number. | 352 __ movq(rax, Immediate(6)); // Test number. |
353 __ movl(rcx, Immediate(0)); | 353 __ movl(rcx, Immediate(0)); |
354 __ Integer32ToSmi(r8, rcx); | 354 __ Integer32ToSmi(r8, rcx); |
355 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); | 355 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::kZero)); |
356 __ cmpq(r8, rdx); | 356 __ cmpq(r8, rdx); |
357 __ j(not_equal, &exit); | 357 __ j(not_equal, &exit); |
358 | 358 |
359 __ movq(rax, Immediate(7)); // Test number. | 359 __ movq(rax, Immediate(7)); // Test number. |
360 __ movl(rcx, Immediate(1024)); | 360 __ movl(rcx, Immediate(1024)); |
361 __ Integer32ToSmi(r8, rcx); | 361 __ Integer32ToSmi(r8, rcx); |
362 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(1024))); | 362 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(1024))); |
363 __ cmpq(r8, rdx); | 363 __ cmpq(r8, rdx); |
364 __ j(not_equal, &exit); | 364 __ j(not_equal, &exit); |
365 | 365 |
(...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 __ ret(0); | 2896 __ ret(0); |
2897 | 2897 |
2898 CodeDesc desc; | 2898 CodeDesc desc; |
2899 masm->GetCode(&desc); | 2899 masm->GetCode(&desc); |
2900 // Call the function from C++. | 2900 // Call the function from C++. |
2901 int result = FUNCTION_CAST<F0>(buffer)(); | 2901 int result = FUNCTION_CAST<F0>(buffer)(); |
2902 CHECK_EQ(0, result); | 2902 CHECK_EQ(0, result); |
2903 } | 2903 } |
2904 | 2904 |
2905 #undef __ | 2905 #undef __ |
OLD | NEW |