"src/compiler/js-typed-lowering.h",
"src/compiler/jump-threading.cc",
"src/compiler/jump-threading.h",
- "src/compiler/linkage-impl.h",
"src/compiler/linkage.cc",
"src/compiler/linkage.h",
"src/compiler/liveness-analyzer.cc",
"src/compiler/ia32/code-generator-ia32.cc",
"src/compiler/ia32/instruction-codes-ia32.h",
"src/compiler/ia32/instruction-selector-ia32.cc",
- "src/compiler/ia32/linkage-ia32.cc",
"src/debug/ia32/debug-ia32.cc",
"src/full-codegen/ia32/full-codegen-ia32.cc",
"src/ic/ia32/access-compiler-ia32.cc",
"src/compiler/x64/code-generator-x64.cc",
"src/compiler/x64/instruction-codes-x64.h",
"src/compiler/x64/instruction-selector-x64.cc",
- "src/compiler/x64/linkage-x64.cc",
"src/debug/x64/debug-x64.cc",
"src/full-codegen/x64/full-codegen-x64.cc",
"src/ic/x64/access-compiler-x64.cc",
"src/compiler/arm/code-generator-arm.cc",
"src/compiler/arm/instruction-codes-arm.h",
"src/compiler/arm/instruction-selector-arm.cc",
- "src/compiler/arm/linkage-arm.cc",
"src/debug/arm/debug-arm.cc",
"src/full-codegen/arm/full-codegen-arm.cc",
"src/ic/arm/access-compiler-arm.cc",
"src/compiler/arm64/code-generator-arm64.cc",
"src/compiler/arm64/instruction-codes-arm64.h",
"src/compiler/arm64/instruction-selector-arm64.cc",
- "src/compiler/arm64/linkage-arm64.cc",
"src/debug/arm64/debug-arm64.cc",
"src/full-codegen/arm64/full-codegen-arm64.cc",
"src/ic/arm64/access-compiler-arm64.cc",
"src/compiler/mips/code-generator-mips.cc",
"src/compiler/mips/instruction-codes-mips.h",
"src/compiler/mips/instruction-selector-mips.cc",
- "src/compiler/mips/linkage-mips.cc",
"src/debug/mips/debug-mips.cc",
"src/full-codegen/mips/full-codegen-mips.cc",
"src/ic/mips/access-compiler-mips.cc",
namespace v8 {
namespace internal {
+// Give alias names to registers for calling conventions.
+const Register kReturnRegister0 = {kRegister_r0_Code};
+const Register kReturnRegister1 = {kRegister_r1_Code};
+const Register kJSFunctionRegister = {kRegister_r1_Code};
+const Register kContextRegister = {kRegister_r7_Code};
+const Register kInterpreterBytecodeOffsetRegister = {kRegister_r5_Code};
+const Register kInterpreterBytecodeArrayRegister = {kRegister_r6_Code};
+const Register kInterpreterDispatchTableRegister = {kRegister_r8_Code};
+const Register kRuntimeCallFunctionRegister = {kRegister_r1_Code};
+const Register kRuntimeCallArgCountRegister = {kRegister_r0_Code};
+
// ----------------------------------------------------------------------------
// Static helper functions
const Register cp = { kRegister_r7_Code }; // JavaScript context pointer.
const Register pp = { kRegister_r8_Code }; // Constant pool pointer.
const Register kRootRegister = { kRegister_r10_Code }; // Roots array pointer.
-const Register kInterpreterBytecodeOffsetRegister = {
- kRegister_r5_Code // Interpreter bytecode offset.
-};
-const Register kInterpreterBytecodeArrayRegister = {
- kRegister_r6_Code // Interpreter bytecode array pointer.
-};
-const Register kInterpreterDispatchTableRegister = {
- kRegister_r8_Code // Interpreter dispatch table.
-};
// Flags used for AllocateHeapNumber
enum TaggingMode {
ALIAS_REGISTER(Register, lr, x30);
ALIAS_REGISTER(Register, xzr, x31);
ALIAS_REGISTER(Register, wzr, w31);
-ALIAS_REGISTER(Register, kInterpreterBytecodeOffsetRegister, x19);
-ALIAS_REGISTER(Register, kInterpreterBytecodeArrayRegister, x20);
-ALIAS_REGISTER(Register, kInterpreterDispatchTableRegister, x21);
// Keeps the 0 double value.
ALIAS_REGISTER(FPRegister, fp_zero, d15);
namespace v8 {
namespace internal {
+// Give alias names to registers for calling conventions.
+// TODO(titzer): arm64 is a pain for aliasing; get rid of these macros
+#define kReturnRegister0 x0
+#define kReturnRegister1 x1
+#define kJSFunctionRegister x1
+#define kContextRegister cp
+#define kInterpreterBytecodeOffsetRegister x19
+#define kInterpreterBytecodeArrayRegister x20
+#define kInterpreterDispatchTableRegister x21
+#define kRuntimeCallFunctionRegister x1
+#define kRuntimeCallArgCountRegister x0
+
#define LS_MACRO_LIST(V) \
V(Ldrb, Register&, rt, LDRB_w) \
V(Strb, Register&, rt, STRB_w) \
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/compiler/linkage.h"
-#include "src/compiler/linkage-impl.h"
-#include "src/zone.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-struct ArmLinkageHelperTraits {
- static Register ReturnValueReg() { return r0; }
- static Register ReturnValue2Reg() { return r1; }
- static Register JSCallFunctionReg() { return r1; }
- static Register ContextReg() { return cp; }
- static Register InterpreterBytecodeOffsetReg() {
- return kInterpreterBytecodeOffsetRegister;
- }
- static Register InterpreterBytecodeArrayReg() {
- return kInterpreterBytecodeArrayRegister;
- }
- static Register InterpreterDispatchTableReg() {
- return kInterpreterDispatchTableRegister;
- }
- static Register RuntimeCallFunctionReg() { return r1; }
- static Register RuntimeCallArgCountReg() { return r0; }
-};
-
-
-typedef LinkageHelper<ArmLinkageHelperTraits> LH;
-
-CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
- CallDescriptor::Flags flags) {
- return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
-}
-
-
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
- properties);
-}
-
-
-CallDescriptor* Linkage::GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- return LH::GetStubCallDescriptor(isolate, zone, descriptor,
- stack_parameter_count, flags, properties,
- return_type);
-}
-
-
-CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
- return LH::GetInterpreterDispatchDescriptor(zone);
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/compiler/linkage.h"
-#include "src/compiler/linkage-impl.h"
-#include "src/zone.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-struct Arm64LinkageHelperTraits {
- static Register ReturnValueReg() { return x0; }
- static Register ReturnValue2Reg() { return x1; }
- static Register JSCallFunctionReg() { return x1; }
- static Register ContextReg() { return cp; }
- static Register InterpreterBytecodeOffsetReg() {
- return kInterpreterBytecodeOffsetRegister;
- }
- static Register InterpreterBytecodeArrayReg() {
- return kInterpreterBytecodeArrayRegister;
- }
- static Register InterpreterDispatchTableReg() {
- return kInterpreterDispatchTableRegister;
- }
- static Register RuntimeCallFunctionReg() { return x1; }
- static Register RuntimeCallArgCountReg() { return x0; }
-};
-
-
-typedef LinkageHelper<Arm64LinkageHelperTraits> LH;
-
-CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
- CallDescriptor::Flags flags) {
- return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
-}
-
-
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
- properties);
-}
-
-
-CallDescriptor* Linkage::GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- return LH::GetStubCallDescriptor(isolate, zone, descriptor,
- stack_parameter_count, flags, properties,
- return_type);
-}
-
-
-CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
- return LH::GetInterpreterDispatchDescriptor(zone);
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
namespace compiler {
namespace {
-// Platform-specific configuration for C calling convention.
LinkageLocation regloc(Register reg) {
return LinkageLocation::ForRegister(Register::ToAllocationIndex(reg));
}
-LinkageLocation stackloc(int i) {
- DCHECK_LT(i, 0);
- return LinkageLocation::ForCallerFrameSlot(i);
-}
-
-
+// Platform-specific configuration for C calling convention.
#if V8_TARGET_ARCH_IA32
// ===========================================================================
// == ia32 ===================================================================
// ===========================================================================
-#define RETURN_REGISTER_0 eax
-#define RETURN_REGISTER_1 edx
#define CALLEE_SAVE_REGISTERS esi.bit() | edi.bit() | ebx.bit()
#elif V8_TARGET_ARCH_X64
// ===========================================================================
// == x64 ====================================================================
// ===========================================================================
-#define RETURN_REGISTER_0 rax
-#define RETURN_REGISTER_1 rdx
#ifdef _WIN64
// == x64 windows ============================================================
// ===========================================================================
// == x87 ====================================================================
// ===========================================================================
-#define RETURN_REGISTER_0 eax
-#define RETURN_REGISTER_1 edx
#define CALLEE_SAVE_REGISTERS esi.bit() | edi.bit() | ebx.bit()
#elif V8_TARGET_ARCH_ARM
// == arm ====================================================================
// ===========================================================================
#define PARAM_REGISTERS r0, r1, r2, r3
-#define RETURN_REGISTER_0 r0
-#define RETURN_REGISTER_1 r1
#define CALLEE_SAVE_REGISTERS \
r4.bit() | r5.bit() | r6.bit() | r7.bit() | r8.bit() | r9.bit() | r10.bit()
#define CALLEE_SAVE_FP_REGISTERS \
// == arm64 ====================================================================
// ===========================================================================
#define PARAM_REGISTERS x0, x1, x2, x3, x4, x5, x6, x7
-#define RETURN_REGISTER_0 x0
-#define RETURN_REGISTER_1 x1
#define CALLEE_SAVE_REGISTERS \
(1 << x19.code()) | (1 << x20.code()) | (1 << x21.code()) | \
(1 << x22.code()) | (1 << x23.code()) | (1 << x24.code()) | \
// == mips ===================================================================
// ===========================================================================
#define PARAM_REGISTERS a0, a1, a2, a3
-#define RETURN_REGISTER_0 v0
-#define RETURN_REGISTER_1 v1
#define CALLEE_SAVE_REGISTERS \
s0.bit() | s1.bit() | s2.bit() | s3.bit() | s4.bit() | s5.bit() | s6.bit() | \
s7.bit()
// == mips64 =================================================================
// ===========================================================================
#define PARAM_REGISTERS a0, a1, a2, a3, a4, a5, a6, a7
-#define RETURN_REGISTER_0 v0
-#define RETURN_REGISTER_1 v1
#define CALLEE_SAVE_REGISTERS \
s0.bit() | s1.bit() | s2.bit() | s3.bit() | s4.bit() | s5.bit() | s6.bit() | \
s7.bit()
// == ppc & ppc64 ============================================================
// ===========================================================================
#define PARAM_REGISTERS r3, r4, r5, r6, r7, r8, r9, r10
-#define RETURN_REGISTER_0 r3
-#define RETURN_REGISTER_1 r4
#define CALLEE_SAVE_REGISTERS \
r14.bit() | r15.bit() | r16.bit() | r17.bit() | r18.bit() | r19.bit() | \
r20.bit() | r21.bit() | r22.bit() | r23.bit() | r24.bit() | r25.bit() | \
// ===========================================================================
// == unknown ================================================================
// ===========================================================================
-// Don't define anything. The below code will dynamically fail.
+#define UNSUPPORTED_C_LINKAGE 1
#endif
} // namespace
}
#endif
-#ifdef RETURN_REGISTER_0
+#ifdef UNSUPPORTED_C_LINKAGE
+ // This method should not be called on unknown architectures.
+ V8_Fatal(__FILE__, __LINE__,
+ "requested C call descriptor on unsupported architecture");
+ return nullptr;
+#endif
+
// Add return location(s).
CHECK(locations.return_count_ <= 2);
if (locations.return_count_ > 0) {
- locations.AddReturn(regloc(RETURN_REGISTER_0));
+ locations.AddReturn(regloc(kReturnRegister0));
}
if (locations.return_count_ > 1) {
- locations.AddReturn(regloc(RETURN_REGISTER_1));
+ locations.AddReturn(regloc(kReturnRegister1));
}
-#else
- // This method should not be called on unknown architectures.
- V8_Fatal(__FILE__, __LINE__,
- "requested C call descriptor on unsupported architecture");
- return nullptr;
-#endif
const int parameter_count = static_cast<int>(msig->parameter_count());
if (i < kParamRegisterCount) {
locations.AddParam(regloc(kParamRegisters[i]));
} else {
- locations.AddParam(stackloc(-1 - stack_offset));
+ locations.AddParam(
+ LinkageLocation::ForCallerFrameSlot(-1 - stack_offset));
stack_offset++;
}
}
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/compiler/linkage.h"
-#include "src/compiler/linkage-impl.h"
-#include "src/zone.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-struct IA32LinkageHelperTraits {
- static Register ReturnValueReg() { return eax; }
- static Register ReturnValue2Reg() { return edx; }
- static Register JSCallFunctionReg() { return edi; }
- static Register ContextReg() { return esi; }
- static Register InterpreterBytecodeOffsetReg() { return ecx; }
- static Register InterpreterBytecodeArrayReg() { return edi; }
- static Register InterpreterDispatchTableReg() { return ebx; }
- static Register RuntimeCallFunctionReg() { return ebx; }
- static Register RuntimeCallArgCountReg() { return eax; }
-};
-
-typedef LinkageHelper<IA32LinkageHelperTraits> LH;
-
-CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
- CallDescriptor::Flags flags) {
- return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
-}
-
-
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
- properties);
-}
-
-
-CallDescriptor* Linkage::GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- return LH::GetStubCallDescriptor(isolate, zone, descriptor,
- stack_parameter_count, flags, properties,
- return_type);
-}
-
-
-CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
- return LH::GetInterpreterDispatchDescriptor(zone);
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef V8_COMPILER_LINKAGE_IMPL_H_
-#define V8_COMPILER_LINKAGE_IMPL_H_
-
-#include "src/code-stubs.h"
-#include "src/compiler/osr.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-// TODO(titzer): replace uses of int with size_t in LinkageHelper.
-template <typename LinkageTraits>
-class LinkageHelper {
- public:
- static const RegList kNoCalleeSaved = 0;
-
- static void AddReturnLocations(LocationSignature::Builder* locations) {
- DCHECK(locations->return_count_ <= 2);
- if (locations->return_count_ > 0) {
- locations->AddReturn(regloc(LinkageTraits::ReturnValueReg()));
- }
- if (locations->return_count_ > 1) {
- locations->AddReturn(regloc(LinkageTraits::ReturnValue2Reg()));
- }
- }
-
- // TODO(turbofan): cache call descriptors for JSFunction calls.
- static CallDescriptor* GetJSCallDescriptor(Zone* zone, bool is_osr,
- int js_parameter_count,
- CallDescriptor::Flags flags) {
- const size_t return_count = 1;
- const size_t context_count = 1;
- const size_t parameter_count = js_parameter_count + context_count;
-
- LocationSignature::Builder locations(zone, return_count, parameter_count);
- MachineSignature::Builder types(zone, return_count, parameter_count);
-
- // Add returns.
- AddReturnLocations(&locations);
- for (size_t i = 0; i < return_count; i++) {
- types.AddReturn(kMachAnyTagged);
- }
-
- // All parameters to JS calls go on the stack.
- for (int i = 0; i < js_parameter_count; i++) {
- int spill_slot_index = i - js_parameter_count;
- locations.AddParam(stackloc(spill_slot_index));
- types.AddParam(kMachAnyTagged);
- }
- // Add context.
- locations.AddParam(regloc(LinkageTraits::ContextReg()));
- types.AddParam(kMachAnyTagged);
-
- // The target for JS function calls is the JSFunction object.
- MachineType target_type = kMachAnyTagged;
- // TODO(titzer): When entering into an OSR function from unoptimized code,
- // the JSFunction is not in a register, but it is on the stack in an
- // unaddressable spill slot. We hack this in the OSR prologue. Fix.
- LinkageLocation target_loc = regloc(LinkageTraits::JSCallFunctionReg());
- return new (zone) CallDescriptor( // --
- CallDescriptor::kCallJSFunction, // kind
- target_type, // target MachineType
- target_loc, // target location
- types.Build(), // machine_sig
- locations.Build(), // location_sig
- js_parameter_count, // stack_parameter_count
- Operator::kNoProperties, // properties
- kNoCalleeSaved, // callee-saved
- kNoCalleeSaved, // callee-saved fp
- flags, // flags
- "js-call");
- }
-
-
- // TODO(turbofan): cache call descriptors for runtime calls.
- static CallDescriptor* GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function_id, int js_parameter_count,
- Operator::Properties properties) {
- const size_t function_count = 1;
- const size_t num_args_count = 1;
- const size_t context_count = 1;
- const size_t parameter_count = function_count +
- static_cast<size_t>(js_parameter_count) +
- num_args_count + context_count;
-
- const Runtime::Function* function = Runtime::FunctionForId(function_id);
- const size_t return_count = static_cast<size_t>(function->result_size);
-
- LocationSignature::Builder locations(zone, return_count, parameter_count);
- MachineSignature::Builder types(zone, return_count, parameter_count);
-
- // Add returns.
- AddReturnLocations(&locations);
- for (size_t i = 0; i < return_count; i++) {
- types.AddReturn(kMachAnyTagged);
- }
-
- // All parameters to the runtime call go on the stack.
- for (int i = 0; i < js_parameter_count; i++) {
- locations.AddParam(stackloc(i - js_parameter_count));
- types.AddParam(kMachAnyTagged);
- }
- // Add runtime function itself.
- locations.AddParam(regloc(LinkageTraits::RuntimeCallFunctionReg()));
- types.AddParam(kMachAnyTagged);
-
- // Add runtime call argument count.
- locations.AddParam(regloc(LinkageTraits::RuntimeCallArgCountReg()));
- types.AddParam(kMachPtr);
-
- // Add context.
- locations.AddParam(regloc(LinkageTraits::ContextReg()));
- types.AddParam(kMachAnyTagged);
-
- CallDescriptor::Flags flags = Linkage::FrameStateInputCount(function_id) > 0
- ? CallDescriptor::kNeedsFrameState
- : CallDescriptor::kNoFlags;
-
- // The target for runtime calls is a code object.
- MachineType target_type = kMachAnyTagged;
- LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
- return new (zone) CallDescriptor( // --
- CallDescriptor::kCallCodeObject, // kind
- target_type, // target MachineType
- target_loc, // target location
- types.Build(), // machine_sig
- locations.Build(), // location_sig
- js_parameter_count, // stack_parameter_count
- properties, // properties
- kNoCalleeSaved, // callee-saved
- kNoCalleeSaved, // callee-saved fp
- flags, // flags
- function->name); // debug name
- }
-
-
- // TODO(all): Add support for return representations/locations to
- // CallInterfaceDescriptor.
- // TODO(turbofan): cache call descriptors for code stub calls.
- static CallDescriptor* GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- const int register_parameter_count = descriptor.GetRegisterParameterCount();
- const int js_parameter_count =
- register_parameter_count + stack_parameter_count;
- const int context_count = 1;
- const size_t return_count = 1;
- const size_t parameter_count =
- static_cast<size_t>(js_parameter_count + context_count);
-
- LocationSignature::Builder locations(zone, return_count, parameter_count);
- MachineSignature::Builder types(zone, return_count, parameter_count);
-
- // Add return location.
- AddReturnLocations(&locations);
- types.AddReturn(return_type);
-
- // Add parameters in registers and on the stack.
- for (int i = 0; i < js_parameter_count; i++) {
- if (i < register_parameter_count) {
- // The first parameters go in registers.
- Register reg = descriptor.GetRegisterParameter(i);
- Representation rep =
- RepresentationFromType(descriptor.GetParameterType(i));
- locations.AddParam(regloc(reg));
- types.AddParam(reptyp(rep));
- } else {
- // The rest of the parameters go on the stack.
- int stack_slot = i - register_parameter_count - stack_parameter_count;
- locations.AddParam(stackloc(stack_slot));
- types.AddParam(kMachAnyTagged);
- }
- }
- // Add context.
- locations.AddParam(regloc(LinkageTraits::ContextReg()));
- types.AddParam(kMachAnyTagged);
-
- // The target for stub calls is a code object.
- MachineType target_type = kMachAnyTagged;
- LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
- return new (zone) CallDescriptor( // --
- CallDescriptor::kCallCodeObject, // kind
- target_type, // target MachineType
- target_loc, // target location
- types.Build(), // machine_sig
- locations.Build(), // location_sig
- stack_parameter_count, // stack_parameter_count
- properties, // properties
- kNoCalleeSaved, // callee-saved registers
- kNoCalleeSaved, // callee-saved fp
- flags, // flags
- descriptor.DebugName(isolate));
- }
-
- static CallDescriptor* GetInterpreterDispatchDescriptor(Zone* zone) {
- MachineSignature::Builder types(zone, 0, 3);
- LocationSignature::Builder locations(zone, 0, 3);
-
- // Add registers for fixed parameters passed via interpreter dispatch.
- STATIC_ASSERT(0 == Linkage::kInterpreterBytecodeOffsetParameter);
- types.AddParam(kMachIntPtr);
- locations.AddParam(regloc(LinkageTraits::InterpreterBytecodeOffsetReg()));
-
- STATIC_ASSERT(1 == Linkage::kInterpreterBytecodeArrayParameter);
- types.AddParam(kMachAnyTagged);
- locations.AddParam(regloc(LinkageTraits::InterpreterBytecodeArrayReg()));
-
- STATIC_ASSERT(2 == Linkage::kInterpreterDispatchTableParameter);
- types.AddParam(kMachPtr);
- locations.AddParam(regloc(LinkageTraits::InterpreterDispatchTableReg()));
-
- LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
- return new (zone) CallDescriptor( // --
- CallDescriptor::kInterpreterDispatch, // kind
- kMachNone, // target MachineType
- target_loc, // target location
- types.Build(), // machine_sig
- locations.Build(), // location_sig
- 0, // stack_parameter_count
- Operator::kNoProperties, // properties
- kNoCalleeSaved, // callee-saved registers
- kNoCalleeSaved, // callee-saved fp regs
- CallDescriptor::kSupportsTailCalls, // flags
- "interpreter-dispatch");
- }
-
- static LinkageLocation regloc(Register reg) {
- return LinkageLocation::ForRegister(Register::ToAllocationIndex(reg));
- }
-
- static LinkageLocation stackloc(int i) {
- return LinkageLocation::ForCallerFrameSlot(i);
- }
-
- static MachineType reptyp(Representation representation) {
- switch (representation.kind()) {
- case Representation::kInteger8:
- return kMachInt8;
- case Representation::kUInteger8:
- return kMachUint8;
- case Representation::kInteger16:
- return kMachInt16;
- case Representation::kUInteger16:
- return kMachUint16;
- case Representation::kInteger32:
- return kMachInt32;
- case Representation::kSmi:
- case Representation::kTagged:
- case Representation::kHeapObject:
- return kMachAnyTagged;
- case Representation::kDouble:
- return kMachFloat64;
- case Representation::kExternal:
- return kMachPtr;
- case Representation::kNone:
- case Representation::kNumRepresentations:
- break;
- }
- UNREACHABLE();
- return kMachNone;
- }
-};
-
-
-LinkageLocation Linkage::GetOsrValueLocation(int index) const {
- CHECK(incoming_->IsJSFunctionCall());
- int parameter_count = static_cast<int>(incoming_->JSParameterCount() - 1);
- int first_stack_slot = OsrHelper::FirstStackSlotIndex(parameter_count);
-
- if (index == kOsrContextSpillSlotIndex) {
- // Context. Use the parameter location of the context spill slot.
- // Parameter (arity + 1) is special for the context of the function frame.
- int context_index = 1 + 1 + parameter_count; // target + receiver + params
- return incoming_->GetInputLocation(context_index);
- } else if (index >= first_stack_slot) {
- // Local variable stored in this (callee) stack.
- int spill_index = index - first_stack_slot;
- return LinkageLocation::ForCalleeFrameSlot(spill_index);
- } else {
- // Parameter. Use the assigned location from the incoming call descriptor.
- int parameter_index = 1 + index; // skip index 0, which is the target.
- return incoming_->GetInputLocation(parameter_index);
- }
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
-
-#endif // V8_COMPILER_LINKAGE_IMPL_H_
#include "src/compiler/common-operator.h"
#include "src/compiler/linkage.h"
#include "src/compiler/node.h"
+#include "src/compiler/osr.h"
#include "src/compiler/pipeline.h"
#include "src/scopes.h"
namespace internal {
namespace compiler {
+namespace {
+LinkageLocation regloc(Register reg) {
+ return LinkageLocation::ForRegister(Register::ToAllocationIndex(reg));
+}
+
+
+MachineType reptyp(Representation representation) {
+ switch (representation.kind()) {
+ case Representation::kInteger8:
+ return kMachInt8;
+ case Representation::kUInteger8:
+ return kMachUint8;
+ case Representation::kInteger16:
+ return kMachInt16;
+ case Representation::kUInteger16:
+ return kMachUint16;
+ case Representation::kInteger32:
+ return kMachInt32;
+ case Representation::kSmi:
+ case Representation::kTagged:
+ case Representation::kHeapObject:
+ return kMachAnyTagged;
+ case Representation::kDouble:
+ return kMachFloat64;
+ case Representation::kExternal:
+ return kMachPtr;
+ case Representation::kNone:
+ case Representation::kNumRepresentations:
+ break;
+ }
+ UNREACHABLE();
+ return kMachNone;
+}
+} // namespace
+
std::ostream& operator<<(std::ostream& os, const CallDescriptor::Kind& k) {
switch (k) {
}
-//==============================================================================
-// Provide unimplemented methods on unsupported architectures, to at least link.
-//==============================================================================
-#if !V8_TURBOFAN_BACKEND
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(
+ Zone* zone, Runtime::FunctionId function_id, int js_parameter_count,
+ Operator::Properties properties) {
+ const size_t function_count = 1;
+ const size_t num_args_count = 1;
+ const size_t context_count = 1;
+ const size_t parameter_count = function_count +
+ static_cast<size_t>(js_parameter_count) +
+ num_args_count + context_count;
+
+ const Runtime::Function* function = Runtime::FunctionForId(function_id);
+ const size_t return_count = static_cast<size_t>(function->result_size);
+
+ LocationSignature::Builder locations(zone, return_count, parameter_count);
+ MachineSignature::Builder types(zone, return_count, parameter_count);
+
+ // Add returns.
+ if (locations.return_count_ > 0) {
+ locations.AddReturn(regloc(kReturnRegister0));
+ }
+ if (locations.return_count_ > 1) {
+ locations.AddReturn(regloc(kReturnRegister1));
+ }
+ for (size_t i = 0; i < return_count; i++) {
+ types.AddReturn(kMachAnyTagged);
+ }
+
+ // All parameters to the runtime call go on the stack.
+ for (int i = 0; i < js_parameter_count; i++) {
+ locations.AddParam(
+ LinkageLocation::ForCallerFrameSlot(i - js_parameter_count));
+ types.AddParam(kMachAnyTagged);
+ }
+ // Add runtime function itself.
+ locations.AddParam(regloc(kRuntimeCallFunctionRegister));
+ types.AddParam(kMachAnyTagged);
+
+ // Add runtime call argument count.
+ locations.AddParam(regloc(kRuntimeCallArgCountRegister));
+ types.AddParam(kMachPtr);
+
+ // Add context.
+ locations.AddParam(regloc(kContextRegister));
+ types.AddParam(kMachAnyTagged);
+
+ CallDescriptor::Flags flags = Linkage::FrameStateInputCount(function_id) > 0
+ ? CallDescriptor::kNeedsFrameState
+ : CallDescriptor::kNoFlags;
+
+ // The target for runtime calls is a code object.
+ MachineType target_type = kMachAnyTagged;
+ LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
+ return new (zone) CallDescriptor( // --
+ CallDescriptor::kCallCodeObject, // kind
+ target_type, // target MachineType
+ target_loc, // target location
+ types.Build(), // machine_sig
+ locations.Build(), // location_sig
+ js_parameter_count, // stack_parameter_count
+ properties, // properties
+ kNoCalleeSaved, // callee-saved
+ kNoCalleeSaved, // callee-saved fp
+ flags, // flags
+ function->name); // debug name
+}
+
+
CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
+ int js_parameter_count,
CallDescriptor::Flags flags) {
- UNIMPLEMENTED();
- return NULL;
-}
+ const size_t return_count = 1;
+ const size_t context_count = 1;
+ const size_t parameter_count = js_parameter_count + context_count;
+ LocationSignature::Builder locations(zone, return_count, parameter_count);
+ MachineSignature::Builder types(zone, return_count, parameter_count);
-LinkageLocation Linkage::GetOsrValueLocation(int index) const {
- UNIMPLEMENTED();
- return LinkageLocation(-1); // Dummy value
+ // All JS calls have exactly one return value.
+ locations.AddReturn(regloc(kReturnRegister0));
+ types.AddReturn(kMachAnyTagged);
+
+ // All parameters to JS calls go on the stack.
+ for (int i = 0; i < js_parameter_count; i++) {
+ int spill_slot_index = i - js_parameter_count;
+ locations.AddParam(LinkageLocation::ForCallerFrameSlot(spill_slot_index));
+ types.AddParam(kMachAnyTagged);
+ }
+ // Add context.
+ locations.AddParam(regloc(kContextRegister));
+ types.AddParam(kMachAnyTagged);
+
+ // The target for JS function calls is the JSFunction object.
+ MachineType target_type = kMachAnyTagged;
+ // TODO(titzer): When entering into an OSR function from unoptimized code,
+ // the JSFunction is not in a register, but it is on the stack in an
+ // unaddressable spill slot. We hack this in the OSR prologue. Fix.
+ LinkageLocation target_loc = regloc(kJSFunctionRegister);
+ return new (zone) CallDescriptor( // --
+ CallDescriptor::kCallJSFunction, // kind
+ target_type, // target MachineType
+ target_loc, // target location
+ types.Build(), // machine_sig
+ locations.Build(), // location_sig
+ js_parameter_count, // stack_parameter_count
+ Operator::kNoProperties, // properties
+ kNoCalleeSaved, // callee-saved
+ kNoCalleeSaved, // callee-saved fp
+ flags, // flags
+ "js-call");
}
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- UNIMPLEMENTED();
- return NULL;
+CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
+ MachineSignature::Builder types(zone, 0, 3);
+ LocationSignature::Builder locations(zone, 0, 3);
+
+ // Add registers for fixed parameters passed via interpreter dispatch.
+ STATIC_ASSERT(0 == Linkage::kInterpreterBytecodeOffsetParameter);
+ types.AddParam(kMachIntPtr);
+ locations.AddParam(regloc(kInterpreterBytecodeOffsetRegister));
+
+ STATIC_ASSERT(1 == Linkage::kInterpreterBytecodeArrayParameter);
+ types.AddParam(kMachAnyTagged);
+ locations.AddParam(regloc(kInterpreterBytecodeArrayRegister));
+
+ STATIC_ASSERT(2 == Linkage::kInterpreterDispatchTableParameter);
+ types.AddParam(kMachPtr);
+ locations.AddParam(regloc(kInterpreterDispatchTableRegister));
+
+ LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
+ return new (zone) CallDescriptor( // --
+ CallDescriptor::kInterpreterDispatch, // kind
+ kMachNone, // target MachineType
+ target_loc, // target location
+ types.Build(), // machine_sig
+ locations.Build(), // location_sig
+ 0, // stack_parameter_count
+ Operator::kNoProperties, // properties
+ kNoCalleeSaved, // callee-saved registers
+ kNoCalleeSaved, // callee-saved fp regs
+ CallDescriptor::kSupportsTailCalls, // flags
+ "interpreter-dispatch");
}
+// TODO(all): Add support for return representations/locations to
+// CallInterfaceDescriptor.
+// TODO(turbofan): cache call descriptors for code stub calls.
CallDescriptor* Linkage::GetStubCallDescriptor(
Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
int stack_parameter_count, CallDescriptor::Flags flags,
Operator::Properties properties, MachineType return_type) {
- UNIMPLEMENTED();
- return NULL;
+ const int register_parameter_count = descriptor.GetRegisterParameterCount();
+ const int js_parameter_count =
+ register_parameter_count + stack_parameter_count;
+ const int context_count = 1;
+ const size_t return_count = 1;
+ const size_t parameter_count =
+ static_cast<size_t>(js_parameter_count + context_count);
+
+ LocationSignature::Builder locations(zone, return_count, parameter_count);
+ MachineSignature::Builder types(zone, return_count, parameter_count);
+
+ // Add return location.
+ locations.AddReturn(regloc(kReturnRegister0));
+ types.AddReturn(return_type);
+
+ // Add parameters in registers and on the stack.
+ for (int i = 0; i < js_parameter_count; i++) {
+ if (i < register_parameter_count) {
+ // The first parameters go in registers.
+ Register reg = descriptor.GetRegisterParameter(i);
+ Representation rep =
+ RepresentationFromType(descriptor.GetParameterType(i));
+ locations.AddParam(regloc(reg));
+ types.AddParam(reptyp(rep));
+ } else {
+ // The rest of the parameters go on the stack.
+ int stack_slot = i - register_parameter_count - stack_parameter_count;
+ locations.AddParam(LinkageLocation::ForCallerFrameSlot(stack_slot));
+ types.AddParam(kMachAnyTagged);
+ }
+ }
+ // Add context.
+ locations.AddParam(regloc(kContextRegister));
+ types.AddParam(kMachAnyTagged);
+
+ // The target for stub calls is a code object.
+ MachineType target_type = kMachAnyTagged;
+ LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
+ return new (zone) CallDescriptor( // --
+ CallDescriptor::kCallCodeObject, // kind
+ target_type, // target MachineType
+ target_loc, // target location
+ types.Build(), // machine_sig
+ locations.Build(), // location_sig
+ stack_parameter_count, // stack_parameter_count
+ properties, // properties
+ kNoCalleeSaved, // callee-saved registers
+ kNoCalleeSaved, // callee-saved fp
+ flags, // flags
+ descriptor.DebugName(isolate));
}
-#endif // !V8_TURBOFAN_BACKEND
+LinkageLocation Linkage::GetOsrValueLocation(int index) const {
+ CHECK(incoming_->IsJSFunctionCall());
+ int parameter_count = static_cast<int>(incoming_->JSParameterCount() - 1);
+ int first_stack_slot = OsrHelper::FirstStackSlotIndex(parameter_count);
+
+ if (index == kOsrContextSpillSlotIndex) {
+ // Context. Use the parameter location of the context spill slot.
+ // Parameter (arity + 1) is special for the context of the function frame.
+ int context_index = 1 + 1 + parameter_count; // target + receiver + params
+ return incoming_->GetInputLocation(context_index);
+ } else if (index >= first_stack_slot) {
+ // Local variable stored in this (callee) stack.
+ int spill_index = index - first_stack_slot;
+ return LinkageLocation::ForCalleeFrameSlot(spill_index);
+ } else {
+ // Parameter. Use the assigned location from the incoming call descriptor.
+ int parameter_index = 1 + index; // skip index 0, which is the target.
+ return incoming_->GetInputLocation(parameter_index);
+ }
+}
} // namespace compiler
} // namespace internal
} // namespace v8
namespace compiler {
+const RegList kNoCalleeSaved = 0;
+
class Node;
class OsrHelper;
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/compiler/linkage.h"
-#include "src/compiler/linkage-impl.h"
-#include "src/zone.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-struct MipsLinkageHelperTraits {
- static Register ReturnValueReg() { return v0; }
- static Register ReturnValue2Reg() { return v1; }
- static Register JSCallFunctionReg() { return a1; }
- static Register ContextReg() { return cp; }
- static Register InterpreterBytecodeOffsetReg() {
- return kInterpreterBytecodeOffsetRegister;
- }
- static Register InterpreterBytecodeArrayReg() {
- return kInterpreterBytecodeArrayRegister;
- }
- static Register InterpreterDispatchTableReg() {
- return kInterpreterDispatchTableRegister;
- }
- static Register RuntimeCallFunctionReg() { return a1; }
- static Register RuntimeCallArgCountReg() { return a0; }
-};
-
-
-typedef LinkageHelper<MipsLinkageHelperTraits> LH;
-
-CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
- CallDescriptor::Flags flags) {
- return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
-}
-
-
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
- properties);
-}
-
-
-CallDescriptor* Linkage::GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- return LH::GetStubCallDescriptor(isolate, zone, descriptor,
- stack_parameter_count, flags, properties,
- return_type);
-}
-
-
-CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
- return LH::GetInterpreterDispatchDescriptor(zone);
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/compiler/linkage.h"
-#include "src/compiler/linkage-impl.h"
-#include "src/zone.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-struct MipsLinkageHelperTraits {
- static Register ReturnValueReg() { return v0; }
- static Register ReturnValue2Reg() { return v1; }
- static Register JSCallFunctionReg() { return a1; }
- static Register ContextReg() { return cp; }
- static Register InterpreterBytecodeOffsetReg() {
- return kInterpreterBytecodeOffsetRegister;
- }
- static Register InterpreterBytecodeArrayReg() {
- return kInterpreterBytecodeArrayRegister;
- }
- static Register InterpreterDispatchTableReg() {
- return kInterpreterDispatchTableRegister;
- }
- static Register RuntimeCallFunctionReg() { return a1; }
- static Register RuntimeCallArgCountReg() { return a0; }
-};
-
-
-typedef LinkageHelper<MipsLinkageHelperTraits> LH;
-
-CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
- CallDescriptor::Flags flags) {
- return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
-}
-
-
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
- properties);
-}
-
-
-CallDescriptor* Linkage::GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- return LH::GetStubCallDescriptor(isolate, zone, descriptor,
- stack_parameter_count, flags, properties,
- return_type);
-}
-
-
-CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
- return LH::GetInterpreterDispatchDescriptor(zone);
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/compiler/linkage.h"
-#include "src/compiler/linkage-impl.h"
-#include "src/zone.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-struct PPCLinkageHelperTraits {
- static Register ReturnValueReg() { return r3; }
- static Register ReturnValue2Reg() { return r4; }
- static Register JSCallFunctionReg() { return r4; }
- static Register ContextReg() { return cp; }
- static Register InterpreterBytecodeOffsetReg() {
- return kInterpreterBytecodeOffsetRegister;
- }
- static Register InterpreterBytecodeArrayReg() {
- return kInterpreterBytecodeArrayRegister;
- }
- static Register InterpreterDispatchTableReg() {
- return kInterpreterDispatchTableRegister;
- }
- static Register RuntimeCallFunctionReg() { return r4; }
- static Register RuntimeCallArgCountReg() { return r3; }
-};
-
-
-typedef LinkageHelper<PPCLinkageHelperTraits> LH;
-
-CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
- CallDescriptor::Flags flags) {
- return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
-}
-
-
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
- properties);
-}
-
-
-CallDescriptor* Linkage::GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- return LH::GetStubCallDescriptor(isolate, zone, descriptor,
- stack_parameter_count, flags, properties,
- return_type);
-}
-
-
-CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
- return LH::GetInterpreterDispatchDescriptor(zone);
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/compiler/linkage.h"
-#include "src/compiler/linkage-impl.h"
-#include "src/zone.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-struct X64LinkageHelperTraits {
- static Register ReturnValueReg() { return rax; }
- static Register ReturnValue2Reg() { return rdx; }
- static Register JSCallFunctionReg() { return rdi; }
- static Register ContextReg() { return rsi; }
- static Register InterpreterBytecodeOffsetReg() { return r12; }
- static Register InterpreterBytecodeArrayReg() { return r14; }
- static Register InterpreterDispatchTableReg() { return r15; }
- static Register RuntimeCallFunctionReg() { return rbx; }
- static Register RuntimeCallArgCountReg() { return rax; }
-};
-
-typedef LinkageHelper<X64LinkageHelperTraits> LH;
-
-CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
- CallDescriptor::Flags flags) {
- return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
-}
-
-
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
- properties);
-}
-
-
-CallDescriptor* Linkage::GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- return LH::GetStubCallDescriptor(isolate, zone, descriptor,
- stack_parameter_count, flags, properties,
- return_type);
-}
-
-
-CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
- return LH::GetInterpreterDispatchDescriptor(zone);
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
+++ /dev/null
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/assembler.h"
-#include "src/code-stubs.h"
-#include "src/compiler/linkage.h"
-#include "src/compiler/linkage-impl.h"
-#include "src/zone.h"
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-struct X87LinkageHelperTraits {
- static Register ReturnValueReg() { return eax; }
- static Register ReturnValue2Reg() { return edx; }
- static Register JSCallFunctionReg() { return edi; }
- static Register ContextReg() { return esi; }
- static Register InterpreterBytecodeOffsetReg() { return ecx; }
- static Register InterpreterBytecodeArrayReg() { return edi; }
- static Register InterpreterDispatchTableReg() { return ebx; }
- static Register RuntimeCallFunctionReg() { return ebx; }
- static Register RuntimeCallArgCountReg() { return eax; }
-};
-
-typedef LinkageHelper<X87LinkageHelperTraits> LH;
-
-CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
- int parameter_count,
- CallDescriptor::Flags flags) {
- return LH::GetJSCallDescriptor(zone, is_osr, parameter_count, flags);
-}
-
-
-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
- Zone* zone, Runtime::FunctionId function, int parameter_count,
- Operator::Properties properties) {
- return LH::GetRuntimeCallDescriptor(zone, function, parameter_count,
- properties);
-}
-
-
-CallDescriptor* Linkage::GetStubCallDescriptor(
- Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
- int stack_parameter_count, CallDescriptor::Flags flags,
- Operator::Properties properties, MachineType return_type) {
- return LH::GetStubCallDescriptor(isolate, zone, descriptor,
- stack_parameter_count, flags, properties,
- return_type);
-}
-
-
-CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
- return LH::GetInterpreterDispatchDescriptor(zone);
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
namespace v8 {
namespace internal {
+// Give alias names to registers for calling conventions.
+const Register kReturnRegister0 = {kRegister_eax_Code};
+const Register kReturnRegister1 = {kRegister_edx_Code};
+const Register kJSFunctionRegister = {kRegister_edi_Code};
+const Register kContextRegister = {kRegister_esi_Code};
+const Register kInterpreterBytecodeOffsetRegister = {kRegister_ecx_Code};
+const Register kInterpreterBytecodeArrayRegister = {kRegister_edi_Code};
+const Register kInterpreterDispatchTableRegister = {kRegister_ebx_Code};
+const Register kRuntimeCallFunctionRegister = {kRegister_ebx_Code};
+const Register kRuntimeCallArgCountRegister = {kRegister_eax_Code};
+
// Convenience for platform-independent signatures. We do not normally
// distinguish memory operands from other operands on ia32.
typedef Operand MemOperand;
#define cp s7
#define kLithiumScratchReg s3
#define kLithiumScratchReg2 s4
-#define kInterpreterBytecodeOffsetRegister t4
-#define kInterpreterBytecodeArrayRegister t5
-#define kInterpreterDispatchTableRegister t6
#define kLithiumScratchDouble f30
#define kDoubleRegZero f28
// Used on mips32r6 for compare operations.
namespace v8 {
namespace internal {
+// Give alias names to registers for calling conventions.
+const Register kReturnRegister0 = {kRegister_v0_Code};
+const Register kReturnRegister1 = {kRegister_v1_Code};
+const Register kJSFunctionRegister = {kRegister_a1_Code};
+const Register kContextRegister = {Register::kCpRegister};
+const Register kInterpreterBytecodeOffsetRegister = {kRegister_t4_Code};
+const Register kInterpreterBytecodeArrayRegister = {kRegister_t5_Code};
+const Register kInterpreterDispatchTableRegister = {kRegister_t6_Code};
+const Register kRuntimeCallFunctionRegister = {kRegister_a1_Code};
+const Register kRuntimeCallArgCountRegister = {kRegister_a0_Code};
+
// Forward declaration.
class JumpTarget;
#define cp s7
#define kLithiumScratchReg s3
#define kLithiumScratchReg2 s4
-#define kInterpreterBytecodeOffsetRegister t0
-#define kInterpreterBytecodeArrayRegister t1
-#define kInterpreterDispatchTableRegister t2
#define kLithiumScratchDouble f30
#define kDoubleRegZero f28
// Used on mips64r6 for compare operations.
namespace v8 {
namespace internal {
+// Give alias names to registers for calling conventions.
+const Register kReturnRegister0 = {kRegister_v0_Code};
+const Register kReturnRegister1 = {kRegister_v1_Code};
+const Register kJSFunctionRegister = {kRegister_a1_Code};
+const Register kContextRegister = {kRegister_s7_Code};
+const Register kInterpreterBytecodeOffsetRegister = {kRegister_t0_Code};
+const Register kInterpreterBytecodeArrayRegister = {kRegister_t1_Code};
+const Register kInterpreterDispatchTableRegister = {kRegister_t2_Code};
+const Register kRuntimeCallFunctionRegister = {kRegister_a1_Code};
+const Register kRuntimeCallArgCountRegister = {kRegister_a0_Code};
+
// Forward declaration.
class JumpTarget;
const Register cp = {kRegister_r30_Code}; // JavaScript context pointer
const Register kRootRegister = {kRegister_r29_Code}; // Roots array pointer.
const Register kConstantPoolRegister = {kRegister_r28_Code}; // Constant pool
-const Register kInterpreterBytecodeOffsetRegister = {
- kRegister_r14_Code // Interpreter bytecode offset.
-};
-const Register kInterpreterBytecodeArrayRegister = {
- kRegister_r15_Code // Interpreter bytecode array pointer.
-};
-const Register kInterpreterDispatchTableRegister = {
- kRegister_r16_Code // Interpreter dispatch table.
-};
// Double word FP register.
struct DoubleRegister {
namespace v8 {
namespace internal {
+// Give alias names to registers for calling conventions.
+const Register kReturnRegister0 = {kRegister_r3_Code};
+const Register kReturnRegister1 = {kRegister_r4_Code};
+const Register kJSFunctionRegister = {kRegister_r4_Code};
+const Register kContextRegister = {kRegister_r30_Code};
+const Register kInterpreterBytecodeOffsetRegister = {kRegister_r14_Code};
+const Register kInterpreterBytecodeArrayRegister = {kRegister_r15_Code};
+const Register kInterpreterDispatchTableRegister = {kRegister_r16_Code};
+const Register kRuntimeCallFunctionRegister = {kRegister_r4_Code};
+const Register kRuntimeCallArgCountRegister = {kRegister_r3_Code};
+
// ----------------------------------------------------------------------------
// Static helper functions
namespace v8 {
namespace internal {
+// Give alias names to registers for calling conventions.
+const Register kReturnRegister0 = {kRegister_rax_Code};
+const Register kReturnRegister1 = {kRegister_rdx_Code};
+const Register kJSFunctionRegister = {kRegister_rdi_Code};
+const Register kContextRegister = {kRegister_rsi_Code};
+const Register kInterpreterBytecodeOffsetRegister = {kRegister_r12_Code};
+const Register kInterpreterBytecodeArrayRegister = {kRegister_r14_Code};
+const Register kInterpreterDispatchTableRegister = {kRegister_r15_Code};
+const Register kRuntimeCallFunctionRegister = {kRegister_rbx_Code};
+const Register kRuntimeCallArgCountRegister = {kRegister_rax_Code};
+
// Default scratch register used by MacroAssembler (and other code that needs
// a spare register). The register isn't callee save, and not used by the
// function calling convention.
namespace v8 {
namespace internal {
+// Give alias names to registers for calling conventions.
+const Register kReturnRegister0 = {kRegister_eax_Code};
+const Register kReturnRegister1 = {kRegister_edx_Code};
+const Register kJSFunctionRegister = {kRegister_edi_Code};
+const Register kContextRegister = {kRegister_esi_Code};
+const Register kInterpreterBytecodeOffsetRegister = {kRegister_ecx_Code};
+const Register kInterpreterBytecodeArrayRegister = {kRegister_edi_Code};
+const Register kInterpreterDispatchTableRegister = {kRegister_ebx_Code};
+const Register kRuntimeCallFunctionRegister = {kRegister_ebx_Code};
+const Register kRuntimeCallArgCountRegister = {kRegister_eax_Code};
+
// Convenience for platform-independent signatures. We do not normally
// distinguish memory operands from other operands on ia32.
typedef Operand MemOperand;
'../../src/compiler/js-typed-lowering.h',
'../../src/compiler/jump-threading.cc',
'../../src/compiler/jump-threading.h',
- '../../src/compiler/linkage-impl.h',
'../../src/compiler/linkage.cc',
'../../src/compiler/linkage.h',
'../../src/compiler/liveness-analyzer.cc',
'../../src/compiler/arm/code-generator-arm.cc',
'../../src/compiler/arm/instruction-codes-arm.h',
'../../src/compiler/arm/instruction-selector-arm.cc',
- '../../src/compiler/arm/linkage-arm.cc',
'../../src/debug/arm/debug-arm.cc',
'../../src/full-codegen/arm/full-codegen-arm.cc',
'../../src/ic/arm/access-compiler-arm.cc',
'../../src/compiler/arm64/code-generator-arm64.cc',
'../../src/compiler/arm64/instruction-codes-arm64.h',
'../../src/compiler/arm64/instruction-selector-arm64.cc',
- '../../src/compiler/arm64/linkage-arm64.cc',
'../../src/debug/arm64/debug-arm64.cc',
'../../src/full-codegen/arm64/full-codegen-arm64.cc',
'../../src/ic/arm64/access-compiler-arm64.cc',
'../../src/compiler/ia32/code-generator-ia32.cc',
'../../src/compiler/ia32/instruction-codes-ia32.h',
'../../src/compiler/ia32/instruction-selector-ia32.cc',
- '../../src/compiler/ia32/linkage-ia32.cc',
'../../src/debug/ia32/debug-ia32.cc',
'../../src/full-codegen/ia32/full-codegen-ia32.cc',
'../../src/ic/ia32/access-compiler-ia32.cc',
'../../src/compiler/x87/code-generator-x87.cc',
'../../src/compiler/x87/instruction-codes-x87.h',
'../../src/compiler/x87/instruction-selector-x87.cc',
- '../../src/compiler/x87/linkage-x87.cc',
'../../src/debug/x87/debug-x87.cc',
'../../src/full-codegen/x87/full-codegen-x87.cc',
'../../src/ic/x87/access-compiler-x87.cc',
'../../src/compiler/mips/code-generator-mips.cc',
'../../src/compiler/mips/instruction-codes-mips.h',
'../../src/compiler/mips/instruction-selector-mips.cc',
- '../../src/compiler/mips/linkage-mips.cc',
'../../src/full-codegen/mips/full-codegen-mips.cc',
'../../src/debug/mips/debug-mips.cc',
'../../src/ic/mips/access-compiler-mips.cc',
'../../src/compiler/mips64/code-generator-mips64.cc',
'../../src/compiler/mips64/instruction-codes-mips64.h',
'../../src/compiler/mips64/instruction-selector-mips64.cc',
- '../../src/compiler/mips64/linkage-mips64.cc',
'../../src/debug/mips64/debug-mips64.cc',
'../../src/full-codegen/mips64/full-codegen-mips64.cc',
'../../src/ic/mips64/access-compiler-mips64.cc',
'../../src/compiler/x64/code-generator-x64.cc',
'../../src/compiler/x64/instruction-codes-x64.h',
'../../src/compiler/x64/instruction-selector-x64.cc',
- '../../src/compiler/x64/linkage-x64.cc',
],
}],
['v8_target_arch=="ppc" or v8_target_arch=="ppc64"', {
'../../src/compiler/ppc/code-generator-ppc.cc',
'../../src/compiler/ppc/instruction-codes-ppc.h',
'../../src/compiler/ppc/instruction-selector-ppc.cc',
- '../../src/compiler/ppc/linkage-ppc.cc',
'../../src/debug/ppc/debug-ppc.cc',
'../../src/full-codegen/ppc/full-codegen-ppc.cc',
'../../src/ic/ppc/access-compiler-ppc.cc',