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

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

Issue 1688283003: [Interpreter] Implements calls through CallICStub in the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removes an unused label declaration. Created 4 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/ia32/builtins-ia32.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/compiler/bytecode-branch-analysis.h" 7 #include "src/compiler/bytecode-branch-analysis.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/operator-properties.h" 9 #include "src/compiler/operator-properties.h"
10 #include "src/interpreter/bytecodes.h" 10 #include "src/interpreter/bytecodes.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 Node* BytecodeGraphBuilder::BuildLoadNativeContextField(int index) { 495 Node* BytecodeGraphBuilder::BuildLoadNativeContextField(int index) {
496 const Operator* op = 496 const Operator* op =
497 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true); 497 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true);
498 Node* native_context = NewNode(op, environment()->Context()); 498 Node* native_context = NewNode(op, environment()->Context());
499 return NewNode(javascript()->LoadContext(0, index, true), native_context); 499 return NewNode(javascript()->LoadContext(0, index, true), native_context);
500 } 500 }
501 501
502 502
503 VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) { 503 VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) {
504 FeedbackVectorSlot slot; 504 FeedbackVectorSlot slot = feedback_vector()->ToSlot(slot_id);
505 if (slot_id >= TypeFeedbackVector::kReservedIndexCount) {
506 slot = feedback_vector()->ToSlot(slot_id);
507 }
508 return VectorSlotPair(feedback_vector(), slot); 505 return VectorSlotPair(feedback_vector(), slot);
509 } 506 }
510 507
511 bool BytecodeGraphBuilder::CreateGraph() { 508 bool BytecodeGraphBuilder::CreateGraph() {
512 // Set up the basic structure of the graph. Outputs for {Start} are 509 // Set up the basic structure of the graph. Outputs for {Start} are
513 // the formal parameters (including the receiver) plus context and 510 // the formal parameters (including the receiver) plus context and
514 // closure. 511 // closure.
515 512
516 // Set up the basic structure of the graph. Outputs for {Start} are the formal 513 // Set up the basic structure of the graph. Outputs for {Start} are the formal
517 // parameters (including the receiver) plus new target, number of arguments, 514 // parameters (including the receiver) plus new target, number of arguments,
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 all[1] = environment()->LookupRegister(receiver); 982 all[1] = environment()->LookupRegister(receiver);
986 int receiver_index = receiver.index(); 983 int receiver_index = receiver.index();
987 for (int i = 2; i < static_cast<int>(arity); ++i) { 984 for (int i = 2; i < static_cast<int>(arity); ++i) {
988 all[i] = environment()->LookupRegister( 985 all[i] = environment()->LookupRegister(
989 interpreter::Register(receiver_index + i - 1)); 986 interpreter::Register(receiver_index + i - 1));
990 } 987 }
991 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false); 988 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false);
992 return value; 989 return value;
993 } 990 }
994 991
995 void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode) { 992 void BytecodeGraphBuilder::BuildCallWithFeedbackSlot(
993 TailCallMode tail_call_mode) {
996 FrameStateBeforeAndAfter states(this); 994 FrameStateBeforeAndAfter states(this);
997 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver 995 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver
998 // register has been loaded with null / undefined explicitly or we are sure it 996 // register has been loaded with null / undefined explicitly or we are sure it
999 // is not null / undefined. 997 // is not null / undefined.
1000 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; 998 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny;
1001 Node* callee = 999 Node* callee =
1002 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1000 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1003 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); 1001 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1);
1004 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 1002 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1005 VectorSlotPair feedback = 1003 int slot_id = bytecode_iterator().GetIndexOperand(3);
1006 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); 1004 VectorSlotPair feedback = CreateVectorSlotPair(slot_id);
1007 1005
1008 const Operator* call = javascript()->CallFunction( 1006 const Operator* call = javascript()->CallFunction(
1009 arg_count + 1, feedback, receiver_hint, tail_call_mode); 1007 arg_count + 1, feedback, receiver_hint, tail_call_mode);
1010 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); 1008 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
1011 environment()->BindAccumulator(value, &states); 1009 environment()->BindAccumulator(value, &states);
1012 } 1010 }
1013 1011
1012 void BytecodeGraphBuilder::VisitCallIC() {
1013 BuildCallWithFeedbackSlot(TailCallMode::kDisallow);
1014 }
1015
1016 void BytecodeGraphBuilder::VisitCallICWide() {
1017 BuildCallWithFeedbackSlot(TailCallMode::kDisallow);
1018 }
1019
1020 void BytecodeGraphBuilder::VisitTailCallIC() {
1021 BuildCallWithFeedbackSlot(TailCallMode::kAllow);
1022 }
1023
1024 void BytecodeGraphBuilder::VisitTailCallICWide() {
1025 BuildCallWithFeedbackSlot(TailCallMode::kAllow);
1026 }
1027
1028 void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode) {
1029 FrameStateBeforeAndAfter states(this);
1030 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver
1031 // register has been loaded with null / undefined explicitly or we are sure it
1032 // is not null / undefined.
1033 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny;
1034 Node* callee =
1035 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1036 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1);
1037 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1038
1039 const Operator* call = javascript()->CallFunction(
1040 arg_count + 1, VectorSlotPair(), receiver_hint, tail_call_mode);
1041 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
1042 environment()->BindAccumulator(value, &states);
1043 }
1044
1014 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); } 1045 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); }
1015 1046
1016 void BytecodeGraphBuilder::VisitCallWide() { 1047 void BytecodeGraphBuilder::VisitCallWide() {
1017 BuildCall(TailCallMode::kDisallow); 1048 BuildCall(TailCallMode::kDisallow);
1018 } 1049 }
1019 1050
1020 void BytecodeGraphBuilder::VisitTailCall() { BuildCall(TailCallMode::kAllow); } 1051 void BytecodeGraphBuilder::VisitTailCall() { BuildCall(TailCallMode::kAllow); }
1021 1052
1022 void BytecodeGraphBuilder::VisitTailCallWide() { 1053 void BytecodeGraphBuilder::VisitTailCallWide() {
1023 BuildCall(TailCallMode::kAllow); 1054 BuildCall(TailCallMode::kAllow);
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 // Phi does not exist yet, introduce one. 1782 // Phi does not exist yet, introduce one.
1752 value = NewPhi(inputs, value, control); 1783 value = NewPhi(inputs, value, control);
1753 value->ReplaceInput(inputs - 1, other); 1784 value->ReplaceInput(inputs - 1, other);
1754 } 1785 }
1755 return value; 1786 return value;
1756 } 1787 }
1757 1788
1758 } // namespace compiler 1789 } // namespace compiler
1759 } // namespace internal 1790 } // namespace internal
1760 } // namespace v8 1791 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698