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 |
2592 // Give the heap a chance to cleanup if we've disposed contexts. | 2595 // Give the heap a chance to cleanup if we've disposed contexts. |
2593 i::Heap::CollectAllGarbageIfContextDisposed(); | 2596 i::Heap::CollectAllGarbageIfContextDisposed(); |
2594 | 2597 #endif |
2595 v8::Handle<ObjectTemplate> proxy_template = global_template; | 2598 v8::Handle<ObjectTemplate> proxy_template = global_template; |
2596 i::Handle<i::FunctionTemplateInfo> proxy_constructor; | 2599 i::Handle<i::FunctionTemplateInfo> proxy_constructor; |
2597 i::Handle<i::FunctionTemplateInfo> global_constructor; | 2600 i::Handle<i::FunctionTemplateInfo> global_constructor; |
2598 | 2601 |
2599 if (!global_template.IsEmpty()) { | 2602 if (!global_template.IsEmpty()) { |
2600 // Make sure that the global_template has a constructor. | 2603 // Make sure that the global_template has a constructor. |
2601 global_constructor = | 2604 global_constructor = |
2602 EnsureConstructor(Utils::OpenHandle(*global_template)); | 2605 EnsureConstructor(Utils::OpenHandle(*global_template)); |
2603 | 2606 |
2604 // Create a fresh template for the global proxy object. | 2607 // Create a fresh template for the global proxy object. |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3635 reinterpret_cast<HandleScopeImplementer*>(storage); | 3638 reinterpret_cast<HandleScopeImplementer*>(storage); |
3636 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3639 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
3637 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3640 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
3638 &thread_local->handle_scope_data_; | 3641 &thread_local->handle_scope_data_; |
3639 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3642 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
3640 | 3643 |
3641 return storage + ArchiveSpacePerThread(); | 3644 return storage + ArchiveSpacePerThread(); |
3642 } | 3645 } |
3643 | 3646 |
3644 } } // namespace v8::internal | 3647 } } // namespace v8::internal |
OLD | NEW |