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 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1596 if (context_type == THIN_CONTEXT) return; | 1596 if (context_type == THIN_CONTEXT) return; |
1597 | 1597 |
1598 { // -- J S O N | 1598 { // -- J S O N |
1599 Handle<String> name = factory->InternalizeUtf8String("JSON"); | 1599 Handle<String> name = factory->InternalizeUtf8String("JSON"); |
1600 Handle<JSFunction> cons = factory->NewFunction(name); | 1600 Handle<JSFunction> cons = factory->NewFunction(name); |
1601 JSFunction::SetInstancePrototype(cons, | 1601 JSFunction::SetInstancePrototype(cons, |
1602 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1602 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1603 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); | 1603 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); |
1604 DCHECK(json_object->IsJSObject()); | 1604 DCHECK(json_object->IsJSObject()); |
1605 JSObject::AddProperty(global, name, json_object, DONT_ENUM); | 1605 JSObject::AddProperty(global, name, json_object, DONT_ENUM); |
1606 SimpleInstallFunction(json_object, "parse", Builtins::kJsonParse, 2, true); | 1606 SimpleInstallFunction(json_object, "parse", Builtins::kJsonParse, 2, false); |
1607 SimpleInstallFunction(json_object, "stringify", Builtins::kJsonStringify, 3, | 1607 SimpleInstallFunction(json_object, "stringify", Builtins::kJsonStringify, 3, |
1608 true); | 1608 true); |
Yang
2016/06/03 18:22:00
do we need to change this for JSON.stringify too?
| |
1609 JSObject::AddProperty( | 1609 JSObject::AddProperty( |
1610 json_object, factory->to_string_tag_symbol(), | 1610 json_object, factory->to_string_tag_symbol(), |
1611 factory->NewStringFromAsciiChecked("JSON"), | 1611 factory->NewStringFromAsciiChecked("JSON"), |
1612 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 1612 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
1613 } | 1613 } |
1614 | 1614 |
1615 { // -- M a t h | 1615 { // -- M a t h |
1616 Handle<String> name = factory->InternalizeUtf8String("Math"); | 1616 Handle<String> name = factory->InternalizeUtf8String("Math"); |
1617 Handle<JSFunction> cons = factory->NewFunction(name); | 1617 Handle<JSFunction> cons = factory->NewFunction(name); |
1618 JSFunction::SetInstancePrototype( | 1618 JSFunction::SetInstancePrototype( |
(...skipping 2194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3813 } | 3813 } |
3814 | 3814 |
3815 | 3815 |
3816 // Called when the top-level V8 mutex is destroyed. | 3816 // Called when the top-level V8 mutex is destroyed. |
3817 void Bootstrapper::FreeThreadResources() { | 3817 void Bootstrapper::FreeThreadResources() { |
3818 DCHECK(!IsActive()); | 3818 DCHECK(!IsActive()); |
3819 } | 3819 } |
3820 | 3820 |
3821 } // namespace internal | 3821 } // namespace internal |
3822 } // namespace v8 | 3822 } // namespace v8 |
OLD | NEW |