OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 if (context_type == THIN_CONTEXT) return; | 1587 if (context_type == THIN_CONTEXT) return; |
1588 | 1588 |
1589 { // -- J S O N | 1589 { // -- J S O N |
1590 Handle<String> name = factory->InternalizeUtf8String("JSON"); | 1590 Handle<String> name = factory->InternalizeUtf8String("JSON"); |
1591 Handle<JSFunction> cons = factory->NewFunction(name); | 1591 Handle<JSFunction> cons = factory->NewFunction(name); |
1592 JSFunction::SetInstancePrototype(cons, | 1592 JSFunction::SetInstancePrototype(cons, |
1593 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1593 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1594 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); | 1594 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); |
1595 DCHECK(json_object->IsJSObject()); | 1595 DCHECK(json_object->IsJSObject()); |
1596 JSObject::AddProperty(global, name, json_object, DONT_ENUM); | 1596 JSObject::AddProperty(global, name, json_object, DONT_ENUM); |
| 1597 SimpleInstallFunction(json_object, "stringify", Builtins::kJsonStringify, 3, |
| 1598 true); |
1597 } | 1599 } |
1598 | 1600 |
1599 { // -- M a t h | 1601 { // -- M a t h |
1600 Handle<String> name = factory->InternalizeUtf8String("Math"); | 1602 Handle<String> name = factory->InternalizeUtf8String("Math"); |
1601 Handle<JSFunction> cons = factory->NewFunction(name); | 1603 Handle<JSFunction> cons = factory->NewFunction(name); |
1602 JSFunction::SetInstancePrototype( | 1604 JSFunction::SetInstancePrototype( |
1603 cons, | 1605 cons, |
1604 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1606 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1605 Handle<JSObject> math = factory->NewJSObject(cons, TENURED); | 1607 Handle<JSObject> math = factory->NewJSObject(cons, TENURED); |
1606 DCHECK(math->IsJSObject()); | 1608 DCHECK(math->IsJSObject()); |
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3776 } | 3778 } |
3777 | 3779 |
3778 | 3780 |
3779 // Called when the top-level V8 mutex is destroyed. | 3781 // Called when the top-level V8 mutex is destroyed. |
3780 void Bootstrapper::FreeThreadResources() { | 3782 void Bootstrapper::FreeThreadResources() { |
3781 DCHECK(!IsActive()); | 3783 DCHECK(!IsActive()); |
3782 } | 3784 } |
3783 | 3785 |
3784 } // namespace internal | 3786 } // namespace internal |
3785 } // namespace v8 | 3787 } // namespace v8 |
OLD | NEW |