| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 F0 f = FUNCTION_CAST<F0>(code->entry()); | 426 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 427 int res = f(); | 427 int res = f(); |
| 428 CHECK_EQ(42, res); | 428 CHECK_EQ(42, res); |
| 429 } | 429 } |
| 430 | 430 |
| 431 | 431 |
| 432 #ifdef __GNUC__ | 432 #ifdef __GNUC__ |
| 433 #define ELEMENT_COUNT 4 | 433 #define ELEMENT_COUNT 4 |
| 434 | 434 |
| 435 void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) { | 435 void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 436 CcTest::InitializeVM(); | |
| 437 v8::HandleScope scope(CcTest::isolate()); | 436 v8::HandleScope scope(CcTest::isolate()); |
| 438 v8::internal::byte buffer[1024]; | 437 v8::internal::byte buffer[1024]; |
| 439 | 438 |
| 440 CHECK(args[0]->IsArray()); | 439 CHECK(args[0]->IsArray()); |
| 441 v8::Local<v8::Array> vec = v8::Local<v8::Array>::Cast(args[0]); | 440 v8::Local<v8::Array> vec = v8::Local<v8::Array>::Cast(args[0]); |
| 442 CHECK_EQ(ELEMENT_COUNT, vec->Length()); | 441 CHECK_EQ(ELEMENT_COUNT, vec->Length()); |
| 443 | 442 |
| 444 Isolate* isolate = CcTest::i_isolate(); | 443 Isolate* isolate = CcTest::i_isolate(); |
| 445 Assembler assm(isolate, buffer, sizeof(buffer)); | 444 Assembler assm(isolate, buffer, sizeof(buffer)); |
| 446 | 445 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 476 v8::internal::Handle<Code>())->ToObjectChecked()); | 475 v8::internal::Handle<Code>())->ToObjectChecked()); |
| 477 CHECK(code->IsCode()); | 476 CHECK(code->IsCode()); |
| 478 | 477 |
| 479 F0 f = FUNCTION_CAST<F0>(code->entry()); | 478 F0 f = FUNCTION_CAST<F0>(code->entry()); |
| 480 int res = f(); | 479 int res = f(); |
| 481 args.GetReturnValue().Set(v8::Integer::New(res)); | 480 args.GetReturnValue().Set(v8::Integer::New(res)); |
| 482 } | 481 } |
| 483 | 482 |
| 484 | 483 |
| 485 TEST(StackAlignmentForSSE2) { | 484 TEST(StackAlignmentForSSE2) { |
| 485 CcTest::InitializeVM(); |
| 486 CHECK_EQ(0, OS::ActivationFrameAlignment() % 16); | 486 CHECK_EQ(0, OS::ActivationFrameAlignment() % 16); |
| 487 | 487 |
| 488 v8::Isolate* isolate = CcTest::isolate(); | 488 v8::Isolate* isolate = CcTest::isolate(); |
| 489 v8::HandleScope handle_scope(isolate); | 489 v8::HandleScope handle_scope(isolate); |
| 490 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | 490 v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); |
| 491 global_template->Set(v8_str("do_sse2"), v8::FunctionTemplate::New(DoSSE2)); | 491 global_template->Set(v8_str("do_sse2"), v8::FunctionTemplate::New(DoSSE2)); |
| 492 | 492 |
| 493 LocalContext env(NULL, global_template); | 493 LocalContext env(NULL, global_template); |
| 494 CompileRun( | 494 CompileRun( |
| 495 "function foo(vec) {" | 495 "function foo(vec) {" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 511 | 511 |
| 512 // The mask should be 0b1000. | 512 // The mask should be 0b1000. |
| 513 CHECK_EQ(8, result->Int32Value()); | 513 CHECK_EQ(8, result->Int32Value()); |
| 514 } | 514 } |
| 515 | 515 |
| 516 #undef ELEMENT_COUNT | 516 #undef ELEMENT_COUNT |
| 517 #endif // __GNUC__ | 517 #endif // __GNUC__ |
| 518 | 518 |
| 519 | 519 |
| 520 #undef __ | 520 #undef __ |
| OLD | NEW |