OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4082 if (i::StringShape(*str).IsExternalTwoByte()) { | 4082 if (i::StringShape(*str).IsExternalTwoByte()) { |
4083 const void* resource = | 4083 const void* resource = |
4084 i::Handle<i::ExternalTwoByteString>::cast(str)->resource(); | 4084 i::Handle<i::ExternalTwoByteString>::cast(str)->resource(); |
4085 expected = reinterpret_cast<const ExternalStringResource*>(resource); | 4085 expected = reinterpret_cast<const ExternalStringResource*>(resource); |
4086 } else { | 4086 } else { |
4087 expected = NULL; | 4087 expected = NULL; |
4088 } | 4088 } |
4089 CHECK_EQ(expected, value); | 4089 CHECK_EQ(expected, value); |
4090 } | 4090 } |
4091 | 4091 |
| 4092 void v8::String::VerifyExternalStringResourceBase( |
| 4093 v8::String::ExternalStringResourceBase* value, |
| 4094 Encoding encoding) const { |
| 4095 i::Handle<i::String> str = Utils::OpenHandle(this); |
| 4096 const v8::String::ExternalStringResourceBase* expected; |
| 4097 Encoding expectedEncoding; |
| 4098 if (i::StringShape(*str).IsExternalAscii()) { |
| 4099 const void* resource = |
| 4100 i::Handle<i::ExternalAsciiString>::cast(str)->resource(); |
| 4101 expected = reinterpret_cast<const ExternalStringResourceBase*>(resource); |
| 4102 expectedEncoding = ASCII_ENCODING; |
| 4103 } else if (i::StringShape(*str).IsExternalTwoByte()) { |
| 4104 const void* resource = |
| 4105 i::Handle<i::ExternalTwoByteString>::cast(str)->resource(); |
| 4106 expected = reinterpret_cast<const ExternalStringResourceBase*>(resource); |
| 4107 expectedEncoding = TWO_BYTE_ENCODING; |
| 4108 } else { |
| 4109 expected = NULL; |
| 4110 expectedEncoding = str->IsAsciiRepresentation() ? ASCII_ENCODING |
| 4111 : TWO_BYTE_ENCODING; |
| 4112 } |
| 4113 CHECK_EQ(expected, value); |
| 4114 CHECK_EQ(expectedEncoding, encoding); |
| 4115 } |
4092 | 4116 |
4093 const v8::String::ExternalAsciiStringResource* | 4117 const v8::String::ExternalAsciiStringResource* |
4094 v8::String::GetExternalAsciiStringResource() const { | 4118 v8::String::GetExternalAsciiStringResource() const { |
4095 i::Handle<i::String> str = Utils::OpenHandle(this); | 4119 i::Handle<i::String> str = Utils::OpenHandle(this); |
4096 if (IsDeadCheck(str->GetIsolate(), | 4120 if (IsDeadCheck(str->GetIsolate(), |
4097 "v8::String::GetExternalAsciiStringResource()")) { | 4121 "v8::String::GetExternalAsciiStringResource()")) { |
4098 return NULL; | 4122 return NULL; |
4099 } | 4123 } |
4100 if (i::StringShape(*str).IsExternalAscii()) { | 4124 if (i::StringShape(*str).IsExternalAscii()) { |
4101 const void* resource = | 4125 const void* resource = |
(...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6554 | 6578 |
6555 v->VisitPointers(blocks_.first(), first_block_limit_); | 6579 v->VisitPointers(blocks_.first(), first_block_limit_); |
6556 | 6580 |
6557 for (int i = 1; i < blocks_.length(); i++) { | 6581 for (int i = 1; i < blocks_.length(); i++) { |
6558 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6582 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6559 } | 6583 } |
6560 } | 6584 } |
6561 | 6585 |
6562 | 6586 |
6563 } } // namespace v8::internal | 6587 } } // namespace v8::internal |
OLD | NEW |