Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: src/bootstrapper.cc

Issue 2375953002: [regexp] Port RegExp.prototype.exec to TurboFan (Closed)
Patch Set: Address comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 1628
1629 // Set the expected parameters for @@toPrimitive to 1; required by builtin. 1629 // Set the expected parameters for @@toPrimitive to 1; required by builtin.
1630 to_primitive->shared()->set_internal_formal_parameter_count(1); 1630 to_primitive->shared()->set_internal_formal_parameter_count(1);
1631 1631
1632 // Set the length for the function to satisfy ECMA-262. 1632 // Set the length for the function to satisfy ECMA-262.
1633 to_primitive->shared()->set_length(1); 1633 to_primitive->shared()->set_length(1);
1634 } 1634 }
1635 1635
1636 { // -- R e g E x p 1636 { // -- R e g E x p
1637 // Builtin functions for RegExp.prototype. 1637 // Builtin functions for RegExp.prototype.
1638 Handle<JSFunction> regexp_fun = InstallFunction( 1638 Handle<JSObject> prototype =
1639 global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, 1639 factory->NewJSObject(isolate->object_function(), TENURED);
1640 isolate->initial_object_prototype(), Builtins::kIllegal); 1640 Handle<JSFunction> regexp_fun =
1641 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
1642 prototype, Builtins::kIllegal);
1641 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, 1643 InstallWithIntrinsicDefaultProto(isolate, regexp_fun,
1642 Context::REGEXP_FUNCTION_INDEX); 1644 Context::REGEXP_FUNCTION_INDEX);
1643 regexp_fun->shared()->SetConstructStub( 1645 regexp_fun->shared()->SetConstructStub(
1644 *isolate->builtins()->JSBuiltinsConstructStub()); 1646 *isolate->builtins()->JSBuiltinsConstructStub());
1645 1647
1646 DCHECK(regexp_fun->has_initial_map()); 1648 DCHECK(regexp_fun->has_initial_map());
1647 Handle<Map> initial_map(regexp_fun->initial_map()); 1649 Handle<Map> initial_map(regexp_fun->initial_map());
1648 1650
1649 DCHECK_EQ(0, initial_map->GetInObjectProperties()); 1651 DCHECK_EQ(0, initial_map->GetInObjectProperties());
1650 1652
1651 Map::EnsureDescriptorSlack(initial_map, 1); 1653 Map::EnsureDescriptorSlack(initial_map, 1);
1652 1654
1653 // ECMA-262, section 15.10.7.5. 1655 // ECMA-262, section 15.10.7.5.
1654 PropertyAttributes writable = 1656 PropertyAttributes writable =
1655 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 1657 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
1656 DataDescriptor field(factory->last_index_string(), 1658 DataDescriptor field(factory->last_index_string(),
1657 JSRegExp::kLastIndexFieldIndex, writable, 1659 JSRegExp::kLastIndexFieldIndex, writable,
1658 Representation::Tagged()); 1660 Representation::Tagged());
1659 initial_map->AppendDescriptor(&field); 1661 initial_map->AppendDescriptor(&field);
1660 1662
1661 static const int num_fields = JSRegExp::kInObjectFieldCount; 1663 static const int num_fields = JSRegExp::kInObjectFieldCount;
1662 initial_map->SetInObjectProperties(num_fields); 1664 initial_map->SetInObjectProperties(num_fields);
1663 initial_map->set_unused_property_fields(0); 1665 initial_map->set_unused_property_fields(0);
1664 initial_map->set_instance_size(initial_map->instance_size() + 1666 initial_map->set_instance_size(initial_map->instance_size() +
1665 num_fields * kPointerSize); 1667 num_fields * kPointerSize);
1668
1669 {
Igor Sheludko 2016/09/29 15:01:34 Please remove this pair of braces.
jgruber 2016/09/30 06:53:26 Done.
1670 // RegExp.prototype setup.
1671
1672 // Install the "constructor" property on the {prototype}.
1673 JSObject::AddProperty(prototype, factory->constructor_string(),
1674 regexp_fun, DONT_ENUM);
1675
1676 SimpleInstallFunction(prototype, "exec", Builtins::kRegExpPrototypeExec,
1677 1, true, DONT_ENUM);
1678 }
1666 } 1679 }
1667 1680
1668 { // -- E r r o r 1681 { // -- E r r o r
1669 InstallError(isolate, global, factory->Error_string(), 1682 InstallError(isolate, global, factory->Error_string(),
1670 Context::ERROR_FUNCTION_INDEX); 1683 Context::ERROR_FUNCTION_INDEX);
1671 InstallMakeError(isolate, isolate->builtins()->MakeError(), 1684 InstallMakeError(isolate, isolate->builtins()->MakeError(),
1672 Context::MAKE_ERROR_INDEX); 1685 Context::MAKE_ERROR_INDEX);
1673 } 1686 }
1674 1687
1675 { // -- E v a l E r r o r 1688 { // -- E v a l E r r o r
(...skipping 2507 matching lines...) Expand 10 before | Expand all | Expand 10 after
4183 } 4196 }
4184 4197
4185 4198
4186 // Called when the top-level V8 mutex is destroyed. 4199 // Called when the top-level V8 mutex is destroyed.
4187 void Bootstrapper::FreeThreadResources() { 4200 void Bootstrapper::FreeThreadResources() {
4188 DCHECK(!IsActive()); 4201 DCHECK(!IsActive());
4189 } 4202 }
4190 4203
4191 } // namespace internal 4204 } // namespace internal
4192 } // namespace v8 4205 } // namespace v8
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/builtins/builtins.h » ('j') | src/builtins/builtins-regexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698