OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // 1. Let c be the code unit in S at index i. | 575 // 1. Let c be the code unit in S at index i. |
576 UChar c = s[i]; | 576 UChar c = s[i]; |
577 // 2. Depending on the value of c: | 577 // 2. Depending on the value of c: |
578 if (U16_IS_SINGLE(c)) { | 578 if (U16_IS_SINGLE(c)) { |
579 // c < 0xD800 or c > 0xDFFF | 579 // c < 0xD800 or c > 0xDFFF |
580 // Append to U the Unicode character with code point c. | 580 // Append to U the Unicode character with code point c. |
581 u.append(c); | 581 u.append(c); |
582 } else if (U16_IS_TRAIL(c)) { | 582 } else if (U16_IS_TRAIL(c)) { |
583 // 0xDC00 <= c <= 0xDFFF | 583 // 0xDC00 <= c <= 0xDFFF |
584 // Append to U a U+FFFD REPLACEMENT CHARACTER. | 584 // Append to U a U+FFFD REPLACEMENT CHARACTER. |
585 u.append(WTF::Unicode::replacementCharacter); | 585 u.append(replacementCharacter); |
586 } else { | 586 } else { |
587 // 0xD800 <= c <= 0xDBFF | 587 // 0xD800 <= c <= 0xDBFF |
588 ASSERT(U16_IS_LEAD(c)); | 588 ASSERT(U16_IS_LEAD(c)); |
589 if (i == n - 1) { | 589 if (i == n - 1) { |
590 // 1. If i = n-1, then append to U a U+FFFD REPLACEMENT CHARACTE
R. | 590 // 1. If i = n-1, then append to U a U+FFFD REPLACEMENT CHARACTE
R. |
591 u.append(WTF::Unicode::replacementCharacter); | 591 u.append(replacementCharacter); |
592 } else { | 592 } else { |
593 // 2. Otherwise, i < n-1: | 593 // 2. Otherwise, i < n-1: |
594 ASSERT(i < n - 1); | 594 ASSERT(i < n - 1); |
595 // ....1. Let d be the code unit in S at index i+1. | 595 // ....1. Let d be the code unit in S at index i+1. |
596 UChar d = s[i + 1]; | 596 UChar d = s[i + 1]; |
597 if (U16_IS_TRAIL(d)) { | 597 if (U16_IS_TRAIL(d)) { |
598 // 2. If 0xDC00 <= d <= 0xDFFF, then: | 598 // 2. If 0xDC00 <= d <= 0xDFFF, then: |
599 // ..1. Let a be c & 0x3FF. | 599 // ..1. Let a be c & 0x3FF. |
600 // ..2. Let b be d & 0x3FF. | 600 // ..2. Let b be d & 0x3FF. |
601 // ..3. Append to U the Unicode character with code point 2^
16+2^10*a+b. | 601 // ..3. Append to U the Unicode character with code point 2^
16+2^10*a+b. |
602 u.append(U16_GET_SUPPLEMENTARY(c, d)); | 602 u.append(U16_GET_SUPPLEMENTARY(c, d)); |
603 // Blink: This is equivalent to u.append(c); u.append(d); | 603 // Blink: This is equivalent to u.append(c); u.append(d); |
604 ++i; | 604 ++i; |
605 } else { | 605 } else { |
606 // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a U+F
FFD REPLACEMENT CHARACTER. | 606 // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a U+F
FFD REPLACEMENT CHARACTER. |
607 u.append(WTF::Unicode::replacementCharacter); | 607 u.append(replacementCharacter); |
608 } | 608 } |
609 } | 609 } |
610 } | 610 } |
611 // 3. Set i to i+1. | 611 // 3. Set i to i+1. |
612 ++i; | 612 ++i; |
613 } | 613 } |
614 | 614 |
615 // 6. Return U. | 615 // 6. Return U. |
616 ASSERT(u.length() == string.length()); | 616 ASSERT(u.length() == string.length()); |
617 return u.toString(); | 617 return u.toString(); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 v8::Local<v8::Value> data = info.Data(); | 988 v8::Local<v8::Value> data = info.Data(); |
989 ASSERT(data->IsExternal()); | 989 ASSERT(data->IsExternal()); |
990 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); | 990 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre
ationContext()); |
991 if (!perContextData) | 991 if (!perContextData) |
992 return; | 992 return; |
993 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 993 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
994 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 994 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
995 } | 995 } |
996 | 996 |
997 } // namespace blink | 997 } // namespace blink |
OLD | NEW |