OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 6940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6951 | 6951 |
6952 static void MorphAString(i::String* string, | 6952 static void MorphAString(i::String* string, |
6953 AsciiVectorResource* ascii_resource, | 6953 AsciiVectorResource* ascii_resource, |
6954 UC16VectorResource* uc16_resource) { | 6954 UC16VectorResource* uc16_resource) { |
6955 CHECK(i::StringShape(string).IsExternal()); | 6955 CHECK(i::StringShape(string).IsExternal()); |
6956 if (string->IsAsciiRepresentation()) { | 6956 if (string->IsAsciiRepresentation()) { |
6957 // Check old map is not symbol or long. | 6957 // Check old map is not symbol or long. |
6958 CHECK(string->map() == i::Heap::short_external_ascii_string_map() || | 6958 CHECK(string->map() == i::Heap::short_external_ascii_string_map() || |
6959 string->map() == i::Heap::medium_external_ascii_string_map()); | 6959 string->map() == i::Heap::medium_external_ascii_string_map()); |
6960 // Morph external string to be TwoByte string. | 6960 // Morph external string to be TwoByte string. |
6961 if (string->length() <= i::String::kMaxShortStringSize) { | 6961 if (string->length() <= i::String::kMaxShortSize) { |
6962 string->set_map(i::Heap::short_external_string_map()); | 6962 string->set_map(i::Heap::short_external_string_map()); |
6963 } else { | 6963 } else { |
6964 string->set_map(i::Heap::medium_external_string_map()); | 6964 string->set_map(i::Heap::medium_external_string_map()); |
6965 } | 6965 } |
6966 i::ExternalTwoByteString* morphed = | 6966 i::ExternalTwoByteString* morphed = |
6967 i::ExternalTwoByteString::cast(string); | 6967 i::ExternalTwoByteString::cast(string); |
6968 morphed->set_resource(uc16_resource); | 6968 morphed->set_resource(uc16_resource); |
6969 } else { | 6969 } else { |
6970 // Check old map is not symbol or long. | 6970 // Check old map is not symbol or long. |
6971 CHECK(string->map() == i::Heap::short_external_string_map() || | 6971 CHECK(string->map() == i::Heap::short_external_string_map() || |
6972 string->map() == i::Heap::medium_external_string_map()); | 6972 string->map() == i::Heap::medium_external_string_map()); |
6973 // Morph external string to be ASCII string. | 6973 // Morph external string to be ASCII string. |
6974 if (string->length() <= i::String::kMaxShortStringSize) { | 6974 if (string->length() <= i::String::kMaxShortSize) { |
6975 string->set_map(i::Heap::short_external_ascii_string_map()); | 6975 string->set_map(i::Heap::short_external_ascii_string_map()); |
6976 } else { | 6976 } else { |
6977 string->set_map(i::Heap::medium_external_ascii_string_map()); | 6977 string->set_map(i::Heap::medium_external_ascii_string_map()); |
6978 } | 6978 } |
6979 i::ExternalAsciiString* morphed = | 6979 i::ExternalAsciiString* morphed = |
6980 i::ExternalAsciiString::cast(string); | 6980 i::ExternalAsciiString::cast(string); |
6981 morphed->set_resource(ascii_resource); | 6981 morphed->set_resource(ascii_resource); |
6982 } | 6982 } |
6983 } | 6983 } |
6984 | 6984 |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8279 double stored_date = date->NumberValue(); | 8279 double stored_date = date->NumberValue(); |
8280 if (!IsNaN(expected_stored_date)) { | 8280 if (!IsNaN(expected_stored_date)) { |
8281 CHECK_EQ(expected_stored_date, stored_date); | 8281 CHECK_EQ(expected_stored_date, stored_date); |
8282 } else { | 8282 } else { |
8283 uint64_t stored_bits = DoubleToBits(stored_date); | 8283 uint64_t stored_bits = DoubleToBits(stored_date); |
8284 // Check if quiet nan (bits 51..62 all set). | 8284 // Check if quiet nan (bits 51..62 all set). |
8285 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); | 8285 CHECK_EQ(0xfff, static_cast<int>((stored_bits >> 51) & 0xfff)); |
8286 } | 8286 } |
8287 } | 8287 } |
8288 } | 8288 } |
OLD | NEW |