Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: src/bootstrapper.cc

Issue 2599903003: Implement "global" property of global object
Patch Set: implement behind a harmony flag Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3449 matching lines...) Expand 10 before | Expand all | Expand 10 after
3460 3460
3461 Handle<Object> unscopables = 3461 Handle<Object> unscopables =
3462 JSObject::GetProperty(array_prototype, factory()->unscopables_symbol()) 3462 JSObject::GetProperty(array_prototype, factory()->unscopables_symbol())
3463 .ToHandleChecked(); 3463 .ToHandleChecked();
3464 DCHECK(unscopables->IsJSObject()); 3464 DCHECK(unscopables->IsJSObject());
3465 JSObject::AddProperty(Handle<JSObject>::cast(unscopables), 3465 JSObject::AddProperty(Handle<JSObject>::cast(unscopables),
3466 factory()->values_string(), factory()->true_value(), 3466 factory()->values_string(), factory()->true_value(),
3467 NONE); 3467 NONE);
3468 } 3468 }
3469 3469
3470 void Genesis::InitializeGlobal_harmony_global() {
3471 if (!FLAG_harmony_global) return;
3472 Handle<JSGlobalObject> global_object(
3473 JSGlobalObject::cast(native_context()->global_object()));
3474 Handle<JSGlobalProxy> global_proxy(
3475 JSGlobalProxy::cast(native_context()->global_proxy()));
3476 Isolate* isolate = global_object->GetIsolate();
3477 Factory* factory = isolate->factory();
3478 Handle<String> global_name = factory->global_string();
3479 JSObject::AddProperty(global_object, global_name, global_proxy, DONT_ENUM);
3480 }
3481
3470 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, 3482 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target,
3471 const char* name, 3483 const char* name,
3472 Builtins::Name call, 3484 Builtins::Name call,
3473 BuiltinFunctionId id) { 3485 BuiltinFunctionId id) {
3474 // Create the %ArrayBufferPrototype% 3486 // Create the %ArrayBufferPrototype%
3475 // Setup the {prototype} with the given {name} for @@toStringTag. 3487 // Setup the {prototype} with the given {name} for @@toStringTag.
3476 Handle<JSObject> prototype = 3488 Handle<JSObject> prototype =
3477 factory()->NewJSObject(isolate()->object_function(), TENURED); 3489 factory()->NewJSObject(isolate()->object_function(), TENURED);
3478 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(), 3490 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(),
3479 factory()->NewStringFromAsciiChecked(name), 3491 factory()->NewStringFromAsciiChecked(name),
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
3925 #ifdef V8_I18N_SUPPORT 3937 #ifdef V8_I18N_SUPPORT
3926 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", 3938 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js",
3927 nullptr}; 3939 nullptr};
3928 static const char* datetime_format_to_parts_natives[] = { 3940 static const char* datetime_format_to_parts_natives[] = {
3929 "native datetime-format-to-parts.js", nullptr}; 3941 "native datetime-format-to-parts.js", nullptr};
3930 #endif 3942 #endif
3931 static const char* harmony_async_await_natives[] = {nullptr}; 3943 static const char* harmony_async_await_natives[] = {nullptr};
3932 static const char* harmony_restrictive_generators_natives[] = {nullptr}; 3944 static const char* harmony_restrictive_generators_natives[] = {nullptr};
3933 static const char* harmony_trailing_commas_natives[] = {nullptr}; 3945 static const char* harmony_trailing_commas_natives[] = {nullptr};
3934 static const char* harmony_class_fields_natives[] = {nullptr}; 3946 static const char* harmony_class_fields_natives[] = {nullptr};
3947 static const char* harmony_global_natives[] = {nullptr};
3935 3948
3936 for (int i = ExperimentalNatives::GetDebuggerCount(); 3949 for (int i = ExperimentalNatives::GetDebuggerCount();
3937 i < ExperimentalNatives::GetBuiltinsCount(); i++) { 3950 i < ExperimentalNatives::GetBuiltinsCount(); i++) {
3938 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ 3951 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
3939 if (FLAG_##id) { \ 3952 if (FLAG_##id) { \
3940 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ 3953 for (size_t j = 0; id##_natives[j] != NULL; j++) { \
3941 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ 3954 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \
3942 if (strncmp(script_name.start(), id##_natives[j], \ 3955 if (strncmp(script_name.start(), id##_natives[j], \
3943 script_name.length()) == 0) { \ 3956 script_name.length()) == 0) { \
3944 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ 3957 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
4665 } 4678 }
4666 4679
4667 4680
4668 // Called when the top-level V8 mutex is destroyed. 4681 // Called when the top-level V8 mutex is destroyed.
4669 void Bootstrapper::FreeThreadResources() { 4682 void Bootstrapper::FreeThreadResources() {
4670 DCHECK(!IsActive()); 4683 DCHECK(!IsActive());
4671 } 4684 }
4672 4685
4673 } // namespace internal 4686 } // namespace internal
4674 } // namespace v8 4687 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698