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

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 1196213004: [turbofan] Add CodeFactory::Instanceof helper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/code-factory.cc ('k') | no next file » | 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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 Node* ref = jsgraph()->ExternalConstant(ExternalReference(f, isolate())); 258 Node* ref = jsgraph()->ExternalConstant(ExternalReference(f, isolate()));
259 Node* arity = jsgraph()->Int32Constant(nargs); 259 Node* arity = jsgraph()->Int32Constant(nargs);
260 node->InsertInput(zone(), 0, jsgraph()->CEntryStubConstant(fun->result_size)); 260 node->InsertInput(zone(), 0, jsgraph()->CEntryStubConstant(fun->result_size));
261 node->InsertInput(zone(), nargs + 1, ref); 261 node->InsertInput(zone(), nargs + 1, ref);
262 node->InsertInput(zone(), nargs + 2, arity); 262 node->InsertInput(zone(), nargs + 2, arity);
263 node->set_op(common()->Call(desc)); 263 node->set_op(common()->Call(desc));
264 } 264 }
265 265
266 266
267 void JSGenericLowering::LowerJSUnaryNot(Node* node) { 267 void JSGenericLowering::LowerJSUnaryNot(Node* node) {
268 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
268 Callable callable = CodeFactory::ToBoolean( 269 Callable callable = CodeFactory::ToBoolean(
269 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); 270 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
270 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
271 ReplaceWithStubCall(node, callable, 271 ReplaceWithStubCall(node, callable,
272 CallDescriptor::kPatchableCallSite | flags); 272 CallDescriptor::kPatchableCallSite | flags);
273 } 273 }
274 274
275 275
276 void JSGenericLowering::LowerJSTypeOf(Node* node) { 276 void JSGenericLowering::LowerJSTypeOf(Node* node) {
277 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
277 Callable callable = CodeFactory::Typeof(isolate()); 278 Callable callable = CodeFactory::Typeof(isolate());
278 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
279 ReplaceWithStubCall(node, callable, flags); 279 ReplaceWithStubCall(node, callable, flags);
280 } 280 }
281 281
282 282
283 void JSGenericLowering::LowerJSToBoolean(Node* node) { 283 void JSGenericLowering::LowerJSToBoolean(Node* node) {
284 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
284 Callable callable = 285 Callable callable =
285 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); 286 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
286 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
287 ReplaceWithStubCall(node, callable, 287 ReplaceWithStubCall(node, callable,
288 CallDescriptor::kPatchableCallSite | flags); 288 CallDescriptor::kPatchableCallSite | flags);
289 } 289 }
290 290
291 291
292 void JSGenericLowering::LowerJSToNumber(Node* node) { 292 void JSGenericLowering::LowerJSToNumber(Node* node) {
293 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
293 Callable callable = CodeFactory::ToNumber(isolate()); 294 Callable callable = CodeFactory::ToNumber(isolate());
294 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
295 ReplaceWithStubCall(node, callable, flags); 295 ReplaceWithStubCall(node, callable, flags);
296 } 296 }
297 297
298 298
299 void JSGenericLowering::LowerJSToString(Node* node) { 299 void JSGenericLowering::LowerJSToString(Node* node) {
300 ReplaceWithBuiltinCall(node, Builtins::TO_STRING, 1); 300 ReplaceWithBuiltinCall(node, Builtins::TO_STRING, 1);
301 } 301 }
302 302
303 303
304 void JSGenericLowering::LowerJSToName(Node* node) { 304 void JSGenericLowering::LowerJSToName(Node* node) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 node->InsertInput(zone(), 4, jsgraph()->SmiConstant(language_mode)); 358 node->InsertInput(zone(), 4, jsgraph()->SmiConstant(language_mode));
359 } 359 }
360 360
361 361
362 void JSGenericLowering::LowerJSHasProperty(Node* node) { 362 void JSGenericLowering::LowerJSHasProperty(Node* node) {
363 ReplaceWithBuiltinCall(node, Builtins::IN, 2); 363 ReplaceWithBuiltinCall(node, Builtins::IN, 2);
364 } 364 }
365 365
366 366
367 void JSGenericLowering::LowerJSInstanceOf(Node* node) { 367 void JSGenericLowering::LowerJSInstanceOf(Node* node) {
368 InstanceofStub::Flags flags = static_cast<InstanceofStub::Flags>( 368 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node);
369 InstanceofStub::Flags stub_flags = static_cast<InstanceofStub::Flags>(
369 InstanceofStub::kReturnTrueFalseObject | 370 InstanceofStub::kReturnTrueFalseObject |
370 InstanceofStub::kArgsInRegisters); 371 InstanceofStub::kArgsInRegisters);
371 InstanceofStub stub(isolate(), flags); 372 Callable callable = CodeFactory::Instanceof(isolate(), stub_flags);
372 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 373 ReplaceWithStubCall(node, callable, flags);
373 CallDescriptor::Flags desc_flags = AdjustFrameStatesForCall(node);
374 CallDescriptor* desc =
375 Linkage::GetStubCallDescriptor(isolate(), zone(), d, 0, desc_flags);
376 Node* stub_code = jsgraph()->HeapConstant(stub.GetCode());
377 node->InsertInput(zone(), 0, stub_code);
378 node->set_op(common()->Call(desc));
379 } 374 }
380 375
381 376
382 void JSGenericLowering::LowerJSLoadContext(Node* node) { 377 void JSGenericLowering::LowerJSLoadContext(Node* node) {
383 const ContextAccess& access = ContextAccessOf(node->op()); 378 const ContextAccess& access = ContextAccessOf(node->op());
384 for (size_t i = 0; i < access.depth(); ++i) { 379 for (size_t i = 0; i < access.depth(); ++i) {
385 node->ReplaceInput( 380 node->ReplaceInput(
386 0, graph()->NewNode(machine()->Load(kMachAnyTagged), 381 0, graph()->NewNode(machine()->Load(kMachAnyTagged),
387 NodeProperties::GetValueInput(node, 0), 382 NodeProperties::GetValueInput(node, 0),
388 jsgraph()->Int32Constant( 383 jsgraph()->Int32Constant(
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 765 }
771 766
772 767
773 MachineOperatorBuilder* JSGenericLowering::machine() const { 768 MachineOperatorBuilder* JSGenericLowering::machine() const {
774 return jsgraph()->machine(); 769 return jsgraph()->machine();
775 } 770 }
776 771
777 } // namespace compiler 772 } // namespace compiler
778 } // namespace internal 773 } // namespace internal
779 } // namespace v8 774 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698