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

Side by Side Diff: src/code-stubs.h

Issue 1250563004: HydrogenCodeStubs consume stack arguments via descriptor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 5 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/arm64/interface-descriptors-arm64.cc ('k') | src/code-stubs.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {} 416 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {}
417 417
418 // Generates the assembler code for the stub. 418 // Generates the assembler code for the stub.
419 virtual void Generate(MacroAssembler* masm) = 0; 419 virtual void Generate(MacroAssembler* masm) = 0;
420 420
421 DEFINE_CODE_STUB_BASE(PlatformCodeStub, CodeStub); 421 DEFINE_CODE_STUB_BASE(PlatformCodeStub, CodeStub);
422 }; 422 };
423 423
424 424
425 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; 425 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE };
426 enum HandlerArgumentsMode { DONT_PASS_ARGUMENTS, PASS_ARGUMENTS };
427 426
428 427
429 class CodeStubDescriptor { 428 class CodeStubDescriptor {
430 public: 429 public:
431 explicit CodeStubDescriptor(CodeStub* stub); 430 explicit CodeStubDescriptor(CodeStub* stub);
432 431
433 CodeStubDescriptor(Isolate* isolate, uint32_t stub_key); 432 CodeStubDescriptor(Isolate* isolate, uint32_t stub_key);
434 433
435 void Initialize(Address deoptimization_handler = NULL, 434 void Initialize(Address deoptimization_handler = NULL,
436 int hint_stack_parameter_count = -1, 435 int hint_stack_parameter_count = -1,
437 StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE); 436 StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE);
438 void Initialize(Register stack_parameter_count, 437 void Initialize(Register stack_parameter_count,
439 Address deoptimization_handler = NULL, 438 Address deoptimization_handler = NULL,
440 int hint_stack_parameter_count = -1, 439 int hint_stack_parameter_count = -1,
441 StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE, 440 StubFunctionMode function_mode = NOT_JS_FUNCTION_STUB_MODE);
442 HandlerArgumentsMode handler_mode = DONT_PASS_ARGUMENTS);
443 441
444 void SetMissHandler(ExternalReference handler) { 442 void SetMissHandler(ExternalReference handler) {
445 miss_handler_ = handler; 443 miss_handler_ = handler;
446 has_miss_handler_ = true; 444 has_miss_handler_ = true;
447 // Our miss handler infrastructure doesn't currently support 445 // Our miss handler infrastructure doesn't currently support
448 // variable stack parameter counts. 446 // variable stack parameter counts.
449 DCHECK(!stack_parameter_count_.is_valid()); 447 DCHECK(!stack_parameter_count_.is_valid());
450 } 448 }
451 449
452 void set_call_descriptor(CallInterfaceDescriptor d) { call_descriptor_ = d; } 450 void set_call_descriptor(CallInterfaceDescriptor d) { call_descriptor_ = d; }
453 CallInterfaceDescriptor call_descriptor() const { return call_descriptor_; } 451 CallInterfaceDescriptor call_descriptor() const { return call_descriptor_; }
454 452
455 int GetRegisterParameterCount() const { 453 int GetRegisterParameterCount() const {
456 return call_descriptor().GetRegisterParameterCount(); 454 return call_descriptor().GetRegisterParameterCount();
457 } 455 }
458 456
457 int GetStackParameterCount() const {
458 return call_descriptor().GetStackParameterCount();
459 }
460
461 int GetParameterCount() const {
462 return call_descriptor().GetParameterCount();
463 }
464
459 Register GetRegisterParameter(int index) const { 465 Register GetRegisterParameter(int index) const {
460 return call_descriptor().GetRegisterParameter(index); 466 return call_descriptor().GetRegisterParameter(index);
461 } 467 }
462 468
463 Type* GetParameterType(int index) const { 469 Type* GetParameterType(int index) const {
464 return call_descriptor().GetParameterType(index); 470 return call_descriptor().GetParameterType(index);
465 } 471 }
466 472
467 ExternalReference miss_handler() const { 473 ExternalReference miss_handler() const {
468 DCHECK(has_miss_handler_); 474 DCHECK(has_miss_handler_);
469 return miss_handler_; 475 return miss_handler_;
470 } 476 }
471 477
472 bool has_miss_handler() const { 478 bool has_miss_handler() const {
473 return has_miss_handler_; 479 return has_miss_handler_;
474 } 480 }
475 481
476 int GetHandlerParameterCount() const { 482 int GetHandlerParameterCount() const {
477 int params = GetRegisterParameterCount(); 483 int params = GetParameterCount();
478 if (handler_arguments_mode_ == PASS_ARGUMENTS) { 484 if (PassesArgumentsToDeoptimizationHandler()) {
479 params += 1; 485 params += 1;
480 } 486 }
481 return params; 487 return params;
482 } 488 }
483 489
484 int hint_stack_parameter_count() const { return hint_stack_parameter_count_; } 490 int hint_stack_parameter_count() const { return hint_stack_parameter_count_; }
485 Register stack_parameter_count() const { return stack_parameter_count_; } 491 Register stack_parameter_count() const { return stack_parameter_count_; }
486 StubFunctionMode function_mode() const { return function_mode_; } 492 StubFunctionMode function_mode() const { return function_mode_; }
487 Address deoptimization_handler() const { return deoptimization_handler_; } 493 Address deoptimization_handler() const { return deoptimization_handler_; }
488 494
489 private: 495 private:
496 bool PassesArgumentsToDeoptimizationHandler() const {
497 return stack_parameter_count_.is_valid();
498 }
499
490 CallInterfaceDescriptor call_descriptor_; 500 CallInterfaceDescriptor call_descriptor_;
491 Register stack_parameter_count_; 501 Register stack_parameter_count_;
492 // If hint_stack_parameter_count_ > 0, the code stub can optimize the 502 // If hint_stack_parameter_count_ > 0, the code stub can optimize the
493 // return sequence. Default value is -1, which means it is ignored. 503 // return sequence. Default value is -1, which means it is ignored.
494 int hint_stack_parameter_count_; 504 int hint_stack_parameter_count_;
495 StubFunctionMode function_mode_; 505 StubFunctionMode function_mode_;
496 506
497 Address deoptimization_handler_; 507 Address deoptimization_handler_;
498 HandlerArgumentsMode handler_arguments_mode_;
499 508
500 ExternalReference miss_handler_; 509 ExternalReference miss_handler_;
501 bool has_miss_handler_; 510 bool has_miss_handler_;
502 }; 511 };
503 512
504 513
505 class HydrogenCodeStub : public CodeStub { 514 class HydrogenCodeStub : public CodeStub {
506 public: 515 public:
507 enum InitializationState { 516 enum InitializationState {
508 UNINITIALIZED, 517 UNINITIALIZED,
(...skipping 2552 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 #undef DEFINE_PLATFORM_CODE_STUB 3070 #undef DEFINE_PLATFORM_CODE_STUB
3062 #undef DEFINE_HANDLER_CODE_STUB 3071 #undef DEFINE_HANDLER_CODE_STUB
3063 #undef DEFINE_HYDROGEN_CODE_STUB 3072 #undef DEFINE_HYDROGEN_CODE_STUB
3064 #undef DEFINE_CODE_STUB 3073 #undef DEFINE_CODE_STUB
3065 #undef DEFINE_CODE_STUB_BASE 3074 #undef DEFINE_CODE_STUB_BASE
3066 3075
3067 extern Representation RepresentationFromType(Type* type); 3076 extern Representation RepresentationFromType(Type* type);
3068 } } // namespace v8::internal 3077 } } // namespace v8::internal
3069 3078
3070 #endif // V8_CODE_STUBS_H_ 3079 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/interface-descriptors-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698