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 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 v8::Handle<ObjectTemplate> global_template, | 2582 v8::Handle<ObjectTemplate> global_template, |
2583 v8::Handle<Value> global_object) { | 2583 v8::Handle<Value> global_object) { |
2584 EnsureInitialized("v8::Context::New()"); | 2584 EnsureInitialized("v8::Context::New()"); |
2585 LOG_API("Context::New"); | 2585 LOG_API("Context::New"); |
2586 ON_BAILOUT("v8::Context::New()", return Persistent<Context>()); | 2586 ON_BAILOUT("v8::Context::New()", return Persistent<Context>()); |
2587 | 2587 |
2588 // Enter V8 via an ENTER_V8 scope. | 2588 // Enter V8 via an ENTER_V8 scope. |
2589 i::Handle<i::Context> env; | 2589 i::Handle<i::Context> env; |
2590 { | 2590 { |
2591 ENTER_V8; | 2591 ENTER_V8; |
2592 #if defined(ANDROID) | |
2593 // On mobile devices, full GC is expensive. | |
2594 #else | |
2595 // Give the heap a chance to cleanup if we've disposed contexts. | 2592 // Give the heap a chance to cleanup if we've disposed contexts. |
2596 i::Heap::CollectAllGarbageIfContextDisposed(); | 2593 i::Heap::CollectAllGarbageIfContextDisposed(); |
2597 #endif | |
2598 v8::Handle<ObjectTemplate> proxy_template = global_template; | 2594 v8::Handle<ObjectTemplate> proxy_template = global_template; |
2599 i::Handle<i::FunctionTemplateInfo> proxy_constructor; | 2595 i::Handle<i::FunctionTemplateInfo> proxy_constructor; |
2600 i::Handle<i::FunctionTemplateInfo> global_constructor; | 2596 i::Handle<i::FunctionTemplateInfo> global_constructor; |
2601 | 2597 |
2602 if (!global_template.IsEmpty()) { | 2598 if (!global_template.IsEmpty()) { |
2603 // Make sure that the global_template has a constructor. | 2599 // Make sure that the global_template has a constructor. |
2604 global_constructor = | 2600 global_constructor = |
2605 EnsureConstructor(Utils::OpenHandle(*global_template)); | 2601 EnsureConstructor(Utils::OpenHandle(*global_template)); |
2606 | 2602 |
2607 // Create a fresh template for the global proxy object. | 2603 // Create a fresh template for the global proxy object. |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3649 reinterpret_cast<HandleScopeImplementer*>(storage); | 3645 reinterpret_cast<HandleScopeImplementer*>(storage); |
3650 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3646 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
3651 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3647 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
3652 &thread_local->handle_scope_data_; | 3648 &thread_local->handle_scope_data_; |
3653 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3649 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
3654 | 3650 |
3655 return storage + ArchiveSpacePerThread(); | 3651 return storage + ArchiveSpacePerThread(); |
3656 } | 3652 } |
3657 | 3653 |
3658 } } // namespace v8::internal | 3654 } } // namespace v8::internal |
OLD | NEW |