Merge V8 5.2.361.47 DO NOT MERGE
https://chromium.googlesource.com/v8/v8/+/5.2.361.47
FPIIM-449
Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index 086da56..5cf9d97 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -33,7 +33,7 @@
CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
InstructionSequence* code, CompilationInfo* info)
- : frame_access_state_(new (code->zone()) FrameAccessState(frame)),
+ : frame_access_state_(nullptr),
linkage_(linkage),
code_(code),
info_(info),
@@ -56,6 +56,12 @@
for (int i = 0; i < code->InstructionBlockCount(); ++i) {
new (&labels_[i]) Label;
}
+ CreateFrameAccessState(frame);
+}
+
+void CodeGenerator::CreateFrameAccessState(Frame* frame) {
+ FinishFrame(frame);
+ frame_access_state_ = new (code()->zone()) FrameAccessState(frame);
}
Handle<Code> CodeGenerator::GenerateCode() {
@@ -96,9 +102,6 @@
}
}
- // Finish the Frame
- frame()->AlignFrame(kFrameAlignmentInBytes);
- AssembleSetupStackPointer();
// Assemble all non-deferred blocks, followed by deferred ones.
for (int deferred = 0; deferred < 2; ++deferred) {
for (const InstructionBlock* block : code()->instruction_blocks()) {
@@ -143,7 +146,7 @@
masm()->bind(GetLabel(current_block_));
if (block->must_construct_frame()) {
- AssemblePrologue();
+ AssembleConstructFrame();
// We need to setup the root register after we assemble the prologue, to
// avoid clobbering callee saved registers in case of C linkage and
// using the roots.
@@ -153,12 +156,14 @@
}
}
+ CodeGenResult result;
if (FLAG_enable_embedded_constant_pool && !block->needs_frame()) {
ConstantPoolUnavailableScope constant_pool_unavailable(masm());
- AssembleBlock(block);
+ result = AssembleBlock(block);
} else {
- AssembleBlock(block);
+ result = AssembleBlock(block);
}
+ if (result != kSuccess) return Handle<Code>();
}
}
@@ -274,8 +279,7 @@
bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object,
int* slot_return) {
if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
- if (info()->has_context() && object.is_identical_to(info()->context()) &&
- !info()->is_osr()) {
+ if (object.is_identical_to(info()->context()) && !info()->is_osr()) {
*slot_return = Frame::kContextSlot;
return true;
} else if (object.is_identical_to(info()->closure())) {
@@ -302,15 +306,18 @@
return false;
}
-void CodeGenerator::AssembleBlock(const InstructionBlock* block) {
+CodeGenerator::CodeGenResult CodeGenerator::AssembleBlock(
+ const InstructionBlock* block) {
for (int i = block->code_start(); i < block->code_end(); ++i) {
Instruction* instr = code()->InstructionAt(i);
- AssembleInstruction(instr, block);
+ CodeGenResult result = AssembleInstruction(instr, block);
+ if (result != kSuccess) return result;
}
+ return kSuccess;
}
-void CodeGenerator::AssembleInstruction(Instruction* instr,
- const InstructionBlock* block) {
+CodeGenerator::CodeGenResult CodeGenerator::AssembleInstruction(
+ Instruction* instr, const InstructionBlock* block) {
AssembleGaps(instr);
DCHECK_IMPLIES(
block->must_deconstruct_frame(),
@@ -321,7 +328,8 @@
}
AssembleSourcePosition(instr);
// Assemble architecture-specific code for the instruction.
- AssembleArchInstruction(instr);
+ CodeGenResult result = AssembleArchInstruction(instr);
+ if (result != kSuccess) return result;
FlagsMode mode = FlagsModeField::decode(instr->opcode());
FlagsCondition condition = FlagsConditionField::decode(instr->opcode());
@@ -337,7 +345,7 @@
if (!IsNextInAssemblyOrder(true_rpo)) {
AssembleArchJump(true_rpo);
}
- return;
+ return kSuccess;
}
if (IsNextInAssemblyOrder(true_rpo)) {
// true block is next, can fall through if condition negated.
@@ -379,6 +387,7 @@
break;
}
}
+ return kSuccess;
}
@@ -498,10 +507,6 @@
handlers_.push_back({caught, GetLabel(handler_rpo), masm()->pc_offset()});
}
- if (flags & CallDescriptor::kNeedsNopAfterCall) {
- AddNopForSmiCodeInlining();
- }
-
if (needs_frame_state) {
MarkLazyDeoptSite();
// If the frame state is present, it starts at argument 1 (just after the
@@ -528,7 +533,7 @@
// by calls.)
for (size_t i = 0; i < descriptor->GetSize(); i++) {
InstructionOperand* op = instr->InputAt(frame_state_offset + 1 + i);
- CHECK(op->IsStackSlot() || op->IsDoubleStackSlot() || op->IsImmediate());
+ CHECK(op->IsStackSlot() || op->IsFPStackSlot() || op->IsImmediate());
}
#endif
safepoints()->RecordLazyDeoptimizationIndex(deopt_state_id);
@@ -710,7 +715,7 @@
} else {
CHECK(false);
}
- } else if (op->IsDoubleStackSlot()) {
+ } else if (op->IsFPStackSlot()) {
DCHECK(IsFloatingPoint(type.representation()));
translation->StoreDoubleStackSlot(LocationOperand::cast(op)->index());
} else if (op->IsRegister()) {
@@ -728,7 +733,7 @@
} else {
CHECK(false);
}
- } else if (op->IsDoubleRegister()) {
+ } else if (op->IsFPRegister()) {
DCHECK(IsFloatingPoint(type.representation()));
InstructionOperandConverter converter(this, instr);
translation->StoreDoubleRegister(converter.ToDoubleRegister(op));