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

Unified Diff: src/compiler/runtime-linkage.cc

Issue 1272883003: [turbofan] Remove architecture-specific linkage files and LinkageTraits. Use macro-assembler-define… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/runtime-linkage.cc
diff --git a/src/compiler/runtime-linkage.cc b/src/compiler/runtime-linkage.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c84c100d1305db15cfc586230a9d1f65dde0e90e
--- /dev/null
+++ b/src/compiler/runtime-linkage.cc
@@ -0,0 +1,82 @@
+// Copyright 2015 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/macro-assembler.h"
+
+#include "src/compiler/linkage.h"
+
+#include "src/compiler/linkage-impl.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+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(stackloc(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
+}
+}
+}
+}

Powered by Google App Engine
This is Rietveld 408576698