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

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

Issue 1185343005: Revert of Revert of [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 size_t hash_value(ResolvedFeedbackSlot const& p) { 184 size_t hash_value(ResolvedFeedbackSlot const& p) {
185 base::hash<int> h; 185 base::hash<int> h;
186 return h(p.slot().ToInt()); 186 return h(p.slot().ToInt());
187 } 187 }
188 188
189 189
190 bool operator==(LoadNamedParameters const& lhs, 190 bool operator==(LoadNamedParameters const& lhs,
191 LoadNamedParameters const& rhs) { 191 LoadNamedParameters const& rhs) {
192 return lhs.name() == rhs.name() && 192 return lhs.name() == rhs.name() &&
193 lhs.language_mode() == rhs.language_mode() &&
193 lhs.contextual_mode() == rhs.contextual_mode() && 194 lhs.contextual_mode() == rhs.contextual_mode() &&
194 lhs.feedback() == rhs.feedback(); 195 lhs.feedback() == rhs.feedback();
195 } 196 }
196 197
197 198
198 bool operator!=(LoadNamedParameters const& lhs, 199 bool operator!=(LoadNamedParameters const& lhs,
199 LoadNamedParameters const& rhs) { 200 LoadNamedParameters const& rhs) {
200 return !(lhs == rhs); 201 return !(lhs == rhs);
201 } 202 }
202 203
203 204
204 size_t hash_value(LoadNamedParameters const& p) { 205 size_t hash_value(LoadNamedParameters const& p) {
205 return base::hash_combine(p.name(), p.contextual_mode(), p.feedback()); 206 return base::hash_combine(p.name(), p.language_mode(), p.contextual_mode(),
207 p.feedback());
206 } 208 }
207 209
208 210
209 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { 211 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) {
210 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode(); 212 return os << Brief(*p.name().handle()) << ", " << p.language_mode() << ", "
213 << p.contextual_mode();
211 } 214 }
212 215
213 216
214 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { 217 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) {
215 // Nothing special to print. 218 return os << p.language_mode();
216 return os;
217 } 219 }
218 220
219 221
220 bool operator==(LoadPropertyParameters const& lhs, 222 bool operator==(LoadPropertyParameters const& lhs,
221 LoadPropertyParameters const& rhs) { 223 LoadPropertyParameters const& rhs) {
222 return lhs.feedback() == rhs.feedback(); 224 return lhs.language_mode() == rhs.language_mode() &&
225 lhs.feedback() == rhs.feedback();
223 } 226 }
224 227
225 228
226 bool operator!=(LoadPropertyParameters const& lhs, 229 bool operator!=(LoadPropertyParameters const& lhs,
227 LoadPropertyParameters const& rhs) { 230 LoadPropertyParameters const& rhs) {
228 return !(lhs == rhs); 231 return !(lhs == rhs);
229 } 232 }
230 233
231 234
232 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) { 235 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op) {
233 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode()); 236 DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode());
234 return OpParameter<LoadPropertyParameters>(op); 237 return OpParameter<LoadPropertyParameters>(op);
235 } 238 }
236 239
237 240
238 size_t hash_value(LoadPropertyParameters const& p) { 241 size_t hash_value(LoadPropertyParameters const& p) {
239 return hash_value(p.feedback()); 242 return base::hash_combine(p.language_mode(), p.feedback());
240 } 243 }
241 244
242 245
243 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { 246 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) {
244 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); 247 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode());
245 return OpParameter<LoadNamedParameters>(op); 248 return OpParameter<LoadNamedParameters>(op);
246 } 249 }
247 250
248 251
249 bool operator==(StoreNamedParameters const& lhs, 252 bool operator==(StoreNamedParameters const& lhs,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 return new (zone()) Operator1<int>( // -- 455 return new (zone()) Operator1<int>( // --
453 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode 456 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode
454 "JSCallConstruct", // name 457 "JSCallConstruct", // name
455 arguments, 1, 1, 1, 1, 2, // counts 458 arguments, 1, 1, 1, 1, 2, // counts
456 arguments); // parameter 459 arguments); // parameter
457 } 460 }
458 461
459 462
460 const Operator* JSOperatorBuilder::LoadNamed( 463 const Operator* JSOperatorBuilder::LoadNamed(
461 const Unique<Name>& name, const ResolvedFeedbackSlot& feedback, 464 const Unique<Name>& name, const ResolvedFeedbackSlot& feedback,
462 ContextualMode contextual_mode) { 465 LanguageMode language_mode, ContextualMode contextual_mode) {
463 LoadNamedParameters parameters(name, feedback, contextual_mode); 466 LoadNamedParameters parameters(name, feedback, language_mode,
467 contextual_mode);
464 return new (zone()) Operator1<LoadNamedParameters>( // -- 468 return new (zone()) Operator1<LoadNamedParameters>( // --
465 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode 469 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode
466 "JSLoadNamed", // name 470 "JSLoadNamed", // name
467 2, 1, 1, 1, 1, 2, // counts 471 2, 1, 1, 1, 1, 2, // counts
468 parameters); // parameter 472 parameters); // parameter
469 } 473 }
470 474
471 475
472 const Operator* JSOperatorBuilder::LoadProperty( 476 const Operator* JSOperatorBuilder::LoadProperty(
473 const ResolvedFeedbackSlot& feedback) { 477 const ResolvedFeedbackSlot& feedback, LanguageMode language_mode) {
474 LoadPropertyParameters parameters(feedback); 478 LoadPropertyParameters parameters(feedback, language_mode);
475 return new (zone()) Operator1<LoadPropertyParameters>( // -- 479 return new (zone()) Operator1<LoadPropertyParameters>( // --
476 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode 480 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode
477 "JSLoadProperty", // name 481 "JSLoadProperty", // name
478 3, 1, 1, 1, 1, 2, // counts 482 3, 1, 1, 1, 1, 2, // counts
479 parameters); // parameter 483 parameters); // parameter
480 } 484 }
481 485
482 486
483 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, 487 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
484 const Unique<Name>& name) { 488 const Unique<Name>& name) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 return new (zone()) Operator1<Unique<String>>( // -- 586 return new (zone()) Operator1<Unique<String>>( // --
583 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode 587 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
584 "JSCreateCatchContext", // name 588 "JSCreateCatchContext", // name
585 2, 1, 1, 1, 1, 2, // counts 589 2, 1, 1, 1, 1, 2, // counts
586 name); // parameter 590 name); // parameter
587 } 591 }
588 592
589 } // namespace compiler 593 } // namespace compiler
590 } // namespace internal 594 } // namespace internal
591 } // namespace v8 595 } // 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