| Index: src/ia32/code-stubs-ia32.cc
|
| diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
|
| index 1dfd62f9f5ebe3852b69b0b308d0cd0086ecc959..f1a5461d96d65ae674c93a37e72959abe1ca0568 100644
|
| --- a/src/ia32/code-stubs-ia32.cc
|
| +++ b/src/ia32/code-stubs-ia32.cc
|
| @@ -21,7 +21,7 @@ namespace internal {
|
|
|
| void FastNewClosureStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { ebx };
|
| + Register registers[] = { esi, ebx };
|
| descriptor->Initialize(
|
| ARRAY_SIZE(registers), registers,
|
| Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
|
| @@ -30,21 +30,22 @@ void FastNewClosureStub::InitializeInterfaceDescriptor(
|
|
|
| void FastNewContextStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { edi };
|
| + Register registers[] = { esi, edi };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers);
|
| }
|
|
|
|
|
| void ToNumberStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { eax };
|
| + // ToNumberStub invokes a function, and therefore needs a context.
|
| + Register registers[] = { esi, eax };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers);
|
| }
|
|
|
|
|
| void NumberToStringStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { eax };
|
| + Register registers[] = { esi, eax };
|
| descriptor->Initialize(
|
| ARRAY_SIZE(registers), registers,
|
| Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
|
| @@ -53,9 +54,10 @@ void NumberToStringStub::InitializeInterfaceDescriptor(
|
|
|
| void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { eax, ebx, ecx };
|
| + Register registers[] = { esi, eax, ebx, ecx };
|
| Representation representations[] = {
|
| Representation::Tagged(),
|
| + Representation::Tagged(),
|
| Representation::Smi(),
|
| Representation::Tagged() };
|
|
|
| @@ -69,7 +71,7 @@ void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
|
|
|
| void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { eax, ebx, ecx, edx };
|
| + Register registers[] = { esi, eax, ebx, ecx, edx };
|
| descriptor->Initialize(
|
| ARRAY_SIZE(registers), registers,
|
| Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
|
| @@ -78,14 +80,14 @@ void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
|
|
|
| void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { ebx, edx };
|
| + Register registers[] = { esi, ebx, edx };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers);
|
| }
|
|
|
|
|
| void RegExpConstructResultStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { ecx, ebx, eax };
|
| + Register registers[] = { esi, ecx, ebx, eax };
|
| descriptor->Initialize(
|
| ARRAY_SIZE(registers), registers,
|
| Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
|
| @@ -94,13 +96,16 @@ void RegExpConstructResultStub::InitializeInterfaceDescriptor(
|
|
|
| void TransitionElementsKindStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { eax, ebx };
|
| + Register registers[] = { esi, eax, ebx };
|
| descriptor->Initialize(
|
| ARRAY_SIZE(registers), registers,
|
| Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry);
|
| }
|
|
|
|
|
| +const Register InterfaceDescriptor::ContextRegister() { return esi; }
|
| +
|
| +
|
| static void InitializeArrayConstructorDescriptor(
|
| Isolate* isolate,
|
| CodeStubInterfaceDescriptor* descriptor,
|
| @@ -113,7 +118,7 @@ static void InitializeArrayConstructorDescriptor(
|
| Runtime::kArrayConstructor)->entry;
|
|
|
| if (constant_stack_parameter_count == 0) {
|
| - Register registers[] = { edi, ebx };
|
| + Register registers[] = { esi, edi, ebx };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| deopt_handler,
|
| NULL,
|
| @@ -121,10 +126,11 @@ static void InitializeArrayConstructorDescriptor(
|
| JS_FUNCTION_STUB_MODE);
|
| } else {
|
| // stack param count needs (constructor pointer, and single argument)
|
| - Register registers[] = { edi, ebx, eax };
|
| + Register registers[] = { esi, edi, ebx, eax };
|
| Representation representations[] = {
|
| Representation::Tagged(),
|
| Representation::Tagged(),
|
| + Representation::Tagged(),
|
| Representation::Integer32() };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| eax,
|
| @@ -147,7 +153,7 @@ static void InitializeInternalArrayConstructorDescriptor(
|
| Runtime::kInternalArrayConstructor)->entry;
|
|
|
| if (constant_stack_parameter_count == 0) {
|
| - Register registers[] = { edi };
|
| + Register registers[] = { esi, edi };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| deopt_handler,
|
| NULL,
|
| @@ -155,9 +161,10 @@ static void InitializeInternalArrayConstructorDescriptor(
|
| JS_FUNCTION_STUB_MODE);
|
| } else {
|
| // stack param count needs (constructor pointer, and single argument)
|
| - Register registers[] = { edi, eax };
|
| + Register registers[] = { esi, edi, eax };
|
| Representation representations[] = {
|
| Representation::Tagged(),
|
| + Representation::Tagged(),
|
| Representation::Integer32() };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| eax,
|
| @@ -208,7 +215,7 @@ void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor(
|
|
|
| void CompareNilICStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { eax };
|
| + Register registers[] = { esi, eax };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| FUNCTION_ADDR(CompareNilIC_Miss));
|
| descriptor->SetMissHandler(
|
| @@ -217,7 +224,7 @@ void CompareNilICStub::InitializeInterfaceDescriptor(
|
|
|
| void ToBooleanStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { eax };
|
| + Register registers[] = { esi, eax };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| FUNCTION_ADDR(ToBooleanIC_Miss));
|
| descriptor->SetMissHandler(
|
| @@ -227,7 +234,7 @@ void ToBooleanStub::InitializeInterfaceDescriptor(
|
|
|
| void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { eax, ebx, ecx, edx };
|
| + Register registers[] = { esi, eax, ebx, ecx, edx };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss));
|
| }
|
| @@ -235,7 +242,7 @@ void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
|
|
|
| void BinaryOpICStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { edx, eax };
|
| + Register registers[] = { esi, edx, eax };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| FUNCTION_ADDR(BinaryOpIC_Miss));
|
| descriptor->SetMissHandler(
|
| @@ -245,7 +252,7 @@ void BinaryOpICStub::InitializeInterfaceDescriptor(
|
|
|
| void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { ecx, edx, eax };
|
| + Register registers[] = { esi, ecx, edx, eax };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers,
|
| FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
|
| }
|
| @@ -253,7 +260,7 @@ void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
|
|
|
| void StringAddStub::InitializeInterfaceDescriptor(
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| - Register registers[] = { edx, eax };
|
| + Register registers[] = { esi, edx, eax };
|
| descriptor->Initialize(
|
| ARRAY_SIZE(registers), registers,
|
| Runtime::FunctionForId(Runtime::kStringAdd)->entry);
|
| @@ -264,14 +271,14 @@ void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
|
| {
|
| CallInterfaceDescriptor* descriptor =
|
| isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
|
| - Register registers[] = { edi, // JSFunction
|
| - esi, // context
|
| + Register registers[] = { esi, // context
|
| + edi, // JSFunction
|
| eax, // actual number of arguments
|
| ebx, // expected number of arguments
|
| };
|
| Representation representations[] = {
|
| - Representation::Tagged(), // JSFunction
|
| Representation::Tagged(), // context
|
| + Representation::Tagged(), // JSFunction
|
| Representation::Integer32(), // actual number of arguments
|
| Representation::Integer32(), // expected number of arguments
|
| };
|
| @@ -305,29 +312,29 @@ void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
|
| CallInterfaceDescriptor* descriptor =
|
| isolate->call_descriptor(Isolate::CallHandler);
|
| Register registers[] = { esi, // context
|
| - edx, // receiver
|
| + edx, // name
|
| };
|
| Representation representations[] = {
|
| - Representation::Tagged(), // context
|
| - Representation::Tagged(), // receiver
|
| + Representation::Tagged(), // context
|
| + Representation::Tagged(), // receiver
|
| };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
|
| }
|
| {
|
| CallInterfaceDescriptor* descriptor =
|
| isolate->call_descriptor(Isolate::ApiFunctionCall);
|
| - Register registers[] = { eax, // callee
|
| + Register registers[] = { esi, // context
|
| + eax, // callee
|
| ebx, // call_data
|
| ecx, // holder
|
| edx, // api_function_address
|
| - esi, // context
|
| };
|
| Representation representations[] = {
|
| + Representation::Tagged(), // context
|
| Representation::Tagged(), // callee
|
| Representation::Tagged(), // call_data
|
| Representation::Tagged(), // holder
|
| Representation::External(), // api_function_address
|
| - Representation::Tagged(), // context
|
| };
|
| descriptor->Initialize(ARRAY_SIZE(registers), registers, representations);
|
| }
|
| @@ -342,18 +349,22 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) {
|
| isolate()->counters()->code_stubs()->Increment();
|
|
|
| CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor();
|
| - int param_count = descriptor->register_param_count();
|
| + // The descriptor counts the context register as a (mandatory) parameter.
|
| + ASSERT(descriptor->register_param_count() > 0);
|
| + int param_count = descriptor->register_param_count() - 1;
|
| {
|
| - // Call the runtime system in a fresh internal frame.
|
| + // Call the runtime system in a fresh internal frame. Note that we remove
|
| + // the context register parameter, and don't include it in the pushed
|
| + // arguments as it is treated separately.
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| - ASSERT(descriptor->register_param_count() == 0 ||
|
| - eax.is(descriptor->GetParameterRegister(param_count - 1)));
|
| - // Push arguments
|
| + ASSERT(param_count == 0 ||
|
| + eax.is(descriptor->GetParameterRegister(param_count)));
|
| + // Push arguments (skipping context register).
|
| for (int i = 0; i < param_count; ++i) {
|
| - __ push(descriptor->GetParameterRegister(i));
|
| + __ push(descriptor->GetParameterRegister(i + 1));
|
| }
|
| ExternalReference miss = descriptor->miss_handler();
|
| - __ CallExternalReference(miss, descriptor->register_param_count());
|
| + __ CallExternalReference(miss, param_count);
|
| }
|
|
|
| __ ret(0);
|
|
|