OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 | 29 |
30 #include "src/v8.h" | 30 #include "src/v8.h" |
31 | 31 |
| 32 #include "src/base/platform/platform.h" |
32 #include "src/disassembler.h" | 33 #include "src/disassembler.h" |
33 #include "src/factory.h" | 34 #include "src/factory.h" |
34 #include "src/macro-assembler.h" | 35 #include "src/macro-assembler.h" |
35 #include "src/platform.h" | |
36 #include "src/serialize.h" | 36 #include "src/serialize.h" |
37 #include "test/cctest/cctest.h" | 37 #include "test/cctest/cctest.h" |
38 | 38 |
39 using namespace v8::internal; | 39 using namespace v8::internal; |
40 | 40 |
41 | 41 |
42 typedef int (*F0)(); | 42 typedef int (*F0)(); |
43 typedef int (*F1)(int x); | 43 typedef int (*F1)(int x); |
44 typedef int (*F2)(int x, int y); | 44 typedef int (*F2)(int x, int y); |
45 | 45 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 Handle<Code> code = isolate->factory()->NewCode( | 347 Handle<Code> code = isolate->factory()->NewCode( |
348 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 348 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
349 #ifdef OBJECT_PRINT | 349 #ifdef OBJECT_PRINT |
350 code->Print(); | 350 code->Print(); |
351 #endif | 351 #endif |
352 | 352 |
353 F7 f = FUNCTION_CAST<F7>(code->entry()); | 353 F7 f = FUNCTION_CAST<F7>(code->entry()); |
354 CHECK_EQ(kLess, f(1.1, 2.2)); | 354 CHECK_EQ(kLess, f(1.1, 2.2)); |
355 CHECK_EQ(kEqual, f(2.2, 2.2)); | 355 CHECK_EQ(kEqual, f(2.2, 2.2)); |
356 CHECK_EQ(kGreater, f(3.3, 2.2)); | 356 CHECK_EQ(kGreater, f(3.3, 2.2)); |
357 CHECK_EQ(kNaN, f(OS::nan_value(), 1.1)); | 357 CHECK_EQ(kNaN, f(v8::base::OS::nan_value(), 1.1)); |
358 } | 358 } |
359 | 359 |
360 | 360 |
361 TEST(AssemblerIa3210) { | 361 TEST(AssemblerIa3210) { |
362 // Test chaining of label usages within instructions (issue 1644). | 362 // Test chaining of label usages within instructions (issue 1644). |
363 CcTest::InitializeVM(); | 363 CcTest::InitializeVM(); |
364 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 364 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
365 HandleScope scope(isolate); | 365 HandleScope scope(isolate); |
366 Assembler assm(isolate, NULL, 0); | 366 Assembler assm(isolate, NULL, 0); |
367 | 367 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 479 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
480 | 480 |
481 F0 f = FUNCTION_CAST<F0>(code->entry()); | 481 F0 f = FUNCTION_CAST<F0>(code->entry()); |
482 int res = f(); | 482 int res = f(); |
483 args.GetReturnValue().Set(v8::Integer::New(CcTest::isolate(), res)); | 483 args.GetReturnValue().Set(v8::Integer::New(CcTest::isolate(), res)); |
484 } | 484 } |
485 | 485 |
486 | 486 |
487 TEST(StackAlignmentForSSE2) { | 487 TEST(StackAlignmentForSSE2) { |
488 CcTest::InitializeVM(); | 488 CcTest::InitializeVM(); |
489 CHECK_EQ(0, OS::ActivationFrameAlignment() % 16); | 489 CHECK_EQ(0, v8::base::OS::ActivationFrameAlignment() % 16); |
490 | 490 |
491 v8::Isolate* isolate = CcTest::isolate(); | 491 v8::Isolate* isolate = CcTest::isolate(); |
492 v8::HandleScope handle_scope(isolate); | 492 v8::HandleScope handle_scope(isolate); |
493 v8::Handle<v8::ObjectTemplate> global_template = | 493 v8::Handle<v8::ObjectTemplate> global_template = |
494 v8::ObjectTemplate::New(isolate); | 494 v8::ObjectTemplate::New(isolate); |
495 global_template->Set(v8_str("do_sse2"), | 495 global_template->Set(v8_str("do_sse2"), |
496 v8::FunctionTemplate::New(isolate, DoSSE2)); | 496 v8::FunctionTemplate::New(isolate, DoSSE2)); |
497 | 497 |
498 LocalContext env(NULL, global_template); | 498 LocalContext env(NULL, global_template); |
499 CompileRun( | 499 CompileRun( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 #ifdef OBJECT_PRINT | 581 #ifdef OBJECT_PRINT |
582 code->Print(); | 582 code->Print(); |
583 #endif | 583 #endif |
584 | 584 |
585 F8 f = FUNCTION_CAST<F8>(code->entry()); | 585 F8 f = FUNCTION_CAST<F8>(code->entry()); |
586 CHECK_EQ(2, f(1.0, 2.0)); | 586 CHECK_EQ(2, f(1.0, 2.0)); |
587 } | 587 } |
588 | 588 |
589 | 589 |
590 #undef __ | 590 #undef __ |
OLD | NEW |