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

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

Issue 212763008: Clean up runtime functions for Maths. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months 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/ia32/code-stubs-ia32.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 3521 matching lines...) Expand 10 before | Expand all | Expand 10 after
3532 // Load the arguments on the stack and call the runtime function. 3532 // Load the arguments on the stack and call the runtime function.
3533 ZoneList<Expression*>* args = expr->arguments(); 3533 ZoneList<Expression*>* args = expr->arguments();
3534 ASSERT(args->length() == 2); 3534 ASSERT(args->length() == 2);
3535 VisitForStackValue(args->at(0)); 3535 VisitForStackValue(args->at(0));
3536 VisitForStackValue(args->at(1)); 3536 VisitForStackValue(args->at(1));
3537 3537
3538 if (CpuFeatures::IsSupported(SSE2)) { 3538 if (CpuFeatures::IsSupported(SSE2)) {
3539 MathPowStub stub(MathPowStub::ON_STACK); 3539 MathPowStub stub(MathPowStub::ON_STACK);
3540 __ CallStub(&stub); 3540 __ CallStub(&stub);
3541 } else { 3541 } else {
3542 __ CallRuntime(Runtime::kMath_pow, 2); 3542 __ CallRuntime(Runtime::kHiddenMathPowSlow, 2);
3543 } 3543 }
3544 context()->Plug(eax); 3544 context()->Plug(eax);
3545 } 3545 }
3546 3546
3547 3547
3548 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) { 3548 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) {
3549 ZoneList<Expression*>* args = expr->arguments(); 3549 ZoneList<Expression*>* args = expr->arguments();
3550 ASSERT(args->length() == 2); 3550 ASSERT(args->length() == 2);
3551 3551
3552 VisitForStackValue(args->at(0)); // Load the object. 3552 VisitForStackValue(args->at(0)); // Load the object.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3719 3719
3720 VisitForStackValue(args->at(0)); 3720 VisitForStackValue(args->at(0));
3721 VisitForStackValue(args->at(1)); 3721 VisitForStackValue(args->at(1));
3722 3722
3723 StringCompareStub stub; 3723 StringCompareStub stub;
3724 __ CallStub(&stub); 3724 __ CallStub(&stub);
3725 context()->Plug(eax); 3725 context()->Plug(eax);
3726 } 3726 }
3727 3727
3728 3728
3729 void FullCodeGenerator::EmitMathLog(CallRuntime* expr) {
3730 // Load the argument on the stack and call the runtime function.
3731 ZoneList<Expression*>* args = expr->arguments();
3732 ASSERT(args->length() == 1);
3733 VisitForStackValue(args->at(0));
3734 __ CallRuntime(Runtime::kMath_log, 1);
3735 context()->Plug(eax);
3736 }
3737
3738
3739 void FullCodeGenerator::EmitMathSqrt(CallRuntime* expr) {
3740 // Load the argument on the stack and call the runtime function.
3741 ZoneList<Expression*>* args = expr->arguments();
3742 ASSERT(args->length() == 1);
3743 VisitForStackValue(args->at(0));
3744 __ CallRuntime(Runtime::kMath_sqrt, 1);
3745 context()->Plug(eax);
3746 }
3747
3748
3749 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3729 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3750 ZoneList<Expression*>* args = expr->arguments(); 3730 ZoneList<Expression*>* args = expr->arguments();
3751 ASSERT(args->length() >= 2); 3731 ASSERT(args->length() >= 2);
3752 3732
3753 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3733 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3754 for (int i = 0; i < arg_count + 1; ++i) { 3734 for (int i = 0; i < arg_count + 1; ++i) {
3755 VisitForStackValue(args->at(i)); 3735 VisitForStackValue(args->at(i));
3756 } 3736 }
3757 VisitForAccumulatorValue(args->last()); // Function. 3737 VisitForAccumulatorValue(args->last()); // Function.
3758 3738
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4936 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4916 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4937 Assembler::target_address_at(call_target_address, 4917 Assembler::target_address_at(call_target_address,
4938 unoptimized_code)); 4918 unoptimized_code));
4939 return OSR_AFTER_STACK_CHECK; 4919 return OSR_AFTER_STACK_CHECK;
4940 } 4920 }
4941 4921
4942 4922
4943 } } // namespace v8::internal 4923 } } // namespace v8::internal
4944 4924
4945 #endif // V8_TARGET_ARCH_IA32 4925 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698