Commit 26186702 authored by Jaideep Bajwa's avatar Jaideep Bajwa Committed by Commit Bot

PPC/s390: [compiler] Delay generation of code stubs.

Port 040fa06f

R=neis@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:6048
LOG=N

Change-Id: I842cf54de1ef33dbcaf95824db15d87e9f68eb22
Reviewed-on: https://chromium-review.googlesource.com/555330Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Commit-Queue: Jaideep Bajwa <bjaideep@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#46326}
parent 3dffe2e3
......@@ -493,10 +493,6 @@ class Assembler : public AssemblerBase {
Isolate* isolate, Address pc, Address target,
RelocInfo::Mode mode = RelocInfo::INTERNAL_REFERENCE);
static void set_heap_number(Handle<HeapObject> number, Address pc) {
UNIMPLEMENTED();
}
// Size of an instruction.
static constexpr int kInstrSize = sizeof(Instr);
......@@ -1522,6 +1518,19 @@ class Assembler : public AssemblerBase {
Trampoline trampoline_;
bool internal_trampoline_exception_;
// The following functions help with avoiding allocations of embedded heap
// objects during the code assembly phase. {RequestHeapObject} records the
// need for a future heap number allocation or code stub generation. After
// code assembly, {AllocateAndInstallRequestedHeapObjects} will allocate these
// objects and place them where they are expected (determined by the pc offset
// associated with each request). That is, for each request, it will patch the
// dummy heap object handle that we emitted during code assembly with the
// actual heap object handle.
void RequestHeapObject(HeapObjectRequest request);
void AllocateAndInstallRequestedHeapObjects(Isolate* isolate);
std::forward_list<HeapObjectRequest> heap_object_requests_;
friend class RegExpMacroAssemblerPPC;
friend class RelocInfo;
friend class CodePatcher;
......
......@@ -2312,6 +2312,24 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
// Fall through when we need to inform the incremental marker.
}
void ProfileEntryHookStub::MaybeCallEntryHookDelayed(MacroAssembler* masm,
Zone* zone) {
UNIMPLEMENTED_PPC();
if (masm->isolate()->function_entry_hook() != NULL) {
PredictableCodeSizeScope predictable(masm,
#if V8_TARGET_ARCH_PPC64
14 * Assembler::kInstrSize);
#else
11 * Assembler::kInstrSize);
#endif
ProfileEntryHookStub stub(masm->isolate());
__ mflr(r0);
__ Push(r0, ip);
__ CallStub(&stub);
__ Pop(r0, ip);
__ mtlr(r0);
}
}
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
if (masm->isolate()->function_entry_hook() != NULL) {
......
......@@ -11,6 +11,15 @@
#include "src/base/macros.h"
#include "src/globals.h"
// UNIMPLEMENTED_ macro for PPC.
#ifdef DEBUG
#define UNIMPLEMENTED_PPC() \
v8::internal::PrintF("%s, \tline %d: \tfunction %s not implemented. \n", \
__FILE__, __LINE__, __func__)
#else
#define UNIMPLEMENTED_PPC()
#endif
namespace v8 {
namespace internal {
......
......@@ -457,10 +457,6 @@ class Assembler : public AssemblerBase {
// of that call in the instruction stream.
inline static Address target_address_from_return_address(Address pc);
static void set_heap_number(Handle<HeapObject> number, Address pc) {
UNIMPLEMENTED();
}
// Given the address of the beginning of a call, return the address
// in the instruction stream that the call will return to.
INLINE(static Address return_address_from_call_start(Address pc));
......@@ -1454,6 +1450,19 @@ class Assembler : public AssemblerBase {
void bind_to(Label* L, int pos);
void next(Label* L);
// The following functions help with avoiding allocations of embedded heap
// objects during the code assembly phase. {RequestHeapObject} records the
// need for a future heap number allocation or code stub generation. After
// code assembly, {AllocateAndInstallRequestedHeapObjects} will allocate these
// objects and place them where they are expected (determined by the pc offset
// associated with each request). That is, for each request, it will patch the
// dummy heap object handle that we emitted during code assembly with the
// actual heap object handle.
void RequestHeapObject(HeapObjectRequest request);
void AllocateAndInstallRequestedHeapObjects(Isolate* isolate);
std::forward_list<HeapObjectRequest> heap_object_requests_;
friend class RegExpMacroAssemblerS390;
friend class RelocInfo;
friend class CodePatcher;
......
......@@ -2248,6 +2248,26 @@ void RecordWriteStub::CheckNeedsToInformIncrementalMarker(
// Fall through when we need to inform the incremental marker.
}
void ProfileEntryHookStub::MaybeCallEntryHookDelayed(MacroAssembler* masm,
Zone* zone) {
UNIMPLEMENTED_S390();
if (masm->isolate()->function_entry_hook() != NULL) {
PredictableCodeSizeScope predictable(masm,
#if V8_TARGET_ARCH_S390X
40);
#elif V8_HOST_ARCH_S390
36);
#else
32);
#endif
ProfileEntryHookStub stub(masm->isolate());
__ CleanseP(r14);
__ Push(r14, ip);
__ CallStub(&stub); // BRASL
__ Pop(r14, ip);
}
}
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
if (masm->isolate()->function_entry_hook() != NULL) {
PredictableCodeSizeScope predictable(masm,
......
......@@ -17,6 +17,15 @@
#include "src/base/macros.h"
#include "src/globals.h"
// UNIMPLEMENTED_ macro for S390.
#ifdef DEBUG
#define UNIMPLEMENTED_S390() \
v8::internal::PrintF("%s, \tline %d: \tfunction %s not implemented. \n", \
__FILE__, __LINE__, __func__)
#else
#define UNIMPLEMENTED_S390()
#endif
namespace v8 {
namespace internal {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment