| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 *function_info, | 919 *function_info, |
| 920 isolate()->heap()->the_hole_value(), | 920 isolate()->heap()->the_hole_value(), |
| 921 pretenure), | 921 pretenure), |
| 922 JSFunction); | 922 JSFunction); |
| 923 } | 923 } |
| 924 | 924 |
| 925 | 925 |
| 926 static Handle<Map> MapForNewFunction(Isolate *isolate, | 926 static Handle<Map> MapForNewFunction(Isolate *isolate, |
| 927 Handle<SharedFunctionInfo> function_info) { | 927 Handle<SharedFunctionInfo> function_info) { |
| 928 Context *context = isolate->context()->native_context(); | 928 Context *context = isolate->context()->native_context(); |
| 929 int map_index = Context::FunctionMapIndex(function_info->language_mode(), | 929 int map_index = Context::FunctionMapIndex(function_info->strict_mode(), |
| 930 function_info->is_generator()); | 930 function_info->is_generator()); |
| 931 return Handle<Map>(Map::cast(context->get(map_index))); | 931 return Handle<Map>(Map::cast(context->get(map_index))); |
| 932 } | 932 } |
| 933 | 933 |
| 934 | 934 |
| 935 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( | 935 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
| 936 Handle<SharedFunctionInfo> function_info, | 936 Handle<SharedFunctionInfo> function_info, |
| 937 Handle<Context> context, | 937 Handle<Context> context, |
| 938 PretenureFlag pretenure) { | 938 PretenureFlag pretenure) { |
| 939 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( | 939 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 initial_map->set_constructor(*function); | 1240 initial_map->set_constructor(*function); |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 JSFunction::SetPrototype(function, prototype); | 1243 JSFunction::SetPrototype(function, prototype); |
| 1244 return function; | 1244 return function; |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 | 1247 |
| 1248 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, | 1248 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, |
| 1249 Handle<Code> code) { | 1249 Handle<Code> code) { |
| 1250 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, | 1250 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); |
| 1251 SLOPPY_MODE); | |
| 1252 function->shared()->set_code(*code); | 1251 function->shared()->set_code(*code); |
| 1253 function->set_code(*code); | 1252 function->set_code(*code); |
| 1254 ASSERT(!function->has_initial_map()); | 1253 ASSERT(!function->has_initial_map()); |
| 1255 ASSERT(!function->has_prototype()); | 1254 ASSERT(!function->has_prototype()); |
| 1256 return function; | 1255 return function; |
| 1257 } | 1256 } |
| 1258 | 1257 |
| 1259 | 1258 |
| 1260 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { | 1259 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { |
| 1261 CALL_HEAP_FUNCTION( | 1260 CALL_HEAP_FUNCTION( |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 dictionary->AtNumberPut(key, *value), | 1614 dictionary->AtNumberPut(key, *value), |
| 1616 UnseededNumberDictionary); | 1615 UnseededNumberDictionary); |
| 1617 } | 1616 } |
| 1618 | 1617 |
| 1619 | 1618 |
| 1620 Handle<JSFunction> Factory::NewFunctionHelper(Handle<String> name, | 1619 Handle<JSFunction> Factory::NewFunctionHelper(Handle<String> name, |
| 1621 Handle<Object> prototype) { | 1620 Handle<Object> prototype) { |
| 1622 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); | 1621 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); |
| 1623 CALL_HEAP_FUNCTION( | 1622 CALL_HEAP_FUNCTION( |
| 1624 isolate(), | 1623 isolate(), |
| 1625 isolate()->heap()->AllocateFunction(*isolate()->function_map(), | 1624 isolate()->heap()->AllocateFunction(*isolate()->sloppy_function_map(), |
| 1626 *function_share, | 1625 *function_share, |
| 1627 *prototype), | 1626 *prototype), |
| 1628 JSFunction); | 1627 JSFunction); |
| 1629 } | 1628 } |
| 1630 | 1629 |
| 1631 | 1630 |
| 1632 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 1631 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
| 1633 Handle<Object> prototype) { | 1632 Handle<Object> prototype) { |
| 1634 Handle<JSFunction> fun = NewFunctionHelper(name, prototype); | 1633 Handle<JSFunction> fun = NewFunctionHelper(name, prototype); |
| 1635 fun->set_context(isolate()->context()->native_context()); | 1634 fun->set_context(isolate()->context()->native_context()); |
| 1636 return fun; | 1635 return fun; |
| 1637 } | 1636 } |
| 1638 | 1637 |
| 1639 | 1638 |
| 1640 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper( | 1639 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper( |
| 1641 Handle<String> name, | 1640 Handle<String> name, |
| 1642 LanguageMode language_mode) { | 1641 StrictMode strict_mode) { |
| 1643 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); | 1642 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); |
| 1644 Handle<Map> map = (language_mode == SLOPPY_MODE) | 1643 Handle<Map> map = strict_mode == SLOPPY |
| 1645 ? isolate()->function_without_prototype_map() | 1644 ? isolate()->sloppy_function_without_prototype_map() |
| 1646 : isolate()->strict_mode_function_without_prototype_map(); | 1645 : isolate()->strict_function_without_prototype_map(); |
| 1647 CALL_HEAP_FUNCTION(isolate(), | 1646 CALL_HEAP_FUNCTION(isolate(), |
| 1648 isolate()->heap()->AllocateFunction( | 1647 isolate()->heap()->AllocateFunction( |
| 1649 *map, | 1648 *map, |
| 1650 *function_share, | 1649 *function_share, |
| 1651 *the_hole_value()), | 1650 *the_hole_value()), |
| 1652 JSFunction); | 1651 JSFunction); |
| 1653 } | 1652 } |
| 1654 | 1653 |
| 1655 | 1654 |
| 1656 Handle<JSFunction> Factory::NewFunctionWithoutPrototype( | 1655 Handle<JSFunction> Factory::NewFunctionWithoutPrototype( |
| 1657 Handle<String> name, | 1656 Handle<String> name, |
| 1658 LanguageMode language_mode) { | 1657 StrictMode strict_mode) { |
| 1659 Handle<JSFunction> fun = | 1658 Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name, strict_mode); |
| 1660 NewFunctionWithoutPrototypeHelper(name, language_mode); | |
| 1661 fun->set_context(isolate()->context()->native_context()); | 1659 fun->set_context(isolate()->context()->native_context()); |
| 1662 return fun; | 1660 return fun; |
| 1663 } | 1661 } |
| 1664 | 1662 |
| 1665 | 1663 |
| 1666 Handle<Object> Factory::ToObject(Handle<Object> object) { | 1664 Handle<Object> Factory::ToObject(Handle<Object> object) { |
| 1667 CALL_HEAP_FUNCTION(isolate(), object->ToObject(isolate()), Object); | 1665 CALL_HEAP_FUNCTION(isolate(), object->ToObject(isolate()), Object); |
| 1668 } | 1666 } |
| 1669 | 1667 |
| 1670 | 1668 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 return Handle<Object>::null(); | 1986 return Handle<Object>::null(); |
| 1989 } | 1987 } |
| 1990 | 1988 |
| 1991 | 1989 |
| 1992 Handle<Object> Factory::ToBoolean(bool value) { | 1990 Handle<Object> Factory::ToBoolean(bool value) { |
| 1993 return value ? true_value() : false_value(); | 1991 return value ? true_value() : false_value(); |
| 1994 } | 1992 } |
| 1995 | 1993 |
| 1996 | 1994 |
| 1997 } } // namespace v8::internal | 1995 } } // namespace v8::internal |
| OLD | NEW |