| 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/ia32/codegen-ia32.h" | 5 #include "src/ia32/codegen-ia32.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 public: | 180 public: |
| 181 explicit LabelConverter(byte* buffer) : buffer_(buffer) {} | 181 explicit LabelConverter(byte* buffer) : buffer_(buffer) {} |
| 182 int32_t address(Label* l) const { | 182 int32_t address(Label* l) const { |
| 183 return reinterpret_cast<int32_t>(buffer_) + l->pos(); | 183 return reinterpret_cast<int32_t>(buffer_) + l->pos(); |
| 184 } | 184 } |
| 185 private: | 185 private: |
| 186 byte* buffer_; | 186 byte* buffer_; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 | 189 |
| 190 MemMoveFunction CreateMemMoveFunction() { | 190 MemMoveFunction CreateMemMoveFunction(Isolate* isolate) { |
| 191 size_t actual_size; | 191 size_t actual_size; |
| 192 // Allocate buffer in executable space. | 192 // Allocate buffer in executable space. |
| 193 byte* buffer = | 193 byte* buffer = |
| 194 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 194 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 195 if (buffer == NULL) return NULL; | 195 if (buffer == nullptr) return nullptr; |
| 196 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), | 196 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size), |
| 197 CodeObjectRequired::kNo); | 197 CodeObjectRequired::kNo); |
| 198 LabelConverter conv(buffer); | 198 LabelConverter conv(buffer); |
| 199 | 199 |
| 200 // Generated code is put into a fixed, unmovable buffer, and not into | 200 // Generated code is put into a fixed, unmovable buffer, and not into |
| 201 // the V8 heap. We can't, and don't, refer to any relocatable addresses | 201 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
| 202 // (e.g. the JavaScript nan-object). | 202 // (e.g. the JavaScript nan-object). |
| 203 | 203 |
| 204 // 32-bit C declaration function calls pass arguments on stack. | 204 // 32-bit C declaration function calls pass arguments on stack. |
| 205 | 205 |
| 206 // Stack layout: | 206 // Stack layout: |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 __ mov(eax, Operand(count, times_4, conv.address(&small_handlers))); | 500 __ mov(eax, Operand(count, times_4, conv.address(&small_handlers))); |
| 501 __ jmp(eax); | 501 __ jmp(eax); |
| 502 } | 502 } |
| 503 | 503 |
| 504 __ bind(&pop_and_return); | 504 __ bind(&pop_and_return); |
| 505 MemMoveEmitPopAndReturn(&masm); | 505 MemMoveEmitPopAndReturn(&masm); |
| 506 | 506 |
| 507 CodeDesc desc; | 507 CodeDesc desc; |
| 508 masm.GetCode(&desc); | 508 masm.GetCode(&desc); |
| 509 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 509 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| 510 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); | 510 Assembler::FlushICache(isolate, buffer, actual_size); |
| 511 base::OS::ProtectCode(buffer, actual_size); | 511 base::OS::ProtectCode(buffer, actual_size); |
| 512 // TODO(jkummerow): It would be nice to register this code creation event | 512 // TODO(jkummerow): It would be nice to register this code creation event |
| 513 // with the PROFILE / GDBJIT system. | 513 // with the PROFILE / GDBJIT system. |
| 514 return FUNCTION_CAST<MemMoveFunction>(buffer); | 514 return FUNCTION_CAST<MemMoveFunction>(buffer); |
| 515 } | 515 } |
| 516 | 516 |
| 517 | 517 |
| 518 #undef __ | 518 #undef __ |
| 519 | 519 |
| 520 // ------------------------------------------------------------------------- | 520 // ------------------------------------------------------------------------- |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 CodePatcher patcher(sequence, young_length); | 1041 CodePatcher patcher(sequence, young_length); |
| 1042 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1042 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 1043 } | 1043 } |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 | 1046 |
| 1047 } // namespace internal | 1047 } // namespace internal |
| 1048 } // namespace v8 | 1048 } // namespace v8 |
| 1049 | 1049 |
| 1050 #endif // V8_TARGET_ARCH_IA32 | 1050 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |