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/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 | 1568 |
1569 // Set the expected parameters for @@toPrimitive to 1; required by builtin. | 1569 // Set the expected parameters for @@toPrimitive to 1; required by builtin. |
1570 to_primitive->shared()->set_internal_formal_parameter_count(1); | 1570 to_primitive->shared()->set_internal_formal_parameter_count(1); |
1571 | 1571 |
1572 // Set the length for the function to satisfy ECMA-262. | 1572 // Set the length for the function to satisfy ECMA-262. |
1573 to_primitive->shared()->set_length(1); | 1573 to_primitive->shared()->set_length(1); |
1574 } | 1574 } |
1575 | 1575 |
1576 { // -- R e g E x p | 1576 { // -- R e g E x p |
1577 // Builtin functions for RegExp.prototype. | 1577 // Builtin functions for RegExp.prototype. |
1578 Handle<JSFunction> regexp_fun = | 1578 Handle<JSFunction> regexp_fun = InstallFunction( |
1579 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, | 1579 global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, |
1580 isolate->initial_object_prototype(), | 1580 isolate->initial_object_prototype(), Builtins::kRegExpConstructor); |
1581 Builtins::kIllegal); | |
1582 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, | 1581 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, |
1583 Context::REGEXP_FUNCTION_INDEX); | 1582 Context::REGEXP_FUNCTION_INDEX); |
1584 regexp_fun->shared()->SetConstructStub( | 1583 |
1585 *isolate->builtins()->JSBuiltinsConstructStub()); | 1584 Handle<SharedFunctionInfo> shared(regexp_fun->shared(), isolate); |
| 1585 shared->SetConstructStub(*isolate->builtins()->RegExpConstructor()); |
| 1586 shared->set_instance_class_name(isolate->heap()->RegExp_string()); |
| 1587 shared->DontAdaptArguments(); |
| 1588 shared->set_length(2); |
| 1589 |
| 1590 Handle<JSObject> proto = |
| 1591 factory->NewJSObject(isolate->object_function(), TENURED); |
| 1592 JSObject::AddProperty(proto, factory->constructor_string(), regexp_fun, |
| 1593 DONT_ENUM); |
| 1594 Accessors::FunctionSetPrototype(regexp_fun, proto).Assert(); |
1586 | 1595 |
1587 DCHECK(regexp_fun->has_initial_map()); | 1596 DCHECK(regexp_fun->has_initial_map()); |
1588 Handle<Map> initial_map(regexp_fun->initial_map()); | 1597 Handle<Map> initial_map(regexp_fun->initial_map()); |
1589 | 1598 |
1590 DCHECK_EQ(0, initial_map->GetInObjectProperties()); | 1599 DCHECK_EQ(0, initial_map->GetInObjectProperties()); |
1591 | 1600 |
1592 Map::EnsureDescriptorSlack(initial_map, 1); | 1601 Map::EnsureDescriptorSlack(initial_map, 1); |
1593 | 1602 |
1594 // ECMA-262, section 15.10.7.5. | 1603 // ECMA-262, section 15.10.7.5. |
1595 PropertyAttributes writable = | 1604 PropertyAttributes writable = |
(...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4093 } | 4102 } |
4094 | 4103 |
4095 | 4104 |
4096 // Called when the top-level V8 mutex is destroyed. | 4105 // Called when the top-level V8 mutex is destroyed. |
4097 void Bootstrapper::FreeThreadResources() { | 4106 void Bootstrapper::FreeThreadResources() { |
4098 DCHECK(!IsActive()); | 4107 DCHECK(!IsActive()); |
4099 } | 4108 } |
4100 | 4109 |
4101 } // namespace internal | 4110 } // namespace internal |
4102 } // namespace v8 | 4111 } // namespace v8 |
OLD | NEW |