OLD | NEW |
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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 | 607 |
608 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { | 608 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { |
609 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); | 609 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); |
610 } | 610 } |
611 | 611 |
612 result->set_context(*context); | 612 result->set_context(*context); |
613 | 613 |
614 if (function_info->is_generator()) { | 614 if (function_info->is_generator()) { |
615 // Generator functions have specialized prototypes and instance types, so | 615 // Generator functions have specialized prototypes and instance types, so |
616 // they need their prototypes to be created eagerly. | 616 // they need their prototypes to be created eagerly. |
617 // TODO(wingo): Use JS_GENERATOR_TYPE. | 617 Handle<Map> instance_map = |
618 Handle<Map> instance_map = NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 618 NewMap(JS_GENERATOR_ITERATOR_TYPE, JSGeneratorIterator::kSize); |
619 Handle<JSObject> iterator_prototype = NewFunctionPrototype(result); | 619 Handle<JSObject> iterator_prototype = NewFunctionPrototype(result); |
620 instance_map->set_prototype(*iterator_prototype); | 620 instance_map->set_prototype(*iterator_prototype); |
621 result->set_initial_map(*instance_map); | 621 result->set_initial_map(*instance_map); |
622 } | 622 } |
623 | 623 |
624 int index = function_info->SearchOptimizedCodeMap(context->native_context()); | 624 int index = function_info->SearchOptimizedCodeMap(context->native_context()); |
625 if (!function_info->bound() && index < 0) { | 625 if (!function_info->bound() && index < 0) { |
626 int number_of_literals = function_info->num_literals(); | 626 int number_of_literals = function_info->num_literals(); |
627 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); | 627 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); |
628 if (number_of_literals > 0) { | 628 if (number_of_literals > 0) { |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 | 971 |
972 | 972 |
973 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, | 973 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, |
974 PretenureFlag pretenure) { | 974 PretenureFlag pretenure) { |
975 CALL_HEAP_FUNCTION( | 975 CALL_HEAP_FUNCTION( |
976 isolate(), | 976 isolate(), |
977 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); | 977 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); |
978 } | 978 } |
979 | 979 |
980 | 980 |
| 981 Handle<JSGeneratorIterator> Factory::NewJSGeneratorIterator( |
| 982 Handle<JSFunction> function) { |
| 983 CALL_HEAP_FUNCTION( |
| 984 isolate(), |
| 985 isolate()->heap()->AllocateJSGeneratorIterator(*function), |
| 986 JSGeneratorIterator); |
| 987 } |
| 988 |
| 989 |
981 Handle<JSModule> Factory::NewJSModule(Handle<Context> context, | 990 Handle<JSModule> Factory::NewJSModule(Handle<Context> context, |
982 Handle<ScopeInfo> scope_info) { | 991 Handle<ScopeInfo> scope_info) { |
983 CALL_HEAP_FUNCTION( | 992 CALL_HEAP_FUNCTION( |
984 isolate(), | 993 isolate(), |
985 isolate()->heap()->AllocateJSModule(*context, *scope_info), JSModule); | 994 isolate()->heap()->AllocateJSModule(*context, *scope_info), JSModule); |
986 } | 995 } |
987 | 996 |
988 | 997 |
989 Handle<GlobalObject> Factory::NewGlobalObject( | 998 Handle<GlobalObject> Factory::NewGlobalObject( |
990 Handle<JSFunction> constructor) { | 999 Handle<JSFunction> constructor) { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 return Handle<Object>::null(); | 1514 return Handle<Object>::null(); |
1506 } | 1515 } |
1507 | 1516 |
1508 | 1517 |
1509 Handle<Object> Factory::ToBoolean(bool value) { | 1518 Handle<Object> Factory::ToBoolean(bool value) { |
1510 return value ? true_value() : false_value(); | 1519 return value ? true_value() : false_value(); |
1511 } | 1520 } |
1512 | 1521 |
1513 | 1522 |
1514 } } // namespace v8::internal | 1523 } } // namespace v8::internal |
OLD | NEW |