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

Side by Side Diff: src/bootstrapper.cc

Issue 2417183002: [builtins] Also port the Object.prototype.__proto__ accessors to C++. (Closed)
Patch Set: Created 4 years, 2 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/builtins/builtins.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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 void SimpleInstallGetterSetter(Handle<JSObject> base, Handle<String> name, 452 void SimpleInstallGetterSetter(Handle<JSObject> base, Handle<String> name,
453 Builtins::Name call_getter, 453 Builtins::Name call_getter,
454 Builtins::Name call_setter, 454 Builtins::Name call_setter,
455 PropertyAttributes attribs) { 455 PropertyAttributes attribs) {
456 Isolate* const isolate = base->GetIsolate(); 456 Isolate* const isolate = base->GetIsolate();
457 457
458 Handle<String> getter_name = 458 Handle<String> getter_name =
459 Name::ToFunctionName(name, isolate->factory()->get_string()) 459 Name::ToFunctionName(name, isolate->factory()->get_string())
460 .ToHandleChecked(); 460 .ToHandleChecked();
461 Handle<JSFunction> getter = 461 Handle<JSFunction> getter =
462 SimpleCreateFunction(isolate, getter_name, call_getter, 0, false); 462 SimpleCreateFunction(isolate, getter_name, call_getter, 0, true);
463 getter->shared()->set_native(true); 463 getter->shared()->set_native(true);
464 464
465 Handle<String> setter_name = 465 Handle<String> setter_name =
466 Name::ToFunctionName(name, isolate->factory()->set_string()) 466 Name::ToFunctionName(name, isolate->factory()->set_string())
467 .ToHandleChecked(); 467 .ToHandleChecked();
468 Handle<JSFunction> setter = 468 Handle<JSFunction> setter =
469 SimpleCreateFunction(isolate, setter_name, call_setter, 0, false); 469 SimpleCreateFunction(isolate, setter_name, call_setter, 1, true);
470 setter->shared()->set_native(true); 470 setter->shared()->set_native(true);
471 471
472 JSObject::DefineAccessor(base, name, getter, setter, attribs).Check(); 472 JSObject::DefineAccessor(base, name, getter, setter, attribs).Check();
473 } 473 }
474 474
475 Handle<JSFunction> SimpleInstallGetter(Handle<JSObject> base, 475 Handle<JSFunction> SimpleInstallGetter(Handle<JSObject> base,
476 Handle<String> name, 476 Handle<String> name,
477 Handle<Name> property_name, 477 Handle<Name> property_name,
478 Builtins::Name call, bool adapt) { 478 Builtins::Name call, bool adapt) {
479 Isolate* const isolate = base->GetIsolate(); 479 Isolate* const isolate = base->GetIsolate();
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 Builtins::kObjectHasOwnProperty, 1, true); 1191 Builtins::kObjectHasOwnProperty, 1, true);
1192 SimpleInstallFunction(isolate->initial_object_prototype(), 1192 SimpleInstallFunction(isolate->initial_object_prototype(),
1193 "__lookupGetter__", Builtins::kObjectLookupGetter, 1, 1193 "__lookupGetter__", Builtins::kObjectLookupGetter, 1,
1194 true); 1194 true);
1195 SimpleInstallFunction(isolate->initial_object_prototype(), 1195 SimpleInstallFunction(isolate->initial_object_prototype(),
1196 "__lookupSetter__", Builtins::kObjectLookupSetter, 1, 1196 "__lookupSetter__", Builtins::kObjectLookupSetter, 1,
1197 true); 1197 true);
1198 SimpleInstallFunction( 1198 SimpleInstallFunction(
1199 isolate->initial_object_prototype(), "propertyIsEnumerable", 1199 isolate->initial_object_prototype(), "propertyIsEnumerable",
1200 Builtins::kObjectPrototypePropertyIsEnumerable, 1, false); 1200 Builtins::kObjectPrototypePropertyIsEnumerable, 1, false);
1201
1202 SimpleInstallGetterSetter(isolate->initial_object_prototype(),
1203 factory->proto_string(),
1204 Builtins::kObjectPrototypeGetProto,
1205 Builtins::kObjectPrototypeSetProto, DONT_ENUM);
1201 } 1206 }
1202 1207
1203 Handle<JSObject> global(native_context()->global_object()); 1208 Handle<JSObject> global(native_context()->global_object());
1204 1209
1205 { // --- F u n c t i o n --- 1210 { // --- F u n c t i o n ---
1206 Handle<JSFunction> prototype = empty_function; 1211 Handle<JSFunction> prototype = empty_function;
1207 Handle<JSFunction> function_fun = 1212 Handle<JSFunction> function_fun =
1208 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, 1213 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
1209 prototype, Builtins::kFunctionConstructor); 1214 prototype, Builtins::kFunctionConstructor);
1210 function_fun->set_prototype_or_initial_map( 1215 function_fun->set_prototype_or_initial_map(
(...skipping 3244 matching lines...) Expand 10 before | Expand all | Expand 10 after
4455 } 4460 }
4456 4461
4457 4462
4458 // Called when the top-level V8 mutex is destroyed. 4463 // Called when the top-level V8 mutex is destroyed.
4459 void Bootstrapper::FreeThreadResources() { 4464 void Bootstrapper::FreeThreadResources() {
4460 DCHECK(!IsActive()); 4465 DCHECK(!IsActive());
4461 } 4466 }
4462 4467
4463 } // namespace internal 4468 } // namespace internal
4464 } // namespace v8 4469 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698