| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // templates passed through the API. The inner global from the snapshot is | 224 // templates passed through the API. The inner global from the snapshot is |
| 225 // detached from the other objects in the snapshot. | 225 // detached from the other objects in the snapshot. |
| 226 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); | 226 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); |
| 227 // New context initialization. Used for creating a context from scratch. | 227 // New context initialization. Used for creating a context from scratch. |
| 228 void InitializeGlobal(Handle<GlobalObject> inner_global, | 228 void InitializeGlobal(Handle<GlobalObject> inner_global, |
| 229 Handle<JSFunction> empty_function); | 229 Handle<JSFunction> empty_function); |
| 230 void InitializeExperimentalGlobal(); | 230 void InitializeExperimentalGlobal(); |
| 231 // Installs the contents of the native .js files on the global objects. | 231 // Installs the contents of the native .js files on the global objects. |
| 232 // Used for creating a context from scratch. | 232 // Used for creating a context from scratch. |
| 233 void InstallNativeFunctions(); | 233 void InstallNativeFunctions(); |
| 234 void InstallExperimentalBuiltinFunctionIds(); | |
| 235 void InstallExperimentalNativeFunctions(); | 234 void InstallExperimentalNativeFunctions(); |
| 236 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, | 235 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, |
| 237 const char* name, | 236 const char* name, |
| 238 ElementsKind elements_kind); | 237 ElementsKind elements_kind); |
| 239 bool InstallNatives(); | 238 bool InstallNatives(); |
| 240 | 239 |
| 241 Handle<JSFunction> InstallTypedArray(const char* name, | 240 Handle<JSFunction> InstallTypedArray(const char* name, |
| 242 ElementsKind elementsKind); | 241 ElementsKind elementsKind); |
| 243 bool InstallExperimentalNatives(); | 242 bool InstallExperimentalNatives(); |
| 244 void InstallBuiltinFunctionIds(); | 243 void InstallBuiltinFunctionIds(); |
| (...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 configure_instance_fun); | 1575 configure_instance_fun); |
| 1577 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); | 1576 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); |
| 1578 INSTALL_NATIVE(JSObject, "functionCache", function_cache); | 1577 INSTALL_NATIVE(JSObject, "functionCache", function_cache); |
| 1579 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", | 1578 INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor", |
| 1580 to_complete_property_descriptor); | 1579 to_complete_property_descriptor); |
| 1581 } | 1580 } |
| 1582 | 1581 |
| 1583 | 1582 |
| 1584 void Genesis::InstallExperimentalNativeFunctions() { | 1583 void Genesis::InstallExperimentalNativeFunctions() { |
| 1585 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); | 1584 INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks); |
| 1586 INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask", | |
| 1587 enqueue_external_microtask); | |
| 1588 | |
| 1589 if (FLAG_harmony_proxies) { | 1585 if (FLAG_harmony_proxies) { |
| 1590 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); | 1586 INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap); |
| 1591 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); | 1587 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap); |
| 1592 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); | 1588 INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap); |
| 1593 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); | 1589 INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate); |
| 1594 } | 1590 } |
| 1595 if (FLAG_harmony_observation) { | 1591 if (FLAG_harmony_observation) { |
| 1596 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); | 1592 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); |
| 1597 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); | 1593 INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice); |
| 1598 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", | 1594 INSTALL_NATIVE(JSFunction, "BeginPerformSplice", |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 INSTALL_EXPERIMENTAL_NATIVE(i, observation, "object-observe.js") | 2050 INSTALL_EXPERIMENTAL_NATIVE(i, observation, "object-observe.js") |
| 2055 INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js") | 2051 INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js") |
| 2056 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") | 2052 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") |
| 2057 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") | 2053 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") |
| 2058 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") | 2054 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") |
| 2059 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") | 2055 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") |
| 2060 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") | 2056 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") |
| 2061 } | 2057 } |
| 2062 | 2058 |
| 2063 InstallExperimentalNativeFunctions(); | 2059 InstallExperimentalNativeFunctions(); |
| 2064 InstallExperimentalBuiltinFunctionIds(); | 2060 |
| 2065 return true; | 2061 return true; |
| 2066 } | 2062 } |
| 2067 | 2063 |
| 2068 | 2064 |
| 2069 static Handle<JSObject> ResolveBuiltinIdHolder( | 2065 static Handle<JSObject> ResolveBuiltinIdHolder( |
| 2070 Handle<Context> native_context, | 2066 Handle<Context> native_context, |
| 2071 const char* holder_expr) { | 2067 const char* holder_expr) { |
| 2072 Isolate* isolate = native_context->GetIsolate(); | 2068 Isolate* isolate = native_context->GetIsolate(); |
| 2073 Factory* factory = isolate->factory(); | 2069 Factory* factory = isolate->factory(); |
| 2074 Handle<GlobalObject> global(native_context->global_object()); | 2070 Handle<GlobalObject> global(native_context->global_object()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2104 Handle<JSObject> holder = ResolveBuiltinIdHolder( \ | 2100 Handle<JSObject> holder = ResolveBuiltinIdHolder( \ |
| 2105 native_context(), #holder_expr); \ | 2101 native_context(), #holder_expr); \ |
| 2106 BuiltinFunctionId id = k##name; \ | 2102 BuiltinFunctionId id = k##name; \ |
| 2107 InstallBuiltinFunctionId(holder, #fun_name, id); \ | 2103 InstallBuiltinFunctionId(holder, #fun_name, id); \ |
| 2108 } | 2104 } |
| 2109 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID) | 2105 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID) |
| 2110 #undef INSTALL_BUILTIN_ID | 2106 #undef INSTALL_BUILTIN_ID |
| 2111 } | 2107 } |
| 2112 | 2108 |
| 2113 | 2109 |
| 2114 void Genesis::InstallExperimentalBuiltinFunctionIds() { | |
| 2115 HandleScope scope(isolate()); | |
| 2116 if (FLAG_harmony_maths) { | |
| 2117 Handle<JSObject> holder = ResolveBuiltinIdHolder(native_context(), "Math"); | |
| 2118 InstallBuiltinFunctionId(holder, "clz32", kMathClz32); | |
| 2119 } | |
| 2120 } | |
| 2121 | |
| 2122 | |
| 2123 // Do not forget to update macros.py with named constant | 2110 // Do not forget to update macros.py with named constant |
| 2124 // of cache id. | 2111 // of cache id. |
| 2125 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ | 2112 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ |
| 2126 F(16, native_context()->regexp_function()) | 2113 F(16, native_context()->regexp_function()) |
| 2127 | 2114 |
| 2128 | 2115 |
| 2129 static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) { | 2116 static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) { |
| 2130 Factory* factory = factory_function->GetIsolate()->factory(); | 2117 Factory* factory = factory_function->GetIsolate()->factory(); |
| 2131 // Caches are supposed to live for a long time, allocate in old space. | 2118 // Caches are supposed to live for a long time, allocate in old space. |
| 2132 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; | 2119 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2572 class NoTrackDoubleFieldsForSerializerScope { | 2559 class NoTrackDoubleFieldsForSerializerScope { |
| 2573 public: | 2560 public: |
| 2574 NoTrackDoubleFieldsForSerializerScope() : flag_(FLAG_track_double_fields) { | 2561 NoTrackDoubleFieldsForSerializerScope() : flag_(FLAG_track_double_fields) { |
| 2575 if (Serializer::enabled()) { | 2562 if (Serializer::enabled()) { |
| 2576 // Disable tracking double fields because heap numbers treated as | 2563 // Disable tracking double fields because heap numbers treated as |
| 2577 // immutable by the serializer. | 2564 // immutable by the serializer. |
| 2578 FLAG_track_double_fields = false; | 2565 FLAG_track_double_fields = false; |
| 2579 } | 2566 } |
| 2580 } | 2567 } |
| 2581 ~NoTrackDoubleFieldsForSerializerScope() { | 2568 ~NoTrackDoubleFieldsForSerializerScope() { |
| 2582 if (Serializer::enabled()) { | 2569 FLAG_track_double_fields = flag_; |
| 2583 FLAG_track_double_fields = flag_; | |
| 2584 } | |
| 2585 } | 2570 } |
| 2586 | 2571 |
| 2587 private: | 2572 private: |
| 2588 bool flag_; | 2573 bool flag_; |
| 2589 }; | 2574 }; |
| 2590 | 2575 |
| 2591 | 2576 |
| 2592 Genesis::Genesis(Isolate* isolate, | 2577 Genesis::Genesis(Isolate* isolate, |
| 2593 Handle<Object> global_object, | 2578 Handle<Object> global_object, |
| 2594 v8::Handle<v8::ObjectTemplate> global_template, | 2579 v8::Handle<v8::ObjectTemplate> global_template, |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2746 return from + sizeof(NestingCounterType); | 2731 return from + sizeof(NestingCounterType); |
| 2747 } | 2732 } |
| 2748 | 2733 |
| 2749 | 2734 |
| 2750 // Called when the top-level V8 mutex is destroyed. | 2735 // Called when the top-level V8 mutex is destroyed. |
| 2751 void Bootstrapper::FreeThreadResources() { | 2736 void Bootstrapper::FreeThreadResources() { |
| 2752 ASSERT(!IsActive()); | 2737 ASSERT(!IsActive()); |
| 2753 } | 2738 } |
| 2754 | 2739 |
| 2755 } } // namespace v8::internal | 2740 } } // namespace v8::internal |
| OLD | NEW |