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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 50563003: Implement Math.sin, cos and tan using table lookup and spline interpolation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/sin-cos.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after
3646 3646
3647 VisitForStackValue(args->at(0)); 3647 VisitForStackValue(args->at(0));
3648 VisitForStackValue(args->at(1)); 3648 VisitForStackValue(args->at(1));
3649 3649
3650 StringCompareStub stub; 3650 StringCompareStub stub;
3651 __ CallStub(&stub); 3651 __ CallStub(&stub);
3652 context()->Plug(rax); 3652 context()->Plug(rax);
3653 } 3653 }
3654 3654
3655 3655
3656 void FullCodeGenerator::EmitMathSin(CallRuntime* expr) { 3656 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3657 // Load the argument on the stack and call the stub. 3657 // Load the argument on the stack and call the stub.
3658 TranscendentalCacheStub stub(TranscendentalCache::SIN, 3658 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3659 TranscendentalCacheStub::TAGGED); 3659 TranscendentalCacheStub::TAGGED);
3660 ZoneList<Expression*>* args = expr->arguments(); 3660 ZoneList<Expression*>* args = expr->arguments();
3661 ASSERT(args->length() == 1); 3661 ASSERT(args->length() == 1);
3662 VisitForStackValue(args->at(0));
3663 __ CallStub(&stub);
3664 context()->Plug(rax);
3665 }
3666
3667
3668 void FullCodeGenerator::EmitMathCos(CallRuntime* expr) {
3669 // Load the argument on the stack and call the stub.
3670 TranscendentalCacheStub stub(TranscendentalCache::COS,
3671 TranscendentalCacheStub::TAGGED);
3672 ZoneList<Expression*>* args = expr->arguments();
3673 ASSERT(args->length() == 1);
3674 VisitForStackValue(args->at(0));
3675 __ CallStub(&stub);
3676 context()->Plug(rax);
3677 }
3678
3679
3680 void FullCodeGenerator::EmitMathTan(CallRuntime* expr) {
3681 // Load the argument on the stack and call the stub.
3682 TranscendentalCacheStub stub(TranscendentalCache::TAN,
3683 TranscendentalCacheStub::TAGGED);
3684 ZoneList<Expression*>* args = expr->arguments();
3685 ASSERT(args->length() == 1);
3686 VisitForStackValue(args->at(0)); 3662 VisitForStackValue(args->at(0));
3687 __ CallStub(&stub); 3663 __ CallStub(&stub);
3688 context()->Plug(rax); 3664 context()->Plug(rax);
3689 } 3665 }
3690 3666
3691 3667
3692 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3693 // Load the argument on the stack and call the stub.
3694 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3695 TranscendentalCacheStub::TAGGED);
3696 ZoneList<Expression*>* args = expr->arguments();
3697 ASSERT(args->length() == 1);
3698 VisitForStackValue(args->at(0));
3699 __ CallStub(&stub);
3700 context()->Plug(rax);
3701 }
3702
3703
3704 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) { 3668 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
3705 // Load the argument on the stack and call the runtime function. 3669 // Load the argument on the stack and call the runtime function.
3706 ZoneList<Expression*>* args = expr->arguments(); 3670 ZoneList<Expression*>* args = expr->arguments();
3707 ASSERT(args->length() == 1); 3671 ASSERT(args->length() == 1);
3708 VisitForStackValue(args->at(0)); 3672 VisitForStackValue(args->at(0));
3709 __ CallRuntime(Runtime::kMath_sqrt, 1); 3673 __ CallRuntime(Runtime::kMath_sqrt, 1);
3710 context()->Plug(rax); 3674 context()->Plug(rax);
3711 } 3675 }
3712 3676
3677
3678 void FullCodeGenerator::EmitMathFloor(CallRuntime* expr) {
3679 // Load the argument on the stack and call the runtime function.
3680 ZoneList<Expression*>* args = expr->arguments();
3681 ASSERT(args->length() == 1);
3682 VisitForStackValue(args->at(0));
3683 __ CallRuntime(Runtime::kMath_floor, 1);
3684 context()->Plug(rax);
3685 }
3686
3713 3687
3714 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3688 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3715 ZoneList<Expression*>* args = expr->arguments(); 3689 ZoneList<Expression*>* args = expr->arguments();
3716 ASSERT(args->length() >= 2); 3690 ASSERT(args->length() >= 2);
3717 3691
3718 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3692 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3719 for (int i = 0; i < arg_count + 1; i++) { 3693 for (int i = 0; i < arg_count + 1; i++) {
3720 VisitForStackValue(args->at(i)); 3694 VisitForStackValue(args->at(i));
3721 } 3695 }
3722 VisitForAccumulatorValue(args->last()); // Function. 3696 VisitForAccumulatorValue(args->last()); // Function.
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
4944 4918
4945 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4919 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4946 Assembler::target_address_at(call_target_address)); 4920 Assembler::target_address_at(call_target_address));
4947 return OSR_AFTER_STACK_CHECK; 4921 return OSR_AFTER_STACK_CHECK;
4948 } 4922 }
4949 4923
4950 4924
4951 } } // namespace v8::internal 4925 } } // namespace v8::internal
4952 4926
4953 #endif // V8_TARGET_ARCH_X64 4927 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/sin-cos.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698