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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 Factory::NewJSObject(Top::object_function(), TENURED), | 1076 Factory::NewJSObject(Top::object_function(), TENURED), |
1077 Builtins::FunctionApply, | 1077 Builtins::FunctionApply, |
1078 false); | 1078 false); |
1079 | 1079 |
1080 // Make sure that Function.prototype.call appears to be compiled. | 1080 // Make sure that Function.prototype.call appears to be compiled. |
1081 // The code will never be called, but inline caching for call will | 1081 // The code will never be called, but inline caching for call will |
1082 // only work if it appears to be compiled. | 1082 // only work if it appears to be compiled. |
1083 call->shared()->DontAdaptArguments(); | 1083 call->shared()->DontAdaptArguments(); |
1084 ASSERT(call->is_compiled()); | 1084 ASSERT(call->is_compiled()); |
1085 | 1085 |
1086 // Set the expected paramters for apply to 2; required by builtin. | 1086 // Set the expected parameters for apply to 2; required by builtin. |
1087 apply->shared()->set_formal_parameter_count(2); | 1087 apply->shared()->set_formal_parameter_count(2); |
1088 | 1088 |
1089 // Set the lengths for the functions to satisfy ECMA-262. | 1089 // Set the lengths for the functions to satisfy ECMA-262. |
1090 call->shared()->set_length(1); | 1090 call->shared()->set_length(1); |
1091 apply->shared()->set_length(2); | 1091 apply->shared()->set_length(2); |
1092 } | 1092 } |
1093 | 1093 |
1094 // Make sure that the builtins object has fast properties. | 1094 // Make sure that the builtins object has fast properties. |
1095 // If the ASSERT below fails, please increase the expected number of | 1095 // If the ASSERT below fails, please increase the expected number of |
1096 // properties for the builtins object. | 1096 // properties for the builtins object. |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 Handle<Code>(Builtins::builtin(Builtins::ArrayPop))); | 1430 Handle<Code>(Builtins::builtin(Builtins::ArrayPop))); |
1431 AddSpecialFunction(prototype, "push", | 1431 AddSpecialFunction(prototype, "push", |
1432 Handle<Code>(Builtins::builtin(Builtins::ArrayPush))); | 1432 Handle<Code>(Builtins::builtin(Builtins::ArrayPush))); |
1433 } | 1433 } |
1434 | 1434 |
1435 | 1435 |
1436 Genesis::Genesis(Handle<Object> global_object, | 1436 Genesis::Genesis(Handle<Object> global_object, |
1437 v8::Handle<v8::ObjectTemplate> global_template, | 1437 v8::Handle<v8::ObjectTemplate> global_template, |
1438 v8::ExtensionConfiguration* extensions) { | 1438 v8::ExtensionConfiguration* extensions) { |
1439 // Link this genesis object into the stacked genesis chain. This | 1439 // Link this genesis object into the stacked genesis chain. This |
1440 // must be done before any early exits because the deconstructor | 1440 // must be done before any early exits because the destructor |
1441 // will always do unlinking. | 1441 // will always do unlinking. |
1442 previous_ = current_; | 1442 previous_ = current_; |
1443 current_ = this; | 1443 current_ = this; |
1444 result_ = NULL; | 1444 result_ = NULL; |
1445 | 1445 |
1446 // If V8 hasn't been and cannot be initialized, just return. | 1446 // If V8 hasn't been and cannot be initialized, just return. |
1447 if (!V8::HasBeenSetup() && !V8::Initialize(NULL)) return; | 1447 if (!V8::HasBeenSetup() && !V8::Initialize(NULL)) return; |
1448 | 1448 |
1449 // Before creating the roots we must save the context and restore it | 1449 // Before creating the roots we must save the context and restore it |
1450 // on all function exits. | 1450 // on all function exits. |
1451 HandleScope scope; | 1451 HandleScope scope; |
1452 SaveContext context; | 1452 SaveContext context; |
1453 | 1453 |
1454 CreateRoots(global_template, global_object); | 1454 CreateRoots(global_template, global_object); |
1455 if (!InstallNatives()) return; | 1455 if (!InstallNatives()) return; |
1456 | 1456 |
1457 MakeFunctionInstancePrototypeWritable(); | 1457 MakeFunctionInstancePrototypeWritable(); |
1458 BuildSpecialFunctionTable(); | 1458 BuildSpecialFunctionTable(); |
1459 | 1459 |
1460 if (!ConfigureGlobalObjects(global_template)) return; | 1460 if (!ConfigureGlobalObjects(global_template)) return; |
1461 | 1461 |
1462 if (!InstallExtensions(extensions)) return; | 1462 if (!InstallExtensions(extensions)) return; |
1463 | 1463 |
1464 if (!InstallSpecialObjects()) return; | 1464 if (!InstallSpecialObjects()) return; |
1465 | 1465 |
1466 result_ = global_context_; | 1466 result_ = global_context_; |
1467 } | 1467 } |
1468 | 1468 |
1469 } } // namespace v8::internal | 1469 } } // namespace v8::internal |
OLD | NEW |