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

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

Issue 1224793002: Loads and stores to global vars are now made via property cell shortcuts installed into parent scri… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments 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/compiler/js-operator.h ('k') | src/compiler/js-typed-lowering.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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return base::hash_combine(p.language_mode(), p.feedback()); 249 return base::hash_combine(p.language_mode(), p.feedback());
250 } 250 }
251 251
252 252
253 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { 253 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) {
254 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); 254 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode());
255 return OpParameter<LoadNamedParameters>(op); 255 return OpParameter<LoadNamedParameters>(op);
256 } 256 }
257 257
258 258
259 const LoadNamedParameters& LoadGlobalParametersOf(const Operator* op) { 259 bool operator==(LoadGlobalParameters const& lhs,
260 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode()); 260 LoadGlobalParameters const& rhs) {
261 return OpParameter<LoadNamedParameters>(op); 261 return lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback() &&
262 lhs.contextual_mode() == rhs.contextual_mode() &&
263 lhs.slot_index() == rhs.slot_index();
262 } 264 }
263 265
264 266
267 bool operator!=(LoadGlobalParameters const& lhs,
268 LoadGlobalParameters const& rhs) {
269 return !(lhs == rhs);
270 }
271
272
273 size_t hash_value(LoadGlobalParameters const& p) {
274 return base::hash_combine(p.name(), p.contextual_mode(), p.slot_index());
275 }
276
277
278 std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) {
279 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode()
280 << ", slot: " << p.slot_index();
281 }
282
283
284 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) {
285 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode());
286 return OpParameter<LoadGlobalParameters>(op);
287 }
288
289
290 bool operator==(StoreGlobalParameters const& lhs,
291 StoreGlobalParameters const& rhs) {
292 return lhs.language_mode() == rhs.language_mode() &&
293 lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback() &&
294 lhs.slot_index() == rhs.slot_index();
295 }
296
297
298 bool operator!=(StoreGlobalParameters const& lhs,
299 StoreGlobalParameters const& rhs) {
300 return !(lhs == rhs);
301 }
302
303
304 size_t hash_value(StoreGlobalParameters const& p) {
305 return base::hash_combine(p.language_mode(), p.name(), p.feedback(),
306 p.slot_index());
307 }
308
309
310 std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) {
311 return os << p.language_mode() << ", " << Brief(*p.name().handle())
312 << ", slot: " << p.slot_index();
313 }
314
315
316 const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) {
317 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode());
318 return OpParameter<StoreGlobalParameters>(op);
319 }
320
321
265 bool operator==(StoreNamedParameters const& lhs, 322 bool operator==(StoreNamedParameters const& lhs,
266 StoreNamedParameters const& rhs) { 323 StoreNamedParameters const& rhs) {
267 return lhs.language_mode() == rhs.language_mode() && 324 return lhs.language_mode() == rhs.language_mode() &&
268 lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback(); 325 lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback();
269 } 326 }
270 327
271 328
272 bool operator!=(StoreNamedParameters const& lhs, 329 bool operator!=(StoreNamedParameters const& lhs,
273 StoreNamedParameters const& rhs) { 330 StoreNamedParameters const& rhs) {
274 return !(lhs == rhs); 331 return !(lhs == rhs);
275 } 332 }
276 333
277 334
278 size_t hash_value(StoreNamedParameters const& p) { 335 size_t hash_value(StoreNamedParameters const& p) {
279 return base::hash_combine(p.language_mode(), p.name(), p.feedback()); 336 return base::hash_combine(p.language_mode(), p.name(), p.feedback());
280 } 337 }
281 338
282 339
283 std::ostream& operator<<(std::ostream& os, StoreNamedParameters const& p) { 340 std::ostream& operator<<(std::ostream& os, StoreNamedParameters const& p) {
284 return os << p.language_mode() << ", " << Brief(*p.name().handle()); 341 return os << p.language_mode() << ", " << Brief(*p.name().handle());
285 } 342 }
286 343
287 344
288 const StoreNamedParameters& StoreNamedParametersOf(const Operator* op) { 345 const StoreNamedParameters& StoreNamedParametersOf(const Operator* op) {
289 DCHECK_EQ(IrOpcode::kJSStoreNamed, op->opcode()); 346 DCHECK_EQ(IrOpcode::kJSStoreNamed, op->opcode());
290 return OpParameter<StoreNamedParameters>(op); 347 return OpParameter<StoreNamedParameters>(op);
291 } 348 }
292 349
293 350
294 const StoreNamedParameters& StoreGlobalParametersOf(const Operator* op) {
295 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode());
296 return OpParameter<StoreNamedParameters>(op);
297 }
298
299
300 bool operator==(StorePropertyParameters const& lhs, 351 bool operator==(StorePropertyParameters const& lhs,
301 StorePropertyParameters const& rhs) { 352 StorePropertyParameters const& rhs) {
302 return lhs.language_mode() == rhs.language_mode() && 353 return lhs.language_mode() == rhs.language_mode() &&
303 lhs.feedback() == rhs.feedback(); 354 lhs.feedback() == rhs.feedback();
304 } 355 }
305 356
306 357
307 bool operator!=(StorePropertyParameters const& lhs, 358 bool operator!=(StorePropertyParameters const& lhs,
308 StorePropertyParameters const& rhs) { 359 StorePropertyParameters const& rhs) {
309 return !(lhs == rhs); 360 return !(lhs == rhs);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 return new (zone()) Operator1<LanguageMode>( // -- 612 return new (zone()) Operator1<LanguageMode>( // --
562 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode 613 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode
563 "JSDeleteProperty", // name 614 "JSDeleteProperty", // name
564 2, 1, 1, 1, 1, 2, // counts 615 2, 1, 1, 1, 1, 2, // counts
565 language_mode); // parameter 616 language_mode); // parameter
566 } 617 }
567 618
568 619
569 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name, 620 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name,
570 const VectorSlotPair& feedback, 621 const VectorSlotPair& feedback,
571 ContextualMode contextual_mode) { 622 ContextualMode contextual_mode,
572 LoadNamedParameters parameters(name, feedback, SLOPPY, contextual_mode); 623 int slot_index) {
573 return new (zone()) Operator1<LoadNamedParameters>( // -- 624 LoadGlobalParameters parameters(name, feedback, contextual_mode, slot_index);
625 return new (zone()) Operator1<LoadGlobalParameters>( // --
574 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode 626 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode
575 "JSLoadGlobal", // name 627 "JSLoadGlobal", // name
576 2, 1, 1, 1, 1, 2, // counts 628 3, 1, 1, 1, 1, 2, // counts
577 parameters); // parameter 629 parameters); // parameter
578 } 630 }
579 631
580 632
581 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, 633 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode,
582 const Unique<Name>& name, 634 const Unique<Name>& name,
583 const VectorSlotPair& feedback) { 635 const VectorSlotPair& feedback,
584 StoreNamedParameters parameters(language_mode, feedback, name); 636 int slot_index) {
585 return new (zone()) Operator1<StoreNamedParameters>( // -- 637 StoreGlobalParameters parameters(language_mode, feedback, name, slot_index);
638 return new (zone()) Operator1<StoreGlobalParameters>( // --
586 IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode 639 IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode
587 "JSStoreGlobal", // name 640 "JSStoreGlobal", // name
588 3, 1, 1, 0, 1, 2, // counts 641 4, 1, 1, 0, 1, 2, // counts
589 parameters); // parameter 642 parameters); // parameter
590 } 643 }
591 644
592 645
593 const Operator* JSOperatorBuilder::LoadContext(size_t depth, size_t index, 646 const Operator* JSOperatorBuilder::LoadContext(size_t depth, size_t index,
594 bool immutable) { 647 bool immutable) {
595 ContextAccess access(depth, index, immutable); 648 ContextAccess access(depth, index, immutable);
596 return new (zone()) Operator1<ContextAccess>( // -- 649 return new (zone()) Operator1<ContextAccess>( // --
597 IrOpcode::kJSLoadContext, // opcode 650 IrOpcode::kJSLoadContext, // opcode
598 Operator::kNoWrite | Operator::kNoThrow, // flags 651 Operator::kNoWrite | Operator::kNoThrow, // flags
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 return new (zone()) Operator1<Unique<String>>( // -- 725 return new (zone()) Operator1<Unique<String>>( // --
673 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode 726 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
674 "JSCreateCatchContext", // name 727 "JSCreateCatchContext", // name
675 2, 1, 1, 1, 1, 2, // counts 728 2, 1, 1, 1, 1, 2, // counts
676 name); // parameter 729 name); // parameter
677 } 730 }
678 731
679 } // namespace compiler 732 } // namespace compiler
680 } // namespace internal 733 } // namespace internal
681 } // namespace v8 734 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698