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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1580 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); | 1580 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); |
1581 native_context()->set_embedder_data(*embedder_data); | 1581 native_context()->set_embedder_data(*embedder_data); |
1582 | 1582 |
1583 if (context_type == THIN_CONTEXT) return; | 1583 if (context_type == THIN_CONTEXT) return; |
1584 | 1584 |
1585 { // -- J S O N | 1585 { // -- J S O N |
1586 Handle<String> name = factory->InternalizeUtf8String("JSON"); | 1586 Handle<String> name = factory->InternalizeUtf8String("JSON"); |
1587 Handle<JSFunction> cons = factory->NewFunction(name); | 1587 Handle<JSFunction> cons = factory->NewFunction(name); |
1588 JSFunction::SetInstancePrototype(cons, | 1588 JSFunction::SetInstancePrototype(cons, |
1589 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1589 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1590 cons->shared()->set_instance_class_name(*name); | |
adamk
2016/05/18 16:07:58
This in the below are just cleanup because JSON an
Toon Verwaest
2016/05/18 17:17:20
It actually affects Object.prototype.toString.call
adamk
2016/05/18 17:46:05
Let's move it out of this CL, leaving it as a pure
| |
1591 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); | 1590 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); |
1592 DCHECK(json_object->IsJSObject()); | 1591 DCHECK(json_object->IsJSObject()); |
1593 JSObject::AddProperty(global, name, json_object, DONT_ENUM); | 1592 JSObject::AddProperty(global, name, json_object, DONT_ENUM); |
1594 } | 1593 } |
1595 | 1594 |
1596 { // -- M a t h | 1595 { // -- M a t h |
1597 Handle<String> name = factory->InternalizeUtf8String("Math"); | 1596 Handle<String> name = factory->InternalizeUtf8String("Math"); |
1598 Handle<JSFunction> cons = factory->NewFunction(name); | 1597 Handle<JSFunction> cons = factory->NewFunction(name); |
1599 JSFunction::SetInstancePrototype( | 1598 JSFunction::SetInstancePrototype( |
1600 cons, | 1599 cons, |
1601 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1600 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1602 cons->shared()->set_instance_class_name(*name); | |
1603 Handle<JSObject> math = factory->NewJSObject(cons, TENURED); | 1601 Handle<JSObject> math = factory->NewJSObject(cons, TENURED); |
1604 DCHECK(math->IsJSObject()); | 1602 DCHECK(math->IsJSObject()); |
1605 JSObject::AddProperty(global, name, math, DONT_ENUM); | 1603 JSObject::AddProperty(global, name, math, DONT_ENUM); |
1606 SimpleInstallFunction(math, "acos", Builtins::kMathAcos, 1, true); | 1604 SimpleInstallFunction(math, "acos", Builtins::kMathAcos, 1, true); |
1607 SimpleInstallFunction(math, "asin", Builtins::kMathAsin, 1, true); | 1605 SimpleInstallFunction(math, "asin", Builtins::kMathAsin, 1, true); |
1608 SimpleInstallFunction(math, "atan", Builtins::kMathAtan, 1, true); | 1606 SimpleInstallFunction(math, "atan", Builtins::kMathAtan, 1, true); |
1609 SimpleInstallFunction(math, "ceil", Builtins::kMathCeil, 1, true); | 1607 SimpleInstallFunction(math, "ceil", Builtins::kMathCeil, 1, true); |
1610 SimpleInstallFunction(math, "clz32", Builtins::kMathClz32, 1, true); | 1608 SimpleInstallFunction(math, "clz32", Builtins::kMathClz32, 1, true); |
1611 Handle<JSFunction> math_floor = | 1609 Handle<JSFunction> math_floor = |
1612 SimpleInstallFunction(math, "floor", Builtins::kMathFloor, 1, true); | 1610 SimpleInstallFunction(math, "floor", Builtins::kMathFloor, 1, true); |
(...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3774 } | 3772 } |
3775 | 3773 |
3776 | 3774 |
3777 // Called when the top-level V8 mutex is destroyed. | 3775 // Called when the top-level V8 mutex is destroyed. |
3778 void Bootstrapper::FreeThreadResources() { | 3776 void Bootstrapper::FreeThreadResources() { |
3779 DCHECK(!IsActive()); | 3777 DCHECK(!IsActive()); |
3780 } | 3778 } |
3781 | 3779 |
3782 } // namespace internal | 3780 } // namespace internal |
3783 } // namespace v8 | 3781 } // namespace v8 |
OLD | NEW |