Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index b997fd88fe35473538a0a09e473cd93fcf7459be..919a4ec755f5f199eebeef91ec661bf46de8942c 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -19,7 +19,7 @@ void FastNewClosureStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r2 }; |
descriptor->Initialize( |
- ARRAY_SIZE(registers), registers, |
+ MajorKey(), ARRAY_SIZE(registers), registers, |
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry); |
} |
@@ -27,14 +27,14 @@ void FastNewClosureStub::InitializeInterfaceDescriptor( |
void FastNewContextStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r1 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers); |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
} |
void ToNumberStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r0 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers); |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
} |
@@ -42,7 +42,7 @@ void NumberToStringStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r0 }; |
descriptor->Initialize( |
- ARRAY_SIZE(registers), registers, |
+ MajorKey(), ARRAY_SIZE(registers), registers, |
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry); |
} |
@@ -56,9 +56,8 @@ void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
Representation::Smi(), |
Representation::Tagged() }; |
descriptor->Initialize( |
- ARRAY_SIZE(registers), registers, |
- Runtime::FunctionForId( |
- Runtime::kCreateArrayLiteralStubBailout)->entry, |
+ MajorKey(), ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry, |
representations); |
} |
@@ -67,7 +66,7 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r3, r2, r1, r0 }; |
descriptor->Initialize( |
- ARRAY_SIZE(registers), registers, |
+ MajorKey(), ARRAY_SIZE(registers), registers, |
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry); |
} |
@@ -75,7 +74,36 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r2, r3 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers); |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
+} |
+ |
+ |
+void InstanceofStub::InitializeInterfaceDescriptor( |
+ Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) { |
+ Register registers[] = {cp, left(), right()}; |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
+} |
+ |
+ |
+void CallFunctionStub::InitializeInterfaceDescriptor( |
+ Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) { |
+ // r1 function the function to call |
+ Register registers[] = {cp, r1}; |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
+} |
+ |
+ |
+void CallConstructStub::InitializeInterfaceDescriptor( |
+ Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) { |
+ // r0 : number of arguments |
+ // r1 : the function to call |
+ // r2 : feedback vector |
+ // r3 : (only if r2 is not the megamorphic symbol) slot in feedback |
+ // vector (Smi) |
+ // TODO(turbofan): So far we don't gather type feedback and hence skip the |
+ // slot parameter, but ArrayConstructStub needs the vector to be undefined. |
+ Register registers[] = {cp, r0, r1, r2}; |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
} |
@@ -83,7 +111,7 @@ void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r2, r1, r0 }; |
descriptor->Initialize( |
- ARRAY_SIZE(registers), registers, |
+ MajorKey(), ARRAY_SIZE(registers), registers, |
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); |
} |
@@ -93,7 +121,7 @@ void TransitionElementsKindStub::InitializeInterfaceDescriptor( |
Register registers[] = { cp, r0, r1 }; |
Address entry = |
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
FUNCTION_ADDR(entry)); |
} |
@@ -101,7 +129,7 @@ void TransitionElementsKindStub::InitializeInterfaceDescriptor( |
void CompareNilICStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r0 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
FUNCTION_ADDR(CompareNilIC_Miss)); |
descriptor->SetMissHandler( |
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); |
@@ -112,7 +140,7 @@ const Register InterfaceDescriptor::ContextRegister() { return cp; } |
static void InitializeArrayConstructorDescriptor( |
- CodeStubInterfaceDescriptor* descriptor, |
+ CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, |
int constant_stack_parameter_count) { |
// register state |
// cp -- context |
@@ -124,10 +152,8 @@ static void InitializeArrayConstructorDescriptor( |
if (constant_stack_parameter_count == 0) { |
Register registers[] = { cp, r1, r2 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
- deopt_handler, |
- NULL, |
- constant_stack_parameter_count, |
+ descriptor->Initialize(major, ARRAY_SIZE(registers), registers, |
+ deopt_handler, NULL, constant_stack_parameter_count, |
JS_FUNCTION_STUB_MODE); |
} else { |
// stack param count needs (constructor pointer, and single argument) |
@@ -137,19 +163,16 @@ static void InitializeArrayConstructorDescriptor( |
Representation::Tagged(), |
Representation::Tagged(), |
Representation::Integer32() }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
- r0, |
- deopt_handler, |
- representations, |
+ descriptor->Initialize(major, ARRAY_SIZE(registers), registers, r0, |
+ deopt_handler, representations, |
constant_stack_parameter_count, |
- JS_FUNCTION_STUB_MODE, |
- PASS_ARGUMENTS); |
+ JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
} |
} |
static void InitializeInternalArrayConstructorDescriptor( |
- CodeStubInterfaceDescriptor* descriptor, |
+ CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, |
int constant_stack_parameter_count) { |
// register state |
// cp -- context |
@@ -160,10 +183,8 @@ static void InitializeInternalArrayConstructorDescriptor( |
if (constant_stack_parameter_count == 0) { |
Register registers[] = { cp, r1 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
- deopt_handler, |
- NULL, |
- constant_stack_parameter_count, |
+ descriptor->Initialize(major, ARRAY_SIZE(registers), registers, |
+ deopt_handler, NULL, constant_stack_parameter_count, |
JS_FUNCTION_STUB_MODE); |
} else { |
// stack param count needs (constructor pointer, and single argument) |
@@ -172,39 +193,36 @@ static void InitializeInternalArrayConstructorDescriptor( |
Representation::Tagged(), |
Representation::Tagged(), |
Representation::Integer32() }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
- r0, |
- deopt_handler, |
- representations, |
+ descriptor->Initialize(major, ARRAY_SIZE(registers), registers, r0, |
+ deopt_handler, representations, |
constant_stack_parameter_count, |
- JS_FUNCTION_STUB_MODE, |
- PASS_ARGUMENTS); |
+ JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
} |
} |
void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- InitializeArrayConstructorDescriptor(descriptor, 0); |
+ InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 0); |
} |
void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- InitializeArrayConstructorDescriptor(descriptor, 1); |
+ InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 1); |
} |
void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- InitializeArrayConstructorDescriptor(descriptor, -1); |
+ InitializeArrayConstructorDescriptor(MajorKey(), descriptor, -1); |
} |
void ToBooleanStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r0 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
FUNCTION_ADDR(ToBooleanIC_Miss)); |
descriptor->SetMissHandler( |
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); |
@@ -213,26 +231,26 @@ void ToBooleanStub::InitializeInterfaceDescriptor( |
void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- InitializeInternalArrayConstructorDescriptor(descriptor, 0); |
+ InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 0); |
} |
void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- InitializeInternalArrayConstructorDescriptor(descriptor, 1); |
+ InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 1); |
} |
void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- InitializeInternalArrayConstructorDescriptor(descriptor, -1); |
+ InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, -1); |
} |
void BinaryOpICStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r1, r0 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
FUNCTION_ADDR(BinaryOpIC_Miss)); |
descriptor->SetMissHandler( |
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); |
@@ -242,7 +260,7 @@ void BinaryOpICStub::InitializeInterfaceDescriptor( |
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r2, r1, r0 }; |
- descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); |
} |
@@ -250,9 +268,8 @@ void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
void StringAddStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
Register registers[] = { cp, r1, r0 }; |
- descriptor->Initialize( |
- ARRAY_SIZE(registers), registers, |
- Runtime::FunctionForId(Runtime::kStringAdd)->entry); |
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kStringAdd)->entry); |
} |
@@ -1672,8 +1689,6 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
void InstanceofStub::Generate(MacroAssembler* masm) { |
// Call site inlining and patching implies arguments in registers. |
ASSERT(HasArgsInRegisters() || !HasCallSiteInlineCheck()); |
- // ReturnTrueFalse is only implemented for inlined call sites. |
- ASSERT(!ReturnTrueFalseObject() || HasCallSiteInlineCheck()); |
// Fixed register usage throughout the stub: |
const Register object = r0; // Object (lhs). |
@@ -1695,7 +1710,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) { |
// If there is a call site cache don't look in the global cache, but do the |
// real lookup and update the call site cache. |
- if (!HasCallSiteInlineCheck()) { |
+ if (!HasCallSiteInlineCheck() && !ReturnTrueFalseObject()) { |
Label miss; |
__ CompareRoot(function, Heap::kInstanceofCacheFunctionRootIndex); |
__ b(ne, &miss); |
@@ -1751,11 +1766,15 @@ void InstanceofStub::Generate(MacroAssembler* masm) { |
__ ldr(scratch, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
__ ldr(scratch, FieldMemOperand(scratch, Map::kPrototypeOffset)); |
__ jmp(&loop); |
+ Factory* factory = isolate()->factory(); |
__ bind(&is_instance); |
if (!HasCallSiteInlineCheck()) { |
__ mov(r0, Operand(Smi::FromInt(0))); |
__ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); |
+ if (ReturnTrueFalseObject()) { |
+ __ Move(r0, factory->true_value()); |
+ } |
} else { |
// Patch the call site to return true. |
__ LoadRoot(r0, Heap::kTrueValueRootIndex); |
@@ -1777,6 +1796,9 @@ void InstanceofStub::Generate(MacroAssembler* masm) { |
if (!HasCallSiteInlineCheck()) { |
__ mov(r0, Operand(Smi::FromInt(1))); |
__ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); |
+ if (ReturnTrueFalseObject()) { |
+ __ Move(r0, factory->false_value()); |
+ } |
} else { |
// Patch the call site to return false. |
__ LoadRoot(r0, Heap::kFalseValueRootIndex); |
@@ -1806,19 +1828,31 @@ void InstanceofStub::Generate(MacroAssembler* masm) { |
// Null is not instance of anything. |
__ cmp(scratch, Operand(isolate()->factory()->null_value())); |
__ b(ne, &object_not_null); |
- __ mov(r0, Operand(Smi::FromInt(1))); |
+ if (ReturnTrueFalseObject()) { |
+ __ Move(r0, factory->false_value()); |
+ } else { |
+ __ mov(r0, Operand(Smi::FromInt(1))); |
+ } |
__ Ret(HasArgsInRegisters() ? 0 : 2); |
__ bind(&object_not_null); |
// Smi values are not instances of anything. |
__ JumpIfNotSmi(object, &object_not_null_or_smi); |
- __ mov(r0, Operand(Smi::FromInt(1))); |
+ if (ReturnTrueFalseObject()) { |
+ __ Move(r0, factory->false_value()); |
+ } else { |
+ __ mov(r0, Operand(Smi::FromInt(1))); |
+ } |
__ Ret(HasArgsInRegisters() ? 0 : 2); |
__ bind(&object_not_null_or_smi); |
// String values are not instances of anything. |
__ IsObjectJSStringType(object, scratch, &slow); |
- __ mov(r0, Operand(Smi::FromInt(1))); |
+ if (ReturnTrueFalseObject()) { |
+ __ Move(r0, factory->false_value()); |
+ } else { |
+ __ mov(r0, Operand(Smi::FromInt(1))); |
+ } |
__ Ret(HasArgsInRegisters() ? 0 : 2); |
// Slow-case. Tail call builtin. |