Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 1922697c7bf8fc1e3b6956eeefbb7a974d3c4fcd..ae8fe8d65a1ab30cc64b080f875915dc8a251b8b 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -37,6 +37,8 @@ namespace v8 { |
namespace internal { |
+// When invoking builtins, we need to record the safepoint in the middle of |
+// the invoke instruction sequence generated by the macro assembler. |
class SafepointGenerator : public PostCallGenerator { |
public: |
SafepointGenerator(LCodeGen* codegen, |
@@ -366,17 +368,11 @@ void LCodeGen::AddToTranslation(Translation* translation, |
void LCodeGen::CallCode(Handle<Code> code, |
RelocInfo::Mode mode, |
LInstruction* instr) { |
- if (instr != NULL) { |
- LPointerMap* pointers = instr->pointer_map(); |
- RecordPosition(pointers->position()); |
- __ call(code, mode); |
- RegisterLazyDeoptimization(instr); |
- } else { |
- LPointerMap no_pointers(0); |
- RecordPosition(no_pointers.position()); |
- __ call(code, mode); |
- RecordSafepoint(&no_pointers, Safepoint::kNoDeoptimizationIndex); |
- } |
+ ASSERT(instr != NULL); |
+ LPointerMap* pointers = instr->pointer_map(); |
+ RecordPosition(pointers->position()); |
+ __ call(code, mode); |
+ RegisterLazyDeoptimization(instr); |
// Signal that we don't inline smi code before these stubs in the |
// optimizing code generator. |
@@ -391,22 +387,12 @@ void LCodeGen::CallRuntime(Runtime::Function* function, |
int num_arguments, |
LInstruction* instr) { |
ASSERT(instr != NULL); |
+ ASSERT(instr->HasPointerMap()); |
LPointerMap* pointers = instr->pointer_map(); |
- ASSERT(pointers != NULL); |
RecordPosition(pointers->position()); |
__ CallRuntime(function, num_arguments); |
- // Runtime calls to Throw are not supposed to ever return at the |
- // call site, so don't register lazy deoptimization for these. We do |
- // however have to record a safepoint since throwing exceptions can |
- // cause garbage collections. |
- // BUG(3243555): register a lazy deoptimization point at throw. We need |
- // it to be able to inline functions containing a throw statement. |
- if (!instr->IsThrow()) { |
- RegisterLazyDeoptimization(instr); |
- } else { |
- RecordSafepoint(instr->pointer_map(), Safepoint::kNoDeoptimizationIndex); |
- } |
+ RegisterLazyDeoptimization(instr); |
} |
@@ -2145,11 +2131,16 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
// Invoke the function. |
__ bind(&invoke); |
+ ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
+ LPointerMap* pointers = instr->pointer_map(); |
+ LEnvironment* env = instr->deoptimization_environment(); |
+ RecordPosition(pointers->position()); |
+ RegisterEnvironmentForDeoptimization(env); |
+ SafepointGenerator safepoint_generator(this, |
+ pointers, |
+ env->deoptimization_index()); |
ASSERT(receiver.is(eax)); |
v8::internal::ParameterCount actual(eax); |
- SafepointGenerator safepoint_generator(this, |
- instr->pointer_map(), |
- Safepoint::kNoDeoptimizationIndex); |
__ InvokeFunction(edi, actual, CALL_FUNCTION, &safepoint_generator); |
} |
@@ -3577,10 +3568,14 @@ void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { |
} else { |
__ push(ToOperand(key)); |
} |
- RecordPosition(instr->pointer_map()->position()); |
+ ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
+ LPointerMap* pointers = instr->pointer_map(); |
+ LEnvironment* env = instr->deoptimization_environment(); |
+ RecordPosition(pointers->position()); |
+ RegisterEnvironmentForDeoptimization(env); |
SafepointGenerator safepoint_generator(this, |
- instr->pointer_map(), |
- Safepoint::kNoDeoptimizationIndex); |
+ pointers, |
+ env->deoptimization_index()); |
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator); |
} |