| 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 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 | 1193 |
| 1194 void Genesis::InitializeExperimentalGlobal() { | 1194 void Genesis::InitializeExperimentalGlobal() { |
| 1195 Isolate* isolate = this->isolate(); | 1195 Isolate* isolate = this->isolate(); |
| 1196 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); | 1196 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); |
| 1197 | 1197 |
| 1198 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no | 1198 // 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. | 1199 // 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 | 1200 if (FLAG_harmony_weakmaps) { // -- W e a k M a p |
| 1201 Handle<JSFunction> weakmap_fun = | 1201 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, |
| 1202 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, | 1202 isolate->initial_object_prototype(), |
| 1203 isolate->initial_object_prototype(), | 1203 Builtins::kIllegal, true); |
| 1204 Builtins::kIllegal, true); | |
| 1205 } | 1204 } |
| 1206 } | 1205 } |
| 1207 | 1206 |
| 1208 | 1207 |
| 1209 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1208 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
| 1210 Vector<const char> name = Natives::GetScriptName(index); | 1209 Vector<const char> name = Natives::GetScriptName(index); |
| 1211 Handle<String> source_code = | 1210 Handle<String> source_code = |
| 1212 isolate->bootstrapper()->NativesSourceLookup(index); | 1211 isolate->bootstrapper()->NativesSourceLookup(index); |
| 1213 return CompileNative(name, source_code); | 1212 return CompileNative(name, source_code); |
| 1214 } | 1213 } |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 InstallNativeFunctions(); | 1579 InstallNativeFunctions(); |
| 1581 | 1580 |
| 1582 // Store the map for the string prototype after the natives has been compiled | 1581 // Store the map for the string prototype after the natives has been compiled |
| 1583 // and the String function has been setup. | 1582 // and the String function has been setup. |
| 1584 Handle<JSFunction> string_function(global_context()->string_function()); | 1583 Handle<JSFunction> string_function(global_context()->string_function()); |
| 1585 ASSERT(JSObject::cast( | 1584 ASSERT(JSObject::cast( |
| 1586 string_function->initial_map()->prototype())->HasFastProperties()); | 1585 string_function->initial_map()->prototype())->HasFastProperties()); |
| 1587 global_context()->set_string_function_prototype_map( | 1586 global_context()->set_string_function_prototype_map( |
| 1588 HeapObject::cast(string_function->initial_map()->prototype())->map()); | 1587 HeapObject::cast(string_function->initial_map()->prototype())->map()); |
| 1589 | 1588 |
| 1590 InstallBuiltinFunctionIds(); | |
| 1591 | |
| 1592 // Install Function.prototype.call and apply. | 1589 // Install Function.prototype.call and apply. |
| 1593 { Handle<String> key = factory()->function_class_symbol(); | 1590 { Handle<String> key = factory()->function_class_symbol(); |
| 1594 Handle<JSFunction> function = | 1591 Handle<JSFunction> function = |
| 1595 Handle<JSFunction>::cast(GetProperty(isolate()->global(), key)); | 1592 Handle<JSFunction>::cast(GetProperty(isolate()->global(), key)); |
| 1596 Handle<JSObject> proto = | 1593 Handle<JSObject> proto = |
| 1597 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 1594 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
| 1598 | 1595 |
| 1599 // Install the call and the apply functions. | 1596 // Install the call and the apply functions. |
| 1600 Handle<JSFunction> call = | 1597 Handle<JSFunction> call = |
| 1601 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1598 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1615 ASSERT(call->is_compiled()); | 1612 ASSERT(call->is_compiled()); |
| 1616 | 1613 |
| 1617 // Set the expected parameters for apply to 2; required by builtin. | 1614 // Set the expected parameters for apply to 2; required by builtin. |
| 1618 apply->shared()->set_formal_parameter_count(2); | 1615 apply->shared()->set_formal_parameter_count(2); |
| 1619 | 1616 |
| 1620 // Set the lengths for the functions to satisfy ECMA-262. | 1617 // Set the lengths for the functions to satisfy ECMA-262. |
| 1621 call->shared()->set_length(1); | 1618 call->shared()->set_length(1); |
| 1622 apply->shared()->set_length(2); | 1619 apply->shared()->set_length(2); |
| 1623 } | 1620 } |
| 1624 | 1621 |
| 1622 InstallBuiltinFunctionIds(); |
| 1623 |
| 1625 // Create a constructor for RegExp results (a variant of Array that | 1624 // Create a constructor for RegExp results (a variant of Array that |
| 1626 // predefines the two properties index and match). | 1625 // predefines the two properties index and match). |
| 1627 { | 1626 { |
| 1628 // RegExpResult initial map. | 1627 // RegExpResult initial map. |
| 1629 | 1628 |
| 1630 // Find global.Array.prototype to inherit from. | 1629 // Find global.Array.prototype to inherit from. |
| 1631 Handle<JSFunction> array_constructor(global_context()->array_function()); | 1630 Handle<JSFunction> array_constructor(global_context()->array_function()); |
| 1632 Handle<JSObject> array_prototype( | 1631 Handle<JSObject> array_prototype( |
| 1633 JSObject::cast(array_constructor->instance_prototype())); | 1632 JSObject::cast(array_constructor->instance_prototype())); |
| 1634 | 1633 |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 return from + sizeof(NestingCounterType); | 2219 return from + sizeof(NestingCounterType); |
| 2221 } | 2220 } |
| 2222 | 2221 |
| 2223 | 2222 |
| 2224 // Called when the top-level V8 mutex is destroyed. | 2223 // Called when the top-level V8 mutex is destroyed. |
| 2225 void Bootstrapper::FreeThreadResources() { | 2224 void Bootstrapper::FreeThreadResources() { |
| 2226 ASSERT(!IsActive()); | 2225 ASSERT(!IsActive()); |
| 2227 } | 2226 } |
| 2228 | 2227 |
| 2229 } } // namespace v8::internal | 2228 } } // namespace v8::internal |
| OLD | NEW |