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

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

Issue 2663963003: [Ignition] Rename New and NewWithSpread bytecodes. (Closed)
Patch Set: Update comments Created 3 years, 10 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
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/debug/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 interpreter::Register first_return = 1345 interpreter::Register first_return =
1346 bytecode_iterator().GetRegisterOperand(3); 1346 bytecode_iterator().GetRegisterOperand(3);
1347 1347
1348 // Create node to perform the runtime call. 1348 // Create node to perform the runtime call.
1349 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 1349 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1350 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); 1350 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1351 environment()->BindRegistersToProjections(first_return, return_pair, 1351 environment()->BindRegistersToProjections(first_return, return_pair,
1352 Environment::kAttachFrameState); 1352 Environment::kAttachFrameState);
1353 } 1353 }
1354 1354
1355 Node* BytecodeGraphBuilder::ProcessCallNewWithSpreadArguments( 1355 Node* BytecodeGraphBuilder::ProcessConstructWithSpreadArguments(
1356 const Operator* op, Node* callee, Node* new_target, 1356 const Operator* op, Node* callee, Node* new_target,
1357 interpreter::Register first_arg, size_t arity) { 1357 interpreter::Register first_arg, size_t arity) {
1358 Node** all = local_zone()->NewArray<Node*>(arity); 1358 Node** all = local_zone()->NewArray<Node*>(arity);
1359 all[0] = callee; 1359 all[0] = callee;
1360 int first_arg_index = first_arg.index(); 1360 int first_arg_index = first_arg.index();
1361 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { 1361 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) {
1362 all[i] = environment()->LookupRegister( 1362 all[i] = environment()->LookupRegister(
1363 interpreter::Register(first_arg_index + i - 1)); 1363 interpreter::Register(first_arg_index + i - 1));
1364 } 1364 }
1365 all[arity - 1] = new_target; 1365 all[arity - 1] = new_target;
1366 Node* value = MakeNode(op, static_cast<int>(arity), all, false); 1366 Node* value = MakeNode(op, static_cast<int>(arity), all, false);
1367 return value; 1367 return value;
1368 } 1368 }
1369 1369
1370 void BytecodeGraphBuilder::VisitNewWithSpread() { 1370 void BytecodeGraphBuilder::VisitConstructWithSpread() {
1371 PrepareEagerCheckpoint(); 1371 PrepareEagerCheckpoint();
1372 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); 1372 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0);
1373 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 1373 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1374 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 1374 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1375 1375
1376 Node* new_target = environment()->LookupAccumulator(); 1376 Node* new_target = environment()->LookupAccumulator();
1377 Node* callee = environment()->LookupRegister(callee_reg); 1377 Node* callee = environment()->LookupRegister(callee_reg);
1378 1378
1379 const Operator* op = 1379 const Operator* op =
1380 javascript()->ConstructWithSpread(static_cast<int>(arg_count) + 2); 1380 javascript()->ConstructWithSpread(static_cast<int>(arg_count) + 2);
1381 Node* value = ProcessCallNewWithSpreadArguments(op, callee, new_target, 1381 Node* value = ProcessConstructWithSpreadArguments(op, callee, new_target,
1382 first_arg, arg_count + 2); 1382 first_arg, arg_count + 2);
1383 environment()->BindAccumulator(value, Environment::kAttachFrameState); 1383 environment()->BindAccumulator(value, Environment::kAttachFrameState);
1384 } 1384 }
1385 1385
1386 void BytecodeGraphBuilder::VisitInvokeIntrinsic() { 1386 void BytecodeGraphBuilder::VisitInvokeIntrinsic() {
1387 PrepareEagerCheckpoint(); 1387 PrepareEagerCheckpoint();
1388 Runtime::FunctionId functionId = bytecode_iterator().GetIntrinsicIdOperand(0); 1388 Runtime::FunctionId functionId = bytecode_iterator().GetIntrinsicIdOperand(0);
1389 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 1389 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1390 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 1390 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1391 1391
1392 // Create node to perform the runtime call. Turbofan will take care of the 1392 // Create node to perform the runtime call. Turbofan will take care of the
1393 // lowering. 1393 // lowering.
1394 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 1394 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1395 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); 1395 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1396 environment()->BindAccumulator(value, Environment::kAttachFrameState); 1396 environment()->BindAccumulator(value, Environment::kAttachFrameState);
1397 } 1397 }
1398 1398
1399 Node* BytecodeGraphBuilder::ProcessCallNewArguments( 1399 Node* BytecodeGraphBuilder::ProcessConstructArguments(
1400 const Operator* call_new_op, Node* callee, Node* new_target, 1400 const Operator* call_new_op, Node* callee, Node* new_target,
1401 interpreter::Register first_arg, size_t arity) { 1401 interpreter::Register first_arg, size_t arity) {
1402 Node** all = local_zone()->NewArray<Node*>(arity); 1402 Node** all = local_zone()->NewArray<Node*>(arity);
1403 all[0] = callee; 1403 all[0] = callee;
1404 int first_arg_index = first_arg.index(); 1404 int first_arg_index = first_arg.index();
1405 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { 1405 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) {
1406 all[i] = environment()->LookupRegister( 1406 all[i] = environment()->LookupRegister(
1407 interpreter::Register(first_arg_index + i - 1)); 1407 interpreter::Register(first_arg_index + i - 1));
1408 } 1408 }
1409 all[arity - 1] = new_target; 1409 all[arity - 1] = new_target;
1410 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); 1410 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false);
1411 return value; 1411 return value;
1412 } 1412 }
1413 1413
1414 void BytecodeGraphBuilder::VisitNew() { 1414 void BytecodeGraphBuilder::VisitConstruct() {
1415 PrepareEagerCheckpoint(); 1415 PrepareEagerCheckpoint();
1416 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); 1416 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0);
1417 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 1417 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1418 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 1418 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1419 // Slot index of 0 is used indicate no feedback slot is available. Assert 1419 // Slot index of 0 is used indicate no feedback slot is available. Assert
1420 // the assumption that slot index 0 is never a valid feedback slot. 1420 // the assumption that slot index 0 is never a valid feedback slot.
1421 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0); 1421 STATIC_ASSERT(TypeFeedbackVector::kReservedIndexCount > 0);
1422 int const slot_id = bytecode_iterator().GetIndexOperand(3); 1422 int const slot_id = bytecode_iterator().GetIndexOperand(3);
1423 VectorSlotPair feedback = CreateVectorSlotPair(slot_id); 1423 VectorSlotPair feedback = CreateVectorSlotPair(slot_id);
1424 1424
1425 Node* new_target = environment()->LookupAccumulator(); 1425 Node* new_target = environment()->LookupAccumulator();
1426 Node* callee = environment()->LookupRegister(callee_reg); 1426 Node* callee = environment()->LookupRegister(callee_reg);
1427 1427
1428 float const frequency = ComputeCallFrequency(slot_id); 1428 float const frequency = ComputeCallFrequency(slot_id);
1429 const Operator* call = javascript()->Construct( 1429 const Operator* call = javascript()->Construct(
1430 static_cast<int>(arg_count) + 2, frequency, feedback); 1430 static_cast<int>(arg_count) + 2, frequency, feedback);
1431 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, 1431 Node* value = ProcessConstructArguments(call, callee, new_target, first_arg,
1432 arg_count + 2); 1432 arg_count + 2);
1433 environment()->BindAccumulator(value, Environment::kAttachFrameState); 1433 environment()->BindAccumulator(value, Environment::kAttachFrameState);
1434 } 1434 }
1435 1435
1436 void BytecodeGraphBuilder::BuildThrow() { 1436 void BytecodeGraphBuilder::BuildThrow() {
1437 PrepareEagerCheckpoint(); 1437 PrepareEagerCheckpoint();
1438 Node* value = environment()->LookupAccumulator(); 1438 Node* value = environment()->LookupAccumulator();
1439 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); 1439 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value);
1440 environment()->BindAccumulator(call, Environment::kAttachFrameState); 1440 environment()->BindAccumulator(call, Environment::kAttachFrameState);
1441 } 1441 }
1442 1442
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 it->source_position().ScriptOffset(), start_position_.InliningId())); 2301 it->source_position().ScriptOffset(), start_position_.InliningId()));
2302 it->Advance(); 2302 it->Advance();
2303 } else { 2303 } else {
2304 DCHECK_GT(it->code_offset(), offset); 2304 DCHECK_GT(it->code_offset(), offset);
2305 } 2305 }
2306 } 2306 }
2307 2307
2308 } // namespace compiler 2308 } // namespace compiler
2309 } // namespace internal 2309 } // namespace internal
2310 } // namespace v8 2310 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698