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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 common_attributes); | 1043 common_attributes); |
1044 | 1044 |
1045 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); | 1045 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); |
1046 script_map->set_instance_descriptors(*script_descriptors); | 1046 script_map->set_instance_descriptors(*script_descriptors); |
1047 | 1047 |
1048 // Allocate the empty script. | 1048 // Allocate the empty script. |
1049 Handle<Script> script = Factory::NewScript(Factory::empty_string()); | 1049 Handle<Script> script = Factory::NewScript(Factory::empty_string()); |
1050 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 1050 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); |
1051 global_context()->set_empty_script(*script); | 1051 global_context()->set_empty_script(*script); |
1052 } | 1052 } |
| 1053 { |
| 1054 // Builtin function for OpaqueReference -- a JSValue-based object, |
| 1055 // that keeps its field isolated from JavaScript code. It may store |
| 1056 // objects, that JavaScript code may not access. |
| 1057 Handle<JSFunction> opaque_reference_fun = |
| 1058 InstallFunction(builtins, "OpaqueReference", JS_VALUE_TYPE, |
| 1059 JSValue::kSize, Top::initial_object_prototype(), |
| 1060 Builtins::Illegal, false); |
| 1061 Handle<JSObject> prototype = |
| 1062 Factory::NewJSObject(Top::object_function(), TENURED); |
| 1063 SetPrototype(opaque_reference_fun, prototype); |
| 1064 global_context()->set_opaque_reference_function(*opaque_reference_fun); |
| 1065 } |
1053 | 1066 |
1054 if (FLAG_natives_file == NULL) { | 1067 if (FLAG_natives_file == NULL) { |
1055 // Without natives file, install default natives. | 1068 // Without natives file, install default natives. |
1056 for (int i = Natives::GetDelayCount(); | 1069 for (int i = Natives::GetDelayCount(); |
1057 i < Natives::GetBuiltinsCount(); | 1070 i < Natives::GetBuiltinsCount(); |
1058 i++) { | 1071 i++) { |
1059 if (!CompileBuiltin(i)) return false; | 1072 if (!CompileBuiltin(i)) return false; |
1060 // TODO(ager): We really only need to install the JS builtin | 1073 // TODO(ager): We really only need to install the JS builtin |
1061 // functions on the builtins object after compiling and running | 1074 // functions on the builtins object after compiling and running |
1062 // runtime.js. | 1075 // runtime.js. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 } | 1591 } |
1579 | 1592 |
1580 | 1593 |
1581 // Restore statics that are thread local. | 1594 // Restore statics that are thread local. |
1582 char* Genesis::RestoreState(char* from) { | 1595 char* Genesis::RestoreState(char* from) { |
1583 current_ = *reinterpret_cast<Genesis**>(from); | 1596 current_ = *reinterpret_cast<Genesis**>(from); |
1584 return from + sizeof(current_); | 1597 return from + sizeof(current_); |
1585 } | 1598 } |
1586 | 1599 |
1587 } } // namespace v8::internal | 1600 } } // namespace v8::internal |
OLD | NEW |