Index: src/compiler/code-generator.cc |
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
index 098e2257bbc5aa0921f5db746b620a3dae87c175..e5e2bccda6cd8596c8dda10ca2b93a82600bb069 100644 |
--- a/src/compiler/code-generator.cc |
+++ b/src/compiler/code-generator.cc |
@@ -156,12 +156,14 @@ Handle<Code> CodeGenerator::GenerateCode() { |
} |
} |
+ 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>(); |
} |
} |
@@ -304,15 +306,18 @@ bool CodeGenerator::IsMaterializableFromRoot( |
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(), |
@@ -323,7 +328,8 @@ void CodeGenerator::AssembleInstruction(Instruction* instr, |
} |
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()); |
@@ -339,7 +345,7 @@ void CodeGenerator::AssembleInstruction(Instruction* instr, |
if (!IsNextInAssemblyOrder(true_rpo)) { |
AssembleArchJump(true_rpo); |
} |
- return; |
+ return kSuccess; |
} |
if (IsNextInAssemblyOrder(true_rpo)) { |
// true block is next, can fall through if condition negated. |
@@ -381,6 +387,7 @@ void CodeGenerator::AssembleInstruction(Instruction* instr, |
break; |
} |
} |
+ return kSuccess; |
} |