X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..8b637bb680022adfddad653280734877951535a9:/assembler/AssemblerBuffer.h diff --git a/assembler/AssemblerBuffer.h b/assembler/AssemblerBuffer.h index b98503d..d82c0b9 100644 --- a/assembler/AssemblerBuffer.h +++ b/assembler/AssemblerBuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,9 +28,11 @@ #if ENABLE(ASSEMBLER) +#include "ExecutableAllocator.h" +#include "JITCompilationEffort.h" +#include "VM.h" #include "stdint.h" #include -#include #include #include #include @@ -128,29 +130,24 @@ namespace JSC { return AssemblerLabel(m_index); } - void* executableCopy(JSGlobalData& globalData, ExecutablePool* allocator) + PassRefPtr executableCopy(VM& vm, void* ownerUID, JITCompilationEffort effort) { if (!m_index) return 0; - void* result = allocator->alloc(globalData, m_index); + RefPtr result = vm.executableAllocator.allocate(vm, m_index, ownerUID, effort); if (!result) return 0; - ExecutableAllocator::makeWritable(result, m_index); + ExecutableAllocator::makeWritable(result->start(), result->sizeInBytes()); - return memcpy(result, m_buffer, m_index); + memcpy(result->start(), m_buffer, m_index); + + return result.release(); } - void rewindToLabel(AssemblerLabel label) - { - m_index = label.m_offset; - } - -#ifndef NDEBUG unsigned debugOffset() { return m_index; } -#endif protected: void append(const char* data, int size) @@ -171,7 +168,7 @@ namespace JSC { } private: - Vector m_storage; + Vector m_storage; char* m_buffer; int m_capacity; int m_index;