void FastNewClosureStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r2 };
+ Register registers[] = { cp, r2 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r1 };
+ Register registers[] = { cp, r1 };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r0 };
+ Register registers[] = { cp, r0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void NumberToStringStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r0 };
+ Register registers[] = { cp, r0 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r3, r2, r1 };
+ Register registers[] = { cp, r3, r2, r1 };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Smi(),
Representation::Tagged() };
void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r3, r2, r1, r0 };
+ Register registers[] = { cp, r3, r2, r1, r0 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r2, r3 };
+ Register registers[] = { cp, r2, r3 };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void RegExpConstructResultStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r2, r1, r0 };
+ Register registers[] = { cp, r2, r1, r0 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
void TransitionElementsKindStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r0, r1 };
+ Register registers[] = { cp, r0, r1 };
Address entry =
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
descriptor->Initialize(ARRAY_SIZE(registers), registers,
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r0 };
+ Register registers[] = { cp, r0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
}
+const Register InterfaceDescriptor::ContextRegister() { return cp; }
+
+
static void InitializeArrayConstructorDescriptor(
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) {
// register state
+ // cp -- context
// r0 -- number of arguments
// r1 -- function
// r2 -- allocation site with elements kind
Runtime::kArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
- Register registers[] = { r1, r2 };
+ Register registers[] = { cp, r1, r2 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
deopt_handler,
NULL,
JS_FUNCTION_STUB_MODE);
} else {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = { r1, r2, r0 };
+ Register registers[] = { cp, r1, r2, r0 };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) {
// register state
+ // cp -- context
// r0 -- number of arguments
// r1 -- constructor function
Address deopt_handler = Runtime::FunctionForId(
Runtime::kInternalArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
- Register registers[] = { r1 };
+ Register registers[] = { cp, r1 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
deopt_handler,
NULL,
JS_FUNCTION_STUB_MODE);
} else {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = { r1, r0 };
+ Register registers[] = { cp, r1, r0 };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r0 };
+ Register registers[] = { cp, r0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r1, r0 };
+ Register registers[] = { cp, r1, r0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r2, r1, r0 };
+ Register registers[] = { cp, r2, r1, r0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { r1, r0 };
+ Register registers[] = { cp, r1, r0 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
- static PlatformCallInterfaceDescriptor default_descriptor =
- PlatformCallInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
+ static PlatformInterfaceDescriptor default_descriptor =
+ PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
- static PlatformCallInterfaceDescriptor noInlineDescriptor =
- PlatformCallInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
+ static PlatformInterfaceDescriptor noInlineDescriptor =
+ PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- Register registers[] = { r1, // JSFunction
- cp, // context
+ Register registers[] = { cp, // context
+ r1, // JSFunction
r0, // actual number of arguments
r2, // 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
};
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ApiFunctionCall);
- Register registers[] = { r0, // callee
+ Register registers[] = { cp, // context
+ r0, // callee
r4, // call_data
r2, // holder
r1, // api_function_address
- cp, // 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, &default_descriptor);
isolate()->counters()->code_stubs()->Increment();
CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor();
- int param_count = descriptor->register_param_count();
+ int param_count = descriptor->GetEnvironmentParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
- ASSERT(descriptor->register_param_count() == 0 ||
- r0.is(descriptor->GetParameterRegister(param_count - 1)));
+ ASSERT(param_count == 0 ||
+ r0.is(descriptor->GetEnvironmentParameterRegister(
+ param_count - 1)));
// Push arguments
for (int i = 0; i < param_count; ++i) {
- __ push(descriptor->GetParameterRegister(i));
+ __ push(descriptor->GetEnvironmentParameterRegister(i));
}
ExternalReference miss = descriptor->miss_handler();
- __ CallExternalReference(miss, descriptor->register_param_count());
+ __ CallExternalReference(miss, param_count);
}
__ Ret();
};
-class PlatformCallInterfaceDescriptor {
+class PlatformInterfaceDescriptor {
public:
- explicit PlatformCallInterfaceDescriptor(
+ explicit PlatformInterfaceDescriptor(
TargetAddressStorageMode storage_mode)
: storage_mode_(storage_mode) { }
LInstruction* LChunkBuilder::DoCallWithDescriptor(
HCallWithDescriptor* instr) {
- const CallInterfaceDescriptor* descriptor = instr->descriptor();
+ const InterfaceDescriptor* descriptor = instr->descriptor();
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
CodeStubInterfaceDescriptor* descriptor =
info()->code_stub()->GetInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor->GetParameterRegister(index);
+ Register reg = descriptor->GetEnvironmentParameterRegister(index);
return DefineFixed(result, reg);
}
}
class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
public:
- LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
+ LCallWithDescriptor(const InterfaceDescriptor* descriptor,
const ZoneList<LOperand*>& operands,
Zone* zone)
: descriptor_(descriptor),
- inputs_(descriptor->environment_length() + 1, zone) {
- ASSERT(descriptor->environment_length() + 1 == operands.length());
+ inputs_(descriptor->GetRegisterParameterCount() + 1, zone) {
+ ASSERT(descriptor->GetRegisterParameterCount() + 1 == operands.length());
inputs_.AddAll(operands, zone);
}
LOperand* target() const { return inputs_[0]; }
- const CallInterfaceDescriptor* descriptor() { return descriptor_; }
+ const InterfaceDescriptor* descriptor() { return descriptor_; }
private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
int arity() const { return hydrogen()->argument_count() - 1; }
- const CallInterfaceDescriptor* descriptor_;
+ const InterfaceDescriptor* descriptor_;
ZoneList<LOperand*> inputs_;
// Iterator support.
LConstantOperand* target = LConstantOperand::cast(instr->target());
Handle<Code> code = Handle<Code>::cast(ToHandle(target));
generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET));
- PlatformCallInterfaceDescriptor* call_descriptor =
+ PlatformInterfaceDescriptor* call_descriptor =
instr->descriptor()->platform_specific_descriptor();
__ Call(code, RelocInfo::CODE_TARGET, TypeFeedbackId::None(), al,
call_descriptor->storage_mode());
void FastNewClosureStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x2: function info
- Register registers[] = { x2 };
+ Register registers[] = { cp, x2 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x1: function
- Register registers[] = { x1 };
+ Register registers[] = { cp, x1 };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x0: value
- Register registers[] = { x0 };
+ Register registers[] = { cp, x0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void NumberToStringStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x0: value
- Register registers[] = { x0 };
+ Register registers[] = { cp, x0 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x3: array literals array
// x2: array literal index
// x1: constant elements
- Register registers[] = { x3, x2, x1 };
+ Register registers[] = { cp, x3, x2, x1 };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Smi(),
Representation::Tagged() };
void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x3: object literals array
// x2: object literal index
// x1: constant properties
// x0: object literal flags
- Register registers[] = { x3, x2, x1, x0 };
+ Register registers[] = { cp, x3, x2, x1, x0 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x2: feedback vector
// x3: call feedback slot
- Register registers[] = { x2, x3 };
+ Register registers[] = { cp, x2, x3 };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void RegExpConstructResultStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x2: length
// x1: index (of last match)
// x0: string
- Register registers[] = { x2, x1, x0 };
+ Register registers[] = { cp, x2, x1, x0 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
void TransitionElementsKindStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x0: value (js_array)
// x1: to_map
- Register registers[] = { x0, x1 };
+ Register registers[] = { cp, x0, x1 };
Address entry =
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
descriptor->Initialize(ARRAY_SIZE(registers), registers,
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x0: value to compare
- Register registers[] = { x0 };
+ Register registers[] = { cp, x0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
}
+const Register InterfaceDescriptor::ContextRegister() { return cp; }
+
+
static void InitializeArrayConstructorDescriptor(
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) {
+ // cp: context
// x1: function
// x2: allocation site with elements kind
// x0: number of arguments to the constructor function
Runtime::kArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
- Register registers[] = { x1, x2 };
+ Register registers[] = { cp, x1, x2 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
deopt_handler,
NULL,
JS_FUNCTION_STUB_MODE);
} else {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = { x1, x2, x0 };
+ Register registers[] = { cp, x1, x2, x0 };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
static void InitializeInternalArrayConstructorDescriptor(
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) {
+ // cp: context
// x1: constructor function
// x0: number of arguments to the constructor function
Address deopt_handler = Runtime::FunctionForId(
Runtime::kInternalArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
- Register registers[] = { x1 };
+ Register registers[] = { cp, x1 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
deopt_handler,
NULL,
JS_FUNCTION_STUB_MODE);
} else {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = { x1, x0 };
+ Register registers[] = { cp, x1, x0 };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x0: value
- Register registers[] = { x0 };
+ Register registers[] = { cp, x0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x1: left operand
// x0: right operand
- Register registers[] = { x1, x0 };
+ Register registers[] = { cp, x1, x0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x2: allocation site
// x1: left operand
// x0: right operand
- Register registers[] = { x2, x1, x0 };
+ Register registers[] = { cp, x2, x1, x0 };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
+ // cp: context
// x1: left operand
// x0: right operand
- Register registers[] = { x1, x0 };
+ Register registers[] = { cp, x1, x0 };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
- static PlatformCallInterfaceDescriptor default_descriptor =
- PlatformCallInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
+ static PlatformInterfaceDescriptor default_descriptor =
+ PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
- static PlatformCallInterfaceDescriptor noInlineDescriptor =
- PlatformCallInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
+ static PlatformInterfaceDescriptor noInlineDescriptor =
+ PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- Register registers[] = { x1, // JSFunction
- cp, // context
+ Register registers[] = { cp, // context
+ x1, // JSFunction
x0, // actual number of arguments
x2, // 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
};
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ApiFunctionCall);
- Register registers[] = { x0, // callee
+ Register registers[] = { cp, // context
+ x0, // callee
x4, // call_data
x2, // holder
x1, // api_function_address
- cp, // 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, &default_descriptor);
isolate()->counters()->code_stubs()->Increment();
CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor();
- int param_count = descriptor->register_param_count();
+ int param_count = descriptor->GetEnvironmentParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameScope scope(masm, StackFrame::INTERNAL);
- ASSERT((descriptor->register_param_count() == 0) ||
- x0.Is(descriptor->GetParameterRegister(param_count - 1)));
+ ASSERT((param_count == 0) ||
+ x0.Is(descriptor->GetEnvironmentParameterRegister(param_count - 1)));
// Push arguments
MacroAssembler::PushPopQueue queue(masm);
for (int i = 0; i < param_count; ++i) {
- queue.Queue(descriptor->GetParameterRegister(i));
+ queue.Queue(descriptor->GetEnvironmentParameterRegister(i));
}
queue.PushQueued();
ExternalReference miss = descriptor->miss_handler();
- __ CallExternalReference(miss, descriptor->register_param_count());
+ __ CallExternalReference(miss, param_count);
}
__ Ret();
};
-class PlatformCallInterfaceDescriptor {
+class PlatformInterfaceDescriptor {
public:
- explicit PlatformCallInterfaceDescriptor(
+ explicit PlatformInterfaceDescriptor(
TargetAddressStorageMode storage_mode)
: storage_mode_(storage_mode) { }
LInstruction* LChunkBuilder::DoCallWithDescriptor(
HCallWithDescriptor* instr) {
- const CallInterfaceDescriptor* descriptor = instr->descriptor();
+ const InterfaceDescriptor* descriptor = instr->descriptor();
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
CodeStubInterfaceDescriptor* descriptor =
info()->code_stub()->GetInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor->GetParameterRegister(index);
+ Register reg = descriptor->GetEnvironmentParameterRegister(index);
return DefineFixed(result, reg);
}
}
class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
public:
- LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
+ LCallWithDescriptor(const InterfaceDescriptor* descriptor,
const ZoneList<LOperand*>& operands,
Zone* zone)
: descriptor_(descriptor),
- inputs_(descriptor->environment_length() + 1, zone) {
- ASSERT(descriptor->environment_length() + 1 == operands.length());
+ inputs_(descriptor->GetRegisterParameterCount() + 1, zone) {
+ ASSERT(descriptor->GetRegisterParameterCount() + 1 == operands.length());
inputs_.AddAll(operands, zone);
}
LOperand* target() const { return inputs_[0]; }
- const CallInterfaceDescriptor* descriptor() { return descriptor_; }
+ const InterfaceDescriptor* descriptor() { return descriptor_; }
private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
int arity() const { return hydrogen()->argument_count() - 1; }
- const CallInterfaceDescriptor* descriptor_;
+ const InterfaceDescriptor* descriptor_;
ZoneList<LOperand*> inputs_;
// Iterator support.
info_(stub, isolate),
context_(NULL) {
descriptor_ = stub->GetInterfaceDescriptor();
- parameters_.Reset(new HParameter*[descriptor_->register_param_count()]);
+ int parameter_count = descriptor_->GetEnvironmentParameterCount();
+ parameters_.Reset(new HParameter*[parameter_count]);
}
virtual bool BuildGraph();
protected:
virtual HValue* BuildCodeStub() = 0;
HParameter* GetParameter(int parameter) {
- ASSERT(parameter < descriptor_->register_param_count());
+ ASSERT(parameter < descriptor_->GetEnvironmentParameterCount());
return parameters_[parameter];
}
HValue* GetArgumentsLength() {
isolate()->GetHTracer()->TraceCompilation(&info_);
}
- int param_count = descriptor_->register_param_count();
+ int param_count = descriptor_->GetEnvironmentParameterCount();
HEnvironment* start_environment = graph()->start_environment();
HBasicBlock* next_block = CreateBasicBlock(start_environment);
Goto(next_block);
bool runtime_stack_params = descriptor_->stack_parameter_count().is_valid();
HInstruction* stack_parameter_count = NULL;
for (int i = 0; i < param_count; ++i) {
- Representation r = descriptor_->GetRegisterParameterRepresentation(i);
- HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r);
+ Representation r = descriptor_->GetEnvironmentParameterRepresentation(i);
+ HParameter* param = Add<HParameter>(i,
+ HParameter::REGISTER_PARAMETER, r);
start_environment->Bind(i, param);
parameters_[i] = param;
- if (descriptor_->IsParameterCountRegister(i)) {
+ if (descriptor_->IsEnvironmentParameterCountRegister(i)) {
param->set_type(HType::Smi());
stack_parameter_count = param;
arguments_length_ = stack_parameter_count;
static_cast<HydrogenCodeStub*>(stub)->MajorKey();
CodeStubInterfaceDescriptor* descriptor =
isolate->code_stub_interface_descriptor(major_key);
- if (!descriptor->initialized()) {
+ if (!descriptor->IsInitialized()) {
stub->InitializeInterfaceDescriptor(descriptor);
}
namespace internal {
+InterfaceDescriptor::InterfaceDescriptor()
+ : register_param_count_(-1) { }
+
+
CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor()
- : register_param_count_(-1),
- stack_parameter_count_(no_reg),
+ : stack_parameter_count_(no_reg),
hint_stack_parameter_count_(-1),
function_mode_(NOT_JS_FUNCTION_STUB_MODE),
deoptimization_handler_(NULL),
has_miss_handler_(false) { }
-void CodeStubInterfaceDescriptor::Initialize(
+void InterfaceDescriptor::Initialize(
int register_parameter_count,
Register* registers,
- Address deoptimization_handler,
Representation* register_param_representations,
- int hint_stack_parameter_count,
- StubFunctionMode function_mode) {
- // CodeStubInterfaceDescriptor owns a copy of the registers array.
+ PlatformInterfaceDescriptor* platform_descriptor) {
+ platform_specific_descriptor_ = platform_descriptor;
register_param_count_ = register_parameter_count;
+
+ // An interface descriptor must have a context register.
+ ASSERT(register_parameter_count > 0 && registers[0].is(ContextRegister()));
+
+ // InterfaceDescriptor owns a copy of the registers array.
register_params_.Reset(NewArray<Register>(register_parameter_count));
for (int i = 0; i < register_parameter_count; i++) {
register_params_[i] = registers[i];
register_param_representations_.Reset(
NewArray<Representation>(register_parameter_count));
for (int i = 0; i < register_parameter_count; i++) {
+ // If there is a context register, the representation must be tagged.
+ ASSERT(i != 0 || register_param_representations[i].Equals(
+ Representation::Tagged()));
register_param_representations_[i] = register_param_representations[i];
}
}
+}
+
+
+void CodeStubInterfaceDescriptor::Initialize(
+ int register_parameter_count,
+ Register* registers,
+ Address deoptimization_handler,
+ Representation* register_param_representations,
+ int hint_stack_parameter_count,
+ StubFunctionMode function_mode) {
+ InterfaceDescriptor::Initialize(register_parameter_count, registers,
+ register_param_representations);
deoptimization_handler_ = deoptimization_handler;
int register_parameter_count,
Register* registers,
Representation* param_representations,
- PlatformCallInterfaceDescriptor* platform_descriptor) {
- // CallInterfaceDescriptor owns a copy of the registers array.
- register_param_count_ = register_parameter_count;
- register_params_.Reset(NewArray<Register>(register_parameter_count));
- for (int i = 0; i < register_parameter_count; i++) {
- register_params_[i] = registers[i];
- }
-
- // Also the register parameter representations.
- param_representations_.Reset(
- NewArray<Representation>(register_parameter_count));
- for (int i = 0; i < register_parameter_count; i++) {
- param_representations_[i] = param_representations[i];
- }
-
- platform_specific_descriptor_ = platform_descriptor;
+ PlatformInterfaceDescriptor* platform_descriptor) {
+ InterfaceDescriptor::Initialize(register_parameter_count, registers,
+ param_representations, platform_descriptor);
}
void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { LoadIC::ReceiverRegister(),
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
STATIC_ASSERT(LoadIC::kParameterCount == 2);
descriptor->Initialize(ARRAY_SIZE(registers), registers,
void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { LoadIC::ReceiverRegister(),
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
STATIC_ASSERT(LoadIC::kParameterCount == 2);
descriptor->Initialize(ARRAY_SIZE(registers), registers,
void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { LoadIC::ReceiverRegister(),
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
STATIC_ASSERT(LoadIC::kParameterCount == 2);
descriptor->Initialize(
void LoadFieldStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { LoadIC::ReceiverRegister() };
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ LoadIC::ReceiverRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void KeyedLoadFieldStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { LoadIC::ReceiverRegister() };
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ LoadIC::ReceiverRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void StringLengthStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { LoadIC::ReceiverRegister(),
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void KeyedStringLengthStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { LoadIC::ReceiverRegister(),
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { KeyedStoreIC::ReceiverRegister(),
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ KeyedStoreIC::ReceiverRegister(),
KeyedStoreIC::NameRegister(),
KeyedStoreIC::ValueRegister() };
descriptor->Initialize(
void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { ValueRegister(),
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ ValueRegister(),
MapRegister(),
KeyRegister(),
ObjectRegister() };
void StoreGlobalStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { StoreIC::ReceiverRegister(),
+ Register registers[] = { InterfaceDescriptor::ContextRegister(),
+ StoreIC::ReceiverRegister(),
StoreIC::NameRegister(),
StoreIC::ValueRegister() };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
int major_key = stub->MajorKey();
CodeStubInterfaceDescriptor* descriptor =
isolate->code_stub_interface_descriptor(major_key);
- if (!descriptor->initialized()) {
+ if (!descriptor->IsInitialized()) {
stub->InitializeInterfaceDescriptor(descriptor);
}
}
enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE };
enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS };
-class CodeStubInterfaceDescriptor {
+
+class PlatformInterfaceDescriptor;
+
+
+class InterfaceDescriptor {
+ public:
+ bool IsInitialized() const { return register_param_count_ >= 0; }
+
+ int GetEnvironmentLength() const { return register_param_count_; }
+
+ int GetRegisterParameterCount() const { return register_param_count_; }
+
+ Register GetParameterRegister(int index) const {
+ return register_params_[index];
+ }
+
+ Representation GetParameterRepresentation(int index) const {
+ ASSERT(index < register_param_count_);
+ if (register_param_representations_.get() == NULL) {
+ return Representation::Tagged();
+ }
+
+ return register_param_representations_[index];
+ }
+
+ // "Environment" versions of parameter functions. The first register
+ // parameter (context) is not included.
+ int GetEnvironmentParameterCount() const {
+ return GetEnvironmentLength() - 1;
+ }
+
+ Register GetEnvironmentParameterRegister(int index) const {
+ return GetParameterRegister(index + 1);
+ }
+
+ Representation GetEnvironmentParameterRepresentation(int index) const {
+ return GetParameterRepresentation(index + 1);
+ }
+
+ // Some platforms have extra information to associate with the descriptor.
+ PlatformInterfaceDescriptor* platform_specific_descriptor() const {
+ return platform_specific_descriptor_;
+ }
+
+ static const Register ContextRegister();
+
+ protected:
+ InterfaceDescriptor();
+ virtual ~InterfaceDescriptor() {}
+
+ void Initialize(int register_parameter_count, Register* registers,
+ Representation* register_param_representations,
+ PlatformInterfaceDescriptor* platform_descriptor = NULL);
+
+ private:
+ int register_param_count_;
+
+ // The Register params are allocated dynamically by the
+ // InterfaceDescriptor, and freed on destruction. This is because static
+ // arrays of Registers cause creation of runtime static initializers
+ // which we don't want.
+ SmartArrayPointer<Register> register_params_;
+ // Specifies Representations for the stub's parameter. Points to an array of
+ // Representations of the same length of the numbers of parameters to the
+ // stub, or if NULL (the default value), Representation of each parameter
+ // assumed to be Tagged().
+ SmartArrayPointer<Representation> register_param_representations_;
+
+ PlatformInterfaceDescriptor* platform_specific_descriptor_;
+
+ DISALLOW_COPY_AND_ASSIGN(InterfaceDescriptor);
+};
+
+
+class CodeStubInterfaceDescriptor: public InterfaceDescriptor {
public:
CodeStubInterfaceDescriptor();
int hint_stack_parameter_count = -1,
StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE,
HandlerArgumentsMode handler_mode = DONT_PASS_ARGUMENTS);
- bool initialized() const { return register_param_count_ >= 0; }
-
- int environment_length() const {
- return register_param_count_;
- }
void SetMissHandler(ExternalReference handler) {
miss_handler_ = handler;
return has_miss_handler_;
}
- Register GetParameterRegister(int index) const {
- return register_params_[index];
- }
-
- Representation GetRegisterParameterRepresentation(int index) const {
- ASSERT(index < register_param_count_);
- if (register_param_representations_.get() == NULL) {
- return Representation::Tagged();
- }
-
- return register_param_representations_[index];
- }
-
- bool IsParameterCountRegister(int index) const {
- return GetParameterRegister(index).is(stack_parameter_count_);
+ bool IsEnvironmentParameterCountRegister(int index) const {
+ return GetEnvironmentParameterRegister(index).is(stack_parameter_count_);
}
int GetHandlerParameterCount() const {
- int params = environment_length();
+ int params = GetEnvironmentParameterCount();
if (handler_arguments_mode_ == PASS_ARGUMENTS) {
params += 1;
}
return params;
}
- int register_param_count() const { return register_param_count_; }
int hint_stack_parameter_count() const { return hint_stack_parameter_count_; }
Register stack_parameter_count() const { return stack_parameter_count_; }
StubFunctionMode function_mode() const { return function_mode_; }
Address deoptimization_handler() const { return deoptimization_handler_; }
- Representation* register_param_representations() const {
- return register_param_representations_.get();
- }
private:
- int register_param_count_;
-
Register stack_parameter_count_;
// If hint_stack_parameter_count_ > 0, the code stub can optimize the
// return sequence. Default value is -1, which means it is ignored.
int hint_stack_parameter_count_;
StubFunctionMode function_mode_;
- // The Register params are allocated dynamically by the
- // CodeStubInterfaceDescriptor, and freed on destruction. This is because
- // static arrays of Registers cause creation of runtime static initializers
- // which we don't want.
- SmartArrayPointer<Register> register_params_;
- // Specifies Representations for the stub's parameter. Points to an array of
- // Representations of the same length of the numbers of parameters to the
- // stub, or if NULL (the default value), Representation of each parameter
- // assumed to be Tagged().
- SmartArrayPointer<Representation> register_param_representations_;
Address deoptimization_handler_;
HandlerArgumentsMode handler_arguments_mode_;
ExternalReference miss_handler_;
bool has_miss_handler_;
- DISALLOW_COPY_AND_ASSIGN(CodeStubInterfaceDescriptor);
};
-class PlatformCallInterfaceDescriptor;
-
-
-class CallInterfaceDescriptor {
+class CallInterfaceDescriptor: public InterfaceDescriptor {
public:
- CallInterfaceDescriptor()
- : register_param_count_(-1),
- register_params_(NULL),
- param_representations_(NULL),
- platform_specific_descriptor_(NULL) { }
+ CallInterfaceDescriptor() { }
// A copy of the passed in registers and param_representations is made
// and owned by the CallInterfaceDescriptor.
// The same should go for the CodeStubInterfaceDescriptor class.
void Initialize(int register_parameter_count, Register* registers,
Representation* param_representations,
- PlatformCallInterfaceDescriptor* platform_descriptor = NULL);
-
- bool initialized() const { return register_param_count_ >= 0; }
-
- int environment_length() const {
- return register_param_count_;
- }
-
- Representation GetParameterRepresentation(int index) const {
- return param_representations_[index];
- }
-
- Register GetParameterRegister(int index) const {
- return register_params_[index];
- }
-
- PlatformCallInterfaceDescriptor* platform_specific_descriptor() const {
- return platform_specific_descriptor_;
- }
-
- private:
- int register_param_count_;
- SmartArrayPointer<Register> register_params_;
- SmartArrayPointer<Representation> param_representations_;
- PlatformCallInterfaceDescriptor* platform_specific_descriptor_;
+ PlatformInterfaceDescriptor* platform_descriptor = NULL);
};
// and the standard stack frame slots. Include space for an argument
// object to the callee and optionally the space to pass the argument
// object to the stub failure handler.
- CHECK_GE(descriptor->register_param_count(), 0);
- int height_in_bytes = kPointerSize * descriptor->register_param_count() +
- sizeof(Arguments) + kPointerSize;
+ int param_count = descriptor->GetEnvironmentParameterCount();
+ CHECK_GE(param_count, 0);
+
+ int height_in_bytes = kPointerSize * param_count + sizeof(Arguments) +
+ kPointerSize;
int fixed_frame_size = StandardFrameConstants::kFixedFrameSize;
int input_frame_size = input_->GetFrameSize();
int output_frame_size = height_in_bytes + fixed_frame_size;
// Copy the register parameters to the failure frame.
int arguments_length_offset = -1;
- for (int i = 0; i < descriptor->register_param_count(); ++i) {
+ for (int i = 0; i < param_count; ++i) {
output_frame_offset -= kPointerSize;
DoTranslateCommand(iterator, 0, output_frame_offset);
- if (!arg_count_known && descriptor->IsParameterCountRegister(i)) {
+ if (!arg_count_known &&
+ descriptor->IsEnvironmentParameterCountRegister(i)) {
arguments_length_offset = output_frame_offset;
}
}
static HCallWithDescriptor* New(Zone* zone, HValue* context,
HValue* target,
int argument_count,
- const CallInterfaceDescriptor* descriptor,
+ const InterfaceDescriptor* descriptor,
const Vector<HValue*>& operands) {
- ASSERT(operands.length() == descriptor->environment_length());
+ ASSERT(operands.length() == descriptor->GetEnvironmentLength());
HCallWithDescriptor* res =
new(zone) HCallWithDescriptor(target, argument_count,
descriptor, operands, zone);
return Representation::Tagged();
} else {
int par_index = index - 1;
- ASSERT(par_index < descriptor_->environment_length());
+ ASSERT(par_index < descriptor_->GetEnvironmentLength());
return descriptor_->GetParameterRepresentation(par_index);
}
}
return -argument_count_;
}
- const CallInterfaceDescriptor* descriptor() const {
+ const InterfaceDescriptor* descriptor() const {
return descriptor_;
}
// The argument count includes the receiver.
HCallWithDescriptor(HValue* target,
int argument_count,
- const CallInterfaceDescriptor* descriptor,
+ const InterfaceDescriptor* descriptor,
const Vector<HValue*>& operands,
Zone* zone)
: descriptor_(descriptor),
- values_(descriptor->environment_length() + 1, zone) {
+ values_(descriptor->GetEnvironmentLength() + 1, zone) {
argument_count_ = argument_count;
AddOperand(target, zone);
for (int i = 0; i < operands.length(); i++) {
values_[index] = value;
}
- const CallInterfaceDescriptor* descriptor_;
+ const InterfaceDescriptor* descriptor_;
ZoneList<HValue*> values_;
int argument_count_;
};
if (info->IsStub()) {
HydrogenCodeStub* stub = info->code_stub();
CodeStubInterfaceDescriptor* descriptor = stub->GetInterfaceDescriptor();
- start_environment_ =
- new(zone_) HEnvironment(zone_, descriptor->environment_length());
+ start_environment_ = new(zone_) HEnvironment(
+ zone_, descriptor->GetEnvironmentParameterCount());
} else {
TraceInlinedFunction(info->shared_info(), HSourcePosition::Unknown());
start_environment_ =
HValue* arity = Add<HConstant>(argument_count - 1);
- HValue* op_vals[] = { fun, context, arity, expected_param_count };
+ HValue* op_vals[] = { context, fun, arity, expected_param_count };
Handle<Code> adaptor =
isolate()->builtins()->ArgumentsAdaptorTrampoline();
return New<HCallWithDescriptor>(
adaptor_value, argument_count, descriptor,
- Vector<HValue*>(op_vals, descriptor->environment_length()));
+ Vector<HValue*>(op_vals, descriptor->GetEnvironmentLength()));
}
HValue* api_function_address = Add<HConstant>(ExternalReference(ref));
HValue* op_vals[] = {
+ context(),
Add<HConstant>(function),
call_data,
holder,
- api_function_address,
- context()
+ api_function_address
};
CallInterfaceDescriptor* descriptor =
HConstant* code_value = Add<HConstant>(code);
ASSERT((sizeof(op_vals) / kPointerSize) ==
- descriptor->environment_length());
+ descriptor->GetEnvironmentLength());
HInstruction* call = New<HCallWithDescriptor>(
code_value, argc + 1, descriptor,
- Vector<HValue*>(op_vals, descriptor->environment_length()));
+ Vector<HValue*>(op_vals, descriptor->GetEnvironmentLength()));
if (drop_extra) Drop(1); // Drop function.
ast_context()->ReturnInstruction(call, ast_id);
void FastNewClosureStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { ebx };
+ Register registers[] = { esi, ebx };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
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);
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() };
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);
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);
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,
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,
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() };
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,
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,
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { eax };
+ Register registers[] = { esi, eax };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { eax };
+ Register registers[] = { esi, eax };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
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(
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));
}
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);
{
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
};
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);
}
isolate()->counters()->code_stubs()->Increment();
CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor();
- int param_count = descriptor->register_param_count();
+ int param_count = descriptor->GetEnvironmentParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameScope scope(masm, StackFrame::INTERNAL);
- ASSERT(descriptor->register_param_count() == 0 ||
- eax.is(descriptor->GetParameterRegister(param_count - 1)));
+ ASSERT(param_count == 0 ||
+ eax.is(descriptor->GetEnvironmentParameterRegister(
+ param_count - 1)));
// Push arguments
for (int i = 0; i < param_count; ++i) {
- __ push(descriptor->GetParameterRegister(i));
+ __ push(descriptor->GetEnvironmentParameterRegister(i));
}
ExternalReference miss = descriptor->miss_handler();
- __ CallExternalReference(miss, descriptor->register_param_count());
+ __ CallExternalReference(miss, param_count);
}
__ ret(0);
LInstruction* LChunkBuilder::DoCallWithDescriptor(
HCallWithDescriptor* instr) {
- const CallInterfaceDescriptor* descriptor = instr->descriptor();
-
+ const InterfaceDescriptor* descriptor = instr->descriptor();
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
ops.Add(target, zone());
CodeStubInterfaceDescriptor* descriptor =
info()->code_stub()->GetInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor->GetParameterRegister(index);
+ Register reg = descriptor->GetEnvironmentParameterRegister(index);
return DefineFixed(result, reg);
}
}
class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
public:
- LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
+ LCallWithDescriptor(const InterfaceDescriptor* descriptor,
const ZoneList<LOperand*>& operands,
Zone* zone)
- : inputs_(descriptor->environment_length() + 1, zone) {
- ASSERT(descriptor->environment_length() + 1 == operands.length());
+ : inputs_(descriptor->GetRegisterParameterCount() + 1, zone) {
+ ASSERT(descriptor->GetRegisterParameterCount() + 1 == operands.length());
inputs_.AddAll(operands, zone);
}
void FastNewClosureStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rbx };
+ Register registers[] = { rsi, rbx };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rdi };
+ Register registers[] = { rsi, rdi };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rax };
+ Register registers[] = { rsi, rax };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void NumberToStringStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rax };
+ Register registers[] = { rsi, rax };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rax, rbx, rcx };
+ Register registers[] = { rsi, rax, rbx, rcx };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Smi(),
Representation::Tagged() };
void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rax, rbx, rcx, rdx };
+ Register registers[] = { rsi, rax, rbx, rcx, rdx };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rbx, rdx };
+ Register registers[] = { rsi, rbx, rdx };
descriptor->Initialize(ARRAY_SIZE(registers), registers);
}
void RegExpConstructResultStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rcx, rbx, rax };
+ Register registers[] = { rsi, rcx, rbx, rax };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
void TransitionElementsKindStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rax, rbx };
+ Register registers[] = { rsi, rax, rbx };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry);
}
+const Register InterfaceDescriptor::ContextRegister() { return rsi; }
+
+
static void InitializeArrayConstructorDescriptor(
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) {
Runtime::kArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
- Register registers[] = { rdi, rbx };
+ Register registers[] = { rsi, rdi, rbx };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
deopt_handler,
NULL,
JS_FUNCTION_STUB_MODE);
} else {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = { rdi, rbx, rax };
+ Register registers[] = { rsi, rdi, rbx, rax };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
CodeStubInterfaceDescriptor* descriptor,
int constant_stack_parameter_count) {
// register state
+ // rsi -- context
// rax -- number of arguments
// rdi -- constructor function
Address deopt_handler = Runtime::FunctionForId(
Runtime::kInternalArrayConstructor)->entry;
if (constant_stack_parameter_count == 0) {
- Register registers[] = { rdi };
+ Register registers[] = { rsi, rdi };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
deopt_handler,
NULL,
JS_FUNCTION_STUB_MODE);
} else {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = { rdi, rax };
+ Register registers[] = { rsi, rdi, rax };
Representation representations[] = {
+ Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rax };
+ Register registers[] = { rsi, rax };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rax };
+ Register registers[] = { rsi, rax };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rdx, rax };
+ Register registers[] = { rsi, rdx, rax };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rcx, rdx, rax };
+ Register registers[] = { rsi, rcx, rdx, rax };
descriptor->Initialize(ARRAY_SIZE(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
- Register registers[] = { rdx, rax };
+ Register registers[] = { rsi, rdx, rax };
descriptor->Initialize(
ARRAY_SIZE(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
- Register registers[] = { rdi, // JSFunction
- rsi, // context
+ Register registers[] = { rsi, // context
+ rdi, // JSFunction
rax, // actual number of arguments
rbx, // 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
};
{
CallInterfaceDescriptor* descriptor =
isolate->call_descriptor(Isolate::ApiFunctionCall);
- Register registers[] = { rax, // callee
+ Register registers[] = { rsi, // context
+ rax, // callee
rbx, // call_data
rcx, // holder
rdx, // api_function_address
- rsi, // 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);
}
isolate()->counters()->code_stubs()->Increment();
CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor();
- int param_count = descriptor->register_param_count();
+ int param_count = descriptor->GetEnvironmentParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameScope scope(masm, StackFrame::INTERNAL);
- ASSERT(descriptor->register_param_count() == 0 ||
- rax.is(descriptor->GetParameterRegister(param_count - 1)));
+ ASSERT(param_count == 0 ||
+ rax.is(descriptor->GetEnvironmentParameterRegister(
+ param_count - 1)));
// Push arguments
for (int i = 0; i < param_count; ++i) {
- __ Push(descriptor->GetParameterRegister(i));
+ __ Push(descriptor->GetEnvironmentParameterRegister(i));
}
ExternalReference miss = descriptor->miss_handler();
- __ CallExternalReference(miss, descriptor->register_param_count());
+ __ CallExternalReference(miss, param_count);
}
__ Ret();
LInstruction* LChunkBuilder::DoCallWithDescriptor(
HCallWithDescriptor* instr) {
- const CallInterfaceDescriptor* descriptor = instr->descriptor();
+ const InterfaceDescriptor* descriptor = instr->descriptor();
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
CodeStubInterfaceDescriptor* descriptor =
info()->code_stub()->GetInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor->GetParameterRegister(index);
+ Register reg = descriptor->GetEnvironmentParameterRegister(index);
return DefineFixed(result, reg);
}
}
class LCallWithDescriptor V8_FINAL : public LTemplateResultInstruction<1> {
public:
- LCallWithDescriptor(const CallInterfaceDescriptor* descriptor,
+ LCallWithDescriptor(const InterfaceDescriptor* descriptor,
const ZoneList<LOperand*>& operands,
Zone* zone)
- : inputs_(descriptor->environment_length() + 1, zone) {
- ASSERT(descriptor->environment_length() + 1 == operands.length());
+ : inputs_(descriptor->GetRegisterParameterCount() + 1, zone) {
+ ASSERT(descriptor->GetRegisterParameterCount() + 1 == operands.length());
inputs_.AddAll(operands, zone);
}