A recursive call to the code generator could (conceivably) clobber any
authorkmillikin@chromium.org <kmillikin@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 10 Dec 2008 13:49:19 +0000 (13:49 +0000)
committerkmillikin@chromium.org <kmillikin@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 10 Dec 2008 13:49:19 +0000 (13:49 +0000)
register.  Generate code to evaluate both arguments of FastCharCodeAt
before popping either from the stack.
Review URL: http://codereview.chromium.org/13706

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@958 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/codegen-ia32.cc

index c5987a3cf0ffbd4440587372d54f83d65a769372..8e5420b66f834528e9e4487a19472dce8825d1e1 100644 (file)
@@ -2919,18 +2919,16 @@ void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) {
   Label ascii_string;
   Label got_char_code;
 
-  // Load the string into eax.
+  // Load the string into eax and the index into ebx.
   Load(args->at(0));
+  Load(args->at(1));
+  frame_->Pop(ebx);
   frame_->Pop(eax);
   // If the receiver is a smi return undefined.
   ASSERT(kSmiTag == 0);
   __ test(eax, Immediate(kSmiTagMask));
   __ j(zero, &slow_case, not_taken);
 
-  // Load the index into ebx.
-  Load(args->at(1));
-  frame_->Pop(ebx);
-
   // Check for negative or non-smi index.
   ASSERT(kSmiTag == 0);
   __ test(ebx, Immediate(kSmiTagMask | 0x80000000));