OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/base/utils/random-number-generator.h" | 5 #include "src/base/utils/random-number-generator.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "test/cctest/compiler/code-assembler-tester.h" | 10 #include "test/cctest/compiler/code-assembler-tester.h" |
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 Smi::FromInt(5), Smi::FromInt(6), 2, 6); | 1920 Smi::FromInt(5), Smi::FromInt(6), 2, 6); |
1921 } | 1921 } |
1922 | 1922 |
1923 TEST(BuildAppendJSArrayFastDoubleElementsObject) { | 1923 TEST(BuildAppendJSArrayFastDoubleElementsObject) { |
1924 Isolate* isolate(CcTest::InitIsolateOnce()); | 1924 Isolate* isolate(CcTest::InitIsolateOnce()); |
1925 AppendJSArrayCodeStubAssembler::TestAppendJSArray( | 1925 AppendJSArrayCodeStubAssembler::TestAppendJSArray( |
1926 isolate, FAST_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), | 1926 isolate, FAST_DOUBLE_ELEMENTS, Smi::FromInt(3), Smi::FromInt(4), |
1927 isolate->heap()->undefined_value(), Smi::FromInt(6), 6, 4); | 1927 isolate->heap()->undefined_value(), Smi::FromInt(6), 6, 4); |
1928 } | 1928 } |
1929 | 1929 |
| 1930 namespace { |
| 1931 |
| 1932 template <typename Stub, typename... Args> |
| 1933 void Recompile(Args... args) { |
| 1934 Stub stub(args...); |
| 1935 stub.DeleteStubFromCacheForTesting(); |
| 1936 stub.GetCode(); |
| 1937 } |
| 1938 |
| 1939 } // namespace |
| 1940 |
| 1941 TEST(CodeStubAssemblerGraphsCorrectness) { |
| 1942 // The test does not work with interpreter because bytecode handlers taken |
| 1943 // from the snapshot already refer to precompiled stubs from the snapshot |
| 1944 // and there is no way to trigger bytecode handlers recompilation. |
| 1945 if (FLAG_ignition || FLAG_turbo) return; |
| 1946 |
| 1947 v8::Isolate::CreateParams create_params; |
| 1948 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 1949 v8::Isolate* v8_isolate = v8::Isolate::New(create_params); |
| 1950 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate); |
| 1951 |
| 1952 { |
| 1953 v8::Isolate::Scope isolate_scope(v8_isolate); |
| 1954 LocalContext env(v8_isolate); |
| 1955 v8::HandleScope scope(v8_isolate); |
| 1956 |
| 1957 FLAG_csa_verify = true; |
| 1958 |
| 1959 // Recompile some stubs here. |
| 1960 Recompile<LoadGlobalICStub>(isolate, LoadGlobalICState(NOT_INSIDE_TYPEOF)); |
| 1961 } |
| 1962 v8_isolate->Dispose(); |
| 1963 } |
| 1964 |
1930 } // namespace internal | 1965 } // namespace internal |
1931 } // namespace v8 | 1966 } // namespace v8 |
OLD | NEW |