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

Unified Diff: test/cctest/test-assembler-arm.cc

Issue 1069633002: [arm] Use position independent table switches. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-assembler-arm.cc
diff --git a/test/cctest/test-assembler-arm.cc b/test/cctest/test-assembler-arm.cc
index 526d4567fa30cd63d0432c6293471fa2403efcea..250206b899f58471b0b1716c593e0df2bb022708 100644
--- a/test/cctest/test-assembler-arm.cc
+++ b/test/cctest/test-assembler-arm.cc
@@ -1885,172 +1885,6 @@ TEST(code_relative_offset) {
}
-TEST(jump_tables1) {
- // Test jump tables with forward jumps.
- CcTest::InitializeVM();
- Isolate* isolate = CcTest::i_isolate();
- HandleScope scope(isolate);
- Assembler assm(isolate, nullptr, 0);
-
- const int kNumCases = 512;
- int values[kNumCases];
- isolate->random_number_generator()->NextBytes(values, sizeof(values));
- Label labels[kNumCases];
-
- __ stm(db_w, sp, lr.bit());
-
- Label done;
- __ BlockConstPoolFor(kNumCases + 2);
- {
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases + 2) * Assembler::kInstrSize);
- __ ldr(pc, MemOperand(pc, r0, LSL, 2));
- __ nop();
- for (int i = 0; i < kNumCases; ++i) {
- __ dd(&labels[i]);
- }
- }
-
- for (int i = 0; i < kNumCases; ++i) {
- __ bind(&labels[i]);
- __ mov(r0, Operand(values[i]));
- __ b(&done);
- }
-
- __ bind(&done);
- __ ldm(ia_w, sp, pc.bit());
-
- CodeDesc desc;
- assm.GetCode(&desc);
- Handle<Code> code = isolate->factory()->NewCode(
- desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
-#ifdef OBJECT_PRINT
- code->Print(std::cout);
-#endif
- F1 f = FUNCTION_CAST<F1>(code->entry());
- for (int i = 0; i < kNumCases; ++i) {
- int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, i, 0, 0, 0, 0));
- ::printf("f(%d) = %d\n", i, res);
- CHECK_EQ(values[i], res);
- }
-}
-
-
-TEST(jump_tables2) {
- // Test jump tables with backward jumps.
- CcTest::InitializeVM();
- Isolate* isolate = CcTest::i_isolate();
- HandleScope scope(isolate);
- Assembler assm(isolate, nullptr, 0);
-
- const int kNumCases = 512;
- int values[kNumCases];
- isolate->random_number_generator()->NextBytes(values, sizeof(values));
- Label labels[kNumCases];
-
- __ stm(db_w, sp, lr.bit());
-
- Label done, dispatch;
- __ b(&dispatch);
-
- for (int i = 0; i < kNumCases; ++i) {
- __ bind(&labels[i]);
- __ mov(r0, Operand(values[i]));
- __ b(&done);
- }
-
- __ bind(&dispatch);
- __ BlockConstPoolFor(kNumCases + 2);
- {
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases + 2) * Assembler::kInstrSize);
- __ ldr(pc, MemOperand(pc, r0, LSL, 2));
- __ nop();
- for (int i = 0; i < kNumCases; ++i) {
- __ dd(&labels[i]);
- }
- }
-
- __ bind(&done);
- __ ldm(ia_w, sp, pc.bit());
-
- CodeDesc desc;
- assm.GetCode(&desc);
- Handle<Code> code = isolate->factory()->NewCode(
- desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
-#ifdef OBJECT_PRINT
- code->Print(std::cout);
-#endif
- F1 f = FUNCTION_CAST<F1>(code->entry());
- for (int i = 0; i < kNumCases; ++i) {
- int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, i, 0, 0, 0, 0));
- ::printf("f(%d) = %d\n", i, res);
- CHECK_EQ(values[i], res);
- }
-}
-
-
-TEST(jump_tables3) {
- // Test jump tables with backward jumps and embedded heap objects.
- CcTest::InitializeVM();
- Isolate* isolate = CcTest::i_isolate();
- HandleScope scope(isolate);
- Assembler assm(isolate, nullptr, 0);
-
- const int kNumCases = 256;
- Handle<Object> values[kNumCases];
- for (int i = 0; i < kNumCases; ++i) {
- double value = isolate->random_number_generator()->NextDouble();
- values[i] = isolate->factory()->NewHeapNumber(value, IMMUTABLE, TENURED);
- }
- Label labels[kNumCases];
-
- __ stm(db_w, sp, lr.bit());
-
- Label done, dispatch;
- __ b(&dispatch);
-
- for (int i = 0; i < kNumCases; ++i) {
- __ bind(&labels[i]);
- __ mov(r0, Operand(values[i]));
- __ b(&done);
- }
-
- __ bind(&dispatch);
- __ BlockConstPoolFor(kNumCases + 2);
- {
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases + 2) * Assembler::kInstrSize);
- __ ldr(pc, MemOperand(pc, r0, LSL, 2));
- __ nop();
- for (int i = 0; i < kNumCases; ++i) {
- __ dd(&labels[i]);
- }
- }
-
- __ bind(&done);
- __ ldm(ia_w, sp, pc.bit());
-
- CodeDesc desc;
- assm.GetCode(&desc);
- Handle<Code> code = isolate->factory()->NewCode(
- desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
-#ifdef OBJECT_PRINT
- code->Print(std::cout);
-#endif
- F1 f = FUNCTION_CAST<F1>(code->entry());
- for (int i = 0; i < kNumCases; ++i) {
- Handle<Object> result(CALL_GENERATED_CODE(f, i, 0, 0, 0, 0), isolate);
-#ifdef OBJECT_PRINT
- ::printf("f(%d) = ", i);
- result->Print(std::cout);
- ::printf("\n");
-#endif
- CHECK(values[i].is_identical_to(result));
- }
-}
-
-
TEST(ARMv8_vrintX) {
// Test the vrintX floating point instructions.
CcTest::InitializeVM();
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698