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

Side by Side Diff: src/compiler/js-operator.cc

Issue 1198983002: [turbofan] Revive the VectorSlotPair and also put feedback on JSCallFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Try to address compilation error. 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/compiler/js-operator.h ('k') | src/handles.h » ('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/compiler/js-operator.h" 5 #include "src/compiler/js-operator.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/lazy-instance.h" 9 #include "src/base/lazy-instance.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
11 #include "src/compiler/operator.h" 11 #include "src/compiler/operator.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace compiler { 15 namespace compiler {
16 16
17 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
18 return lhs.slot() == rhs.slot() && lhs.vector() == rhs.vector();
19 }
20
21
22 bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
23 return !(lhs == rhs);
24 }
25
26
27 size_t hash_value(VectorSlotPair const& p) {
28 return base::hash_combine(p.slot(), p.vector());
29 }
30
31
17 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { 32 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) {
18 return os << p.arity() << ", " << p.flags() << ", " << p.language_mode(); 33 return os << p.arity() << ", " << p.flags() << ", " << p.language_mode();
19 } 34 }
20 35
21 36
22 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { 37 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) {
23 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); 38 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode());
24 return OpParameter<CallFunctionParameters>(op); 39 return OpParameter<CallFunctionParameters>(op);
25 } 40 }
26 41
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 101
87 ContextAccess const& ContextAccessOf(Operator const* op) { 102 ContextAccess const& ContextAccessOf(Operator const* op) {
88 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || 103 DCHECK(op->opcode() == IrOpcode::kJSLoadContext ||
89 op->opcode() == IrOpcode::kJSStoreContext); 104 op->opcode() == IrOpcode::kJSStoreContext);
90 return OpParameter<ContextAccess>(op); 105 return OpParameter<ContextAccess>(op);
91 } 106 }
92 107
93 108
94 DynamicGlobalAccess::DynamicGlobalAccess(const Handle<String>& name, 109 DynamicGlobalAccess::DynamicGlobalAccess(const Handle<String>& name,
95 uint32_t check_bitset, 110 uint32_t check_bitset,
96 const ResolvedFeedbackSlot& feedback, 111 const VectorSlotPair& feedback,
97 ContextualMode mode) 112 ContextualMode mode)
98 : name_(name), 113 : name_(name),
99 check_bitset_(check_bitset), 114 check_bitset_(check_bitset),
100 feedback_(feedback), 115 feedback_(feedback),
101 mode_(mode) { 116 mode_(mode) {
102 DCHECK(check_bitset == kFullCheckRequired || check_bitset < 0x80000000U); 117 DCHECK(check_bitset == kFullCheckRequired || check_bitset < 0x80000000U);
103 } 118 }
104 119
105 120
106 bool operator==(DynamicGlobalAccess const& lhs, 121 bool operator==(DynamicGlobalAccess const& lhs,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 << access.context_access(); 183 << access.context_access();
169 } 184 }
170 185
171 186
172 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) { 187 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) {
173 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode()); 188 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode());
174 return OpParameter<DynamicContextAccess>(op); 189 return OpParameter<DynamicContextAccess>(op);
175 } 190 }
176 191
177 192
178 bool operator==(ResolvedFeedbackSlot const& lhs,
179 ResolvedFeedbackSlot const& rhs) {
180 return lhs.slot().ToInt() == rhs.slot().ToInt();
181 }
182
183
184 size_t hash_value(ResolvedFeedbackSlot const& p) {
185 base::hash<int> h;
186 return h(p.slot().ToInt());
187 }
188
189
190 bool operator==(LoadNamedParameters const& lhs, 193 bool operator==(LoadNamedParameters const& lhs,
191 LoadNamedParameters const& rhs) { 194 LoadNamedParameters const& rhs) {
192 return lhs.name() == rhs.name() && 195 return lhs.name() == rhs.name() &&
193 lhs.contextual_mode() == rhs.contextual_mode() && 196 lhs.contextual_mode() == rhs.contextual_mode() &&
194 lhs.feedback() == rhs.feedback(); 197 lhs.feedback() == rhs.feedback();
195 } 198 }
196 199
197 200
198 bool operator!=(LoadNamedParameters const& lhs, 201 bool operator!=(LoadNamedParameters const& lhs,
199 LoadNamedParameters const& rhs) { 202 LoadNamedParameters const& rhs) {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 case STRONG_BIT: \ 448 case STRONG_BIT: \
446 break; /* %*!%^$#@ */ \ 449 break; /* %*!%^$#@ */ \
447 } \ 450 } \
448 UNREACHABLE(); \ 451 UNREACHABLE(); \
449 return nullptr; \ 452 return nullptr; \
450 } 453 }
451 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) 454 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE)
452 #undef CACHED_WITH_LANGUAGE_MODE 455 #undef CACHED_WITH_LANGUAGE_MODE
453 456
454 457
455 const Operator* JSOperatorBuilder::CallFunction(size_t arity, 458 const Operator* JSOperatorBuilder::CallFunction(
456 CallFunctionFlags flags, 459 size_t arity, CallFunctionFlags flags, LanguageMode language_mode,
457 LanguageMode language_mode) { 460 VectorSlotPair const& feedback) {
458 CallFunctionParameters parameters(arity, flags, language_mode); 461 CallFunctionParameters parameters(arity, flags, language_mode, feedback);
459 return new (zone()) Operator1<CallFunctionParameters>( // -- 462 return new (zone()) Operator1<CallFunctionParameters>( // --
460 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode 463 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode
461 "JSCallFunction", // name 464 "JSCallFunction", // name
462 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs 465 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs
463 parameters); // parameter 466 parameters); // parameter
464 } 467 }
465 468
466 469
467 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, 470 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id,
468 size_t arity) { 471 size_t arity) {
(...skipping 10 matching lines...) Expand all
479 482
480 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { 483 const Operator* JSOperatorBuilder::CallConstruct(int arguments) {
481 return new (zone()) Operator1<int>( // -- 484 return new (zone()) Operator1<int>( // --
482 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode 485 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode
483 "JSCallConstruct", // name 486 "JSCallConstruct", // name
484 arguments, 1, 1, 1, 1, 2, // counts 487 arguments, 1, 1, 1, 1, 2, // counts
485 arguments); // parameter 488 arguments); // parameter
486 } 489 }
487 490
488 491
489 const Operator* JSOperatorBuilder::LoadNamed( 492 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name,
490 const Unique<Name>& name, const ResolvedFeedbackSlot& feedback, 493 const VectorSlotPair& feedback,
491 ContextualMode contextual_mode) { 494 ContextualMode contextual_mode) {
492 LoadNamedParameters parameters(name, feedback, contextual_mode); 495 LoadNamedParameters parameters(name, feedback, contextual_mode);
493 return new (zone()) Operator1<LoadNamedParameters>( // -- 496 return new (zone()) Operator1<LoadNamedParameters>( // --
494 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode 497 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode
495 "JSLoadNamed", // name 498 "JSLoadNamed", // name
496 2, 1, 1, 1, 1, 2, // counts 499 2, 1, 1, 1, 1, 2, // counts
497 parameters); // parameter 500 parameters); // parameter
498 } 501 }
499 502
500 503
501 const Operator* JSOperatorBuilder::LoadProperty( 504 const Operator* JSOperatorBuilder::LoadProperty(
502 const ResolvedFeedbackSlot& feedback) { 505 const VectorSlotPair& feedback) {
503 LoadPropertyParameters parameters(feedback); 506 LoadPropertyParameters parameters(feedback);
504 return new (zone()) Operator1<LoadPropertyParameters>( // -- 507 return new (zone()) Operator1<LoadPropertyParameters>( // --
505 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode 508 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode
506 "JSLoadProperty", // name 509 "JSLoadProperty", // name
507 3, 1, 1, 1, 1, 2, // counts 510 3, 1, 1, 1, 1, 2, // counts
508 parameters); // parameter 511 parameters); // parameter
509 } 512 }
510 513
511 514
512 const Operator* JSOperatorBuilder::StoreNamed( 515 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
513 LanguageMode language_mode, const Unique<Name>& name, 516 const Unique<Name>& name,
514 const ResolvedFeedbackSlot& feedback) { 517 const VectorSlotPair& feedback) {
515 StoreNamedParameters parameters(language_mode, feedback, name); 518 StoreNamedParameters parameters(language_mode, feedback, name);
516 return new (zone()) Operator1<StoreNamedParameters>( // -- 519 return new (zone()) Operator1<StoreNamedParameters>( // --
517 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode 520 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode
518 "JSStoreNamed", // name 521 "JSStoreNamed", // name
519 2, 1, 1, 0, 1, 2, // counts 522 2, 1, 1, 0, 1, 2, // counts
520 parameters); // parameter 523 parameters); // parameter
521 } 524 }
522 525
523 526
524 const Operator* JSOperatorBuilder::StoreProperty( 527 const Operator* JSOperatorBuilder::StoreProperty(
525 LanguageMode language_mode, const ResolvedFeedbackSlot& feedback) { 528 LanguageMode language_mode, const VectorSlotPair& feedback) {
526 StorePropertyParameters parameters(language_mode, feedback); 529 StorePropertyParameters parameters(language_mode, feedback);
527 return new (zone()) Operator1<StorePropertyParameters>( // -- 530 return new (zone()) Operator1<StorePropertyParameters>( // --
528 IrOpcode::kJSStoreProperty, Operator::kNoProperties, // opcode 531 IrOpcode::kJSStoreProperty, Operator::kNoProperties, // opcode
529 "JSStoreProperty", // name 532 "JSStoreProperty", // name
530 3, 1, 1, 0, 1, 2, // counts 533 3, 1, 1, 0, 1, 2, // counts
531 parameters); // parameter 534 parameters); // parameter
532 } 535 }
533 536
534 537
535 const Operator* JSOperatorBuilder::DeleteProperty(LanguageMode language_mode) { 538 const Operator* JSOperatorBuilder::DeleteProperty(LanguageMode language_mode) {
(...skipping 23 matching lines...) Expand all
559 IrOpcode::kJSStoreContext, // opcode 562 IrOpcode::kJSStoreContext, // opcode
560 Operator::kNoRead | Operator::kNoThrow, // flags 563 Operator::kNoRead | Operator::kNoThrow, // flags
561 "JSStoreContext", // name 564 "JSStoreContext", // name
562 2, 1, 1, 0, 1, 0, // counts 565 2, 1, 1, 0, 1, 0, // counts
563 access); // parameter 566 access); // parameter
564 } 567 }
565 568
566 569
567 const Operator* JSOperatorBuilder::LoadDynamicGlobal( 570 const Operator* JSOperatorBuilder::LoadDynamicGlobal(
568 const Handle<String>& name, uint32_t check_bitset, 571 const Handle<String>& name, uint32_t check_bitset,
569 const ResolvedFeedbackSlot& feedback, ContextualMode mode) { 572 const VectorSlotPair& feedback, ContextualMode mode) {
570 DynamicGlobalAccess access(name, check_bitset, feedback, mode); 573 DynamicGlobalAccess access(name, check_bitset, feedback, mode);
571 return new (zone()) Operator1<DynamicGlobalAccess>( // -- 574 return new (zone()) Operator1<DynamicGlobalAccess>( // --
572 IrOpcode::kJSLoadDynamicGlobal, Operator::kNoProperties, // opcode 575 IrOpcode::kJSLoadDynamicGlobal, Operator::kNoProperties, // opcode
573 "JSLoadDynamicGlobal", // name 576 "JSLoadDynamicGlobal", // name
574 2, 1, 1, 1, 1, 2, // counts 577 2, 1, 1, 1, 1, 2, // counts
575 access); // parameter 578 access); // parameter
576 } 579 }
577 580
578 581
579 const Operator* JSOperatorBuilder::LoadDynamicContext( 582 const Operator* JSOperatorBuilder::LoadDynamicContext(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 return new (zone()) Operator1<Unique<String>>( // -- 626 return new (zone()) Operator1<Unique<String>>( // --
624 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode 627 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
625 "JSCreateCatchContext", // name 628 "JSCreateCatchContext", // name
626 2, 1, 1, 1, 1, 2, // counts 629 2, 1, 1, 1, 1, 2, // counts
627 name); // parameter 630 name); // parameter
628 } 631 }
629 632
630 } // namespace compiler 633 } // namespace compiler
631 } // namespace internal 634 } // namespace internal
632 } // namespace v8 635 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698