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

Side by Side Diff: src/bootstrapper.cc

Issue 2452913002: [regexp] Set static property attributes as in spec proposal (Closed)
Patch Set: Check setters as well Created 4 years, 1 month 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 | « no previous file | test/mjsunit/regress/regress-5566.js » ('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 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 } 1867 }
1868 1868
1869 // Store the initial RegExp.prototype map. This is used in fast-path 1869 // Store the initial RegExp.prototype map. This is used in fast-path
1870 // checks. Do not alter the prototype after this point. 1870 // checks. Do not alter the prototype after this point.
1871 native_context()->set_regexp_prototype_map(prototype->map()); 1871 native_context()->set_regexp_prototype_map(prototype->map());
1872 } 1872 }
1873 1873
1874 { 1874 {
1875 // RegExp getters and setters. 1875 // RegExp getters and setters.
1876 1876
1877 // TODO(jgruber): This should really be DONT_ENUM | DONT_DELETE.
1878 // However, that currently breaks layout test expectations. Note that
1879 // Firefox sets a couple of these as enumerable.
1880 // On the other hand, installing attributes as DONT_ENUM matches the draft
1881 // specification at
1882 // https://github.com/claudepache/es-regexp-legacy-static-properties.
1883 const PropertyAttributes no_enum = DONT_ENUM;
1884
1885 SimpleInstallGetter(regexp_fun, 1877 SimpleInstallGetter(regexp_fun,
1886 factory->InternalizeUtf8String("[Symbol.species]"), 1878 factory->InternalizeUtf8String("[Symbol.species]"),
1887 factory->species_symbol(), 1879 factory->species_symbol(),
1888 Builtins::kRegExpPrototypeSpeciesGetter, false); 1880 Builtins::kRegExpPrototypeSpeciesGetter, false);
1889 1881
1890 // Static properties set by a successful match. 1882 // Static properties set by a successful match.
1891 1883
1884 const PropertyAttributes no_enum = DONT_ENUM;
1892 SimpleInstallGetterSetter(regexp_fun, factory->input_string(), 1885 SimpleInstallGetterSetter(regexp_fun, factory->input_string(),
1893 Builtins::kRegExpInputGetter, 1886 Builtins::kRegExpInputGetter,
1894 Builtins::kRegExpInputSetter, DONT_DELETE); 1887 Builtins::kRegExpInputSetter, no_enum);
1895 SimpleInstallGetterSetter( 1888 SimpleInstallGetterSetter(
1896 regexp_fun, factory->InternalizeUtf8String("$_"), 1889 regexp_fun, factory->InternalizeUtf8String("$_"),
1897 Builtins::kRegExpInputGetter, Builtins::kRegExpInputSetter, no_enum); 1890 Builtins::kRegExpInputGetter, Builtins::kRegExpInputSetter, no_enum);
1898 1891
1899 SimpleInstallGetterSetter( 1892 SimpleInstallGetterSetter(
1900 regexp_fun, factory->InternalizeUtf8String("lastMatch"), 1893 regexp_fun, factory->InternalizeUtf8String("lastMatch"),
1901 Builtins::kRegExpLastMatchGetter, Builtins::kEmptyFunction, no_enum); 1894 Builtins::kRegExpLastMatchGetter, Builtins::kEmptyFunction, no_enum);
1902 SimpleInstallGetterSetter( 1895 SimpleInstallGetterSetter(
1903 regexp_fun, factory->InternalizeUtf8String("$&"), 1896 regexp_fun, factory->InternalizeUtf8String("$&"),
1904 Builtins::kRegExpLastMatchGetter, Builtins::kEmptyFunction, no_enum); 1897 Builtins::kRegExpLastMatchGetter, Builtins::kEmptyFunction, no_enum);
(...skipping 16 matching lines...) Expand all
1921 1914
1922 SimpleInstallGetterSetter(regexp_fun, 1915 SimpleInstallGetterSetter(regexp_fun,
1923 factory->InternalizeUtf8String("rightContext"), 1916 factory->InternalizeUtf8String("rightContext"),
1924 Builtins::kRegExpRightContextGetter, 1917 Builtins::kRegExpRightContextGetter,
1925 Builtins::kEmptyFunction, no_enum); 1918 Builtins::kEmptyFunction, no_enum);
1926 SimpleInstallGetterSetter(regexp_fun, 1919 SimpleInstallGetterSetter(regexp_fun,
1927 factory->InternalizeUtf8String("$'"), 1920 factory->InternalizeUtf8String("$'"),
1928 Builtins::kRegExpRightContextGetter, 1921 Builtins::kRegExpRightContextGetter,
1929 Builtins::kEmptyFunction, no_enum); 1922 Builtins::kEmptyFunction, no_enum);
1930 1923
1931 #define INSTALL_CAPTURE_GETTER(i) \ 1924 #define INSTALL_CAPTURE_GETTER(i) \
1932 SimpleInstallGetterSetter(regexp_fun, \ 1925 SimpleInstallGetterSetter( \
1933 factory->InternalizeUtf8String("$" #i), \ 1926 regexp_fun, factory->InternalizeUtf8String("$" #i), \
1934 Builtins::kRegExpCapture##i##Getter, \ 1927 Builtins::kRegExpCapture##i##Getter, Builtins::kEmptyFunction, no_enum)
1935 Builtins::kEmptyFunction, DONT_DELETE)
1936 INSTALL_CAPTURE_GETTER(1); 1928 INSTALL_CAPTURE_GETTER(1);
1937 INSTALL_CAPTURE_GETTER(2); 1929 INSTALL_CAPTURE_GETTER(2);
1938 INSTALL_CAPTURE_GETTER(3); 1930 INSTALL_CAPTURE_GETTER(3);
1939 INSTALL_CAPTURE_GETTER(4); 1931 INSTALL_CAPTURE_GETTER(4);
1940 INSTALL_CAPTURE_GETTER(5); 1932 INSTALL_CAPTURE_GETTER(5);
1941 INSTALL_CAPTURE_GETTER(6); 1933 INSTALL_CAPTURE_GETTER(6);
1942 INSTALL_CAPTURE_GETTER(7); 1934 INSTALL_CAPTURE_GETTER(7);
1943 INSTALL_CAPTURE_GETTER(8); 1935 INSTALL_CAPTURE_GETTER(8);
1944 INSTALL_CAPTURE_GETTER(9); 1936 INSTALL_CAPTURE_GETTER(9);
1945 #undef INSTALL_CAPTURE_GETTER 1937 #undef INSTALL_CAPTURE_GETTER
(...skipping 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after
4572 } 4564 }
4573 4565
4574 4566
4575 // Called when the top-level V8 mutex is destroyed. 4567 // Called when the top-level V8 mutex is destroyed.
4576 void Bootstrapper::FreeThreadResources() { 4568 void Bootstrapper::FreeThreadResources() {
4577 DCHECK(!IsActive()); 4569 DCHECK(!IsActive());
4578 } 4570 }
4579 4571
4580 } // namespace internal 4572 } // namespace internal
4581 } // namespace v8 4573 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5566.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698