OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 JSFunction); | 498 JSFunction); |
499 } | 499 } |
500 | 500 |
501 | 501 |
502 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( | 502 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
503 Handle<SharedFunctionInfo> function_info, | 503 Handle<SharedFunctionInfo> function_info, |
504 Handle<Context> context, | 504 Handle<Context> context, |
505 PretenureFlag pretenure) { | 505 PretenureFlag pretenure) { |
506 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( | 506 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( |
507 function_info, | 507 function_info, |
508 function_info->strict_mode() | 508 function_info->is_classic_mode() |
509 ? isolate()->strict_mode_function_map() | 509 ? isolate()->function_map() |
510 : isolate()->function_map(), | 510 : isolate()->strict_mode_function_map(), |
511 pretenure); | 511 pretenure); |
512 | 512 |
513 result->set_context(*context); | 513 result->set_context(*context); |
514 if (!function_info->bound()) { | 514 if (!function_info->bound()) { |
515 int number_of_literals = function_info->num_literals(); | 515 int number_of_literals = function_info->num_literals(); |
516 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); | 516 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); |
517 if (number_of_literals > 0) { | 517 if (number_of_literals > 0) { |
518 // Store the object, regexp and array functions in the literals | 518 // Store the object, regexp and array functions in the literals |
519 // array prefix. These functions will be used when creating | 519 // array prefix. These functions will be used when creating |
520 // object, regexp and array literals in this function. | 520 // object, regexp and array literals in this function. |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 SetPrototypeProperty(function, prototype); | 750 SetPrototypeProperty(function, prototype); |
751 // Currently safe because it is only invoked from Genesis. | 751 // Currently safe because it is only invoked from Genesis. |
752 SetLocalPropertyNoThrow(prototype, constructor_symbol(), function, DONT_ENUM); | 752 SetLocalPropertyNoThrow(prototype, constructor_symbol(), function, DONT_ENUM); |
753 return function; | 753 return function; |
754 } | 754 } |
755 | 755 |
756 | 756 |
757 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, | 757 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, |
758 Handle<Code> code) { | 758 Handle<Code> code) { |
759 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, | 759 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, |
760 kNonStrictMode); | 760 CLASSIC_MODE); |
761 function->shared()->set_code(*code); | 761 function->shared()->set_code(*code); |
762 function->set_code(*code); | 762 function->set_code(*code); |
763 ASSERT(!function->has_initial_map()); | 763 ASSERT(!function->has_initial_map()); |
764 ASSERT(!function->has_prototype()); | 764 ASSERT(!function->has_prototype()); |
765 return function; | 765 return function; |
766 } | 766 } |
767 | 767 |
768 | 768 |
769 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { | 769 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { |
770 CALL_HEAP_FUNCTION( | 770 CALL_HEAP_FUNCTION( |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 1064 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
1065 Handle<Object> prototype) { | 1065 Handle<Object> prototype) { |
1066 Handle<JSFunction> fun = NewFunctionHelper(name, prototype); | 1066 Handle<JSFunction> fun = NewFunctionHelper(name, prototype); |
1067 fun->set_context(isolate()->context()->global_context()); | 1067 fun->set_context(isolate()->context()->global_context()); |
1068 return fun; | 1068 return fun; |
1069 } | 1069 } |
1070 | 1070 |
1071 | 1071 |
1072 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper( | 1072 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper( |
1073 Handle<String> name, | 1073 Handle<String> name, |
1074 StrictModeFlag strict_mode) { | 1074 LanguageMode language_mode) { |
1075 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); | 1075 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); |
1076 Handle<Map> map = strict_mode == kStrictMode | 1076 Handle<Map> map = (language_mode == CLASSIC_MODE) |
1077 ? isolate()->strict_mode_function_without_prototype_map() | 1077 ? isolate()->function_without_prototype_map() |
1078 : isolate()->function_without_prototype_map(); | 1078 : isolate()->strict_mode_function_without_prototype_map(); |
1079 CALL_HEAP_FUNCTION(isolate(), | 1079 CALL_HEAP_FUNCTION(isolate(), |
1080 isolate()->heap()->AllocateFunction( | 1080 isolate()->heap()->AllocateFunction( |
1081 *map, | 1081 *map, |
1082 *function_share, | 1082 *function_share, |
1083 *the_hole_value()), | 1083 *the_hole_value()), |
1084 JSFunction); | 1084 JSFunction); |
1085 } | 1085 } |
1086 | 1086 |
1087 | 1087 |
1088 Handle<JSFunction> Factory::NewFunctionWithoutPrototype( | 1088 Handle<JSFunction> Factory::NewFunctionWithoutPrototype( |
1089 Handle<String> name, | 1089 Handle<String> name, |
1090 StrictModeFlag strict_mode) { | 1090 LanguageMode language_mode) { |
1091 Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name, strict_mode); | 1091 Handle<JSFunction> fun = |
| 1092 NewFunctionWithoutPrototypeHelper(name, language_mode); |
1092 fun->set_context(isolate()->context()->global_context()); | 1093 fun->set_context(isolate()->context()->global_context()); |
1093 return fun; | 1094 return fun; |
1094 } | 1095 } |
1095 | 1096 |
1096 | 1097 |
1097 Handle<Object> Factory::ToObject(Handle<Object> object) { | 1098 Handle<Object> Factory::ToObject(Handle<Object> object) { |
1098 CALL_HEAP_FUNCTION(isolate(), object->ToObject(), Object); | 1099 CALL_HEAP_FUNCTION(isolate(), object->ToObject(), Object); |
1099 } | 1100 } |
1100 | 1101 |
1101 | 1102 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 | 1359 |
1359 | 1360 |
1360 Handle<Object> Factory::ToBoolean(bool value) { | 1361 Handle<Object> Factory::ToBoolean(bool value) { |
1361 return Handle<Object>(value | 1362 return Handle<Object>(value |
1362 ? isolate()->heap()->true_value() | 1363 ? isolate()->heap()->true_value() |
1363 : isolate()->heap()->false_value()); | 1364 : isolate()->heap()->false_value()); |
1364 } | 1365 } |
1365 | 1366 |
1366 | 1367 |
1367 } } // namespace v8::internal | 1368 } } // namespace v8::internal |
OLD | NEW |