| OLD | NEW | 
|---|
| 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/isolate-inl.h" | 8 #include "src/isolate-inl.h" | 
| 9 #include "src/natives.h" | 9 #include "src/natives.h" | 
| 10 #include "src/snapshot.h" | 10 #include "src/snapshot.h" | 
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 255                           Handle<ObjectTemplateInfo> object_template); | 255                           Handle<ObjectTemplateInfo> object_template); | 
| 256   bool ConfigureGlobalObjects(v8::Handle<v8::ObjectTemplate> global_template); | 256   bool ConfigureGlobalObjects(v8::Handle<v8::ObjectTemplate> global_template); | 
| 257 | 257 | 
| 258   // Migrates all properties from the 'from' object to the 'to' | 258   // Migrates all properties from the 'from' object to the 'to' | 
| 259   // object and overrides the prototype in 'to' with the one from | 259   // object and overrides the prototype in 'to' with the one from | 
| 260   // 'from'. | 260   // 'from'. | 
| 261   void TransferObject(Handle<JSObject> from, Handle<JSObject> to); | 261   void TransferObject(Handle<JSObject> from, Handle<JSObject> to); | 
| 262   void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to); | 262   void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to); | 
| 263   void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to); | 263   void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to); | 
| 264 | 264 | 
| 265   enum PrototypePropertyMode { | 265   enum FunctionMode { | 
| 266     DONT_ADD_PROTOTYPE, | 266     // With prototype. | 
| 267     ADD_READONLY_PROTOTYPE, | 267     FUNCTION_WITH_WRITEABLE_PROTOTYPE, | 
| 268     ADD_WRITEABLE_PROTOTYPE | 268     FUNCTION_WITH_READONLY_PROTOTYPE, | 
|  | 269     // Without prototype. | 
|  | 270     FUNCTION_WITHOUT_PROTOTYPE, | 
|  | 271     BOUND_FUNCTION | 
| 269   }; | 272   }; | 
| 270 | 273 | 
| 271   Handle<Map> CreateFunctionMap(PrototypePropertyMode prototype_mode); | 274   static bool IsFunctionModeWithPrototype(FunctionMode function_mode) { | 
|  | 275     return (function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE || | 
|  | 276             function_mode == FUNCTION_WITH_READONLY_PROTOTYPE); | 
|  | 277   } | 
|  | 278 | 
|  | 279   Handle<Map> CreateFunctionMap(FunctionMode function_mode); | 
| 272 | 280 | 
| 273   void SetFunctionInstanceDescriptor(Handle<Map> map, | 281   void SetFunctionInstanceDescriptor(Handle<Map> map, | 
| 274                                      PrototypePropertyMode prototypeMode); | 282                                      FunctionMode function_mode); | 
| 275   void MakeFunctionInstancePrototypeWritable(); | 283   void MakeFunctionInstancePrototypeWritable(); | 
| 276 | 284 | 
| 277   Handle<Map> CreateStrictFunctionMap( | 285   Handle<Map> CreateStrictFunctionMap( | 
| 278       PrototypePropertyMode prototype_mode, | 286       FunctionMode function_mode, | 
| 279       Handle<JSFunction> empty_function); | 287       Handle<JSFunction> empty_function); | 
| 280 | 288 | 
| 281   void SetStrictFunctionInstanceDescriptor(Handle<Map> map, | 289   void SetStrictFunctionInstanceDescriptor(Handle<Map> map, | 
| 282                                            PrototypePropertyMode propertyMode); | 290                                            FunctionMode function_mode); | 
| 283 | 291 | 
| 284   static bool CompileBuiltin(Isolate* isolate, int index); | 292   static bool CompileBuiltin(Isolate* isolate, int index); | 
| 285   static bool CompileExperimentalBuiltin(Isolate* isolate, int index); | 293   static bool CompileExperimentalBuiltin(Isolate* isolate, int index); | 
| 286   static bool CompileNative(Isolate* isolate, | 294   static bool CompileNative(Isolate* isolate, | 
| 287                             Vector<const char> name, | 295                             Vector<const char> name, | 
| 288                             Handle<String> source); | 296                             Handle<String> source); | 
| 289   static bool CompileScriptCached(Isolate* isolate, | 297   static bool CompileScriptCached(Isolate* isolate, | 
| 290                                   Vector<const char> name, | 298                                   Vector<const char> name, | 
| 291                                   Handle<String> source, | 299                                   Handle<String> source, | 
| 292                                   SourceCodeCache* cache, | 300                                   SourceCodeCache* cache, | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 375       target, internalized_name, function, attributes).Check(); | 383       target, internalized_name, function, attributes).Check(); | 
| 376   if (target->IsJSGlobalObject()) { | 384   if (target->IsJSGlobalObject()) { | 
| 377     function->shared()->set_instance_class_name(*internalized_name); | 385     function->shared()->set_instance_class_name(*internalized_name); | 
| 378   } | 386   } | 
| 379   function->shared()->set_native(true); | 387   function->shared()->set_native(true); | 
| 380   return function; | 388   return function; | 
| 381 } | 389 } | 
| 382 | 390 | 
| 383 | 391 | 
| 384 void Genesis::SetFunctionInstanceDescriptor( | 392 void Genesis::SetFunctionInstanceDescriptor( | 
| 385     Handle<Map> map, PrototypePropertyMode prototypeMode) { | 393     Handle<Map> map, FunctionMode function_mode) { | 
| 386   int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; | 394   int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4; | 
| 387   Map::EnsureDescriptorSlack(map, size); | 395   Map::EnsureDescriptorSlack(map, size); | 
| 388 | 396 | 
| 389   PropertyAttributes attribs = static_cast<PropertyAttributes>( | 397   PropertyAttributes attribs = static_cast<PropertyAttributes>( | 
| 390       DONT_ENUM | DONT_DELETE | READ_ONLY); | 398       DONT_ENUM | DONT_DELETE | READ_ONLY); | 
| 391 | 399 | 
| 392   Handle<AccessorInfo> length = | 400   Handle<AccessorInfo> length = | 
| 393       Accessors::FunctionLengthInfo(isolate(), attribs); | 401       Accessors::FunctionLengthInfo(isolate(), attribs); | 
| 394   {  // Add length. | 402   {  // Add length. | 
| 395     CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), | 403     CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), | 
| 396                           length, attribs); | 404                           length, attribs); | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 410                           args, attribs); | 418                           args, attribs); | 
| 411     map->AppendDescriptor(&d); | 419     map->AppendDescriptor(&d); | 
| 412   } | 420   } | 
| 413   Handle<AccessorInfo> caller = | 421   Handle<AccessorInfo> caller = | 
| 414       Accessors::FunctionCallerInfo(isolate(), attribs); | 422       Accessors::FunctionCallerInfo(isolate(), attribs); | 
| 415   {  // Add caller. | 423   {  // Add caller. | 
| 416     CallbacksDescriptor d(Handle<Name>(Name::cast(caller->name())), | 424     CallbacksDescriptor d(Handle<Name>(Name::cast(caller->name())), | 
| 417                           caller, attribs); | 425                           caller, attribs); | 
| 418     map->AppendDescriptor(&d); | 426     map->AppendDescriptor(&d); | 
| 419   } | 427   } | 
| 420   if (prototypeMode != DONT_ADD_PROTOTYPE) { | 428   if (IsFunctionModeWithPrototype(function_mode)) { | 
| 421     if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) { | 429     if (function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE) { | 
| 422       attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); | 430       attribs = static_cast<PropertyAttributes>(attribs & ~READ_ONLY); | 
| 423     } | 431     } | 
| 424     Handle<AccessorInfo> prototype = | 432     Handle<AccessorInfo> prototype = | 
| 425         Accessors::FunctionPrototypeInfo(isolate(), attribs); | 433         Accessors::FunctionPrototypeInfo(isolate(), attribs); | 
| 426     CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 434     CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 
| 427                           prototype, attribs); | 435                           prototype, attribs); | 
| 428     map->AppendDescriptor(&d); | 436     map->AppendDescriptor(&d); | 
| 429   } | 437   } | 
| 430 } | 438 } | 
| 431 | 439 | 
| 432 | 440 | 
| 433 Handle<Map> Genesis::CreateFunctionMap(PrototypePropertyMode prototype_mode) { | 441 Handle<Map> Genesis::CreateFunctionMap(FunctionMode function_mode) { | 
| 434   Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 442   Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 
| 435   SetFunctionInstanceDescriptor(map, prototype_mode); | 443   SetFunctionInstanceDescriptor(map, function_mode); | 
| 436   map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); | 444   map->set_function_with_prototype(IsFunctionModeWithPrototype(function_mode)); | 
| 437   return map; | 445   return map; | 
| 438 } | 446 } | 
| 439 | 447 | 
| 440 | 448 | 
| 441 Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { | 449 Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { | 
| 442   // Allocate the map for function instances. Maps are allocated first and their | 450   // Allocate the map for function instances. Maps are allocated first and their | 
| 443   // prototypes patched later, once empty function is created. | 451   // prototypes patched later, once empty function is created. | 
| 444 | 452 | 
| 445   // Functions with this map will not have a 'prototype' property, and | 453   // Functions with this map will not have a 'prototype' property, and | 
| 446   // can not be used as constructors. | 454   // can not be used as constructors. | 
| 447   Handle<Map> function_without_prototype_map = | 455   Handle<Map> function_without_prototype_map = | 
| 448       CreateFunctionMap(DONT_ADD_PROTOTYPE); | 456       CreateFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); | 
| 449   native_context()->set_sloppy_function_without_prototype_map( | 457   native_context()->set_sloppy_function_without_prototype_map( | 
| 450       *function_without_prototype_map); | 458       *function_without_prototype_map); | 
| 451 | 459 | 
| 452   // Allocate the function map. This map is temporary, used only for processing | 460   // Allocate the function map. This map is temporary, used only for processing | 
| 453   // of builtins. | 461   // of builtins. | 
| 454   // Later the map is replaced with writable prototype map, allocated below. | 462   // Later the map is replaced with writable prototype map, allocated below. | 
| 455   Handle<Map> function_map = CreateFunctionMap(ADD_READONLY_PROTOTYPE); | 463   Handle<Map> function_map = | 
|  | 464       CreateFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE); | 
| 456   native_context()->set_sloppy_function_map(*function_map); | 465   native_context()->set_sloppy_function_map(*function_map); | 
| 457   native_context()->set_sloppy_function_with_readonly_prototype_map( | 466   native_context()->set_sloppy_function_with_readonly_prototype_map( | 
| 458       *function_map); | 467       *function_map); | 
| 459 | 468 | 
| 460   // The final map for functions. Writeable prototype. | 469   // The final map for functions. Writeable prototype. | 
| 461   // This map is installed in MakeFunctionInstancePrototypeWritable. | 470   // This map is installed in MakeFunctionInstancePrototypeWritable. | 
| 462   sloppy_function_map_writable_prototype_ = | 471   sloppy_function_map_writable_prototype_ = | 
| 463       CreateFunctionMap(ADD_WRITEABLE_PROTOTYPE); | 472       CreateFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); | 
| 464 | 473 | 
| 465   Factory* factory = isolate->factory(); | 474   Factory* factory = isolate->factory(); | 
| 466 | 475 | 
| 467   Handle<String> object_name = factory->Object_string(); | 476   Handle<String> object_name = factory->Object_string(); | 
| 468 | 477 | 
| 469   {  // --- O b j e c t --- | 478   {  // --- O b j e c t --- | 
| 470     Handle<JSFunction> object_fun = factory->NewFunction(object_name); | 479     Handle<JSFunction> object_fun = factory->NewFunction(object_name); | 
| 471     Handle<Map> object_function_map = | 480     Handle<Map> object_function_map = | 
| 472         factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 481         factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 
| 473     object_fun->set_initial_map(*object_function_map); | 482     object_fun->set_initial_map(*object_function_map); | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 507   empty_function->shared()->set_end_position(source->length()); | 516   empty_function->shared()->set_end_position(source->length()); | 
| 508   empty_function->shared()->DontAdaptArguments(); | 517   empty_function->shared()->DontAdaptArguments(); | 
| 509 | 518 | 
| 510   // Set prototypes for the function maps. | 519   // Set prototypes for the function maps. | 
| 511   native_context()->sloppy_function_map()->set_prototype(*empty_function); | 520   native_context()->sloppy_function_map()->set_prototype(*empty_function); | 
| 512   native_context()->sloppy_function_without_prototype_map()-> | 521   native_context()->sloppy_function_without_prototype_map()-> | 
| 513       set_prototype(*empty_function); | 522       set_prototype(*empty_function); | 
| 514   sloppy_function_map_writable_prototype_->set_prototype(*empty_function); | 523   sloppy_function_map_writable_prototype_->set_prototype(*empty_function); | 
| 515 | 524 | 
| 516   // Allocate the function map first and then patch the prototype later | 525   // Allocate the function map first and then patch the prototype later | 
| 517   Handle<Map> empty_function_map = CreateFunctionMap(DONT_ADD_PROTOTYPE); | 526   Handle<Map> empty_function_map = | 
|  | 527       CreateFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); | 
| 518   empty_function_map->set_prototype( | 528   empty_function_map->set_prototype( | 
| 519       native_context()->object_function()->prototype()); | 529       native_context()->object_function()->prototype()); | 
| 520   empty_function->set_map(*empty_function_map); | 530   empty_function->set_map(*empty_function_map); | 
| 521   return empty_function; | 531   return empty_function; | 
| 522 } | 532 } | 
| 523 | 533 | 
| 524 | 534 | 
| 525 void Genesis::SetStrictFunctionInstanceDescriptor( | 535 void Genesis::SetStrictFunctionInstanceDescriptor( | 
| 526     Handle<Map> map, PrototypePropertyMode prototypeMode) { | 536     Handle<Map> map, FunctionMode function_mode) { | 
| 527   int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; | 537   int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4; | 
| 528   Map::EnsureDescriptorSlack(map, size); | 538   Map::EnsureDescriptorSlack(map, size); | 
| 529 | 539 | 
| 530   Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 540   Handle<AccessorPair> arguments(factory()->NewAccessorPair()); | 
| 531   Handle<AccessorPair> caller(factory()->NewAccessorPair()); | 541   Handle<AccessorPair> caller(factory()->NewAccessorPair()); | 
| 532   PropertyAttributes rw_attribs = | 542   PropertyAttributes rw_attribs = | 
| 533       static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 543       static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 
| 534   PropertyAttributes ro_attribs = | 544   PropertyAttributes ro_attribs = | 
| 535       static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 545       static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 
| 536 | 546 | 
| 537   Handle<AccessorInfo> length = | 547   // Add length. | 
| 538       Accessors::FunctionLengthInfo(isolate(), ro_attribs); | 548   if (function_mode == BOUND_FUNCTION) { | 
| 539   {  // Add length. | 549     Handle<String> length_string = isolate()->factory()->length_string(); | 
|  | 550     FieldDescriptor d(length_string, 0, ro_attribs, Representation::Tagged()); | 
|  | 551     map->AppendDescriptor(&d); | 
|  | 552   } else { | 
|  | 553     ASSERT(function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE || | 
|  | 554            function_mode == FUNCTION_WITH_READONLY_PROTOTYPE || | 
|  | 555            function_mode == FUNCTION_WITHOUT_PROTOTYPE); | 
|  | 556     Handle<AccessorInfo> length = | 
|  | 557         Accessors::FunctionLengthInfo(isolate(), ro_attribs); | 
| 540     CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), | 558     CallbacksDescriptor d(Handle<Name>(Name::cast(length->name())), | 
| 541                           length, ro_attribs); | 559                           length, ro_attribs); | 
| 542     map->AppendDescriptor(&d); | 560     map->AppendDescriptor(&d); | 
| 543   } | 561   } | 
| 544   Handle<AccessorInfo> name = | 562   Handle<AccessorInfo> name = | 
| 545       Accessors::FunctionNameInfo(isolate(), ro_attribs); | 563       Accessors::FunctionNameInfo(isolate(), ro_attribs); | 
| 546   {  // Add name. | 564   {  // Add name. | 
| 547     CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), | 565     CallbacksDescriptor d(Handle<Name>(Name::cast(name->name())), | 
| 548                           name, ro_attribs); | 566                           name, ro_attribs); | 
| 549     map->AppendDescriptor(&d); | 567     map->AppendDescriptor(&d); | 
| 550   } | 568   } | 
| 551   {  // Add arguments. | 569   {  // Add arguments. | 
| 552     CallbacksDescriptor d(factory()->arguments_string(), arguments, | 570     CallbacksDescriptor d(factory()->arguments_string(), arguments, | 
| 553                           rw_attribs); | 571                           rw_attribs); | 
| 554     map->AppendDescriptor(&d); | 572     map->AppendDescriptor(&d); | 
| 555   } | 573   } | 
| 556   {  // Add caller. | 574   {  // Add caller. | 
| 557     CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); | 575     CallbacksDescriptor d(factory()->caller_string(), caller, rw_attribs); | 
| 558     map->AppendDescriptor(&d); | 576     map->AppendDescriptor(&d); | 
| 559   } | 577   } | 
| 560   if (prototypeMode != DONT_ADD_PROTOTYPE) { | 578   if (IsFunctionModeWithPrototype(function_mode)) { | 
| 561     // Add prototype. | 579     // Add prototype. | 
| 562     PropertyAttributes attribs = | 580     PropertyAttributes attribs = | 
| 563         prototypeMode == ADD_WRITEABLE_PROTOTYPE ? rw_attribs : ro_attribs; | 581         function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE ? rw_attribs | 
|  | 582                                                            : ro_attribs; | 
| 564     Handle<AccessorInfo> prototype = | 583     Handle<AccessorInfo> prototype = | 
| 565         Accessors::FunctionPrototypeInfo(isolate(), attribs); | 584         Accessors::FunctionPrototypeInfo(isolate(), attribs); | 
| 566     CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 585     CallbacksDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 
| 567                           prototype, attribs); | 586                           prototype, attribs); | 
| 568     map->AppendDescriptor(&d); | 587     map->AppendDescriptor(&d); | 
| 569   } | 588   } | 
| 570 } | 589 } | 
| 571 | 590 | 
| 572 | 591 | 
| 573 // ECMAScript 5th Edition, 13.2.3 | 592 // ECMAScript 5th Edition, 13.2.3 | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 598     generator_poison_function->set_map(native_context()->sloppy_function_map()); | 617     generator_poison_function->set_map(native_context()->sloppy_function_map()); | 
| 599     generator_poison_function->shared()->DontAdaptArguments(); | 618     generator_poison_function->shared()->DontAdaptArguments(); | 
| 600 | 619 | 
| 601     JSObject::PreventExtensions(generator_poison_function).Assert(); | 620     JSObject::PreventExtensions(generator_poison_function).Assert(); | 
| 602   } | 621   } | 
| 603   return generator_poison_function; | 622   return generator_poison_function; | 
| 604 } | 623 } | 
| 605 | 624 | 
| 606 | 625 | 
| 607 Handle<Map> Genesis::CreateStrictFunctionMap( | 626 Handle<Map> Genesis::CreateStrictFunctionMap( | 
| 608     PrototypePropertyMode prototype_mode, | 627     FunctionMode function_mode, | 
| 609     Handle<JSFunction> empty_function) { | 628     Handle<JSFunction> empty_function) { | 
| 610   Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 629   Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | 
| 611   SetStrictFunctionInstanceDescriptor(map, prototype_mode); | 630   SetStrictFunctionInstanceDescriptor(map, function_mode); | 
| 612   map->set_function_with_prototype(prototype_mode != DONT_ADD_PROTOTYPE); | 631   map->set_function_with_prototype(IsFunctionModeWithPrototype(function_mode)); | 
| 613   map->set_prototype(*empty_function); | 632   map->set_prototype(*empty_function); | 
| 614   return map; | 633   return map; | 
| 615 } | 634 } | 
| 616 | 635 | 
| 617 | 636 | 
| 618 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { | 637 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { | 
| 619   // Allocate map for the prototype-less strict mode instances. | 638   // Allocate map for the prototype-less strict mode instances. | 
| 620   Handle<Map> strict_function_without_prototype_map = | 639   Handle<Map> strict_function_without_prototype_map = | 
| 621       CreateStrictFunctionMap(DONT_ADD_PROTOTYPE, empty); | 640       CreateStrictFunctionMap(FUNCTION_WITHOUT_PROTOTYPE, empty); | 
| 622   native_context()->set_strict_function_without_prototype_map( | 641   native_context()->set_strict_function_without_prototype_map( | 
| 623       *strict_function_without_prototype_map); | 642       *strict_function_without_prototype_map); | 
| 624 | 643 | 
| 625   // Allocate map for the strict mode functions. This map is temporary, used | 644   // Allocate map for the strict mode functions. This map is temporary, used | 
| 626   // only for processing of builtins. | 645   // only for processing of builtins. | 
| 627   // Later the map is replaced with writable prototype map, allocated below. | 646   // Later the map is replaced with writable prototype map, allocated below. | 
| 628   Handle<Map> strict_function_map = | 647   Handle<Map> strict_function_map = | 
| 629       CreateStrictFunctionMap(ADD_READONLY_PROTOTYPE, empty); | 648       CreateStrictFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE, empty); | 
| 630   native_context()->set_strict_function_map(*strict_function_map); | 649   native_context()->set_strict_function_map(*strict_function_map); | 
| 631 | 650 | 
| 632   // The final map for the strict mode functions. Writeable prototype. | 651   // The final map for the strict mode functions. Writeable prototype. | 
| 633   // This map is installed in MakeFunctionInstancePrototypeWritable. | 652   // This map is installed in MakeFunctionInstancePrototypeWritable. | 
| 634   strict_function_map_writable_prototype_ = | 653   strict_function_map_writable_prototype_ = | 
| 635       CreateStrictFunctionMap(ADD_WRITEABLE_PROTOTYPE, empty); | 654       CreateStrictFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); | 
|  | 655   // Special map for bound functions. | 
|  | 656   Handle<Map> bound_function_map = | 
|  | 657       CreateStrictFunctionMap(BOUND_FUNCTION, empty); | 
|  | 658   native_context()->set_bound_function_map(*bound_function_map); | 
| 636 | 659 | 
| 637   // Complete the callbacks. | 660   // Complete the callbacks. | 
| 638   PoisonArgumentsAndCaller(strict_function_without_prototype_map); | 661   PoisonArgumentsAndCaller(strict_function_without_prototype_map); | 
| 639   PoisonArgumentsAndCaller(strict_function_map); | 662   PoisonArgumentsAndCaller(strict_function_map); | 
| 640   PoisonArgumentsAndCaller(strict_function_map_writable_prototype_); | 663   PoisonArgumentsAndCaller(strict_function_map_writable_prototype_); | 
|  | 664   PoisonArgumentsAndCaller(bound_function_map); | 
| 641 } | 665 } | 
| 642 | 666 | 
| 643 | 667 | 
| 644 static void SetAccessors(Handle<Map> map, | 668 static void SetAccessors(Handle<Map> map, | 
| 645                          Handle<String> name, | 669                          Handle<String> name, | 
| 646                          Handle<JSFunction> func) { | 670                          Handle<JSFunction> func) { | 
| 647   DescriptorArray* descs = map->instance_descriptors(); | 671   DescriptorArray* descs = map->instance_descriptors(); | 
| 648   int number = descs->SearchWithCache(*name, *map); | 672   int number = descs->SearchWithCache(*name, *map); | 
| 649   AccessorPair* accessors = AccessorPair::cast(descs->GetValue(number)); | 673   AccessorPair* accessors = AccessorPair::cast(descs->GetValue(number)); | 
| 650   accessors->set_getter(*func); | 674   accessors->set_getter(*func); | 
| (...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2718   return from + sizeof(NestingCounterType); | 2742   return from + sizeof(NestingCounterType); | 
| 2719 } | 2743 } | 
| 2720 | 2744 | 
| 2721 | 2745 | 
| 2722 // Called when the top-level V8 mutex is destroyed. | 2746 // Called when the top-level V8 mutex is destroyed. | 
| 2723 void Bootstrapper::FreeThreadResources() { | 2747 void Bootstrapper::FreeThreadResources() { | 
| 2724   ASSERT(!IsActive()); | 2748   ASSERT(!IsActive()); | 
| 2725 } | 2749 } | 
| 2726 | 2750 | 
| 2727 } }  // namespace v8::internal | 2751 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|