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

Side by Side Diff: src/bootstrapper.cc

Issue 99203006: Make a strict function's "name" property non-writable. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Make Function.name [[Configurable]] per ES6 Created 7 years 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength)); 400 Handle<Foreign> length(factory()->NewForeign(&Accessors::FunctionLength));
401 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName)); 401 Handle<Foreign> name(factory()->NewForeign(&Accessors::FunctionName));
402 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments)); 402 Handle<Foreign> args(factory()->NewForeign(&Accessors::FunctionArguments));
403 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller)); 403 Handle<Foreign> caller(factory()->NewForeign(&Accessors::FunctionCaller));
404 Handle<Foreign> prototype; 404 Handle<Foreign> prototype;
405 if (prototypeMode != DONT_ADD_PROTOTYPE) { 405 if (prototypeMode != DONT_ADD_PROTOTYPE) {
406 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); 406 prototype = factory()->NewForeign(&Accessors::FunctionPrototype);
407 } 407 }
408 PropertyAttributes attribs = static_cast<PropertyAttributes>( 408 PropertyAttributes attribs = static_cast<PropertyAttributes>(
409 DONT_ENUM | DONT_DELETE | READ_ONLY); 409 DONT_ENUM | DONT_DELETE | READ_ONLY);
410 PropertyAttributes ro_configurable_attribs =
411 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
410 map->set_instance_descriptors(*descriptors); 412 map->set_instance_descriptors(*descriptors);
411 413
412 { // Add length. 414 { // Add length.
413 CallbacksDescriptor d(*factory()->length_string(), *length, attribs); 415 CallbacksDescriptor d(*factory()->length_string(), *length, attribs);
414 map->AppendDescriptor(&d, witness); 416 map->AppendDescriptor(&d, witness);
415 } 417 }
416 { // Add name. 418 { // Add name.
417 CallbacksDescriptor d(*factory()->name_string(), *name, attribs); 419 CallbacksDescriptor d(*factory()->name_string(), *name,
420 ro_configurable_attribs);
418 map->AppendDescriptor(&d, witness); 421 map->AppendDescriptor(&d, witness);
419 } 422 }
420 { // Add arguments. 423 { // Add arguments.
421 CallbacksDescriptor d(*factory()->arguments_string(), *args, attribs); 424 CallbacksDescriptor d(*factory()->arguments_string(), *args, attribs);
422 map->AppendDescriptor(&d, witness); 425 map->AppendDescriptor(&d, witness);
423 } 426 }
424 { // Add caller. 427 { // Add caller.
425 CallbacksDescriptor d(*factory()->caller_string(), *caller, attribs); 428 CallbacksDescriptor d(*factory()->caller_string(), *caller, attribs);
426 map->AppendDescriptor(&d, witness); 429 map->AppendDescriptor(&d, witness);
427 } 430 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 Handle<AccessorPair> arguments(factory()->NewAccessorPair()); 543 Handle<AccessorPair> arguments(factory()->NewAccessorPair());
541 Handle<AccessorPair> caller(factory()->NewAccessorPair()); 544 Handle<AccessorPair> caller(factory()->NewAccessorPair());
542 Handle<Foreign> prototype; 545 Handle<Foreign> prototype;
543 if (prototypeMode != DONT_ADD_PROTOTYPE) { 546 if (prototypeMode != DONT_ADD_PROTOTYPE) {
544 prototype = factory()->NewForeign(&Accessors::FunctionPrototype); 547 prototype = factory()->NewForeign(&Accessors::FunctionPrototype);
545 } 548 }
546 PropertyAttributes rw_attribs = 549 PropertyAttributes rw_attribs =
547 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 550 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
548 PropertyAttributes ro_attribs = 551 PropertyAttributes ro_attribs =
549 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 552 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
553 PropertyAttributes ro_configurable_attribs =
554 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
550 map->set_instance_descriptors(*descriptors); 555 map->set_instance_descriptors(*descriptors);
551 556
552 { // Add length. 557 { // Add length.
553 CallbacksDescriptor d(*factory()->length_string(), *length, ro_attribs); 558 CallbacksDescriptor d(*factory()->length_string(), *length, ro_attribs);
554 map->AppendDescriptor(&d, witness); 559 map->AppendDescriptor(&d, witness);
555 } 560 }
556 { // Add name. 561 { // Add name.
557 CallbacksDescriptor d(*factory()->name_string(), *name, rw_attribs); 562 CallbacksDescriptor d(*factory()->name_string(), *name,
563 ro_configurable_attribs);
558 map->AppendDescriptor(&d, witness); 564 map->AppendDescriptor(&d, witness);
559 } 565 }
560 { // Add arguments. 566 { // Add arguments.
561 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, 567 CallbacksDescriptor d(*factory()->arguments_string(), *arguments,
562 rw_attribs); 568 rw_attribs);
563 map->AppendDescriptor(&d, witness); 569 map->AppendDescriptor(&d, witness);
564 } 570 }
565 { // Add caller. 571 { // Add caller.
566 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs); 572 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs);
567 map->AppendDescriptor(&d, witness); 573 map->AppendDescriptor(&d, witness);
(...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 return from + sizeof(NestingCounterType); 2707 return from + sizeof(NestingCounterType);
2702 } 2708 }
2703 2709
2704 2710
2705 // Called when the top-level V8 mutex is destroyed. 2711 // Called when the top-level V8 mutex is destroyed.
2706 void Bootstrapper::FreeThreadResources() { 2712 void Bootstrapper::FreeThreadResources() {
2707 ASSERT(!IsActive()); 2713 ASSERT(!IsActive());
2708 } 2714 }
2709 2715
2710 } } // namespace v8::internal 2716 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/object-observe.js » ('j') | test/mjsunit/harmony/object-observe.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698