| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 // function before overwriting the context but since we're in a | 891 // function before overwriting the context but since we're in a |
| 892 // single-threaded environment it is not strictly necessary. | 892 // single-threaded environment it is not strictly necessary. |
| 893 ASSERT(Top::context()->IsGlobalContext()); | 893 ASSERT(Top::context()->IsGlobalContext()); |
| 894 Handle<Context> context = | 894 Handle<Context> context = |
| 895 Handle<Context>(use_runtime_context | 895 Handle<Context>(use_runtime_context |
| 896 ? Top::context()->runtime_context() | 896 ? Top::context()->runtime_context() |
| 897 : Top::context()); | 897 : Top::context()); |
| 898 Handle<JSFunction> fun = | 898 Handle<JSFunction> fun = |
| 899 Factory::NewFunctionFromBoilerplate(boilerplate, context); | 899 Factory::NewFunctionFromBoilerplate(boilerplate, context); |
| 900 | 900 |
| 901 // Call function using the either the runtime object or the global | 901 // Call function using either the runtime object or the global |
| 902 // object as the receiver. Provide no parameters. | 902 // object as the receiver. Provide no parameters. |
| 903 Handle<Object> receiver = | 903 Handle<Object> receiver = |
| 904 Handle<Object>(use_runtime_context | 904 Handle<Object>(use_runtime_context |
| 905 ? Top::context()->builtins() | 905 ? Top::context()->builtins() |
| 906 : Top::context()->global()); | 906 : Top::context()->global()); |
| 907 bool has_pending_exception; | 907 bool has_pending_exception; |
| 908 Handle<Object> result = | 908 Handle<Object> result = |
| 909 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); | 909 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); |
| 910 if (has_pending_exception) return false; | 910 if (has_pending_exception) return false; |
| 911 return PendingFixups::Process( | 911 return PendingFixups::Process( |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 // If V8 isn't running and cannot be initialized, just return. | 1540 // If V8 isn't running and cannot be initialized, just return. |
| 1541 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; | 1541 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; |
| 1542 | 1542 |
| 1543 // Before creating the roots we must save the context and restore it | 1543 // Before creating the roots we must save the context and restore it |
| 1544 // on all function exits. | 1544 // on all function exits. |
| 1545 HandleScope scope; | 1545 HandleScope scope; |
| 1546 SaveContext context; | 1546 SaveContext context; |
| 1547 | 1547 |
| 1548 CreateRoots(global_template, global_object); | 1548 CreateRoots(global_template, global_object); |
| 1549 | 1549 |
| 1550 #ifndef V8_TARGET_ARCH_MIPS |
| 1550 if (!InstallNatives()) return; | 1551 if (!InstallNatives()) return; |
| 1551 | 1552 |
| 1552 MakeFunctionInstancePrototypeWritable(); | 1553 MakeFunctionInstancePrototypeWritable(); |
| 1553 BuildSpecialFunctionTable(); | 1554 BuildSpecialFunctionTable(); |
| 1554 | 1555 |
| 1555 if (!ConfigureGlobalObjects(global_template)) return; | 1556 if (!ConfigureGlobalObjects(global_template)) return; |
| 1556 | 1557 |
| 1557 if (!InstallExtensions(extensions)) return; | 1558 if (!InstallExtensions(extensions)) return; |
| 1558 | 1559 |
| 1559 if (!InstallSpecialObjects()) return; | 1560 if (!InstallSpecialObjects()) return; |
| 1561 #endif |
| 1560 | 1562 |
| 1561 result_ = global_context_; | 1563 result_ = global_context_; |
| 1562 } | 1564 } |
| 1563 | 1565 |
| 1564 | 1566 |
| 1565 // Support for thread preemption. | 1567 // Support for thread preemption. |
| 1566 | 1568 |
| 1567 // Reserve space for statics needing saving and restoring. | 1569 // Reserve space for statics needing saving and restoring. |
| 1568 int Bootstrapper::ArchiveSpacePerThread() { | 1570 int Bootstrapper::ArchiveSpacePerThread() { |
| 1569 return Genesis::ArchiveSpacePerThread(); | 1571 return Genesis::ArchiveSpacePerThread(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 } | 1604 } |
| 1603 | 1605 |
| 1604 | 1606 |
| 1605 // Restore statics that are thread local. | 1607 // Restore statics that are thread local. |
| 1606 char* Genesis::RestoreState(char* from) { | 1608 char* Genesis::RestoreState(char* from) { |
| 1607 current_ = *reinterpret_cast<Genesis**>(from); | 1609 current_ = *reinterpret_cast<Genesis**>(from); |
| 1608 return from + sizeof(current_); | 1610 return from + sizeof(current_); |
| 1609 } | 1611 } |
| 1610 | 1612 |
| 1611 } } // namespace v8::internal | 1613 } } // namespace v8::internal |
| OLD | NEW |