OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
951 const int kRecursionBudget = 100; | 951 const int kRecursionBudget = 100; |
952 do { | 952 do { |
953 failure = false; | 953 failure = false; |
954 len = Utf8LengthHelper( | 954 len = Utf8LengthHelper( |
955 *str, 0, str->length(), false, kRecursionBudget, &failure, &dummy); | 955 *str, 0, str->length(), false, kRecursionBudget, &failure, &dummy); |
956 if (failure) FlattenString(str); | 956 if (failure) FlattenString(str); |
957 } while (failure); | 957 } while (failure); |
958 return len; | 958 return len; |
959 } | 959 } |
960 | 960 |
961 | |
962 DeferredHandleScope::DeferredHandleScope(Isolate* isolate) | |
963 : impl_(isolate->handle_scope_implementer()) { | |
964 impl_->BeginDeferredScope(); | |
965 Object** new_next = impl_->GetSpareOrNewBlock(); | |
966 Object** new_limit = &new_next[kHandleBlockSize]; | |
967 impl_->blocks()->Add(new_next); | |
968 | |
969 v8::ImplementationUtilities::HandleScopeData* data = | |
970 impl_->isolate()->handle_scope_data(); | |
971 #ifdef DEBUG | |
972 prev_level_ = data->level; | |
973 #endif | |
974 data->level++; | |
975 prev_limit_ = data->limit; | |
976 prev_next_ = data->next; | |
977 data->next = new_next; | |
978 data->limit = new_limit; | |
979 } | |
980 | |
Erik Corry
2012/06/27 10:28:15
Missing newline.
sanjoy
2012/06/27 11:17:09
Fixed.
| |
981 DeferredHandleScope::~DeferredHandleScope() { | |
982 impl_->isolate()->handle_scope_data()->level--; | |
983 ASSERT(handles_detached_); | |
984 ASSERT(impl_->isolate()->handle_scope_data()->level == prev_level_); | |
985 } | |
986 | |
987 | |
988 DeferredHandles* DeferredHandleScope::Detach() { | |
989 DeferredHandles* deferred = impl_->Detach(prev_limit_); | |
990 v8::ImplementationUtilities::HandleScopeData* data = | |
991 impl_->isolate()->handle_scope_data(); | |
992 data->next = prev_next_; | |
993 data->limit = prev_limit_; | |
994 #ifdef DEBUG | |
995 handles_detached_ = true; | |
996 #endif | |
997 return deferred; | |
998 } | |
999 | |
1000 | |
1001 CompilationHandleScope::CompilationHandleScope(CompilationInfo* info) | |
Erik Corry
2012/06/27 10:28:15
This should also go somewhere else (perhaps inline
sanjoy
2012/06/27 11:17:09
Moved to compiler.h
| |
1002 : deferred_(info->isolate()), info_(info) { | |
1003 } | |
1004 | |
1005 | |
1006 CompilationHandleScope::~CompilationHandleScope() { | |
1007 info_->set_deferred_handles(deferred_.Detach()); | |
1008 } | |
1009 | |
1010 | |
961 } } // namespace v8::internal | 1011 } } // namespace v8::internal |
OLD | NEW |