| 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 "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 445 |
| 446 Handle<JSFunction> SimpleInstallFunction(Handle<JSObject> base, | 446 Handle<JSFunction> SimpleInstallFunction(Handle<JSObject> base, |
| 447 const char* name, Builtins::Name call, | 447 const char* name, Builtins::Name call, |
| 448 int len, bool adapt, | 448 int len, bool adapt, |
| 449 PropertyAttributes attrs = DONT_ENUM) { | 449 PropertyAttributes attrs = DONT_ENUM) { |
| 450 Factory* const factory = base->GetIsolate()->factory(); | 450 Factory* const factory = base->GetIsolate()->factory(); |
| 451 return SimpleInstallFunction(base, factory->InternalizeUtf8String(name), call, | 451 return SimpleInstallFunction(base, factory->InternalizeUtf8String(name), call, |
| 452 len, adapt, attrs); | 452 len, adapt, attrs); |
| 453 } | 453 } |
| 454 | 454 |
| 455 Handle<JSFunction> SimpleInstallFunction(Handle<JSObject> base, |
| 456 const char* name, Builtins::Name call, |
| 457 int len, bool adapt, |
| 458 BuiltinFunctionId id) { |
| 459 Handle<JSFunction> fun = SimpleInstallFunction(base, name, call, len, adapt); |
| 460 fun->shared()->set_builtin_function_id(id); |
| 461 return fun; |
| 462 } |
| 463 |
| 455 Handle<JSFunction> SimpleInstallGetter(Handle<JSObject> base, | 464 Handle<JSFunction> SimpleInstallGetter(Handle<JSObject> base, |
| 456 Handle<String> name, Builtins::Name call, | 465 Handle<String> name, Builtins::Name call, |
| 457 bool adapt) { | 466 bool adapt) { |
| 458 Isolate* const isolate = base->GetIsolate(); | 467 Isolate* const isolate = base->GetIsolate(); |
| 459 Handle<String> fun_name = | 468 Handle<String> fun_name = |
| 460 Name::ToFunctionName(name, isolate->factory()->get_string()) | 469 Name::ToFunctionName(name, isolate->factory()->get_string()) |
| 461 .ToHandleChecked(); | 470 .ToHandleChecked(); |
| 462 Handle<JSFunction> fun = | 471 Handle<JSFunction> fun = |
| 463 SimpleCreateFunction(isolate, fun_name, call, 0, adapt); | 472 SimpleCreateFunction(isolate, fun_name, call, 0, adapt); |
| 464 InstallGetter(base, name, fun); | 473 InstallGetter(base, name, fun); |
| (...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3048 DCHECK(JSObject::cast( | 3057 DCHECK(JSObject::cast( |
| 3049 string_function->initial_map()->prototype())->HasFastProperties()); | 3058 string_function->initial_map()->prototype())->HasFastProperties()); |
| 3050 native_context()->set_string_function_prototype_map( | 3059 native_context()->set_string_function_prototype_map( |
| 3051 HeapObject::cast(string_function->initial_map()->prototype())->map()); | 3060 HeapObject::cast(string_function->initial_map()->prototype())->map()); |
| 3052 | 3061 |
| 3053 Handle<JSGlobalObject> global_object = | 3062 Handle<JSGlobalObject> global_object = |
| 3054 handle(native_context()->global_object()); | 3063 handle(native_context()->global_object()); |
| 3055 | 3064 |
| 3056 // Install Global.decodeURI. | 3065 // Install Global.decodeURI. |
| 3057 SimpleInstallFunction(global_object, "decodeURI", Builtins::kGlobalDecodeURI, | 3066 SimpleInstallFunction(global_object, "decodeURI", Builtins::kGlobalDecodeURI, |
| 3058 1, false); | 3067 1, false, kGlobalDecodeURI); |
| 3059 | 3068 |
| 3060 // Install Global.decodeURIComponent. | 3069 // Install Global.decodeURIComponent. |
| 3061 SimpleInstallFunction(global_object, "decodeURIComponent", | 3070 SimpleInstallFunction(global_object, "decodeURIComponent", |
| 3062 Builtins::kGlobalDecodeURIComponent, 1, false); | 3071 Builtins::kGlobalDecodeURIComponent, 1, false, |
| 3072 kGlobalDecodeURIComponent); |
| 3063 | 3073 |
| 3064 // Install Global.encodeURI. | 3074 // Install Global.encodeURI. |
| 3065 SimpleInstallFunction(global_object, "encodeURI", Builtins::kGlobalEncodeURI, | 3075 SimpleInstallFunction(global_object, "encodeURI", Builtins::kGlobalEncodeURI, |
| 3066 1, false); | 3076 1, false, kGlobalEncodeURI); |
| 3067 | 3077 |
| 3068 // Install Global.encodeURIComponent. | 3078 // Install Global.encodeURIComponent. |
| 3069 SimpleInstallFunction(global_object, "encodeURIComponent", | 3079 SimpleInstallFunction(global_object, "encodeURIComponent", |
| 3070 Builtins::kGlobalEncodeURIComponent, 1, false); | 3080 Builtins::kGlobalEncodeURIComponent, 1, false, |
| 3081 kGlobalEncodeURIComponent); |
| 3071 | 3082 |
| 3072 // Install Global.escape. | 3083 // Install Global.escape. |
| 3073 SimpleInstallFunction(global_object, "escape", Builtins::kGlobalEscape, 1, | 3084 SimpleInstallFunction(global_object, "escape", Builtins::kGlobalEscape, 1, |
| 3074 false); | 3085 false, kGlobalEscape); |
| 3075 | 3086 |
| 3076 // Install Global.unescape. | 3087 // Install Global.unescape. |
| 3077 SimpleInstallFunction(global_object, "unescape", Builtins::kGlobalUnescape, 1, | 3088 SimpleInstallFunction(global_object, "unescape", Builtins::kGlobalUnescape, 1, |
| 3078 false); | 3089 false, kGlobalUnescape); |
| 3079 | 3090 |
| 3080 // Install Global.eval. | 3091 // Install Global.eval. |
| 3081 { | 3092 { |
| 3082 Handle<JSFunction> eval = | 3093 Handle<JSFunction> eval = |
| 3083 SimpleInstallFunction(global_object, factory()->eval_string(), | 3094 SimpleInstallFunction(global_object, factory()->eval_string(), |
| 3084 Builtins::kGlobalEval, 1, false); | 3095 Builtins::kGlobalEval, 1, false); |
| 3085 native_context()->set_global_eval_fun(*eval); | 3096 native_context()->set_global_eval_fun(*eval); |
| 3086 } | 3097 } |
| 3087 | 3098 |
| 3088 // Install Array.prototype.concat | 3099 // Install Array.prototype.concat |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4077 } | 4088 } |
| 4078 | 4089 |
| 4079 | 4090 |
| 4080 // Called when the top-level V8 mutex is destroyed. | 4091 // Called when the top-level V8 mutex is destroyed. |
| 4081 void Bootstrapper::FreeThreadResources() { | 4092 void Bootstrapper::FreeThreadResources() { |
| 4082 DCHECK(!IsActive()); | 4093 DCHECK(!IsActive()); |
| 4083 } | 4094 } |
| 4084 | 4095 |
| 4085 } // namespace internal | 4096 } // namespace internal |
| 4086 } // namespace v8 | 4097 } // namespace v8 |
| OLD | NEW |