| 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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 const Operator* call = javascript()->CallFunction( | 1266 const Operator* call = javascript()->CallFunction( |
| 1267 arg_count + 1, frequency, feedback, receiver_hint, tail_call_mode); | 1267 arg_count + 1, frequency, feedback, receiver_hint, tail_call_mode); |
| 1268 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); | 1268 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); |
| 1269 environment()->BindAccumulator(value, Environment::kAttachFrameState); | 1269 environment()->BindAccumulator(value, Environment::kAttachFrameState); |
| 1270 } | 1270 } |
| 1271 | 1271 |
| 1272 void BytecodeGraphBuilder::VisitCall() { | 1272 void BytecodeGraphBuilder::VisitCall() { |
| 1273 BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kAny); | 1273 BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kAny); |
| 1274 } | 1274 } |
| 1275 | 1275 |
| 1276 void BytecodeGraphBuilder::VisitCallWithSpread() { |
| 1277 PrepareEagerCheckpoint(); |
| 1278 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(0); |
| 1279 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(1); |
| 1280 const Operator* op = |
| 1281 javascript()->CallFunctionWithSpread(static_cast<int>(arg_count)); |
| 1282 Node* value = ProcessCallRuntimeArguments(op, first_arg, arg_count); |
| 1283 environment()->BindAccumulator(value, Environment::kAttachFrameState); |
| 1284 } |
| 1285 |
| 1276 void BytecodeGraphBuilder::VisitCallProperty() { | 1286 void BytecodeGraphBuilder::VisitCallProperty() { |
| 1277 BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kNotNullOrUndefined); | 1287 BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kNotNullOrUndefined); |
| 1278 } | 1288 } |
| 1279 | 1289 |
| 1280 void BytecodeGraphBuilder::VisitTailCall() { | 1290 void BytecodeGraphBuilder::VisitTailCall() { |
| 1281 TailCallMode tail_call_mode = | 1291 TailCallMode tail_call_mode = |
| 1282 bytecode_array_->GetIsolate()->is_tail_call_elimination_enabled() | 1292 bytecode_array_->GetIsolate()->is_tail_call_elimination_enabled() |
| 1283 ? TailCallMode::kAllow | 1293 ? TailCallMode::kAllow |
| 1284 : TailCallMode::kDisallow; | 1294 : TailCallMode::kDisallow; |
| 1285 BuildCall(tail_call_mode, ConvertReceiverMode::kAny); | 1295 BuildCall(tail_call_mode, ConvertReceiverMode::kAny); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 int first_arg_index = first_arg.index(); | 1356 int first_arg_index = first_arg.index(); |
| 1347 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { | 1357 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { |
| 1348 all[i] = environment()->LookupRegister( | 1358 all[i] = environment()->LookupRegister( |
| 1349 interpreter::Register(first_arg_index + i - 1)); | 1359 interpreter::Register(first_arg_index + i - 1)); |
| 1350 } | 1360 } |
| 1351 all[arity - 1] = new_target; | 1361 all[arity - 1] = new_target; |
| 1352 Node* value = MakeNode(op, static_cast<int>(arity), all, false); | 1362 Node* value = MakeNode(op, static_cast<int>(arity), all, false); |
| 1353 return value; | 1363 return value; |
| 1354 } | 1364 } |
| 1355 | 1365 |
| 1356 void BytecodeGraphBuilder::VisitCallWithSpread() { | |
| 1357 PrepareEagerCheckpoint(); | |
| 1358 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(0); | |
| 1359 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(1); | |
| 1360 const Operator* call = | |
| 1361 javascript()->CallRuntime(Runtime::kCallWithSpread, arg_count); | |
| 1362 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); | |
| 1363 environment()->BindAccumulator(value, Environment::kAttachFrameState); | |
| 1364 } | |
| 1365 | |
| 1366 void BytecodeGraphBuilder::VisitNewWithSpread() { | 1366 void BytecodeGraphBuilder::VisitNewWithSpread() { |
| 1367 PrepareEagerCheckpoint(); | 1367 PrepareEagerCheckpoint(); |
| 1368 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); | 1368 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); |
| 1369 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); | 1369 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); |
| 1370 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); | 1370 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); |
| 1371 | 1371 |
| 1372 Node* new_target = environment()->LookupAccumulator(); | 1372 Node* new_target = environment()->LookupAccumulator(); |
| 1373 Node* callee = environment()->LookupRegister(callee_reg); | 1373 Node* callee = environment()->LookupRegister(callee_reg); |
| 1374 | 1374 |
| 1375 const Operator* op = | 1375 const Operator* op = |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2298 it->source_position().ScriptOffset(), start_position_.InliningId())); | 2298 it->source_position().ScriptOffset(), start_position_.InliningId())); |
| 2299 it->Advance(); | 2299 it->Advance(); |
| 2300 } else { | 2300 } else { |
| 2301 DCHECK_GT(it->code_offset(), offset); | 2301 DCHECK_GT(it->code_offset(), offset); |
| 2302 } | 2302 } |
| 2303 } | 2303 } |
| 2304 | 2304 |
| 2305 } // namespace compiler | 2305 } // namespace compiler |
| 2306 } // namespace internal | 2306 } // namespace internal |
| 2307 } // namespace v8 | 2307 } // namespace v8 |
| OLD | NEW |