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

Side by Side Diff: src/bootstrapper.cc

Issue 297163009: Revert "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 ro_attribs = 389 PropertyAttributes attribs = static_cast<PropertyAttributes>(
390 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 390 DONT_ENUM | DONT_DELETE | READ_ONLY);
391 PropertyAttributes roc_attribs =
392 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
393 391
394 Handle<AccessorInfo> length = 392 Handle<AccessorInfo> length =
395 Accessors::FunctionLengthInfo(isolate(), ro_attribs); 393 Accessors::FunctionLengthInfo(isolate(), attribs);
396 { // Add length. 394 { // Add length.
397 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), 395 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())),
398 length, ro_attribs); 396 length, attribs);
399 map->AppendDescriptor(&d); 397 map->AppendDescriptor(&d);
400 } 398 }
401 Handle<AccessorInfo> name = 399 Handle<AccessorInfo> name =
402 Accessors::FunctionNameInfo(isolate(), roc_attribs); 400 Accessors::FunctionNameInfo(isolate(), attribs);
403 { // Add name. 401 { // Add name.
404 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), 402 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())),
405 name, roc_attribs); 403 name, attribs);
406 map->AppendDescriptor(&d); 404 map->AppendDescriptor(&d);
407 } 405 }
408 Handle<AccessorInfo> args = 406 Handle<AccessorInfo> args =
409 Accessors::FunctionArgumentsInfo(isolate(), ro_attribs); 407 Accessors::FunctionArgumentsInfo(isolate(), attribs);
410 { // Add arguments. 408 { // Add arguments.
411 CallbacksDescriptor d(Handle<Name>(Name::cast(args->name())), 409 CallbacksDescriptor d(Handle<Name>(Name::cast(args->name())),
412 args, ro_attribs); 410 args, attribs);
413 map->AppendDescriptor(&d); 411 map->AppendDescriptor(&d);
414 } 412 }
415 Handle<AccessorInfo> caller = 413 Handle<AccessorInfo> caller =
416 Accessors::FunctionCallerInfo(isolate(), ro_attribs); 414 Accessors::FunctionCallerInfo(isolate(), attribs);
417 { // Add caller. 415 { // Add caller.
418 CallbacksDescriptor d(Handle<Name>(Name::cast(caller->name())), 416 CallbacksDescriptor d(Handle<Name>(Name::cast(caller->name())),
419 caller, ro_attribs); 417 caller, attribs);
420 map->AppendDescriptor(&d); 418 map->AppendDescriptor(&d);
421 } 419 }
422 if (prototypeMode != DONT_ADD_PROTOTYPE) { 420 if (prototypeMode != DONT_ADD_PROTOTYPE) {
423 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { 421 if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
424 ro_attribs = static_cast<PropertyAttributes>(ro_attribs & ~READ_ONLY); 422 attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY);
425 } 423 }
426 Handle<AccessorInfo> prototype = 424 Handle<AccessorInfo> prototype =
427 Accessors::FunctionPrototypeInfo(isolate(), ro_attribs); 425 Accessors::FunctionPrototypeInfo(isolate(), attribs);
428 CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())), 426 CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())),
429 prototype, ro_attribs); 427 prototype, attribs);
430 map->AppendDescriptor(&d); 428 map->AppendDescriptor(&d);
431 } 429 }
432 } 430 }
433 431
434 432
435 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { 433 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) {
436 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); 434 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
437 SetFunctionInstanceDescriptor(map, prototype_mode); 435 SetFunctionInstanceDescriptor(map, prototype_mode);
438 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); 436 map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE);
439 return map; 437 return map;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 Handle<Map> map, PrototypePropertyMode prototypeMode) { 526 Handle<Map> map, PrototypePropertyMode prototypeMode) {
529 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 527 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
530 Map::EnsureDescriptorSlack(map, size); 528 Map::EnsureDescriptorSlack(map, size);
531 529
532 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); 530 Handle<AccessorPair> arguments(factory()->NewAccessorPair());
533 Handle<AccessorPair> caller(factory()->NewAccessorPair()); 531 Handle<AccessorPair> caller(factory()->NewAccessorPair());
534 PropertyAttributes rw_attribs = 532 PropertyAttributes rw_attribs =
535 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 533 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
536 PropertyAttributes ro_attribs = 534 PropertyAttributes ro_attribs =
537 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 535 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
538 PropertyAttributes roc_attribs =
539 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
540 536
541 Handle<AccessorInfo> length = 537 Handle<AccessorInfo> length =
542 Accessors::FunctionLengthInfo(isolate(), ro_attribs); 538 Accessors::FunctionLengthInfo(isolate(), ro_attribs);
543 { // Add length. 539 { // Add length.
544 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), 540 CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())),
545 length, ro_attribs); 541 length, ro_attribs);
546 map->AppendDescriptor(&d); 542 map->AppendDescriptor(&d);
547 } 543 }
548 Handle<AccessorInfo> name = 544 Handle<AccessorInfo> name =
549 Accessors::FunctionNameInfo(isolate(), roc_attribs); 545 Accessors::FunctionNameInfo(isolate(), ro_attribs);
550 { // Add name. 546 { // Add name.
551 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), 547 CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())),
552 name, roc_attribs); 548 name, ro_attribs);
553 map->AppendDescriptor(&d); 549 map->AppendDescriptor(&d);
554 } 550 }
555 { // Add arguments. 551 { // Add arguments.
556 CallbacksDescriptor d(factory()->arguments_string(), arguments, 552 CallbacksDescriptor d(factory()->arguments_string(), arguments,
557 rw_attribs); 553 rw_attribs);
558 map->AppendDescriptor(&d); 554 map->AppendDescriptor(&d);
559 } 555 }
560 { // Add caller. 556 { // Add caller.
561 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); 557 CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs);
562 map->AppendDescriptor(&d); 558 map->AppendDescriptor(&d);
(...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 return from + sizeof(NestingCounterType); 2701 return from + sizeof(NestingCounterType);
2706 } 2702 }
2707 2703
2708 2704
2709 // Called when the top-level V8 mutex is destroyed. 2705 // Called when the top-level V8 mutex is destroyed.
2710 void Bootstrapper::FreeThreadResources() { 2706 void Bootstrapper::FreeThreadResources() {
2711 ASSERT(!IsActive()); 2707 ASSERT(!IsActive());
2712 } 2708 }
2713 2709
2714 } } // namespace v8::internal 2710 } } // 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