| OLD | NEW | 
|---|
| 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" | 
| 11 #include "src/compiler/node-properties-inl.h" | 11 #include "src/compiler/node-properties-inl.h" | 
| 12 #include "src/unique.h" | 12 #include "src/unique.h" | 
| 13 | 13 | 
| 14 namespace v8 { | 14 namespace v8 { | 
| 15 namespace internal { | 15 namespace internal { | 
| 16 namespace compiler { | 16 namespace compiler { | 
| 17 | 17 | 
| 18 | 18 | 
| 19 // TODO(mstarzinger): This is a temporary workaround for non-hydrogen stubs for |  | 
| 20 // which we don't have an interface descriptor yet. Use ReplaceWithStubCall |  | 
| 21 // once these stub have been made into a HydrogenCodeStub. |  | 
| 22 template <typename T> |  | 
| 23 static CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate, |  | 
| 24                                                            T* stub) { |  | 
| 25   CodeStub::Major key = static_cast<CodeStub*>(stub)->MajorKey(); |  | 
| 26   CodeStubInterfaceDescriptor* d = isolate->code_stub_interface_descriptor(key); |  | 
| 27   stub->InitializeInterfaceDescriptor(d); |  | 
| 28   return d; |  | 
| 29 } |  | 
| 30 |  | 
| 31 |  | 
| 32 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 19 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 
| 33 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 20 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 
| 34 // stub for the underlying IC stub code. | 21 // stub for the underlying IC stub code. | 
| 35 class LoadICStubShim : public HydrogenCodeStub { | 22 class LoadICStubShim : public HydrogenCodeStub { | 
| 36  public: | 23  public: | 
| 37   LoadICStubShim(Isolate* isolate, ContextualMode contextual_mode) | 24   LoadICStubShim(Isolate* isolate, ContextualMode contextual_mode) | 
| 38       : HydrogenCodeStub(isolate), contextual_mode_(contextual_mode) { | 25       : HydrogenCodeStub(isolate), contextual_mode_(contextual_mode) {} | 
| 39     i::compiler::GetInterfaceDescriptor(isolate, this); |  | 
| 40   } |  | 
| 41 | 26 | 
| 42   virtual Handle<Code> GenerateCode() OVERRIDE { | 27   virtual Handle<Code> GenerateCode() OVERRIDE { | 
| 43     ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode_); | 28     ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode_); | 
| 44     return LoadIC::initialize_stub(isolate(), extra_state); | 29     return LoadIC::initialize_stub(isolate(), extra_state); | 
| 45   } | 30   } | 
| 46 | 31 | 
| 47   virtual void InitializeInterfaceDescriptor( | 32   virtual void InitializeInterfaceDescriptor( | 
| 48       CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 33       CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 
| 49     LoadDescriptor call_descriptor(isolate()); | 34     LoadDescriptor call_descriptor(isolate()); | 
| 50     descriptor->Initialize(MajorKey(), call_descriptor); | 35     descriptor->Initialize(MajorKey(), call_descriptor); | 
| 51   } | 36   } | 
| 52 | 37 | 
| 53  private: | 38  private: | 
| 54   virtual Major MajorKey() const OVERRIDE { return NoCache; } | 39   virtual Major MajorKey() const OVERRIDE { return NoCache; } | 
| 55   virtual bool UseSpecialCache() OVERRIDE { return true; } | 40   virtual bool UseSpecialCache() OVERRIDE { return true; } | 
| 56 | 41 | 
| 57   ContextualMode contextual_mode_; | 42   ContextualMode contextual_mode_; | 
| 58 }; | 43 }; | 
| 59 | 44 | 
| 60 | 45 | 
| 61 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 46 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 
| 62 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 47 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 
| 63 // stub for the underlying IC stub code. | 48 // stub for the underlying IC stub code. | 
| 64 class KeyedLoadICStubShim : public HydrogenCodeStub { | 49 class KeyedLoadICStubShim : public HydrogenCodeStub { | 
| 65  public: | 50  public: | 
| 66   explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) { | 51   explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 
| 67     i::compiler::GetInterfaceDescriptor(isolate, this); |  | 
| 68   } |  | 
| 69 | 52 | 
| 70   virtual Handle<Code> GenerateCode() OVERRIDE { | 53   virtual Handle<Code> GenerateCode() OVERRIDE { | 
| 71     return isolate()->builtins()->KeyedLoadIC_Initialize(); | 54     return isolate()->builtins()->KeyedLoadIC_Initialize(); | 
| 72   } | 55   } | 
| 73 | 56 | 
| 74   virtual void InitializeInterfaceDescriptor( | 57   virtual void InitializeInterfaceDescriptor( | 
| 75       CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 58       CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 
| 76     LoadDescriptor call_descriptor(isolate()); | 59     LoadDescriptor call_descriptor(isolate()); | 
| 77     descriptor->Initialize(MajorKey(), call_descriptor); | 60     descriptor->Initialize(MajorKey(), call_descriptor); | 
| 78   } | 61   } | 
| 79 | 62 | 
| 80  private: | 63  private: | 
| 81   virtual Major MajorKey() const OVERRIDE { return NoCache; } | 64   virtual Major MajorKey() const OVERRIDE { return NoCache; } | 
| 82   virtual bool UseSpecialCache() OVERRIDE { return true; } | 65   virtual bool UseSpecialCache() OVERRIDE { return true; } | 
| 83 }; | 66 }; | 
| 84 | 67 | 
| 85 | 68 | 
| 86 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 69 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 
| 87 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 70 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 
| 88 // stub for the underlying IC stub code. | 71 // stub for the underlying IC stub code. | 
| 89 class StoreICStubShim : public HydrogenCodeStub { | 72 class StoreICStubShim : public HydrogenCodeStub { | 
| 90  public: | 73  public: | 
| 91   StoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 74   StoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 
| 92       : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { | 75       : HydrogenCodeStub(isolate), strict_mode_(strict_mode) {} | 
| 93     i::compiler::GetInterfaceDescriptor(isolate, this); |  | 
| 94   } |  | 
| 95 | 76 | 
| 96   virtual Handle<Code> GenerateCode() OVERRIDE { | 77   virtual Handle<Code> GenerateCode() OVERRIDE { | 
| 97     return StoreIC::initialize_stub(isolate(), strict_mode_); | 78     return StoreIC::initialize_stub(isolate(), strict_mode_); | 
| 98   } | 79   } | 
| 99 | 80 | 
| 100   virtual void InitializeInterfaceDescriptor( | 81   virtual void InitializeInterfaceDescriptor( | 
| 101       CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 82       CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 
| 102     StoreDescriptor call_descriptor(isolate()); | 83     StoreDescriptor call_descriptor(isolate()); | 
| 103     descriptor->Initialize(MajorKey(), call_descriptor); | 84     descriptor->Initialize(MajorKey(), call_descriptor); | 
| 104   } | 85   } | 
| 105 | 86 | 
| 106  private: | 87  private: | 
| 107   virtual Major MajorKey() const OVERRIDE { return NoCache; } | 88   virtual Major MajorKey() const OVERRIDE { return NoCache; } | 
| 108   virtual bool UseSpecialCache() OVERRIDE { return true; } | 89   virtual bool UseSpecialCache() OVERRIDE { return true; } | 
| 109 | 90 | 
| 110   StrictMode strict_mode_; | 91   StrictMode strict_mode_; | 
| 111 }; | 92 }; | 
| 112 | 93 | 
| 113 | 94 | 
| 114 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 95 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 
| 115 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 96 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 
| 116 // stub for the underlying IC stub code. | 97 // stub for the underlying IC stub code. | 
| 117 class KeyedStoreICStubShim : public HydrogenCodeStub { | 98 class KeyedStoreICStubShim : public HydrogenCodeStub { | 
| 118  public: | 99  public: | 
| 119   KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 100   KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 
| 120       : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { | 101       : HydrogenCodeStub(isolate), strict_mode_(strict_mode) {} | 
| 121     i::compiler::GetInterfaceDescriptor(isolate, this); |  | 
| 122   } |  | 
| 123 | 102 | 
| 124   virtual Handle<Code> GenerateCode() OVERRIDE { | 103   virtual Handle<Code> GenerateCode() OVERRIDE { | 
| 125     return strict_mode_ == SLOPPY | 104     return strict_mode_ == SLOPPY | 
| 126                ? isolate()->builtins()->KeyedStoreIC_Initialize() | 105                ? isolate()->builtins()->KeyedStoreIC_Initialize() | 
| 127                : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 106                : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 
| 128   } | 107   } | 
| 129 | 108 | 
| 130   virtual void InitializeInterfaceDescriptor( | 109   virtual void InitializeInterfaceDescriptor( | 
| 131       CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 110       CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 
| 132     StoreDescriptor call_descriptor(isolate()); | 111     StoreDescriptor call_descriptor(isolate()); | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 283   if (OperatorProperties::HasFrameStateInput(node->op())) { | 262   if (OperatorProperties::HasFrameStateInput(node->op())) { | 
| 284     result |= CallDescriptor::kNeedsFrameState; | 263     result |= CallDescriptor::kNeedsFrameState; | 
| 285   } | 264   } | 
| 286   return result; | 265   return result; | 
| 287 } | 266 } | 
| 288 | 267 | 
| 289 | 268 | 
| 290 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token, | 269 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token, | 
| 291                                              bool pure) { | 270                                              bool pure) { | 
| 292   BinaryOpICStub stub(isolate(), Token::ADD);  // TODO(mstarzinger): Hack. | 271   BinaryOpICStub stub(isolate(), Token::ADD);  // TODO(mstarzinger): Hack. | 
| 293   CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor(); | 272   CodeStubInterfaceDescriptor d; | 
|  | 273   stub.InitializeInterfaceDescriptor(&d); | 
| 294   bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op()); | 274   bool has_frame_state = OperatorProperties::HasFrameStateInput(node->op()); | 
| 295   CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor( | 275   CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor( | 
| 296       d, 0, CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node)); | 276       &d, 0, CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node)); | 
| 297   Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token); | 277   Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token); | 
| 298   NodeVector inputs(zone()); | 278   NodeVector inputs(zone()); | 
| 299   inputs.reserve(node->InputCount() + 1); | 279   inputs.reserve(node->InputCount() + 1); | 
| 300   inputs.push_back(CodeConstant(ic)); | 280   inputs.push_back(CodeConstant(ic)); | 
| 301   inputs.push_back(NodeProperties::GetValueInput(node, 0)); | 281   inputs.push_back(NodeProperties::GetValueInput(node, 0)); | 
| 302   inputs.push_back(NodeProperties::GetValueInput(node, 1)); | 282   inputs.push_back(NodeProperties::GetValueInput(node, 1)); | 
| 303   inputs.push_back(NodeProperties::GetContextInput(node)); | 283   inputs.push_back(NodeProperties::GetContextInput(node)); | 
| 304   if (pure) { | 284   if (pure) { | 
| 305     // A pure (strict) comparison doesn't have an effect, control or frame | 285     // A pure (strict) comparison doesn't have an effect, control or frame | 
| 306     // state.  But for the graph, we need to add control and effect inputs. | 286     // state.  But for the graph, we need to add control and effect inputs. | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 333     } | 313     } | 
| 334     node->TrimInputCount(dest); | 314     node->TrimInputCount(dest); | 
| 335   } | 315   } | 
| 336 | 316 | 
| 337   ReplaceWithRuntimeCall(node, Runtime::kBooleanize); | 317   ReplaceWithRuntimeCall(node, Runtime::kBooleanize); | 
| 338 } | 318 } | 
| 339 | 319 | 
| 340 | 320 | 
| 341 void JSGenericLowering::ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub, | 321 void JSGenericLowering::ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub, | 
| 342                                             CallDescriptor::Flags flags) { | 322                                             CallDescriptor::Flags flags) { | 
| 343   CodeStubInterfaceDescriptor* d = stub->GetInterfaceDescriptor(); | 323   CodeStubInterfaceDescriptor d; | 
|  | 324   stub->InitializeInterfaceDescriptor(&d); | 
| 344   CallDescriptor* desc = | 325   CallDescriptor* desc = | 
| 345       linkage()->GetStubCallDescriptor(d, 0, flags | FlagsForNode(node)); | 326       linkage()->GetStubCallDescriptor(&d, 0, flags | FlagsForNode(node)); | 
| 346   Node* stub_code = CodeConstant(stub->GetCode()); | 327   Node* stub_code = CodeConstant(stub->GetCode()); | 
| 347   PatchInsertInput(node, 0, stub_code); | 328   PatchInsertInput(node, 0, stub_code); | 
| 348   PatchOperator(node, common()->Call(desc)); | 329   PatchOperator(node, common()->Call(desc)); | 
| 349 } | 330 } | 
| 350 | 331 | 
| 351 | 332 | 
| 352 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, | 333 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, | 
| 353                                                Builtins::JavaScript id, | 334                                                Builtins::JavaScript id, | 
| 354                                                int nargs) { | 335                                                int nargs) { | 
| 355   CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); | 336   CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); | 
| 356   CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); | 337   CodeStubInterfaceDescriptor d; | 
| 357   CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, nargs); | 338   stub.InitializeInterfaceDescriptor(&d); | 
|  | 339   CallDescriptor* desc = linkage()->GetStubCallDescriptor(&d, nargs); | 
| 358   // TODO(mstarzinger): Accessing the builtins object this way prevents sharing | 340   // TODO(mstarzinger): Accessing the builtins object this way prevents sharing | 
| 359   // of code across native contexts. Fix this by loading from given context. | 341   // of code across native contexts. Fix this by loading from given context. | 
| 360   Handle<JSFunction> function( | 342   Handle<JSFunction> function( | 
| 361       JSFunction::cast(info()->context()->builtins()->javascript_builtin(id))); | 343       JSFunction::cast(info()->context()->builtins()->javascript_builtin(id))); | 
| 362   Node* stub_code = CodeConstant(stub.GetCode()); | 344   Node* stub_code = CodeConstant(stub.GetCode()); | 
| 363   Node* function_node = FunctionConstant(function); | 345   Node* function_node = FunctionConstant(function); | 
| 364   PatchInsertInput(node, 0, stub_code); | 346   PatchInsertInput(node, 0, stub_code); | 
| 365   PatchInsertInput(node, 1, function_node); | 347   PatchInsertInput(node, 1, function_node); | 
| 366   PatchOperator(node, common()->Call(desc)); | 348   PatchOperator(node, common()->Call(desc)); | 
| 367 } | 349 } | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 471   ReplaceWithBuiltinCall(node, Builtins::IN, 2); | 453   ReplaceWithBuiltinCall(node, Builtins::IN, 2); | 
| 472   return node; | 454   return node; | 
| 473 } | 455 } | 
| 474 | 456 | 
| 475 | 457 | 
| 476 Node* JSGenericLowering::LowerJSInstanceOf(Node* node) { | 458 Node* JSGenericLowering::LowerJSInstanceOf(Node* node) { | 
| 477   InstanceofStub::Flags flags = static_cast<InstanceofStub::Flags>( | 459   InstanceofStub::Flags flags = static_cast<InstanceofStub::Flags>( | 
| 478       InstanceofStub::kReturnTrueFalseObject | | 460       InstanceofStub::kReturnTrueFalseObject | | 
| 479       InstanceofStub::kArgsInRegisters); | 461       InstanceofStub::kArgsInRegisters); | 
| 480   InstanceofStub stub(isolate(), flags); | 462   InstanceofStub stub(isolate(), flags); | 
| 481   CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); | 463   CodeStubInterfaceDescriptor d; | 
| 482   CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0); | 464   stub.InitializeInterfaceDescriptor(&d); | 
|  | 465   CallDescriptor* desc = linkage()->GetStubCallDescriptor(&d, 0); | 
| 483   Node* stub_code = CodeConstant(stub.GetCode()); | 466   Node* stub_code = CodeConstant(stub.GetCode()); | 
| 484   PatchInsertInput(node, 0, stub_code); | 467   PatchInsertInput(node, 0, stub_code); | 
| 485   PatchOperator(node, common()->Call(desc)); | 468   PatchOperator(node, common()->Call(desc)); | 
| 486   return node; | 469   return node; | 
| 487 } | 470 } | 
| 488 | 471 | 
| 489 | 472 | 
| 490 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { | 473 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { | 
| 491   ContextAccess access = OpParameter<ContextAccess>(node); | 474   ContextAccess access = OpParameter<ContextAccess>(node); | 
| 492   // TODO(mstarzinger): Use simplified operators instead of machine operators | 475   // TODO(mstarzinger): Use simplified operators instead of machine operators | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 520   node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); | 503   node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); | 
| 521   node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); | 504   node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); | 
| 522   PatchOperator(node, machine()->Store(kMachAnyTagged, kFullWriteBarrier)); | 505   PatchOperator(node, machine()->Store(kMachAnyTagged, kFullWriteBarrier)); | 
| 523   return node; | 506   return node; | 
| 524 } | 507 } | 
| 525 | 508 | 
| 526 | 509 | 
| 527 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { | 510 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { | 
| 528   int arity = OpParameter<int>(node); | 511   int arity = OpParameter<int>(node); | 
| 529   CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); | 512   CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); | 
| 530   CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); | 513   CodeStubInterfaceDescriptor d; | 
|  | 514   stub.InitializeInterfaceDescriptor(&d); | 
| 531   CallDescriptor* desc = | 515   CallDescriptor* desc = | 
| 532       linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node)); | 516       linkage()->GetStubCallDescriptor(&d, arity, FlagsForNode(node)); | 
| 533   Node* stub_code = CodeConstant(stub.GetCode()); | 517   Node* stub_code = CodeConstant(stub.GetCode()); | 
| 534   Node* construct = NodeProperties::GetValueInput(node, 0); | 518   Node* construct = NodeProperties::GetValueInput(node, 0); | 
| 535   PatchInsertInput(node, 0, stub_code); | 519   PatchInsertInput(node, 0, stub_code); | 
| 536   PatchInsertInput(node, 1, Int32Constant(arity - 1)); | 520   PatchInsertInput(node, 1, Int32Constant(arity - 1)); | 
| 537   PatchInsertInput(node, 2, construct); | 521   PatchInsertInput(node, 2, construct); | 
| 538   PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); | 522   PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); | 
| 539   PatchOperator(node, common()->Call(desc)); | 523   PatchOperator(node, common()->Call(desc)); | 
| 540   return node; | 524   return node; | 
| 541 } | 525 } | 
| 542 | 526 | 
| 543 | 527 | 
| 544 Node* JSGenericLowering::LowerJSCallFunction(Node* node) { | 528 Node* JSGenericLowering::LowerJSCallFunction(Node* node) { | 
| 545   CallParameters p = OpParameter<CallParameters>(node); | 529   CallParameters p = OpParameter<CallParameters>(node); | 
| 546   CallFunctionStub stub(isolate(), p.arity - 2, p.flags); | 530   CallFunctionStub stub(isolate(), p.arity - 2, p.flags); | 
| 547   CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); | 531   CodeStubInterfaceDescriptor d; | 
|  | 532   stub.InitializeInterfaceDescriptor(&d); | 
| 548   CallDescriptor* desc = | 533   CallDescriptor* desc = | 
| 549       linkage()->GetStubCallDescriptor(d, p.arity - 1, FlagsForNode(node)); | 534       linkage()->GetStubCallDescriptor(&d, p.arity - 1, FlagsForNode(node)); | 
| 550   Node* stub_code = CodeConstant(stub.GetCode()); | 535   Node* stub_code = CodeConstant(stub.GetCode()); | 
| 551   PatchInsertInput(node, 0, stub_code); | 536   PatchInsertInput(node, 0, stub_code); | 
| 552   PatchOperator(node, common()->Call(desc)); | 537   PatchOperator(node, common()->Call(desc)); | 
| 553   return node; | 538   return node; | 
| 554 } | 539 } | 
| 555 | 540 | 
| 556 | 541 | 
| 557 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 542 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 
| 558   Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 543   Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 
| 559   int arity = OperatorProperties::GetValueInputCount(node->op()); | 544   int arity = OperatorProperties::GetValueInputCount(node->op()); | 
| 560   ReplaceWithRuntimeCall(node, function, arity); | 545   ReplaceWithRuntimeCall(node, function, arity); | 
| 561   return node; | 546   return node; | 
| 562 } | 547 } | 
| 563 | 548 | 
| 564 }  // namespace compiler | 549 }  // namespace compiler | 
| 565 }  // namespace internal | 550 }  // namespace internal | 
| 566 }  // namespace v8 | 551 }  // namespace v8 | 
| OLD | NEW | 
|---|