Index: src/arm/lithium-arm.cc |
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc |
index 6fdbbb58934c0e852df086b589f55edab6f85905..efed5f282b7f3e875e1fd952d179b340ca78c635 100644 |
--- a/src/arm/lithium-arm.cc |
+++ b/src/arm/lithium-arm.cc |
@@ -779,10 +779,11 @@ LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
HValue* right = instr->right(); |
ASSERT(left->representation().IsTagged()); |
ASSERT(right->representation().IsTagged()); |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* left_operand = UseFixed(left, r1); |
LOperand* right_operand = UseFixed(right, r0); |
LArithmeticT* result = |
- new(zone()) LArithmeticT(op, left_operand, right_operand); |
+ new(zone()) LArithmeticT(op, context, left_operand, right_operand); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
@@ -1044,9 +1045,10 @@ LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { |
LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LInstanceOf* result = |
- new(zone()) LInstanceOf(UseFixed(instr->left(), r0), |
- UseFixed(instr->right(), r1)); |
+ new(zone()) LInstanceOf(context, UseFixed(instr->left(), r0), |
+ UseFixed(instr->right(), r1)); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
@@ -1054,8 +1056,10 @@ LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { |
LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( |
HInstanceOfKnownGlobal* instr) { |
LInstanceOfKnownGlobal* result = |
- new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), r0), |
- FixedTemp(r4)); |
+ new(zone()) LInstanceOfKnownGlobal( |
+ UseFixed(instr->context(), cp), |
+ UseFixed(instr->left(), r0), |
+ FixedTemp(r4)); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
@@ -1119,14 +1123,13 @@ LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
- // If there is a non-return use, the context must be allocated in a register. |
- for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { |
- if (!it.value()->IsReturn()) { |
- return DefineAsRegister(new(zone()) LContext); |
- } |
+ if (instr->HasNoUses()) return NULL; |
+ |
+ if (info()->IsStub()) { |
+ return DefineFixed(new(zone()) LContext, cp); |
} |
- return NULL; |
+ return DefineAsRegister(new(zone()) LContext); |
} |
@@ -1137,7 +1140,8 @@ LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { |
LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { |
- return MarkAsCall(new(zone()) LDeclareGlobals, instr); |
+ LOperand* context = UseFixed(instr->context(), cp); |
+ return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); |
} |
@@ -1161,9 +1165,10 @@ LInstruction* LChunkBuilder::DoCallConstantFunction( |
LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* function = UseFixed(instr->function(), r1); |
argument_count_ -= instr->argument_count(); |
- LInvokeFunction* result = new(zone()) LInvokeFunction(function); |
+ LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
} |
@@ -1203,8 +1208,12 @@ LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { |
LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { |
+ Representation r = instr->value()->representation(); |
+ LOperand* context = (r.IsDouble() || r.IsSmiOrInteger32()) |
+ ? NULL |
+ : UseFixed(instr->context(), cp); |
ulan
2013/09/27 12:08:00
I think we can use UseAny here because the context
vincent.belliard.fr
2013/09/27 12:37:04
If we use UseAny, the context will we copied into
ulan
2013/09/27 12:44:13
OK, let's leave UseFixed.
|
LOperand* input = UseRegister(instr->value()); |
- LMathAbs* result = new(zone()) LMathAbs(input); |
+ LMathAbs* result = new(zone()) LMathAbs(context, input); |
return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
} |
@@ -1266,21 +1275,25 @@ LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
ASSERT(instr->key()->representation().IsTagged()); |
+ LOperand* context = UseFixed(instr->context(), cp); |
argument_count_ -= instr->argument_count(); |
LOperand* key = UseFixed(instr->key(), r2); |
- return MarkAsCall(DefineFixed(new(zone()) LCallKeyed(key), r0), instr); |
+ return MarkAsCall( |
+ DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr); |
} |
LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
argument_count_ -= instr->argument_count(); |
- return MarkAsCall(DefineFixed(new(zone()) LCallNamed, r0), instr); |
+ return MarkAsCall(DefineFixed(new(zone()) LCallNamed(context), r0), instr); |
} |
LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
argument_count_ -= instr->argument_count(); |
- return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, r0), instr); |
+ return MarkAsCall(DefineFixed(new(zone()) LCallGlobal(context), r0), instr); |
} |
@@ -1291,32 +1304,36 @@ LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* constructor = UseFixed(instr->constructor(), r1); |
argument_count_ -= instr->argument_count(); |
- LCallNew* result = new(zone()) LCallNew(constructor); |
+ LCallNew* result = new(zone()) LCallNew(context, constructor); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* constructor = UseFixed(instr->constructor(), r1); |
argument_count_ -= instr->argument_count(); |
- LCallNewArray* result = new(zone()) LCallNewArray(constructor); |
+ LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* function = UseFixed(instr->function(), r1); |
argument_count_ -= instr->argument_count(); |
- return MarkAsCall(DefineFixed(new(zone()) LCallFunction(function), r0), |
- instr); |
+ return MarkAsCall( |
+ DefineFixed(new(zone()) LCallFunction(context, function), r0), instr); |
} |
LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
argument_count_ -= instr->argument_count(); |
- return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, r0), instr); |
+ LOperand* context = UseFixed(instr->context(), cp); |
+ return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), r0), instr); |
} |
@@ -1719,9 +1736,10 @@ LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { |
LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
ASSERT(instr->left()->representation().IsTagged()); |
ASSERT(instr->right()->representation().IsTagged()); |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* left = UseFixed(instr->left(), r1); |
LOperand* right = UseFixed(instr->right(), r0); |
- LCmpT* result = new(zone()) LCmpT(left, right); |
+ LCmpT* result = new(zone()) LCmpT(context, left, right); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
@@ -1795,10 +1813,11 @@ LInstruction* LChunkBuilder::DoStringCompareAndBranch( |
HStringCompareAndBranch* instr) { |
ASSERT(instr->left()->representation().IsTagged()); |
ASSERT(instr->right()->representation().IsTagged()); |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* left = UseFixed(instr->left(), r1); |
LOperand* right = UseFixed(instr->right(), r0); |
LStringCompareAndBranch* result = |
- new(zone()) LStringCompareAndBranch(left, right); |
+ new(zone()) LStringCompareAndBranch(context, left, right); |
return MarkAsCall(result, instr); |
} |
@@ -1886,8 +1905,9 @@ LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation( |
LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* value = UseFixed(instr->value(), r0); |
- return MarkAsCall(new(zone()) LThrow(value), instr); |
+ return MarkAsCall(new(zone()) LThrow(context, value), instr); |
} |
@@ -2067,8 +2087,11 @@ LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
+ LOperand* context = info()->IsStub() |
+ ? UseFixed(instr->context(), cp) |
+ : NULL; |
LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); |
- return new(zone()) LReturn(UseFixed(instr->value(), r0), |
+ return new(zone()) LReturn(UseFixed(instr->value(), r0), context, |
parameter_count); |
} |
@@ -2101,8 +2124,10 @@ LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* global_object = UseFixed(instr->global_object(), r0); |
- LLoadGlobalGeneric* result = new(zone()) LLoadGlobalGeneric(global_object); |
+ LLoadGlobalGeneric* result = |
+ new(zone()) LLoadGlobalGeneric(context, global_object); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
@@ -2118,10 +2143,11 @@ LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { |
LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* global_object = UseFixed(instr->global_object(), r1); |
LOperand* value = UseFixed(instr->value(), r0); |
LStoreGlobalGeneric* result = |
- new(zone()) LStoreGlobalGeneric(global_object, value); |
+ new(zone()) LStoreGlobalGeneric(context, global_object, value); |
return MarkAsCall(result, instr); |
} |
@@ -2156,8 +2182,10 @@ LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* object = UseFixed(instr->object(), r0); |
- LInstruction* result = DefineFixed(new(zone()) LLoadNamedGeneric(object), r0); |
+ LInstruction* result = |
+ DefineFixed(new(zone()) LLoadNamedGeneric(context, object), r0); |
return MarkAsCall(result, instr); |
} |
@@ -2218,11 +2246,12 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* object = UseFixed(instr->object(), r1); |
LOperand* key = UseFixed(instr->key(), r0); |
LInstruction* result = |
- DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); |
+ DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), r0); |
return MarkAsCall(result, instr); |
} |
@@ -2271,6 +2300,7 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* obj = UseFixed(instr->object(), r2); |
LOperand* key = UseFixed(instr->key(), r1); |
LOperand* val = UseFixed(instr->value(), r0); |
@@ -2279,7 +2309,8 @@ LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
ASSERT(instr->key()->representation().IsTagged()); |
ASSERT(instr->value()->representation().IsTagged()); |
- return MarkAsCall(new(zone()) LStoreKeyedGeneric(obj, key, val), instr); |
+ return MarkAsCall( |
+ new(zone()) LStoreKeyedGeneric(context, obj, key, val), instr); |
} |
@@ -2289,11 +2320,12 @@ LInstruction* LChunkBuilder::DoTransitionElementsKind( |
if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { |
LOperand* new_map_reg = TempRegister(); |
LTransitionElementsKind* result = |
- new(zone()) LTransitionElementsKind(object, new_map_reg); |
+ new(zone()) LTransitionElementsKind(object, NULL, new_map_reg); |
return result; |
} else { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LTransitionElementsKind* result = |
- new(zone()) LTransitionElementsKind(object, NULL); |
+ new(zone()) LTransitionElementsKind(object, context, NULL); |
return AssignPointerMap(result); |
} |
} |
@@ -2352,56 +2384,68 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* obj = UseFixed(instr->object(), r1); |
LOperand* val = UseFixed(instr->value(), r0); |
- LInstruction* result = new(zone()) LStoreNamedGeneric(obj, val); |
+ LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); |
return MarkAsCall(result, instr); |
} |
LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* left = UseRegisterAtStart(instr->left()); |
LOperand* right = UseRegisterAtStart(instr->right()); |
- return MarkAsCall(DefineFixed(new(zone()) LStringAdd(left, right), r0), |
- instr); |
+ return MarkAsCall( |
+ DefineFixed(new(zone()) LStringAdd(context, left, right), r0), |
+ instr); |
} |
LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
LOperand* string = UseTempRegister(instr->string()); |
LOperand* index = UseTempRegister(instr->index()); |
- LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index); |
+ LOperand* context = UseAny(instr->context()); |
+ LStringCharCodeAt* result = |
+ new(zone()) LStringCharCodeAt(context, string, index); |
return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
} |
LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
LOperand* char_code = UseRegister(instr->value()); |
- LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); |
+ LOperand* context = UseAny(instr->context()); |
+ LStringCharFromCode* result = |
+ new(zone()) LStringCharFromCode(context, char_code); |
return AssignPointerMap(DefineAsRegister(result)); |
} |
LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { |
info()->MarkAsDeferredCalling(); |
+ LOperand* context = UseAny(instr->context()); |
LOperand* size = instr->size()->IsConstant() |
? UseConstant(instr->size()) |
: UseTempRegister(instr->size()); |
LOperand* temp1 = TempRegister(); |
LOperand* temp2 = TempRegister(); |
- LAllocate* result = new(zone()) LAllocate(size, temp1, temp2); |
+ LAllocate* result = new(zone()) LAllocate(context, size, temp1, temp2); |
return AssignPointerMap(DefineAsRegister(result)); |
} |
LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { |
- return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, r0), instr); |
+ LOperand* context = UseFixed(instr->context(), cp); |
+ return MarkAsCall( |
+ DefineFixed(new(zone()) LRegExpLiteral(context), r0), instr); |
} |
LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
- return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, r0), instr); |
+ LOperand* context = UseFixed(instr->context(), cp); |
+ return MarkAsCall( |
+ DefineFixed(new(zone()) LFunctionLiteral(context), r0), instr); |
} |
@@ -2448,8 +2492,9 @@ LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
argument_count_ -= instr->argument_count(); |
- return MarkAsCall(DefineFixed(new(zone()) LCallStub, r0), instr); |
+ return MarkAsCall(DefineFixed(new(zone()) LCallStub(context), r0), instr); |
} |
@@ -2494,7 +2539,8 @@ LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
- LTypeof* result = new(zone()) LTypeof(UseFixed(instr->value(), r0)); |
+ LOperand* context = UseFixed(instr->context(), cp); |
+ LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0)); |
return MarkAsCall(DefineFixed(result, r0), instr); |
} |
@@ -2533,10 +2579,13 @@ LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
if (instr->is_function_entry()) { |
- return MarkAsCall(new(zone()) LStackCheck, instr); |
+ LOperand* context = UseFixed(instr->context(), cp); |
+ return MarkAsCall(new(zone()) LStackCheck(context), instr); |
} else { |
ASSERT(instr->is_backwards_branch()); |
- return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck)); |
+ LOperand* context = UseAny(instr->context()); |
+ return AssignEnvironment( |
+ AssignPointerMap(new(zone()) LStackCheck(context))); |
} |
} |
@@ -2581,8 +2630,9 @@ LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { |
+ LOperand* context = UseFixed(instr->context(), cp); |
LOperand* object = UseFixed(instr->enumerable(), r0); |
- LForInPrepareMap* result = new(zone()) LForInPrepareMap(object); |
+ LForInPrepareMap* result = new(zone()) LForInPrepareMap(context, object); |
return MarkAsCall(DefineFixed(result, r0), instr, CAN_DEOPTIMIZE_EAGERLY); |
} |