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 TEST(CodeStubAssemblerGraphsCorrectness) { |
| 1931 // The test does not work with interpreter because bytecode handlers taken |
| 1932 // from the snapshot already refer to precompiled stubs from the snapshot |
| 1933 // and there is no way to trigger bytecode handlers recompilation. |
| 1934 if (i::FLAG_ignition || i::FLAG_turbo) return; |
| 1935 |
| 1936 i::FLAG_csa_verify = true; |
| 1937 |
| 1938 v8::Isolate::CreateParams create_params; |
| 1939 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 1940 v8::Isolate* isolate = v8::Isolate::New(create_params); |
| 1941 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 1942 |
| 1943 { |
| 1944 v8::Isolate::Scope isolate_scope(isolate); |
| 1945 LocalContext env(isolate); |
| 1946 v8::HandleScope scope(isolate); |
| 1947 |
| 1948 { |
| 1949 // Enforce recompilation of the following stubs. |
| 1950 i::CodeStub::Major code_stub_keys[] = { |
| 1951 i::CodeStub::LoadIC, i::CodeStub::LoadICTrampoline, |
| 1952 i::CodeStub::LoadGlobalIC, i::CodeStub::LoadGlobalICTrampoline, |
| 1953 i::CodeStub::KeyedLoadICTF, i::CodeStub::KeyedLoadICTrampolineTF, |
| 1954 i::CodeStub::StoreIC, i::CodeStub::StoreICTrampoline, |
| 1955 i::CodeStub::KeyedStoreICTF, i::CodeStub::KeyedStoreICTrampolineTF, |
| 1956 }; |
| 1957 i::Heap* heap = i_isolate->heap(); |
| 1958 i::Handle<i::UnseededNumberDictionary> dict(heap->code_stubs()); |
| 1959 for (size_t i = 0; i < arraysize(code_stub_keys); i++) { |
| 1960 dict = i::UnseededNumberDictionary::DeleteKey(dict, code_stub_keys[i]); |
| 1961 } |
| 1962 heap->SetRootCodeStubs(*dict); |
| 1963 } |
| 1964 // Generate some stubs here. |
| 1965 } |
| 1966 isolate->Dispose(); |
| 1967 } |
| 1968 |
1930 } // namespace internal | 1969 } // namespace internal |
1931 } // namespace v8 | 1970 } // namespace v8 |
OLD | NEW |