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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 CompileRun( | 541 CompileRun( |
542 "function foo(vec) {" | 542 "function foo(vec) {" |
543 " return do_sse2(vec);" | 543 " return do_sse2(vec);" |
544 "}"); | 544 "}"); |
545 | 545 |
546 v8::Local<v8::Object> global_object = env->Global(); | 546 v8::Local<v8::Object> global_object = env->Global(); |
547 v8::Local<v8::Function> foo = | 547 v8::Local<v8::Function> foo = |
548 v8::Local<v8::Function>::Cast(global_object->Get(v8_str("foo"))); | 548 v8::Local<v8::Function>::Cast(global_object->Get(v8_str("foo"))); |
549 | 549 |
550 int32_t vec[ELEMENT_COUNT] = { -1, 1, 1, 1 }; | 550 int32_t vec[ELEMENT_COUNT] = { -1, 1, 1, 1 }; |
551 v8::Local<v8::Array> v8_vec = v8::Array::New(ELEMENT_COUNT); | 551 v8::Local<v8::Array> v8_vec = v8::Array::New(isolate, ELEMENT_COUNT); |
552 for (int i = 0; i < ELEMENT_COUNT; i++) { | 552 for (int i = 0; i < ELEMENT_COUNT; i++) { |
553 v8_vec->Set(i, v8_num(vec[i])); | 553 v8_vec->Set(i, v8_num(vec[i])); |
554 } | 554 } |
555 | 555 |
556 v8::Local<v8::Value> args[] = { v8_vec }; | 556 v8::Local<v8::Value> args[] = { v8_vec }; |
557 v8::Local<v8::Value> result = foo->Call(global_object, 1, args); | 557 v8::Local<v8::Value> result = foo->Call(global_object, 1, args); |
558 | 558 |
559 // The mask should be 0b1000. | 559 // The mask should be 0b1000. |
560 CHECK_EQ(8, result->Int32Value()); | 560 CHECK_EQ(8, result->Int32Value()); |
561 } | 561 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 #ifdef OBJECT_PRINT | 633 #ifdef OBJECT_PRINT |
634 Code::cast(code)->Print(); | 634 Code::cast(code)->Print(); |
635 #endif | 635 #endif |
636 | 636 |
637 F8 f = FUNCTION_CAST<F8>(Code::cast(code)->entry()); | 637 F8 f = FUNCTION_CAST<F8>(Code::cast(code)->entry()); |
638 CHECK_EQ(2, f(1.0, 2.0)); | 638 CHECK_EQ(2, f(1.0, 2.0)); |
639 } | 639 } |
640 | 640 |
641 | 641 |
642 #undef __ | 642 #undef __ |
OLD | NEW |