Lgtm

On Tue, Oct 7, 2008 at 10:59 AM,  <[EMAIL PROTECTED]> wrote:
> Reviewers: Christian Plesner Hansen,
>
> Message:
> Stricter IsFlat.
> All tests still run in mode=debug.
>
> Description:
> Fixed typo
>
> Please review this at http://codereview.chromium.org/6302
>
> Affected files:
>  M src/objects-inl.h
>  M test/mjsunit/switch.js
>
>
> Index: src/objects-inl.h
> diff --git a/src/objects-inl.h b/src/objects-inl.h
> index
> decaf392f6d999002e9d9db5eaaf22f587e100de..a612ba984cc86e534669b9513cb7f87478179c56
> 100644
> --- a/src/objects-inl.h
> +++ b/src/objects-inl.h
> @@ -1321,17 +1321,17 @@ StringRepresentationTag
> String::map_representation_tag(Map* map) {
>
>
>  bool String::IsFlat() {
> -  String* current = this;
> -  while (true) {
> -    switch (current->representation_tag()) {
> -      case kConsStringTag:
> -        return String::cast(ConsString::cast(current)->second())->length()
> == 0;
> -      case kSlicedStringTag:
> -        current = String::cast(SlicedString::cast(this)->buffer());
> -        break;
> -      default:
> -        return true;
> +  switch (this->representation_tag()) {
> +    case kConsStringTag:
> +      // Only flattened strings have second part empty.
> +      return String::cast(ConsString::cast(this)->second())->length() == 0;
> +    case kSlicedStringTag: {
> +      String* slice = String::cast(SlicedString::cast(this)->buffer());
> +      StringRepresentationTag tag = slice->representation_tag();
> +      return tag == kSeqStringTag || tag == kExternalStringTag;
>     }
> +    default:
> +      return true;
>   }
>  }
>
> Index: test/mjsunit/switch.js
> diff --git a/test/mjsunit/switch.js b/test/mjsunit/switch.js
> index
> 3b8458d3d963425f065e147f4c0e92377b101d01..ae5ce2bdcdad80afd1503496b849906e3638eb2b
> 100644
> --- a/test/mjsunit/switch.js
> +++ b/test/mjsunit/switch.js
> @@ -27,7 +27,7 @@
>
>  function f0() {
>   switch (0) {
> -    // switch deliberatly left empty
> +    // switch deliberately left empty
>   }
>  }
>
>
>
>

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

Reply via email to