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

Side by Side Diff: src/bootstrapper.cc

Issue 2415103002: [regexp] Turn last match info into a simple FixedArray (Closed)
Patch Set: Don't check instance type before map check 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
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/builtins/builtins-regexp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, 1692 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
1693 prototype, Builtins::kRegExpConstructor); 1693 prototype, Builtins::kRegExpConstructor);
1694 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, 1694 InstallWithIntrinsicDefaultProto(isolate, regexp_fun,
1695 Context::REGEXP_FUNCTION_INDEX); 1695 Context::REGEXP_FUNCTION_INDEX);
1696 1696
1697 Handle<SharedFunctionInfo> shared(regexp_fun->shared(), isolate); 1697 Handle<SharedFunctionInfo> shared(regexp_fun->shared(), isolate);
1698 shared->SetConstructStub(*isolate->builtins()->RegExpConstructor()); 1698 shared->SetConstructStub(*isolate->builtins()->RegExpConstructor());
1699 shared->set_instance_class_name(isolate->heap()->RegExp_string()); 1699 shared->set_instance_class_name(isolate->heap()->RegExp_string());
1700 shared->DontAdaptArguments(); 1700 shared->DontAdaptArguments();
1701 shared->set_length(2); 1701 shared->set_length(2);
1702
1702 { 1703 {
1703 // RegExp.prototype setup. 1704 // RegExp.prototype setup.
1704 1705
1705 // Install the "constructor" property on the {prototype}. 1706 // Install the "constructor" property on the {prototype}.
1706 JSObject::AddProperty(prototype, factory->constructor_string(), 1707 JSObject::AddProperty(prototype, factory->constructor_string(),
1707 regexp_fun, DONT_ENUM); 1708 regexp_fun, DONT_ENUM);
1708 1709
1709 { 1710 {
1710 Handle<JSFunction> fun = SimpleInstallFunction( 1711 Handle<JSFunction> fun = SimpleInstallFunction(
1711 prototype, "exec", Builtins::kRegExpPrototypeExec, 1, true, 1712 prototype, "exec", Builtins::kRegExpPrototypeExec, 1, true,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 1761
1761 { 1762 {
1762 Handle<JSFunction> fun = SimpleCreateFunction( 1763 Handle<JSFunction> fun = SimpleCreateFunction(
1763 isolate, factory->InternalizeUtf8String("[Symbol.split]"), 1764 isolate, factory->InternalizeUtf8String("[Symbol.split]"),
1764 Builtins::kRegExpPrototypeSplit, 2, false); 1765 Builtins::kRegExpPrototypeSplit, 2, false);
1765 InstallFunction(prototype, fun, factory->split_symbol(), DONT_ENUM); 1766 InstallFunction(prototype, fun, factory->split_symbol(), DONT_ENUM);
1766 } 1767 }
1767 1768
1768 // Store the initial RegExp.prototype map. This is used in fast-path 1769 // Store the initial RegExp.prototype map. This is used in fast-path
1769 // checks. Do not alter the prototype after this point. 1770 // checks. Do not alter the prototype after this point.
1770 isolate->native_context()->set_regexp_prototype_map(prototype->map()); 1771 native_context()->set_regexp_prototype_map(prototype->map());
1771 } 1772 }
1772 1773
1773 { 1774 {
1774 // RegExp getters and setters. 1775 // RegExp getters and setters.
1775 1776
1776 // TODO(jgruber): This should really be DONT_ENUM | DONT_DELETE. 1777 // TODO(jgruber): This should really be DONT_ENUM | DONT_DELETE.
1777 // However, that currently breaks layout test expectations. Note that 1778 // However, that currently breaks layout test expectations. Note that
1778 // Firefox sets a couple of these as enumerable. 1779 // Firefox sets a couple of these as enumerable.
1779 // On the other hand, installing attributes as DONT_ENUM matches the draft 1780 // On the other hand, installing attributes as DONT_ENUM matches the draft
1780 // specification at 1781 // specification at
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 num_fields * kPointerSize); 1867 num_fields * kPointerSize);
1867 1868
1868 { // Internal: RegExpInternalMatch 1869 { // Internal: RegExpInternalMatch
1869 Handle<JSFunction> function = 1870 Handle<JSFunction> function =
1870 factory->NewFunction(isolate->factory()->empty_string(), 1871 factory->NewFunction(isolate->factory()->empty_string(),
1871 isolate->builtins()->RegExpInternalMatch(), 1872 isolate->builtins()->RegExpInternalMatch(),
1872 JS_OBJECT_TYPE, JSObject::kHeaderSize); 1873 JS_OBJECT_TYPE, JSObject::kHeaderSize);
1873 function->shared()->set_internal_formal_parameter_count(2); 1874 function->shared()->set_internal_formal_parameter_count(2);
1874 function->shared()->set_length(2); 1875 function->shared()->set_length(2);
1875 function->shared()->set_native(true); 1876 function->shared()->set_native(true);
1876 isolate->native_context()->set(Context::REGEXP_INTERNAL_MATCH, *function); 1877 native_context()->set(Context::REGEXP_INTERNAL_MATCH, *function);
1877 } 1878 }
1879
1880 // Create the last match info. One for external use, and one for internal
1881 // use when we don't want to modify the externally visible match info.
1882 Handle<RegExpMatchInfo> last_match_info = factory->NewRegExpMatchInfo();
1883 native_context()->set_regexp_last_match_info(*last_match_info);
1884 Handle<RegExpMatchInfo> internal_match_info = factory->NewRegExpMatchInfo();
1885 native_context()->set_regexp_internal_match_info(*internal_match_info);
1878 } 1886 }
1879 1887
1880 { // -- E r r o r 1888 { // -- E r r o r
1881 InstallError(isolate, global, factory->Error_string(), 1889 InstallError(isolate, global, factory->Error_string(),
1882 Context::ERROR_FUNCTION_INDEX); 1890 Context::ERROR_FUNCTION_INDEX);
1883 InstallMakeError(isolate, isolate->builtins()->MakeError(), 1891 InstallMakeError(isolate, isolate->builtins()->MakeError(),
1884 Context::MAKE_ERROR_INDEX); 1892 Context::MAKE_ERROR_INDEX);
1885 } 1893 }
1886 1894
1887 { // -- E v a l E r r o r 1895 { // -- E v a l E r r o r
(...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after
4453 } 4461 }
4454 4462
4455 4463
4456 // Called when the top-level V8 mutex is destroyed. 4464 // Called when the top-level V8 mutex is destroyed.
4457 void Bootstrapper::FreeThreadResources() { 4465 void Bootstrapper::FreeThreadResources() {
4458 DCHECK(!IsActive()); 4466 DCHECK(!IsActive());
4459 } 4467 }
4460 4468
4461 } // namespace internal 4469 } // namespace internal
4462 } // namespace v8 4470 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/builtins/builtins-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698