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

Side by Side Diff: src/mips/full-codegen-mips.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/math.js ('k') | src/objects.h » ('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 3738 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 3749
3750 VisitForStackValue(args->at(0)); 3750 VisitForStackValue(args->at(0));
3751 VisitForStackValue(args->at(1)); 3751 VisitForStackValue(args->at(1));
3752 3752
3753 StringCompareStub stub; 3753 StringCompareStub stub;
3754 __ CallStub(&stub); 3754 __ CallStub(&stub);
3755 context()->Plug(v0); 3755 context()->Plug(v0);
3756 } 3756 }
3757 3757
3758 3758
3759 void FullCodeGenerator::EmitMathSin(CallRuntime* expr) { 3759 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3760 // Load the argument on the stack and call the stub. 3760 // Load the argument on the stack and call the stub.
3761 TranscendentalCacheStub stub(TranscendentalCache::SIN, 3761 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3762 TranscendentalCacheStub::TAGGED); 3762 TranscendentalCacheStub::TAGGED);
3763 ZoneList<Expression*>* args = expr->arguments(); 3763 ZoneList<Expression*>* args = expr->arguments();
3764 ASSERT(args->length() == 1); 3764 ASSERT(args->length() == 1);
3765 VisitForStackValue(args->at(0));
3766 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos.
3767 __ CallStub(&stub);
3768 context()->Plug(v0);
3769 }
3770
3771
3772 void FullCodeGenerator::EmitMathCos(CallRuntime* expr) {
3773 // Load the argument on the stack and call the stub.
3774 TranscendentalCacheStub stub(TranscendentalCache::COS,
3775 TranscendentalCacheStub::TAGGED);
3776 ZoneList<Expression*>* args = expr->arguments();
3777 ASSERT(args->length() == 1);
3778 VisitForStackValue(args->at(0));
3779 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos.
3780 __ CallStub(&stub);
3781 context()->Plug(v0);
3782 }
3783
3784
3785 void FullCodeGenerator::EmitMathTan(CallRuntime* expr) {
3786 // Load the argument on the stack and call the stub.
3787 TranscendentalCacheStub stub(TranscendentalCache::TAN,
3788 TranscendentalCacheStub::TAGGED);
3789 ZoneList<Expression*>* args = expr->arguments();
3790 ASSERT(args->length() == 1);
3791 VisitForStackValue(args->at(0)); 3765 VisitForStackValue(args->at(0));
3792 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos. 3766 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos.
3793 __ CallStub(&stub); 3767 __ CallStub(&stub);
3794 context()->Plug(v0); 3768 context()->Plug(v0);
3795 } 3769 }
3796 3770
3797 3771
3798 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3799 // Load the argument on the stack and call the stub.
3800 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3801 TranscendentalCacheStub::TAGGED);
3802 ZoneList<Expression*>* args = expr->arguments();
3803 ASSERT(args->length() == 1);
3804 VisitForStackValue(args->at(0));
3805 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos.
3806 __ CallStub(&stub);
3807 context()->Plug(v0);
3808 }
3809
3810
3811 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) { 3772 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
3812 // Load the argument on the stack and call the runtime function. 3773 // Load the argument on the stack and call the runtime function.
3813 ZoneList<Expression*>* args = expr->arguments(); 3774 ZoneList<Expression*>* args = expr->arguments();
3814 ASSERT(args->length() == 1); 3775 ASSERT(args->length() == 1);
3815 VisitForStackValue(args->at(0)); 3776 VisitForStackValue(args->at(0));
3816 __ CallRuntime(Runtime::kMath_sqrt, 1); 3777 __ CallRuntime(Runtime::kMath_sqrt, 1);
3817 context()->Plug(v0); 3778 context()->Plug(v0);
3818 } 3779 }
3819 3780
3781
3782 void FullCodeGenerator::EmitMathFloor(CallRuntime* expr) {
3783 // Load the argument on the stack and call the runtime function.
3784 ZoneList<Expression*>* args = expr->arguments();
3785 ASSERT(args->length() == 1);
3786 VisitForStackValue(args->at(0));
3787 __ CallRuntime(Runtime::kMath_floor, 1);
3788 context()->Plug(v0);
3789 }
3790
3820 3791
3821 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3792 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3822 ZoneList<Expression*>* args = expr->arguments(); 3793 ZoneList<Expression*>* args = expr->arguments();
3823 ASSERT(args->length() >= 2); 3794 ASSERT(args->length() >= 2);
3824 3795
3825 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3796 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3826 for (int i = 0; i < arg_count + 1; i++) { 3797 for (int i = 0; i < arg_count + 1; i++) {
3827 VisitForStackValue(args->at(i)); 3798 VisitForStackValue(args->at(i));
3828 } 3799 }
3829 VisitForAccumulatorValue(args->last()); // Function. 3800 VisitForAccumulatorValue(args->last()); // Function.
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
4993 Assembler::target_address_at(pc_immediate_load_address)) == 4964 Assembler::target_address_at(pc_immediate_load_address)) ==
4994 reinterpret_cast<uint32_t>( 4965 reinterpret_cast<uint32_t>(
4995 isolate->builtins()->OsrAfterStackCheck()->entry())); 4966 isolate->builtins()->OsrAfterStackCheck()->entry()));
4996 return OSR_AFTER_STACK_CHECK; 4967 return OSR_AFTER_STACK_CHECK;
4997 } 4968 }
4998 4969
4999 4970
5000 } } // namespace v8::internal 4971 } } // namespace v8::internal
5001 4972
5002 #endif // V8_TARGET_ARCH_MIPS 4973 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/math.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698