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

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

Issue 553833002: Initialize CodeStubInterfaceDescriptor in the constructor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler/linkage.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/code-stubs.h" 5 #include "src/code-stubs.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph-inl.h" 7 #include "src/compiler/graph-inl.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-aux-data-inl.h" 10 #include "src/compiler/node-aux-data-inl.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 if (OperatorProperties::HasFrameStateInput(node->op())) { 262 if (OperatorProperties::HasFrameStateInput(node->op())) {
263 result |= CallDescriptor::kNeedsFrameState; 263 result |= CallDescriptor::kNeedsFrameState;
264 } 264 }
265 return result; 265 return result;
266 } 266 }
267 267
268 268
269 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token, 269 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
270 bool pure) { 270 bool pure) {
271 BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack. 271 BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack.
272 CodeStubInterfaceDescriptor d; 272 CodeStubInterfaceDescriptor d(&stub);
273 stub.InitializeInterfaceDescriptor(&d);
274 bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op()); 273 bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op());
275 CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor( 274 CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(
276 &d, 0, CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node)); 275 &d, 0, CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node));
277 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token); 276 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token);
278 NodeVector inputs(zone()); 277 NodeVector inputs(zone());
279 inputs.reserve(node->InputCount() + 1); 278 inputs.reserve(node->InputCount() + 1);
280 inputs.push_back(CodeConstant(ic)); 279 inputs.push_back(CodeConstant(ic));
281 inputs.push_back(NodeProperties::GetValueInput(node, 0)); 280 inputs.push_back(NodeProperties::GetValueInput(node, 0));
282 inputs.push_back(NodeProperties::GetValueInput(node, 1)); 281 inputs.push_back(NodeProperties::GetValueInput(node, 1));
283 inputs.push_back(NodeProperties::GetContextInput(node)); 282 inputs.push_back(NodeProperties::GetContextInput(node));
(...skipping 29 matching lines...) Expand all
313 } 312 }
314 node->TrimInputCount(dest); 313 node->TrimInputCount(dest);
315 } 314 }
316 315
317 ReplaceWithRuntimeCall(node, Runtime::kBooleanize); 316 ReplaceWithRuntimeCall(node, Runtime::kBooleanize);
318 } 317 }
319 318
320 319
321 void JSGenericLowering::ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub, 320 void JSGenericLowering::ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub,
322 CallDescriptor::Flags flags) { 321 CallDescriptor::Flags flags) {
323 CodeStubInterfaceDescriptor d; 322 CodeStubInterfaceDescriptor d(stub);
324 stub->InitializeInterfaceDescriptor(&d);
325 CallDescriptor* desc = 323 CallDescriptor* desc =
326 linkage()->GetStubCallDescriptor(&d, 0, flags | FlagsForNode(node)); 324 linkage()->GetStubCallDescriptor(&d, 0, flags | FlagsForNode(node));
327 Node* stub_code = CodeConstant(stub->GetCode()); 325 Node* stub_code = CodeConstant(stub->GetCode());
328 PatchInsertInput(node, 0, stub_code); 326 PatchInsertInput(node, 0, stub_code);
329 PatchOperator(node, common()->Call(desc)); 327 PatchOperator(node, common()->Call(desc));
330 } 328 }
331 329
332 330
333 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, 331 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node,
334 Builtins::JavaScript id, 332 Builtins::JavaScript id,
335 int nargs) { 333 int nargs) {
336 CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); 334 CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS);
337 CodeStubInterfaceDescriptor d; 335 CodeStubInterfaceDescriptor d(&stub);
338 stub.InitializeInterfaceDescriptor(&d);
339 CallDescriptor* desc = linkage()->GetStubCallDescriptor(&d, nargs); 336 CallDescriptor* desc = linkage()->GetStubCallDescriptor(&d, nargs);
340 // TODO(mstarzinger): Accessing the builtins object this way prevents sharing 337 // TODO(mstarzinger): Accessing the builtins object this way prevents sharing
341 // of code across native contexts. Fix this by loading from given context. 338 // of code across native contexts. Fix this by loading from given context.
342 Handle<JSFunction> function( 339 Handle<JSFunction> function(
343 JSFunction::cast(info()->context()->builtins()->javascript_builtin(id))); 340 JSFunction::cast(info()->context()->builtins()->javascript_builtin(id)));
344 Node* stub_code = CodeConstant(stub.GetCode()); 341 Node* stub_code = CodeConstant(stub.GetCode());
345 Node* function_node = FunctionConstant(function); 342 Node* function_node = FunctionConstant(function);
346 PatchInsertInput(node, 0, stub_code); 343 PatchInsertInput(node, 0, stub_code);
347 PatchInsertInput(node, 1, function_node); 344 PatchInsertInput(node, 1, function_node);
348 PatchOperator(node, common()->Call(desc)); 345 PatchOperator(node, common()->Call(desc));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 ReplaceWithBuiltinCall(node, Builtins::IN, 2); 450 ReplaceWithBuiltinCall(node, Builtins::IN, 2);
454 return node; 451 return node;
455 } 452 }
456 453
457 454
458 Node* JSGenericLowering::LowerJSInstanceOf(Node* node) { 455 Node* JSGenericLowering::LowerJSInstanceOf(Node* node) {
459 InstanceofStub::Flags flags = static_cast<InstanceofStub::Flags>( 456 InstanceofStub::Flags flags = static_cast<InstanceofStub::Flags>(
460 InstanceofStub::kReturnTrueFalseObject | 457 InstanceofStub::kReturnTrueFalseObject |
461 InstanceofStub::kArgsInRegisters); 458 InstanceofStub::kArgsInRegisters);
462 InstanceofStub stub(isolate(), flags); 459 InstanceofStub stub(isolate(), flags);
463 CodeStubInterfaceDescriptor d; 460 CodeStubInterfaceDescriptor d(&stub);
464 stub.InitializeInterfaceDescriptor(&d);
465 CallDescriptor* desc = linkage()->GetStubCallDescriptor(&d, 0); 461 CallDescriptor* desc = linkage()->GetStubCallDescriptor(&d, 0);
466 Node* stub_code = CodeConstant(stub.GetCode()); 462 Node* stub_code = CodeConstant(stub.GetCode());
467 PatchInsertInput(node, 0, stub_code); 463 PatchInsertInput(node, 0, stub_code);
468 PatchOperator(node, common()->Call(desc)); 464 PatchOperator(node, common()->Call(desc));
469 return node; 465 return node;
470 } 466 }
471 467
472 468
473 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { 469 Node* JSGenericLowering::LowerJSLoadContext(Node* node) {
474 ContextAccess access = OpParameter<ContextAccess>(node); 470 ContextAccess access = OpParameter<ContextAccess>(node);
(...skipping 28 matching lines...) Expand all
503 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); 499 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
504 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); 500 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
505 PatchOperator(node, machine()->Store(kMachAnyTagged, kFullWriteBarrier)); 501 PatchOperator(node, machine()->Store(kMachAnyTagged, kFullWriteBarrier));
506 return node; 502 return node;
507 } 503 }
508 504
509 505
510 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { 506 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) {
511 int arity = OpParameter<int>(node); 507 int arity = OpParameter<int>(node);
512 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); 508 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS);
513 CodeStubInterfaceDescriptor d; 509 CodeStubInterfaceDescriptor d(&stub);
514 stub.InitializeInterfaceDescriptor(&d);
515 CallDescriptor* desc = 510 CallDescriptor* desc =
516 linkage()->GetStubCallDescriptor(&d, arity, FlagsForNode(node)); 511 linkage()->GetStubCallDescriptor(&d, arity, FlagsForNode(node));
517 Node* stub_code = CodeConstant(stub.GetCode()); 512 Node* stub_code = CodeConstant(stub.GetCode());
518 Node* construct = NodeProperties::GetValueInput(node, 0); 513 Node* construct = NodeProperties::GetValueInput(node, 0);
519 PatchInsertInput(node, 0, stub_code); 514 PatchInsertInput(node, 0, stub_code);
520 PatchInsertInput(node, 1, Int32Constant(arity - 1)); 515 PatchInsertInput(node, 1, Int32Constant(arity - 1));
521 PatchInsertInput(node, 2, construct); 516 PatchInsertInput(node, 2, construct);
522 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); 517 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant());
523 PatchOperator(node, common()->Call(desc)); 518 PatchOperator(node, common()->Call(desc));
524 return node; 519 return node;
525 } 520 }
526 521
527 522
528 Node* JSGenericLowering::LowerJSCallFunction(Node* node) { 523 Node* JSGenericLowering::LowerJSCallFunction(Node* node) {
529 CallParameters p = OpParameter<CallParameters>(node); 524 CallParameters p = OpParameter<CallParameters>(node);
530 CallFunctionStub stub(isolate(), p.arity - 2, p.flags); 525 CallFunctionStub stub(isolate(), p.arity - 2, p.flags);
531 CodeStubInterfaceDescriptor d; 526 CodeStubInterfaceDescriptor d(&stub);
532 stub.InitializeInterfaceDescriptor(&d);
533 CallDescriptor* desc = 527 CallDescriptor* desc =
534 linkage()->GetStubCallDescriptor(&d, p.arity - 1, FlagsForNode(node)); 528 linkage()->GetStubCallDescriptor(&d, p.arity - 1, FlagsForNode(node));
535 Node* stub_code = CodeConstant(stub.GetCode()); 529 Node* stub_code = CodeConstant(stub.GetCode());
536 PatchInsertInput(node, 0, stub_code); 530 PatchInsertInput(node, 0, stub_code);
537 PatchOperator(node, common()->Call(desc)); 531 PatchOperator(node, common()->Call(desc));
538 return node; 532 return node;
539 } 533 }
540 534
541 535
542 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { 536 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) {
543 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 537 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
544 int arity = OperatorProperties::GetValueInputCount(node->op()); 538 int arity = OperatorProperties::GetValueInputCount(node->op());
545 ReplaceWithRuntimeCall(node, function, arity); 539 ReplaceWithRuntimeCall(node, function, arity);
546 return node; 540 return node;
547 } 541 }
548 542
549 } // namespace compiler 543 } // namespace compiler
550 } // namespace internal 544 } // namespace internal
551 } // namespace v8 545 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698