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

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

Issue 70003004: Reland "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: fix 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 3744 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 3755
3756 VisitForStackValue(args->at(0)); 3756 VisitForStackValue(args->at(0));
3757 VisitForStackValue(args->at(1)); 3757 VisitForStackValue(args->at(1));
3758 3758
3759 StringCompareStub stub; 3759 StringCompareStub stub;
3760 __ CallStub(&stub); 3760 __ CallStub(&stub);
3761 context()->Plug(v0); 3761 context()->Plug(v0);
3762 } 3762 }
3763 3763
3764 3764
3765 void FullCodeGenerator::EmitMathSin(CallRuntime* expr) { 3765 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3766 // Load the argument on the stack and call the stub. 3766 // Load the argument on the stack and call the stub.
3767 TranscendentalCacheStub stub(TranscendentalCache::SIN, 3767 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3768 TranscendentalCacheStub::TAGGED); 3768 TranscendentalCacheStub::TAGGED);
3769 ZoneList<Expression*>* args = expr->arguments(); 3769 ZoneList<Expression*>* args = expr->arguments();
3770 ASSERT(args->length() == 1); 3770 ASSERT(args->length() == 1);
3771 VisitForStackValue(args->at(0));
3772 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos.
3773 __ CallStub(&stub);
3774 context()->Plug(v0);
3775 }
3776
3777
3778 void FullCodeGenerator::EmitMathCos(CallRuntime* expr) {
3779 // Load the argument on the stack and call the stub.
3780 TranscendentalCacheStub stub(TranscendentalCache::COS,
3781 TranscendentalCacheStub::TAGGED);
3782 ZoneList<Expression*>* args = expr->arguments();
3783 ASSERT(args->length() == 1);
3784 VisitForStackValue(args->at(0));
3785 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos.
3786 __ CallStub(&stub);
3787 context()->Plug(v0);
3788 }
3789
3790
3791 void FullCodeGenerator::EmitMathTan(CallRuntime* expr) {
3792 // Load the argument on the stack and call the stub.
3793 TranscendentalCacheStub stub(TranscendentalCache::TAN,
3794 TranscendentalCacheStub::TAGGED);
3795 ZoneList<Expression*>* args = expr->arguments();
3796 ASSERT(args->length() == 1);
3797 VisitForStackValue(args->at(0)); 3771 VisitForStackValue(args->at(0));
3798 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos. 3772 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos.
3799 __ CallStub(&stub); 3773 __ CallStub(&stub);
3800 context()->Plug(v0); 3774 context()->Plug(v0);
3801 } 3775 }
3802 3776
3803 3777
3804 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3805 // Load the argument on the stack and call the stub.
3806 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3807 TranscendentalCacheStub::TAGGED);
3808 ZoneList<Expression*>* args = expr->arguments();
3809 ASSERT(args->length() == 1);
3810 VisitForStackValue(args->at(0));
3811 __ mov(a0, result_register()); // Stub requires parameter in a0 and on tos.
3812 __ CallStub(&stub);
3813 context()->Plug(v0);
3814 }
3815
3816
3817 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) { 3778 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
3818 // Load the argument on the stack and call the runtime function. 3779 // Load the argument on the stack and call the runtime function.
3819 ZoneList<Expression*>* args = expr->arguments(); 3780 ZoneList<Expression*>* args = expr->arguments();
3820 ASSERT(args->length() == 1); 3781 ASSERT(args->length() == 1);
3821 VisitForStackValue(args->at(0)); 3782 VisitForStackValue(args->at(0));
3822 __ CallRuntime(Runtime::kMath_sqrt, 1); 3783 __ CallRuntime(Runtime::kMath_sqrt, 1);
3823 context()->Plug(v0); 3784 context()->Plug(v0);
3824 } 3785 }
3825 3786
3787
3788 void FullCodeGenerator::EmitMathFloor(CallRuntime* expr) {
3789 // Load the argument on the stack and call the runtime function.
3790 ZoneList<Expression*>* args = expr->arguments();
3791 ASSERT(args->length() == 1);
3792 VisitForStackValue(args->at(0));
3793 __ CallRuntime(Runtime::kMath_floor, 1);
3794 context()->Plug(v0);
3795 }
3796
3826 3797
3827 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3798 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3828 ZoneList<Expression*>* args = expr->arguments(); 3799 ZoneList<Expression*>* args = expr->arguments();
3829 ASSERT(args->length() >= 2); 3800 ASSERT(args->length() >= 2);
3830 3801
3831 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3802 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3832 for (int i = 0; i < arg_count + 1; i++) { 3803 for (int i = 0; i < arg_count + 1; i++) {
3833 VisitForStackValue(args->at(i)); 3804 VisitForStackValue(args->at(i));
3834 } 3805 }
3835 VisitForAccumulatorValue(args->last()); // Function. 3806 VisitForAccumulatorValue(args->last()); // Function.
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
5016 Assembler::target_address_at(pc_immediate_load_address)) == 4987 Assembler::target_address_at(pc_immediate_load_address)) ==
5017 reinterpret_cast<uint32_t>( 4988 reinterpret_cast<uint32_t>(
5018 isolate->builtins()->OsrAfterStackCheck()->entry())); 4989 isolate->builtins()->OsrAfterStackCheck()->entry()));
5019 return OSR_AFTER_STACK_CHECK; 4990 return OSR_AFTER_STACK_CHECK;
5020 } 4991 }
5021 4992
5022 4993
5023 } } // namespace v8::internal 4994 } } // namespace v8::internal
5024 4995
5025 #endif // V8_TARGET_ARCH_MIPS 4996 #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