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 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 &DisposeExternalAsciiString); | 3034 &DisposeExternalAsciiString); |
3035 } | 3035 } |
3036 return result; | 3036 return result; |
3037 } | 3037 } |
3038 | 3038 |
3039 | 3039 |
3040 bool v8::String::CanMakeExternal() { | 3040 bool v8::String::CanMakeExternal() { |
3041 if (IsDeadCheck("v8::String::CanMakeExternal()")) return false; | 3041 if (IsDeadCheck("v8::String::CanMakeExternal()")) return false; |
3042 i::Handle<i::String> obj = Utils::OpenHandle(this); | 3042 i::Handle<i::String> obj = Utils::OpenHandle(this); |
3043 int size = obj->Size(); // Byte size of the original string. | 3043 int size = obj->Size(); // Byte size of the original string. |
3044 return (size >= i::ExternalString::kSize) && !obj->IsExternalString(); | 3044 if (size < i::ExternalString::kSize) |
| 3045 return false; |
| 3046 i::StringShape shape(*obj); |
| 3047 return !shape.IsExternal(); |
3045 } | 3048 } |
3046 | 3049 |
3047 | 3050 |
3048 Local<v8::Object> v8::Object::New() { | 3051 Local<v8::Object> v8::Object::New() { |
3049 EnsureInitialized("v8::Object::New()"); | 3052 EnsureInitialized("v8::Object::New()"); |
3050 LOG_API("Object::New"); | 3053 LOG_API("Object::New"); |
3051 ENTER_V8; | 3054 ENTER_V8; |
3052 i::Handle<i::JSObject> obj = | 3055 i::Handle<i::JSObject> obj = |
3053 i::Factory::NewJSObject(i::Top::object_function()); | 3056 i::Factory::NewJSObject(i::Top::object_function()); |
3054 return Utils::ToLocal(obj); | 3057 return Utils::ToLocal(obj); |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3646 reinterpret_cast<HandleScopeImplementer*>(storage); | 3649 reinterpret_cast<HandleScopeImplementer*>(storage); |
3647 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3650 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
3648 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3651 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
3649 &thread_local->handle_scope_data_; | 3652 &thread_local->handle_scope_data_; |
3650 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3653 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
3651 | 3654 |
3652 return storage + ArchiveSpacePerThread(); | 3655 return storage + ArchiveSpacePerThread(); |
3653 } | 3656 } |
3654 | 3657 |
3655 } } // namespace v8::internal | 3658 } } // namespace v8::internal |
OLD | NEW |