OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4493 } | 4493 } |
4494 bool result = obj->MakeExternal(resource); | 4494 bool result = obj->MakeExternal(resource); |
4495 if (result && !obj->IsSymbol()) { | 4495 if (result && !obj->IsSymbol()) { |
4496 isolate->heap()->external_string_table()->AddString(*obj); | 4496 isolate->heap()->external_string_table()->AddString(*obj); |
4497 } | 4497 } |
4498 return result; | 4498 return result; |
4499 } | 4499 } |
4500 | 4500 |
4501 | 4501 |
4502 bool v8::String::CanMakeExternal() { | 4502 bool v8::String::CanMakeExternal() { |
| 4503 if (!internal::FLAG_clever_optimizations) return false; |
4503 i::Handle<i::String> obj = Utils::OpenHandle(this); | 4504 i::Handle<i::String> obj = Utils::OpenHandle(this); |
4504 i::Isolate* isolate = obj->GetIsolate(); | 4505 i::Isolate* isolate = obj->GetIsolate(); |
4505 if (IsDeadCheck(isolate, "v8::String::CanMakeExternal()")) return false; | 4506 if (IsDeadCheck(isolate, "v8::String::CanMakeExternal()")) return false; |
4506 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { | 4507 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { |
4507 return false; | 4508 return false; |
4508 } | 4509 } |
4509 int size = obj->Size(); // Byte size of the original string. | 4510 int size = obj->Size(); // Byte size of the original string. |
4510 if (size < i::ExternalString::kSize) | 4511 if (size < i::ExternalString::kSize) |
4511 return false; | 4512 return false; |
4512 i::StringShape shape(*obj); | 4513 i::StringShape shape(*obj); |
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6064 | 6065 |
6065 | 6066 |
6066 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6067 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
6067 HandleScopeImplementer* scope_implementer = | 6068 HandleScopeImplementer* scope_implementer = |
6068 reinterpret_cast<HandleScopeImplementer*>(storage); | 6069 reinterpret_cast<HandleScopeImplementer*>(storage); |
6069 scope_implementer->IterateThis(v); | 6070 scope_implementer->IterateThis(v); |
6070 return storage + ArchiveSpacePerThread(); | 6071 return storage + ArchiveSpacePerThread(); |
6071 } | 6072 } |
6072 | 6073 |
6073 } } // namespace v8::internal | 6074 } } // namespace v8::internal |
OLD | NEW |