OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 EnsureInitialized("v8::String::IsExternalAscii()"); | 2348 EnsureInitialized("v8::String::IsExternalAscii()"); |
2349 i::Handle<i::String> str = Utils::OpenHandle(this); | 2349 i::Handle<i::String> str = Utils::OpenHandle(this); |
2350 return i::StringShape(*str).IsExternalAscii(); | 2350 return i::StringShape(*str).IsExternalAscii(); |
2351 } | 2351 } |
2352 | 2352 |
2353 | 2353 |
2354 v8::String::ExternalStringResource* | 2354 v8::String::ExternalStringResource* |
2355 v8::String::GetExternalStringResource() const { | 2355 v8::String::GetExternalStringResource() const { |
2356 EnsureInitialized("v8::String::GetExternalStringResource()"); | 2356 EnsureInitialized("v8::String::GetExternalStringResource()"); |
2357 i::Handle<i::String> str = Utils::OpenHandle(this); | 2357 i::Handle<i::String> str = Utils::OpenHandle(this); |
2358 ASSERT(str->IsExternalTwoByteString()); | 2358 if (i::StringShape(*str).IsExternalTwoByte()) { |
2359 void* resource = i::Handle<i::ExternalTwoByteString>::cast(str)->resource(); | 2359 void* resource = i::Handle<i::ExternalTwoByteString>::cast(str)->resource(); |
2360 return reinterpret_cast<ExternalStringResource*>(resource); | 2360 return reinterpret_cast<ExternalStringResource*>(resource); |
| 2361 } else { |
| 2362 return NULL; |
| 2363 } |
2361 } | 2364 } |
2362 | 2365 |
2363 | 2366 |
2364 v8::String::ExternalAsciiStringResource* | 2367 v8::String::ExternalAsciiStringResource* |
2365 v8::String::GetExternalAsciiStringResource() const { | 2368 v8::String::GetExternalAsciiStringResource() const { |
2366 EnsureInitialized("v8::String::GetExternalAsciiStringResource()"); | 2369 EnsureInitialized("v8::String::GetExternalAsciiStringResource()"); |
2367 i::Handle<i::String> str = Utils::OpenHandle(this); | 2370 i::Handle<i::String> str = Utils::OpenHandle(this); |
2368 ASSERT(str->IsExternalAsciiString()); | 2371 if (i::StringShape(*str).IsExternalAscii()) { |
2369 void* resource = i::Handle<i::ExternalAsciiString>::cast(str)->resource(); | 2372 void* resource = i::Handle<i::ExternalAsciiString>::cast(str)->resource(); |
2370 return reinterpret_cast<ExternalAsciiStringResource*>(resource); | 2373 return reinterpret_cast<ExternalAsciiStringResource*>(resource); |
| 2374 } else { |
| 2375 return NULL; |
| 2376 } |
2371 } | 2377 } |
2372 | 2378 |
2373 | 2379 |
2374 double Number::Value() const { | 2380 double Number::Value() const { |
2375 if (IsDeadCheck("v8::Number::Value()")) return 0; | 2381 if (IsDeadCheck("v8::Number::Value()")) return 0; |
2376 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2382 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2377 return obj->Number(); | 2383 return obj->Number(); |
2378 } | 2384 } |
2379 | 2385 |
2380 | 2386 |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3462 reinterpret_cast<HandleScopeImplementer*>(storage); | 3468 reinterpret_cast<HandleScopeImplementer*>(storage); |
3463 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3469 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
3464 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3470 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
3465 &thread_local->handle_scope_data_; | 3471 &thread_local->handle_scope_data_; |
3466 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3472 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
3467 | 3473 |
3468 return storage + ArchiveSpacePerThread(); | 3474 return storage + ArchiveSpacePerThread(); |
3469 } | 3475 } |
3470 | 3476 |
3471 } } // namespace v8::internal | 3477 } } // namespace v8::internal |
OLD | NEW |