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