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

Side by Side Diff: src/bootstrapper.cc

Issue 1692713005: ES6: Desugaring of instanceof to support @@hasInstance (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@blah
Patch Set: Code comments. Created 4 years, 10 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
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/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 JSObject::kHeaderSize, MaybeHandle<JSObject>(), 1154 JSObject::kHeaderSize, MaybeHandle<JSObject>(),
1155 Builtins::kFunctionHasInstance, 1155 Builtins::kFunctionHasInstance,
1156 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY)); 1156 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY));
1157 1157
1158 // Set the expected parameters for @@hasInstance to 1; required by builtin. 1158 // Set the expected parameters for @@hasInstance to 1; required by builtin.
1159 has_instance->shared()->set_internal_formal_parameter_count(1); 1159 has_instance->shared()->set_internal_formal_parameter_count(1);
1160 1160
1161 // Set the length for the function to satisfy ECMA-262. 1161 // Set the length for the function to satisfy ECMA-262.
1162 has_instance->shared()->set_length(1); 1162 has_instance->shared()->set_length(1);
1163 1163
1164 // Install in the native context
1165 native_context()->set_ordinary_has_instance(*has_instance);
1166
1164 // Install the "constructor" property on the %FunctionPrototype%. 1167 // Install the "constructor" property on the %FunctionPrototype%.
1165 JSObject::AddProperty(prototype, factory->constructor_string(), 1168 JSObject::AddProperty(prototype, factory->constructor_string(),
1166 function_fun, DONT_ENUM); 1169 function_fun, DONT_ENUM);
1167 1170
1168 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); 1171 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun);
1169 strict_function_map_writable_prototype_->SetConstructor(*function_fun); 1172 strict_function_map_writable_prototype_->SetConstructor(*function_fun);
1170 native_context()->strong_function_map()->SetConstructor(*function_fun); 1173 native_context()->strong_function_map()->SetConstructor(*function_fun);
1171 } 1174 }
1172 1175
1173 { // --- A r r a y --- 1176 { // --- A r r a y ---
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe) 2335 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_observe)
2333 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps) 2336 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexps)
2334 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps) 2337 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode_regexps)
2335 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) 2338 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions)
2336 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) 2339 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind)
2337 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property) 2340 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
2338 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name) 2341 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_name)
2339 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) 2342 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
2340 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) 2343 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra)
2341 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) 2344 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls)
2345 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_instanceof)
2342 2346
2343 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, 2347 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
2344 const char* name, Handle<Symbol> value) { 2348 const char* name, Handle<Symbol> value) {
2345 Handle<JSGlobalObject> global( 2349 Handle<JSGlobalObject> global(
2346 JSGlobalObject::cast(native_context->global_object())); 2350 JSGlobalObject::cast(native_context->global_object()));
2347 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); 2351 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol");
2348 Handle<JSObject> symbol = Handle<JSObject>::cast( 2352 Handle<JSObject> symbol = Handle<JSObject>::cast(
2349 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); 2353 JSObject::GetProperty(global, symbol_string).ToHandleChecked());
2350 Handle<String> name_string = factory->InternalizeUtf8String(name); 2354 Handle<String> name_string = factory->InternalizeUtf8String(name);
2351 PropertyAttributes attributes = 2355 PropertyAttributes attributes =
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2973 static const char* harmony_destructuring_assignment_natives[] = {nullptr}; 2977 static const char* harmony_destructuring_assignment_natives[] = {nullptr};
2974 static const char* harmony_object_observe_natives[] = { 2978 static const char* harmony_object_observe_natives[] = {
2975 "native harmony-object-observe.js", nullptr}; 2979 "native harmony-object-observe.js", nullptr};
2976 static const char* harmony_sharedarraybuffer_natives[] = { 2980 static const char* harmony_sharedarraybuffer_natives[] = {
2977 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; 2981 "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL};
2978 static const char* harmony_simd_natives[] = {"native harmony-simd.js", 2982 static const char* harmony_simd_natives[] = {"native harmony-simd.js",
2979 nullptr}; 2983 nullptr};
2980 static const char* harmony_do_expressions_natives[] = {nullptr}; 2984 static const char* harmony_do_expressions_natives[] = {nullptr};
2981 static const char* harmony_regexp_subclass_natives[] = {nullptr}; 2985 static const char* harmony_regexp_subclass_natives[] = {nullptr};
2982 static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; 2986 static const char* harmony_regexp_lookbehind_natives[] = {nullptr};
2987 static const char* harmony_instanceof_natives[] = {nullptr};
2983 static const char* harmony_regexp_property_natives[] = {nullptr}; 2988 static const char* harmony_regexp_property_natives[] = {nullptr};
2984 static const char* harmony_function_name_natives[] = {nullptr}; 2989 static const char* harmony_function_name_natives[] = {nullptr};
2985 static const char* harmony_function_sent_natives[] = {nullptr}; 2990 static const char* harmony_function_sent_natives[] = {nullptr};
2986 static const char* promise_extra_natives[] = {"native promise-extra.js", 2991 static const char* promise_extra_natives[] = {"native promise-extra.js",
2987 nullptr}; 2992 nullptr};
2988 static const char* harmony_object_values_entries_natives[] = {nullptr}; 2993 static const char* harmony_object_values_entries_natives[] = {nullptr};
2989 static const char* harmony_object_own_property_descriptors_natives[] = { 2994 static const char* harmony_object_own_property_descriptors_natives[] = {
2990 nullptr}; 2995 nullptr};
2991 2996
2992 for (int i = ExperimentalNatives::GetDebuggerCount(); 2997 for (int i = ExperimentalNatives::GetDebuggerCount();
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3655 } 3660 }
3656 3661
3657 3662
3658 // Called when the top-level V8 mutex is destroyed. 3663 // Called when the top-level V8 mutex is destroyed.
3659 void Bootstrapper::FreeThreadResources() { 3664 void Bootstrapper::FreeThreadResources() {
3660 DCHECK(!IsActive()); 3665 DCHECK(!IsActive());
3661 } 3666 }
3662 3667
3663 } // namespace internal 3668 } // namespace internal
3664 } // namespace v8 3669 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast-value-factory.cc ('k') | src/contexts.h » ('j') | src/runtime/runtime-function.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698