OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 if (!result) return false; | 954 if (!result) return false; |
955 | 955 |
956 } else { | 956 } else { |
957 // Empty natives file name - do not install any natives. | 957 // Empty natives file name - do not install any natives. |
958 PrintF("Warning: Running without installed natives!\n"); | 958 PrintF("Warning: Running without installed natives!\n"); |
959 return true; | 959 return true; |
960 } | 960 } |
961 | 961 |
962 InstallNativeFunctions(); | 962 InstallNativeFunctions(); |
963 | 963 |
964 #ifndef USE_OLD_CALLING_CONVENTIONS | |
965 // TODO(1240778): Get rid of the JS implementation of | 964 // TODO(1240778): Get rid of the JS implementation of |
966 // Function.prototype.call and simply create a function with the | 965 // Function.prototype.call and simply create a function with the |
967 // faked formal parameter count (-1) and use the illegal builtin as | 966 // faked formal parameter count (-1) and use the illegal builtin as |
968 // the code for it. | 967 // the code for it. |
969 | 968 |
970 // Find Function.prototype.call and set it's number of formal | 969 // Find Function.prototype.call and set it's number of formal |
971 // parameters to -1 to let the arguments adaptor handle it | 970 // parameters to -1 to let the arguments adaptor handle it |
972 // specially. | 971 // specially. |
973 { Handle<JSFunction> function = | 972 { Handle<JSFunction> function = |
974 Handle<JSFunction>::cast(GetProperty(Top::global(), | 973 Handle<JSFunction>::cast(GetProperty(Top::global(), |
975 Factory::function_class_symbol())); | 974 Factory::function_class_symbol())); |
976 Handle<JSObject> proto = | 975 Handle<JSObject> proto = |
977 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 976 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
978 Handle<JSFunction> call = | 977 Handle<JSFunction> call = |
979 Handle<JSFunction>::cast(GetProperty(proto, Factory::call_symbol())); | 978 Handle<JSFunction>::cast(GetProperty(proto, Factory::call_symbol())); |
980 call->shared()->set_formal_parameter_count(-1); | 979 call->shared()->set_formal_parameter_count(-1); |
981 | 980 |
982 // Make sure that Function.prototype.call appears to be compiled. | 981 // Make sure that Function.prototype.call appears to be compiled. |
983 // The code will never be called, but inline caching for call will | 982 // The code will never be called, but inline caching for call will |
984 // only work if it appears to be compiled. | 983 // only work if it appears to be compiled. |
985 call->shared()->set_code(Builtins::builtin(Builtins::Illegal)); | 984 call->shared()->set_code(Builtins::builtin(Builtins::Illegal)); |
986 ASSERT(call->is_compiled()); | 985 ASSERT(call->is_compiled()); |
987 | 986 |
988 // Use the specialized builtin for Function.prototype.apply. | 987 // Use the specialized builtin for Function.prototype.apply. |
989 Handle<JSFunction> apply = | 988 Handle<JSFunction> apply = |
990 Handle<JSFunction>::cast(GetProperty(proto, Factory::apply_symbol())); | 989 Handle<JSFunction>::cast(GetProperty(proto, Factory::apply_symbol())); |
991 apply->shared()->set_code(Builtins::builtin(Builtins::FunctionApply)); | 990 apply->shared()->set_code(Builtins::builtin(Builtins::FunctionApply)); |
992 } | 991 } |
993 #endif | |
994 | 992 |
995 // Make sure that the builtins object has fast properties. | 993 // Make sure that the builtins object has fast properties. |
996 // If the ASSERT below fails, please increase the expected number of | 994 // If the ASSERT below fails, please increase the expected number of |
997 // properties for the builtins object. | 995 // properties for the builtins object. |
998 ASSERT(builtins->HasFastProperties()); | 996 ASSERT(builtins->HasFastProperties()); |
999 #ifdef DEBUG | 997 #ifdef DEBUG |
1000 builtins->Verify(); | 998 builtins->Verify(); |
1001 #endif | 999 #endif |
1002 return true; | 1000 return true; |
1003 } | 1001 } |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 if (!ConfigureGlobalObject(global_template)) return; | 1336 if (!ConfigureGlobalObject(global_template)) return; |
1339 | 1337 |
1340 if (!InstallExtensions(extensions)) return; | 1338 if (!InstallExtensions(extensions)) return; |
1341 | 1339 |
1342 if (!InstallSpecialObjects()) return; | 1340 if (!InstallSpecialObjects()) return; |
1343 | 1341 |
1344 result_ = global_context_; | 1342 result_ = global_context_; |
1345 } | 1343 } |
1346 | 1344 |
1347 } } // namespace v8::internal | 1345 } } // namespace v8::internal |
OLD | NEW |