Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: src/ia32/code-stubs-ia32.cc

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/assembler-ia32-inl.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index 8679b471e37c44bf97e7f8d857891aec14ef716c..00574367440093db162bc90ab23438c832b5615d 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -23,7 +23,7 @@ void FastNewClosureStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ebx };
descriptor->Initialize(
- ARRAY_SIZE(registers), registers,
+ MajorKey(), ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
@@ -31,7 +31,7 @@ void FastNewClosureStub::InitializeInterfaceDescriptor(
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edi };
- descriptor->Initialize(ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
}
@@ -39,7 +39,7 @@ void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
// ToNumberStub invokes a function, and therefore needs a context.
Register registers[] = { esi, eax };
- descriptor->Initialize(ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
}
@@ -47,7 +47,7 @@ void NumberToStringStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
descriptor->Initialize(
- ARRAY_SIZE(registers), registers,
+ MajorKey(), ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
@@ -62,9 +62,8 @@ void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
Representation::Tagged() };
descriptor->Initialize(
- ARRAY_SIZE(registers), registers,
- Runtime::FunctionForId(
- Runtime::kCreateArrayLiteralStubBailout)->entry,
+ MajorKey(), ARRAY_SIZE(registers), registers,
+ Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
@@ -73,7 +72,7 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx, ecx, edx };
descriptor->Initialize(
- ARRAY_SIZE(registers), registers,
+ MajorKey(), ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
@@ -81,7 +80,35 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ebx, edx };
- descriptor->Initialize(ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+}
+
+
+void InstanceofStub::InitializeInterfaceDescriptor(
+ Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) {
+ Register registers[] = {esi, left(), right()};
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+}
+
+
+void CallFunctionStub::InitializeInterfaceDescriptor(
+ Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) {
+ Register registers[] = {esi, edi};
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+}
+
+
+void CallConstructStub::InitializeInterfaceDescriptor(
+ Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) {
+ // eax : number of arguments
+ // ebx : feedback vector
+ // edx : (only if ebx is not the megamorphic symbol) slot in feedback
+ // vector (Smi)
+ // edi : constructor function
+ // 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[] = {esi, eax, edi, ebx};
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
}
@@ -89,7 +116,7 @@ void RegExpConstructResultStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ecx, ebx, eax };
descriptor->Initialize(
- ARRAY_SIZE(registers), registers,
+ MajorKey(), ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
@@ -98,7 +125,7 @@ void TransitionElementsKindStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx };
descriptor->Initialize(
- ARRAY_SIZE(registers), registers,
+ MajorKey(), ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry);
}
@@ -107,7 +134,7 @@ const Register InterfaceDescriptor::ContextRegister() { return esi; }
static void InitializeArrayConstructorDescriptor(
- Isolate* isolate,
+ Isolate* isolate, CodeStub::Major major,
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) {
// register state
@@ -119,10 +146,8 @@ static void InitializeArrayConstructorDescriptor(
if (constant_stack_parameter_count == 0) {
Register registers[] = { esi, edi, ebx };
- 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)
@@ -132,19 +157,16 @@ static void InitializeArrayConstructorDescriptor(
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
- eax,
- deopt_handler,
- representations,
+ descriptor->Initialize(major, ARRAY_SIZE(registers), registers, eax,
+ 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
// eax -- number of arguments
@@ -154,10 +176,8 @@ static void InitializeInternalArrayConstructorDescriptor(
if (constant_stack_parameter_count == 0) {
Register registers[] = { esi, edi };
- 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)
@@ -166,57 +186,54 @@ static void InitializeInternalArrayConstructorDescriptor(
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
- eax,
- deopt_handler,
- representations,
+ descriptor->Initialize(major, ARRAY_SIZE(registers), registers, eax,
+ 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(isolate(), descriptor, 0);
+ InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0);
}
void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- InitializeArrayConstructorDescriptor(isolate(), descriptor, 1);
+ InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1);
}
void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
+ InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1);
}
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 CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
- 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()));
@@ -225,7 +242,7 @@ void CompareNilICStub::InitializeInterfaceDescriptor(
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
- 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()));
@@ -235,7 +252,7 @@ void ToBooleanStub::InitializeInterfaceDescriptor(
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edx, eax };
- 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()));
@@ -245,7 +262,7 @@ void BinaryOpICStub::InitializeInterfaceDescriptor(
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ecx, edx, eax };
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
@@ -253,9 +270,8 @@ void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edx, eax };
- descriptor->Initialize(
- ARRAY_SIZE(registers), registers,
- Runtime::FunctionForId(Runtime::kStringAdd)->entry);
+ descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
@@ -2783,7 +2799,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()) {
// Look up the function and the map in the instanceof cache.
Label miss;
__ CompareRoot(function, scratch, Heap::kInstanceofCacheFunctionRootIndex);
@@ -2842,6 +2858,9 @@ void InstanceofStub::Generate(MacroAssembler* masm) {
if (!HasCallSiteInlineCheck()) {
__ mov(eax, Immediate(0));
__ StoreRoot(eax, scratch, Heap::kInstanceofCacheAnswerRootIndex);
+ if (ReturnTrueFalseObject()) {
+ __ mov(eax, factory->true_value());
+ }
} else {
// Get return address and delta to inlined map check.
__ mov(eax, factory->true_value());
@@ -2862,6 +2881,9 @@ void InstanceofStub::Generate(MacroAssembler* masm) {
if (!HasCallSiteInlineCheck()) {
__ mov(eax, Immediate(Smi::FromInt(1)));
__ StoreRoot(eax, scratch, Heap::kInstanceofCacheAnswerRootIndex);
+ if (ReturnTrueFalseObject()) {
+ __ mov(eax, factory->false_value());
+ }
} else {
// Get return address and delta to inlined map check.
__ mov(eax, factory->false_value());
@@ -2889,20 +2911,32 @@ void InstanceofStub::Generate(MacroAssembler* masm) {
// Null is not instance of anything.
__ cmp(object, factory->null_value());
__ j(not_equal, &object_not_null, Label::kNear);
- __ Move(eax, Immediate(Smi::FromInt(1)));
+ if (ReturnTrueFalseObject()) {
+ __ mov(eax, factory->false_value());
+ } else {
+ __ Move(eax, Immediate(Smi::FromInt(1)));
+ }
__ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize);
__ bind(&object_not_null);
// Smi values is not instance of anything.
__ JumpIfNotSmi(object, &object_not_null_or_smi, Label::kNear);
- __ Move(eax, Immediate(Smi::FromInt(1)));
+ if (ReturnTrueFalseObject()) {
+ __ mov(eax, factory->false_value());
+ } else {
+ __ Move(eax, Immediate(Smi::FromInt(1)));
+ }
__ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize);
__ bind(&object_not_null_or_smi);
// String values is not instance of anything.
Condition is_string = masm->IsObjectStringType(object, scratch, scratch);
__ j(NegateCondition(is_string), &slow, Label::kNear);
- __ Move(eax, Immediate(Smi::FromInt(1)));
+ if (ReturnTrueFalseObject()) {
+ __ mov(eax, factory->false_value());
+ } else {
+ __ Move(eax, Immediate(Smi::FromInt(1)));
+ }
__ ret((HasArgsInRegisters() ? 0 : 2) * kPointerSize);
// Slow-case: Go through the JavaScript implementation.
« no previous file with comments | « src/ia32/assembler-ia32-inl.h ('k') | src/ia32/deoptimizer-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698