| 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 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2551 } | 2551 } |
| 2552 } | 2552 } |
| 2553 | 2553 |
| 2554 | 2554 |
| 2555 bool v8::V8::Dispose() { | 2555 bool v8::V8::Dispose() { |
| 2556 i::V8::TearDown(); | 2556 i::V8::TearDown(); |
| 2557 return true; | 2557 return true; |
| 2558 } | 2558 } |
| 2559 | 2559 |
| 2560 | 2560 |
| 2561 void v8::V8::IdleNotification(bool is_high_priority) { |
| 2562 i::V8::IdleNotification(is_high_priority); |
| 2563 } |
| 2564 |
| 2561 const char* v8::V8::GetVersion() { | 2565 const char* v8::V8::GetVersion() { |
| 2562 static v8::internal::EmbeddedVector<char, 128> buffer; | 2566 static v8::internal::EmbeddedVector<char, 128> buffer; |
| 2563 v8::internal::Version::GetString(buffer); | 2567 v8::internal::Version::GetString(buffer); |
| 2564 return buffer.start(); | 2568 return buffer.start(); |
| 2565 } | 2569 } |
| 2566 | 2570 |
| 2567 | 2571 |
| 2568 static i::Handle<i::FunctionTemplateInfo> | 2572 static i::Handle<i::FunctionTemplateInfo> |
| 2569 EnsureConstructor(i::Handle<i::ObjectTemplateInfo> templ) { | 2573 EnsureConstructor(i::Handle<i::ObjectTemplateInfo> templ) { |
| 2570 if (templ->constructor()->IsUndefined()) { | 2574 if (templ->constructor()->IsUndefined()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2582 v8::Handle<ObjectTemplate> global_template, | 2586 v8::Handle<ObjectTemplate> global_template, |
| 2583 v8::Handle<Value> global_object) { | 2587 v8::Handle<Value> global_object) { |
| 2584 EnsureInitialized("v8::Context::New()"); | 2588 EnsureInitialized("v8::Context::New()"); |
| 2585 LOG_API("Context::New"); | 2589 LOG_API("Context::New"); |
| 2586 ON_BAILOUT("v8::Context::New()", return Persistent<Context>()); | 2590 ON_BAILOUT("v8::Context::New()", return Persistent<Context>()); |
| 2587 | 2591 |
| 2588 // Enter V8 via an ENTER_V8 scope. | 2592 // Enter V8 via an ENTER_V8 scope. |
| 2589 i::Handle<i::Context> env; | 2593 i::Handle<i::Context> env; |
| 2590 { | 2594 { |
| 2591 ENTER_V8; | 2595 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. | 2596 // Give the heap a chance to cleanup if we've disposed contexts. |
| 2596 i::Heap::CollectAllGarbageIfContextDisposed(); | 2597 i::Heap::CollectAllGarbageIfContextDisposed(); |
| 2597 #endif | |
| 2598 v8::Handle<ObjectTemplate> proxy_template = global_template; | 2598 v8::Handle<ObjectTemplate> proxy_template = global_template; |
| 2599 i::Handle<i::FunctionTemplateInfo> proxy_constructor; | 2599 i::Handle<i::FunctionTemplateInfo> proxy_constructor; |
| 2600 i::Handle<i::FunctionTemplateInfo> global_constructor; | 2600 i::Handle<i::FunctionTemplateInfo> global_constructor; |
| 2601 | 2601 |
| 2602 if (!global_template.IsEmpty()) { | 2602 if (!global_template.IsEmpty()) { |
| 2603 // Make sure that the global_template has a constructor. | 2603 // Make sure that the global_template has a constructor. |
| 2604 global_constructor = | 2604 global_constructor = |
| 2605 EnsureConstructor(Utils::OpenHandle(*global_template)); | 2605 EnsureConstructor(Utils::OpenHandle(*global_template)); |
| 2606 | 2606 |
| 2607 // Create a fresh template for the global proxy object. | 2607 // 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); | 3649 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 3650 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3650 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
| 3651 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3651 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
| 3652 &thread_local->handle_scope_data_; | 3652 &thread_local->handle_scope_data_; |
| 3653 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3653 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
| 3654 | 3654 |
| 3655 return storage + ArchiveSpacePerThread(); | 3655 return storage + ArchiveSpacePerThread(); |
| 3656 } | 3656 } |
| 3657 | 3657 |
| 3658 } } // namespace v8::internal | 3658 } } // namespace v8::internal |
| OLD | NEW |