OLD | NEW |
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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 void BytecodeGraphBuilder::VisitNewWithSpread() { | 1370 void BytecodeGraphBuilder::VisitNewWithSpread() { |
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()->CallConstructWithSpread(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 = ProcessCallNewWithSpreadArguments(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); |
(...skipping 28 matching lines...) Expand all Loading... |
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()->CallConstruct( | 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 = ProcessCallNewArguments(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); |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |