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

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

Issue 125123: Fix stack alignment issue with the new fast Math.random() code (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 4919 matching lines...) Expand 10 before | Expand all | Expand 10 after
4930 ASSERT(ebp_as_smi.is_valid()); 4930 ASSERT(ebp_as_smi.is_valid());
4931 __ mov(ebp_as_smi.reg(), Operand(ebp)); 4931 __ mov(ebp_as_smi.reg(), Operand(ebp));
4932 __ shr(ebp_as_smi.reg(), kSmiTagSize); 4932 __ shr(ebp_as_smi.reg(), kSmiTagSize);
4933 frame_->Push(&ebp_as_smi); 4933 frame_->Push(&ebp_as_smi);
4934 } 4934 }
4935 4935
4936 4936
4937 void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) { 4937 void CodeGenerator::GenerateRandomPositiveSmi(ZoneList<Expression*>* args) {
4938 ASSERT(args->length() == 0); 4938 ASSERT(args->length() == 0);
4939 frame_->SpillAll(); 4939 frame_->SpillAll();
4940
4941 // Make sure the frame is aligned like the OS expects.
4942 static const int kFrameAlignment = OS::ActivationFrameAlignment();
4943 if (kFrameAlignment > 0) {
4944 ASSERT(IsPowerOf2(kFrameAlignment));
4945 __ mov(edi, Operand(esp)); // Save in callee-saved register.
4946 __ and_(esp, -kFrameAlignment);
4947 }
4948
4949 // Call V8::RandomPositiveSmi().
4940 __ call(FUNCTION_ADDR(V8::RandomPositiveSmi), RelocInfo::RUNTIME_ENTRY); 4950 __ call(FUNCTION_ADDR(V8::RandomPositiveSmi), RelocInfo::RUNTIME_ENTRY);
4951
4952 // Restore stack pointer from callee-saved register edi.
4953 if (kFrameAlignment > 0) {
4954 __ mov(esp, Operand(edi));
4955 }
4956
4941 Result result = allocator_->Allocate(eax); 4957 Result result = allocator_->Allocate(eax);
4942 frame_->Push(&result); 4958 frame_->Push(&result);
4943 } 4959 }
4944 4960
4945 4961
4946 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { 4962 void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
4947 if (CheckForInlineRuntimeCall(node)) { 4963 if (CheckForInlineRuntimeCall(node)) {
4948 return; 4964 return;
4949 } 4965 }
4950 4966
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after
7501 7517
7502 // Slow-case: Go through the JavaScript implementation. 7518 // Slow-case: Go through the JavaScript implementation.
7503 __ bind(&slow); 7519 __ bind(&slow);
7504 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 7520 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
7505 } 7521 }
7506 7522
7507 7523
7508 #undef __ 7524 #undef __
7509 7525
7510 } } // namespace v8::internal 7526 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698