Commit ae947e26 authored by sampsong's avatar sampsong Committed by Commit Bot

PPC/s390: [compiler] Delay allocation of code-embedded heap numbers.

Port 659e8f7b

Original Commit Message:

    Instead of allocating and embedding certain heap numbers into the code
    during code assembly, emit dummies but record the allocation requests.
    Later then, in Assembler::GetCode, allocate the heap numbers and patch
    the code by replacing the dummies with the actual objects. The
    RelocInfos for the embedded objects are already recorded correctly when
    emitting the dummies.

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

Review-Url: https://codereview.chromium.org/2929843002
Cr-Commit-Position: refs/heads/master@{#45793}
parent e34f8021
......@@ -250,8 +250,7 @@ Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size)
relocations_.reserve(128);
}
void Assembler::GetCode(CodeDesc* desc) {
void Assembler::GetCode(Isolate* isolate, CodeDesc* desc) {
// Emit constant pool if necessary.
int constant_pool_offset = EmitConstantPool();
......
......@@ -405,7 +405,7 @@ class Assembler : public AssemblerBase {
// GetCode emits any pending (non-emitted) code and fills the descriptor
// desc. GetCode() is idempotent; it returns the same result if no other
// Assembler functions are invoked in between GetCode() calls.
void GetCode(CodeDesc* desc);
void GetCode(Isolate* isolate, CodeDesc* desc);
// Label operations & relative jumps (PPUM Appendix D)
//
......@@ -493,6 +493,10 @@ 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);
......
......@@ -39,7 +39,7 @@ UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) {
__ Ret();
CodeDesc desc;
masm.GetCode(&desc);
masm.GetCode(isolate, &desc);
DCHECK(ABI_USES_FUNCTION_DESCRIPTORS ||
!RelocInfo::RequiresRelocation(isolate, desc));
......
......@@ -932,7 +932,7 @@ Handle<HeapObject> RegExpMacroAssemblerPPC::GetCode(Handle<String> source) {
}
CodeDesc code_desc;
masm_->GetCode(&code_desc);
masm_->GetCode(isolate(), &code_desc);
Handle<Code> code = isolate()->factory()->NewCode(
code_desc, Code::ComputeFlags(Code::REGEXP), masm_->CodeObject());
PROFILE(masm_->isolate(),
......
......@@ -928,7 +928,7 @@ Handle<HeapObject> RegExpMacroAssemblerS390::GetCode(Handle<String> source) {
}
CodeDesc code_desc;
masm_->GetCode(&code_desc);
masm_->GetCode(isolate(), &code_desc);
Handle<Code> code = isolate()->factory()->NewCode(
code_desc, Code::ComputeFlags(Code::REGEXP), masm_->CodeObject());
PROFILE(masm_->isolate(),
......
......@@ -348,7 +348,7 @@ Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size)
relocations_.reserve(128);
}
void Assembler::GetCode(CodeDesc* desc) {
void Assembler::GetCode(Isolate* isloate, CodeDesc* desc) {
EmitRelocations();
// Set up code descriptor.
......
......@@ -405,7 +405,7 @@ class Assembler : public AssemblerBase {
// GetCode emits any pending (non-emitted) code and fills the descriptor
// desc. GetCode() is idempotent; it returns the same result if no other
// Assembler functions are invoked in between GetCode() calls.
void GetCode(CodeDesc* desc);
void GetCode(Isolate* isolate, CodeDesc* desc);
// Label operations & relative jumps (PPUM Appendix D)
//
......@@ -457,6 +457,10 @@ 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));
......
......@@ -35,7 +35,7 @@ UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) {
__ Ret();
CodeDesc desc;
masm.GetCode(&desc);
masm.GetCode(isolate, &desc);
DCHECK(ABI_USES_FUNCTION_DESCRIPTORS ||
!RelocInfo::RequiresRelocation(isolate, desc));
......
......@@ -59,7 +59,7 @@ TEST(0) {
__ blr();
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -98,7 +98,7 @@ TEST(1) {
__ blr();
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -149,7 +149,7 @@ TEST(2) {
__ mov(r0, Operand(0xFFF0FFFF));
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -222,7 +222,7 @@ TEST(3) {
__ blr();
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -335,7 +335,7 @@ TEST(4) {
__ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Object* code = isolate->heap()->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
......@@ -396,7 +396,7 @@ TEST(5) {
__ mov(pc, Operand(lr));
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Object* code = isolate->heap()->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
......@@ -432,7 +432,7 @@ TEST(6) {
__ mov(pc, Operand(lr));
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Object* code = isolate->heap()->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
......@@ -508,7 +508,7 @@ static void TestRoundingMode(VCVTTypes types,
__ mov(pc, Operand(lr));
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Object* code = isolate->heap()->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
......@@ -696,7 +696,7 @@ TEST(8) {
__ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Object* code = isolate->heap()->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
......@@ -812,7 +812,7 @@ TEST(9) {
__ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Object* code = isolate->heap()->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
......@@ -924,7 +924,7 @@ TEST(10) {
__ ldm(ia_w, sp, r4.bit() | fp.bit() | pc.bit());
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Object* code = isolate->heap()->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
......@@ -1022,7 +1022,7 @@ TEST(11) {
__ mov(pc, Operand(lr));
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Object* code = isolate->heap()->CreateCode(
desc,
Code::ComputeFlags(Code::STUB),
......
......@@ -59,7 +59,7 @@ TEST(0) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -99,7 +99,7 @@ TEST(1) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -151,7 +151,7 @@ TEST(2) {
__ iilf(r0, Operand(0xFFF0FFFF));
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -207,7 +207,7 @@ TEST(3) {
// OS::DebugBreak();
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -248,7 +248,7 @@ TEST(4) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -276,7 +276,7 @@ TEST(5) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -310,7 +310,7 @@ TEST(6) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -342,7 +342,7 @@ TEST(7) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -373,7 +373,7 @@ TEST(8) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -400,7 +400,7 @@ TEST(9) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......@@ -485,7 +485,7 @@ TEST(10) {
__ b(r14);
CodeDesc desc;
assm.GetCode(&desc);
assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef DEBUG
......
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