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

Side by Side Diff: src/compiler/raw-machine-assembler.cc

Issue 1300813005: [Interpreter] Add implementations of arithmetic binary op bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@mstar_v8h
Patch Set: Fix unittest too... Created 5 years, 3 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/raw-machine-assembler.h ('k') | src/interpreter/bytecode-array-builder.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/raw-machine-assembler.h" 5 #include "src/compiler/raw-machine-assembler.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/pipeline.h" 8 #include "src/compiler/pipeline.h"
9 #include "src/compiler/scheduler.h" 9 #include "src/compiler/scheduler.h"
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 Node* ret = graph()->NewNode(common()->Return(), value); 97 Node* ret = graph()->NewNode(common()->Return(), value);
98 schedule()->AddReturn(CurrentBlock(), ret); 98 schedule()->AddReturn(CurrentBlock(), ret);
99 current_block_ = nullptr; 99 current_block_ = nullptr;
100 } 100 }
101 101
102 102
103 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function, 103 Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function,
104 Node** args) { 104 Node** args) {
105 int param_count = 105 int param_count =
106 static_cast<int>(desc->GetMachineSignature()->parameter_count()); 106 static_cast<int>(desc->GetMachineSignature()->parameter_count());
107 Node** buffer = zone()->NewArray<Node*>(param_count + 3); 107 int input_count = param_count + 3;
108 Node** buffer = zone()->NewArray<Node*>(input_count);
108 int index = 0; 109 int index = 0;
109 buffer[index++] = function; 110 buffer[index++] = function;
110 for (int i = 0; i < param_count; i++) { 111 for (int i = 0; i < param_count; i++) {
111 buffer[index++] = args[i]; 112 buffer[index++] = args[i];
112 } 113 }
113 buffer[index++] = graph()->start(); 114 buffer[index++] = graph()->start();
114 buffer[index++] = graph()->start(); 115 buffer[index++] = graph()->start();
115 Node* call = graph()->NewNode(common()->Call(desc), param_count + 3, buffer); 116 Node* call = graph()->NewNode(common()->Call(desc), input_count, buffer);
116 schedule()->AddNode(CurrentBlock(), call); 117 schedule()->AddNode(CurrentBlock(), call);
117 return call; 118 return call;
118 } 119 }
119 120
120 121
122 Node* RawMachineAssembler::CallNWithFrameState(CallDescriptor* desc,
123 Node* function, Node** args,
124 Node* frame_state) {
125 DCHECK(desc->NeedsFrameState());
126 int param_count =
127 static_cast<int>(desc->GetMachineSignature()->parameter_count());
128 int input_count = param_count + 4;
129 Node** buffer = zone()->NewArray<Node*>(input_count);
130 int index = 0;
131 buffer[index++] = function;
132 for (int i = 0; i < param_count; i++) {
133 buffer[index++] = args[i];
134 }
135 buffer[index++] = frame_state;
136 buffer[index++] = graph()->start();
137 buffer[index++] = graph()->start();
138 Node* call = graph()->NewNode(common()->Call(desc), input_count, buffer);
139 schedule()->AddNode(CurrentBlock(), call);
140 return call;
141 }
142
143
144 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function,
145 Node** args) {
146 int param_count =
147 static_cast<int>(desc->GetMachineSignature()->parameter_count());
148 int input_count = param_count + 3;
149 Node** buffer = zone()->NewArray<Node*>(input_count);
150 int index = 0;
151 buffer[index++] = function;
152 for (int i = 0; i < param_count; i++) {
153 buffer[index++] = args[i];
154 }
155 buffer[index++] = graph()->start();
156 buffer[index++] = graph()->start();
157 Node* tail_call =
158 graph()->NewNode(common()->TailCall(desc), input_count, buffer);
159 schedule()->AddTailCall(CurrentBlock(), tail_call);
160 return tail_call;
161 }
162
163
121 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, 164 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver,
122 Node* context, Node* frame_state, 165 Node* context, Node* frame_state,
123 CallFunctionFlags flags) { 166 CallFunctionFlags flags) {
124 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags); 167 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags);
125 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 168 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
126 isolate(), zone(), callable.descriptor(), 1, 169 isolate(), zone(), callable.descriptor(), 1,
127 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); 170 CallDescriptor::kNeedsFrameState, Operator::kNoProperties);
128 Node* stub_code = HeapConstant(callable.code()); 171 Node* stub_code = HeapConstant(callable.code());
129 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, 172 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function,
130 receiver, context, frame_state, 173 receiver, context, frame_state,
131 graph()->start(), graph()->start()); 174 graph()->start(), graph()->start());
132 schedule()->AddNode(CurrentBlock(), call); 175 schedule()->AddNode(CurrentBlock(), call);
133 return call; 176 return call;
134 } 177 }
135 178
136 179
137 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver,
138 Node* context, Node* frame_state) {
139 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
140 zone(), false, 1, CallDescriptor::kNeedsFrameState);
141 Node* call =
142 graph()->NewNode(common()->Call(descriptor), function, receiver, context,
143 frame_state, graph()->start(), graph()->start());
144 schedule()->AddNode(CurrentBlock(), call);
145 return call;
146 }
147
148
149 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, 180 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
150 Node* arg0, Node* context, 181 Node* arg0, Node* context,
151 Node* frame_state) { 182 Node* frame_state) {
152 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( 183 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor(
153 zone(), function, 1, Operator::kNoProperties); 184 zone(), function, 1, Operator::kNoProperties);
154 185
155 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); 186 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
156 Node* ref = NewNode( 187 Node* ref = NewNode(
157 common()->ExternalConstant(ExternalReference(function, isolate()))); 188 common()->ExternalConstant(ExternalReference(function, isolate())));
158 Node* arity = Int32Constant(1); 189 Node* arity = Int32Constant(1);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 graph()->start()}; 273 graph()->start()};
243 const CallDescriptor* descriptor = 274 const CallDescriptor* descriptor =
244 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build()); 275 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
245 Node* call = 276 Node* call =
246 graph()->NewNode(common()->Call(descriptor), arraysize(args), args); 277 graph()->NewNode(common()->Call(descriptor), arraysize(args), args);
247 schedule()->AddNode(CurrentBlock(), call); 278 schedule()->AddNode(CurrentBlock(), call);
248 return call; 279 return call;
249 } 280 }
250 281
251 282
252 Node* RawMachineAssembler::TailCallInterpreterDispatch(
253 const CallDescriptor* call_descriptor, Node* target, Node* arg1, Node* arg2,
254 Node* arg3, Node* arg4, Node* arg5, Node* arg6) {
255 Node* tail_call = graph()->NewNode(common()->TailCall(call_descriptor),
256 target, arg1, arg2, arg3, arg4, arg5, arg6,
257 graph()->start(), graph()->start());
258 schedule()->AddTailCall(CurrentBlock(), tail_call);
259 return tail_call;
260 }
261
262
263 void RawMachineAssembler::Bind(Label* label) { 283 void RawMachineAssembler::Bind(Label* label) {
264 DCHECK(current_block_ == nullptr); 284 DCHECK(current_block_ == nullptr);
265 DCHECK(!label->bound_); 285 DCHECK(!label->bound_);
266 label->bound_ = true; 286 label->bound_ = true;
267 current_block_ = EnsureBlock(label); 287 current_block_ = EnsureBlock(label);
268 } 288 }
269 289
270 290
271 BasicBlock* RawMachineAssembler::Use(Label* label) { 291 BasicBlock* RawMachineAssembler::Use(Label* label) {
272 label->used_ = true; 292 label->used_ = true;
(...skipping 18 matching lines...) Expand all
291 DCHECK_NOT_NULL(schedule_); 311 DCHECK_NOT_NULL(schedule_);
292 DCHECK(current_block_ != nullptr); 312 DCHECK(current_block_ != nullptr);
293 Node* node = graph()->NewNode(op, input_count, inputs); 313 Node* node = graph()->NewNode(op, input_count, inputs);
294 schedule()->AddNode(CurrentBlock(), node); 314 schedule()->AddNode(CurrentBlock(), node);
295 return node; 315 return node;
296 } 316 }
297 317
298 } // namespace compiler 318 } // namespace compiler
299 } // namespace internal 319 } // namespace internal
300 } // namespace v8 320 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698