| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "codegen.h" | 9 #include "codegen.h" |
| 10 #include "heap.h" | 10 #include "heap.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 public: | 179 public: |
| 180 explicit LabelConverter(byte* buffer) : buffer_(buffer) {} | 180 explicit LabelConverter(byte* buffer) : buffer_(buffer) {} |
| 181 int32_t address(Label* l) const { | 181 int32_t address(Label* l) const { |
| 182 return reinterpret_cast<int32_t>(buffer_) + l->pos(); | 182 return reinterpret_cast<int32_t>(buffer_) + l->pos(); |
| 183 } | 183 } |
| 184 private: | 184 private: |
| 185 byte* buffer_; | 185 byte* buffer_; |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 | 188 |
| 189 OS::MemMoveFunction CreateMemMoveFunction() { | 189 MemMoveFunction CreateMemMoveFunction() { |
| 190 size_t actual_size; | 190 size_t actual_size; |
| 191 // Allocate buffer in executable space. | 191 // Allocate buffer in executable space. |
| 192 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 192 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); |
| 193 if (buffer == NULL) return NULL; | 193 if (buffer == NULL) return NULL; |
| 194 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 194 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
| 195 LabelConverter conv(buffer); | 195 LabelConverter conv(buffer); |
| 196 | 196 |
| 197 // Generated code is put into a fixed, unmovable buffer, and not into | 197 // Generated code is put into a fixed, unmovable buffer, and not into |
| 198 // the V8 heap. We can't, and don't, refer to any relocatable addresses | 198 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
| 199 // (e.g. the JavaScript nan-object). | 199 // (e.g. the JavaScript nan-object). |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 __ bind(&pop_and_return); | 501 __ bind(&pop_and_return); |
| 502 MemMoveEmitPopAndReturn(&masm); | 502 MemMoveEmitPopAndReturn(&masm); |
| 503 | 503 |
| 504 CodeDesc desc; | 504 CodeDesc desc; |
| 505 masm.GetCode(&desc); | 505 masm.GetCode(&desc); |
| 506 ASSERT(!RelocInfo::RequiresRelocation(desc)); | 506 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
| 507 CPU::FlushICache(buffer, actual_size); | 507 CPU::FlushICache(buffer, actual_size); |
| 508 OS::ProtectCode(buffer, actual_size); | 508 OS::ProtectCode(buffer, actual_size); |
| 509 // TODO(jkummerow): It would be nice to register this code creation event | 509 // TODO(jkummerow): It would be nice to register this code creation event |
| 510 // with the PROFILE / GDBJIT system. | 510 // with the PROFILE / GDBJIT system. |
| 511 return FUNCTION_CAST<OS::MemMoveFunction>(buffer); | 511 return FUNCTION_CAST<MemMoveFunction>(buffer); |
| 512 } | 512 } |
| 513 | 513 |
| 514 | 514 |
| 515 #undef __ | 515 #undef __ |
| 516 | 516 |
| 517 // ------------------------------------------------------------------------- | 517 // ------------------------------------------------------------------------- |
| 518 // Code generators | 518 // Code generators |
| 519 | 519 |
| 520 #define __ ACCESS_MASM(masm) | 520 #define __ ACCESS_MASM(masm) |
| 521 | 521 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 Code* stub = GetCodeAgeStub(isolate, age, parity); | 1010 Code* stub = GetCodeAgeStub(isolate, age, parity); |
| 1011 CodePatcher patcher(sequence, young_length); | 1011 CodePatcher patcher(sequence, young_length); |
| 1012 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1012 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 1013 } | 1013 } |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 | 1016 |
| 1017 } } // namespace v8::internal | 1017 } } // namespace v8::internal |
| 1018 | 1018 |
| 1019 #endif // V8_TARGET_ARCH_IA32 | 1019 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |