| 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 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2642 } | 2642 } |
| 2643 | 2643 |
| 2644 | 2644 |
| 2645 String::Utf8Value::~Utf8Value() { | 2645 String::Utf8Value::~Utf8Value() { |
| 2646 i::DeleteArray(str_); | 2646 i::DeleteArray(str_); |
| 2647 } | 2647 } |
| 2648 | 2648 |
| 2649 | 2649 |
| 2650 String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) { | 2650 String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) { |
| 2651 EnsureInitialized("v8::String::AsciiValue::AsciiValue()"); | 2651 EnsureInitialized("v8::String::AsciiValue::AsciiValue()"); |
| 2652 if (obj.IsEmpty()) { |
| 2653 str_ = NULL; |
| 2654 length_ = 0; |
| 2655 return; |
| 2656 } |
| 2652 HandleScope scope; | 2657 HandleScope scope; |
| 2653 TryCatch try_catch; | 2658 TryCatch try_catch; |
| 2654 Handle<String> str = obj->ToString(); | 2659 Handle<String> str = obj->ToString(); |
| 2655 if (str.IsEmpty()) { | 2660 if (str.IsEmpty()) { |
| 2656 str_ = NULL; | 2661 str_ = NULL; |
| 2657 length_ = 0; | 2662 length_ = 0; |
| 2658 } else { | 2663 } else { |
| 2659 length_ = str->Length(); | 2664 length_ = str->Length(); |
| 2660 str_ = i::NewArray<char>(length_ + 1); | 2665 str_ = i::NewArray<char>(length_ + 1); |
| 2661 str->WriteAscii(str_); | 2666 str->WriteAscii(str_); |
| 2662 } | 2667 } |
| 2663 } | 2668 } |
| 2664 | 2669 |
| 2665 | 2670 |
| 2666 String::AsciiValue::~AsciiValue() { | 2671 String::AsciiValue::~AsciiValue() { |
| 2667 i::DeleteArray(str_); | 2672 i::DeleteArray(str_); |
| 2668 } | 2673 } |
| 2669 | 2674 |
| 2670 | 2675 |
| 2671 String::Value::Value(v8::Handle<v8::Value> obj) { | 2676 String::Value::Value(v8::Handle<v8::Value> obj) { |
| 2672 EnsureInitialized("v8::String::Value::Value()"); | 2677 EnsureInitialized("v8::String::Value::Value()"); |
| 2678 if (obj.IsEmpty()) { |
| 2679 str_ = NULL; |
| 2680 length_ = 0; |
| 2681 return; |
| 2682 } |
| 2673 HandleScope scope; | 2683 HandleScope scope; |
| 2674 TryCatch try_catch; | 2684 TryCatch try_catch; |
| 2675 Handle<String> str = obj->ToString(); | 2685 Handle<String> str = obj->ToString(); |
| 2676 if (str.IsEmpty()) { | 2686 if (str.IsEmpty()) { |
| 2677 str_ = NULL; | 2687 str_ = NULL; |
| 2678 length_ = 0; | 2688 length_ = 0; |
| 2679 } else { | 2689 } else { |
| 2680 length_ = str->Length(); | 2690 length_ = str->Length(); |
| 2681 str_ = i::NewArray<uint16_t>(length_ + 1); | 2691 str_ = i::NewArray<uint16_t>(length_ + 1); |
| 2682 str->Write(str_); | 2692 str->Write(str_); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2926 reinterpret_cast<HandleScopeImplementer*>(storage); | 2936 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 2927 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 2937 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
| 2928 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 2938 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
| 2929 &thread_local->handle_scope_data_; | 2939 &thread_local->handle_scope_data_; |
| 2930 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 2940 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
| 2931 | 2941 |
| 2932 return storage + ArchiveSpacePerThread(); | 2942 return storage + ArchiveSpacePerThread(); |
| 2933 } | 2943 } |
| 2934 | 2944 |
| 2935 } } // namespace v8::internal | 2945 } } // namespace v8::internal |
| OLD | NEW |