Revision: 4770
Author: [email protected]
Date: Tue Jun  1 07:08:19 2010
Log: Fix generated code for String.charCodeAt.

Review URL: http://codereview.chromium.org/2468001
http://code.google.com/p/v8/source/detail?r=4770

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/arm/codegen-arm.cc
 /branches/bleeding_edge/src/ia32/codegen-ia32.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/x64/codegen-x64.cc

=======================================
--- /branches/bleeding_edge/include/v8.h        Wed May 26 04:28:14 2010
+++ /branches/bleeding_edge/include/v8.h        Tue Jun  1 07:08:19 2010
@@ -3177,7 +3177,7 @@
   static const int kProxyProxyOffset = sizeof(void*);
   static const int kJSObjectHeaderSize = 3 * sizeof(void*);
   static const int kFullStringRepresentationMask = 0x07;
-  static const int kExternalTwoByteRepresentationTag = 0x03;
+  static const int kExternalTwoByteRepresentationTag = 0x02;

   // These constants are compiler dependent so their values must be
   // defined within the implementation.
=======================================
--- /branches/bleeding_edge/src/arm/codegen-arm.cc      Mon May 31 01:52:57 2010
+++ /branches/bleeding_edge/src/arm/codegen-arm.cc      Tue Jun  1 07:08:19 2010
@@ -9283,7 +9283,7 @@
   __ CheckMap(index_, scratch_,
               Factory::heap_number_map(), index_not_number_, true);
   call_helper.BeforeCall(masm);
-  __ Push(object_, index_, result_);
+  __ Push(object_, index_);
   __ push(index_);  // Consumed by runtime conversion function.
   if (index_flags_ == STRING_INDEX_IS_NUMBER) {
     __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
@@ -9297,9 +9297,11 @@
     // have a chance to overwrite it.
     __ mov(scratch_, r0);
   }
-  __ pop(result_);
   __ pop(index_);
   __ pop(object_);
+  // Reload the instance type.
+  __ ldr(result_, FieldMemOperand(object_, HeapObject::kMapOffset));
+  __ ldrb(result_, FieldMemOperand(result_, Map::kInstanceTypeOffset));
   call_helper.AfterCall(masm);
   // If index is still not a smi, it must be out of range.
   __ BranchOnNotSmi(scratch_, index_out_of_range_);
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Thu May 27 05:30:45 2010 +++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Tue Jun 1 07:08:19 2010
@@ -12638,7 +12638,6 @@
   call_helper.BeforeCall(masm);
   __ push(object_);
   __ push(index_);
-  __ push(result_);
   __ push(index_);  // Consumed by runtime conversion function.
   if (index_flags_ == STRING_INDEX_IS_NUMBER) {
     __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
@@ -12652,9 +12651,11 @@
     // have a chance to overwrite it.
     __ mov(scratch_, eax);
   }
-  __ pop(result_);
   __ pop(index_);
   __ pop(object_);
+  // Reload the instance type.
+  __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset));
+  __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset));
   call_helper.AfterCall(masm);
   // If index is still not a smi, it must be out of range.
   ASSERT(kSmiTag == 0);
=======================================
--- /branches/bleeding_edge/src/objects.h       Thu May 27 05:30:45 2010
+++ /branches/bleeding_edge/src/objects.h       Tue Jun  1 07:08:19 2010
@@ -408,7 +408,7 @@
 enum StringRepresentationTag {
   kSeqStringTag = 0x0,
   kConsStringTag = 0x1,
-  kExternalStringTag = 0x3
+  kExternalStringTag = 0x2
 };
 const uint32_t kIsConsStringMask = 0x1;

=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Mon May 31 06:26:12 2010
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Tue Jun  1 07:08:19 2010
@@ -10922,7 +10922,6 @@
   call_helper.BeforeCall(masm);
   __ push(object_);
   __ push(index_);
-  __ push(result_);
   __ push(index_);  // Consumed by runtime conversion function.
   if (index_flags_ == STRING_INDEX_IS_NUMBER) {
     __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
@@ -10936,9 +10935,11 @@
     // have a chance to overwrite it.
     __ movq(scratch_, rax);
   }
-  __ pop(result_);
   __ pop(index_);
   __ pop(object_);
+  // Reload the instance type.
+  __ movq(result_, FieldOperand(object_, HeapObject::kMapOffset));
+  __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset));
   call_helper.AfterCall(masm);
   // If index is still not a smi, it must be out of range.
   __ JumpIfNotSmi(scratch_, index_out_of_range_);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to