| 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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 | 825 |
| 826 bool Genesis::CompileBuiltin(int index) { | 826 bool Genesis::CompileBuiltin(int index) { |
| 827 Vector<const char> name = Natives::GetScriptName(index); | 827 Vector<const char> name = Natives::GetScriptName(index); |
| 828 Handle<String> source_code = Bootstrapper::NativesSourceLookup(index); | 828 Handle<String> source_code = Bootstrapper::NativesSourceLookup(index); |
| 829 return CompileNative(name, source_code); | 829 return CompileNative(name, source_code); |
| 830 } | 830 } |
| 831 | 831 |
| 832 | 832 |
| 833 bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) { | 833 bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) { |
| 834 HandleScope scope; | 834 HandleScope scope; |
| 835 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 835 Debugger::set_compiling_natives(true); | 836 Debugger::set_compiling_natives(true); |
| 837 #endif |
| 836 bool result = | 838 bool result = |
| 837 CompileScriptCached(name, source, &natives_cache, NULL, true); | 839 CompileScriptCached(name, source, &natives_cache, NULL, true); |
| 838 ASSERT(Top::has_pending_exception() != result); | 840 ASSERT(Top::has_pending_exception() != result); |
| 839 if (!result) Top::clear_pending_exception(); | 841 if (!result) Top::clear_pending_exception(); |
| 842 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 840 Debugger::set_compiling_natives(false); | 843 Debugger::set_compiling_natives(false); |
| 844 #endif |
| 841 return result; | 845 return result; |
| 842 } | 846 } |
| 843 | 847 |
| 844 | 848 |
| 845 bool Genesis::CompileScriptCached(Vector<const char> name, | 849 bool Genesis::CompileScriptCached(Vector<const char> name, |
| 846 Handle<String> source, | 850 Handle<String> source, |
| 847 SourceCodeCache* cache, | 851 SourceCodeCache* cache, |
| 848 v8::Extension* extension, | 852 v8::Extension* extension, |
| 849 bool use_runtime_context) { | 853 bool use_runtime_context) { |
| 850 HandleScope scope; | 854 HandleScope scope; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 Handle<JSGlobalObject> js_global( | 1129 Handle<JSGlobalObject> js_global( |
| 1126 JSGlobalObject::cast(global_context()->global())); | 1130 JSGlobalObject::cast(global_context()->global())); |
| 1127 // Expose the natives in global if a name for it is specified. | 1131 // Expose the natives in global if a name for it is specified. |
| 1128 if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) { | 1132 if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) { |
| 1129 Handle<String> natives_string = | 1133 Handle<String> natives_string = |
| 1130 Factory::LookupAsciiSymbol(FLAG_expose_natives_as); | 1134 Factory::LookupAsciiSymbol(FLAG_expose_natives_as); |
| 1131 SetProperty(js_global, natives_string, | 1135 SetProperty(js_global, natives_string, |
| 1132 Handle<JSObject>(js_global->builtins()), DONT_ENUM); | 1136 Handle<JSObject>(js_global->builtins()), DONT_ENUM); |
| 1133 } | 1137 } |
| 1134 | 1138 |
| 1139 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1135 // Expose the debug global object in global if a name for it is specified. | 1140 // Expose the debug global object in global if a name for it is specified. |
| 1136 if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) { | 1141 if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) { |
| 1137 // If loading fails we just bail out without installing the | 1142 // If loading fails we just bail out without installing the |
| 1138 // debugger but without tanking the whole context. | 1143 // debugger but without tanking the whole context. |
| 1139 if (!Debug::Load()) | 1144 if (!Debug::Load()) |
| 1140 return true; | 1145 return true; |
| 1141 // Set the security token for the debugger context to the same as | 1146 // Set the security token for the debugger context to the same as |
| 1142 // the shell global context to allow calling between these (otherwise | 1147 // the shell global context to allow calling between these (otherwise |
| 1143 // exposing debug global object doesn't make much sense). | 1148 // exposing debug global object doesn't make much sense). |
| 1144 Debug::debug_context()->set_security_token( | 1149 Debug::debug_context()->set_security_token( |
| 1145 global_context()->security_token()); | 1150 global_context()->security_token()); |
| 1146 | 1151 |
| 1147 Handle<String> debug_string = | 1152 Handle<String> debug_string = |
| 1148 Factory::LookupAsciiSymbol(FLAG_expose_debug_as); | 1153 Factory::LookupAsciiSymbol(FLAG_expose_debug_as); |
| 1149 SetProperty(js_global, debug_string, | 1154 SetProperty(js_global, debug_string, |
| 1150 Handle<Object>(Debug::debug_context()->global_proxy()), DONT_ENUM); | 1155 Handle<Object>(Debug::debug_context()->global_proxy()), DONT_ENUM); |
| 1151 } | 1156 } |
| 1157 #endif |
| 1152 | 1158 |
| 1153 return true; | 1159 return true; |
| 1154 } | 1160 } |
| 1155 | 1161 |
| 1156 | 1162 |
| 1157 bool Genesis::InstallExtensions(v8::ExtensionConfiguration* extensions) { | 1163 bool Genesis::InstallExtensions(v8::ExtensionConfiguration* extensions) { |
| 1158 // Clear coloring of extension list | 1164 // Clear coloring of extension list |
| 1159 v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension(); | 1165 v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension(); |
| 1160 while (current != NULL) { | 1166 while (current != NULL) { |
| 1161 current->set_state(v8::UNVISITED); | 1167 current->set_state(v8::UNVISITED); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 } | 1525 } |
| 1520 | 1526 |
| 1521 | 1527 |
| 1522 // Restore statics that are thread local. | 1528 // Restore statics that are thread local. |
| 1523 char* Genesis::RestoreState(char* from) { | 1529 char* Genesis::RestoreState(char* from) { |
| 1524 current_ = *reinterpret_cast<Genesis**>(from); | 1530 current_ = *reinterpret_cast<Genesis**>(from); |
| 1525 return from + sizeof(current_); | 1531 return from + sizeof(current_); |
| 1526 } | 1532 } |
| 1527 | 1533 |
| 1528 } } // namespace v8::internal | 1534 } } // namespace v8::internal |
| OLD | NEW |