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 GatheringHandleScope::GatheringHandleScope(CompilationInfo* info) | |
963 : info_(info) { | |
964 Isolate* isolate = info->isolate(); | |
danno
2012/06/24 11:07:03
You should be able to put the code below in the Sc
| |
965 v8::ImplementationUtilities::HandleScopeData* current = | |
966 isolate->handle_scope_data(); | |
967 prev_next_ = current->next; | |
968 prev_limit_ = current->limit; | |
969 | |
970 HandleScopeImplementer* impl = isolate->handle_scope_implementer(); | |
971 impl->begin_persistence(); | |
972 Object** new_next = impl->GetSpareOrNewBlock(); | |
973 Object** new_limit = &new_next[kHandleBlockSize]; | |
974 impl->blocks()->Add(new_next); | |
975 | |
976 current->next = new_next; | |
977 current->limit = new_limit; | |
978 current->level++; | |
979 } | |
980 | |
981 | |
982 GatheringHandleScope::~GatheringHandleScope() { | |
983 Isolate* isolate = info_->isolate(); | |
984 HandleScopeImplementer* impl = isolate->handle_scope_implementer(); | |
985 HandleScopeImplementer::PersistentExtensions* extensions = | |
986 impl->PersistExtensions(prev_limit_); | |
danno
2012/06/24 11:07:03
All of the code below can be pushed to the impl if
| |
987 info_->StorePersistentExtensions(extensions); | |
988 | |
989 v8::ImplementationUtilities::HandleScopeData* current = | |
990 isolate->handle_scope_data(); | |
991 current->next = prev_next_; | |
992 current->limit = prev_limit_; | |
993 | |
994 impl->end_persistence(); | |
995 current->level--; | |
996 } | |
997 | |
998 | |
961 } } // namespace v8::internal | 999 } } // namespace v8::internal |
OLD | NEW |