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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 2571563004: [Turbofan] Implement super calls with spread bytecode in assembly code. (Closed)
Patch Set: Rebase on master Created 4 years 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "src/compiler/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/compiler-source-position-table.h" 10 #include "src/compiler/compiler-source-position-table.h"
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 interpreter::Register first_return = 1328 interpreter::Register first_return =
1329 bytecode_iterator().GetRegisterOperand(3); 1329 bytecode_iterator().GetRegisterOperand(3);
1330 1330
1331 // Create node to perform the runtime call. 1331 // Create node to perform the runtime call.
1332 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 1332 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1333 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); 1333 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1334 environment()->BindRegistersToProjections(first_return, return_pair, 1334 environment()->BindRegistersToProjections(first_return, return_pair,
1335 Environment::kAttachFrameState); 1335 Environment::kAttachFrameState);
1336 } 1336 }
1337 1337
1338 Node* BytecodeGraphBuilder::ProcessCallNewWithSpreadArguments(
1339 const Operator* op, interpreter::Register first_arg, size_t arity) {
1340 Node** all = local_zone()->NewArray<Node*>(arity);
1341 all[0] = environment()->LookupRegister(first_arg);
1342 int first_arg_index = first_arg.index();
1343 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) {
1344 all[i] = environment()->LookupRegister(
1345 interpreter::Register(first_arg_index + i + 1));
1346 }
1347 all[arity - 1] =
1348 environment()->LookupRegister(interpreter::Register(first_arg_index + 1));
1349 Node* value = MakeNode(op, static_cast<int>(arity), all, false);
1350 return value;
1351 }
1352
1338 void BytecodeGraphBuilder::VisitNewWithSpread() { 1353 void BytecodeGraphBuilder::VisitNewWithSpread() {
1339 PrepareEagerCheckpoint(); 1354 PrepareEagerCheckpoint();
1340 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(0); 1355 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(0);
1341 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(1); 1356 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(1);
1342 1357
1343 const Operator* op = 1358 const Operator* op =
1344 javascript()->CallConstructWithSpread(static_cast<int>(arg_count)); 1359 javascript()->CallConstructWithSpread(static_cast<int>(arg_count));
1345 Node* value = ProcessCallRuntimeArguments(op, first_arg, arg_count); 1360 Node* value = ProcessCallNewWithSpreadArguments(op, first_arg, arg_count);
1346 environment()->BindAccumulator(value, Environment::kAttachFrameState); 1361 environment()->BindAccumulator(value, Environment::kAttachFrameState);
1347 } 1362 }
1348 1363
1349 void BytecodeGraphBuilder::VisitInvokeIntrinsic() { 1364 void BytecodeGraphBuilder::VisitInvokeIntrinsic() {
1350 PrepareEagerCheckpoint(); 1365 PrepareEagerCheckpoint();
1351 Runtime::FunctionId functionId = bytecode_iterator().GetIntrinsicIdOperand(0); 1366 Runtime::FunctionId functionId = bytecode_iterator().GetIntrinsicIdOperand(0);
1352 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 1367 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1353 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 1368 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1354 1369
1355 // Create node to perform the runtime call. Turbofan will take care of the 1370 // Create node to perform the runtime call. Turbofan will take care of the
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 it->source_position().ScriptOffset(), start_position_.InliningId())); 2251 it->source_position().ScriptOffset(), start_position_.InliningId()));
2237 it->Advance(); 2252 it->Advance();
2238 } else { 2253 } else {
2239 DCHECK_GT(it->code_offset(), offset); 2254 DCHECK_GT(it->code_offset(), offset);
2240 } 2255 }
2241 } 2256 }
2242 2257
2243 } // namespace compiler 2258 } // namespace compiler
2244 } // namespace internal 2259 } // namespace internal
2245 } // namespace v8 2260 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698