Reviewers: William Hesse,

Message:
Small review (one bug, prettifications).

Description:
X64: Fix bug in boolean conversion of empty string.

Please review this at http://codereview.chromium.org/165043

Affected files:
   M src/heap.cc
   M src/objects.h
   M src/x64/codegen-x64.cc


Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index  
d813ed1dfd3e8695f0eaf3257f432d5074aa4f9b..7c9177859f1ae8688757d48714a6c5a52c9ec29f
  
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -1669,7 +1669,7 @@ Object* Heap::AllocateSlicedString(String* buffer,
    int length = end - start;

    // If the resulting string is small make a sub string.
-  if (end - start <= String::kMinNonFlatLength) {
+  if (length <= String::kMinNonFlatLength) {
      return Heap::AllocateSubString(buffer, start, end);
    }

Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index  
d367f815fd8aaf8f5ab5be7bf571a375faeecb6e..b0d9d87099e70738d254a91431ca18363d4ea70f
  
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4038,8 +4038,8 @@ class SlicedString: public String {
    // Layout description
  #if V8_HOST_ARCH_64_BIT
    // Optimizations expect buffer to be located at same offset as a  
ConsString's
-  // first substring. In 64 bit mode we have room for the size before the
-  // buffer.
+  // first substring. In 64 bit mode we have room for the start offset  
before
+  // the buffer.
    static const int kStartOffset = String::kSize;
    static const int kBufferOffset = kStartOffset + kIntSize;
    static const int kSize = kBufferOffset + kPointerSize;
Index: src/x64/codegen-x64.cc
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc
index  
d2ac163b7ad0f90e2e87bfe9163a8eb8a963f2a2..9a60ba66e0f1f48cb6a0ec4d4b9ecc862654a6ef
  
100644
--- a/src/x64/codegen-x64.cc
+++ b/src/x64/codegen-x64.cc
@@ -5746,7 +5746,7 @@ void ToBooleanStub::Generate(MacroAssembler* masm) {
    __ and_(rcx, Immediate(kStringSizeMask));
    __ cmpq(rcx, Immediate(kShortStringTag));
    __ j(not_equal, &true_result);  // Empty string is always short.
-  __ movq(rdx, FieldOperand(rax, String::kLengthOffset));
+  __ movl(rdx, FieldOperand(rax, String::kLengthOffset));
    __ shr(rdx, Immediate(String::kShortLengthShift));
    __ j(zero, &false_result);
    __ jmp(&true_result);



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

Reply via email to