| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 CHECK(act_size >= static_cast<size_t>(data_size)); | 79 CHECK(act_size >= static_cast<size_t>(data_size)); |
| 80 byte* dest_buffer = | 80 byte* dest_buffer = |
| 81 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); | 81 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); |
| 82 CHECK(dest_buffer); | 82 CHECK(dest_buffer); |
| 83 CHECK(act_size >= static_cast<size_t>(data_size)); | 83 CHECK(act_size >= static_cast<size_t>(data_size)); |
| 84 | 84 |
| 85 // Storage for a0 and a1. | 85 // Storage for a0 and a1. |
| 86 byte* a0_; | 86 byte* a0_; |
| 87 byte* a1_; | 87 byte* a1_; |
| 88 | 88 |
| 89 MacroAssembler assembler(isolate, NULL, 0); | 89 MacroAssembler assembler(isolate, NULL, 0, true); |
| 90 MacroAssembler* masm = &assembler; | 90 MacroAssembler* masm = &assembler; |
| 91 | 91 |
| 92 // Code to be generated: The stuff in CopyBytes followed by a store of a0 and | 92 // Code to be generated: The stuff in CopyBytes followed by a store of a0 and |
| 93 // a1, respectively. | 93 // a1, respectively. |
| 94 __ CopyBytes(a0, a1, a2, a3); | 94 __ CopyBytes(a0, a1, a2, a3); |
| 95 __ li(a2, Operand(reinterpret_cast<int64_t>(&a0_))); | 95 __ li(a2, Operand(reinterpret_cast<int64_t>(&a0_))); |
| 96 __ li(a3, Operand(reinterpret_cast<int64_t>(&a1_))); | 96 __ li(a3, Operand(reinterpret_cast<int64_t>(&a1_))); |
| 97 __ sd(a0, MemOperand(a2)); | 97 __ sd(a0, MemOperand(a2)); |
| 98 __ jr(ra); | 98 __ jr(ra); |
| 99 __ sd(a1, MemOperand(a3)); | 99 __ sd(a1, MemOperand(a3)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 HandleScope handles(isolate); | 144 HandleScope handles(isolate); |
| 145 | 145 |
| 146 int64_t refConstants[64]; | 146 int64_t refConstants[64]; |
| 147 int64_t result[64]; | 147 int64_t result[64]; |
| 148 | 148 |
| 149 int64_t mask = 1; | 149 int64_t mask = 1; |
| 150 for (int i = 0; i < 64; i++) { | 150 for (int i = 0; i < 64; i++) { |
| 151 refConstants[i] = ~(mask << i); | 151 refConstants[i] = ~(mask << i); |
| 152 } | 152 } |
| 153 | 153 |
| 154 MacroAssembler assembler(isolate, NULL, 0); | 154 MacroAssembler assembler(isolate, NULL, 0, true); |
| 155 MacroAssembler* masm = &assembler; | 155 MacroAssembler* masm = &assembler; |
| 156 | 156 |
| 157 __ mov(a4, a0); | 157 __ mov(a4, a0); |
| 158 for (int i = 0; i < 64; i++) { | 158 for (int i = 0; i < 64; i++) { |
| 159 // Load constant. | 159 // Load constant. |
| 160 __ li(a5, Operand(refConstants[i])); | 160 __ li(a5, Operand(refConstants[i])); |
| 161 __ sd(a5, MemOperand(a4)); | 161 __ sd(a5, MemOperand(a4)); |
| 162 __ Daddu(a4, a4, Operand(kPointerSize)); | 162 __ Daddu(a4, a4, Operand(kPointerSize)); |
| 163 } | 163 } |
| 164 | 164 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 178 CHECK(refConstants[i] == result[i]); | 178 CHECK(refConstants[i] == result[i]); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 | 182 |
| 183 TEST(LoadAddress) { | 183 TEST(LoadAddress) { |
| 184 CcTest::InitializeVM(); | 184 CcTest::InitializeVM(); |
| 185 Isolate* isolate = CcTest::i_isolate(); | 185 Isolate* isolate = CcTest::i_isolate(); |
| 186 HandleScope handles(isolate); | 186 HandleScope handles(isolate); |
| 187 | 187 |
| 188 MacroAssembler assembler(isolate, NULL, 0); | 188 MacroAssembler assembler(isolate, NULL, 0, true); |
| 189 MacroAssembler* masm = &assembler; | 189 MacroAssembler* masm = &assembler; |
| 190 Label to_jump, skip; | 190 Label to_jump, skip; |
| 191 __ mov(a4, a0); | 191 __ mov(a4, a0); |
| 192 | 192 |
| 193 __ Branch(&skip); | 193 __ Branch(&skip); |
| 194 __ bind(&to_jump); | 194 __ bind(&to_jump); |
| 195 __ nop(); | 195 __ nop(); |
| 196 __ nop(); | 196 __ nop(); |
| 197 __ jr(ra); | 197 __ jr(ra); |
| 198 __ nop(); | 198 __ nop(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 221 | 221 |
| 222 | 222 |
| 223 TEST(jump_tables4) { | 223 TEST(jump_tables4) { |
| 224 // Similar to test-assembler-mips jump_tables1, with extra test for branch | 224 // Similar to test-assembler-mips jump_tables1, with extra test for branch |
| 225 // trampoline required before emission of the dd table (where trampolines are | 225 // trampoline required before emission of the dd table (where trampolines are |
| 226 // blocked), and proper transition to long-branch mode. | 226 // blocked), and proper transition to long-branch mode. |
| 227 // Regression test for v8:4294. | 227 // Regression test for v8:4294. |
| 228 CcTest::InitializeVM(); | 228 CcTest::InitializeVM(); |
| 229 Isolate* isolate = CcTest::i_isolate(); | 229 Isolate* isolate = CcTest::i_isolate(); |
| 230 HandleScope scope(isolate); | 230 HandleScope scope(isolate); |
| 231 MacroAssembler assembler(isolate, NULL, 0); | 231 MacroAssembler assembler(isolate, NULL, 0, true); |
| 232 MacroAssembler* masm = &assembler; | 232 MacroAssembler* masm = &assembler; |
| 233 | 233 |
| 234 const int kNumCases = 512; | 234 const int kNumCases = 512; |
| 235 int values[kNumCases]; | 235 int values[kNumCases]; |
| 236 isolate->random_number_generator()->NextBytes(values, sizeof(values)); | 236 isolate->random_number_generator()->NextBytes(values, sizeof(values)); |
| 237 Label labels[kNumCases]; | 237 Label labels[kNumCases]; |
| 238 Label near_start, end; | 238 Label near_start, end; |
| 239 | 239 |
| 240 __ daddiu(sp, sp, -8); | 240 __ daddiu(sp, sp, -8); |
| 241 __ sd(ra, MemOperand(sp)); | 241 __ sd(ra, MemOperand(sp)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 F1 f = FUNCTION_CAST<F1>(code->entry()); | 299 F1 f = FUNCTION_CAST<F1>(code->entry()); |
| 300 for (int i = 0; i < kNumCases; ++i) { | 300 for (int i = 0; i < kNumCases; ++i) { |
| 301 int64_t res = reinterpret_cast<int64_t>( | 301 int64_t res = reinterpret_cast<int64_t>( |
| 302 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); | 302 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); |
| 303 ::printf("f(%d) = %" PRId64 "\n", i, res); | 303 ::printf("f(%d) = %" PRId64 "\n", i, res); |
| 304 CHECK_EQ(values[i], res); | 304 CHECK_EQ(values[i], res); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 | 307 |
| 308 #undef __ | 308 #undef __ |
| OLD | NEW |