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

Side by Side Diff: src/bootstrapper.cc

Issue 10388158: Fix CreateEmptyFunction to not share descriptor array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 global_context()->set_object_function(*object_fun); 478 global_context()->set_object_function(*object_fun);
479 479
480 // Allocate a new prototype for the object function. 480 // Allocate a new prototype for the object function.
481 Handle<JSObject> prototype = factory->NewJSObject( 481 Handle<JSObject> prototype = factory->NewJSObject(
482 isolate->object_function(), 482 isolate->object_function(),
483 TENURED); 483 TENURED);
484 484
485 global_context()->set_initial_object_prototype(*prototype); 485 global_context()->set_initial_object_prototype(*prototype);
486 SetPrototype(object_fun, prototype); 486 SetPrototype(object_fun, prototype);
487 object_function_map-> 487 object_function_map->set_instance_descriptors(
488 set_instance_descriptors(heap->empty_descriptor_array()); 488 heap->empty_descriptor_array());
489 } 489 }
490 490
491 // Allocate the empty function as the prototype for function ECMAScript 491 // Allocate the empty function as the prototype for function ECMAScript
492 // 262 15.3.4. 492 // 262 15.3.4.
493 Handle<String> symbol = factory->LookupAsciiSymbol("Empty"); 493 Handle<String> symbol = factory->LookupAsciiSymbol("Empty");
494 Handle<JSFunction> empty_function = 494 Handle<JSFunction> empty_function =
495 factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE); 495 factory->NewFunctionWithoutPrototype(symbol, CLASSIC_MODE);
496 496
497 // --- E m p t y --- 497 // --- E m p t y ---
498 Handle<Code> code = 498 Handle<Code> code =
(...skipping 10 matching lines...) Expand all
509 empty_function->shared()->DontAdaptArguments(); 509 empty_function->shared()->DontAdaptArguments();
510 510
511 // Set prototypes for the function maps. 511 // Set prototypes for the function maps.
512 global_context()->function_map()->set_prototype(*empty_function); 512 global_context()->function_map()->set_prototype(*empty_function);
513 global_context()->function_instance_map()->set_prototype(*empty_function); 513 global_context()->function_instance_map()->set_prototype(*empty_function);
514 global_context()->function_without_prototype_map()-> 514 global_context()->function_without_prototype_map()->
515 set_prototype(*empty_function); 515 set_prototype(*empty_function);
516 function_instance_map_writable_prototype_->set_prototype(*empty_function); 516 function_instance_map_writable_prototype_->set_prototype(*empty_function);
517 517
518 // Allocate the function map first and then patch the prototype later 518 // Allocate the function map first and then patch the prototype later
519 Handle<Map> empty_fm = factory->CopyMapDropDescriptors( 519 Handle<Map> empty_function_map = CreateFunctionMap(DONT_ADD_PROTOTYPE);
520 function_without_prototype_map); 520 empty_function_map->set_prototype(
521 empty_fm->set_instance_descriptors( 521 global_context()->object_function()->prototype());
522 function_without_prototype_map->instance_descriptors()); 522 empty_function->set_map(*empty_function_map);
523 empty_fm->set_prototype(global_context()->object_function()->prototype());
524 empty_function->set_map(*empty_fm);
525 return empty_function; 523 return empty_function;
526 } 524 }
527 525
528 526
529 Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor( 527 Handle<DescriptorArray> Genesis::ComputeStrictFunctionInstanceDescriptor(
530 PrototypePropertyMode prototypeMode) { 528 PrototypePropertyMode prototypeMode) {
531 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5; 529 int size = (prototypeMode == DONT_ADD_PROTOTYPE) ? 4 : 5;
532 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size)); 530 Handle<DescriptorArray> descriptors(factory()->NewDescriptorArray(size));
533 PropertyAttributes attribs = static_cast<PropertyAttributes>( 531 PropertyAttributes attribs = static_cast<PropertyAttributes>(
534 DONT_ENUM | DONT_DELETE); 532 DONT_ENUM | DONT_DELETE);
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 return from + sizeof(NestingCounterType); 2366 return from + sizeof(NestingCounterType);
2369 } 2367 }
2370 2368
2371 2369
2372 // Called when the top-level V8 mutex is destroyed. 2370 // Called when the top-level V8 mutex is destroyed.
2373 void Bootstrapper::FreeThreadResources() { 2371 void Bootstrapper::FreeThreadResources() {
2374 ASSERT(!IsActive()); 2372 ASSERT(!IsActive());
2375 } 2373 }
2376 2374
2377 } } // namespace v8::internal 2375 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698