OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 4032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4043 } | 4043 } |
4044 bool result = obj->MakeExternal(resource); | 4044 bool result = obj->MakeExternal(resource); |
4045 if (result && !obj->IsSymbol()) { | 4045 if (result && !obj->IsSymbol()) { |
4046 isolate->heap()->external_string_table()->AddString(*obj); | 4046 isolate->heap()->external_string_table()->AddString(*obj); |
4047 } | 4047 } |
4048 return result; | 4048 return result; |
4049 } | 4049 } |
4050 | 4050 |
4051 | 4051 |
4052 bool v8::String::CanMakeExternal() { | 4052 bool v8::String::CanMakeExternal() { |
4053 i::Isolate* isolate = i::Isolate::Current(); | 4053 i::Handle<i::String> obj = Utils::OpenHandle(this); |
4054 i::Isolate* isolate = (*obj)->GetIsolate(); | |
Vitaly Repeshko
2011/03/21 19:26:47
obj->GetIsolate() should also work.
| |
4054 if (IsDeadCheck(isolate, "v8::String::CanMakeExternal()")) return false; | 4055 if (IsDeadCheck(isolate, "v8::String::CanMakeExternal()")) return false; |
4055 i::Handle<i::String> obj = Utils::OpenHandle(this); | |
4056 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { | 4056 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { |
4057 return false; | 4057 return false; |
4058 } | 4058 } |
4059 int size = obj->Size(); // Byte size of the original string. | 4059 int size = obj->Size(); // Byte size of the original string. |
4060 if (size < i::ExternalString::kSize) | 4060 if (size < i::ExternalString::kSize) |
4061 return false; | 4061 return false; |
4062 i::StringShape shape(*obj); | 4062 i::StringShape shape(*obj); |
4063 return !shape.IsExternal(); | 4063 return !shape.IsExternal(); |
4064 } | 4064 } |
4065 | 4065 |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5608 | 5608 |
5609 | 5609 |
5610 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5610 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5611 HandleScopeImplementer* thread_local = | 5611 HandleScopeImplementer* thread_local = |
5612 reinterpret_cast<HandleScopeImplementer*>(storage); | 5612 reinterpret_cast<HandleScopeImplementer*>(storage); |
5613 thread_local->IterateThis(v); | 5613 thread_local->IterateThis(v); |
5614 return storage + ArchiveSpacePerThread(); | 5614 return storage + ArchiveSpacePerThread(); |
5615 } | 5615 } |
5616 | 5616 |
5617 } } // namespace v8::internal | 5617 } } // namespace v8::internal |
OLD | NEW |