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

Side by Side Diff: src/bootstrapper.cc

Issue 296413003: Make 'name' property on functions configurable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/es7/object-observe.js » ('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 "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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 function->shared()->set_native(true); 379 function->shared()->set_native(true);
380 return function; 380 return function;
381 } 381 }
382 382
383 383
384 void Genesis::SetFunctionInstanceDescriptor( 384 void Genesis::SetFunctionInstanceDescriptor(
385 Handle<Map> map, PrototypePropertyMode prototypeMode) { 385 Handle<Map> map, PrototypePropertyMode prototypeMode) {
386 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 386 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
387 Map::EnsureDescriptorSlack(map, size); 387 Map::EnsureDescriptorSlack(map, size);
388 388
389 PropertyAttributes attribs = static_cast<PropertyAttributes>( 389 PropertyAttributes ro_attribs =
390 DONT_ENUM | DONT_DELETE | READ_ONLY); 390 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
391 PropertyAttributes roc_attribs =
392 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
391 393
392 Handle<AccessorInfo> length = 394 Handle<AccessorInfo> length =
393 Accessors::FunctionLengthInfo(isolate(), attribs); 395 Accessors::FunctionLengthInfo(isolate(), ro_attribs);
394 { // Add length. 396 { // Add length.
395 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), 397 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())),
396 length, attribs); 398 length, ro_attribs);
397 map->AppendDescriptor(&d); 399 map->AppendDescriptor(&d);
398 } 400 }
399 Handle<AccessorInfo> name = 401 Handle<AccessorInfo> name =
400 Accessors::FunctionNameInfo(isolate(), attribs); 402 Accessors::FunctionNameInfo(isolate(), roc_attribs);
401 { // Add name. 403 { // Add name.
402 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), 404 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())),
403 name, attribs); 405 name, roc_attribs);
404 map->AppendDescriptor(&d); 406 map->AppendDescriptor(&d);
405 } 407 }
406 Handle<AccessorInfo> args = 408 Handle<AccessorInfo> args =
407 Accessors::FunctionArgumentsInfo(isolate(), attribs); 409 Accessors::FunctionArgumentsInfo(isolate(), ro_attribs);
408 { // Add arguments. 410 { // Add arguments.
409 CallbacksDescriptor d(Handle<Name>(Name::cast(args->name())), 411 CallbacksDescriptor d(Handle<Name>(Name::cast(args->name())),
410 args, attribs); 412 args, ro_attribs);
411 map->AppendDescriptor(&d); 413 map->AppendDescriptor(&d);
412 } 414 }
413 Handle<AccessorInfo> caller = 415 Handle<AccessorInfo> caller =
414 Accessors::FunctionCallerInfo(isolate(), attribs); 416 Accessors::FunctionCallerInfo(isolate(), ro_attribs);
415 { // Add caller. 417 { // Add caller.
416 CallbacksDescriptor d(Handle<Name>(Name::cast(caller->name())), 418 CallbacksDescriptor d(Handle<Name>(Name::cast(caller->name())),
417 caller, attribs); 419 caller, ro_attribs);
418 map->AppendDescriptor(&d); 420 map->AppendDescriptor(&d);
419 } 421 }
420 if (prototypeMode != DONT_ADD_PROTOTYPE) { 422 if (prototypeMode != DONT_ADD_PROTOTYPE) {
421 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { 423 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
422 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); 424 ro_attribs = static_cast<PropertyAttributes>(ro_attribs & ~READ_ONLY);
423 } 425 }
424 Handle<AccessorInfo> prototype = 426 Handle<AccessorInfo> prototype =
425 Accessors::FunctionPrototypeInfo(isolate(), attribs); 427 Accessors::FunctionPrototypeInfo(isolate(), ro_attribs);
426 CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())), 428 CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())),
427 prototype, attribs); 429 prototype, ro_attribs);
428 map->AppendDescriptor(&d); 430 map->AppendDescriptor(&d);
429 } 431 }
430 } 432 }
431 433
432 434
433 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { 435 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) {
434 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); 436 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
435 SetFunctionInstanceDescriptor(map, prototype_mode); 437 SetFunctionInstanceDescriptor(map, prototype_mode);
436 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); 438 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE);
437 return map; 439 return map;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 Handle<Map> map, PrototypePropertyMode prototypeMode) { 528 Handle<Map> map, PrototypePropertyMode prototypeMode) {
527 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 529 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
528 Map::EnsureDescriptorSlack(map, size); 530 Map::EnsureDescriptorSlack(map, size);
529 531
530 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); 532 Handle<AccessorPair> arguments(factory()->NewAccessorPair());
531 Handle<AccessorPair> caller(factory()->NewAccessorPair()); 533 Handle<AccessorPair> caller(factory()->NewAccessorPair());
532 PropertyAttributes rw_attribs = 534 PropertyAttributes rw_attribs =
533 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 535 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
534 PropertyAttributes ro_attribs = 536 PropertyAttributes ro_attribs =
535 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 537 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
538 PropertyAttributes roc_attribs =
539 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
536 540
537 Handle<AccessorInfo> length = 541 Handle<AccessorInfo> length =
538 Accessors::FunctionLengthInfo(isolate(), ro_attribs); 542 Accessors::FunctionLengthInfo(isolate(), ro_attribs);
539 { // Add length. 543 { // Add length.
540 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), 544 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())),
541 length, ro_attribs); 545 length, ro_attribs);
542 map->AppendDescriptor(&d); 546 map->AppendDescriptor(&d);
543 } 547 }
544 Handle<AccessorInfo> name = 548 Handle<AccessorInfo> name =
545 Accessors::FunctionNameInfo(isolate(), ro_attribs); 549 Accessors::FunctionNameInfo(isolate(), roc_attribs);
546 { // Add name. 550 { // Add name.
547 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), 551 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())),
548 name, ro_attribs); 552 name, roc_attribs);
549 map->AppendDescriptor(&d); 553 map->AppendDescriptor(&d);
550 } 554 }
551 { // Add arguments. 555 { // Add arguments.
552 CallbacksDescriptor d(factory()->arguments_string(), arguments, 556 CallbacksDescriptor d(factory()->arguments_string(), arguments,
553 rw_attribs); 557 rw_attribs);
554 map->AppendDescriptor(&d); 558 map->AppendDescriptor(&d);
555 } 559 }
556 { // Add caller. 560 { // Add caller.
557 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); 561 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs);
558 map->AppendDescriptor(&d); 562 map->AppendDescriptor(&d);
(...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 return from + sizeof(NestingCounterType); 2705 return from + sizeof(NestingCounterType);
2702 } 2706 }
2703 2707
2704 2708
2705 // Called when the top-level V8 mutex is destroyed. 2709 // Called when the top-level V8 mutex is destroyed.
2706 void Bootstrapper::FreeThreadResources() { 2710 void Bootstrapper::FreeThreadResources() {
2707 ASSERT(!IsActive()); 2711 ASSERT(!IsActive());
2708 } 2712 }
2709 2713
2710 } } // namespace v8::internal 2714 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es7/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698