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/factory.cc

Issue 13192004: arrange to create prototypes for generators (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Allow fast closure creation for generators Created 7 years, 8 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
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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 CALL_HEAP_FUNCTION( 571 CALL_HEAP_FUNCTION(
572 isolate(), 572 isolate(),
573 isolate()->heap()->AllocateFunction(*function_map, 573 isolate()->heap()->AllocateFunction(*function_map,
574 *function_info, 574 *function_info,
575 isolate()->heap()->the_hole_value(), 575 isolate()->heap()->the_hole_value(),
576 pretenure), 576 pretenure),
577 JSFunction); 577 JSFunction);
578 } 578 }
579 579
580 580
581 static Handle<Map> MapForNewFunction(Isolate *isolate,
582 Handle<SharedFunctionInfo> function_info) {
583 if (function_info->is_generator()) {
584 if (function_info->is_classic_mode()) {
585 return isolate->generator_function_map();
586 } else {
587 return isolate->strict_mode_generator_function_map();
588 }
589 } else {
590 if (function_info->is_classic_mode()) {
591 return isolate->function_map();
592 } else {
593 return isolate->strict_mode_function_map();
594 }
595 }
596 }
597
598
581 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 599 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
582 Handle<SharedFunctionInfo> function_info, 600 Handle<SharedFunctionInfo> function_info,
583 Handle<Context> context, 601 Handle<Context> context,
584 PretenureFlag pretenure) { 602 PretenureFlag pretenure) {
585 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( 603 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo(
586 function_info, 604 function_info,
587 function_info->is_classic_mode() 605 MapForNewFunction(isolate(), function_info),
588 ? isolate()->function_map()
589 : isolate()->strict_mode_function_map(),
590 pretenure); 606 pretenure);
591 607
592 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { 608 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) {
593 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); 609 function_info->ResetForNewContext(isolate()->heap()->global_ic_age());
594 } 610 }
595 611
596 result->set_context(*context); 612 result->set_context(*context);
597 613
598 int index = function_info->SearchOptimizedCodeMap(context->native_context()); 614 int index = function_info->SearchOptimizedCodeMap(context->native_context());
599 if (!function_info->bound() && index < 0) { 615 if (!function_info->bound() && index < 0) {
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 return Handle<Object>::null(); 1495 return Handle<Object>::null();
1480 } 1496 }
1481 1497
1482 1498
1483 Handle<Object> Factory::ToBoolean(bool value) { 1499 Handle<Object> Factory::ToBoolean(bool value) {
1484 return value ? true_value() : false_value(); 1500 return value ? true_value() : false_value();
1485 } 1501 }
1486 1502
1487 1503
1488 } } // namespace v8::internal 1504 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698