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

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

Issue 1199983002: [strong] Implement strong property access semantics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add TODOs 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/full-codegen.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"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) { 187 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) {
188 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode()); 188 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode());
189 return OpParameter<DynamicContextAccess>(op); 189 return OpParameter<DynamicContextAccess>(op);
190 } 190 }
191 191
192 192
193 bool operator==(LoadNamedParameters const& lhs, 193 bool operator==(LoadNamedParameters const& lhs,
194 LoadNamedParameters const& rhs) { 194 LoadNamedParameters const& rhs) {
195 return lhs.name() == rhs.name() && 195 return lhs.name() == rhs.name() &&
196 lhs.language_mode() == rhs.language_mode() &&
196 lhs.contextual_mode() == rhs.contextual_mode() && 197 lhs.contextual_mode() == rhs.contextual_mode() &&
197 lhs.feedback() == rhs.feedback(); 198 lhs.feedback() == rhs.feedback();
198 } 199 }
199 200
200 201
201 bool operator!=(LoadNamedParameters const& lhs, 202 bool operator!=(LoadNamedParameters const& lhs,
202 LoadNamedParameters const& rhs) { 203 LoadNamedParameters const& rhs) {
203 return !(lhs == rhs); 204 return !(lhs == rhs);
204 } 205 }
205 206
206 207
207 size_t hash_value(LoadNamedParameters const& p) { 208 size_t hash_value(LoadNamedParameters const& p) {
208 return base::hash_combine(p.name(), p.contextual_mode(), p.feedback()); 209 return base::hash_combine(p.name(), p.language_mode(), p.contextual_mode(),
210 p.feedback());
209 } 211 }
210 212
211 213
212 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { 214 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) {
213 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode(); 215 return os << Brief(*p.name().handle()) << ", " << p.language_mode() << ", "
216 << p.contextual_mode();
214 } 217 }
215 218
216 219
217 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { 220 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) {
218 // Nothing special to print. 221 return os << p.language_mode();
219 return os;
220 } 222 }
221 223
222 224
223 bool operator==(LoadPropertyParameters const& lhs, 225 bool operator==(LoadPropertyParameters const& lhs,
224 LoadPropertyParameters const& rhs) { 226 LoadPropertyParameters const& rhs) {
225 return lhs.feedback() == rhs.feedback(); 227 return lhs.language_mode() == rhs.language_mode() &&
228 lhs.feedback() == rhs.feedback();
226 } 229 }
227 230
228 231
229 bool operator!=(LoadPropertyParameters const& lhs, 232 bool operator!=(LoadPropertyParameters const& lhs,
230 LoadPropertyParameters const& rhs) { 233 LoadPropertyParameters const& rhs) {
231 return !(lhs == rhs); 234 return !(lhs == rhs);
232 } 235 }
233 236
234 237
235 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) { 238 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) {
236 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode()); 239 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode());
237 return OpParameter<LoadPropertyParameters>(op); 240 return OpParameter<LoadPropertyParameters>(op);
238 } 241 }
239 242
240 243
241 size_t hash_value(LoadPropertyParameters const& p) { 244 size_t hash_value(LoadPropertyParameters const& p) {
242 return hash_value(p.feedback()); 245 return base::hash_combine(p.language_mode(), p.feedback());
243 } 246 }
244 247
245 248
246 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { 249 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) {
247 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); 250 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode());
248 return OpParameter<LoadNamedParameters>(op); 251 return OpParameter<LoadNamedParameters>(op);
249 } 252 }
250 253
251 254
252 const LoadNamedParameters& LoadGlobalParametersOf(const Operator* op) { 255 const LoadNamedParameters& LoadGlobalParametersOf(const Operator* op) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { 498 const Operator* JSOperatorBuilder::CallConstruct(int arguments) {
496 return new (zone()) Operator1<int>( // -- 499 return new (zone()) Operator1<int>( // --
497 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode 500 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode
498 "JSCallConstruct", // name 501 "JSCallConstruct", // name
499 arguments, 1, 1, 1, 1, 2, // counts 502 arguments, 1, 1, 1, 1, 2, // counts
500 arguments); // parameter 503 arguments); // parameter
501 } 504 }
502 505
503 506
504 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, 507 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name,
505 const VectorSlotPair& feedback) { 508 const VectorSlotPair& feedback,
506 LoadNamedParameters parameters(name, feedback, NOT_CONTEXTUAL); 509 LanguageMode language_mode) {
510 LoadNamedParameters parameters(name, feedback, language_mode, NOT_CONTEXTUAL);
507 return new (zone()) Operator1<LoadNamedParameters>( // -- 511 return new (zone()) Operator1<LoadNamedParameters>( // --
508 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode 512 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode
509 "JSLoadNamed", // name 513 "JSLoadNamed", // name
510 2, 1, 1, 1, 1, 2, // counts 514 2, 1, 1, 1, 1, 2, // counts
511 parameters); // parameter 515 parameters); // parameter
512 } 516 }
513 517
514 518
515 const Operator* JSOperatorBuilder::LoadProperty( 519 const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback,
516 const VectorSlotPair& feedback) { 520 LanguageMode language_mode) {
517 LoadPropertyParameters parameters(feedback); 521 LoadPropertyParameters parameters(feedback, language_mode);
518 return new (zone()) Operator1<LoadPropertyParameters>( // -- 522 return new (zone()) Operator1<LoadPropertyParameters>( // --
519 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode 523 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode
520 "JSLoadProperty", // name 524 "JSLoadProperty", // name
521 3, 1, 1, 1, 1, 2, // counts 525 3, 1, 1, 1, 1, 2, // counts
522 parameters); // parameter 526 parameters); // parameter
523 } 527 }
524 528
525 529
526 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, 530 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
527 const Unique<Name>& name, 531 const Unique<Name>& name,
(...skipping 23 matching lines...) Expand all
551 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode 555 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode
552 "JSDeleteProperty", // name 556 "JSDeleteProperty", // name
553 2, 1, 1, 1, 1, 2, // counts 557 2, 1, 1, 1, 1, 2, // counts
554 language_mode); // parameter 558 language_mode); // parameter
555 } 559 }
556 560
557 561
558 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name, 562 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name,
559 const VectorSlotPair& feedback, 563 const VectorSlotPair& feedback,
560 ContextualMode contextual_mode) { 564 ContextualMode contextual_mode) {
561 LoadNamedParameters parameters(name, feedback, contextual_mode); 565 LoadNamedParameters parameters(name, feedback, SLOPPY, contextual_mode);
562 return new (zone()) Operator1<LoadNamedParameters>( // -- 566 return new (zone()) Operator1<LoadNamedParameters>( // --
563 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode 567 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode
564 "JSLoadGlobal", // name 568 "JSLoadGlobal", // name
565 2, 1, 1, 1, 1, 2, // counts 569 2, 1, 1, 1, 1, 2, // counts
566 parameters); // parameter 570 parameters); // parameter
567 } 571 }
568 572
569 573
570 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, 574 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode,
571 const Unique<Name>& name, 575 const Unique<Name>& name,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 return new (zone()) Operator1<Unique<String>>( // -- 665 return new (zone()) Operator1<Unique<String>>( // --
662 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode 666 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
663 "JSCreateCatchContext", // name 667 "JSCreateCatchContext", // name
664 2, 1, 1, 1, 1, 2, // counts 668 2, 1, 1, 1, 1, 2, // counts
665 name); // parameter 669 name); // parameter
666 } 670 }
667 671
668 } // namespace compiler 672 } // namespace compiler
669 } // namespace internal 673 } // namespace internal
670 } // namespace v8 674 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698