| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/heap.h" | 10 #include "src/heap.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return reinterpret_cast<int32_t>(buffer_) + l->pos(); | 72 return reinterpret_cast<int32_t>(buffer_) + l->pos(); |
| 73 } | 73 } |
| 74 private: | 74 private: |
| 75 byte* buffer_; | 75 byte* buffer_; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 | 78 |
| 79 MemMoveFunction CreateMemMoveFunction() { | 79 MemMoveFunction CreateMemMoveFunction() { |
| 80 size_t actual_size; | 80 size_t actual_size; |
| 81 // Allocate buffer in executable space. | 81 // Allocate buffer in executable space. |
| 82 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 82 byte* buffer = |
| 83 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 83 if (buffer == NULL) return NULL; | 84 if (buffer == NULL) return NULL; |
| 84 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 85 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
| 85 LabelConverter conv(buffer); | 86 LabelConverter conv(buffer); |
| 86 | 87 |
| 87 // Generated code is put into a fixed, unmovable buffer, and not into | 88 // Generated code is put into a fixed, unmovable buffer, and not into |
| 88 // the V8 heap. We can't, and don't, refer to any relocatable addresses | 89 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
| 89 // (e.g. the JavaScript nan-object). | 90 // (e.g. the JavaScript nan-object). |
| 90 | 91 |
| 91 // 32-bit C declaration function calls pass arguments on stack. | 92 // 32-bit C declaration function calls pass arguments on stack. |
| 92 | 93 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 __ mov_b(Operand(dst, 0), eax); | 175 __ mov_b(Operand(dst, 0), eax); |
| 175 __ jmp(&backward_loop_1byte); | 176 __ jmp(&backward_loop_1byte); |
| 176 } | 177 } |
| 177 | 178 |
| 178 __ bind(&pop_and_return); | 179 __ bind(&pop_and_return); |
| 179 MemMoveEmitPopAndReturn(&masm); | 180 MemMoveEmitPopAndReturn(&masm); |
| 180 | 181 |
| 181 CodeDesc desc; | 182 CodeDesc desc; |
| 182 masm.GetCode(&desc); | 183 masm.GetCode(&desc); |
| 183 ASSERT(!RelocInfo::RequiresRelocation(desc)); | 184 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
| 184 CPU::FlushICache(buffer, actual_size); | 185 CpuFeatures::FlushICache(buffer, actual_size); |
| 185 OS::ProtectCode(buffer, actual_size); | 186 base::OS::ProtectCode(buffer, actual_size); |
| 186 // TODO(jkummerow): It would be nice to register this code creation event | 187 // TODO(jkummerow): It would be nice to register this code creation event |
| 187 // with the PROFILE / GDBJIT system. | 188 // with the PROFILE / GDBJIT system. |
| 188 return FUNCTION_CAST<MemMoveFunction>(buffer); | 189 return FUNCTION_CAST<MemMoveFunction>(buffer); |
| 189 } | 190 } |
| 190 | 191 |
| 191 | 192 |
| 192 #undef __ | 193 #undef __ |
| 193 | 194 |
| 194 // ------------------------------------------------------------------------- | 195 // ------------------------------------------------------------------------- |
| 195 // Code generators | 196 // Code generators |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 } | 612 } |
| 612 | 613 |
| 613 | 614 |
| 614 void Code::PatchPlatformCodeAge(Isolate* isolate, | 615 void Code::PatchPlatformCodeAge(Isolate* isolate, |
| 615 byte* sequence, | 616 byte* sequence, |
| 616 Code::Age age, | 617 Code::Age age, |
| 617 MarkingParity parity) { | 618 MarkingParity parity) { |
| 618 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 619 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
| 619 if (age == kNoAgeCodeAge) { | 620 if (age == kNoAgeCodeAge) { |
| 620 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 621 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
| 621 CPU::FlushICache(sequence, young_length); | 622 CpuFeatures::FlushICache(sequence, young_length); |
| 622 } else { | 623 } else { |
| 623 Code* stub = GetCodeAgeStub(isolate, age, parity); | 624 Code* stub = GetCodeAgeStub(isolate, age, parity); |
| 624 CodePatcher patcher(sequence, young_length); | 625 CodePatcher patcher(sequence, young_length); |
| 625 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 626 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 626 } | 627 } |
| 627 } | 628 } |
| 628 | 629 |
| 629 | 630 |
| 630 } } // namespace v8::internal | 631 } } // namespace v8::internal |
| 631 | 632 |
| 632 #endif // V8_TARGET_ARCH_X87 | 633 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |