| OLD | NEW | 
|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "bootstrapper.h" | 5 #include "bootstrapper.h" | 
| 6 | 6 | 
| 7 #include "accessors.h" | 7 #include "accessors.h" | 
| 8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" | 
| 9 #include "natives.h" | 9 #include "natives.h" | 
| 10 #include "snapshot.h" | 10 #include "snapshot.h" | 
| (...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2016   ASSERT(!property_string.is_null()); | 2016   ASSERT(!property_string.is_null()); | 
| 2017   Handle<JSFunction> function = Handle<JSFunction>::cast( | 2017   Handle<JSFunction> function = Handle<JSFunction>::cast( | 
| 2018       Object::GetProperty(global, property_string).ToHandleChecked()); | 2018       Object::GetProperty(global, property_string).ToHandleChecked()); | 
| 2019   return Handle<JSObject>(JSObject::cast(function->prototype())); | 2019   return Handle<JSObject>(JSObject::cast(function->prototype())); | 
| 2020 } | 2020 } | 
| 2021 | 2021 | 
| 2022 | 2022 | 
| 2023 static void InstallBuiltinFunctionId(Handle<JSObject> holder, | 2023 static void InstallBuiltinFunctionId(Handle<JSObject> holder, | 
| 2024                                      const char* function_name, | 2024                                      const char* function_name, | 
| 2025                                      BuiltinFunctionId id) { | 2025                                      BuiltinFunctionId id) { | 
| 2026   Factory* factory = holder->GetIsolate()->factory(); | 2026   Isolate* isolate = holder->GetIsolate(); | 
| 2027   Handle<String> name = factory->InternalizeUtf8String(function_name); |  | 
| 2028   Handle<Object> function_object = | 2027   Handle<Object> function_object = | 
| 2029       Object::GetProperty(holder, name).ToHandleChecked(); | 2028       Object::GetProperty(isolate, holder, function_name).ToHandleChecked(); | 
| 2030   Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 2029   Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 
| 2031   function->shared()->set_function_data(Smi::FromInt(id)); | 2030   function->shared()->set_function_data(Smi::FromInt(id)); | 
| 2032 } | 2031 } | 
| 2033 | 2032 | 
| 2034 | 2033 | 
| 2035 void Genesis::InstallBuiltinFunctionIds() { | 2034 void Genesis::InstallBuiltinFunctionIds() { | 
| 2036   HandleScope scope(isolate()); | 2035   HandleScope scope(isolate()); | 
| 2037 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \ | 2036 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \ | 
| 2038   {                                                     \ | 2037   {                                                     \ | 
| 2039     Handle<JSObject> holder = ResolveBuiltinIdHolder(   \ | 2038     Handle<JSObject> holder = ResolveBuiltinIdHolder(   \ | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2126   if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) { | 2125   if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) { | 
| 2127     Handle<String> natives = | 2126     Handle<String> natives = | 
| 2128         factory->InternalizeUtf8String(FLAG_expose_natives_as); | 2127         factory->InternalizeUtf8String(FLAG_expose_natives_as); | 
| 2129     RETURN_ON_EXCEPTION_VALUE( | 2128     RETURN_ON_EXCEPTION_VALUE( | 
| 2130         isolate, | 2129         isolate, | 
| 2131         JSObject::SetLocalPropertyIgnoreAttributes( | 2130         JSObject::SetLocalPropertyIgnoreAttributes( | 
| 2132             global, natives, Handle<JSObject>(global->builtins()), DONT_ENUM), | 2131             global, natives, Handle<JSObject>(global->builtins()), DONT_ENUM), | 
| 2133         false); | 2132         false); | 
| 2134   } | 2133   } | 
| 2135 | 2134 | 
| 2136   Handle<Object> Error = GetProperty(global, "Error").ToHandleChecked(); | 2135   Handle<Object> Error = Object::GetProperty( | 
|  | 2136       isolate, global, "Error").ToHandleChecked(); | 
| 2137   if (Error->IsJSObject()) { | 2137   if (Error->IsJSObject()) { | 
| 2138     Handle<String> name = factory->InternalizeOneByteString( | 2138     Handle<String> name = factory->InternalizeOneByteString( | 
| 2139         STATIC_ASCII_VECTOR("stackTraceLimit")); | 2139         STATIC_ASCII_VECTOR("stackTraceLimit")); | 
| 2140     Handle<Smi> stack_trace_limit( | 2140     Handle<Smi> stack_trace_limit( | 
| 2141         Smi::FromInt(FLAG_stack_trace_limit), isolate); | 2141         Smi::FromInt(FLAG_stack_trace_limit), isolate); | 
| 2142     RETURN_ON_EXCEPTION_VALUE( | 2142     RETURN_ON_EXCEPTION_VALUE( | 
| 2143         isolate, | 2143         isolate, | 
| 2144         JSObject::SetLocalPropertyIgnoreAttributes( | 2144         JSObject::SetLocalPropertyIgnoreAttributes( | 
| 2145             Handle<JSObject>::cast(Error), name, stack_trace_limit, NONE), | 2145             Handle<JSObject>::cast(Error), name, stack_trace_limit, NONE), | 
| 2146         false); | 2146         false); | 
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2307   extension_states->set_state(current, INSTALLED); | 2307   extension_states->set_state(current, INSTALLED); | 
| 2308   isolate->NotifyExtensionInstalled(); | 2308   isolate->NotifyExtensionInstalled(); | 
| 2309   return result; | 2309   return result; | 
| 2310 } | 2310 } | 
| 2311 | 2311 | 
| 2312 | 2312 | 
| 2313 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) { | 2313 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) { | 
| 2314   HandleScope scope(isolate()); | 2314   HandleScope scope(isolate()); | 
| 2315   for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { | 2315   for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { | 
| 2316     Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); | 2316     Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); | 
| 2317     Handle<String> name = | 2317     Handle<Object> function_object = Object::GetProperty( | 
| 2318         factory()->InternalizeUtf8String(Builtins::GetName(id)); | 2318         isolate(), builtins, Builtins::GetName(id)).ToHandleChecked(); | 
| 2319     Handle<Object> function_object = |  | 
| 2320         Object::GetProperty(builtins, name).ToHandleChecked(); |  | 
| 2321     Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 2319     Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); | 
| 2322     builtins->set_javascript_builtin(id, *function); | 2320     builtins->set_javascript_builtin(id, *function); | 
| 2323     if (!Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) { | 2321     if (!Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) { | 
| 2324       return false; | 2322       return false; | 
| 2325     } | 2323     } | 
| 2326     builtins->set_javascript_builtin_code(id, function->shared()->code()); | 2324     builtins->set_javascript_builtin_code(id, function->shared()->code()); | 
| 2327   } | 2325   } | 
| 2328   return true; | 2326   return true; | 
| 2329 } | 2327 } | 
| 2330 | 2328 | 
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2684   return from + sizeof(NestingCounterType); | 2682   return from + sizeof(NestingCounterType); | 
| 2685 } | 2683 } | 
| 2686 | 2684 | 
| 2687 | 2685 | 
| 2688 // Called when the top-level V8 mutex is destroyed. | 2686 // Called when the top-level V8 mutex is destroyed. | 
| 2689 void Bootstrapper::FreeThreadResources() { | 2687 void Bootstrapper::FreeThreadResources() { | 
| 2690   ASSERT(!IsActive()); | 2688   ASSERT(!IsActive()); | 
| 2691 } | 2689 } | 
| 2692 | 2690 | 
| 2693 } }  // namespace v8::internal | 2691 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|