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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 961 |
962 DeferredHandleScope::DeferredHandleScope(Isolate* isolate) | 962 DeferredHandleScope::DeferredHandleScope(Isolate* isolate) |
963 : impl_(isolate->handle_scope_implementer()) { | 963 : impl_(isolate->handle_scope_implementer()) { |
| 964 ASSERT(impl_->isolate() == Isolate::Current()); |
964 impl_->BeginDeferredScope(); | 965 impl_->BeginDeferredScope(); |
| 966 v8::ImplementationUtilities::HandleScopeData* data = |
| 967 impl_->isolate()->handle_scope_data(); |
965 Object** new_next = impl_->GetSpareOrNewBlock(); | 968 Object** new_next = impl_->GetSpareOrNewBlock(); |
966 Object** new_limit = &new_next[kHandleBlockSize]; | 969 Object** new_limit = &new_next[kHandleBlockSize]; |
| 970 ASSERT(data->limit == &impl_->blocks()->last()[kHandleBlockSize]); |
967 impl_->blocks()->Add(new_next); | 971 impl_->blocks()->Add(new_next); |
968 | 972 |
969 v8::ImplementationUtilities::HandleScopeData* data = | |
970 impl_->isolate()->handle_scope_data(); | |
971 #ifdef DEBUG | 973 #ifdef DEBUG |
972 prev_level_ = data->level; | 974 prev_level_ = data->level; |
973 #endif | 975 #endif |
974 data->level++; | 976 data->level++; |
975 prev_limit_ = data->limit; | 977 prev_limit_ = data->limit; |
976 prev_next_ = data->next; | 978 prev_next_ = data->next; |
977 data->next = new_next; | 979 data->next = new_next; |
978 data->limit = new_limit; | 980 data->limit = new_limit; |
979 } | 981 } |
980 | 982 |
(...skipping 12 matching lines...) Expand all Loading... |
993 data->next = prev_next_; | 995 data->next = prev_next_; |
994 data->limit = prev_limit_; | 996 data->limit = prev_limit_; |
995 #ifdef DEBUG | 997 #ifdef DEBUG |
996 handles_detached_ = true; | 998 handles_detached_ = true; |
997 #endif | 999 #endif |
998 return deferred; | 1000 return deferred; |
999 } | 1001 } |
1000 | 1002 |
1001 | 1003 |
1002 } } // namespace v8::internal | 1004 } } // namespace v8::internal |
OLD | NEW |