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

Side by Side Diff: src/arm/full-codegen-arm.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 | « no previous file | src/hydrogen.cc » ('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 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after
3714 ASSERT_EQ(2, args->length()); 3714 ASSERT_EQ(2, args->length());
3715 VisitForStackValue(args->at(0)); 3715 VisitForStackValue(args->at(0));
3716 VisitForStackValue(args->at(1)); 3716 VisitForStackValue(args->at(1));
3717 3717
3718 StringCompareStub stub; 3718 StringCompareStub stub;
3719 __ CallStub(&stub); 3719 __ CallStub(&stub);
3720 context()->Plug(r0); 3720 context()->Plug(r0);
3721 } 3721 }
3722 3722
3723 3723
3724 void FullCodeGenerator::EmitMathSin(CallRuntime* expr) { 3724 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3725 // Load the argument on the stack and call the stub. 3725 // Load the argument on the stack and call the stub.
3726 TranscendentalCacheStub stub(TranscendentalCache::SIN, 3726 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3727 TranscendentalCacheStub::TAGGED); 3727 TranscendentalCacheStub::TAGGED);
3728 ZoneList<Expression*>* args = expr->arguments(); 3728 ZoneList<Expression*>* args = expr->arguments();
3729 ASSERT(args->length() == 1); 3729 ASSERT(args->length() == 1);
3730 VisitForStackValue(args->at(0));
3731 __ CallStub(&stub);
3732 context()->Plug(r0);
3733 }
3734
3735
3736 void FullCodeGenerator::EmitMathCos(CallRuntime* expr) {
3737 // Load the argument on the stack and call the stub.
3738 TranscendentalCacheStub stub(TranscendentalCache::COS,
3739 TranscendentalCacheStub::TAGGED);
3740 ZoneList<Expression*>* args = expr->arguments();
3741 ASSERT(args->length() == 1);
3742 VisitForStackValue(args->at(0));
3743 __ CallStub(&stub);
3744 context()->Plug(r0);
3745 }
3746
3747
3748 void FullCodeGenerator::EmitMathTan(CallRuntime* expr) {
3749 // Load the argument on the stack and call the stub.
3750 TranscendentalCacheStub stub(TranscendentalCache::TAN,
3751 TranscendentalCacheStub::TAGGED);
3752 ZoneList<Expression*>* args = expr->arguments();
3753 ASSERT(args->length() == 1);
3754 VisitForStackValue(args->at(0)); 3730 VisitForStackValue(args->at(0));
3755 __ CallStub(&stub); 3731 __ CallStub(&stub);
3756 context()->Plug(r0); 3732 context()->Plug(r0);
3757 } 3733 }
3758 3734
3759 3735
3760 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3761 // Load the argument on the stack and call the stub.
3762 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3763 TranscendentalCacheStub::TAGGED);
3764 ZoneList<Expression*>* args = expr->arguments();
3765 ASSERT(args->length() == 1);
3766 VisitForStackValue(args->at(0));
3767 __ CallStub(&stub);
3768 context()->Plug(r0);
3769 }
3770
3771
3772 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) { 3736 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
3773 // Load the argument on the stack and call the runtime function. 3737 // Load the argument on the stack and call the runtime function.
3774 ZoneList<Expression*>* args = expr->arguments(); 3738 ZoneList<Expression*>* args = expr->arguments();
3775 ASSERT(args->length() == 1); 3739 ASSERT(args->length() == 1);
3776 VisitForStackValue(args->at(0)); 3740 VisitForStackValue(args->at(0));
3777 __ CallRuntime(Runtime::kMath_sqrt, 1); 3741 __ CallRuntime(Runtime::kMath_sqrt, 1);
3778 context()->Plug(r0); 3742 context()->Plug(r0);
3779 } 3743 }
3780 3744
3745
3746 void FullCodeGenerator::EmitMathFloor(CallRuntime* expr) {
3747 // Load the argument on the stack and call the runtime function.
3748 ZoneList<Expression*>* args = expr->arguments();
3749 ASSERT(args->length() == 1);
3750 VisitForStackValue(args->at(0));
3751 __ CallRuntime(Runtime::kMath_floor, 1);
3752 context()->Plug(r0);
3753 }
3754
3781 3755
3782 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3756 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3783 ZoneList<Expression*>* args = expr->arguments(); 3757 ZoneList<Expression*>* args = expr->arguments();
3784 ASSERT(args->length() >= 2); 3758 ASSERT(args->length() >= 2);
3785 3759
3786 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3760 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3787 for (int i = 0; i < arg_count + 1; i++) { 3761 for (int i = 0; i < arg_count + 1; i++) {
3788 VisitForStackValue(args->at(i)); 3762 VisitForStackValue(args->at(i));
3789 } 3763 }
3790 VisitForAccumulatorValue(args->last()); // Function. 3764 VisitForAccumulatorValue(args->last()); // Function.
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
4959 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4933 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4960 reinterpret_cast<uint32_t>( 4934 reinterpret_cast<uint32_t>(
4961 isolate->builtins()->OsrAfterStackCheck()->entry())); 4935 isolate->builtins()->OsrAfterStackCheck()->entry()));
4962 return OSR_AFTER_STACK_CHECK; 4936 return OSR_AFTER_STACK_CHECK;
4963 } 4937 }
4964 4938
4965 4939
4966 } } // namespace v8::internal 4940 } } // namespace v8::internal
4967 4941
4968 #endif // V8_TARGET_ARCH_ARM 4942 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698