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

Side by Side Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 1323463005: [Interpreter] Add support for JS calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/compiler/instruction-selector-impl.h" 8 #include "src/compiler/instruction-selector-impl.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 // Emit the call instruction. 1194 // Emit the call instruction.
1195 size_t output_count = buffer.outputs.size(); 1195 size_t output_count = buffer.outputs.size();
1196 auto* outputs = &buffer.outputs.front(); 1196 auto* outputs = &buffer.outputs.front();
1197 Emit(opcode, output_count, outputs, buffer.instruction_args.size(), 1197 Emit(opcode, output_count, outputs, buffer.instruction_args.size(),
1198 &buffer.instruction_args.front())->MarkAsCall(); 1198 &buffer.instruction_args.front())->MarkAsCall();
1199 Emit(kArchRet, 0, nullptr, output_count, outputs); 1199 Emit(kArchRet, 0, nullptr, output_count, outputs);
1200 } 1200 }
1201 } 1201 }
1202 1202
1203 1203
1204 void InstructionSelector::VisitCallVarArgs(Node* node) {
1205 X64OperandGenerator g(this);
1206 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node);
1207 const int descriptor_input_count = static_cast<int>(descriptor->InputCount());
1208
1209 FrameStateDescriptor* frame_state_descriptor = nullptr;
1210 if (descriptor->NeedsFrameState()) {
1211 frame_state_descriptor =
1212 GetFrameStateDescriptor(node->InputAt(descriptor_input_count + 2));
1213 }
1214
1215 CallBuffer buffer(zone(), descriptor, frame_state_descriptor);
1216
1217 // Compute InstructionOperands for inputs and outputs.
1218 InitializeCallBuffer(node, &buffer, true, true);
1219
1220 // Push the arguments onto the stack.
1221 Node* args_start = node->InputAt(descriptor_input_count);
1222 Node* args_end = node->InputAt(descriptor_input_count + 1);
1223 Emit(kX64PushMultiple, g.NoOutput(), g.UseRegister(args_start),
Benedikt Meurer 2015/09/07 05:14:30 Mhm, I have mixed feelings with this, but on the o
1224 g.UseRegister(args_end));
1225
1226 // Select the appropriate opcode based on the call type.
1227 CallDescriptor::Flags flags = descriptor->flags();
1228 InstructionCode opcode;
1229 switch (descriptor->kind()) {
1230 case CallDescriptor::kCallCodeObject:
1231 opcode = kArchCallCodeObject | MiscField::encode(flags);
1232 break;
1233 case CallDescriptor::kCallJSFunction:
1234 opcode = kArchCallJSFunction | MiscField::encode(flags);
1235 break;
1236 default:
1237 UNREACHABLE();
1238 return;
1239 }
1240
1241 // Emit the call instruction.
1242 size_t const output_count = buffer.outputs.size();
1243 auto* outputs = output_count ? &buffer.outputs.front() : nullptr;
1244 Emit(opcode, output_count, outputs, buffer.instruction_args.size(),
1245 &buffer.instruction_args.front())->MarkAsCall();
1246 }
1247
1248
1204 namespace { 1249 namespace {
1205 1250
1206 // Shared routine for multiple compare operations. 1251 // Shared routine for multiple compare operations.
1207 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, 1252 void VisitCompare(InstructionSelector* selector, InstructionCode opcode,
1208 InstructionOperand left, InstructionOperand right, 1253 InstructionOperand left, InstructionOperand right,
1209 FlagsContinuation* cont) { 1254 FlagsContinuation* cont) {
1210 X64OperandGenerator g(selector); 1255 X64OperandGenerator g(selector);
1211 opcode = cont->Encode(opcode); 1256 opcode = cont->Encode(opcode);
1212 if (cont->IsBranch()) { 1257 if (cont->IsBranch()) {
1213 selector->Emit(opcode, g.NoOutput(), left, right, 1258 selector->Emit(opcode, g.NoOutput(), left, right,
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 if (CpuFeatures::IsSupported(SSE4_1)) { 1729 if (CpuFeatures::IsSupported(SSE4_1)) {
1685 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1730 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1686 MachineOperatorBuilder::kFloat64RoundTruncate; 1731 MachineOperatorBuilder::kFloat64RoundTruncate;
1687 } 1732 }
1688 return flags; 1733 return flags;
1689 } 1734 }
1690 1735
1691 } // namespace compiler 1736 } // namespace compiler
1692 } // namespace internal 1737 } // namespace internal
1693 } // namespace v8 1738 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698