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

Side by Side Diff: src/compiler/code-assembler.h

Issue 2579163003: [turbofan] Combine family of CallJS() methods into single implementation. (Closed)
Patch Set: Created 4 years 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 | « no previous file | src/compiler/code-assembler.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 #ifndef V8_COMPILER_CODE_ASSEMBLER_H_ 5 #ifndef V8_COMPILER_CODE_ASSEMBLER_H_
6 #define V8_COMPILER_CODE_ASSEMBLER_H_ 6 #define V8_COMPILER_CODE_ASSEMBLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return CallStubR(descriptor, 1, target, context, args...); 320 return CallStubR(descriptor, 1, target, context, args...);
321 } 321 }
322 322
323 template <class... TArgs> 323 template <class... TArgs>
324 Node* CallStubR(const CallInterfaceDescriptor& descriptor, size_t result_size, 324 Node* CallStubR(const CallInterfaceDescriptor& descriptor, size_t result_size,
325 Node* target, Node* context, TArgs... args); 325 Node* target, Node* context, TArgs... args);
326 326
327 Node* CallStubN(const CallInterfaceDescriptor& descriptor, size_t result_size, 327 Node* CallStubN(const CallInterfaceDescriptor& descriptor, size_t result_size,
328 int input_count, Node* const* inputs); 328 int input_count, Node* const* inputs);
329 329
330 Node* CallStubN(const CallInterfaceDescriptor& descriptor,
331 int js_parameter_count, Node* target, Node** args,
332 size_t result_size = 1);
333 Node* CallStubN(const CallInterfaceDescriptor& descriptor, Node* target,
334 Node** args, size_t result_size = 1) {
335 return CallStubN(descriptor, 0, target, args, result_size);
336 }
337
338 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, 330 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
339 size_t result_size = 1); 331 size_t result_size = 1);
340 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, 332 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
341 Node* arg2, size_t result_size = 1); 333 Node* arg2, size_t result_size = 1);
342 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, 334 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
343 Node* arg2, Node* arg3, size_t result_size = 1); 335 Node* arg2, Node* arg3, size_t result_size = 1);
344 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, 336 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
345 Node* arg2, Node* arg3, Node* arg4, 337 Node* arg2, Node* arg3, Node* arg4,
346 size_t result_size = 1); 338 size_t result_size = 1);
347 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, 339 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1,
(...skipping 15 matching lines...) Expand all
363 Node* context, Node* arg1, Node* arg2, Node* arg3, 355 Node* context, Node* arg1, Node* arg2, Node* arg3,
364 Node* arg4, Node* arg5, size_t result_size = 1); 356 Node* arg4, Node* arg5, size_t result_size = 1);
365 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, 357 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
366 Node* context, Node* arg1, Node* arg2, Node* arg3, 358 Node* context, Node* arg1, Node* arg2, Node* arg3,
367 Node* arg4, Node* arg5, Node* arg6, 359 Node* arg4, Node* arg5, Node* arg6,
368 size_t result_size = 1); 360 size_t result_size = 1);
369 361
370 Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor, 362 Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor,
371 Node* code_target_address, Node** args); 363 Node* code_target_address, Node** args);
372 364
365 template <class... TArgs>
373 Node* CallJS(Callable const& callable, Node* context, Node* function, 366 Node* CallJS(Callable const& callable, Node* context, Node* function,
374 Node* receiver, size_t result_size = 1); 367 Node* receiver, TArgs... args) {
375 Node* CallJS(Callable const& callable, Node* context, Node* function, 368 int argc = static_cast<int>(sizeof...(args));
376 Node* receiver, Node* arg1, size_t result_size = 1); 369 Node* arity = Int32Constant(argc);
377 Node* CallJS(Callable const& callable, Node* context, Node* function, 370 return CallStub(callable, context, function, arity, receiver, args...);
378 Node* receiver, Node* arg1, Node* arg2, size_t result_size = 1); 371 }
379 Node* CallJS(Callable const& callable, Node* context, Node* function,
380 Node* receiver, Node* arg1, Node* arg2, Node* arg3,
381 size_t result_size = 1);
382 372
383 // Call to a C function with two arguments. 373 // Call to a C function with two arguments.
384 Node* CallCFunction2(MachineType return_type, MachineType arg0_type, 374 Node* CallCFunction2(MachineType return_type, MachineType arg0_type,
385 MachineType arg1_type, Node* function, Node* arg0, 375 MachineType arg1_type, Node* function, Node* arg0,
386 Node* arg1); 376 Node* arg1);
387 377
388 // Exception handling support. 378 // Exception handling support.
389 void GotoIfException(Node* node, Label* if_exception, 379 void GotoIfException(Node* node, Label* if_exception,
390 Variable* exception_var = nullptr); 380 Variable* exception_var = nullptr);
391 381
392 // Helpers which delegate to RawMachineAssembler. 382 // Helpers which delegate to RawMachineAssembler.
393 Factory* factory() const; 383 Factory* factory() const;
394 Isolate* isolate() const; 384 Isolate* isolate() const;
395 Zone* zone() const; 385 Zone* zone() const;
396 386
397 CodeAssemblerState* state() { return state_; } 387 CodeAssemblerState* state() { return state_; }
398 388
399 void BreakOnNode(int node_id); 389 void BreakOnNode(int node_id);
400 390
401 protected: 391 protected:
402 // Enables subclasses to perform operations before and after a call. 392 // Enables subclasses to perform operations before and after a call.
403 virtual void CallPrologue(); 393 virtual void CallPrologue();
404 virtual void CallEpilogue(); 394 virtual void CallEpilogue();
405 395
406 private: 396 private:
407 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args); 397 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args);
408 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args); 398 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args);
409 399
410 void InstallBreakOnNodeDecorator();
411
412 RawMachineAssembler* raw_assembler() const; 400 RawMachineAssembler* raw_assembler() const;
413 401
414 CodeAssemblerState* state_; 402 CodeAssemblerState* state_;
415 403
416 DISALLOW_COPY_AND_ASSIGN(CodeAssembler); 404 DISALLOW_COPY_AND_ASSIGN(CodeAssembler);
417 }; 405 };
418 406
419 class CodeAssemblerVariable { 407 class CodeAssemblerVariable {
420 public: 408 public:
421 explicit CodeAssemblerVariable(CodeAssembler* assembler, 409 explicit CodeAssemblerVariable(CodeAssembler* assembler,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 ZoneSet<CodeAssemblerVariable::Impl*> variables_; 497 ZoneSet<CodeAssemblerVariable::Impl*> variables_;
510 498
511 DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState); 499 DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState);
512 }; 500 };
513 501
514 } // namespace compiler 502 } // namespace compiler
515 } // namespace internal 503 } // namespace internal
516 } // namespace v8 504 } // namespace v8
517 505
518 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ 506 #endif // V8_COMPILER_CODE_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/code-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698