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

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

Issue 1314473007: [turbofan] Remove usage of Unique<T> from graph. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased and fixed. Created 5 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
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-type-feedback.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/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"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 190
191 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) { 191 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) {
192 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode()); 192 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode());
193 return OpParameter<DynamicContextAccess>(op); 193 return OpParameter<DynamicContextAccess>(op);
194 } 194 }
195 195
196 196
197 bool operator==(LoadNamedParameters const& lhs, 197 bool operator==(LoadNamedParameters const& lhs,
198 LoadNamedParameters const& rhs) { 198 LoadNamedParameters const& rhs) {
199 return lhs.name() == rhs.name() && 199 return lhs.name().location() == rhs.name().location() &&
200 lhs.language_mode() == rhs.language_mode() && 200 lhs.language_mode() == rhs.language_mode() &&
201 lhs.feedback() == rhs.feedback(); 201 lhs.feedback() == rhs.feedback();
202 } 202 }
203 203
204 204
205 bool operator!=(LoadNamedParameters const& lhs, 205 bool operator!=(LoadNamedParameters const& lhs,
206 LoadNamedParameters const& rhs) { 206 LoadNamedParameters const& rhs) {
207 return !(lhs == rhs); 207 return !(lhs == rhs);
208 } 208 }
209 209
210 210
211 size_t hash_value(LoadNamedParameters const& p) { 211 size_t hash_value(LoadNamedParameters const& p) {
212 return base::hash_combine(p.name(), p.language_mode(), p.feedback()); 212 return base::hash_combine(p.name().location(), p.language_mode(),
213 p.feedback());
213 } 214 }
214 215
215 216
216 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { 217 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) {
217 return os << Brief(*p.name().handle()) << ", " << p.language_mode(); 218 return os << Brief(*p.name()) << ", " << p.language_mode();
218 } 219 }
219 220
220 221
221 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { 222 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) {
222 return os << p.language_mode(); 223 return os << p.language_mode();
223 } 224 }
224 225
225 226
226 bool operator==(LoadPropertyParameters const& lhs, 227 bool operator==(LoadPropertyParameters const& lhs,
227 LoadPropertyParameters const& rhs) { 228 LoadPropertyParameters const& rhs) {
(...skipping 20 matching lines...) Expand all
248 249
249 250
250 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { 251 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) {
251 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); 252 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode());
252 return OpParameter<LoadNamedParameters>(op); 253 return OpParameter<LoadNamedParameters>(op);
253 } 254 }
254 255
255 256
256 bool operator==(LoadGlobalParameters const& lhs, 257 bool operator==(LoadGlobalParameters const& lhs,
257 LoadGlobalParameters const& rhs) { 258 LoadGlobalParameters const& rhs) {
258 return lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback() && 259 return lhs.name().location() == rhs.name().location() &&
260 lhs.feedback() == rhs.feedback() &&
259 lhs.typeof_mode() == rhs.typeof_mode() && 261 lhs.typeof_mode() == rhs.typeof_mode() &&
260 lhs.slot_index() == rhs.slot_index(); 262 lhs.slot_index() == rhs.slot_index();
261 } 263 }
262 264
263 265
264 bool operator!=(LoadGlobalParameters const& lhs, 266 bool operator!=(LoadGlobalParameters const& lhs,
265 LoadGlobalParameters const& rhs) { 267 LoadGlobalParameters const& rhs) {
266 return !(lhs == rhs); 268 return !(lhs == rhs);
267 } 269 }
268 270
269 271
270 size_t hash_value(LoadGlobalParameters const& p) { 272 size_t hash_value(LoadGlobalParameters const& p) {
271 return base::hash_combine(p.name(), p.typeof_mode(), p.slot_index()); 273 return base::hash_combine(p.name().location(), p.typeof_mode(),
274 p.slot_index());
272 } 275 }
273 276
274 277
275 std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) { 278 std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) {
276 return os << Brief(*p.name().handle()) << ", " << p.typeof_mode() 279 return os << Brief(*p.name()) << ", " << p.typeof_mode()
277 << ", slot: " << p.slot_index(); 280 << ", slot: " << p.slot_index();
278 } 281 }
279 282
280 283
281 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) { 284 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) {
282 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode()); 285 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode());
283 return OpParameter<LoadGlobalParameters>(op); 286 return OpParameter<LoadGlobalParameters>(op);
284 } 287 }
285 288
286 289
287 bool operator==(StoreGlobalParameters const& lhs, 290 bool operator==(StoreGlobalParameters const& lhs,
288 StoreGlobalParameters const& rhs) { 291 StoreGlobalParameters const& rhs) {
289 return lhs.language_mode() == rhs.language_mode() && 292 return lhs.language_mode() == rhs.language_mode() &&
290 lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback() && 293 lhs.name().location() == rhs.name().location() &&
294 lhs.feedback() == rhs.feedback() &&
291 lhs.slot_index() == rhs.slot_index(); 295 lhs.slot_index() == rhs.slot_index();
292 } 296 }
293 297
294 298
295 bool operator!=(StoreGlobalParameters const& lhs, 299 bool operator!=(StoreGlobalParameters const& lhs,
296 StoreGlobalParameters const& rhs) { 300 StoreGlobalParameters const& rhs) {
297 return !(lhs == rhs); 301 return !(lhs == rhs);
298 } 302 }
299 303
300 304
301 size_t hash_value(StoreGlobalParameters const& p) { 305 size_t hash_value(StoreGlobalParameters const& p) {
302 return base::hash_combine(p.language_mode(), p.name(), p.feedback(), 306 return base::hash_combine(p.language_mode(), p.name().location(),
303 p.slot_index()); 307 p.feedback(), p.slot_index());
304 } 308 }
305 309
306 310
307 std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) { 311 std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) {
308 return os << p.language_mode() << ", " << Brief(*p.name().handle()) 312 return os << p.language_mode() << ", " << Brief(*p.name())
309 << ", slot: " << p.slot_index(); 313 << ", slot: " << p.slot_index();
310 } 314 }
311 315
312 316
313 const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) { 317 const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) {
314 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode()); 318 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode());
315 return OpParameter<StoreGlobalParameters>(op); 319 return OpParameter<StoreGlobalParameters>(op);
316 } 320 }
317 321
318 322
319 bool operator==(StoreNamedParameters const& lhs, 323 bool operator==(StoreNamedParameters const& lhs,
320 StoreNamedParameters const& rhs) { 324 StoreNamedParameters const& rhs) {
321 return lhs.language_mode() == rhs.language_mode() && 325 return lhs.language_mode() == rhs.language_mode() &&
322 lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback(); 326 lhs.name().location() == rhs.name().location() &&
327 lhs.feedback() == rhs.feedback();
323 } 328 }
324 329
325 330
326 bool operator!=(StoreNamedParameters const& lhs, 331 bool operator!=(StoreNamedParameters const& lhs,
327 StoreNamedParameters const& rhs) { 332 StoreNamedParameters const& rhs) {
328 return !(lhs == rhs); 333 return !(lhs == rhs);
329 } 334 }
330 335
331 336
332 size_t hash_value(StoreNamedParameters const& p) { 337 size_t hash_value(StoreNamedParameters const& p) {
333 return base::hash_combine(p.language_mode(), p.name(), p.feedback()); 338 return base::hash_combine(p.language_mode(), p.name().location(),
339 p.feedback());
334 } 340 }
335 341
336 342
337 std::ostream& operator<<(std::ostream& os, StoreNamedParameters const& p) { 343 std::ostream& operator<<(std::ostream& os, StoreNamedParameters const& p) {
338 return os << p.language_mode() << ", " << Brief(*p.name().handle()); 344 return os << p.language_mode() << ", " << Brief(*p.name());
339 } 345 }
340 346
341 347
342 const StoreNamedParameters& StoreNamedParametersOf(const Operator* op) { 348 const StoreNamedParameters& StoreNamedParametersOf(const Operator* op) {
343 DCHECK_EQ(IrOpcode::kJSStoreNamed, op->opcode()); 349 DCHECK_EQ(IrOpcode::kJSStoreNamed, op->opcode());
344 return OpParameter<StoreNamedParameters>(op); 350 return OpParameter<StoreNamedParameters>(op);
345 } 351 }
346 352
347 353
348 bool operator==(StorePropertyParameters const& lhs, 354 bool operator==(StorePropertyParameters const& lhs,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 558
553 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { 559 const Operator* JSOperatorBuilder::CallConstruct(int arguments) {
554 return new (zone()) Operator1<int>( // -- 560 return new (zone()) Operator1<int>( // --
555 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode 561 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode
556 "JSCallConstruct", // name 562 "JSCallConstruct", // name
557 arguments, 1, 1, 1, 1, 2, // counts 563 arguments, 1, 1, 1, 1, 2, // counts
558 arguments); // parameter 564 arguments); // parameter
559 } 565 }
560 566
561 567
562 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, 568 const Operator* JSOperatorBuilder::LoadNamed(const Handle<Name>& name,
563 const VectorSlotPair& feedback, 569 const VectorSlotPair& feedback,
564 LanguageMode language_mode) { 570 LanguageMode language_mode) {
565 LoadNamedParameters parameters(name, feedback, language_mode); 571 LoadNamedParameters parameters(name, feedback, language_mode);
566 return new (zone()) Operator1<LoadNamedParameters>( // -- 572 return new (zone()) Operator1<LoadNamedParameters>( // --
567 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode 573 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode
568 "JSLoadNamed", // name 574 "JSLoadNamed", // name
569 2, 1, 1, 1, 1, 2, // counts 575 2, 1, 1, 1, 1, 2, // counts
570 parameters); // parameter 576 parameters); // parameter
571 } 577 }
572 578
573 579
574 const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback, 580 const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback,
575 LanguageMode language_mode) { 581 LanguageMode language_mode) {
576 LoadPropertyParameters parameters(feedback, language_mode); 582 LoadPropertyParameters parameters(feedback, language_mode);
577 return new (zone()) Operator1<LoadPropertyParameters>( // -- 583 return new (zone()) Operator1<LoadPropertyParameters>( // --
578 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode 584 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode
579 "JSLoadProperty", // name 585 "JSLoadProperty", // name
580 3, 1, 1, 1, 1, 2, // counts 586 3, 1, 1, 1, 1, 2, // counts
581 parameters); // parameter 587 parameters); // parameter
582 } 588 }
583 589
584 590
585 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, 591 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
586 const Unique<Name>& name, 592 const Handle<Name>& name,
587 const VectorSlotPair& feedback) { 593 const VectorSlotPair& feedback) {
588 StoreNamedParameters parameters(language_mode, feedback, name); 594 StoreNamedParameters parameters(language_mode, feedback, name);
589 return new (zone()) Operator1<StoreNamedParameters>( // -- 595 return new (zone()) Operator1<StoreNamedParameters>( // --
590 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode 596 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode
591 "JSStoreNamed", // name 597 "JSStoreNamed", // name
592 3, 1, 1, 0, 1, 2, // counts 598 3, 1, 1, 0, 1, 2, // counts
593 parameters); // parameter 599 parameters); // parameter
594 } 600 }
595 601
596 602
(...skipping 10 matching lines...) Expand all
607 613
608 const Operator* JSOperatorBuilder::DeleteProperty(LanguageMode language_mode) { 614 const Operator* JSOperatorBuilder::DeleteProperty(LanguageMode language_mode) {
609 return new (zone()) Operator1<LanguageMode>( // -- 615 return new (zone()) Operator1<LanguageMode>( // --
610 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode 616 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode
611 "JSDeleteProperty", // name 617 "JSDeleteProperty", // name
612 2, 1, 1, 1, 1, 2, // counts 618 2, 1, 1, 1, 1, 2, // counts
613 language_mode); // parameter 619 language_mode); // parameter
614 } 620 }
615 621
616 622
617 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name, 623 const Operator* JSOperatorBuilder::LoadGlobal(const Handle<Name>& name,
618 const VectorSlotPair& feedback, 624 const VectorSlotPair& feedback,
619 TypeofMode typeof_mode, 625 TypeofMode typeof_mode,
620 int slot_index) { 626 int slot_index) {
621 LoadGlobalParameters parameters(name, feedback, typeof_mode, slot_index); 627 LoadGlobalParameters parameters(name, feedback, typeof_mode, slot_index);
622 return new (zone()) Operator1<LoadGlobalParameters>( // -- 628 return new (zone()) Operator1<LoadGlobalParameters>( // --
623 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode 629 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode
624 "JSLoadGlobal", // name 630 "JSLoadGlobal", // name
625 3, 1, 1, 1, 1, 2, // counts 631 3, 1, 1, 1, 1, 2, // counts
626 parameters); // parameter 632 parameters); // parameter
627 } 633 }
628 634
629 635
630 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, 636 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode,
631 const Unique<Name>& name, 637 const Handle<Name>& name,
632 const VectorSlotPair& feedback, 638 const VectorSlotPair& feedback,
633 int slot_index) { 639 int slot_index) {
634 StoreGlobalParameters parameters(language_mode, feedback, name, slot_index); 640 StoreGlobalParameters parameters(language_mode, feedback, name, slot_index);
635 return new (zone()) Operator1<StoreGlobalParameters>( // -- 641 return new (zone()) Operator1<StoreGlobalParameters>( // --
636 IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode 642 IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode
637 "JSStoreGlobal", // name 643 "JSStoreGlobal", // name
638 4, 1, 1, 0, 1, 2, // counts 644 4, 1, 1, 0, 1, 2, // counts
639 parameters); // parameter 645 parameters); // parameter
640 } 646 }
641 647
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 const Operator* JSOperatorBuilder::CreateLiteralObject(int literal_flags) { 717 const Operator* JSOperatorBuilder::CreateLiteralObject(int literal_flags) {
712 return new (zone()) Operator1<int>( // -- 718 return new (zone()) Operator1<int>( // --
713 IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode 719 IrOpcode::kJSCreateLiteralObject, Operator::kNoProperties, // opcode
714 "JSCreateLiteralObject", // name 720 "JSCreateLiteralObject", // name
715 3, 1, 1, 1, 1, 2, // counts 721 3, 1, 1, 1, 1, 2, // counts
716 literal_flags); // parameter 722 literal_flags); // parameter
717 } 723 }
718 724
719 725
720 const Operator* JSOperatorBuilder::CreateCatchContext( 726 const Operator* JSOperatorBuilder::CreateCatchContext(
721 const Unique<String>& name) { 727 const Handle<String>& name) {
722 return new (zone()) Operator1<Unique<String>>( // -- 728 return new (zone()) Operator1<Handle<String>, Handle<String>::equal_to,
729 Handle<String>::hash>( // --
723 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode 730 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
724 "JSCreateCatchContext", // name 731 "JSCreateCatchContext", // name
725 2, 1, 1, 1, 1, 2, // counts 732 2, 1, 1, 1, 1, 2, // counts
726 name); // parameter 733 name); // parameter
727 } 734 }
728 735
729 } // namespace compiler 736 } // namespace compiler
730 } // namespace internal 737 } // namespace internal
731 } // namespace v8 738 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-type-feedback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698