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

Side by Side Diff: src/ia32/full-codegen-ia32.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/hydrogen.cc ('k') | src/math.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 3676 matching lines...) Expand 10 before | Expand all | Expand 10 after
3687 3687
3688 VisitForStackValue(args->at(0)); 3688 VisitForStackValue(args->at(0));
3689 VisitForStackValue(args->at(1)); 3689 VisitForStackValue(args->at(1));
3690 3690
3691 StringCompareStub stub; 3691 StringCompareStub stub;
3692 __ CallStub(&stub); 3692 __ CallStub(&stub);
3693 context()->Plug(eax); 3693 context()->Plug(eax);
3694 } 3694 }
3695 3695
3696 3696
3697 void FullCodeGenerator::EmitMathSin(CallRuntime* expr) { 3697 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3698 // Load the argument on the stack and call the stub. 3698 // Load the argument on the stack and call the stub.
3699 TranscendentalCacheStub stub(TranscendentalCache::SIN, 3699 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3700 TranscendentalCacheStub::TAGGED); 3700 TranscendentalCacheStub::TAGGED);
3701 ZoneList<Expression*>* args = expr->arguments(); 3701 ZoneList<Expression*>* args = expr->arguments();
3702 ASSERT(args->length() == 1); 3702 ASSERT(args->length() == 1);
3703 VisitForStackValue(args->at(0));
3704 __ CallStub(&stub);
3705 context()->Plug(eax);
3706 }
3707
3708
3709 void FullCodeGenerator::EmitMathCos(CallRuntime* expr) {
3710 // Load the argument on the stack and call the stub.
3711 TranscendentalCacheStub stub(TranscendentalCache::COS,
3712 TranscendentalCacheStub::TAGGED);
3713 ZoneList<Expression*>* args = expr->arguments();
3714 ASSERT(args->length() == 1);
3715 VisitForStackValue(args->at(0));
3716 __ CallStub(&stub);
3717 context()->Plug(eax);
3718 }
3719
3720
3721 void FullCodeGenerator::EmitMathTan(CallRuntime* expr) {
3722 // Load the argument on the stack and call the stub.
3723 TranscendentalCacheStub stub(TranscendentalCache::TAN,
3724 TranscendentalCacheStub::TAGGED);
3725 ZoneList<Expression*>* args = expr->arguments();
3726 ASSERT(args->length() == 1);
3727 VisitForStackValue(args->at(0)); 3703 VisitForStackValue(args->at(0));
3728 __ CallStub(&stub); 3704 __ CallStub(&stub);
3729 context()->Plug(eax); 3705 context()->Plug(eax);
3730 } 3706 }
3731 3707
3732 3708
3733 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3734 // Load the argument on the stack and call the stub.
3735 TranscendentalCacheStub stub(TranscendentalCache::LOG,
3736 TranscendentalCacheStub::TAGGED);
3737 ZoneList<Expression*>* args = expr->arguments();
3738 ASSERT(args->length() == 1);
3739 VisitForStackValue(args->at(0));
3740 __ CallStub(&stub);
3741 context()->Plug(eax);
3742 }
3743
3744
3745 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) { 3709 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
3746 // Load the argument on the stack and call the runtime function. 3710 // Load the argument on the stack and call the runtime function.
3747 ZoneList<Expression*>* args = expr->arguments(); 3711 ZoneList<Expression*>* args = expr->arguments();
3748 ASSERT(args->length() == 1); 3712 ASSERT(args->length() == 1);
3749 VisitForStackValue(args->at(0)); 3713 VisitForStackValue(args->at(0));
3750 __ CallRuntime(Runtime::kMath_sqrt, 1); 3714 __ CallRuntime(Runtime::kMath_sqrt, 1);
3751 context()->Plug(eax); 3715 context()->Plug(eax);
3752 } 3716 }
3753 3717
3718
3719 void FullCodeGenerator::EmitMathFloor(CallRuntime* expr) {
3720 // Load the argument on the stack and call the runtime function.
3721 ZoneList<Expression*>* args = expr->arguments();
3722 ASSERT(args->length() == 1);
3723 VisitForStackValue(args->at(0));
3724 __ CallRuntime(Runtime::kMath_floor, 1);
3725 context()->Plug(eax);
3726 }
3727
3754 3728
3755 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3729 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3756 ZoneList<Expression*>* args = expr->arguments(); 3730 ZoneList<Expression*>* args = expr->arguments();
3757 ASSERT(args->length() >= 2); 3731 ASSERT(args->length() >= 2);
3758 3732
3759 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3733 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3760 for (int i = 0; i < arg_count + 1; ++i) { 3734 for (int i = 0; i < arg_count + 1; ++i) {
3761 VisitForStackValue(args->at(i)); 3735 VisitForStackValue(args->at(i));
3762 } 3736 }
3763 VisitForAccumulatorValue(args->last()); // Function. 3737 VisitForAccumulatorValue(args->last()); // Function.
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
4957 4931
4958 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4932 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4959 Assembler::target_address_at(call_target_address)); 4933 Assembler::target_address_at(call_target_address));
4960 return OSR_AFTER_STACK_CHECK; 4934 return OSR_AFTER_STACK_CHECK;
4961 } 4935 }
4962 4936
4963 4937
4964 } } // namespace v8::internal 4938 } } // namespace v8::internal
4965 4939
4966 #endif // V8_TARGET_ARCH_IA32 4940 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698