| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 Handle<String> symbol = factory->LookupAsciiSymbol(name); | 343 Handle<String> symbol = factory->LookupAsciiSymbol(name); |
| 344 Handle<Code> call_code = Handle<Code>(isolate->builtins()->builtin(call)); | 344 Handle<Code> call_code = Handle<Code>(isolate->builtins()->builtin(call)); |
| 345 Handle<JSFunction> function = prototype.is_null() ? | 345 Handle<JSFunction> function = prototype.is_null() ? |
| 346 factory->NewFunctionWithoutPrototype(symbol, call_code) : | 346 factory->NewFunctionWithoutPrototype(symbol, call_code) : |
| 347 factory->NewFunctionWithPrototype(symbol, | 347 factory->NewFunctionWithPrototype(symbol, |
| 348 type, | 348 type, |
| 349 instance_size, | 349 instance_size, |
| 350 prototype, | 350 prototype, |
| 351 call_code, | 351 call_code, |
| 352 is_ecma_native); | 352 is_ecma_native); |
| 353 SetLocalPropertyNoThrow(target, symbol, function, DONT_ENUM); | 353 PropertyAttributes attributes; |
| 354 if (target->IsJSBuiltinsObject()) { |
| 355 attributes = |
| 356 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 357 } else { |
| 358 attributes = DONT_ENUM; |
| 359 } |
| 360 SetLocalPropertyNoThrow(target, symbol, function, attributes); |
| 354 if (is_ecma_native) { | 361 if (is_ecma_native) { |
| 355 function->shared()->set_instance_class_name(*symbol); | 362 function->shared()->set_instance_class_name(*symbol); |
| 356 } | 363 } |
| 357 return function; | 364 return function; |
| 358 } | 365 } |
| 359 | 366 |
| 360 | 367 |
| 361 Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor( | 368 Handle<DescriptorArray> Genesis::ComputeFunctionInstanceDescriptor( |
| 362 PrototypePropertyMode prototypeMode) { | 369 PrototypePropertyMode prototypeMode) { |
| 363 Handle<DescriptorArray> descriptors = | 370 Handle<DescriptorArray> descriptors = |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 code, | 1160 code, |
| 1154 true); | 1161 true); |
| 1155 | 1162 |
| 1156 Handle<String> name = factory->LookupAsciiSymbol("context_extension"); | 1163 Handle<String> name = factory->LookupAsciiSymbol("context_extension"); |
| 1157 context_extension_fun->shared()->set_instance_class_name(*name); | 1164 context_extension_fun->shared()->set_instance_class_name(*name); |
| 1158 global_context()->set_context_extension_function(*context_extension_fun); | 1165 global_context()->set_context_extension_function(*context_extension_fun); |
| 1159 } | 1166 } |
| 1160 | 1167 |
| 1161 | 1168 |
| 1162 { | 1169 { |
| 1163 // Setup the call-as-function delegate. | 1170 // Set up the call-as-function delegate. |
| 1164 Handle<Code> code = | 1171 Handle<Code> code = |
| 1165 Handle<Code>(isolate->builtins()->builtin( | 1172 Handle<Code>(isolate->builtins()->builtin( |
| 1166 Builtins::kHandleApiCallAsFunction)); | 1173 Builtins::kHandleApiCallAsFunction)); |
| 1167 Handle<JSFunction> delegate = | 1174 Handle<JSFunction> delegate = |
| 1168 factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE, | 1175 factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE, |
| 1169 JSObject::kHeaderSize, code, true); | 1176 JSObject::kHeaderSize, code, true); |
| 1170 global_context()->set_call_as_function_delegate(*delegate); | 1177 global_context()->set_call_as_function_delegate(*delegate); |
| 1171 delegate->shared()->DontAdaptArguments(); | 1178 delegate->shared()->DontAdaptArguments(); |
| 1172 } | 1179 } |
| 1173 | 1180 |
| 1174 { | 1181 { |
| 1175 // Setup the call-as-constructor delegate. | 1182 // Set up the call-as-constructor delegate. |
| 1176 Handle<Code> code = | 1183 Handle<Code> code = |
| 1177 Handle<Code>(isolate->builtins()->builtin( | 1184 Handle<Code>(isolate->builtins()->builtin( |
| 1178 Builtins::kHandleApiCallAsConstructor)); | 1185 Builtins::kHandleApiCallAsConstructor)); |
| 1179 Handle<JSFunction> delegate = | 1186 Handle<JSFunction> delegate = |
| 1180 factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE, | 1187 factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE, |
| 1181 JSObject::kHeaderSize, code, true); | 1188 JSObject::kHeaderSize, code, true); |
| 1182 global_context()->set_call_as_constructor_delegate(*delegate); | 1189 global_context()->set_call_as_constructor_delegate(*delegate); |
| 1183 delegate->shared()->DontAdaptArguments(); | 1190 delegate->shared()->DontAdaptArguments(); |
| 1184 } | 1191 } |
| 1185 | 1192 |
| 1186 // Initialize the out of memory slot. | 1193 // Initialize the out of memory slot. |
| 1187 global_context()->set_out_of_memory(heap->false_value()); | 1194 global_context()->set_out_of_memory(heap->false_value()); |
| 1188 | 1195 |
| 1189 // Initialize the data slot. | 1196 // Initialize the data slot. |
| 1190 global_context()->set_data(heap->undefined_value()); | 1197 global_context()->set_data(heap->undefined_value()); |
| 1191 } | 1198 } |
| 1192 | 1199 |
| 1193 | 1200 |
| 1194 void Genesis::InitializeExperimentalGlobal() { | 1201 void Genesis::InitializeExperimentalGlobal() { |
| 1195 Isolate* isolate = this->isolate(); | |
| 1196 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); | 1202 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); |
| 1197 | 1203 |
| 1198 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no | 1204 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no |
| 1199 // longer need to live behind a flag, so WeakMap gets added to the snapshot. | 1205 // longer need to live behind a flag, so WeakMap gets added to the snapshot. |
| 1200 if (FLAG_harmony_weakmaps) { // -- W e a k M a p | 1206 if (FLAG_harmony_weakmaps) { // -- W e a k M a p |
| 1207 Handle<JSObject> prototype = |
| 1208 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| 1201 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, | 1209 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, |
| 1202 isolate->initial_object_prototype(), | 1210 prototype, Builtins::kIllegal, true); |
| 1203 Builtins::kIllegal, true); | |
| 1204 } | 1211 } |
| 1205 } | 1212 } |
| 1206 | 1213 |
| 1207 | 1214 |
| 1208 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1215 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
| 1209 Vector<const char> name = Natives::GetScriptName(index); | 1216 Vector<const char> name = Natives::GetScriptName(index); |
| 1210 Handle<String> source_code = | 1217 Handle<String> source_code = |
| 1211 isolate->bootstrapper()->NativesSourceLookup(index); | 1218 isolate->bootstrapper()->NativesSourceLookup(index); |
| 1212 return CompileNative(name, source_code); | 1219 return CompileNative(name, source_code); |
| 1213 } | 1220 } |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 reresult_descriptors->Sort(); | 1677 reresult_descriptors->Sort(); |
| 1671 | 1678 |
| 1672 initial_map->set_inobject_properties(2); | 1679 initial_map->set_inobject_properties(2); |
| 1673 initial_map->set_pre_allocated_property_fields(2); | 1680 initial_map->set_pre_allocated_property_fields(2); |
| 1674 initial_map->set_unused_property_fields(0); | 1681 initial_map->set_unused_property_fields(0); |
| 1675 initial_map->set_instance_descriptors(*reresult_descriptors); | 1682 initial_map->set_instance_descriptors(*reresult_descriptors); |
| 1676 | 1683 |
| 1677 global_context()->set_regexp_result_map(*initial_map); | 1684 global_context()->set_regexp_result_map(*initial_map); |
| 1678 } | 1685 } |
| 1679 | 1686 |
| 1680 | |
| 1681 #ifdef DEBUG | 1687 #ifdef DEBUG |
| 1682 builtins->Verify(); | 1688 builtins->Verify(); |
| 1683 #endif | 1689 #endif |
| 1684 | 1690 |
| 1685 return true; | 1691 return true; |
| 1686 } | 1692 } |
| 1687 | 1693 |
| 1688 | 1694 |
| 1689 bool Genesis::InstallExperimentalNatives() { | 1695 bool Genesis::InstallExperimentalNatives() { |
| 1690 for (int i = ExperimentalNatives::GetDebuggerCount(); | 1696 for (int i = ExperimentalNatives::GetDebuggerCount(); |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2219 return from + sizeof(NestingCounterType); | 2225 return from + sizeof(NestingCounterType); |
| 2220 } | 2226 } |
| 2221 | 2227 |
| 2222 | 2228 |
| 2223 // Called when the top-level V8 mutex is destroyed. | 2229 // Called when the top-level V8 mutex is destroyed. |
| 2224 void Bootstrapper::FreeThreadResources() { | 2230 void Bootstrapper::FreeThreadResources() { |
| 2225 ASSERT(!IsActive()); | 2231 ASSERT(!IsActive()); |
| 2226 } | 2232 } |
| 2227 | 2233 |
| 2228 } } // namespace v8::internal | 2234 } } // namespace v8::internal |
| OLD | NEW |