OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 | 2733 |
2734 v8::Local<v8::Context> Context::GetCurrent() { | 2734 v8::Local<v8::Context> Context::GetCurrent() { |
2735 if (IsDeadCheck("v8::Context::GetCurrent()")) return Local<Context>(); | 2735 if (IsDeadCheck("v8::Context::GetCurrent()")) return Local<Context>(); |
2736 i::Handle<i::Context> context(i::Top::global_context()); | 2736 i::Handle<i::Context> context(i::Top::global_context()); |
2737 return Utils::ToLocal(context); | 2737 return Utils::ToLocal(context); |
2738 } | 2738 } |
2739 | 2739 |
2740 | 2740 |
2741 v8::Local<v8::Context> Context::GetCalling() { | 2741 v8::Local<v8::Context> Context::GetCalling() { |
2742 if (IsDeadCheck("v8::Context::GetCalling()")) return Local<Context>(); | 2742 if (IsDeadCheck("v8::Context::GetCalling()")) return Local<Context>(); |
2743 i::Handle<i::Context> context(i::Top::GetCallingGlobalContext()); | 2743 i::Handle<i::Object> calling = i::Top::GetCallingGlobalContext(); |
| 2744 if (calling.is_null()) return Local<Context>(); |
| 2745 i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling); |
2744 return Utils::ToLocal(context); | 2746 return Utils::ToLocal(context); |
2745 } | 2747 } |
2746 | 2748 |
2747 | 2749 |
2748 v8::Local<v8::Object> Context::Global() { | 2750 v8::Local<v8::Object> Context::Global() { |
2749 if (IsDeadCheck("v8::Context::Global()")) return Local<v8::Object>(); | 2751 if (IsDeadCheck("v8::Context::Global()")) return Local<v8::Object>(); |
2750 i::Object** ctx = reinterpret_cast<i::Object**>(this); | 2752 i::Object** ctx = reinterpret_cast<i::Object**>(this); |
2751 i::Handle<i::Context> context = | 2753 i::Handle<i::Context> context = |
2752 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); | 2754 i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); |
2753 i::Handle<i::Object> global(context->global_proxy()); | 2755 i::Handle<i::Object> global(context->global_proxy()); |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3732 | 3734 |
3733 | 3735 |
3734 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 3736 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
3735 HandleScopeImplementer* thread_local = | 3737 HandleScopeImplementer* thread_local = |
3736 reinterpret_cast<HandleScopeImplementer*>(storage); | 3738 reinterpret_cast<HandleScopeImplementer*>(storage); |
3737 thread_local->IterateThis(v); | 3739 thread_local->IterateThis(v); |
3738 return storage + ArchiveSpacePerThread(); | 3740 return storage + ArchiveSpacePerThread(); |
3739 } | 3741 } |
3740 | 3742 |
3741 } } // namespace v8::internal | 3743 } } // namespace v8::internal |
OLD | NEW |