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 12652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12663 v8::V8::ContextDisposedNotification(); | 12663 v8::V8::ContextDisposedNotification(); |
12664 CheckSurvivingGlobalObjectsCount(0); | 12664 CheckSurvivingGlobalObjectsCount(0); |
12665 } | 12665 } |
12666 } | 12666 } |
12667 | 12667 |
12668 template<class T> | 12668 template<class T> |
12669 struct CopyablePersistentTraits { | 12669 struct CopyablePersistentTraits { |
12670 typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent; | 12670 typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent; |
12671 static const bool kResetInDestructor = true; | 12671 static const bool kResetInDestructor = true; |
12672 template<class S, class M> | 12672 template<class S, class M> |
12673 V8_INLINE(static void Copy(const Persistent<S, M>& source, | 12673 static V8_INLINE void Copy(const Persistent<S, M>& source, |
12674 CopyablePersistent* dest)) { | 12674 CopyablePersistent* dest) { |
12675 // do nothing, just allow copy | 12675 // do nothing, just allow copy |
12676 } | 12676 } |
12677 }; | 12677 }; |
12678 | 12678 |
12679 | 12679 |
12680 TEST(CopyablePersistent) { | 12680 TEST(CopyablePersistent) { |
12681 LocalContext context; | 12681 LocalContext context; |
12682 v8::Isolate* isolate = context->GetIsolate(); | 12682 v8::Isolate* isolate = context->GetIsolate(); |
12683 i::GlobalHandles* globals = | 12683 i::GlobalHandles* globals = |
12684 reinterpret_cast<i::Isolate*>(isolate)->global_handles(); | 12684 reinterpret_cast<i::Isolate*>(isolate)->global_handles(); |
(...skipping 7895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20580 // Verify function not cached | 20580 // Verify function not cached |
20581 int serial_number = | 20581 int serial_number = |
20582 i::Smi::cast(v8::Utils::OpenHandle(*func) | 20582 i::Smi::cast(v8::Utils::OpenHandle(*func) |
20583 ->shared()->get_api_func_data()->serial_number())->value(); | 20583 ->shared()->get_api_func_data()->serial_number())->value(); |
20584 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 20584 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
20585 i::Object* elm = i_isolate->native_context()->function_cache() | 20585 i::Object* elm = i_isolate->native_context()->function_cache() |
20586 ->GetElementNoExceptionThrown(i_isolate, serial_number); | 20586 ->GetElementNoExceptionThrown(i_isolate, serial_number); |
20587 CHECK(elm->IsNull()); | 20587 CHECK(elm->IsNull()); |
20588 } | 20588 } |
20589 | 20589 |
OLD | NEW |