Chromium Code Reviews| 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/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
| 6 | 6 |
| 7 #include <stack> | 7 #include <stack> |
| 8 | 8 |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 | 453 |
| 454 // TODO(rmcilroy): Deal with possible direct eval here? | 454 // TODO(rmcilroy): Deal with possible direct eval here? |
| 455 // TODO(rmcilroy): Use CallIC to allow call type feedback. | 455 // TODO(rmcilroy): Use CallIC to allow call type feedback. |
| 456 builder().Call(callee, receiver, args->length()); | 456 builder().Call(callee, receiver, args->length()); |
| 457 } | 457 } |
| 458 | 458 |
| 459 | 459 |
| 460 void BytecodeGenerator::VisitCallNew(CallNew* expr) { UNIMPLEMENTED(); } | 460 void BytecodeGenerator::VisitCallNew(CallNew* expr) { UNIMPLEMENTED(); } |
| 461 | 461 |
| 462 | 462 |
| 463 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { UNIMPLEMENTED(); } | 463 void BytecodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
| 464 if (expr->is_jsruntime()) { | |
| 465 UNIMPLEMENTED(); | |
| 466 } | |
| 467 | |
| 468 // Evaluate all arguments to the runtime call. | |
| 469 ZoneList<Expression*>* args = expr->arguments(); | |
| 470 TemporaryRegisterScope temporary_register_scope(&builder_); | |
| 471 // Ensure we always have a valid first_arg register even if there are no | |
| 472 // arguments to pass. | |
| 473 Register first_arg = temporary_register_scope.NewRegister(); | |
| 474 for (int i = 0; i < args->length(); ++i) { | |
| 475 Register arg = | |
| 476 (i == 0) ? first_arg : temporary_register_scope.NewRegister(); | |
| 477 Visit(args->at(i)); | |
| 478 DCHECK(arg.index() - i == first_arg.index()); | |
|
Michael Starzinger
2015/09/29 08:28:34
nit: DCHECK_EQ here?
rmcilroy
2015/10/01 17:02:45
Done.
| |
| 479 builder().StoreAccumulatorInRegister(arg); | |
| 480 } | |
| 481 | |
| 482 // TODO(rmcilroy): support multiple return values. | |
| 483 DCHECK(expr->function()->result_size <= 1); | |
|
oth
2015/09/29 09:33:36
nit: DCHECK_LE
rmcilroy
2015/10/01 17:02:45
Done.
| |
| 484 Runtime::FunctionId function_id = expr->function()->function_id; | |
| 485 builder().CallRuntime(function_id, first_arg, args->length()); | |
| 486 } | |
| 464 | 487 |
| 465 | 488 |
| 466 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 489 void BytecodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 467 UNIMPLEMENTED(); | 490 UNIMPLEMENTED(); |
| 468 } | 491 } |
| 469 | 492 |
| 470 | 493 |
| 471 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { | 494 void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 472 UNIMPLEMENTED(); | 495 UNIMPLEMENTED(); |
| 473 } | 496 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 } | 569 } |
| 547 | 570 |
| 548 | 571 |
| 549 int BytecodeGenerator::feedback_index(FeedbackVectorICSlot slot) const { | 572 int BytecodeGenerator::feedback_index(FeedbackVectorICSlot slot) const { |
| 550 return info()->feedback_vector()->GetIndex(slot); | 573 return info()->feedback_vector()->GetIndex(slot); |
| 551 } | 574 } |
| 552 | 575 |
| 553 } // namespace interpreter | 576 } // namespace interpreter |
| 554 } // namespace internal | 577 } // namespace internal |
| 555 } // namespace v8 | 578 } // namespace v8 |
| OLD | NEW |