OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2616 | 2616 |
2617 | 2617 |
2618 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) { | 2618 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) { |
2619 if (IsDeadCheck("v8::V8::SetGlobalGCEpilogueCallback()")) return; | 2619 if (IsDeadCheck("v8::V8::SetGlobalGCEpilogueCallback()")) return; |
2620 i::Heap::SetGlobalGCEpilogueCallback(callback); | 2620 i::Heap::SetGlobalGCEpilogueCallback(callback); |
2621 } | 2621 } |
2622 | 2622 |
2623 | 2623 |
2624 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) { | 2624 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) { |
2625 EnsureInitialized("v8::String::Utf8Value::Utf8Value()"); | 2625 EnsureInitialized("v8::String::Utf8Value::Utf8Value()"); |
| 2626 if (obj.IsEmpty()) { |
| 2627 str_ = NULL; |
| 2628 length_ = 0; |
| 2629 return; |
| 2630 } |
2626 HandleScope scope; | 2631 HandleScope scope; |
2627 TryCatch try_catch; | 2632 TryCatch try_catch; |
2628 Handle<String> str = obj->ToString(); | 2633 Handle<String> str = obj->ToString(); |
2629 if (str.IsEmpty()) { | 2634 if (str.IsEmpty()) { |
2630 str_ = NULL; | 2635 str_ = NULL; |
2631 length_ = 0; | 2636 length_ = 0; |
2632 } else { | 2637 } else { |
2633 length_ = str->Utf8Length(); | 2638 length_ = str->Utf8Length(); |
2634 str_ = i::NewArray<char>(length_ + 1); | 2639 str_ = i::NewArray<char>(length_ + 1); |
2635 str->WriteUtf8(str_); | 2640 str->WriteUtf8(str_); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 reinterpret_cast<HandleScopeImplementer*>(storage); | 2926 reinterpret_cast<HandleScopeImplementer*>(storage); |
2922 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 2927 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
2923 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 2928 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
2924 &thread_local->handle_scope_data_; | 2929 &thread_local->handle_scope_data_; |
2925 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 2930 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
2926 | 2931 |
2927 return storage + ArchiveSpacePerThread(); | 2932 return storage + ArchiveSpacePerThread(); |
2928 } | 2933 } |
2929 | 2934 |
2930 } } // namespace v8::internal | 2935 } } // namespace v8::internal |
OLD | NEW |